From 7ad3d81023b83d6481e916458439fbbdd80307e2 Mon Sep 17 00:00:00 2001 From: Tymur Baksheiev Date: Sun, 7 Jan 2024 22:36:19 +0200 Subject: [PATCH 1/2] Fixed indentation including issues with "=" normal mode command. --- indent/ps1.vim | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/indent/ps1.vim b/indent/ps1.vim index 9eac9c9..f7a6d84 100644 --- a/indent/ps1.vim +++ b/indent/ps1.vim @@ -11,10 +11,15 @@ if exists("b:did_indent") endif let b:did_indent = 1 -" smartindent is good enough for powershell -setlocal smartindent -" disable the indent removal for # marks -inoremap # X# - -let b:undo_indent = "setl si<" +setlocal cindent +" Disable zero indentation of lines started with "#" in insert mode, which are comments +setlocal cinkeys-=0# +" Enable detection of Shell/Perl style comments +setlocal cinoptions+=#1 +" Disable additonal indentation for "continuation lines", which are all the lines missing ";" +setlocal cinoptions+=+0 +" Make indentation single for unclosed parentheses (multiline argument lists and array literals). +" By default it's shiftwidth * 2 +execute "setlocal cinoptions+=(" . &shiftwidth +let b:undo_indent = "setl cindent< cinkeys< cinoptions<" From 4067ab5dbca7fb3dc3750d06774e3558fe69b9dd Mon Sep 17 00:00:00 2001 From: Tymur Baksheiev Date: Wed, 10 Jan 2024 23:40:39 +0200 Subject: [PATCH 2/2] Additional indentation improvements: - Improved indentation of comments. - Simplified option for unclosed parentheses. --- indent/ps1.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indent/ps1.vim b/indent/ps1.vim index f7a6d84..49ea079 100644 --- a/indent/ps1.vim +++ b/indent/ps1.vim @@ -15,11 +15,11 @@ setlocal cindent " Disable zero indentation of lines started with "#" in insert mode, which are comments setlocal cinkeys-=0# " Enable detection of Shell/Perl style comments -setlocal cinoptions+=#1 +setlocal cinoptions+=#1s " Disable additonal indentation for "continuation lines", which are all the lines missing ";" setlocal cinoptions+=+0 " Make indentation single for unclosed parentheses (multiline argument lists and array literals). " By default it's shiftwidth * 2 -execute "setlocal cinoptions+=(" . &shiftwidth +setlocal cinoptions+=(1s let b:undo_indent = "setl cindent< cinkeys< cinoptions<"