Skip to content

Commit

Permalink
copy go's function because it may diverge
Browse files Browse the repository at this point in the history
  • Loading branch information
perelo committed Feb 22, 2024
1 parent 43e42ee commit cf178b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions autoload/sj/cue.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
function! sj#cue#SplitImports()
let pattern = '^import\s\+\(\%(\k\+\s\+\)\=\%(".*"\)\)$'

if getline('.') =~ pattern
call sj#Keeppatterns('s/' . pattern . '/import (\r\1\r)/')
normal! k==
return 1
else
return 0
endif
endfunction

function! sj#cue#SplitStructLiteral()
let [from, to] = sj#LocateBracesOnLine('{', '}')

Expand Down
2 changes: 1 addition & 1 deletion ftplugin/cue/splitjoin.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if !exists('b:splitjoin_split_callbacks')
\ 'sj#cue#SplitStructLiteral',
\ 'sj#cue#SplitArray',
\ 'sj#cue#SplitArgs',
\ 'sj#go#SplitImports',
\ 'sj#cue#SplitImports',
\ ]
endif

Expand Down

0 comments on commit cf178b0

Please sign in to comment.