Go to close quote / parenthesis when I click a tab in Vim

I played with Vim plugins that automatically close quotes and brackets.

I don’t think that I will continue to use these plugins because sometimes they call me because of their behavior, but I thought it would be a good plugin idea.

Basically the following. When you are inside a block (quotation marks or brackets or something else), clicking a tab leads you to the outside of the block.

Here an example |is the cursor:

(let stuff (+ 1 2|)) ; yo!

; press tab:
(let stuff (+ 1 2)|) ; yo!

; press tab again:
(let stuff (+ 1 2))| ; yo!

I hope this idea works out. There is probably already a plugin or config for this, but I would still be interested to know how to do this.

Quote from my comment below:

-, , , , - ( , ?).

+4
2

:inoremap <expr> <Tab> ..., (, <Right>), ( , , ..)

, search() n, , \%# .

:inoremap <expr> <Tab> search('\%#[]>)}]', 'n') ? '<Right>' : '<Tab>'
+4

, tab, .

imap <tab> <esc>])a

]), , .

tab

nnoremap <tab> ])
+6

Source: https://habr.com/ru/post/1531363/


All Articles