wrapping a bash variable name in quotes #2544
Contributing guidelines
Module(s)mini.ai, mini.surround QuestionOne problem I'm regularly running into while maintaining bash scripts is a quick keystroke to surround a bash variable use in quotes. I have a neovim configuration mostly built around the mini modules so I'd be happy to add this config in the most mini-way possible. I think what I need to do is write a mini.ai custom_textobject pattern that matches Has anyone done this before, or is there a simpler solution that I'm not seeing? Apologies if this is the wrong forum for a question like this, but I'm struggling to put together the pieces to solve this problem. |
Replies: 1 comment 2 replies
This indeed sounds like a correct direction: 1) create a custom 'mini.ai' textobject, like with Here is how to create a custom 'mini.ai' textobject that would be active only in files with
Now opening the file with Surrounding now is done by the following sequence: vim.keymap.set('n', '<Leader>v', 'saav"', { buf = 0, remap = true })Hope this helps!
This is absolutely the intended use of the |
This indeed sounds like a correct direction: 1) create a custom 'mini.ai' textobject, like with
v(variable) identifier; 2) use 'mini.surround'addmapping to surround the whole variable.Here is how to create a custom 'mini.ai' textobject that would be active only in files with
shfiletype (which bash scripts mostly are):Create a file
~/.config/after/ftplugin/sh.lua. This is a filetype plugin for forshfiletype. I'd also probably recommend copying …