Skip to content

Override terminal width #606

@andrewbaxter

Description

@andrewbaxter

I wasn't sure if this should go here or in terminal_size but I think the latter is a minimal utility, and this feature is more context specific?

There are situations where I want to override the terminal size/wrap width. For instance, when capturing wrapped command output for a fixed-width document, or doing multi-column output (e.g. with diff -y) etc. Or alternatively, setting it to a very high number to effectively disable wrapping.

I think the COLUMNS environment variable is fairly standard for this in linux, e.g. ncurses has this documentation https://invisible-island.net/ncurses/man/ncurses.3x.html#h3-COLUMNS (used to override terminfo data). https://linux.die.net/man/1/resize, also it looks like vim reads that variable. https://linux.die.net/man/1/tput reads it too. E.g.:

export COLUMNS=80
./run_my_program

It'd be great if this supported that as well when using the terminal_width feature... or maybe it does and I just messed up updating my packages. I couldn't find any discussions about this elsewhere though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions