Reputation: 7151
I have the following configuration in my .vimrc
in OSX under MacVim.
let mapleader = ','
nnoremap <leader>af :Autoformat<CR> " autoformat document
nnoremap <leader>ig :IndentGuidesToggle<CR> " indent guides toggle
nnoremap <leader>nt :NERDTreeToggle<CR> " nerd tree toggle
nnoremap <leader>tb :TagbarToggle<CR> " tagbar toggle
The commands work fine, but when I use them, the terminal beeps the sound for error and the cursor moves position about 4 lines. This happens both when using Vim in iTerm2 and in GVim.
Any idea why this is happening and how to fix it?
Upvotes: 2
Views: 403
Reputation: 45107
Do not put comments on the same line as your mappings as the comments will be executed.
let mapleader = ','
" autoformat document
nnoremap <leader>af :Autoformat<CR>
" indent guides toggle
nnoremap <leader>ig :IndentGuidesToggle<CR>
" nerd tree toggle
nnoremap <leader>nt :NERDTreeToggle<CR>
nnoremap <leader>tb :TagbarToggle<CR>
You may want to look at idiomatic-vimrc for basic do's and don't's for your vimrc
.
Upvotes: 6