Solved How do I get inoremap work in vim?

Hi,

Helps are appreciated.
I couldn't get something like following lines in ~/.vimrc work. I'm learning maily C, Cpp, python. I don't need super fancy functions at this point, but brackets (including []{}()<>'") auto completions would be really nice if native built-in feature works out for me. All of the basic tips on the internet tell me to use "inoremap". Tried following lines and other alternatives but they don't seem work at all - simply, when I hit { I don't get its pair }.

Code:
inoremap { {}<ESC>i<left>
inoremap {<CR> {<CR>}<ESC>O
inoremap {{ {
inoremap {} {}

I do have following line in ~/.vimrc,
Code:
set completeopt=longest,menu
if it matters.

Any clue, or are there conflicts caused by some plugins I installed? I sense it is like an on/off button that can easily enable these "inoremap" mappings.
 
there are some projects that already have indentation all ready for you to put in your vimrc on github. search google vim for programming
 
Answering my own question.

It turns out the problem is with the system wide vimrc /usr/local/etc/vim/vimrc that I tweaked not long ago, which I think overrides ~/.vimrc. I just replaced the system wide vimrc with default one now the auto completion in ~/.vimrc works as desired.

By the way, removing <left> from first line of inoremap is better.
 
Back
Top