Skip to content

Commit

Permalink
cleanup in autocmds
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Aug 29, 2013
1 parent 2864ae9 commit 1e55d59
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions vimrc
Expand Up @@ -78,22 +78,23 @@ set ttimeoutlen=100

" Ragel syntax (default to ruby as host language)
let g:ragel_default_subtype='ruby'
autocmd BufNewFile,BufRead *.rl setfiletype ragel

function s:setupWrapping()
set wrap
set wrapmargin=2
set textwidth=80
endfunction

if has("autocmd")
augroup vimrcEx
" Clear all autocmds in the group
autocmd!

" Avoid showing trailing whitespace when in insert mode
au InsertEnter * :set listchars-=trail:
au InsertLeave * :set listchars+=trail:

" Some file types use real tabs
au FileType make set noexpandtab
au FileType gitconfig set noexpandtab
au FileType {make,gitconfig} set noexpandtab

" Make sure all markdown files have the correct filetype set and setup wrapping
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} setf markdown | call s:setupWrapping()
Expand All @@ -104,6 +105,8 @@ if has("autocmd")
" https://github.com/sstephenson/bats
au BufNewFile,BufRead *.bats setf sh

au BufNewFile,BufRead *.rl setfiletype ragel

" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79

Expand All @@ -121,7 +124,7 @@ if has("autocmd")
au BufLeave *.{css,scss,sass} exe "normal! mS"
au BufLeave *.{js,coffee} exe "normal! mJ"
au BufLeave *.{rb} exe "normal! mC"
endif
augroup END

" don't use Ex mode, use Q for formatting
map Q gq
Expand Down

0 comments on commit 1e55d59

Please sign in to comment.