I followed the guide here to create vim mapppings. Put the following in my .vimrc
file
let mapleader=','
if exists(":Tabularize")
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
endif
The page says when I type ,a=
it should tell Tabularize to align my lines. But instead it inserts the character =
where the cursor is.
I have Tabularize installed and the :Tabularize
command does work when I call it without mapping.
What am I doing wrong?
To map keys that work only in the insert and replace modes, use the 'imap' or 'inoremap' command. To remove a keymap from insert mode, use the ':iunmap' command. For example, the following command removes the insert mode map for <F2>.
Use :map! and :map for manually set keys and :help 'char(-combination)' to find out which keys are already mapped in vim out-of-the-box(/out of your specific compiling options).
By Vim, I mean literally Vim, the command-line text editor. And by bindings, I mean keyboard commands that do specific things in the editor.
Your .vimrc
file is read and executed before plugins are loaded, so :Tabularize
isn't defined.
To find out the exact order in which the various scripts are called at startup you can run the command:
:scriptnames
and you can learn the details about the initialization process with:
:help startup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With