aboutsummaryrefslogtreecommitdiff
path: root/vim/after
diff options
context:
space:
mode:
Diffstat (limited to 'vim/after')
-rw-r--r--vim/after/ftplugin/html.vim16
-rw-r--r--vim/after/ftplugin/php.vim11
-rw-r--r--vim/after/indent/c.vim6
-rw-r--r--vim/after/indent/gitconfig.vim9
4 files changed, 21 insertions, 21 deletions
diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim
index d9c0149c..7866f31b 100644
--- a/vim/after/ftplugin/html.vim
+++ b/vim/after/ftplugin/html.vim
@@ -1,6 +1,11 @@
-" Spellcheck documents we're actually editing (not just viewing), as long as
-" they're actually HTML buffers and not just dotting this in
-if &modifiable && !&readonly && &filetype ==# 'html'
+" None of this is appropriate for other filetypes that are just sourcing this
+" filetype's scripts in, e.g. Markdown, PHP, so cut that off here
+if &filetype !=# 'html'
+ finish
+endif
+
+" Spellcheck documents we're actually editing (not just viewing)
+if &modifiable && !&readonly
setlocal spell
let b:undo_ftplugin .= '|setlocal spell<'
endif
@@ -36,8 +41,3 @@ endif
nnoremap <buffer> <LocalLeader>r
\ :<C-U>call html#UrlLink()<CR>
let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>r'
-
-" Switch to PHP filetype for templated PHP
-nnoremap <buffer> <LocalLeader>f
- \ :<C-U>setlocal filetype=php<CR>
-let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>f'
diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim
index 3b023f9e..c7f77ece 100644
--- a/vim/after/ftplugin/php.vim
+++ b/vim/after/ftplugin/php.vim
@@ -21,12 +21,7 @@ let b:undo_ftplugin .= '|setlocal keywordprg<'
let b:regex_escape_flavor = 'ere'
let b:undo_ftplugin .= '|unlet b:regex_escape_flavor'
-" Stop here if the user doesn't want ftplugin mappings
-if exists('no_plugin_maps') || exists('no_php_maps')
- finish
+" Set HTML as an alternative filetype
+if !exists('b:alternate_filetypes')
+ let b:alternate_filetypes = [&filetype, 'html']
endif
-
-" Switch to HTML filetype for templated PHP
-nnoremap <buffer> <LocalLeader>f
- \ :<C-U>setlocal filetype=html<CR>
-let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>f'
diff --git a/vim/after/indent/c.vim b/vim/after/indent/c.vim
index dfc50242..ad01aceb 100644
--- a/vim/after/indent/c.vim
+++ b/vim/after/indent/c.vim
@@ -1,9 +1,11 @@
" Use hard tabs for C
-setlocal noexpandtab shiftwidth=0 tabstop=8
+setlocal noexpandtab
+setlocal shiftwidth=0
+let b:undo_indent .= '|setlocal expandtab< shiftwidth<'
if &softtabstop != -1
let &softtabstop = &shiftwidth
+ let b:undo_indent .= '|setlocal softtabstop<'
endif
-let b:undo_indent .= '|setlocal expandtab< shiftwidth< softtabstop< tabstop<'
" If the path to the file looks like the Vim sources, set 'shiftwidth' to 4
if expand('%:p') =~# '/vim.*src/'
diff --git a/vim/after/indent/gitconfig.vim b/vim/after/indent/gitconfig.vim
index 16a948ab..ff1654e5 100644
--- a/vim/after/indent/gitconfig.vim
+++ b/vim/after/indent/gitconfig.vim
@@ -1,6 +1,9 @@
" Use tabs for indent in Git config files, rather than fighting with the
" frontend tool
setlocal noexpandtab
-setlocal softtabstop=0
-let &shiftwidth = &tabstop
-let b:undo_indent .= '|setlocal expandtab< softtabstop< shiftwidth<'
+setlocal shiftwidth=0
+let b:undo_indent .= '|setlocal expandtab< shiftwidth<'
+if &softtabstop != -1
+ let &softtabstop = &shiftwidth
+ let b:undo_indent .= '|setlocal softtabstop<'
+endif