Skip to content

Instantly share code, notes, and snippets.

@tpope
Created October 24, 2012 22:12
Show Gist options
  • Select an option

  • Save tpope/3949272 to your computer and use it in GitHub Desktop.

Select an option

Save tpope/3949272 to your computer and use it in GitHub Desktop.
Aggressively in-your-face splitjoin.vim mappings
function! s:join(cmd)
if exists(':SplitjoinJoin') && !v:count
let tick = b:changedtick
SplitjoinJoin
if tick == b:changedtick
execute 'normal! '.a:cmd
endif
else
execute 'normal! '.v:count.a:cmd
endif
endfunction
nnoremap <silent> gJ :<C-U>call <SID>join('gJ')<CR>
nnoremap <silent> J :<C-U>call <SID>join('J')<CR>
nnoremap <silent> gS :SplitjoinSplit<CR>
nnoremap <silent> S :SplitjoinSplit<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment