Merge remote-tracking branch 'GrantMoyer/paren-in-literal'

This commit is contained in:
Maxime Coste 2019-04-01 21:21:01 +11:00
commit bf170ec7f5
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
try %< execute-keys [c [({],[)}] <ret> >
# 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
try %< execute-keys -draft <space> <a-h> s\h+<ret> d >
# 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