diff options
-rw-r--r-- | vim.dot.link/filetype.vim | 62 | ||||
-rw-r--r-- | vimrc.dot.link | 48 |
2 files changed, 54 insertions, 56 deletions
diff --git a/vim.dot.link/filetype.vim b/vim.dot.link/filetype.vim index 2b958bc..6401d41 100644 --- a/vim.dot.link/filetype.vim +++ b/vim.dot.link/filetype.vim @@ -4,20 +4,66 @@ if exists("did_load_filetypes") finish endif -" markdown filetype file - +" Markdown augroup markdown - au! BufRead,BufNewFile *.mkd setfiletype mkd + " File extensions + autocmd! + autocmd BufRead,BufNewFile *.md setfiletype markdown + autocmd BufRead,BufNewFile *.mkd setfiletype markdown + autocmd BufRead,BufNewFile *.md setfiletype markdown + autocmd BufRead,BufNewFile *.mdwn setfiletype ikiwiki + + " Markdown configuration + " + " Include folding setup: + " https://github.com/masukomi/vim-markdown-folding + " + " Alternative folding method: + " https://codereview.stackexchange.com/questions/202620/vim-plugin-for-folding-markdown-lists + autocmd FileType markdown set foldexpr=NestedMarkdownFolds() + autocmd FileType markdown set autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab formatoptions=tcroqn2 comments=n:> augroup END -" detect puppet filetypes +" Python +augroup python + autocmd! + autocmd BufRead *.py setfiletype python + autocmd FileType python set autoindent smartindent tabstop=4 softtabstop=4 shiftwidth=4 expandtab +augroup END -augroup filetypedetect - au! BufRead,BufNewFile *.pp setfiletype puppet +" Puppet +augroup puppet + autocmd BufRead,BufNewFile *.pp setfiletype puppet augroup END -" detect drupal modules +" Drupal *.module and *.install files. +if has("autocmd") + augroup module + autocmd! + autocmd BufRead,BufNewFile *.profile setfiletype php + autocmd BufRead,BufNewFile *.module setfiletype php + autocmd BufRead,BufNewFile *.install setfiletype php + autocmd BufRead,BufNewFile *.test setfiletype php + augroup END +endif + +" Mail +" +" Workaround for mail editing. There must be a plugin enabling autoindent in +" mail composition, which is annoying. +augroup mail + autocmd! + autocmd FileType mail set noautoindent +augroup END +" Other filetypes augroup filetypedetect - au! BufRead,BufNewFile *.module setfiletype php + autocmd! + autocmd BufRead,BufNewFile kvmxfile setfiletype sh + autocmd BufRead,BufNewFile Vagrantfile setfiletype ruby + autocmd BufRead,BufNewFile *.vue setfiletype html + autocmd BufRead,BufNewFile *.thtml setfiletype php + autocmd BufRead,BufNewFile *.rem setfiletype remind + autocmd BufRead,BufNewFile *.trac setfiletype tracwiki + autocmd BufRead,BufNewFile *.tracwiki setfiletype tracwiki augroup END diff --git a/vimrc.dot.link b/vimrc.dot.link index c2454bf..9c19dfd 100644 --- a/vimrc.dot.link +++ b/vimrc.dot.link @@ -78,47 +78,6 @@ filetype plugin indent on "let vimsyn_folding='af' "let xml_syntax_folding=1 -" Setup https://github.com/masukomi/vim-markdown-folding -" Alternative method: https://codereview.stackexchange.com/questions/202620/vim-plugin-for-folding-markdown-lists -autocmd FileType markdown set foldexpr=NestedMarkdownFolds() - -" Filetypes -augroup vimrc_syntax - autocmd! - au BufNewFile,BufRead *.vue set ft=html - au BufNewFile,BufRead *.thtml set ft=php - au BufNewFile,BufRead *.mdwn set ft=ikiwiki - au BufNewFile,BufRead *.md set ft=markdown - au BufNewFile,BufRead *.rem set ft=remind - au BufNewFile,BufRead *.trac set ft=tracwiki - au BufNewFile,BufRead *.tracwiki set ft=tracwiki - au BufNewFile,BufRead Vagrantfile set ft=ruby - au BufNewFile,BufRead kvmxfile set ft=sh -augroup END - -" Markdown -augroup markdown - autocmd! - autocmd BufRead *.md set autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab formatoptions=tcroqn2 comments=n:> -augroup END - -" Python -augroup python - autocmd! - autocmd BufRead *.py set autoindent smartindent tabstop=4 softtabstop=4 shiftwidth=4 expandtab -augroup END - -" Drupal *.module and *.install files. -if has("autocmd") - augroup module - autocmd! - autocmd BufRead,BufNewFile *.profile set filetype=php - autocmd BufRead,BufNewFile *.module set filetype=php - autocmd BufRead,BufNewFile *.install set filetype=php - autocmd BufRead,BufNewFile *.test set filetype=php - augroup END -endif - " PHP let php_sql_query=1 @@ -359,13 +318,6 @@ command -nargs=0 OpenNERDTree :call OpenNERDTree() vnoremap <C-c> "+yi vnoremap <C-x> "+c -" Workaround for mail editing. There must be a plugin enabling autoindent in -" mail composition, which is annoying. -augroup mail - autocmd! - au FileType mail set noautoindent -augroup END - " For email: unfold and delete to your signature " See https://hroy.eu/tips/vim/email-delete-til-signature/ noremap ,dd zi:.;/^-- $/d<CR>O-- <UP><End><CR><CR><UP><CR><C-O>zi |