Can I use SPACE as mapleader in VIM?

偶尔善良 提交于 2019-11-29 10:30:41

问题


From http://items.sjbach.com/319/configuring-vim-right I got that you were supposed to be able to use Space as the mapleader in vim. I've tried but it does not seem to work. Anyone who have made it work?

Tried:

let mapleader = <space>

回答1:


Try the following instead:

let mapleader=" "



回答2:


Mapleader is a Vim string variable. To use space as leader, you must escape the special character.

let mapleader = "\<Space>"

For more info see,

http://vimdoc.sourceforge.net/htmldoc/eval.html#expr-quote

EDIT:

This no longer works for me in my version of Vim. Even with the suggestion in the comments of unmapping the spacebar in normal mode by running nnoremap <SPACE> <Nop>.

I ending up going with the solution given in the answer below.

map <Space> <Leader>



回答3:


The above solutions are great, however, nothing shows up in the bottom right command corner. If you don't have any use for the \ key anyway, try using map <SPACE> <leader> and \ will show up in the command corner. That and you don't have to unmap space first, as suggested in the commends above.



来源:https://stackoverflow.com/questions/446269/can-i-use-space-as-mapleader-in-vim

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