summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-06-08 13:14:56 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2019-06-08 13:14:56 +0200
commit17ecfbdabcfdf294dae27c506fb68b58175199b5 (patch)
treea6d1e836815a4bba2bbdf806cb539d191e604ab3
parent0217fb50fe40a631cc220462520249e36dbc919a (diff)
downloadvim-polyglot-17ecfbdabcfdf294dae27c506fb68b58175199b5.tar.gz
vim-polyglot-17ecfbdabcfdf294dae27c506fb68b58175199b5.zip
Add s:setf helper, fixes #399
-rw-r--r--config.vim6
-rw-r--r--ftdetect/polyglot.vim6
2 files changed, 12 insertions, 0 deletions
diff --git a/config.vim b/config.vim
index 4e6ecae4..21be71bb 100644
--- a/config.vim
+++ b/config.vim
@@ -1,3 +1,9 @@
+function! s:setf(filetype) abort
+ if &filetype !=# a:filetype
+ let &filetype = a:filetype
+ endif
+endfunction
+
" Enable jsx syntax by default
if !exists('g:jsx_ext_required')
let g:jsx_ext_required = 0
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim
index 3fb51075..830b1fb7 100644
--- a/ftdetect/polyglot.vim
+++ b/ftdetect/polyglot.vim
@@ -1,3 +1,9 @@
+function! s:setf(filetype) abort
+ if &filetype !=# a:filetype
+ let &filetype = a:filetype
+ endif
+endfunction
+
" Enable jsx syntax by default
if !exists('g:jsx_ext_required')
let g:jsx_ext_required = 0