Skip to content

Commit 2870a29

Browse files
committed
Indent command substitution
1 parent 83f8bdb commit 2870a29

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

autoload/fish.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ function! s:IsContinuedLine(lnum)
99
return getline(a:lnum - 1) =~ '\v\\$'
1010
endfunction
1111

12+
function! s:IsInSubstitution(lnum)
13+
" Returns "true" if the given line is a continued line.
14+
return getline(a:lnum - 1) =~ '\v\($'
15+
endfunction
16+
1217
function! s:FindPrevLnum(lnum)
1318
" Starting on the given line, search backwards for a line that is not
1419
" empty, not part of a string and not a continued line.
@@ -80,6 +85,14 @@ function! fish#Indent()
8085
return l:previndent + l:shiftwidth
8186
endif
8287
endif
88+
if l:prevline =~ '(\s*$'
89+
" Inside a substitution
90+
let l:shift += 1
91+
endif
92+
if l:line =~ '^\s*)'
93+
" Outside a substitution
94+
let l:shift -= 1
95+
endif
8396
if l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|case|switch)>'
8497
" First line inside a block, increase by one.
8598
let l:shift += 1

0 commit comments

Comments
 (0)