[SOLVED] How to convince vim my terminal supports color?

Hi. I recently got a shell account from Kaitocracy on his linode machine. I noticed that my bash prompt has color, as expected, but when I copied over my vim configuration (which includes a color theme), it didn't work! After some toying around, I noticed that vim recognizes the terminal escape codes using `:hi <type> start= stop=`, but not the existing `cterm` commands in my color theme. To make things more confusing, I know my terminal (urxvt) is capable of using the cterm flags.
Also, Ctrl+L does not clear/redraw the screen as expected.
What can I do to fix these issues? Here are the configs:
~/.vimrc:
" No vi compatibility; strictly vim here.
set nocompatible
" Don't source /etc/vimrc
set noexrc
" My background is always black
set background=dark
" The mouse is helpful every now and then...
set mouse=a
" I'm a Linux user
set fileformats=unix,dos,mac
" Search while I type
set incsearch
" The blinking pisses me off
set novisualbell
" Line numbers are key to debugging
set number
set numberwidth=5
" My tabs are 4 characters long
set tabstop=4
set softtabstop=4
" Indention is also 4 characters
set shiftwidth=4
" Normally, I don't want tabs converted to spaces.
set noexpandtab
" Syntax highlighting is a staple :D
syntax on
" I want liberal use of hidden buffers, just in case.
set hidden
set laststatus=2
" filename, filetype, readonly flag, modified flag line #, column #, %age of file length, hex value of byte under cursor.
" Ex: .vimrc [vim][+] 48,22 55% hex:20
set statusline=%f\ %y%r%m\ %l,%c\ %P\ hex:%B
set noai
" I can see where tabs and line endings are
set listchars=tab:▸\ ,eol:¬
" This turns on the config above; I can turn it off with :set nolist
set list
" I want wordwrap on, coupled with sane line-breaking. This will not work when :set list is active.
set wrap
set lbr
" My color scheme is pwn
colorscheme sporkbox
filetype indent on
if has("autocmd")
" enable filetype detection
filetype on
" I want to convert tabs to spaces to adhere to PEP 8.
autocmd FileType python setlocal ts=4 sts=4 sw=4 expandtab
endif
" \l toggles invisibles
nmap <leader>l :set list!<CR>
" I like to get rid of trailing white space.
nnoremap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR>
" Fast window movement is important
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Courtesy of vimcasts.org
function! <SID>StripTrailingWhitespaces()
" Save last search and cursor position
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Restore previous search history and cursor position
let @/=_s
call cursor(l, c)
endfunction
~/.vim/colors/sporkbox.vim:
" Color scheme "sporkbox"
" by Daniel Campbell <[email protected]>
" Tab characters and EOLs should be dark gray so they don't stand out too much.
highlight SpecialKey ctermfg=darkgray
highlight NonText ctermfg=darkgray
" If I'm in a mode, I want to see it.
highlight ModeMsg ctermfg=green
" The current file should be obvious; the others can be faded.
highlight StatusLine ctermfg=green ctermbg=black
highlight StatusLineFC ctermfg=darkgray ctermbg=white
" Line numbers should be just-visible, not bright.
highlight LineNr ctermfg=darkgray
" Titles in Markdown
highlight Title cterm=bold ctermfg=white
" My splits should not be bright
highlight VertSplit ctermfg=black ctermbg=darkblue
highlight Comment ctermfg=darkgreen
highlight Constant ctermfg=cyan
highlight Identifier ctermfg=yellow
highlight Statement ctermfg=magenta
highlight PreProc ctermfg=lightblue
highlight Type ctermfg=blue
highlight Special ctermfg=lightblue
Remote .bashrc:
### ~/.bashrc: Sourced by all interactive bash shells on startup
# Set a fancier prompt
PS1='\[\e[32;01m\]\u\[\e[m\] \[\e[36m\]\w\[\e[m\]: '
# Turn on colors for ls and grep
alias less='less --RAW-CONTROL-CHARS'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
# Set colors for ls and friends
if [ -f ~/.dir_colors ]; then
eval `dircolors -b ~/.dir_colors`
elif [ -f /etc/dir_colors ]; then
eval `dircolors -b /etc/dir_colors`
else eval `dircolors -b`; fi
# Compilation optimization flags
CHOST="i686-pc-linux-gnu"
MAKEFLAGS="-j2"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=both"
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
FFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CPPFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
export PGHOST="private1.kiwilight.com"
export PS1 CHOST MAKEFLAGS LDFLAGS CFLAGS FFLAGS CXXFLAGS
To make matters more confusing, my vim theme works when I connect to the linode in a GNU screen session, but not when it's a straight-up terminal.
Last edited by xelados (2010-04-25 00:34:44)

