diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-07-28 19:33:41 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-07-28 19:33:41 -0300 |
commit | 42c2637b1e7a420e5e5017f6fc32c6a9c4b8b252 (patch) | |
tree | c92c263fdb5b95ea020186cf893b2a51e78ebb35 | |
parent | 91baa371aaf7cfa58496f97405ae6b5c040ab8e4 (diff) | |
download | vim-42c2637b1e7a420e5e5017f6fc32c6a9c4b8b252.tar.gz vim-42c2637b1e7a420e5e5017f6fc32c6a9c4b8b252.tar.bz2 |
Feat: use ftplugin
-rw-r--r-- | vim.dot.link/filetype.vim | 84 | ||||
-rw-r--r-- | vim.dot.link/ftplugin/mail.vim | 5 | ||||
-rw-r--r-- | vim.dot.link/ftplugin/markdown.vim | 20 | ||||
-rw-r--r-- | vim.dot.link/ftplugin/php.vim | 2 | ||||
-rw-r--r-- | vim.dot.link/ftplugin/python.vim | 2 | ||||
-rw-r--r-- | vimrc.dot.link | 3 |
6 files changed, 47 insertions, 69 deletions
diff --git a/vim.dot.link/filetype.vim b/vim.dot.link/filetype.vim index 9ab8afd..5513aa1 100644 --- a/vim.dot.link/filetype.vim +++ b/vim.dot.link/filetype.vim @@ -4,73 +4,7 @@ if exists("did_load_filetypes") finish endif -" Markdown -augroup markdown - " Markdown configuration without vim-markdown plugin - " - " 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 - " - " Seem like this things should be set during BufRead or BufNewFile; they're - " not working when set during the FileType event. - autocmd! - autocmd BufRead,BufNewFile *.md set filetype=markdown foldexpr=NestedMarkdownFolds() autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab formatoptions=tcroqn2 comments=n:> - autocmd BufRead,BufNewFile *.mdwn set filetype=ikiwiki foldexpr=NestedMarkdownFolds() - - " Markdown configuration with vim-markdown plugin - "autocmd! - "autocmd BufRead,BufNewFile *.md set autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab formatoptions=tcroqn2 comments=n:> - "let g:vim_markdown_new_list_item_indent = 2 - "let g:vim_markdown_folding_style_pythonic = 1 - "let g:vim_markdown_folding_level = 1 - "let g:vim_markdown_auto_insert_bullets = 0 - "let g:vim_markdown_new_list_item_indent = 0 -augroup END - -" Python -augroup python - autocmd! - autocmd BufRead *.py setfiletype python - autocmd FileType python set autoindent smartindent tabstop=4 softtabstop=4 shiftwidth=4 expandtab -augroup END - -" Puppet -augroup puppet - autocmd! - autocmd BufRead,BufNewFile *.pp setfiletype puppet -augroup END - -" PHP -augroup php - autocmd! - autocmd BufRead,BufNewFile *.php setfiletype php - autocmd FileType php let php_sql_query=1 -augroup END - -" 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 +" Filetype detection " " According to ":help BufRead", this augroup is also evaluated also on " ":filetype detect". @@ -83,4 +17,20 @@ augroup filetypedetect autocmd BufRead,BufNewFile *.rem setfiletype remind autocmd BufRead,BufNewFile *.trac setfiletype tracwiki autocmd BufRead,BufNewFile *.tracwiki setfiletype tracwiki + autocmd BufRead,BufNewFile *.mdwn setfiletype markdown + autocmd BufRead,BufNewFile *.md setfiletype markdown + autocmd BufRead,BufNewFile *.py setfiletype python + autocmd BufRead,BufNewFile *.pp setfiletype puppet + autocmd BufRead,BufNewFile *.php setfiletype php augroup END + +" 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 diff --git a/vim.dot.link/ftplugin/mail.vim b/vim.dot.link/ftplugin/mail.vim new file mode 100644 index 0000000..f21ff9c --- /dev/null +++ b/vim.dot.link/ftplugin/mail.vim @@ -0,0 +1,5 @@ +" Mail +" +" Workaround for mail editing. There must be a plugin enabling autoindent in +" mail composition, which is annoying. +set noautoindent diff --git a/vim.dot.link/ftplugin/markdown.vim b/vim.dot.link/ftplugin/markdown.vim new file mode 100644 index 0000000..99d0ed3 --- /dev/null +++ b/vim.dot.link/ftplugin/markdown.vim @@ -0,0 +1,20 @@ +" Markdown configuration + +" Markdown configuration without vim-markdown plugin +" +" 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 +set foldexpr=NestedMarkdownFolds() +set autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 +set expandtab formatoptions=tcroqn2 comments=n:> + +" Markdown configuration with vim-markdown plugin +"set autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab formatoptions=tcroqn2 comments=n:> +"let g:vim_markdown_new_list_item_indent = 2 +"let g:vim_markdown_folding_style_pythonic = 1 +"let g:vim_markdown_folding_level = 1 +"let g:vim_markdown_auto_insert_bullets = 0 +"let g:vim_markdown_new_list_item_indent = 0 diff --git a/vim.dot.link/ftplugin/php.vim b/vim.dot.link/ftplugin/php.vim new file mode 100644 index 0000000..9892f83 --- /dev/null +++ b/vim.dot.link/ftplugin/php.vim @@ -0,0 +1,2 @@ +" PHP +let php_sql_query=1 diff --git a/vim.dot.link/ftplugin/python.vim b/vim.dot.link/ftplugin/python.vim new file mode 100644 index 0000000..3e27472 --- /dev/null +++ b/vim.dot.link/ftplugin/python.vim @@ -0,0 +1,2 @@ +" Python +set autoindent smartindent tabstop=4 softtabstop=4 shiftwidth=4 expandtab diff --git a/vimrc.dot.link b/vimrc.dot.link index e86464e..65c0c03 100644 --- a/vimrc.dot.link +++ b/vimrc.dot.link @@ -26,8 +26,7 @@ let mapleader=" " " Syntax highlighting syntax on -" Indenting -filetype indent off +" Filetype handling filetype plugin indent on " Syntax check |