From d73c1a756ca33f3ee1e43da74034c37830b6ffa0 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 28 Sep 2017 20:31:48 -0400 Subject: [PATCH] vim: put all ftdetect autocmd to ftdetect.vim Moved from shared.vim to reload these autocmd after ':filetype off' --- ftdetect/ftdetect.vim | 28 ++++++++++++++++++++++++++++ shared.vim | 18 ------------------ 2 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 ftdetect/ftdetect.vim diff --git a/ftdetect/ftdetect.vim b/ftdetect/ftdetect.vim new file mode 100644 index 0000000..3609e8e --- /dev/null +++ b/ftdetect/ftdetect.vim @@ -0,0 +1,28 @@ +" Copyright 2017 Jan Edmund Doroin Lazo +" +" Licensed under the Apache License, Version 2.0 (the "License"); +" you may not use this file except in compliance with the License. +" You may obtain a copy of the License at +" +" http://www.apache.org/licenses/LICENSE-2.0 +" +" Unless required by applicable law or agreed to in writing, software +" distributed under the License is distributed on an "AS IS" BASIS, +" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +" See the License for the specific language governing permissions and +" limitations under the License. +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if has('autocmd') + let s:globs = { + \ 'coffee': ['*.cson'], + \ 'dosini': ['.npmrc'], + \ 'json': ['*.json', '.bowerrc', 'composer.lock'], + \ 'pandoc': ['*.pandoc'] + \ } + + for s:list in items(s:globs) + execute 'autocmd filetypedetect BufNewFile,BufRead' join(s:list[1], ',') 'setfiletype' s:list[0] + endfor + + unlet s:globs s:list +endif diff --git a/shared.vim b/shared.vim index c78c776..6b7e974 100644 --- a/shared.vim +++ b/shared.vim @@ -231,24 +231,6 @@ if has('autocmd') let g:vimsyn_embed = '' let g:vim_indent_cont = 0 let g:tex_flavor = 'latex' - let s:globs = { - \ 'coffee': ['*.cson'], - \ 'dosini': ['.npmrc'], - \ 'json': ['*.json', '.bowerrc', 'composer.lock'], - \ 'pandoc': ['*.pandoc'] - \ } - - if exists('g:did_load_filetypes') - filetype off - endif - - augroup filetypedetect - for s:list in items(s:globs) - execute 'autocmd BufNewFile,BufRead' join(s:list[1], ',') 'setfiletype' s:list[0] - endfor - augroup END - - unlet s:globs s:list endif " }}}normal " {{{big