IdeaVim,多光标用法

时间:2019-03-17 00:26:19

标签: webstorm jetbrains-ide rubymine ideavim multiple-cursor

我正在尝试触发(使用)IdeaVim多光标插件:https://github.com/JetBrains/ideavim#emulated-vim-plugins->多光标

在github文档中,我们有以下命令:<A-n><A-x><A-p>g<A-n>来触发/使用此插件,但是我无法做到这一点插件完全起作用...

我已经在.id​​eavimrc set multiple-cursors中添加了

我想念什么吗?

我正在使用OSX(如果很重要)。

3 个答案:

答案 0 :(得分:9)

如其他答案所述,macOS 将 <A-n> 视为“死键”,以便输入重音字符,例如 ñ (<A-n>n)。似乎不可能以编程方式禁用此功能,您必须使用替代键盘输入源来解决此问题。

然而,<A-n> 键不是 IdeaVim 的 multiple-cursors 所基于的扩展程序使用的键 (terryma/vim-multiple-cursors)。我不确定它们来自哪里,但是 vim-multiple-cursors 使用 <C-n><C-p><C-x> 并且只使用 <A-n> 来选择所有出现的地方,这是不同的到 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+ 来解决“选择所有出现”的 <A-n> 问题n:

" 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

答案 1 :(得分:2)

OSX具有映射到选项 + 的特殊字符。例如,您应该使用this禁用它们。

在那之后写下这段文字:

Hello world!
Hello world!
Hello world!
Hello world!

将插入符放在Hello上,然后按<A-n>几次。应该为每个单词选择所有Hello,并选择一个插入符号。

答案 2 :(得分:0)

是的,tnx提醒了我!

实际上,现在在OSX Mojave中,我们只需在键盘输入源enter image description here中选择Unicode Hex Input

就是这样...现在一切正常,并且在(alt / option +)输入上禁用了特殊字符,并且我可以毫无问题地使用所有快捷方式:)