Vim: Leader not working

ぃ、小莉子 提交于 2019-12-10 15:11:32

问题


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?


回答1:


Try to clear a content of ~/.viminfo file and if you are using a session plugin -- clear a session data in generated file. Then restart Vim. It helps me sometimes when I experiment with different settings, mappings etc.




回答2:


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



回答3:


After uninstalling Vim, removing all plugin and config files and reinstalling it, the Leader works just fine. Unfortunately, i don't know what exactly caused Vim to ignore the Leader.




回答4:


If you have a mapping like this in your .vimrc,

nmap <Leader>rf @<Plug>Tex_RefreshFolds

then the output of nmap (without arguments) should be this:

n  \rf   @<Plug>Tex_RefreshFolds

In other words, "<Leader>" should be expanded to "\". Since this is not the case for you, something is going wrong with your mapping. This could be caused by having "<" in your cpoptions. Try set cpoptions? to check.



来源:https://stackoverflow.com/questions/11560294/vim-leader-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!