Skip to content

Commit fcc17bc

Browse files
committed
Ctrl+A in normal mode in .feature files detects and aligns an ascii table
1 parent 6a5dda6 commit fcc17bc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

vim/after/ftplugin/cucumber.vim

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,26 @@ Snippet visit When I visit <{}>
1313
" Factory steps
1414
Snippet exist Given a <{factory}> exists with a <{attribute}> of "<{}>"
1515

16+
function! AlignAsciiTable()
17+
let startline = line(".")
18+
while match(getline(startline), "|") != -1
19+
let startline = startline - 1
20+
endwhile
21+
let startline = startline + 1
22+
23+
let endline = startline
24+
while match(getline(endline), "|") != -1
25+
let endline = endline + 1
26+
endwhile
27+
let endline = endline - 1
28+
29+
if startline >= endline
30+
return
31+
endif
32+
33+
exec startline . "," . endline . "!align_ascii_table"
34+
endfunction
35+
36+
nmap <buffer> <C-A> :call AlignAsciiTable()<CR>
37+
1638
vmap <buffer> <C-A> !align_ascii_table<CR>

0 commit comments

Comments
 (0)