LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 01-18-2015, 12:36 PM   #1
joe_2000
Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 878

Rep: Reputation: 245Reputation: 245Reputation: 245
Vim colorscheme based on source of SSH connection


I gotta post this: Just changed the overall theming on one of my machines. The console now has white background rather then black, as opposed to all my other machines.
As a result I also need a different vim colorscheme.

Now, if I ssh onto my homeserver, I want that theme to still be applied to vim, without changing it for connections from other clients in the process. Here is how I solved it:

In the server's .bashrc:

Code:
export SSH_SOURCE_IP=$(echo $SSH_CONNECTION | cut -d' ' -f 1)
export VIM_COLOR_SCHEME="elflord"  # my default scheme
if [ "$SSH_SOURCE_IP" == "192.168.1.225" ]; then
        export VIM_COLOR_SCHEME="delek"   # white background suitable
fi
And in /etc/vim/vimrc
Code:
colorscheme $VIM_COLOR_SCHEME
Amazingly, this does exactly what you'd think it does. When I log in from that one machine, I get delek. In all other cases, I get elflord. How cool ist this?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] vim - solarized colorscheme StevenXL Linux - Software 2 02-02-2014 03:25 PM
gvim colorscheme in vim RudraB Linux - General 4 01-08-2013 09:37 AM
Vim colorscheme search path? alke Linux - Software 1 03-05-2007 11:56 AM
Script to start vim with a random colorscheme daihard Programming 1 05-12-2006 03:46 AM
VIM via remote SSH connection causes seg fault nkendrick Linux - Software 1 11-08-2003 06:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 07:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration