diff options
| author | Mitsuo Tokumori <[email protected]> | 2022-09-13 16:34:45 -0500 |
|---|---|---|
| committer | Mitsuo Tokumori <[email protected]> | 2022-09-13 16:34:45 -0500 |
| commit | 6364658da063381339b32b51af13229cbfab310d (patch) | |
| tree | cee1ba934aae2e79e25e0ac3b4f191483e9aa466 | |
| parent | 9047154ea855c7afa6881f62a39e39e6b834b107 (diff) | |
| download | dotfiles-6364658da063381339b32b51af13229cbfab310d.tar.gz dotfiles-6364658da063381339b32b51af13229cbfab310d.tar.bz2 dotfiles-6364658da063381339b32b51af13229cbfab310d.zip | |
Add Comment and UnComment mappings
| -rw-r--r-- | vim/vimrc | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -201,6 +201,21 @@ nnoremap gJ :%!python3 -m json.tool<CR> " NERDTree plugin nnoremap <C-t> :NERDTreeToggle<CR> +" Comment/UnComment lines +" Ref.: +" - https://vim.fandom.com/wiki/Comment/UnComment_visually_selected_text +" - https://stackoverflow.com/a/1676672/7498073 +" - https://stackoverflow.com/a/9051932/7498073 +au FileType haskell,vhdl,ada let b:comment_leader = '-- ' +au FileType vim let b:comment_leader = '" ' +au FileType c,cpp,java let b:comment_leader = '// ' +au FileType sh,make let b:comment_leader = '# ' +au FileType tex let b:comment_leader = '% ' +" That c_CTRL-R_= thingy enters the "expression register". And that \V +" tells :s to go into "Very NonMagic" mode. +noremap ,c :s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:noh<CR> +noremap ,u :s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:noh<CR> + " Yanking and pasting " ---------------------------------------------------------------------- |
