How can I get proper vim themeing in Cygwin? - vim

(edit: I am using zsh, if that matters)
I'm pretty baffled right now. Here's the relevant part of my vimrc (I'm using Vundle).
set t_Co=256
set background=dark
colorscheme PaperColor
(the full vimrc if you are curious, it's pretty short)
And here's what vim in Cygwin displays (with all Cygwin's terminal color stuff set to their out-of-box defaults):
If I comment out the t_Co=256, I get this:
Which is better, but not when you consider that the PaperColor theme is supposed to look like what's shown here.
I've read this answer here to a similar question, but that isn't a very good workaround for me -- I don't want to have to change Cygwin's terminal colors manually every time I change a color scheme, and would that even work if my vim uses one set of colors while my zsh uses another? Why can't Cygwin just display all the colors my monitor can -- does it really not have that ability? Or am I just messing something up with my configs? From what I've googled, the amount of information about how Cygwin colors work is surprisingly scarce. I expected hundreds of links with people having the exact same problem, but there's really only a few.

I found my problem.
Long ago when I switched to zsh from bash, I altered my Cygwin launcher .bat file to launch zsh.exe. Doing so opens up a very stripped-down terminal running zsh, but it is NOT the mintty terminal, which Cygwin normally uses (and which supports much more features like better colors).
I just had to switch my Cygwin launcher shortcut to open up the mintty terminal instead (and then login to zsh within Mintty).

Related

How do I make macvim execute shell commands like it does in Destroy all Software?

When Gary Bernhardt executes a shell command from Destroy All Software, for example this:
:!ls
The command looks as if it had "spawn a new shell" - it takes the whole window, with its own theme. You can see it around 00:36 in the "One-minute demo video" of his homepage.
When I do the same in my macvim, the result is not the same; the command runs in the "bottom of the screen", inside a "small buffer" of around 1/3rd of the screen size, and conserving the theme I use in vim. Inconveniently, it also prints escape codes literally, instead using color codes (this particular bit has been asked in Stack Overflow before, but I want to know how Gary does his stuff).
What I have tried:
I have watched the 3 episodes Gary has about vim configuration: The .vimrc, Some Vim Tips and File Navigation in Vim. Sadly, none of them mention doing something special or installing a plugin relevant to the way the shell script is done.
I have studied Gary's .vimrc and .vim folder. If the relevant configuration option is there somewhere, I could not find it.
Hence, my question: how do I get macvim to display shell commands as in DAS?
Spec: I'm using MacVim, MacOsx 10.8.1, iterm2, zsh and ohmyzsh.
Well, I think I can answer myself now.
Macvim does the console thing very differently in gui mode than in console mode.
In console mode, it works as in DAS. Full screen, color codes.
In gui mode, it ... well, it basically sucks. Bottom of the screen, no color codes.
So, if you want nice shell outputs in macvim, use the non-gui mode. At least for now. (I have not investigated plugins like Conque)

How to set manualy color of params[] and redirect_to in Vim?

This is my colorscheme -> https://gist.github.com/1973544
But in example screenshot of sexy-railscasts: https://github.com/oguzbilgic/sexy-railscasts-theme
params[] and redirect_to are colored.
How to achieve this?
EDIT: Problem is with filetypes. Releated -> Ultisnips break rails syntax. How to setup correctly?
This colorscheme is, as specified in its header, "A GUI Only port of the RailsCasts TextMate theme to Vim.".
GUI colorschemes (for GVim or MacVim) can make use of thousands of colors. If you want to make Vim look like in the official screenshot you'll need to use GVim.
But you appear to be using it in a terminal emulator which can only display a maximum of 256 colors. For this "GUI Only" colorscheme to even work in your terminal, you probably have a color conversion plugin like CSApprox, do you? Such plugins will do their best to match your GUI colors to their closest equivalent in the X11 set but this task is obviously not foolproof. Some colors may be frankly off and I'm almost certain that's what's happening here.
EDIT
First, I don't do Ruby, even on Rails.
Second, the syntax group of params in params[:comment] depends on the filetype:
if I have :set ft=ruby.rails:
rubyBlock, rubyMethodBlock, rubyLocalVariableOrMethod
if I have :set ft=ruby:
rubyBlock, rubyMethodBlock, rubyRailsMethod
The problem is that rubyLocalVariableOrMethod, as defined in the default ruby syntax file appears to not being linked to Function unlike rubyRailsMethod, from the rails plugin.
So I think that it's the rubyLocalVariableOrMethod that is causing problems. I've been looking around on my machine and can't seem to find how, why and by whom it is set instead of rubyRailsMethod when ft=ruby.rails.
While waiting for a real solution, there is a global setting for using rails completion when :set ft=ruby, I think it should help: let g:rubycomplete_rails = 1.
I believe that is from the rails.vim plugin.

command line VIM does not change background (stays black)?

I have tried this in both gVIM and VIM
the background is correctly applied in gVIM but not in VIM, it just stays black.
I use the command, :color zenburn
I am running this in Windows XP, Command Prompt
I also wonder how many colours command prompt in xp supports.
The colour sets between "gui" vim (gvim) and "console" vim (vim) are completely different. They can even be completely different for the same colour scheme.
I'm unfamiliar with the "zenburn" scheme, but it sounds like it makes different choices depending on whether you're using the GUI or not.
The :highlight command has different arguments (term=, cterm=, gui=, etc) that define the different colours used by vim in different modes. You should be able to look at your zenburn.vim colour definition file to see what it is using.
The colors for the GUI version and the console version of Vim are set differently in each colorscheme file. They don't even have to be set at all (some colorschemes define only the values for the GUI version and vice versa).
That being said, open up your colorscheme file (zenburn.vim) and look it up. If you're interested in the background color, check it up for a line looking similar to
hi Normal guibg=... guifg=.... ctermbg=.... ctermfg=...
or something similar.
The values should be there - change them to your liking if you wish.
In a windows command prompt, I find only 16 color color schemes work well. You may prefer to install cygwin and include mintty in the installation. mintty is a better terminal and I have no problem with 256 colors. http://code.google.com/p/mintty/

How do I get Vim colorschemes to work in gnome-terminal?

I have added this to .vimrc
set t_Co=256
That did not seem to have an effect.
I am using the "wombat.vim" color scheme from the vim.org website. This works fine in vim-gnome, the gui version. I have tried other color schemes and some work and some do not. If gnome-terminal will not work with the color schemes is there a terminal that will?
The wombat colorscheme doesn't define colors for anything other than the gui. You can use the CSApprox plugin to allow using gui-only colorschemes in terminal vim.
Of course, once you do that there's still the issue of gnome-terminal not specifying the right $TERM for itself, so you have to either
Put code in your vimrc to try and detect when you're using gnome-terminal and only then manually set t_Co. CSApprox's documentation has an example.
Put code in your shell init file to try and detect when you're using gnome-terminal and only then manually set $TERM to a proper value
Convince Gnome upstream to fix the bug that's been sitting in their tracker for years to either allow users to set a proper $TERM (without having to edit the source and recompile) or to set it properly in the first place
It looks like they may finally be getting around to the first option and making it configurable via gconf/gsettings
You need to enable 256-color support.
To do that, you need to put the following line in your ~/.bashrc, ~/.bash_profile, or ~/.profile file:
export TERM="gnome-256color"

How to make color settings look the same in vim as in gvim

When I put the following in .vimrc
colorscheme blue
It gives me a nice blue colorscheme in gvim. However, when I use vim, it is light blue instead. Is there a setting I can change so that gvim and vim look the same? If not, then is there a way I can set it up so that my gvim settings do not interfere with my vim settings?
As well as John's suggestion of using .gvimrc, there are a couple of other interesting alternatives:
If your command-line vim is compiled with +gui (:echo has("gui"))* and you have a 256 colour capable terminal, you can use the CSApprox plugin to convert the GUI colour scheme into a matching command line one.
If your command-line vim doesn't have +gui, you could try (I haven't used this one) the guicolorscheme plugin. The guicolorscheme plugin parses the colour scheme file, so it isn't as robust as the CSApprox one (it almost certainly won't work with my colour scheme for example.
There's a lot more information on both of those methods here and here.
* Regarding has("gui"):
If you're not interested in +gui, stop reading now!
Personally, I'd recommend this as it simplifies things a bit - you get the opportunity to type :gui if you want to change from terminal to GUI and as you inevitably have +X11 and +xterm_clipboard as well, you can copy to the X clipboards from console vim. If your vim doesn't have +gui, the easiest way to fix it is to create a link in your personal bin directory to the GUI executable:
ln `which gvim` ~/bin/vim
GVim will quite happily work as a console vim if the executable name is vim. A "default" build from the vim source with GUI enabled will create one executable (vim) and lots of links to that executable like gvim, gview, view, vimdiff etc. Most Linux distributions seem to compile them separately though, in order to minimise requirements of the basic Vim (so you can use vim without installing X). As such, I tend to recompile and install in /usr/local with the features I want as I always have X installed (it doesn't have to be running, just installed).
set your vim settings in the .vimrc file, and set the gvim settings in the .gvimrc settings file.
Just pick a different colorscheme in the .gvimrc...
If you are using a modern terminal which support 88 or 256 colors(most of them do like gnome-terminal or roxterm(on linux) not sure about Mac or Windows) , you should check out this vim script CSApprox(http://www.vim.org/scripts/script.php?script_id=2390). This scripts make the color schemes made for gvim, work with terminal vim.

Resources