PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/vimrc.commands.vim

https://github.com/bf4/vimfiles
Vim Script | 60 lines | 27 code | 10 blank | 23 comment | 5 complexity | 5df672299f8ca973ea5ef9385ad75b0c MD5 | raw file
  1. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  2. " CUSTOM AUTOCMDS
  3. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  4. augroup vimrcEx
  5. " Clear all autocmds in the group
  6. autocmd!
  7. autocmd FileType text setlocal textwidth=78
  8. " Jump to last cursor position unless it's invalid or in an event handler
  9. autocmd BufReadPost *
  10. \ if line("'\"") > 0 && line("'\"") <= line("$") |
  11. \ exe "normal g`\"" |
  12. \ endif
  13. "for ruby, autoindent with two spaces, always expand tabs
  14. autocmd FileType ruby,haml,eruby,yaml,html,javascript,sass,cucumber set ai sw=2 sts=2 et
  15. autocmd FileType python set sw=4 sts=4 et
  16. autocmd! BufRead,BufNewFile *.sass setfiletype sass
  17. autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:&gt;
  18. autocmd BufRead *.markdown set ai formatoptions=tcroqn2 comments=n:&gt;
  19. " Indent p tags
  20. autocmd FileType html,eruby if g:html_indent_tags !~ '\\|p\>' | let g:html_indent_tags .= '\|p\|li\|dt\|dd' | endif
  21. " Don't syntax highlight markdown because it's often wrong
  22. autocmd! FileType mkd setlocal syn=off
  23. " Leave the return key alone when in command line windows, since it's used
  24. " to run commands there.
  25. autocmd! CmdwinEnter * :unmap <cr>
  26. autocmd! CmdwinLeave * :call MapCR()
  27. augroup END
  28. " BF ADDED from http://dominique.pelle.free.fr/.vimrc.html
  29. if has('autocmd')
  30. " also
  31. " :so $MYVIMRC
  32. " Source .vimrc when I write it. The nested keyword allows
  33. " autocommand ColorScheme to fire when sourcing ~/.vimrc.
  34. au! BufWritePost .vimrc nested source %
  35. " Change color of cursor in terminal:
  36. " - red in normal mode.
  37. " - orange in insert mode.
  38. " Tip found there:
  39. " http://forums.macosxhints.com/archive/index.php/t-49708.html
  40. " It works at least with: xterm rxvt eterm
  41. " But do nothing with: gnome-terminal terminator konsole xfce4-terminal
  42. if version >= 700
  43. if &term =~ "xterm\\|rxvt"
  44. ":silent !echo -ne "\033]12;red\007"
  45. let &t_SI = "\033]12;orange\007"
  46. let &t_EI = "\033]12;red\007"
  47. au! VimLeave * :sil !echo -ne "\033]12;red\007"
  48. endif
  49. endif
  50. endif