Vim delimitMate

In DelimitMate, it automatically creates closing parentheses. When I finished typing in a parenthesis, what key strokes do I click to quickly jump to the right of the closing parenthesis? (Right now I need to manually press ESC, then "a")

+7
source share
8 answers

You can create a custom map. You probably want to go to the right of the closing parenthesis while you are in insert mode. Just add to this .vimrc this mapping:

 :inoremap <F8> <ESC>f)a 

Thus, while you are in insert mode , and you have finished writing inside the brackets, F8 will cause your cursor to have the right to close the parenthesis. If you want, you can change the displayed key using a different key instead of F8 .

As Kent said in a comment, a more general solution would be to:

 :inoremap <F8> <ESC>%%a 

What will work in brackets [ and { .

+4
source

The idea behind these automatic closing plugins (for example, the implementation of the original function found in the IDE, such as Eclipse) is that you simply enter the closing character to go through it. The plugin should detect this situation and instead of inserting character transitions on top of the existing, automatically inserted.

If this does not work for you, there are several plugin alternatives. Vim Tips Wiki has a list of them.

+9
source

With delimitMate , the Shift-tab jump out of the current delimiter, and Control-g g will take you out of the nested delimiters. There is no need to reassign anything.

+7
source

You can try Fly Mode fleets

eg:

 ( hello| world ) press ) at | ( hello world )| 

If the transition is incorrect, use <Mb> to perform a backward insert.

eg:

 (hello| world() press ) at | (hello world()| press <Mb> (hello)| world() 

Repository: https://github.com/jiangmiao/auto-pairs

Plugin: http://www.vim.org/scripts/script.php?script_id=3599

add

 let g:AutoPairsFlyMode=1 

in .vimrc to enable Fly mode

+4
source

I agree with Atropo on this: if you want to stick with DelimitMate, then the least disruption to your workflow could be to make a custom imap to access the other side of the automatically inserted character.

Personally, I prefer to control more where / when characters are automatically inserted, and how I can navigate through automatically inserted characters; UltiSnips or SnipMate does this for me. Perhaps they are more than what you are looking for.

+1
source

If you are typing on a new line, try A , which will add text at the end of the line.

0
source

I have autoClose installed. what i am doing now ("I" is the cursor)

 - (xxxxI) - ( xxxxI ) - ( xxxxIxx ) - text (xxxxI) other text - text ( xxxxI ) other text - text ( xxxxIxx ) other text 

I just do the matching, <esc>%%a , then in this case the cursor will move to (...)I..whatever

it does not work for quotes.

0
source

A little late to the party, but note that this can be easily done without any user mappings. In insert mode, you can press <CO> (default mapping) to enter normal single shot mode, where you can enter one normal mode command.

To answer your question, what you can do is <CO>a .

0
source

All Articles