Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: Leader not working

Tags:

vim

leader

When trying to use vim-latexsuite's mappings, the ones using Leader are not working:

:nmap
----------------------------------------
n  <Leader>rf   @<Plug>Tex_RefreshFolds
n  <Leader>ls   @<Plug>Tex_ForwardSearch
n  <Leader>lv   @<Plug>Tex_View
n  <Leader>ll   @<Plug>Tex_Compile

All other mappings by this plugin are working, so the plugin is being loaded correctly. Without mapleader being set, Leader should default to \ (Backslash).

When typing \ll in command mode, the cursor gets moved 2 characters to the right, as it's supposed to by just typing ll. So the Backslash seems to be ignored. Vim does not beep or display any errors and the ll follows earlier than 1000ms, which is my timeoutlen.

I have also tried the following settings in both .vimrc and /etc/vimrc (Though I assume only mapleader needs to be set here):

let mapleader = ","
let maplocalleader = ","

After this, Vim behaves the same way: No beep, no error and after typing ,ll the cursor moves 2 characters to the right.

Any ideas how to fix this?

like image 418
J0hn D0e Avatar asked Jul 19 '12 11:07

J0hn D0e


People also ask

How do I map a leader in Vim?

The "Leader key" is a way of extending the power of VIM's shortcuts by using sequences of keys to perform a command. The default leader key is backslash. Therefore, if you have a map of <Leader>Q, you can perform that action by typing \Q.

What is a leader Vim?

The leader key provides a facility for creating customized shortcuts that can be further restricted to apply only in certain modes, such as normal, insert, visual, terminal (neovim-specific), etc. The leader key is normally defined by the mapleader variable as \ . Many people like to redefine it to , .


1 Answers

If you've shortened timeoutlen, you won't be able to type quickly enough. If you look at :help 'ttimeoutlen', you'll see it suggests:

:set timeout timeoutlen=3000 ttimeoutlen=100
like image 66
neptunepink Avatar answered Oct 19 '22 00:10

neptunepink