From 8d4ca36fd563d440191352abea3de4c69a420bfd Mon Sep 17 00:00:00 2001 From: Chris Coley <chris@codingallnight.com> Date: Tue, 17 Sep 2019 13:41:13 -0700 Subject: [PATCH] Extract most of the FileType specific settings to plugin files Also deleted some FileType specific settings that aren't needed anymore. --- vim/ftdetect/dot.vim | 2 ++ vim/ftplugin/diff.vim | 1 + vim/ftplugin/dot.vim | 2 ++ vim/ftplugin/html.vim | 2 ++ vim/ftplugin/less.vim | 2 ++ vim/ftplugin/php.vim | 2 ++ vim/ftplugin/plsql.vim | 2 ++ vim/ftplugin/sass.vim | 2 ++ vim/ftplugin/sql.vim | 2 ++ vim/ftplugin/vim.vim | 2 ++ vim/ftplugin/yaml.vim | 3 +++ vimrc | 17 ----------------- 12 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 vim/ftdetect/dot.vim create mode 100644 vim/ftplugin/diff.vim create mode 100644 vim/ftplugin/dot.vim create mode 100644 vim/ftplugin/html.vim create mode 100644 vim/ftplugin/less.vim create mode 100644 vim/ftplugin/php.vim create mode 100644 vim/ftplugin/plsql.vim create mode 100644 vim/ftplugin/sass.vim create mode 100644 vim/ftplugin/sql.vim create mode 100644 vim/ftplugin/vim.vim create mode 100644 vim/ftplugin/yaml.vim diff --git a/vim/ftdetect/dot.vim b/vim/ftdetect/dot.vim new file mode 100644 index 0000000..06f3d59 --- /dev/null +++ b/vim/ftdetect/dot.vim @@ -0,0 +1,2 @@ +autocmd BufRead,BufNewFile *.dot setlocal filetype=dot +autocmd BufRead,BufNewFile *.gv setlocal filetype=dot diff --git a/vim/ftplugin/diff.vim b/vim/ftplugin/diff.vim new file mode 100644 index 0000000..bbd8967 --- /dev/null +++ b/vim/ftplugin/diff.vim @@ -0,0 +1 @@ +setlocal noexpandtab diff --git a/vim/ftplugin/dot.vim b/vim/ftplugin/dot.vim new file mode 100644 index 0000000..95db5c0 --- /dev/null +++ b/vim/ftplugin/dot.vim @@ -0,0 +1,2 @@ +" Set the modeline to use a single line comment +let b:ml_commentstring = '// %s' diff --git a/vim/ftplugin/html.vim b/vim/ftplugin/html.vim new file mode 100644 index 0000000..c5c9720 --- /dev/null +++ b/vim/ftplugin/html.vim @@ -0,0 +1,2 @@ +" Add whitespace to the modeline commentstring +let b:ml_commentstring = '<!-- %s -->' diff --git a/vim/ftplugin/less.vim b/vim/ftplugin/less.vim new file mode 100644 index 0000000..95db5c0 --- /dev/null +++ b/vim/ftplugin/less.vim @@ -0,0 +1,2 @@ +" Set the modeline to use a single line comment +let b:ml_commentstring = '// %s' diff --git a/vim/ftplugin/php.vim b/vim/ftplugin/php.vim new file mode 100644 index 0000000..95db5c0 --- /dev/null +++ b/vim/ftplugin/php.vim @@ -0,0 +1,2 @@ +" Set the modeline to use a single line comment +let b:ml_commentstring = '// %s' diff --git a/vim/ftplugin/plsql.vim b/vim/ftplugin/plsql.vim new file mode 100644 index 0000000..93019fe --- /dev/null +++ b/vim/ftplugin/plsql.vim @@ -0,0 +1,2 @@ +" Set the modeline to use a single line comment +let b:ml_commentstring = '-- %s' diff --git a/vim/ftplugin/sass.vim b/vim/ftplugin/sass.vim new file mode 100644 index 0000000..95db5c0 --- /dev/null +++ b/vim/ftplugin/sass.vim @@ -0,0 +1,2 @@ +" Set the modeline to use a single line comment +let b:ml_commentstring = '// %s' diff --git a/vim/ftplugin/sql.vim b/vim/ftplugin/sql.vim new file mode 100644 index 0000000..93019fe --- /dev/null +++ b/vim/ftplugin/sql.vim @@ -0,0 +1,2 @@ +" Set the modeline to use a single line comment +let b:ml_commentstring = '-- %s' diff --git a/vim/ftplugin/vim.vim b/vim/ftplugin/vim.vim new file mode 100644 index 0000000..c15b7cb --- /dev/null +++ b/vim/ftplugin/vim.vim @@ -0,0 +1,2 @@ +" Set the modeline to use a single line comment +let b:ml_commentstring = '" %s' diff --git a/vim/ftplugin/yaml.vim b/vim/ftplugin/yaml.vim new file mode 100644 index 0000000..5e33d4a --- /dev/null +++ b/vim/ftplugin/yaml.vim @@ -0,0 +1,3 @@ +setlocal shiftwidth=2 +setlocal tabstop=2 +setlocal softtabstop=2 diff --git a/vimrc b/vimrc index 69d4b10..50217c6 100644 --- a/vimrc +++ b/vimrc @@ -17,7 +17,6 @@ set backspace=2 " Make Backspace work like you expect set formatoptions+=ro " Automatically insert the comment character when you " hit <Enter> (r) or o/O (o) in a comment block set showbreak=└\ " Prefix wrapped continuation lines with '└ ' -set commentstring=#\ %s " The default comment style for line comments let mapleader='\' " The <leader> key for key maps syntax enable " Syntax highlighting filetype plugin on " Enable the filetype plugin @@ -75,10 +74,6 @@ function! ToggleColorColumn() endfunction -" Associate extensions to filetypes -autocmd BufRead,BufNewFile *.gv setlocal filetype=dot - - " Set the terminal title to reflect the open file. Even works with Vim tabs. autocmd BufEnter * let &titlestring = expand("%:t") . " - %{$USER}@" . hostname() | setlocal title autocmd VimLeave * let &titleold = $USER . "@" . hostname() | setlocal title @@ -99,19 +94,7 @@ endfunction " Filetype specific settings -autocmd FileType diff setlocal noet -autocmd FileType dot setlocal commentstring=//\ %s autocmd FileType dns setlocal commentstring=;\ %s -autocmd FileType gitconfig setlocal commentstring=;\ %s -autocmd FileType go setlocal commentstring=//\ %s -autocmd FileType html setlocal commentstring=<!--\ %s\ --> -autocmd FileType less setlocal commentstring=/*\ %s\ */ -autocmd FileType php setlocal commentstring=//\ %s -autocmd FileType plsql setlocal commentstring=--\ %s -autocmd FileType sass setlocal commentstring=//\ %s -autocmd FileType sql setlocal commentstring=--\ %s -autocmd FileType vim setlocal commentstring=\"\ %s -autocmd FileType yaml,ansible setlocal tabstop=2 shiftwidth=2 softtabstop=2 " Map numpad keys in insert and command-line mode -- GitLab