Mr.Elendig wrote:Make sure you are using rxvt-unicode-256color and that your TERM is rxvt-256color outside of screen, and screen-256color inside of screen.
That's the peculiarity of the problem; when I run vim in my local environment, I always get color using the `:hi <hilighttype> ctermfg=* ctermbg=*` commands. This applies inside of X through rxvt-unicode (non-256color), GNU screen, and on the plain command line in vc1. This issue seems to be related to the remote environment and/or variables not being sent through ssh.
@moljac: When I echo'd TERM inside a screen session, it returned "screen", so I don't know whether it's legit or not.
Last edited by xelados (2010-04-24 11:47:52)

Similar Messages

  • [Solved] How to set vim -R as a viewer for mc?

    Hello!
    I am trying to set vim in read only mode as a viewer for Midnight Commander.
    I tried:
    alias mc='VIEWER="vim -R" mc'
    or
    alias vimr='vim -R'
    alias mc='VIEWER=vimr mc'
    and more but without success.
    So far the only successful approach was to:
    - create shell script, e.g. vimr.sh containing "vim -R"
    - create an alias using the script, i.e. alias mc='VIEWER=vimr.sh mc'
    It works, but creating additional file doesn't seem to be optimal solution.
    Is there a way to solve it using one-liner, or at least put all the config into .bashrc?
    Last edited by satori (2014-09-19 19:03:14)

    Thank you for your quick replies.
    @alphaniner:
    alias mc='VIEWER=vim\ -R mc'
    does not work as intended - it launches vim but I am still able to modify viewed file, like -R had no effect
    @WonderWoofy:
    If you mean exporting variable like
    export VIEWER='vim -R'
    it has the same effect as described above. Additionally, it sets the viewer for all applications using that variable, which I would like to avoid.
    Unfortunately this is not what I am looking for.

  • {Solved}How to drop to a terminal only environment but stay logged in?

    Cntrl+ALT+f1 drops me to a command prompt but logs me out in the process.  For some reason terminals just kept spawning for me and i wasn't able to enter killall terminal into one of them because terminals kept spawning making that impossible.  if something like this was to happen again is there anything i can do to drop down to a shell only but keep all current processes running and then kill the misbehavior and then return back to the gui?
    Last edited by mamamia88 (2012-12-30 22:17:48)

    Trilby wrote:
    This is very confusing.  Can you describe, from the start, what you are trying to do?  Is the problem with a terminal emulator in X?
    If you are in X on tty7 you can switch to tty1 (or any other open tty).  This tty-switch will *not* log you out of X on tty7, you simply will not yet be logged in on that other tty.  If you then login with the same user account on tty1 you should see all your X processes in (h)top or ps(tree) and you can kill any of them as needed.  In other words, the same user account can be logged in multiple times on multiple ttys, but also must be logged in on each tty you wish to use - you log in to the tty, not to "the computer".
    As for the immediate problem, is sounds like something in your bashrc, profile, or other start-up script is launching additional terminal emulators.
    (edit: this was cross posted with the previous two posts ... so if it is redundant or unneeded feel free to ignore.)
    well what i was trying to do was learn how to kill the terminal task in xfce without logging completely out of the gui envrionment. I did add adb and my scripts folder to $PATH in .bashrc the other day.  could that have caused this to happen?  or do processes sometimes just go crazy and need to be killed?

  • [Solved] How to disable vim filetype indentation.

    Hello. I want to start using vim, but there is only that problem with that. In gedit I always use tabs 4 spaces wide for indentation, and I want to do something similar in vim. So in my .vimrc I used tabstop=4 and set autoindent. If I write a plain text file, it works correctly, for example, if I press tab in a new line, and the press enter, the following lines preserve the tab as indentation.
    The problem starts when writing code in common lisp or python. In lisp tab is replaced by two spaces and does some weird things, and in python tab is replaced by 4 spaces. I tried including "filetype indent off" in my vimrc, or writing ":filetype indent off" directly in console, but that doesn't have any effect. The only thing that somewhat works is to disable autodinent, but then I have to manually indent every line. What can I do?
    Last edited by Serge2702 (2014-11-06 20:57:54)

    I keep a skeleton vimrc file to use when I have a question similar to Serge2702's.  My barebones.vim:
    set nocompatible
    filetype plugin on
    set t_co=256 " Optional, you may comment this out.
    syntax on
    Start vim, using the alternate vimrc file with the command, say, for a lisp file: vim -u barebones.vim file_to_edit.lisp.
    Seems most filetypes default to a tab with a width of eight spaces here.  To see the tabs, you can use these two commands from within vim:
    :set list
    :set listchars=tab:_T
    Then you can try all the different setting combinations to figure out a comfortable tab width.
    And there are quite a few settings that affect the width of tabs and indentation besides tabstop. There's autoindent to repeat the previous line's indentation, but this is modified if you use cindent or smartindent to set the indent according to syntax. Then there are the expandtab and smarttab settings to use spaces for tabs, and shiftwidth and softtabstop also set indentation width. I don't see why anyone has trouble figuring it out.;)

  • [Solved] How do I get bash to be colorful like in Gentoo?

    I know that this isn't Gentoo, so yall don't need to remind me just in case you were thinking about doing that, but I also know that this IS LINUX (sorry that was a 300 reference, you know, "this is Sparta," et cetera, et cetera (Yeah, I know it was unnecessary, but I couldn't help it, the temptation was too tantalizing)) and therefore what bash can do on one Linux Box should be able to happen on, more or less, any Linux Box.
    Last edited by Boxes (2011-12-15 04:27:38)

    anonymous_user wrote:
    To the OP you may be interested in Gentoo's bashrc:
    http://www.jeremysands.com/archlinux/ge … hrc-2008.0
    Thank you, I tried searching for different kinds of terminals, but I wasn't familiar with any of the one's listed (or at least I wasn't familiar with them by name, though I might have recognized them if I had used them, though I'm not sure) except for the one that I remember having used in ArchBang, which I liked very much because it's terminal showed so much info regarding my system.
    Last edited by Boxes (2011-12-15 04:29:58)

  • Terminal.app color labels

    How do I find out what the filename colors mean? If a filename is red what does that mean? What about blue? aqua?
    I know this is probably basic stuff, but I have to start somewhere and I don't know where else to look for the answers.
    Thanks

    Hi Matthew,
       Shells are case sensitive and the option for Apple's default BSD ls utility, /bin/ls, that turns on colored ls output is "-G". You can check to see which ls utility you're using with the command "which ls". If the output isn't colored with the "-G" option, post the output of that command. You can also get colorized output with this utility by setting the CLICOLOR environment variable. It doesn't matter to what you set it.
       The BSD ls utility will only produce colored output if the value of your TERM variable indicates that your terminal supports color. For instance, xterm-color works, among many others. You can check the value of that variable with the command "echo $TERM". You can set the value of that variable for all new shells in the Terminal Preferences window with the dropdown menu. It applies to new shells only, not to ones already opened.
    Gary
    ~~~~
       Help fight continental drift.

  • How do I install a version of vim with Python support?

    I'm trying to install a version of vim with Python support, but for some reason I can't seem to find anything useful when I search.
    So far I've found posts that say arch doesn't have one built with Python support, and use this <broken link> AUR package. I've search AUR for "vim python" which turned up nothing. There *does* exist extra/gvim-python3, but when I install that, then vim (not gvim) still tells me "Error: Required vim compiled with +python"
    This search:
    https://duckduckgo.com/?t=lm&q=arch+lin … on+support
    Provides:
    https://bbs.archlinux.org/viewtopic.php … 1#p1070281 - Only a link to a bug report
    https://bbs.archlinux.org/viewtopic.php … 0#p1144210 - Post with the 404'd AUR link
    What I finally found was this Gist with directions on using the ABS:
    https://gist.github.com/MicahElliott/3048622
    Ultimately you'll have to change the particular tar.xz files you use in the pacman -U steps, but this should get you vim with Python enabled.

    I have downloaded vim by cloning The Vim Mercurial repository.
    hg clone https://vim.googlecode.com/hg/ ~/bin/vim_bin
    Then i have a this script to install it in my own ~/bin/ dir.
    #!/bin/bash
    cd /home/myuser/bin/vim_bin/src
    echo "---Configure----"
    ./configure --prefix=/usr --localstatedir=/var/lib/vim \
    --with-features=big --with-compiledby="Custom Vim insall" \
    --enable-gpm --enable-acl --with-x=no \
    --disable-gui --enable-multibyte --enable-cscope \
    --enable-netbeans --enable-perlinterp \
    --enable-rubyinterp --enable-luainterp \
    --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config \
    --enable-python3interp --with-python3-config-dir=/usr/lib/python3.4/config > my_log
    echo "=== Make ==="
    make >> my_log
    echo "==== Install ===="
    make install >> my_log
    Hope it helps some one

  • How can I customize my terminal?[SOLVED]

    I'm using xterm and /bin/zsh, but it looks ugly. It's a white background with a black text. On debian, I use to right click and hit preferences and went from there. But when I right click it just highlights the shell. How can I customize background color, change font, etc?
    http://dwv91.deviantart.com/art/Twily-L … -426541695 How can I get my terminal to look like this? I know the color codes, but I don't know how to actually get there!
    Last edited by BabbyUser (2014-08-28 18:14:20)

    He/she lists everything they are using right under the screenshot:
    Much of the same from my other submission...
    Arch Linux with Awesome WM and custom tile layout. Also using Compton for composition.
    Firefox Nightly (Australis) [v31.0a1] and 4-Chan with my CSS. Using Vimperator for navigation.
    (Firefox CSS can also place an url-bar on top (below the tabs or merged with the tabs on the left) or at the bottom of the browser)
    Terminals (URxvt-256color) showing from left: screenfetch and ncmpcpp + mpd.
    My files can be found at twily.info (files updated for this theme May 17th, 2014)
    The Lemon font and my vol/bat widgets belong to github.com/phallus.
    Wallpaper: http://wallbase.cc/wallpaper/2…
    If I was you, I would go through each thing listed and figure out each one.  Understanding each element is essential.

  • How to use IIFL trade terminal on Mac book air

    how to use IIFL trade terminal on Mac book air

    If you are referring to downloading and installing https://ttweb.indiainfoline.com/trade/Downloads.aspx it appears that is a Windows program and (only a quick look) I don't see that they offer a Mac version. To install a Windows program on a Mac you would first need to buy and install a copy of Windows (e.g. Windows 8). You would install Windows via Bootcamp Boot Camp 5.1: Frequently asked questions - Apple Support or via 3rd party software such as http://www.parallels.com/products/desktop/

  • How do i unregister from blackberry support forum

    How do I unregister from blackberry support forum?

    There's no formal method of doing so. You could PM a mod and request it, otherwise just don't post or show up anymore.
    I hope that helps you.
    - If my response has helped you, please click "Options" beside my post and mark it as solved. Clicking the "thumbs up" icon near the bottom of my response would also be appreciated.

  • How can I change my Apple Support Communities Name?

    How can I change my Apple Support Communities Name? I want to change it because I made it a long time ago and want a different name. I want to start using Apple Support Communities a lot more and start helping people, But I want a different name.

    It is possible he was incorrect.
    > When you signed up you were not given the opportunity to create an alias? I find that hard to believe given the number of people who have joined since that have there own alias. Apple assigned xdcdx to you?
    Yes, back on 2007 I chose xdcdx.
    Forward to 2011: I change the email address of my Apple ID to my current email address.
    I login to Apple Support Communities (which I had not logged in to since 2007) and to my surprise I see this nickname that I almost didn't remember using here.
    For me, it's irrational that I am able to change the main email address of my Apple ID (is there any piece of information more important than that?), but not this little username on this subpar forum system (subpar because of the web design/engineering, I don't mean to offend all the people here which are always quite helpful).
    I upgrade to iCloud, and my email address gets hardcoded to my Apple ID. That's good, because I want this email address. In that case, they make sure to warn you that you had to chose an email address as an Apple ID for iCloud. That was not the case in this forums.
    > In the link that you provided Tuttle did a better job than I did as to the difficulty factor. Not sure why you were linking it.
    >
    > You don't have to move to a new company to have new software or a new system.
    >
    > How many million participants does StackOverflow have? Size matters.
    How many million participants have these forums?
    At least you do not seem to disagree with me that these forum are subpar compared to the usual Apple perfectionism level (see iCloud nice web user interface, for another fine example). This thing still looks like a forum from 2007.
    > Yes on an extremely limited basis Apple has made the change for longtime users (only two that I know of) with one of those a request for security reasons. That does not mean it is easy.
    I still am not convinced that it is technically that difficult. I think it just a policy on part of Apple to avoid banal username change requests.
    In part, I am not more active in this forums because I do not want my words to be associated to this nickname, becayse it is used on internet by tons of other people for other stuff, as a Google result will show.
    Anyway, thanks for your words. I'll keep looking from time to time for the username change feature, because I do want to contribute to these forums.

  • Can't watch video on CNN with IPAD after installation IOS 6 any tip to solve how to solve this issue.

    Can't watch video on CNN with IPAD after installation IOS 6 any tip to solve how to solve this issue.
    Thanks for your support in advance

    I have a few TV type Apps that are doing the same think since the  IOS6 update . I figure the problem is at there end and there will be an update from them soon.

  • How to sign out of apple support community

    Since i asked the above question i have received almost  3000 emails from apple support community  of all the question other people have asked and as my question was not solved by the community i had to take my apple pro to the genius bar and they solved it for me  of which i am very greatful
    but they did not no how to stop all the apple support replies and question coming to my iphone
    Please can you help me to sign out of the support community please  so the i can stop all the emails until i need to ask another question
    await your reply

    Click/Tap HERE , then click/tap the Gear tool >   > then click/tap "Following" where the image indicates

  • How to know my macbook pro supports usb2 or usb3?

    How to know my macbook pro supports usb2 or usb3 ?
    And if it is USB 2, will external hardisk which support usb 2 would be compatible with & vice-versa?
    What would be the cons?

    USB 3.0 ports were only added to those MacBook Pros that were released in mid 2012 and later.
    So you would have USB 2.0 ports on your machine.
    But USB 3.0 and 2.0 are 'compaitble,' somewhat - you just won't be able to get the throughput of a USB 3.0 to USB 3.0 connection.
    Clinton

  • How many users can 1 Xserve support?

    I have one Xserve (10.5.2, 2x3GHz, 5GB RAM, 1.34TB RAID 5) that I want to support the following services for my SMB:
    DNS, DHCP
    AFP, NFS, SMB
    Open Directory
    Print
    Software Update
    I also want to have mobile sync'd network home folders, but only for ~/Documents and iCals and Address Books (I don't want everyone's MP3s or family photos).
    I occasionally will use NetBoot/NetInstall, but only 1-2 users at once.
    I am getting ready to migrate my company to OpenDirectory and 10.5.2 for all users and was hoping someone here might be able to tell me how many users I can reasonably support with one Xserve.
    Also, is it a bad idea to have everyone using "mobile" accounts? It seems like it would be less strain on the server to have the occasional sync from users than everyone reading & writing all the time. Also, if anything happened, there would be a local copy and a remote copy of any files.
    Thanks.

    Rosemarie,
    BeehiveOnline currently supports 95,000 users and we have groups on the system as large as 10,000, that is probably about as big as we want to go - remember collaborating with 10,000 users is not an effective way of working - maybe a more open way of delivering content may be more appropriate. Given that the only issues we have with very large groups is the time it takes to run and the email traffic it generates as the large group are processed.
    So it is possible to host 10,000 in a group but we need to be warned in advance and work with you to minimise the impact as the group is set up.
    Phil

Maybe you are looking for

  • Handling HTTP form data

    Hi, I am really struggling with HTTP data submission from a LiveCycle form. There seems to be loads of code samples for ColdFusion, but nothing for ASP/ASP.net - all I am looking to do is submit the data, post a response back to the user confirming i

  • Hebrew Language PO form logo in left?

    Hi, WE have standard English PO form. That we have converted in to HE. Now everything is fine. Except logo is coming in left side instead right side. Is there any option to bring to right side? Please let me know Thanks Venkatesh P

  • Max.No. of columns a table can have in oracle9i db.10g?

    wat is the maximun no. of columns a table can have in the oracle database version 9i. and in the version oracle 10g.

  • Facebook games not loading...

    I'm having trouble with FP loading facebook games. I had the problem a couple weeks ago when I was using Google Chrome and I followed the instructions and disabled the PPAPI and it worked temporarily but after a week or so I started having the proble

  • How to see inserted graphics in downloaded email ?

    Hi, How do I enable the viewing of graphic inserts in received email ? Or, how can I unblock remote images ? Or, how can I allow images from all senders ? Have accessed the website 'Constant Contact' for aan answer but the answer is not correct, as w