Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the terminal line width in Visual Studio Code?

I'm using Visual Studio Code 1.18.1 on Mac OSX and the integrated terminal seems to have a fixed width of 36 characters that doesn't increase when I make the terminal window wider.

How can change the number of characters per line in the terminal? Is it possible to make the lines wrap based on the terminal window width?

like image 970
filip Avatar asked Dec 03 '17 08:12

filip


People also ask

How do I set line length in Visual Studio code?

In VSCode, go 'Code -> Preferences -> Settings' and search for "python formatting black args". A few notes about line lengths in Python: PEP8 recommends a line length of 79 characters (72 for docstrings) Black sets line lengths to 88 characters by default.


4 Answers

There is no option to disable word-wrap in VS Code integrated terminal

Actually, for VSCode 1.61 (Sept. 2021), there is:

Terminal / Toggle wrapped lines:

Toggle the terminal width between fitting the full contents and wrapped lines via kb(workbench.action.terminal.sizeToContentWidth) or using the tab context menu action Toggle Size to Content Width.

https://media.githubusercontent.com/media/microsoft/vscode-docs/vnext/release-notes/images/1_61/terminal-content-width.gif

Keyboard shortcut: Alt+Z

like image 198
VonC Avatar answered Oct 27 '22 13:10

VonC


There doesn't seem to be a fix to this currently per open issue: https://github.com/microsoft/vscode/issues/74501

However in the above issue, user ultraGentle recommends tput rmam as a workaround.

like image 1
gungthar Avatar answered Oct 27 '22 14:10

gungthar


UPDATE 1: As of now there is no option to disable word-wrap in VS Code integrated terminal ( internally running program like bash or zsh will get the same width as the vscode terminal area you can check with echo "COLUMNS=$COLUMNS" ) even popular terminal emulator like iTerm don't have this feature see this open issue #1790

now if you can not do this at vscode level you can try doing it on program lever ( like bash or zsh ) maybe there is some way by defining a setting in bashrc or zshrc but I can not find anything on internet

However there is a program which can make horizontal scroll available for you at program level and that is less -S you can pipe any output ( with help of | oprator ) in it like

echo " this is very long lorem ipsum text sldkfjdslfk jsdlfkj sldfkj sldfkj sdlfjs dlfkjsd flsd jfsdlkfsdlfkj slfkjs lflskdfjsldfjsdlfksdlfkjsdflksdjflsdkfj ssldfkjsdlkf jsdlfkj sdlfsjdlfksdf lsdfjk " | less -S

you can scroll horizontally with help of arrow key for more shortcut see

 h  H                 Display help.
 q  :q  Q  :Q  ZZ     Exit.

enter image description here


I am using version 1.42.1 and it works as expected maybe you can try updating it to the latest version

enter image description here

I also checked the configuration ( command + , ) there wasn't any setting related to width of the integrated terminal

like image 1
Tripurari Shankar Avatar answered Oct 27 '22 13:10

Tripurari Shankar


There is no option to disable word-wrap in VS Code integrated terminal, but you can set an external terminal via "console": "externalTerminal" and there disable the word wrap or set the line width.

For example: On Windows click on top left corner to see the menu and select Properties, then Layout and uncheck the buffer checkbox and then increase the buffer to 4000. On Linux try setterm -linewrap off

like image 1
Codr Avatar answered Oct 27 '22 12:10

Codr