Created
November 30, 2016 15:37
-
-
Save tweekmonster/9d23e2b058b79dde6751e7a64fb5447b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
highlight default NonComment ctermfg=8 ctermbg=none cterm=none guifg=#333333 guibg=none gui=none | |
function! s:toggle_comments() abort | |
if exists('w:toggle_comments') | |
silent! call matchdelete(w:toggle_comments) | |
unlet! w:toggle_comments | |
else | |
let w:toggle_comments = matchadd('NonComment', '^\%(\s*'.split(escape(&commentstring, '^$.*/"'''), '%s')[0].'\)\@!.*') | |
endif | |
endfunction | |
nnoremap <leader>c :<c-u>call <sid>toggle_comments()<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment