簡體   English   中英

Vim和GVim:領導關鍵不起作用

[英]Vim and GVim: leader key not working

我安裝了一些插件,包括NERDCommenter和NERDTree。 但是,我不能讓領導者的鑰匙適合他們。 當我輸入:map時,這些是默認配置

v  \c<Space>     <Plug>NERDCommenterToggle
n  \c<Space>     <Plug>NERDCommenterToggle
v  \cc           <Plug>NERDCommenterComment
n  \cc           <Plug>NERDCommenterComment

\\c<space>就像點擊c<space> 我已經嘗試使用我的主目錄中的.vimrc中的以下內容重新映射領導鍵:

let mapleader = ","

當我重新啟動vim並輸入:map時會反映這一點

v  ,c<Space>     <Plug>NERDCommenterToggle
n  ,c<Space>     <Plug>NERDCommenterToggle
v  ,cc           <Plug>NERDCommenterComment
n  ,cc           <Plug>NERDCommenterComment

但是,c<space>只是表現得像我正在擊中c<space> 發生了什么,我該如何解決這個問題?

編輯 :在VIM中測試它也具有相同的行為。

在加載任何插件之前定義mapleadermaplocalleader鍵。

就在你的.vimrc之上!

我期待,這些映射看起來很有趣

v  <Leader>c<Space>     <Plug>NERDCommenterToggle
n  <Leader>c<Space>     <Plug>NERDCommenterToggle
v  <Leader>cc           <Plug>NERDCommenterComment
n  <Leader>cc           <Plug>NERDCommenterComment

讓他們工作。 我懷疑你在插件加載設置了mapleader

您可能已將超時設置為零。 在那種情況下,vim將不會等待在mapleader之后的密鑰。

:set timeout timeoutlen=0 ttimeoutlen=0

這可能不是大多數人的答案,但可能會幫助少數......

我正在運行debian發行版(在我的情況下是PureOS,雖然特定的味道可能並不完全重要)並且默認的\\ leader鍵映射到<開箱即用。

對我來說,重新映射關鍵代碼是修復:

sudo setkeycodes 56 43

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM