sedwards2009 / extraterm

The swiss army chainsaw of terminal emulators
https://extraterm.org
MIT License
2.52k stars 116 forks source link

An idea: some improvements of settings and operation #307

Closed MintYale closed 3 years ago

MintYale commented 3 years ago

Extraterm is the best terminal tool I've ever used. It's amazing -- easy to use yet very powerful. I think it can be even better. I find that there seems no Linux terminal tool which supports one kind of setting: colorize the [username@domain dir] and leave a clean empty line after running every single command -- just like Git Bash of Git for Windows(with Mintty 2) does. In fact this would be a very useful optimization -- when running many commands one by one, it looks very clear and elegant. Just add a swich of the settings, when it's on, append ; echo '' to whatever user input before running. (OR maybe extraterm has supported this already but I didn't know how to config it ?)

sedwards2009 commented 3 years ago

What you are asking for can be done by changing the prompt your shell uses. Most shells let you configure the prompt it prints after every command. You can use escape codes to add colours and also make it span multiple lines.

Here is a tutorial which describes how to do this for bash shell:

https://www.howtogeek.com/307701/how-to-customize-and-colorize-your-bash-prompt/

MintYale commented 3 years ago

https://www.howtogeek.com/307701/how-to-customize-and-colorize-your-bash-prompt/

@sedwards2009 MANY THANKS for your professional response. The tutorial you recommand helps a lot. After reading the tutorial, I add this in my ~/.bashrc:

# bash prompt
PS1="\n[\[\033[1;35m\]\u@\[\033[34m\]\h \[\033[32m\]\W]\[\033[0;37m\]\$"

Then after running source ~/.bashrc , the bash prompt looks much prettier than before. Almost what I just wanted. Only there is a little thing confusing me: you see I add \n in $PS1 so there would be an empty line everytime I run any command, but in this way as soon as I start a terminal window, there would be an empty line first like this:


[mint@localhost ~]$

...I am thinking could there be a way to watch the action we open a new terminal window, in this situation we change the $PS1 and drop the \n...Could this be possible? How should I write the IF-Function in ~/.bashrc?

sedwards2009 commented 3 years ago

@MintYale There is probably some way to do what you want, but it is likely to be quite tricky and a lot of work. My advice is to just get used to it. :-)

MintYale commented 3 years ago

@MintYale There is probably some way to do what you want, but it is likely to be quite tricky and a lot of work. My advice is to just get used to it. :-)

YES you are right. I've got used to it already. It's pretty and easy-to-use enough. :+1: