Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


  Search this Thread
Old 07-03-2011, 03:31 AM   #1
LQ Newbie
Registered: Nov 2008
Posts: 5

Rep: Reputation: 0
Openbox and setting alias on openbox start

I want run the following command to set an alias to use gvim when running an Openbox session and vim when on the console.

if which gvim > /dev/null ; then alias vi='gvim' ; else alias vi='vim' ; fi
If I add this to ~/.bashrc its fine but will set gvim as the the default all the time regardless of running X/Openbox, which is no good.

I tried adding it to ~/.xinitrc and ~/.config/openbox/ but the alias does not get applied. I also tried:

x-terminal-emulator -e "if which gvim > /dev/null ; then alias vi='gvim' ; else alias vi='vim' ; fi"
Which doesn't work either.

How can I apply this alias when only running and openbox/X session?
Old 07-03-2011, 03:56 AM   #2
LQ Newbie
Registered: Nov 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Edit: The below previous post doesn't work OK as my tty was just set to /dev/pts/1..... any suggestions appreciated.

I ended up using the following in ~/.bashrc

if [[ "$(tty)" = "/dev/pts/0" ]] && [[ $(which gvim) ]] ; then 
    alias vi='gvim'
    alias vi='vim'
This seems to be working ok.

Last edited by Jelloir; 07-03-2011 at 04:04 AM. Reason: problem not resolved.


alias, autostart, openbox

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] Help setting up Slackware with openbox, slim etc cra1g321 Slackware 15 03-30-2012 02:17 AM
Cannot cp menu.xml, rc.xml, and (Openbox) oalicein Linux - Newbie 2 02-10-2011 05:52 PM
[SOLVED] Question, Openbox autostart on second desktop TobiSGD Linux - Desktop 1 09-15-2010 08:36 PM
[openbox] My file is not restoring things Removed44 Linux - Newbie 4 06-14-2010 09:31 PM
how to start openbox session with Numlock ON? frenchn00b Linux - Newbie 1 06-26-2007 06:51 AM > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 11:06 PM.

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