Extract filetype-specific setups to ftplugin
Vim's documentation advises that buffer-specific configuration based on a filetype should be performed via a file in `$HOME/.vim/ftplugin`: http://vimdoc.sourceforge.net/htmldoc/usr_41.html#41.12 This change moves CSS/Sass-, Git commit message-, and Markdown-related editor settings into `ftplugin/gitcommit.vim` and `ftplugin/markdown.vim`, and rewrites those settings to avoid using `autocmd`, letting Vim execute `setlocal` when a file of the filetype is determined or set.
This commit is contained in:
parent
2d9e8bf0e8
commit
f02eab0354
6 changed files with 11 additions and 13 deletions
1
vim/ftplugin/css.vim
Normal file
1
vim/ftplugin/css.vim
Normal file
|
@ -0,0 +1 @@
|
|||
setlocal iskeyword+=-
|
3
vim/ftplugin/gitcommit.vim
Normal file
3
vim/ftplugin/gitcommit.vim
Normal file
|
@ -0,0 +1,3 @@
|
|||
" Automatically wrap at 72 characters and spell check commit messages
|
||||
setlocal textwidth=72
|
||||
setlocal spell
|
5
vim/ftplugin/markdown.vim
Normal file
5
vim/ftplugin/markdown.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
" Enable spellchecking
|
||||
setlocal spell
|
||||
|
||||
" Automatically wrap at 80 characters
|
||||
setlocal textwidth=80
|
1
vim/ftplugin/sass.vim
Normal file
1
vim/ftplugin/sass.vim
Normal file
|
@ -0,0 +1 @@
|
|||
setlocal iskeyword+=-
|
1
vim/ftplugin/scss.vim
Normal file
1
vim/ftplugin/scss.vim
Normal file
|
@ -0,0 +1 @@
|
|||
setlocal iskeyword+=-
|
13
vimrc
13
vimrc
|
@ -44,19 +44,6 @@ augroup vimrcEx
|
|||
autocmd BufRead,BufNewFile Appraisals set filetype=ruby
|
||||
autocmd BufRead,BufNewFile *.md set filetype=markdown
|
||||
autocmd BufRead,BufNewFile .{jscs,jshint,eslint}rc set filetype=json
|
||||
|
||||
" Enable spellchecking for Markdown
|
||||
autocmd FileType markdown setlocal spell
|
||||
|
||||
" Automatically wrap at 80 characters for Markdown
|
||||
autocmd BufRead,BufNewFile *.md setlocal textwidth=80
|
||||
|
||||
" Automatically wrap at 72 characters and spell check git commit messages
|
||||
autocmd FileType gitcommit setlocal textwidth=72
|
||||
autocmd FileType gitcommit setlocal spell
|
||||
|
||||
" Allow stylesheets to autocomplete hyphenated words
|
||||
autocmd FileType css,scss,sass setlocal iskeyword+=-
|
||||
augroup END
|
||||
|
||||
" Softtabs, 2 spaces
|
||||
|
|
Loading…
Add table
Reference in a new issue