
Customizing Your Shell - chmaynard
https://blog.balthazar-rouberol.com/customizing-your-shell.html
======
Timpy
I've seen a lot of Animal Crossing screenshots recently; people will spend an
incredible amount of time working on something to make it look nice. They can
spend hours to make simulation-life more productive in a way that gets such a
marginal return, they won't make the hours back.

Meanwhile, I've recently spent an equally unreasonable amount of time unifying
my bash environment across all machines so that I get a different color for
each host name. So now my bash prompt is color coded by machine. I was lying
to myself about it being more productive or whatever. I did it because I
thought it would be neat, and it looks cool, and I felt pretty clever
implementing it. One of my customers is a lawncare website and I get some
satisfaction seeing the @host turn from blue to green when I ssh into their
server. I think this is the same human satisfaction of organizing your
toolshed, or customizing your town in Animal Crossing.

~~~
ikornaselur
I genuinely get so much enjoyment over tinkering around with my tools, apps,
shell, you name it. When everything is tweaked to look nice to me, work
nicely, scripts automating things and when everything just clicks.. it's
amazing.

I used to re-arrange my bedroom every few months when I was a kid, I feel like
I do the equivalent with my dev machine. Look at tweaking themes, switching
out plugins/tools, updating things, change things around a little bit and I
always love it afterwards.

I also play Animal Crossing and I find it an interesting comparison. I'm
playing with my GF and we made a plan of how we want the island to look and
the timeline is 3-4 weeks with everything (because of how artificially they
slow down a lot of things). Each individual thing sounds tedious and boring
(dig up that whole hill, place all the paths, etc. etc.) but it feels good in
the end for some reason. It turns into what we imagined, what we wanted it to
look like and work, the same way I guess my dev setup right now.

I've spent so much time just tinkering and it gives me great joy!

~~~
mauricedenassau
I feel exactly the opposite, I like to stick with the defaults and change only
if there's something that really bothers me with it, like urxvt.

------
RMPR
As a newbie I was quite confused with the difference between shell, terminal
and console, finally it's a super user post
[https://superuser.com/questions/144666/what-is-the-
differenc...](https://superuser.com/questions/144666/what-is-the-difference-
between-shell-console-and-terminal) that helped me in this regard, I find it
really interesting that the author shed some light on it.

------
jstanley
Personally I'd recommend not customising your shell and just learning to live
with the defaults on whatever operating systems you tend to use. Makes it much
quicker to be comfortable on a new machine because everything is already same
as you're used to.

~~~
migueloller
This is addressed in the first paragraph of the article.

> "I feel that sharing files between different computers is now a solved
> issue, and the benefits I get from having personalized my work environments
> are so great that I gladly pay the small price of synchronizing that
> configuration between my computers."

~~~
Majestic121
The issue is not solved when you sh into a container for a quick debugging
session.

Or when you work in an airtight environment, like in banking.

It is 'solved' when the only computers you connect to is small enough to be be
described as 'my computers', which seems like a pretty narrow use case to me.

------
toyg
If you're stuck on Windows, the new Windows Terminal by Microsoft is somewhat
promising: [https://www.microsoft.com/en-us/p/windows-terminal-
preview/9...](https://www.microsoft.com/en-us/p/windows-terminal-
preview/9n0dx20hk701)

~~~
RMPR
Previously discussed here
[https://news.ycombinator.com/item?id=22614690](https://news.ycombinator.com/item?id=22614690)

------
hprotagonist
I’d recommend against using ligature fonts in your shell. If there’s one place
you don’t want any ambiguity about what glyph you’re using, it’s in the middle
of sed, awk, or grep.

 _Programming code has special semantic considerations. Ligatures in
programming fonts are likely to either misrepresent the meaning of the code,
or cause miscues among readers. So in the end, even if they’re cute, the risk
of error isn’t worth it._

[https://practicaltypography.com/ligatures-in-programming-
fon...](https://practicaltypography.com/ligatures-in-programming-fonts-hell-
no.html)

~~~
akvadrako
I have been using ligatures in my shell and editor for a few months and
haven't had any issues.

I do recommend it; the only issue is now I'm a bit lazier. For example,
instead of making proper arrows like →, I just type ->, which looks good to me
in monospace font, but looks different to everyone else.

------
bewuethr
Not trying to extract the bad parts here – this looks like a lot of effort
went into it and it certainly is useful – but there are a few wrinkles:

    
    
      [[ $? ]]
    

is always true, even if $? is non-zero; it only checks if $? is non-empty. A
working check for successful exit status would be (for Bash)

    
    
      if (($?)); then
          echo "not successful"
      else
          echo "succesful"
      fi
    

For prompt configurations: the article hardcodes the "$" sign. A useful
feature is to indicate when the user is root by switching to "#"; this can be
achieved by escaping the "$".

    
    
      $ declare -p PS1
      declare -- PS1="\$ "
      $ sudo bash
      # exit bash
      $
    

And lastly, the examples should be careful about quoting. This

    
    
      function mkcd {
          local target=$1
          mkdir -p $target
          cd $target
      }
    

breaks when called like

    
    
      mkcd 'has space'
    

because $target expands unquoted. Or

    
    
      mkcd '*'
    

would expand to all files in the directory.

The colour section doesn't mention true colour support; many terminal emulator
come with it these days, see
[https://gist.github.com/XVilka/8346728](https://gist.github.com/XVilka/8346728).

------
fbcpck
Related: [https://danluu.com/term-latency/](https://danluu.com/term-latency/)

While it's great to use other terminals and customize the terminal visuals to
your liking, don't forget about the additional latency it adds; this is one of
the main reasons I still use macOS' default Terminal.app

~~~
scott_s
Perceived latency is why I stuck with Terminal over a decade ago. Since then,
Terminal has gotten better. Maybe I should re-evaluate, but it's serving me
well and I prefer using default applications where I can.

------
FeepingCreature
Shoutout to yakuake (Quake-style dropdown terminal with tabs, for KDE). I do
all my console work in it; the convenience of having access to your console at
any time with the press of a button is hard to overstate. guake is the gnome
version, and I am told ConEmu supports someting similar for Windows.

~~~
williamdclt
iTerm supports this on mac (google "iterm hotkey window"). Been addicted to
that since guake!

------
hestefisk
I used to customise the hell out of tcsh, zsh... until I started using fish,
which just has sane defaults.

~~~
RMPR
What makes me reluctant to use fish is the fact that it's syntax is totally
incompatible with bash and zsh.

~~~
t0astbread
I use fish but only interactively. For scripts I still use bash. The amount of
fish-specific syntax I use interactively (and, string interpolation etc.) is
so small, it doesn't really bother me.

Addendum: I did write my entire prompt (which is 81 lines right now) in fish
(my rationale was "maybe it's better performance-wise"), which was hell and I
hated it but that's the only piece of fish code I've ever written.

------
DrBazza
Regarding the prompt part, if you switch between different shells, you may
prefer to take a look at [https://starship.rs/](https://starship.rs/) so you
only have to configure your prompt once.

------
andrewzah
I used to use oh-my-zsh but I found that it added too much latency to my shell
startup. I removed oh-my-zsh and realized I don't need the majority of what it
provides.

The only major modification left is my shell theme, which tracks the amount of
time between commands, and is green/red like the OP for successful/failed
commands.

I also do not source things like nvm, rbenv, etc by default, instead just
sourcing them as needed.

My .zshrc for reference:
[https://git.andrewzah.com/andrewzah/dotfiles/src/branch/debi...](https://git.andrewzah.com/andrewzah/dotfiles/src/branch/debian-
desktop/.zshrc)

------
hncensorsnonpc
Summary: Install Oh my ZSH and never look back (Did it already)

------
Tade0
If anyone's interested in a decent colour scheme, a friend of mine put some
time into developing one:

[https://github.com/jan-warchol/selenized](https://github.com/jan-
warchol/selenized)

