Skip to content
Discussion options

You must be logged in to vote

One problem I'm regularly running into while maintaining bash scripts is a quick keystroke to surround a bash variable use in quotes.
...
I think what I need to do is write a mini.ai custom_textobject pattern that matches $VAR or ${VAR}?

This indeed sounds like a correct direction: 1) create a custom 'mini.ai' textobject, like with v (variable) identifier; 2) use 'mini.surround' add mapping to surround the whole variable.

Here is how to create a custom 'mini.ai' textobject that would be active only in files with sh filetype (which bash scripts mostly are):

  • Create a file ~/.config/after/ftplugin/sh.lua. This is a filetype plugin for for sh filetype. I'd also probably recommend copying …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@rexroof
Comment options

@echasnovski
Comment options

Answer selected by echasnovski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested mini.surround mini.ai
2 participants