![]() Here I used the VimEnter event but you could also try the SessionLoadPost event :Īutocmd SessionLoadPost * source /path/to/custom_colors. Since this file should be sourced after Session.vim, its settings should not be overwritten. For example, something like this :Īutocmd VimEnter * source /path/to/custom_colors.vim Write your custom highlight groups into a dedicated file (let's say custom_colors.vim) and then, inside your vimrc, add an autocmd that automatically source this file at the end of the startup. Saving the session or include it inside your vimrc : set sessionoptions-=optionsĪs a result, your sessionsoptions value will beīlank,buffers,curdir,folds,help,tabpages,winsize and your options You could use the following command before The options part is responsible for saving options (including the It's blank,buffers,curdir,folds,help,options,tabpages,winsize. Now, but you will have to do it again every time you create a newĬhange the value of the sessionoptions option. I don't know if it will work, but here are a few suggestions you could try :ĭelete this line from your Session.vim. So I suppose that when the set background=dark from your Session.vim is executed, your default theme is reloaded but not your custom colors because they are defined in a different place (your vimrc). Setting 'background' will cause the color scheme to be reloaded. ![]() When a color scheme is loaded (the "g:colors_name" variable is set) I think the reason why your default theme is loaded a second time when you source your Session.vim, is because the latter includes this line (83) : set background=dark The second time it's loaded, your custom highlight groups must be overwritten. Your last comment says that your default colorscheme is sourced twice : once before your custom highlight groups, and once after. Hi StatuslineWarning cterm=inverse ctermfg=210 gui=inverse guifg=#ff8787 Hi Modifier cterm=inverse ctermfg=118 gui=inverse guifg=#87ff00 Hi PmenuSel ctermfg=16 ctermbg=179 cterm=NONE Hi Visual ctermfg=186 ctermbg=64 cterm=NONE Hi StatusLineNC ctermfg=244 ctermbg=144 cterm=NONE Hi StatusLine ctermfg=16 ctermbg=179 cterm=NONE Hi Search term=reverse ctermfg=229 ctermbg=136 Hi CursorLine term=NONE cterm=NONE ctermbg=238 Hi PmenuSel guifg=black guibg=LightGoldenrod3 ![]() Hi StatusLine guifg=black guibg=LightGoldenrod3 The sessionoptions is blank,buffers,curdir,folds,help,options,tabpages,winsize. However after I mksession and sourced it back, I found that some (maybe all) of the custom highlights were lost and vim used the default settings of the colorscheme. This causes Vim to automatically source and apply your changes to your vimrc when the buffer is saved. " existing :so command to the new one.I defined some highlights in the vimrc file and it works well in gvim. If you find yourself always executing :so after every vimrc change, put this in your. " in order to achieve _real_ drop-in replacement, I like to abbreviate " given arguments otherwise calls function SourcePart() which sourcesĬommand! -nargs=? -bar -range Source if empty("") | call SourcePart(, ) | else | exec "so " | endif " if some argument is given, this command calls built-in command :source with Let tmp = exec a:line1.",".a:line2."yank z" " built-in :source command, but this one also can take range and execute just I couldnt find a way to 'install' the built executables the way precompiled vim gets. The make command created all binaries in src/ directory. I was able to use sources from the svn repository and also compile successfully under cygwin using Makecyg.mak file. Some other commands should also have '' appended, which means. When you define functions in vimrc, use 'function'. ![]() However I get a lot of errors (E174) saying command already exists for each line in my vimrc. vimrc source I did this and it seems to work. Here: " This script provides :Source command, a drop-in replacement for I needed a version of VIM that used python 2.6 instead of the default python 2.4. If you find yourself always re :so ing your vimrc after you changed it, have the following autocmd in your vimrc: autocmd bufwritepost. With my script below, we can use :so command as before, and we are also able to use it with range: :'so (which actually expands to :'Source) There is little side effect: register is corrupted after executing the command.For example, something like this : autocmd VimEnter source /path/to/customcolors. Oni, Neovim, Vim, Visual Studio Code, and Sublime Text are the most popular alternatives and competitors to VimR. We have to use additional user-specified command :Execute instead of standard :so (ok, we can name user-specified command :So, anyway it's annoying to use new capitalized version of the command) Write your custom highlight groups into a dedicated file (let's say customcolors.vim) and then, inside your vimrc, add an autocmd that automatically source this file at the end of the startup.Thanks to Ingo Karkat, I have taken his main idea and improved it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |