Skip to content

Commit

Permalink
Merge remote-tracking branch 'pr/master'
Browse files Browse the repository at this point in the history
* pr/master:
  clean useless initialization code
  Support argument_split_first_newline/argument_split_last_newline for c
  • Loading branch information
AndrewRadev committed Aug 11, 2023
2 parents 30a1d7c + 2802a18 commit 0e208e0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
14 changes: 13 additions & 1 deletion autoload/sj/c.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ function! sj#c#SplitFuncall()
let end = col('.')

let items = sj#ParseJsonObjectBody(start, end)
let body = '('.join(items, ",\n").')'

let body = "("
if sj#settings#Read('c_argument_split_first_newline')
let body = "(\n"
endif

let body .= join(items, ",\n")

if sj#settings#Read('c_argument_split_last_newline')
let body .= "\n)"
else
let body .= ")"
endif

call sj#PopCursor()

Expand Down
10 changes: 10 additions & 0 deletions doc/splitjoin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,16 @@ after the last one:
This is a setting that might be generalized for other languages and constructs
at a later time.

*splitjoin_c_argument_split_first_newline*
*splitjoin_c_argument_split_last_newline*
>
let g:splitjoin_c_argument_split_first_newline = 1
let g:splitjoin_c_argument_split_last_newline = 1
<
Default value: 0

Same like the arguments for java.

==============================================================================
INTERNALS *splitjoin-internals*

Expand Down

0 comments on commit 0e208e0

Please sign in to comment.