|
guys/experts:
sorry If I'm asking an idiot question... I'm learning about auto detection of file type and apply my own syntax highlight+folding based on it. so overall we have following machnism: 1) ex: set ft= 2) modeline: vim:ft= .. 3) $VIMRUNTIME/filetype.vim 4) ~/.vim/ftdetect/xxx_filetype.vim 5) .... what's the complete logic/detect order in place here? help ftdetect does give me a lot of good info, but I'm not sure in what sequence vim applies them? thanks regards ping -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
|
On 7/3/2012 10:43 AM, ping wrote:
> guys/experts: > sorry If I'm asking an idiot question... > I'm learning about auto detection of file type and apply my own syntax > highlight+folding based on it. > so overall we have following machnism: > > 1) ex: set ft= > 2) modeline: vim:ft= .. > 3) $VIMRUNTIME/filetype.vim > 4) ~/.vim/ftdetect/xxx_filetype.vim > 5) .... > > what's the complete logic/detect order in place here? > > help ftdetect does give me a lot of good info, but I'm not sure in what > sequence vim applies them? > > thanks > > regards > ping after read more... now to answer my own questions now, please correct me if I'm wrong or missing anything... :help filetype tells: --------------------------------------- turn file type detection on [:filetype on] => locate and load filetype.vim => it contains: autocommands for the BufNewFile and BufRead events fail? => locate and load scripts.vim , and detect from the contents turn plugin option on [:filetype plugin on] => locate and load ftplugin.vim load ftplugin/ and all its files :help runtimepath --------------------------------------- tells in what sequence the above files/folders should be searched and loaded. ALL (not the first found) found files/folders will be loaded. another email from the vim_use group (Gary) -------------------------------------- so anything you set in ~/.vim/ftplugin/python/python.vim may be overwritten in /usr/local/share/vim/vim73/ftplugin/python.vim. You can add code to your plugin to prevent the contents of Vim's plugin from being executed, but that isn't what you want to do here. Instead, you should put your option setting in ~/.vim/after/ftpluin/python.vim or ~/.vim/after/ftplugin/python/python.vim so that yours is set after Vim's. -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
|
On 7/17/2012 12:53 AM, ping wrote:
> On 7/3/2012 10:43 AM, ping wrote: >> guys/experts: >> sorry If I'm asking an idiot question... >> I'm learning about auto detection of file type and apply my own syntax >> highlight+folding based on it. >> so overall we have following machnism: >> >> 1) ex: set ft= >> 2) modeline: vim:ft= .. >> 3) $VIMRUNTIME/filetype.vim >> 4) ~/.vim/ftdetect/xxx_filetype.vim >> 5) .... >> >> what's the complete logic/detect order in place here? >> >> help ftdetect does give me a lot of good info, but I'm not sure in what >> sequence vim applies them? >> >> thanks >> >> regards >> ping > > after read more... > now to answer my own questions now, please correct me if I'm wrong or > missing anything... > > :help filetype tells: > --------------------------------------- > turn file type detection on [:filetype on] => > locate and load filetype.vim => > it contains: autocommands for the BufNewFile and BufRead events > fail? => > locate and load scripts.vim , and detect from the contents > > turn plugin option on [:filetype plugin on] => > locate and load ftplugin.vim > load ftplugin/ and all its files > > > :help runtimepath > --------------------------------------- > tells in what sequence the above files/folders should be searched and > loaded. ALL (not the first found) found files/folders will be loaded. > > another email from the vim_use group (Gary) > -------------------------------------- > so anything you set in ~/.vim/ftplugin/python/python.vim may be > overwritten in /usr/local/share/vim/vim73/ftplugin/python.vim. You > can add code to your plugin to prevent the contents of Vim's plugin > from being executed, but that isn't what you want to do here. > Instead, you should put your option setting in > ~/.vim/after/ftpluin/python.vim or > ~/.vim/after/ftplugin/python/python.vim so that yours is set after Vim's. I got following from help usr_43.txt: Therefore, the order of checks is: 1. filetype.vim files before $VIMRUNTIME in 'runtimepath' 2. first part of $VIMRUNTIME/filetype.vim 3. all scripts.vim files in 'runtimepath' 4. remainder of $VIMRUNTIME/filetype.vim 5. filetype.vim files after $VIMRUNTIME in 'runtimepath' -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
| Powered by Nabble | Edit this page |
