iTerm/OSX Terminal: Change text margin from edge of window

9,565

Solution 1

If anyone comes up at this question, this functionality is available via this plugin for iTerm2:

https://github.com/jaredculp/iterm2-borderless-padding

And from iTerm 3.1 on (currently in alpha), you can have it as an advanced option in height of top and bottom margins and width of left and right margins.

Solution 2

Seems like an option, although involves some compile& build hassle http://hackr.it/articles/prettier-gutter-in-iterm-2/

i.e., you have to clone https://github.com/gnachman/iTerm2.git and then patch sources/PTYTextView.h

33c33
< #define MARGIN  5
---
> #define MARGIN  15
36c36
< #define VMARGIN 2
---
> #define VMARGIN 12

and then make it.

Share:
9,565

Related videos on Youtube

Caleb Xu
Author by

Caleb Xu

Updated on September 18, 2022

Comments

  • Caleb Xu
    Caleb Xu over 1 year

    Currently, I use iTerm on OS X. My terminal looks something along these lines:

    My terminal

    I came across this picture of a terminal setup on GitHub, and I wanted to imitate it:

    Target terminal

    Specifically, I wanted to change the padding/margin along the left side/bottom side of the window. While the picture in question appears to utilize OSX's default Terminal, I'm hoping it can be done in iTerm as well, although an OSX Terminal-specific solution would work too.

    I've tried looking through iTerm and OSX Terminal's preferences (especially under the "Window" section on iTerm, but I have looked elsewhere), and I have yet to find an option for adjusting where the characters start along the left side.

    I've also tried to implement this programmatically in Bash:

    bash -l | sed 's/^/ /'

    This seems to work fairly well, although it only indents program output, not my prompt line (and I'm having trouble setting such a piped command as my login shell).

    Also, it only adjusts stdout, not stderr and piping it with bash -l 2>&1 simply hides all of Bash's output altogether.

    Have I just overlooked some setting in iTerm/OSX Terminal? Is there any other way to set an "inner text area" within the Terminal window (i.e. set padding along the sides)?

    • lzam
      lzam over 9 years
      Well, for your prompt you could always try adding export PS1=" $PS1" (give or take a space) to ~/.profile
    • Caleb Xu
      Caleb Xu over 9 years
      Yes, I figured that would work out pretty easily, but there's no good way to indent the rest of the output, unfortunately.
  • Caleb Xu
    Caleb Xu over 9 years
    Still easier changing two variables than meddling around with a bunch of messy pile of shell script. Thanks!
  • Kevin Suttle
    Kevin Suttle over 8 years
    Still works for me. Only caveat is that in the current beta builds, the "cursor guide" (persistent line highlight) doesn't go full-bleed. cloudup.com/cD9Leds1Wof
  • Aviel Gross
    Aviel Gross over 7 years
    Those defines now reside in iTermTextDrawingHelper.h
  • Caleb Xu
    Caleb Xu over 7 years
    Just to provide an update, these defines no longer work. You can find margin settings in the Advanced section of the preferences.
  • Chris Page
    Chris Page almost 6 years
    This answer would be improved by describing the location of these preferences.