Fix autoindent issues with paren in literal

This commit is contained in:
Grant Moyer 2019-03-27 16:31:11 -04:00
parent 2c283d46a5
commit d8e4c6801f
5 changed files with 23 additions and 1 deletions

View File

@ -65,7 +65,7 @@ define-command -hidden c-family-indent-on-newline %< evaluate-commands -draft -i
# Go to opening parenthesis and opening brace, then select the most nested one # Go to opening parenthesis and opening brace, then select the most nested one
try %< execute-keys [c [({],[)}] <ret> > try %< execute-keys [c [({],[)}] <ret> >
# Validate selection and get first and last char # Validate selection and get first and last char
execute-keys <a-k>\A[{(](\h*\S+)+\n<ret> <a-:><a-\;>L <a-S> execute-keys <a-k>\A[{(](\h*\S+)+\n<ret> <a-K>"(([^"]*"){2})*<ret> <a-K>'(([^']*'){2})*<ret> <a-:><a-\;>L <a-S>
# Remove possibly incorrect indent from new line which was copied from previous line # Remove possibly incorrect indent from new line which was copied from previous line
try %< execute-keys -draft <space> <a-h> s\h+<ret> d > try %< execute-keys -draft <space> <a-h> s\h+<ret> d >
# Now indent and align that new line with the opening parenthesis/brace # Now indent and align that new line with the opening parenthesis/brace

View File

@ -0,0 +1 @@
c<ret>bar<esc>

View File

@ -0,0 +1,7 @@
if(c == '(') {%( )
if(c == '(') {}%( )
if(s == "(") {%( )
if(s == "(" "foo") {%( )

View File

@ -0,0 +1,11 @@
if(c == '(') {
bar
if(c == '(') {}
bar
if(s == "(") {
bar
if(s == "(" "foo") {
bar

View File

@ -0,0 +1,3 @@
source "%val{runtime}/colors/default.kak"
source "%val{runtime}/rc/filetype/c-family.kak"
set buffer filetype cpp