summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2014-12-18 15:53:48 +0100
committerHugues Hiegel <hugues.hiegel@qosmos.com>2014-12-18 15:59:24 +0100
commited09312c511018d26c9dd7bd03c6e9b62fb2708a (patch)
tree4ddaf011cf41e6c354ccb7029da0643893dd8be2
parentb8ae592ddfe32b79e39c7dbfa55021e61ac8d276 (diff)
[map] comments/uncomments C code blocks/lines
-rw-r--r--vimrc12
1 files changed, 10 insertions, 2 deletions
diff --git a/vimrc b/vimrc
index db9b36a..86edbfb 100644
--- a/vimrc
+++ b/vimrc
@@ -253,8 +253,16 @@ set tabstop=4
set shiftwidth=4
set noexpandtab
-noremap U yyp:s/[^ ]/-/g<CR>:noh<CR>
-noremap Y yyp:s/[^ ]/=/g<CR>:noh<CR>
+"noremap U yyp:s/[^ ]/-/g<CR>:noh<CR>
+"noremap Y yyp:s/[^ ]/=/g<CR>:noh<CR>
+
+" Code comment/uncomment
+ noremap <silent> // m"I// <ESC>g`"3l
+ noremap <silent> /* m"I/* <ESC>A */<ESC>jg`"3l
+ xmap <silent> // /*
+xnoremap <silent> /* <ESC>`>a */<ESC>`<i/* <ESC>
+ noremap <silent> \* m"e?/\* *<CR>:s:/\* *::<CR>/ *\*\/<CR>:s: *\*/::\|:nohl<CR>jg`"3h
+ noremap <silent> \\ m"0:s:// *::\|:nohl<CR>g`"3h
" Reformatting is done using 'gq<motion>'
noremap <ESC>Q :s/^/> /<CR>