Vim:Cumber缩进表示“;及;线
在Cucumber的小黄瓜语言中,允许缩进和线条,如下所示:Vim:Cumber缩进表示“;及;线,vim,cucumber,Vim,Cucumber,在Cucumber的小黄瓜语言中,允许缩进和线条,如下所示: Scenario: Given there is a user named Chris And I am logged in as Chris When I go to the home page Then I should see "hi Chris" And I should not see "log in" 我喜欢这种缩进样式比同样缩进的样式好得多,但是对于Tim,我必须手动缩进和行,并手动删除下面
Scenario:
Given there is a user named Chris
And I am logged in as Chris
When I go to the home page
Then I should see "hi Chris"
And I should not see "log in"
我喜欢这种缩进样式比同样缩进的样式好得多,但是对于Tim,我必须手动缩进和行,并手动删除下面的行,有时Vim会自动缩进行,结果完全错误
在Vim中使用缩进和线条的最佳方法是什么?还是放弃它最简单?我想你可以定制
缩进/cucumber.vim
(在线)来增加以^\s*和开头的行的缩进,根据Andy的回答,这里有一个缩进/cumber.vim
的区别:
--- .vim/indent/cucumber.vim.bak 2011-03-24 18:44:27.000000000 +0100
+++ .vim/indent/cucumber.vim 2011-03-24 19:09:41.000000000 +0100
@@ -47,6 +47,10 @@
return indent(prevnonblank(v:lnum-1)) + &sw
elseif cline =~# '^\s*[^|# \t]' && line =~# '^\s*|'
return indent(prevnonblank(v:lnum-1)) - &sw
+ elseif cline =~# '^\s*\%(And\|But\)' && line !~# '^\s*\%(And\|But\)'
+ return indent(prevnonblank(v:lnum-1)) + &sw
+ elseif cline !~# '^\s*\%(And\|But\)' && line =~# '^\s*\%(And\|But\)'
+ return indent(prevnonblank(v:lnum-1)) - &sw
elseif cline =~# '^\s*$' && line =~# '^\s*|'
let in = indent(prevnonblank(v:lnum-1))
return in == indent(v:lnum) ? in : in - &sw