1 " Commment one line (Controle /)
2 autocmd FileType * nnoremap <buffer> <C-_> <Home>i# <esc>
3 autocmd FileType vim nnoremap <buffer> <C-_> <Home>i" <esc>
4 autocmd FileType nasm nnoremap <buffer> <C-_> <Home>i; <esc>
5 autocmd FileType c,cpp nnoremap <buffer> <C-_> <Home>i// <esc>
6 autocmd FileType c nnoremap <buffer> <Leader>/ ^i/* <End> */<esc>
7 autocmd FileType css nnoremap <buffer> <C-_> <Home>i/* <End> */<esc>
8 autocmd FileType html nnoremap <buffer> <C-_> <Home>i<!-- <End> --><esc>
10 " Uncomment one line (Shift /)
11 autocmd FileType * nnoremap <buffer> ? :s/^# /<CR>
12 autocmd FileType vim nnoremap <buffer> ? :s/^" /<CR>
13 autocmd FileType nasm nnoremap <buffer> ? :s/^; /<CR>
14 autocmd FileType c,cpp nnoremap <buffer> ? :s/^\/\/ /<CR>
15 autocmd FileType c nnoremap <buffer> <Leader>? :s/^/* /<CR>:s/ */$/<CR>
16 autocmd FileType css nnoremap <buffer> ? :s/^/* /<CR>:s/ */$/<CR>
17 autocmd FileType html nnoremap <buffer> ? :s/^<!-- /<CR>:s/ -->$/<CR>
19 " Commment selected lines (Controle /)
20 autocmd FileType * vnoremap <buffer> <C-_> <Home><C-v>I# <esc><esc>
21 autocmd FileType vim vnoremap <buffer> <C-_> <Home><C-v>I" <esc><esc>
22 autocmd FileType nasm vnoremap <buffer> <C-_> <Home><C-v>I; <esc><esc>
23 autocmd FileType c,cpp vnoremap <buffer> <C-_> <Home><C-v>I// <esc><esc>
25 " Uncomment selected lines (Shift /)
26 autocmd FileType * vnoremap <buffer> ? :s/^# /<CR>
27 autocmd FileType vim vnoremap <buffer> ? :s/^" /<CR>
28 autocmd FileType nasm vnoremap <buffer> ? :s/^; /<CR>
29 autocmd FileType c,cpp vnoremap <buffer> ? :s/^\/\/ /<CR>