Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions plugin/comments.vim
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
" *********************************************************************************************
" Jasmeet Anand 11th January 2009 v2.12
" bug fix for haskel files as prpvided by Jean-Marie
" *********************************************************************************************
" Russell Friesenhahn 31th March 2014 v2.13
" Added support for Verilog and SystemVerilog for // case only
"

" Exit if already loaded
Expand All @@ -106,8 +109,8 @@ vnoremap <silent> <C-X> :call RangeUnCommentLine()<CR>
function! CommentLine()
let file_name = buffer_name("%")

" for .cpp or .hpp or .java or .C files use //
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$'
" for .cpp or .hpp or .java or .C files or .v or .sv files use //
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$' || file_name =~ '\.v$' || file_name =~ '\.sv$'
execute ":silent! normal ^i//\<ESC>==\<down>^"
" for .c or .h or .pc or .css files use /* */
elseif file_name =~ '\.c$' || file_name =~ '\.h$' || file_name =~ '\.pc$' || file_name =~ '\.css$' || file_name =~ '\.js$'
Expand Down Expand Up @@ -171,8 +174,8 @@ endfunction
function! UnCommentLine()
let file_name = buffer_name("%")

" for .cpp or .hpp or .java or .C files use //
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$'
" for .cpp or .hpp or .java or .C or .v or .sv files use //
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$' || file_name =~ '\.v$' || file_name =~ '\.sv$'
execute ":silent! normal :nohlsearch\<CR>:s/\\/\\///\<CR>:nohlsearch\<CR>=="
" for .ml or .mli
elseif file_name =~ '\.ml$' || file_name =~ '\.mli$'
Expand Down Expand Up @@ -216,8 +219,8 @@ endfunction
function! RangeCommentLine()
let file_name = buffer_name("%")

" for .cpp or .hpp or .java or .C files use //
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$'
" for .cpp or .hpp or .java or .C or .v or .sv files use //
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$' || file_name =~ '\.v$' || file_name =~ '\.sv$'
execute ":silent! normal :s/\\S/\\/\\/\\0/\<CR>:nohlsearch<CR>=="
" for .c or .h or .pc or .css files use /* */
elseif file_name =~ '\.c$' || file_name =~ '\.h$' || file_name =~ '\.pc$' || file_name =~ '\.css$' || file_name =~ '\.js$'
Expand Down Expand Up @@ -281,8 +284,8 @@ endfunction
function! RangeUnCommentLine()
let file_name = buffer_name("%")

" for .cpp or .hpp or .java files use //
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$'
" for .cpp or .hpp or .java or .v or .sv files use //
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$' || file_name =~ '\.v$' || file_name =~ '\.sv$'
execute ":silent! normal :s/\\/\\///\<CR>:nohlsearch\<CR>=="
" for .c or .h or .pc or .css files use /* */
elseif file_name =~ '\.c$' || file_name =~ '\.h$' || file_name =~ '\.pc$' || file_name =~ '\.css$' || file_name =~ '\.js$'
Expand Down