Q: Tab spacing in Terminal.app

Discussion in 'Apple' started by Mo Geffer, May 20, 2004.

  1. Mo Geffer

    Mo Geffer Guest


    Is there any way to control the tap settings in the Terminal.app? For
    example, in vi I have 'set tabs=4' and my tabs are every 4 spaces. But
    if I cat the file I just edited the tabs are at 8.

    Where can I change this? If I can't change this are there any

    Mo Geffer, May 20, 2004
    1. Advertisements

  2. Mo Geffer

    Bob Harris Guest

    You could try sending vt100 escape sequences to Terminal.app to set your
    tabstops (see the end of my message).

    As a long time text editor with tabs user, you really shouldn't.
    Because if you find a way to change the Terminal.app tabs, then you will
    want to find a way to change the printer default tabs, and you will
    annoy anyone you send the file to because they will not have your tab
    settings, etc...

    The Mac OS X 10.3 vi is really Vim and in Vim what I do is set the
    option to expand tabs into spaces so that regardless of what I set
    tabstops to, my display output in any terminal or printer is consistent,
    and when other people read my text they see the format I laid out.

    :set expandtab

    This can be stored in your ~/.vimrc file.

    For a real vi (or nvi), I keep my tabstops at 8, but I set my shiftwidth
    to 4, and I use Control-D to move out one shiftwidth and Control-T to
    move in one shiftwidth. I also use << to move a line out one shiftwidth
    and >> to move a line in one shiftwidth. <} and >} to move a paragraph,
    <% and >% to move from the the starting { to the ending }.

    :set shiftwidth=4

    Having said all that, one way that might work is to use terminal escape
    sequences to set your tabstops. Have not tired this, but since
    Terminal.app is a vt100 or better terminal emulator, you might be able
    to use escape sequences documented by the creator of the vt100 line of
    terminals (Digital Equipment Corporation living on as part of HP). This
    is a URL to the dtterm terminal emulator man page on escape sequences,
    which is also a vt100 line terminal emulator


    Bob Harris
    Messing with tabs since 1979,
    Using vi since 1988
    Using Vim since 2000
    Bob Harris, May 21, 2004
    1. Advertisements

  3. Mo Geffer

    Mo Geffer Guest

    Excellent, Bob. "expandtab" is exactly what I'm looking for. I like your
    Mo Geffer, May 21, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.