diff --git a/vim/ftdetect/dot.vim b/vim/ftdetect/dot.vim
new file mode 100644
index 0000000000000000000000000000000000000000..06f3d59ec483b3d3b1a66f128c569b5316a62176
--- /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 0000000000000000000000000000000000000000..bbd8967d578154182ad48d42abf35b404e7e3768
--- /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 0000000000000000000000000000000000000000..95db5c06beb69eff1e95803094dd300fd9060b37
--- /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 0000000000000000000000000000000000000000..c5c972082ade2abe40193e172a2bec9f3b56b7f2
--- /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 0000000000000000000000000000000000000000..95db5c06beb69eff1e95803094dd300fd9060b37
--- /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 0000000000000000000000000000000000000000..95db5c06beb69eff1e95803094dd300fd9060b37
--- /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 0000000000000000000000000000000000000000..93019fea85b1c61daf3c23c74ac9ca40d440a82b
--- /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 0000000000000000000000000000000000000000..95db5c06beb69eff1e95803094dd300fd9060b37
--- /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 0000000000000000000000000000000000000000..93019fea85b1c61daf3c23c74ac9ca40d440a82b
--- /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 0000000000000000000000000000000000000000..c15b7cb2f7f6611760a0d554b94a28fb6c653608
--- /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 0000000000000000000000000000000000000000..5e33d4a741a39b582ea67c6bb00c5edc0d638934
--- /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 69d4b10b9c8940a1610c514a8a363606a86c1938..50217c6773e5b6e7470aae50d10083cb9825174f 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