2
0
mirror of https://github.com/webgefrickel/dotfiles synced 2024-11-17 09:25:52 +00:00
steffen-dotfiles/vim/config/autocommands.vim
Steffen Rademacker c911f34027 Split up vimrc in separate files
With default configs and configs for plugins. Wrap autocommands
in a vimrc group as well.
2015-05-05 13:18:25 +02:00

33 lines
1.3 KiB
VimL

" autocommands, filetypes, spelling, keywords for specific filetypes
"======================================================================
" define a group `vimrc` and initialize.
augroup vimrc
autocmd!
" Remember last location/cursor in file
autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif
" spell correction on text-files
autocmd BufNewFile,BufRead *.md setlocal spell
" add the dash to keywords -- makes better css/js/html search
" do this for specific files only (not in php/rb e.g.)
autocmd BufNewFile,BufRead *.{js,scss,html} set iskeyword+=-
autocmd BufNewFile,BufRead *.{js,scss,html} set iskeyword-=_
autocmd BufNewFile,BufRead *.php set iskeyword-=-
" scss.css snippets and stuff
autocmd BufNewFile,BufRead *.scss set filetype=scss.css
" Syntaxes for other files
autocmd BufNewFile,BufRead *.twig set filetype=html.twig
" omnicompletion for some filetypes
autocmd FileType css,scss setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,php,twig setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
augroup END