From edeb64eced3365b93cdf1b3d4e10f472ec29fabd Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 2 Sep 2019 12:27:31 +0300 Subject: [PATCH] Move filetype-related Vim hooks to separate files --- vim/.vim/ftdetect/conf.vim | 1 + vim/.vim/ftdetect/python.vim | 1 + vim/.vim/ftdetect/sql.vim | 1 + vim/.vim/ftdetect/tex.vim | 3 +++ vim/.vim/ftplugin/gitcommit/spell.vim | 1 + vim/.vim/ftplugin/gitcommit/tw.vim | 1 + vim/.vim/ftplugin/go/autos.vim | 3 +++ vim/.vim/ftplugin/texinfo/autos.vim | 1 + vim/.vim/ftplugin/yaml/sw.vim | 1 + vim/.vim/plugin/killsig.vim | 1 + vim/.vimrc | 12 ------------ 11 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 vim/.vim/ftdetect/conf.vim create mode 100644 vim/.vim/ftdetect/python.vim create mode 100644 vim/.vim/ftdetect/sql.vim create mode 100644 vim/.vim/ftdetect/tex.vim create mode 100644 vim/.vim/ftplugin/gitcommit/spell.vim create mode 100644 vim/.vim/ftplugin/gitcommit/tw.vim create mode 100644 vim/.vim/ftplugin/texinfo/autos.vim create mode 100644 vim/.vim/ftplugin/yaml/sw.vim diff --git a/vim/.vim/ftdetect/conf.vim b/vim/.vim/ftdetect/conf.vim new file mode 100644 index 0000000..9345bbd --- /dev/null +++ b/vim/.vim/ftdetect/conf.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.conf setlocal noexpandtab diff --git a/vim/.vim/ftdetect/python.vim b/vim/.vim/ftdetect/python.vim new file mode 100644 index 0000000..182a76e --- /dev/null +++ b/vim/.vim/ftdetect/python.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.pyi setlocal filetype=python diff --git a/vim/.vim/ftdetect/sql.vim b/vim/.vim/ftdetect/sql.vim new file mode 100644 index 0000000..d8b8b37 --- /dev/null +++ b/vim/.vim/ftdetect/sql.vim @@ -0,0 +1 @@ +autocmd BufRead /tmp/psql.edit* setlocal filetype=sql diff --git a/vim/.vim/ftdetect/tex.vim b/vim/.vim/ftdetect/tex.vim new file mode 100644 index 0000000..19517da --- /dev/null +++ b/vim/.vim/ftdetect/tex.vim @@ -0,0 +1,3 @@ +autocmd BufNewFile,BufRead *.tex abbreviate framedo \begin{frame}\frametitle{TODO}\end{frame}k>>wwlcw +autocmd BufNewFile,BufRead *.tex abbreviate itemdo \begin{itemize}\item \end{itemize}k>>$a +autocmd BufNewFile,BufRead *.tex abbreviate cnter \begin{center}\end{center}k$o diff --git a/vim/.vim/ftplugin/gitcommit/spell.vim b/vim/.vim/ftplugin/gitcommit/spell.vim new file mode 100644 index 0000000..2ffef3c --- /dev/null +++ b/vim/.vim/ftplugin/gitcommit/spell.vim @@ -0,0 +1 @@ +setlocal spell spelllang=ru,en_gb diff --git a/vim/.vim/ftplugin/gitcommit/tw.vim b/vim/.vim/ftplugin/gitcommit/tw.vim new file mode 100644 index 0000000..446f25e --- /dev/null +++ b/vim/.vim/ftplugin/gitcommit/tw.vim @@ -0,0 +1 @@ +setlocal textwidth=72 diff --git a/vim/.vim/ftplugin/go/autos.vim b/vim/.vim/ftplugin/go/autos.vim index e5023b1..faad3c9 100644 --- a/vim/.vim/ftplugin/go/autos.vim +++ b/vim/.vim/ftplugin/go/autos.vim @@ -1,2 +1,5 @@ +set noexpandtab +let g:defsplit_shift=" " + let @e = "^iif err = A; err != nil {o " let @r = "oif err != nil { }O " diff --git a/vim/.vim/ftplugin/texinfo/autos.vim b/vim/.vim/ftplugin/texinfo/autos.vim new file mode 100644 index 0000000..d8a2d8a --- /dev/null +++ b/vim/.vim/ftplugin/texinfo/autos.vim @@ -0,0 +1 @@ +abbreviate \t @tab diff --git a/vim/.vim/ftplugin/yaml/sw.vim b/vim/.vim/ftplugin/yaml/sw.vim new file mode 100644 index 0000000..6f78fab --- /dev/null +++ b/vim/.vim/ftplugin/yaml/sw.vim @@ -0,0 +1 @@ +setlocal shiftwidth=2 diff --git a/vim/.vim/plugin/killsig.vim b/vim/.vim/plugin/killsig.vim index d857425..d106b42 100644 --- a/vim/.vim/plugin/killsig.vim +++ b/vim/.vim/plugin/killsig.vim @@ -7,3 +7,4 @@ function! s:KillSignature() endfunction autocmd BufRead /tmp/mutt-* call s:KillSignature() +autocmd BufRead /tmp/mutt-* setlocal textwidth=72 diff --git a/vim/.vimrc b/vim/.vimrc index 6d0607a..516e670 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -118,18 +118,6 @@ set formatoptions+=n " }}} autocmd BufEnter * let &titlestring = expand("%:t") -autocmd BufRead /tmp/mutt-* setlocal textwidth=72 -autocmd BufRead,BufNewFile *.pyi setlocal filetype=python -autocmd BufRead,BufNewFile *.conf setlocal noexpandtab -autocmd BufRead,BufNewFile *.go setlocal noexpandtab -autocmd BufRead,BufNewFile *.go let g:defsplit_shift=" " -autocmd BufNewFile,BufRead *.tex abbreviate framedo \begin{frame}\frametitle{TODO}\end{frame}k>>wwlcw -autocmd BufNewFile,BufRead *.tex abbreviate itemdo \begin{itemize}\item \end{itemize}k>>$a -autocmd BufNewFile,BufRead *.tex abbreviate cnter \begin{center}\end{center}k$o -autocmd Filetype texinfo abbreviate \t @tab -autocmd Filetype gitcommit setlocal textwidth=72 -autocmd BufRead /tmp/psql.edit* setlocal filetype=sql -autocmd Filetype yaml setlocal shiftwidth=2 set keywordprg= -- 2.44.0