dr *_*ter 7 vim resharper text-editor editor
ReSharper有一个很好的功能叫做"扩展选择":通过CTRL+W
反复按(我认为这是默认值),你从当前的插入符号位置选择越来越多.首先它是一个单词,然后是越来越多的单词,一行,内部和外部的行块(例如if-block),然后是一个函数等...
基本上,通过反复按下组合键,您最终可以选择整个文件.我相信至少你们中的一些人会熟悉它.
我刚刚开始学习vim的所有复杂性,我没有足够的经验来看看这样的东西是如何在Vim中实现的(尽管我认为它是可能的).所以我的问题是针对那里的Vim大师:可以做到这一点以及如何做?
更新:一点背景故事.我一直在和我的前任老板谈论Vim的所有好处,他认为这一切都很棒.他唯一的问题是:它有"延伸选择"吗?到目前为止我的问题一直没有.所以,如果有人知道答案,我最终会赢得一个讨论:P(并且可能会创建一个新的Vim转换器:-)
)
我快速解决了这个问题。它不能按原样工作。如果您对其进行了改进,请随意进行编辑并发布在 vim wiki 上或作为插件。
您可能想为每种语言创建 ag:resharp_list (例如,为括号语言创建一个 ag:resharp_list )
所需要的只是原始光标位置的标记:标记和重置索引的超时自动命令。
"resharp emulator
"TODO this needs a marker
"also c-w is bad mapping as it has a lag with all the other-
"window mappings
"
let g:resharp_index = 0
let g:resharp_select = ['iw', 'is', 'ip', 'ggVG']
func! ResharpSelect()
if g:resharp_index >= len (g:resharp_select)
let g:resharp_index = 0
endif
exe "norm \<esc>v" . g:resharp_select[g:resharp_index]
let g:resharp_index = g:resharp_index + 1
endfun
nnoremap <c-w> :call ResharpSelect()<cr>
vnoremap <c-w> :call ResharpSelect()<cr>
"Something to reset on timeout. TODO this doesn't work
au CursorHold :let g:resharp_index = 0<cr>
Run Code Online (Sandbox Code Playgroud)