mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-15 19:45:46 +08:00
Add: introduce splitjoin (#3956)
This commit is contained in:
parent
9c275500d4
commit
cc95234586
@ -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/vim-jplus', { 'on_map' : '<Plug>(jplus' }],
|
||||||
\ [g:_spacevim_root_dir . 'bundle/tabular', { 'merged' : 0}],
|
\ [g:_spacevim_root_dir . 'bundle/tabular', { 'merged' : 0}],
|
||||||
\ [g:_spacevim_root_dir . 'bundle/vim-better-whitespace', { 'on_cmd' : ['StripWhitespace', 'ToggleWhitespace', 'DisableWhitespace', 'EnableWhitespace']}],
|
\ [g:_spacevim_root_dir . 'bundle/vim-better-whitespace', { 'on_cmd' : ['StripWhitespace', 'ToggleWhitespace', 'DisableWhitespace', 'EnableWhitespace']}],
|
||||||
|
\ ['andrewradev/splitjoin.vim',{ 'merged' : 0, 'loadconf' : 1}],
|
||||||
\ ]
|
\ ]
|
||||||
if executable('fcitx')
|
if executable('fcitx')
|
||||||
call add(plugins,[g:_spacevim_root_dir . 'bundle/fcitx.vim', { 'on_event' : 'InsertEnter'}])
|
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"])',
|
\ . string(s:_function('s:transpose_with_next')) . ', ["line"])',
|
||||||
\ 'swap-current-line-with-next-one', 1)
|
\ '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
|
endfunction
|
||||||
|
|
||||||
function! s:transpose_with_previous(type) abort
|
function! s:transpose_with_previous(type) abort
|
||||||
|
3
config/plugins/splitjoin.vim
Normal file
3
config/plugins/splitjoin.vim
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
" Disable splitjoin default mappings
|
||||||
|
let g:splitjoin_split_mapping = ''
|
||||||
|
let g:splitjoin_join_mapping = ''
|
@ -1773,6 +1773,8 @@ The `SPC j` prefix is for jumping, joining and splitting.
|
|||||||
| Key Bindings | Descriptions |
|
| Key Bindings | Descriptions |
|
||||||
| ------------ | ----------------------------------------------------------------------------- |
|
| ------------ | ----------------------------------------------------------------------------- |
|
||||||
| `J` | join the current line with the next line |
|
| `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 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 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 |
|
| `SPC j o` | split the current line at point but let point on current line |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user