So I'm quite new to this vimrc thing and I've recently attempted to make Vim look better. However, when I start up Vim, airline is "unthemed" until I tab out of my terminal, go into split view, or type a Vim command.
At times, my airline theme would load and after, for example saving my file, it will return to being "unthemed".
I have included :set laststatus=2 in my vimrc, but I have had no success in fixing this issue.
Below is what I intend my airline to look like at all times:
but this is what I get:
The same thing happened to me until a while ago.
I fixed it by changing the way I set the color scheme I had, leaving it at colorscheme oceanic_material. Before I had it as autocmd vimenter * colorscheme oceanic_material.
Here I attach a photo of how I currently have it:
Related
So I had this beautifully themed Vim colorscheme which used the terminal colors (24bit true color Termite with dark solarized color theme), the visual mode simply reverted the colors in selected text, basically it matched with my whole system theme.
Today I was trying to install Lightline plugin for Vim and the guide said to add the following lines of code to .vimrc:
if !has('gui_running')
set t_Co=256
endif
I was happy with the plugin but ever since I added those 3 lines of code into my .vimrc, my colorscheme vanished. I've since tried deleting the plugin, deleting those 3 lines of code from my .vimrc, setting every colorscheme available in the /usr/share/vim/vim81/colors directory and nothing seems to bring back my old colorscheme - which used the terminal colors (I've aleady tried setting the colorscheme to default, but I'm still getting weird colors that I didn't have before).
Due to various reasons, I run Vim at sixteen-colors, synced w/ my terminal's colors. In a recent Vim update, I've had to rework my "~/.vimrc" completely to get it back into running order on Linux.
Initially I was shocked to find that this simple line did not work (even w/ "syntax on" preceding it):
:highlight Comment ctermfg=White
I'm also using a "LineNr" ctermfg. No matter where I placed/stacked the "Comment" ctermfg, it didn't work, or interfered w/ everything else sourcing correctly (ie, placed in the same line w/ "LineNr"). However, I found that calling "Comment" after a buffer had loaded would make the comments appear as intended.
I am new to autocmd in Vim (and want to know how it works, anyways). Is there an "autocmd" call that I can have in my "~/.vimrc" that will run the aforementioned line of code immediately after a buffer has loaded?
I have tried several iterations (BufWritePre, BufWritePost, etc.) and been unsuccessful. This was my previous attempt:
autocmd BufWinPost * :highlight Comment ctermfg=white
Don't resort to :autocmd without reason; search harder for the root cause!
Your description lacks specifics; I guess your chosen colorscheme (or a plugin, but no sane plugin should interfere with the default highlightings) overrides your custom one for Comment. You can check who defined this via
:verbose highlight Comment
If this points to your colorscheme, you simply need to execute your :highlight command after it. For this, you need to understand :help initialization, and maybe check the output of :scriptnames. If you have a :colorscheme foo command in your ~/.vimrc, it should be as simple as putting the :highlight command after it.
You do need an :autocmd if you switch colorschemes on the fly, as most colorschemes override the basic Comment definition. The correct event and pattern for that would be ColorScheme *
If I do a quick :h autocmd-events, I find the the event BufWinPost does not exist. I think, you want BufWinEnter instead. The autocmd you wrote should work, except for the :. HTH
I recently discovered Vim colorschemes, and in the process have discovered a rather curious bug: when I run hi Normal ctermbg in Vim, the color change carries over to the shell that I'm running Vim in, like so:
I'm using PuTTYtray (but also see the behavior in PuTTY) with 256 colors enabled , bolded text indicated by font changes, and $TERM set to "putty-256color"; my .vimrc is as follows:
set t_Co=256
colors zenburn
and zenburn.vim can be found here. I've isolated the problem specifically to specifically line 298, where it first configures ctermbg for Normal highlighting.
(As an aside: it seems that when using PuTTY tray with specific color settings, in Normal highlighting, ctermbg has to be first set simultaneously with guifg or guibg, e.g. hi Normal guifg=#dcdccc ctermbg=237, and only after that will hi Normal ctermbg=some_val work.)
Does anyone happen to have any idea why this is happening?
I've also tried to do a workaround by running hi Normal ctermbg=None on VimLeave (although I recognize that this is problematic if I run multiple Vim instances, so if anyone can suggest an alternative that would also be welcome), but with no success. Adding the following to my .vimrc does not work:
function! RESET_ctermbg()
"reset $ctermbg to None"
exec "hi Normal ctermbg=None"
endfunction
au VimLeave * call RESET_ctermbg()
I've fixed the problem by changing $TERM to xterm-256color; my best bet is that putty-256color is not well-supported enough as a shell to handle behavior like the vim colorscheme I was doing, so I don't even need to try to make the workaround work anymore.
I'm trying to load a default colorscheme torte by placing colorscheme torte on my ~/.vimrc.local (I'm using vIm SPF13 by the way if it means anything.)
Anyways, whenever I open vim, I end up seeing this.
But when I execute colorscheme torte from the command mode, I get
Anyone knows how to get the second image consistent? Thanks. :)
My guess is that 'background' is changed at some point or another of the startup process which would explain the difference in looks. You can test it with:
:set background=light
:set background=dark
But the arbitrary and unneeded complexity introduced by your distribution makes it hard to guess where it's done or not.
I'm assuming that you're deliberately not adding color scheme to your .vimrc file.
If that is true, simply add this to your .vimrc file
if filereadable(glob("~/.vimrc.local")
source ~/.vimrc.local
endif
Otherwise simply add it to your. vimrc file itself.
I am trying to customize my vim popup completion menu as per this guide:
Vim Wiki: "Omni completion popup menu". It notes
add to your vimrc if you always want this choice.
However, with the following settings in my .vimrc file
colo desert
filetype plugin on
set ofu=syntaxcomplete#Complete
highlight Pmenu guibg=brown gui=bold
I get the following:
Note: when I manually enter the highlight command manually, it works:
How do I get the popup to use a color scheme defined in .vimrc without having to enter it in manually each time?
if you put your commands in below sequence, you can get what you want. the syntax option will override your highlight option.
"" gui configuration
color murphy
syntax one
highlight Pmenu guibg=brown gui=bold
See vim - Override colorscheme
Short answer is that you can't. If you use a colorscheme, then all other color scheme tweaks in your .vimrc are ignored. The AfterColors plugin solved the problem for me.
Hmm, most likely there is a highlighting command coming afterwards that is overriding your option. Probably when the filetype is determined and adjusts options. Try running it without the filetype plugin on option set.
If that works, you'll need to adjust the filetype detection to run your special options afterwards.