[英]IdeaVim, multi cursor usage
我正在嘗試觸發(使用)IdeaVim 多光標插件: https : //github.com/JetBrains/ideavim#emulated-vim-plugins -> multiple-cursors
在 github 文檔中,我們有命令: <An>
, <Ax>
, <Ap>
, g<An>
來觸發/使用這個插件,但我根本無法讓這個插件工作......
我已經在我的 .ideavimrc set multiple-cursors
。
我錯過了什么嗎?
我正在使用 OSX(如果這很重要)。
如其他答案中所述,macOS 將<An>
視為“死鍵”,以便輸入重音字符,例如ñ
( <An>n
)。 似乎不可能以編程方式禁用此功能,您必須使用替代鍵盤輸入源來解決此問題。
但是, <An>
鍵不是 IdeaVim 的multiple-cursors
所基於的擴展所使用的鍵( terryma/vim-multiple-cursors )。 我不確定它們來自哪里,但是 vim-multiple-cursors 使用<Cn>
、 <Cp>
和<Cx>
並且只使用<An>
來選擇所有出現的地方,這與 IdeaVim 行為不同。 跟蹤錯誤的鍵映射存在問題 - VIM-2178 。
同時,您可以通過將以下內容添加到您的~/.ideavimrc
來重新映射鍵以匹配 Vim 插件:
" Remap multiple-cursors shortcuts to match terryma/vim-multiple-cursors
nmap <C-n> <Plug>NextWholeOccurrence
xmap <C-n> <Plug>NextWholeOccurrence
nmap g<C-n> <Plug>NextOccurrence
xmap g<C-n> <Plug>NextOccurrence
nmap <C-x> <Plug>SkipOccurrence
xmap <C-x> <Plug>SkipOccurrence
nmap <C-p> <Plug>RemoveOccurrence
xmap <C-p> <Plug>RemoveOccurrence
您可以通過映射到其他內容(例如Shift + Ctrl + n )來解決“選擇所有出現”的<An>
問題:
" Note that the default <A-n> and g<A-n> shortcuts don't work on Mac due to dead keys.
" <A-n> is used to enter accented text e.g. ñ
nmap <S-C-n> <Plug>AllWholeOccurrences
xmap <S-C-n> <Plug>AllWholeOccurrences
nmap g<S-C-n> <Plug>AllOccurrences
xmap g<S-C-n> <Plug>AllOccurrences
OSX 具有映射到option + key 的特殊字符。 例如,您應該使用它禁用它們。
之后寫下這段文字:
Hello world!
Hello world!
Hello world!
Hello world!
將脫字符放在Hello
並按<An>
幾次。 All Hello
應該被選中,每個單詞都有一個單獨的插入符號。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.