Oh, one other thing regarding everything I just said:If you're really uncomfortable with terminals and shells/command lines.. you probably don't want to go through all the hassle I just mentioned. While nothing I said was all that unsafe, playing around with terminal capabilities has the potential to break a lot of things in somewhat unexpected fashions, even if you do it correctly (i.e. when you ssh places that don't have the same information, when you run 'screen', etc.). Probably best to just set t_Co=256 in your .vimrc and be aware of that setting when you switch terminals and things look really weird. :)
However, if you DO run 'screen', setting t_Co=256 in vim will be insufficient. In that case you will be required to create a proper terminfo file for your terminal, AND potentially have to modify the terminfo file for screen to indicate it can support 256 colors, assuming it can (though if screen came with your OS supporting 256 colors, it probably has a correct terminfo file). I don't know if the 'screen' available on mac os x supports 256 colors by default. I leave this as an exercise to the reader. :) On Wed, Oct 14, 2009 at 3:56 PM, Kyle Lippincott <[email protected]> wrote: > First, a note to everyone setting t_Co=256 in your .vimrc: If you ever try > to use a terminal that does not support 256 colors, this will cause it to > look very weird! 'vi -u /dev/null' will skip loading your .vimrc in this > scenario, so you can fix it if needed. :) You can probably also just do > :set t_Co=8, but I've had problems in the past with setting that in a > running session, even after hitting Ctrl-L to redraw. A better solution is > approximately four paragraphs below. > > > I'm not sure exactly what you mean. Testing right now, when I quit vim, > the terminal goes back to the way it was when I ran vim: my cursor is on the > bottom line and vim has essentially disappeared. However, I mostly deal > with vim on a linux box (over ssh if I run it in iTerm), and I have played > around with my configuration extensively, both my vimrc and my > termcap/terminfo settings to get everything accurate. > I don't know if I'd even notice if it didn't restore my terminal to the way > it was before I started vim. I know in the past it used to clear the screen > and leave my prompt at the top of an otherwise empty screen. This setting > might be controlled by something in termcap/terminfo, but I'm not entirely > sure what. I have an accurate termcap/terminfo for my linux terminal I'm on > right now (rxvt-unicode), and it does not blank. This might be because of > the contents of t_te and t_ke: > infocmp -C $TERM | grep :te > infocmp -C $TERM | grep :ke > > are sent whenever vim exits. These restore your terminal to line editing > mode, and can be viewed with t_te and t_ke inside of vim: :set t_te? or > :set t_ke? > > Perhaps one of these is triggering a screen blank for you. You can try > changing them inside of vim, but I don't know which is which or what exactly > they do, and looking up the meaning of their existing values (for xterm this > is probably te=\E[?1049l and ke=\E[?1l\E>) is very annoying. :) If you're > going to play with these, do so via :set before putting them in .vimrc, and > be sure to do it in a terminal you don't care about having to close. > Usually you can save the terminal by typing 'reset' and 'clear' at the > command line, but no guarantees that'll always work. > > Best solution, for those adventurous enough to do it, but it can cause > problems if you ssh! (read more below): > 1) Figure out what terminal type you're currently using: echo $TERM in your > shell, it's probably 'xterm' > 2) Fix that, it should be unique. Changing the terminal type depends on > your terminal, it's a parameter on your 'profile' in iTerm I believe. Name > it something like iterm (prefer all lowercase), since it is ;) > 3) Dump xterm's terminfo since iTerm is close enough: infocmp -I > iterm > 4) Open up the file iterm in your favorite text editor (vim), and edit the > first non-comment line to be iterm|some description, and edit the colors#8 > to colors#256 and pairs#64 to pairs#256 (probably on line 4) > 5) run: tic iterm, this compiles that file and stores it in the proper > location (on mac [leopard], this is ~/.terminfo/69/iterm) > 6) restart your terminal. You should no longer need to set t_Co in your > vimrc. > > Caveats of that solution: > 1) It will only work for your user. To work for everyone, after step 5, > copy ~/.terminfo/69/iterm to /usr/share/terminfo/69/iterm (I haven't tested > this actually works though). > 2) (the big one): If you connect from this terminal out somewhere else > (i.e. via ssh), your TERM environment variable will follow you. The host > you connect to probably does not have an 'iterm' terminfo entry. You can > probably add it (copy over ~/.terminfo/69/iterm from your mac to > ~/.terminfo/###/iterm on the machine you're sshing to), or you can just lie > about your terminal once you get there and claim you're xterm, either: > TERM=xterm ssh <destination> or play with your ~/.ssh/config or > ~/.ssh/environment, check 'man ssh'. Vim won't be 256 color then though ;) > Note I said ###: on mac (leopard), this is the number 69. On the version > of linux I normally use, this is a lowercase i. Look in > /usr/local/share/terminfo to see what the naming scheme is on your platform. > > Whew. This got long.. ;) I'm going to have to ignore this thread for a > bit while I deal with stuff at my real job.. hopefully it's > detailed/accurate enough to help :) > > On Wed, Oct 14, 2009 at 2:50 PM, estebahn fahlhallah < > [email protected]> wrote: > >> Wow. >> 2 step process to beautiful experiences... >> The first was to put set t_Co=256 into my .vimrc, >> then to experiment with some of those Hex colors. >> >> Thanks!! >> >> The only weird thing I've noticed so far is that if I exit from a file in >> vim the current line is down a bit from the top. Not a big deal, but have >> you run into this before? >> >> >> On Oct 14, 2009, at 2:07 PM, Kyle Lippincott wrote: >> >> Now that you have a terminal that supports 256 colors, you can use colors >> that there aren't even names for, by looking up the color number using this >> perl script: http://www.vim.org/scripts/script.php?script_id=1349 >> >> The perl script does nothing involving termcap/terminfo to determine if >> your terminal CAN display > 16 colors, so it'll probably work no matter what >> in iTerm and give weird blinky text in Terminal.app. Vim uses >> termcap/terminfo, so if it's not showing 256 colors correctly (though since >> you mention colortest I'm assuming it does), you might have to play around >> with that. I can attempt to help you there to do this correctly, involving >> changing your TERM variable and writing out some terminfo files and dealing >> with infocmp, or you can just cheat and :set t_Co=256 inside of vim, which >> is probably easier ;) >> >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_mac" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
