Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

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:

  • editor: VIM - Vi Improved 7.2
  • O.S.: SUSE Linux
like image 965
ROMANIA_engineer Avatar asked Dec 29 '25 05:12

ROMANIA_engineer


1 Answers

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).

like image 106
René Nyffenegger Avatar answered Jan 01 '26 16:01

René Nyffenegger



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!