From 5b1a253e9beb3645e6663cf5c989cf434c0ea5db Mon Sep 17 00:00:00 2001 From: Artem Nezvigin Date: Sat, 2 Mar 2013 11:14:57 -0800 Subject: [PATCH] Fix new tabs overriding default syntax rules Calling `syntax on` will override existing syntax rules with default ones. This ends up adding a bunch of syntax rules that users have disabled. See `:help syntax` for this snippet: The ":syntax enable" command will keep your current color settings. This allows using ":highlight" commands to set your preferred colors before or after using this command. If you want Vim to overrule your settings with the defaults, use: `:syntax on` Calling `:syntax enable` doesn't appear to work either. It does the same thing as `:syntax on`. So the solution implemented here is to conditionally set the filetype and syntax rules when they aren't already set. --- autoload/jedi.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/jedi.vim b/autoload/jedi.vim index b1041a7..59ad137 100644 --- a/autoload/jedi.vim +++ b/autoload/jedi.vim @@ -97,8 +97,12 @@ function! jedi#new_buffer(path) Python vim.command('edit ' + jedi_vim.escape_file_path(vim.eval('a:path'))) endif " sometimes syntax is being disabled and the filetype not set. - syntax on - set filetype=python + if !exists("g:syntax_on") + syntax enable + endif + if &filetype != 'python' + set filetype=python + endif endfunction function! jedi#add_goto_window()