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

Add Comments space

Add keymap [SPC]cl for comment and uncomment lines. Use nerdcommenter
plugin to do the line code comments. Read nerdcommenter settings in edit
layer.
This commit is contained in:
Javier Tiá 2017-06-26 07:13:45 -06:00
parent 3f9c3dd5ee
commit f1cc39f1f5
3 changed files with 43 additions and 1 deletions

View File

@ -8,7 +8,7 @@ function! SpaceVim#layers#edit#plugins() abort
\ ['kana/vim-textobj-indent'],
\ ['kana/vim-textobj-line'],
\ ['kana/vim-textobj-entire'],
\ ['scrooloose/nerdcommenter'],
\ ['scrooloose/nerdcommenter', { 'loadconf' : 1}],
\ ['mattn/emmet-vim', { 'on_cmd' : 'EmmetInstall'}],
\ ['gcmt/wildfire.vim',{'on_map' : '<Plug>(wildfire-'}],
\ ['easymotion/vim-easymotion'],

View File

@ -13,6 +13,7 @@ function! SpaceVim#mapping#space#init() abort
let g:_spacevim_mappings_space.T = {'name' : '+UI toggles/themes'}
let g:_spacevim_mappings_space.a = {'name' : '+Applications'}
let g:_spacevim_mappings_space.b = {'name' : '+Buffers'}
let g:_spacevim_mappings_space.c = {'name' : '+Comments'}
let g:_spacevim_mappings_space.f = {'name' : '+Files'}
let g:_spacevim_mappings_space.j = {'name' : '+Jump/Join/Split'}
let g:_spacevim_mappings_space.w = {'name' : '+Windows'}
@ -65,6 +66,16 @@ function! SpaceVim#mapping#space#init() abort
nnoremap <silent> [SPC]bp :bp<CR>
let g:_spacevim_mappings_space.b.p = ['bp', 'previous buffer']
call SpaceVim#mapping#menu('Open previous buffer', '[SPC]bp', 'bp')
"
" Comments sections
"
" Toggles the comment state of the selected line(s). If the topmost selected
" line is commented, all selected lines are uncommented and vice versa.
let g:_spacevim_mappings_space.c.c = ['cl', 'Toggle commment line(s)']
call SpaceVim#mapping#menu('Toggle comment line(s)', '[SPC]cl', '')
nnoremap <silent> [SPC]cl :call NERDComment("n", "Toggle")<CR>
let g:_spacevim_mappings_space.e = {'name' : '+Errors/Encoding'}
let g:_spacevim_mappings_space.B = {'name' : '+Global-buffers'}
nnoremap <silent> [SPC]tn :<C-u>setlocal nonumber! norelativenumber!<CR>

View File

@ -0,0 +1,31 @@
scriptencoding utf-8
"
" nerd-commenter plugin settings
"
" Add extra space around delimiters when commenting, remove them when
" uncommenting
let g:NERDSpaceDelims = 1
" Always remove the extra spaces when uncommenting regardless of whether
" NERDSpaceDelims is set
let g:NERDRemoveExtraSpaces = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code
" indentation
let g:NERDDefaultAlign = 'left'
" Allow commenting and inverting empty lines (useful when commenting a
" region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Always use alternative delimiter
let g:NERD_c_alt_style = 1
let g:NERDCustomDelimiters = {'c': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }}