Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom search pattern in VIM

In what way I can make sort of a shortcut to parametrized search in vim? So when I invoke (for example) :customsearch foo, I get a search for /bar foo baz$. Or more generally /bar %s baz.

like image 918
JonnyRobbie Avatar asked Jun 28 '26 18:06

JonnyRobbie


1 Answers

Add a command to the vimrc file such as this:

Note that the command must start with a capital letter.

command -nargs=1 Customsearch :
    \ /foo <args> baz
like image 150
Tom Myddeltyn Avatar answered Jul 01 '26 12:07

Tom Myddeltyn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!