vim: rich ("gui") colorschemes in a terminal emulator?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
vim: rich ("gui") colorschemes in a terminal emulator?
I downloaded a bunch of nice colorschemes from http://www.vi-improved.org/, only to be crestfallen when they would not display as nice in the terminal as they did in gvim. Is there any terminal emulator capable of displaying these color schemes? I've tried xterm, rxvt, aterm, konsole and gnome-terminal with no luck.
Look in your home directory for a file called ".vimrc". (Try typing "ls -a ~/.vimrc".) If it's there, just add:
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
This will tell VIM to use colors to highlight your commands and other stuff as you type/read.
If you don't have a .vimrc file, make one and add those lines. You may want to look in /usr/share/vim/vim63 for a file called, "vimrc_example.vim". If you find it, just copy it to ".vimrc" in your home directory. (Try typing "cp /usr/share/vim/vim63/vimrc_example.vim ~/.vimrc".)
Oh, I guess I should have been more explicit: colors will display, but the colors (and possibly capabilities) of gvim seem to eclipse those available on the terminals I've tried.
If you try to load this scheme (aqua) in the terminal, and then again in gvim, you'll notice what I mean. I'm assuming that vim is capable of displaying everything on the terminal that it can in gvim, but it is being held back by the capabilities of the terminal. Then again, I don't really know how canonical (and incompatible with gvim-style coloring) the method for displaying colors in linux terminals is. I looked around for a "high color" or 24-bit color-capable terminal for Linux, and didn't find anything. Any leads?
I get the impression that they don't require anything more complex than 256 colors, or maybe 16-bit. Unfortunately I don't know how to get these working! I'll to some fiddling and get back to you if I can find an answer.
It's a neat script and thank you for such involved help, but it does not solve my problem
When I do ":colorscheme aqua" in vim (in a terminal emulator), the colors change but it does not look like the aqua colorscheme at all. Like you said, I'm sure this is a matter of color depth, and I hope that vim doesn't have a problem with the color values (it doesn't seem to, since it doesn't give me any errors).
So, I'm looking for a terminal emulator that can display colors in such a way that the colorschemes will appear as expected (as in gvim). It seems to me that such a terminal emulator should exist, but the ostensibly hard-coded inclusion of only 16 colors in gnome-terminal's profile dialog is discouraging. I hope such sensibilities are not so ingrained and embedded that no such terminal emulator exists. I was looking around for an OpenGL-based terminal emulator, but didn't come up with any results.
I did some comparison between the appearance in gvim and vim using these color schemes and I see what you mean about the terminal version not looking as good. I also looked around a bit on the internet for some info on whether it's possible to change the background in the terminal version to how it is in the gvim version and it would seem, unfortunately, that the only options for the background color are "light" and "dark". ( http://www.vim.org/tips/tip.php?tip_id=53 , among others ) There might be a way that I've overlooked, so don't hesitate to do some more searching if you want to.
As far as suggestions, all I can think of is that you might want to use a different scheme in the terminal than you use in gvim, so that both will look OK. I've come across a few schemes that look pretty sweet in the terminal: blackbeauty, borland, coloror, dante, delek, denim, fog, hhdblue, golden, hhdred, ibmedit, less, lingodirector, maxome, nightwish, papayawhip, ps_color, redblack, relaxedgreen, sean, xemacs, zenburn.
I've noticed that some of these schemes have lines in them referencing the terminal version of VIM specifically, like:
hi Normal term=NONE cterm=none ctermfg=gray ctermbg=DarkBLue
The "DarkBlue" bit sets the background color in ibmedit to blue in the terminal. I tried entering the gui values as cterm values in this manner in aqua.vim and it just gave me some errors, so I guess it's up to you to hack them.
You were able to load zenburn in a terminal? I'm guessing that was a mistake because I couldn't do it, and the colors are all defined to be "gui" colors.
Anyway, yeah it looks like the gui and terminal colors are separate issues, and that the terminal colorschemes are only using sixteen colors. It's something I suppose I have to live with for now, so no biggie I guess. I really appreciate your help and collaboration in this, so thank you! I'm sure you're as interested in it as I am
I thought it was pretty goofy to have a toolbar and a menu which not only duplicated the functionality of vim whilst eliminating the convenience of using the keyboard, but also duplicated the functionality of each other. I also thought it was goofy to have a scrollbar, for much the same reasons. So, I updated my .gvimrc thusly:
set guioptions-=r " no scrollbar on the right
set guioptions-=m " no menu
set guioptions-=T " no toolbar
VERY NICE! I'll have to make use of those tweaks! Also, you can still open files directly from the command prompt using gvim: "gvim file.txt &". This will open the file in a gvim window and then give you back the terminal.
It's always cool when you can learn something while trying to answer somebody else's question :-)
I realise this is perhaps a little late, but just wanted to say thanks for the tips, and add some input:
1. You can use the :cd command inside vim or gvim to set the working directory,
and (if you're working on lots of code in the same dir) then you don't have
to worry about it anymore.
2. I solved the ugly colours issue (I'm pretty sure vim will only ever use the 16
colors the terminal provides) by using gnome-terminal and just making the
terminal's colours nicer. I realise you're windowmaker user though, and my
baulk at that idea. Still, my terminal sessions are a lot prettier now.
Anyway.. I'm definitely going to clean up my gvim now, thanks for the tips!
hi, maybe this is far too late to answer, but I accidentally found this topic by google and I can suggest to use the mrxvt terminal application. It can display at least 256 colors. Also, there should be xterm-color on popular linux systems so it can get 256 colors also.
Then vim setting: you can set ctermfg and ctermbg to any color, just by giving the color number. For example:
:hi LineNr ctermfg=240 (should be dim gray)
The only thing is to use a proper terminal application and properly configured. For instance, using screen inside my 256-color xterm causes significant color reduction to the good old 16 colors... But this is caused by screen entirely (or its environment settings) because in pure color-term everything works like a charm!