Advertisement
anjishnu

ColorComment.vim

Sep 15th, 2011
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.94 KB | None | 0 0
  1. " To define toggle switch <C-G> to color the comments grey/darkblue
  2. " Author: Anjishnu Sarkar
  3. " Version: 1.0
  4. " Date: 21/04/07
  5. " Vim Version: 6.0
  6. " Acknowledgement: www.vim.org -> Vim_Tip #1072
  7. " ****************************************************************
  8.  
  9. " Exit quickly when:
  10. " - this plugin was already loaded (or disabled)
  11. " - when 'compatible' is set
  12. if exists ("g:loaded_color_comment") || &cp
  13.     finish
  14. endif
  15. let g:loaded_color_comment = 1
  16.  
  17. " To autoload grayed out comments
  18. if !exists("s:c_color")
  19.     let s:c_color = 1
  20.     highlight Comment ctermfg=darkblue guifg=gray
  21. endif
  22.    
  23. " To toggle between darkblue and gray colors for comments
  24. function Color_comment()
  25.     if  s:c_color == 1
  26.         highlight Comment ctermfg=gray guifg=blue
  27.         let s:c_color = 0
  28.     else
  29.         highlight Comment ctermfg=darkblue guifg=gray
  30.         let s:c_color = 1
  31.     endif
  32. endfunction
  33.  
  34. " To map the function to keyboard <C-G>
  35. nmap <C-G> :call Color_comment()<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement