我可以在 VIM 中使用 SPACE 作为映射器吗?

http://items.sjbach.com/319/configuring-vim-right我得到,你应该能够使用 Space作为地图领导者在 vim。我试过了,但好像没用。有人成功过吗?

试过:

let mapleader = <space>
61991 次浏览

Try the following instead:

let mapleader=" "

And remember to write the following line before that, to make sure spacebar doesn't have any mapping beforehand:

nnoremap <SPACE> <Nop>

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>

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.

nnoremap <space> <Nop>
nnoremap <nowait> <space> /