简体   繁体   English

如何使用带有 y/c/d 命令的 vim 简易运动插件运动?

[英]How to use vim easy motion plugin movements with y/c/d commands?

I am using easymotion plugin ( https://github.com/easymotion/vim-easymotion ) with vim.我正在使用带有 vim 的 easymotion 插件( https://github.com/easymotion/vim-easymotion )。 If you use f/F motions in VIM (with easymotion plugin), easy motion highlights all possible positions when there are multiple matches, that way you can easily jump to the position you want.如果您在 VIM 中使用 f/F 动作(使用 easymotion 插件),当有多个匹配项时,easymotion 会突出显示所有可能的位置,这样您就可以轻松跳转到您想要的位置。

But it doesn't work with y/c/d commands, how can I achive that ?但它不适用于 y/c/d 命令,我怎样才能做到这一点? I have provided an example below for clarification:我在下面提供了一个示例以供说明:

This is some line.

Say I am working on the above line in vim and the cursor is at the i in "This".假设我正在 vim 中处理上述行,并且光标位于“This”中的 i 处。 If I do "yfs" in vim, I would like easy motion to mark the three "s"s present to the right of the cursor.如果我在 vim 中执行“yfs”,我希望轻松移动以标记光标右侧的三个“s”。 That way, I can easily yank/change/delete upto the s I want.这样,我可以轻松地猛拉/更改/删除我想要的 s。

Thanks in advance !提前致谢 !

You can, use something like this in your .vimrc:你可以在你的 .vimrc 中使用这样的东西:

" Find next occurence of a char using easymotion
map  <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)

Now you can do something like y<Leader>fs and it will highlight the three s-characters.现在您可以执行类似y<Leader>fs ,它会突出显示三个 s 字符。 Selecting one will then yank from your cursor's position to that character.然后选择一个将从光标位置猛拉到该字符。

If this does not work如果这不起作用

This means that there are other key bindings that are using the same combination.这意味着还有其他键绑定使用相同的组合。 You can check this with :map and then look for the key combination you are trying to map to the easy-motion.您可以使用:map进行检查,然后查找您尝试映射到 easy-motion 的组合键。 Removing that keybinding from your .vimrc or removing the plugin that created the binding should solve the problem.从您的.vimrc删除该键绑定或删除创建绑定的插件应该可以解决问题。

If it's the YankRing plugin that's hijacking the y/c/d keystrokes, you can add the following to your vimrc to prevent it from doing that (Check :h yankring for more info):如果是 YankRing 插件劫持了 y/c/d 按键,您可以将以下内容添加到您的 vimrc 中以防止它这样做(查看:h yankring了解更多信息):

let g:yankring_zap_keys = ''

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM