1

Does anyone know how I can set "margins" for terminal output?

As you can see in the screenshot below, I'm working with a custom two-line terminal prompt. The prompt itself has:

  1. a top margin, which is just a "\n" prepended to the prompt lines.
  2. a left margin, which is just a whitespace character prepended to the prompt lines.

terminal output

I would like to achieve the same aesthetical result with the output, adding a top and left margin to it.

My terminal configs: gnome-terminal + zsh + oh-my-zsh.

My zsh custom theme config goes something like this:

TOP_MARGIN=$'\n'
LEFT_MARGIN=' '

PROMPT_FIRST_LINE=${TOP_MARGIN}${LEFT_MARGIN}
PROMPT_FIRST_LINE+='┌─ ➜  '

PROMPT_SECOND_LINE=${TOP_MARGIN}${LEFT_MARGIN}
PROMPT_SECOND_LINE+='└─ >  '

PROMPT=${PROMPT_FIRST_LINE}${PROMPT_SECOND_LINE}
2
  • Just to clarify, are you looking for a solution that works with pixels? Commented Aug 11, 2022 at 22:59
  • @DanielW. It doesn't need to be fine-tunable to the pixel level, but if such solution exists, I would like to hear more about it. Commented Aug 12, 2022 at 14:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.