![]() |
colorized ssh sessions
Hello All,
Starting from a kde konsole, I ssh to different hosts. I'd like to set the background with a different colors according to the host. I have excluded the 'setterm' command because of the restricted choice of colors. I tried to use ANSI sequences like Code:
printf "\e[48;2;241;255;236m \n" 1) colorized commands like 'ls' or 'grep' reset the bg color. OK, I can disable colorization. 2) vim background is independent of the terminal background, and that is my real problem. Any suggestion ? |
i think you will need to start a dedicated terminal emulator window with different settings for each ssh session.
|
Opening a new terminal would certainly solve my problem, but implementation will not be easy with my current setup.
I run my desktop as an unprivileged user, open Konsoles, and then su to root. From that point, I open ssh sessions to other hosts, jumping from one host to another, possibly returning to the first. Hence my need of colorization ;-) |
Why do you need root for openning a ssh session? You can always ssh from a regular user
|
^ i wholeheartedly agree, but didn't mention it earlier since it didn't seem relevant for the colorization issue.
|
Indeed. I just was pretty surprised to read that root was needed. The best way to solve a problem is to avoid it =)
Concerning the colorozation issue: 1) On all hosts I use zsh with oh-my-zsh extension. Setting different ZSH_THEME variables in ~/.zshrc for different hosts makes the hosts easily distinguishable. No need for fore/background color changes. 2) For vim different foreground and background colors could be set in ~/.vimrc Code:
highlight Normal ctermfg=red ctermbg=yellow |
[SOLVED]
Ok I managed to get colorized ssh sessions by
1) applying redfox2807 suggestion to .vimrc 2) in .bash_profile, getting colors from .vimrc and including them in the prompt (PS1) 3) viewing man pages with "view" (read only vim) instead of "less" I expect some command breaking my display in the future, but for now I'm satisfied with this solution. Thank you redfox2807 and ondoho for your useful comments. |
All times are GMT -5. The time now is 08:51 AM. |