1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 07:20:04 +08:00

fix(commenter): fix nerdcommenter for markdown

This commit is contained in:
Eric Wong 2024-12-30 22:20:05 +08:00
parent 91c299fd8a
commit a0fc3ad290
3 changed files with 11 additions and 6 deletions

View File

@ -1205,6 +1205,10 @@ function! NERDCommentIsLineCommented(lineNo)
return s:IsInSexyComment(a:lineNo) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine) return s:IsInSexyComment(a:lineNo) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
endfunction endfunction
function! NERDCommentSetUpForNewFiletype(ft) abort
call s:SetUpForNewFiletype(a:ft, 1)
endfunction
" Function: NERDComment(mode, type) function " Function: NERDComment(mode, type) function
" This function is a Wrapper for the main commenting functions " This function is a Wrapper for the main commenting functions
" "

View File

@ -30,19 +30,19 @@ let g:NERDTrimTrailingWhitespace = 1
" Always use alternative delimiter " Always use alternative delimiter
let g:NERD_c_alt_style = 1 let g:NERD_c_alt_style = 1
let g:NERDCustomDelimiters = {'c': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }} let g:NERDCustomDelimiters = {'c': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }}
let g:ft = '' let s:ft = ''
fu! NERDCommenter_before() fu! NERDCommenter_before()
if &ft ==# 'markdown' if &ft ==# 'markdown'
let g:ft = 'markdown'
let cf = context_filetype#get() let cf = context_filetype#get()
if cf.filetype !=# 'markdown' if cf.filetype !=# 'markdown'
exe 'setf ' . cf.filetype let s:ft = 'markdown'
call NERDCommentSetUpForNewFiletype(cf.filetype)
endif endif
endif endif
endfu endfu
fu! NERDCommenter_after() fu! NERDCommenter_after()
if g:ft ==# 'markdown' if s:ft ==# 'markdown'
setf markdown call NERDCommentSetUpForNewFiletype(s:ft)
let g:ft = '' let s:ft = ''
endif endif
endfu endfu

View File

@ -54,6 +54,7 @@ These plugins are changed based on a specific version of origin plugin.
- `jedi-vim`: based on [jedi-vim@e82d07](https://github.com/davidhalter/jedi-vim/tree/e82d07faa17c3b3fe04b4fa6ab074e8e8601a596) - `jedi-vim`: based on [jedi-vim@e82d07](https://github.com/davidhalter/jedi-vim/tree/e82d07faa17c3b3fe04b4fa6ab074e8e8601a596)
- `vim-unstack`: based on [vim-unstack@9b191419](https://github.com/mattboehm/vim-unstack/tree/9b191419b4d3f26225a5ae3df5e409c62b426941) - `vim-unstack`: based on [vim-unstack@9b191419](https://github.com/mattboehm/vim-unstack/tree/9b191419b4d3f26225a5ae3df5e409c62b426941)
- `tagbar`: based on [tagbar@af3ce7c](https://github.com/preservim/tagbar/tree/af3ce7c3cec81f2852bdb0a0651d2485fcd01214) - `tagbar`: based on [tagbar@af3ce7c](https://github.com/preservim/tagbar/tree/af3ce7c3cec81f2852bdb0a0651d2485fcd01214)
- `nerdcommenter`: based on [nerdcommenter@fade3d4b2](https://github.com/preservim/nerdcommenter/tree/fade3d4b26f5a0d58f256a06ba7b0a04d9fb4f3b)
#### `core` layer #### `core` layer