ROMANIA_engineer
ROMANIA_engineer

Reputation: 56704

VIM replaces $1, $2, $3 and $4 with parantheses

When I write a text in VIM (insert mode) it automatically replaces: $1 with (), $2 with [], $3 with {} and $4 with:

{

}

For the other digits (E.g.: $5) it has an expected behavior.

How can I disable this replacement?

Edit:

1) If I type $, the caret remains about 1 second on that character. So, if I wait a little after typing $, it won't replace $1 with anything.

2) Output for :map $1 is:

v  $1          * <Esc>`>a)<Esc>`<i(<Esc> 

3) Output for :imap $1 is:

i  $1          * ()<Esc>i 

4) Output for :nmap $1 is:

No mapping found

5) I use many plugins, but according to the comments/answer, they are not relevant because there are some lines containing inoremap in my ~/.vimrc file.

Details:

Upvotes: 3

Views: 2106

Answers (1)

Ren&#233; Nyffenegger
Ren&#233; Nyffenegger

Reputation: 40553

This is not the default behaviour of vim.

You probably have a map or an insert map for these keystrokes. You can verify this with a

:verbose map $1

or

:verbose nmap $1

which shows what mappings there are.

If this is indeed the case, the first place to look for definitions is in your .vimrc:

:e $MYVIMRC

then search for $1 and/or map in the .vimrc

Alternatively, you might have some plugin that does that.

Edited with the helpful comment of Marth (using verbose to find out where the mapping was defined).

Upvotes: 12

Related Questions