dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 6f815fc65b9f58d0054733af084d9e9dad9b45bc
parent 8b8f48c21224c72dcedcc4c904b96aa2548494ac
Author: hhvn <dev@hhvn.uk>
Date:   Sat, 22 Jan 2022 13:45:03 +0000

.c/n/i/rcshell.vim: unindent braces/parens

Diffstat:
M.config/nvim/indent/rcshell.vim | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/.config/nvim/indent/rcshell.vim b/.config/nvim/indent/rcshell.vim @@ -11,12 +11,15 @@ endif let b:did_indent = 1 setlocal indentexpr=GetRcIndent() +setlocal indentkeys+=0},0) +setlocal nosmartindent if exists("GetRcIndent") finish endif function! GetRcIndent() + let curline = getline(v:lnum) let lnum = prevnonblank(v:lnum - 1) let pnum = prevnonblank(lnum - 1) @@ -29,6 +32,11 @@ function! GetRcIndent() let indent = indent(lnum) let origindent = indent + if curline =~ '[})]' + let prevline = line + let line = curline + endif + let braces = s:Get_brace_balance(line, '{', '}') let indent += braces * &sw @@ -43,9 +51,6 @@ function! GetRcIndent() endif endif - " Todo: have ending braces automatically - " unindented like cindent - return indent endfunction