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