1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 02:05:40 +08:00

Add: introduce splitjoin (#3956)

This commit is contained in:
GBProd 2020-12-19 14:00:47 +01:00 committed by GitHub
parent 9c275500d4
commit cc95234586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -32,6 +32,7 @@ function! SpaceVim#layers#edit#plugins() abort
\ [g:_spacevim_root_dir . 'bundle/vim-jplus', { 'on_map' : '<Plug>(jplus' }],
\ [g:_spacevim_root_dir . 'bundle/tabular', { 'merged' : 0}],
\ [g:_spacevim_root_dir . 'bundle/vim-better-whitespace', { 'on_cmd' : ['StripWhitespace', 'ToggleWhitespace', 'DisableWhitespace', 'EnableWhitespace']}],
\ ['andrewradev/splitjoin.vim',{ 'merged' : 0, 'loadconf' : 1}],
\ ]
if executable('fcitx')
call add(plugins,[g:_spacevim_root_dir . 'bundle/fcitx.vim', { 'on_event' : 'InsertEnter'}])
@ -217,6 +218,11 @@ function! SpaceVim#layers#edit#config() abort
\ . string(s:_function('s:transpose_with_next')) . ', ["line"])',
\ 'swap-current-line-with-next-one', 1)
" splitjoin
call SpaceVim#mapping#space#def('nnoremap', ['j', 'o'],
\ 'SplitjoinJoin', 'join into a single-line statement', 1)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'm'],
\ 'SplitjoinSplit', 'split a one-liner into multiple lines', 1)
endfunction
function! s:transpose_with_previous(type) abort

View File

@ -0,0 +1,3 @@
" Disable splitjoin default mappings
let g:splitjoin_split_mapping = ''
let g:splitjoin_join_mapping = ''

View File

@ -1773,6 +1773,8 @@ The `SPC j` prefix is for jumping, joining and splitting.
| Key Bindings | Descriptions |
| ------------ | ----------------------------------------------------------------------------- |
| `J` | join the current line with the next line |
| `SPC j o` | join a code block into a single-line statement |
| `SPC j m` | split a one-liner into multiple lines |
| `SPC j k` | go to next line and indent it using auto-indent rules |
| `SPC j n` | split the current line at point, insert a new line and auto-indent |
| `SPC j o` | split the current line at point but let point on current line |