有没有可能在Vim中根据已经存在的缩进标记块?类似于v{。在
它对于使用空格敏感语法的编程语言(如Haskell和Python)非常有用。在
例如,在此函数中标记第一个let和return之间的所有内容:
checkArg (com:arg) s d ns
| com == "add-source " = do
let s' = v ++ s
lift $ saveLinks s'
return (s', d)
| com == "remove-source" = do
let s' = filter (not . hasWord str) s
lift $ saveLinks s'
return (s', d)
链接到的插件Jeet看起来很整洁,但是这里有一个简单的替代方法。在
如果你已经
set foldmethod=indent
。。。在可以使用可视块选择。在
所以从第3行开始,只需输入
V]z
。在我使用indent object plugin:
这样,您可以使用标准的Vim文本对象命令选择、删除、更改等块,使用“i”和“a”来表示您所在的块:“vii”、“dii”等。 它与语言无关,但在诸如Python这样的空白结构化语言中特别有用/相关。在
相关问题 更多 >
编程相关推荐