math
math

Reputation: 8820

Is it possible to put a custom prefix and suffix for a word under cursor in VIM?

I have many latin words in my TeX document and wan't them to wrap with a special command \lat{anterior}. So when I move my cursor in VIM above words, is there an efficent way to add a prefix \lat{ and suffix } to the current word? Ideally with a key binding?

Upvotes: 0

Views: 463

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172580

Have a look at the tpope/vim-surround plugin. You can customize it per filetype; see :help surround-customizing:

autocmd FileType tex let b:surround_45 = "\\lat{\r}"

Upvotes: 2

Related Questions