Merge remote-tracking branch 'GrantMoyer/paren-in-literal'
This commit is contained in:
commit
bf170ec7f5
|
@ -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
|
||||||
|
|
1
test/indent/c-family/paren-in-literal/cmd
Normal file
1
test/indent/c-family/paren-in-literal/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
c<ret>bar<esc>
|
7
test/indent/c-family/paren-in-literal/in
Normal file
7
test/indent/c-family/paren-in-literal/in
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
if(c == '(') {%( )
|
||||||
|
|
||||||
|
if(c == '(') {}%( )
|
||||||
|
|
||||||
|
if(s == "(") {%( )
|
||||||
|
|
||||||
|
if(s == "(" "foo") {%( )
|
11
test/indent/c-family/paren-in-literal/out
Normal file
11
test/indent/c-family/paren-in-literal/out
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
if(c == '(') {
|
||||||
|
bar
|
||||||
|
|
||||||
|
if(c == '(') {}
|
||||||
|
bar
|
||||||
|
|
||||||
|
if(s == "(") {
|
||||||
|
bar
|
||||||
|
|
||||||
|
if(s == "(" "foo") {
|
||||||
|
bar
|
3
test/indent/c-family/paren-in-literal/rc
Normal file
3
test/indent/c-family/paren-in-literal/rc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
source "%val{runtime}/colors/default.kak"
|
||||||
|
source "%val{runtime}/rc/filetype/c-family.kak"
|
||||||
|
set buffer filetype cpp
|
Loading…
Reference in New Issue
Block a user