pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/doums/tenaille.nvim

GitHub - doums/tenaille.nvim: nvim plugin to wrap the visual selection in brackets and quotes · GitHub
Skip to content

doums/tenaille.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

tenaille.nvim

Wrap the visual selection in brackets and quotes

Install

As usual using your plugin manager, e.g. lazy.nvim

local P = {
  -- plugin spec
  'doums/tenaille.nvim',
  config = true,
}

Config

local tenaille = require('tenaille')

-- Default config
tenaille.setup({
  -- generate default mapping for each pair using
  -- <leader>_open-character_
  -- i.e.
  -- <leader>" for double quotes ""
  -- <leader>[ for brackets []
  -- <leader>{ for curly braces {} and so on...
  default_mapping = true,
  -- supported brackets and quotes pairs
  -- ⚠ only 2 character pairs are supported
  pairs = {
    { '"', '"' },
    { "'", "'" },
    { '`', '`' },
    { '{', '}' },
    { '[', ']' },
    { '(', ')' },
    { '<', '>' },
  },
})

Usage

Select the text you want to wrap then press the relevant key mapping

before key after
|text| <Leader>[ [|text|]
|text| <Leader>" "|text|"
|[text]| <Leader>( (|text|)
|"text"| <Leader>' '|text|'
|"text"| <Leader>" "|text|"

|…| selection

note: multiline selections are supported

Custom mapping

tenaille.setup({
  -- disable default key mapping
  default_mapping = false,
)}

local wrap = require('tenaille').wrap

vim.keymap.set('v', '"', function() wrap({ '"', '"' }) end)
vim.keymap.set('v', "'", function() wrap({ "'", "'" }) end)
vim.keymap.set('v', '`', function() wrap({ '`', '`' }) end)
vim.keymap.set('v', '(', function() wrap({ '(', ')' }) end)
vim.keymap.set('v', '[', function() wrap({ '[', ']' }) end)
vim.keymap.set('v', '{', function() wrap({ '{', '}' }) end)
vim.keymap.set('v', '<', function() wrap({ '<', '>' }) end)

License

Mozilla Public License 2.0

About

nvim plugin to wrap the visual selection in brackets and quotes

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy