💾 Archived View for gemini.ctrl-c.club › ~de_alchmst › b-logs › rants › multiline-prompt:multiline-p… captured on 2024-06-16 at 14:03:29. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-26)
➡️ Next capture (2024-08-25)
-=-=-=-=-=-=-
Many experienced shell users are already familiar with this concept, so consider it more of a guide for those new to *nix and terminal usage in general.
In case you don't know, prompt is the text that appears after you run some program and prompts you for your next commands. Prompts can contain a lot of information, but they usually include your username, device name and curent working directory. I also like to add time to my prompts, some like to add exit status of programs... Point is that prompt can take a lot of space.
Most of it is usually taken by directory. Even with more minimal prompt, something like:
Jhon@Thinkpad ~/personal-projects/cool-name/src/libs/some-lib $
can get quite long.
There are some ways to deal with this. First is shortening /home/$USERNAME to ~. Nice, but not enough. Some shells can shorten the path to only first letters of dir names, but that is just confusing in my opinion.
That still does not fix my main problem. While it is annoyng to fit only first half fo your relatively short command on prompt line, it's not that bad. However when I start writing command, I want it to appear on the same place, not be indented based on when in the system I am.
Solution: just put the prompt on two lnines. prompt on my home computer looks like this, but with more colors:
┌┤NAME@DEVICE│CURRENT_PATH│ └─HH:MM─❱
My prompt on ^C looks like this:
~::NAME|CURRENT_DIR::~ '@ctrl-c.club|>
no time, since it's offset quite a bit form where I live.
This way, my commands always start in the same place and I have enough space for current directory.
Some could object that it takes more vertical space, but it's very unlikely that command output will be off by just one line. It either has enough space or is way over one screen, so no complications here.
Since kitty (my current terminal emulator of choice) has support for displaying images through it's own protocol (I still want sixels to come back), I should be able to put image in my prompt. It even supports gifs...
----------------------------