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

Change: toggle functions of some pairs of key bindings. (#2601)

This commit is contained in:
Lin Kun 2019-02-18 13:28:30 +08:00 committed by Wang Shidong
parent bf92a4d5ed
commit c64fdc2ddf
3 changed files with 18 additions and 22 deletions

View File

@ -250,17 +250,17 @@ function! SpaceVim#layers#core#config() abort
call SpaceVim#mapping#space#def('nmap', ['c', 'u'], '<Plug>NERDCommenterUncomment', 'uncomment lines', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'v'], '<Plug>NERDCommenterInvertgv', 'toggle comment lines and keep visual', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 's'], '<Plug>NERDCommenterSexy', 'comment with sexy/pretty layout', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'y'], '<Plug>NERDCommenterYank', 'yank and comment', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'Y'], '<Plug>NERDCommenterYank', 'yank and comment', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', '$'], '<Plug>NERDCommenterToEOL', 'comment current line from cursor to the end of the line', 0, 1)
nnoremap <silent> <Plug>CommentToLine :call <SID>comment_to_line(0)<Cr>
nnoremap <silent> <Plug>CommentToLineInvert :call <SID>comment_to_line(1)<Cr>
nnoremap <silent> <Plug>CommentParagraphs :call <SID>comment_paragraphs(0)<Cr>
nnoremap <silent> <Plug>CommentParagraphsInvert :call <SID>comment_paragraphs(1)<Cr>
call SpaceVim#mapping#space#def('nmap', ['c', 't'], '<Plug>CommentToLine', 'comment until the line', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'T'], '<Plug>CommentToLineInvert', 'toggle comment until the line', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'p'], '<Plug>CommentParagraphs', 'comment paragraphs', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'P'], '<Plug>CommentParagraphsInvert', 'toggle comment paragraphs', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 't'], '<Plug>CommentToLineInvert', 'toggle comment until the line', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'T'], '<Plug>CommentToLine', 'comment until the line', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'p'], '<Plug>CommentParagraphsInvert', 'toggle comment paragraphs', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'P'], '<Plug>CommentParagraphs', 'comment paragraphs', 0, 1)
nnoremap <silent> <Plug>CommentOperator :set opfunc=<SID>commentOperator<Cr>g@
let g:_spacevim_mappings_space[';'] = ['call feedkeys("\<Plug>CommentOperator")', 'comment operator']
@ -380,11 +380,7 @@ function! s:split_string(newline) abort
break
endif
endwhile
if a:newline
let l:connector = "\n"
else
let l:connector = ''
endif
let l:connector = a:newline ? "\n" : ""
let l:save_register_m = @m
let @m = sep . l:connector . sep
normal! "mp

View File

@ -1673,13 +1673,13 @@ The default color for iedit is `red`/`green` which is based on the current color
| `SPC c l` | 注释/反注释当前行 |
| `SPC c L` | 注释行 |
| `SPC c u` | 反注释行 |
| `SPC c p` | 注释段落 |
| `SPC c P` | 注释/反注释段落 |
| `SPC c p` | 注释/反注释段落 |
| `SPC c P` | 注释段落 |
| `SPC c s` | 使用完美格式注释 |
| `SPC c t` | 注释到行 |
| `SPC c T` | 注释/反注释到行 |
| `SPC c y` | 复制到未命名寄存器后注释 |
| `SPC c Y` | toggle comment and yank(TODO) |
| `SPC c t` | 注释/反注释到行 |
| `SPC c T` | 注释到行 |
| `SPC c y` | toggle comment and yank(TODO) |
| `SPC c Y` | 复制到未命名寄存器后注释 |
| `SPC c $` | 从光标位置开始注释当前行 |
小提示:

View File

@ -1707,13 +1707,13 @@ Comments are handled by [nerdcommenter](https://github.com/scrooloose/nerdcommen
| `SPC c l` | toggle comment lines |
| `SPC c L` | comment lines |
| `SPC c u` | uncomment lines |
| `SPC c p` | comment paragraphs |
| `SPC c P` | toggle comment paragraphs |
| `SPC c p` | toggle comment paragraphs |
| `SPC c P` | comment paragraphs |
| `SPC c s` | comment with pretty layout |
| `SPC c t` | comment to line |
| `SPC c T` | toggle comment to line |
| `SPC c y` | yank and comment |
| `SPC c Y` | toggle comment and yank(TODO) |
| `SPC c t` | toggle comment to line |
| `SPC c T` | comment to line |
| `SPC c y` | toggle comment and yank(TODO) |
| `SPC c Y` | yank and comment |
| `SPC c $` | comment current line from cursor to the end of the line |
**Tips:** `SPC ;` will start operator mode, in this mode, you can use motion command to comment lines.