Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have two profiles in my Gnome Terminal, one uses specific image for background. Would like to switch between them when I enter/exit Vim.

So far, I do this by Alt+t and navigating to the other profile. But would like to have this automated.

Possible scenarios:

vim newFile # profile changes to Vim-one
:q # it changes back to default

vim confFile # profile changes to Vim-one
Ctrl-z # vim is suspended, default profile enters
cmd_that_uses_changed_config_file
fg # vim is brought back from suspension, profile changes again...

Now I realize that automating this fully may be difficult, so keyboard shortcut to do this is perfectly fine. I searched Gnome Terminal shortcuts but Terminal menu has three of them only: title, reset, reset and clear.

Any ideas, hints or pointers? :-)

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Preface: I am new, and having similar problems. In the absence of an answer by someone with a functional knowledge of these things, this is how I am approaching solving this.

'man gnome-terminal' offers some interesting options for starting new windows, or tabs using a specific profile. An alias to start an instance of gnome-terminal in a new tab using profile "X" seems like a reasonable quasi-kluge, and allows for existing keyboard shortcuts to switch between, and close tabs.

It would look something close to this:

    alias gtvim='gnome-terminal --tab-with-profile=X -t Vim -x vim >&1'
    gtvim filename

For alias permanency, it has to be added to bottom of ~/.bashrc

I need to work on other things now, but that was my first foray into it. It still seems to open the command in a new terminal window, but still easily accessible from keyboard shortcuts.

Just as a side note, I am attempting to have all terminals with ssh connections to remote terminals open with a different color profile to help prevent commands being issued to the wrong machine.

share|improve this answer
    
Good thinking @Jortony! I should have mentioned I rejected always opening vim in another tab+profile due to fact I disliked such flow. Nevertheless, I've made inquiries into setting background image for Vim and short from coding this and compiling it with that option - there's no way. So, your answer will most likely be the best there is. :-) –  LIttle Ancient Forest Kami Feb 5 '13 at 15:46
    
Excellent =) my first social reward in helping out. –  jortony Feb 5 '13 at 21:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.