Question

I am using a plugin that redefine a filetype:

cat ~/.vim/bundle/kdb-vim/filetype.vim

if exists("did_load_filetypes")
  finish
endif
augroup filetypedetect
  au! BufRead,BufNewFile *.k            setfiletype k
  au! BufRead,BufNewFile *.q            setfiletype q
  au! BufRead,BufNewFile *.s            setfiletype sql
augroup END

And in my vimrc:

set nocompatible
filetype off                                            
                                                                                                    
set rtp+=~/.vim/bundle/vundle                                                                       
set rtp+=~/.vim/bundle/Align                                                                        
set rtp+=~/.vim/bundle/Vim-R-plugin                                                                 
set rtp+=~/.vim/bundle/ctrlp.vim                                                                    
set rtp+=~/.vim/bundle/minibufexpl.vim                                                              
set rtp+=~/.vim/bundle/nerdcommenter                                                                
set rtp+=~/.vim/bundle/nerdtree                                                                     
set rtp+=~/.vim/bundle/syntastic                                                                    
set rtp+=~/.vim/bundle/ultisnips                                                                    
set rtp+=~/.vim/bundle/vim-fugitive                                                                 
set rtp+=~/.vim/bundle/screen                                                                       
set rtp+=~/.vim/bundle/kdb-vim                                                                      
set rtp+=~/.vim/bundle/statquantPlugin                                                              
                                            
filetype plugin on                                                                                  
filetype indent on                                                                                  
syntax   on   

When I try to open a *q file the filetype is not detected. Then I commented out

if exists("did_load_filetypes")
  finish
endif 

So there the file is detected but then when I start writting some stuff and reopen the file the filetype swith to CONF. I need it as I statquantPlugin I configured something to act based on the filetype.

NOTE: I do not have access to the $VIM directory files

What can I do to have the filetype right ? Regards

I changed

$ cat .vim/bundle/kdb-vim/ftdetect/myFiletype.vim 
" my filetype file
"if exists("did_load_filetypes")
"  finish
"endif
"augroup filetypedetect
  au! BufRead,BufNewFile *.k            setfiletype k
  au! BufRead,BufNewFile *.q            setfiletype q
  au! BufRead,BufNewFile *.s            setfiletype sql
"augroup END

NOW working

Was it helpful?

Solution

filetype.vim is the main filetype detection script; you shouldn't override it. Instead, put (only the au! BufRead,BufNewFile lines, the include guard and :augroup isn't necessary there) this into a file ~/.vim/bundle/kdb-vim/ftdetect/myfiletypes.vim. See :help ftdetect.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top