Scrolling in the integrated terminal using the mouse wheel - visual-studio-code

I am using the remote-ssh extension with a (remote) bash as integrated terminal in Visual Studio Code September 2021 release.
When I use the scroll wheel in the integrated terminal, I move through the bash command history (like if I were pressing the up/down arrow keys). Furthermore, there are no scrollbars in the terminal so I am not able to see the text that does not fit in the current viewport.
Is there any way I can use the scroll wheel to actually scroll the content of the integrated terminal window? If I remember correctly, with previous versions of the program I was able to do exactly what I am asking.
The support page https://code.visualstudio.com/docs/editor/integrated-terminal does not say anything about this.
I have another question: is there a place with a comprehensive list of settings for the integrated terminal?
Details:
Version: 1.61.0 (user setup)
Commit: ee8c7def80afc00dd6e593ef12f37756d8f504ea
Date: 2021-10-07T18:13:09.652Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19043
Microsoft remote-ssh: version v0.65.8

The issue being described here is the "alternative screen buffer" which causes the scroll wheel to act as arrow keys, scrolling the shell history rather than the window.
If you execute a command (such as vim) that puts you in the "alternative screen buffer" but doesn't put you back when it exits, you can switch back from the alternative screen buffer with:
$ echo -ne '\x1B[?1049l'
# or, if you don't want to memorize that:
$ tput rmcup
If you really want to disable alternate screen buffer switching, which could cause other apps to behave very differently than you're used to which rely on the alternate screen buffer, you could create a new terminfo entry that removes the smcup and rmcup capabilities, which enables this capability.
For example, if you're using xterm-256color, you can create a xterm-256color-noalt terminfo entry like this:
$ infocmp xterm-256color | sed \
-e 's/^xterm-256color/xterm-256color-noalt/' \
-e 's/[rs]mcup=[^,]*,//' \
>xterm-256color-noalt.ti
$ tic xterm-256color-noalt.ti
Then, set your TERM to xterm-256color-noalt:
$ export TERM=xterm-256color-noalt
But, this is a bit more drastic and, like I said, could cause other apps that depend on alternate screen buffer capability being available in the terminal to misbehave or at least behave in ways you don't expect.

CTRL+A then ESC will allow you to use the wheel to scroll up/down
Press ESC to cancel it and get back to the normal wheel functionality.

This had me so frustrated too. After a little trial-and-error, I felt so stupid when I figured out my problem: I was using the WRONG terminal type.
In the terminal "section" at the bottom of VSCode are the tabs: PROBLEMS, OUTPUT, DEBUG, TERMINAL. In the TERMINAL tab, there's a drop-down on the right for terminal type: "tmux" and "JavaScript Debug Terminal" have the awful behavior described above; choose "bash" instead!! "bash" behaves like a proper Bash Linux terminal.

Related

Libreoffice fails to display in openbox debian minimal desktop

When I launch libreoffice, either from the openbox applications menu or from the command line, it doesn't display. I only see the libreoffice picture with the loading bar, then it disappears, and that's it, no window at all is displayed. Only when I use the switch-beetween-window keybinding (Alt + Tab) can I see the thumbnails of libreoffice main and the tips windows along with my other open windows thumbnails in the windows-switch menu, but no windows on my desktop nor even any outline of them...
What's more, when I
ps -e | grep libreoffice
no process is returned.
Every other graphical application works well, only libreoffice has theis issue so far.
*I'm using
Debian 11 (5.10162-1) for x86_64
Kernel : 5.10.0-21-amd64
And a minimal desktop environment made of
Openbox 3.6.1 and Polybar 3.5.5*
I tried to run libreoffice in safe mode to override the .config file
libreoffice --safe-mode
Same result.
I tried to reinstall libreoffice, nothing changed.

Doom emacs display various themes in terminal

I employed the 'Ocean next theme' on alacritty terminal Color schemes ยท jwilm/alacritty Wiki
Upon starting doom-emacs from terminal (tmux new -s 'main'),
the identical commands emacs -nw display various theme.
I want the one above.
It's tricky that if start a new tmux session with other name saying 'focus',
They display the same themes
Restart the machine multiple times,
my desired theme appears on 'main' session to the above window.
What's the problem?
Your setup has too many layers:
Terminal->Tmux ->Emacs.
Try just running emacs without tmux (emacs has all the tmux goodies integrated) or better run the GUI emacs directly (themes will be in 100% full potential).
BTW, emacs GUI is not like GUI Vim. It's the total package if you run it with exwm.
Take out all decorations (scrool bar menu bar etc..) and it will look like a terminal app except with access to thousands of packages that cannot run in the terminal mode because of limitations.
Once you use it this way. There is no coming back.
My .xinitrc has one line exec emacs (keep in mind you can run firefox inside emacs)

Visual Studio Code - Add option(s) in 'select default shell' list on Windows?

I want to use various shells in VSCode terminal, eg. Git Bash. I can set it in settings.json with terminal.integrated.shell.windows, but if I select CMD as default subsequently, that setting will get replaced. And if I add another terminal.integrated.shell.windows to bash.exe, I'm stuck with bash, can't change default shell, seems logical anyway if VSCode only replaces the 1st setting, but read the last same setting value.
The problem is there's no Bash existed in the "select default shell" list, and my question is how to add that?
I have installed latest (2.22.0) 64-bit version of Git for Windows, and hoped it would add the necessary env/reg etc for that, but no.
Even though this should be version independent, nevertheless here's my VSCode About:
Version: 1.35.1 (user setup)
Commit: c7d83e57cd18f18026a8162d042843bda1bcf21f
Date: 2019-06-12T14:30:02.622Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.10240
Please. I know there are similar questions, but they don't really solve my problem. However, the correct answer to my question will solve theirs.
If your question is how to add more terminal shells to Terminal:Select Default Shell, I dont think thats easily possible.
But you can use Shell Launcher plugin to add more shells and launch them in your integrated terminal. Below is a screen shot where I added Julia to the list.
Installation:
Go to Extensions and add Shell launcher.
Go to settings(Ctrl+,) and search for Shell Launcher and edit for your platform.
Add your shell to the list
You can launch this by F1(Command Pallete) -> Shell Launcher
My alternative solution is to use the "terminal.external.windowsExec" setting for non-default Windows shell. But you can only have one such setting!
I have this same question, and have looked through all of the documentation, and every article I can find on the subject, and haven't found the answer. I found a terminal launcher extension, but that creates a separate menu. There must be a json file somewhere that has the list of choices for the Select Default Shell menu. Does anyone know how to update that menu?
I did some more testing on this. On the Mac version (and I assume the linux version), there is a file called /etc/shells that is used to determine what to put in the menu. If there is a similar file on Windows, I'm not sure what it would be called or where it would be.
For anyone on Linux who cannot seem to find the option at all, uninstall VS Code and reinstall the latest version from the website.
I spent so much time with the same issue but the reason was that I had installed it from the pop shop on my pop OS (Linux).
The Select Default Shell command just list the shells that can be found from your %PATH% environment variable. Add the shell and restart VSCode to see it.
Here is to add a new path.
Remember that you can always start a shell from another one. Just type bash from inside CMD.

VS code - 2 split terminal in one (split)

As I'm working with Node.js and Angular, I've currently work with two terminals where I have to switch terminal by the dropdown option.
Is there a way to have two terminals (split) in the same place
like this:
Couldn't find a way.
Update - Visual studio code has this feature starting with version 1.21
Split terminals
The Integrated Terminal can now be split such that multiple are visible at once, which can enable much easier management of terminals when you need a watch and a run command for example:
Open the article to see the GIF demonstration.
Splitting can be done by clicking the split button in the panel, through the context menu or the command Ctrl+Shift + 5.
....
Before VS Code introduced the feature
Inside vs code
You can configure your console to bash or cygwin, and then install and use tmux or screen.
Initial answer before I understood the question intent was to do it inside vs code
Outside vs code
On windows
I'm using Cmder.
It allows opening multiple cmd tabs, and configure more types of command lines / tabs - such as bash, nodejs etc.
On Linux
I got to play a bit with tmux and I heard it's a good option.
Screen shot from google:
On Mac
As Brad stated - tmux works also on Macs, so have a look at the Linux section above.
VSCode has added support to split the integrated terminal in february 2018, as requested by this issue.
At the time it is not yet released, you need to install the Insiders version of VSCode.
You have to set the keybindings yourself, the default are still being discussed here.
As of June 2021, you can select the terminal then enter command: ctrl + shift + 5.

Filtering ZSH history by command

I was told that in ZSH you could do something like command and then when you hit up it would filter the history based on the given command. But when I try this it just cycles the history like bash does. Is this disabled by default?
Hit Ctrl+R, type some letters, it will find the previous command with these letters, keep hitting Ctrl+R to continue through the previous findings.
Works in bash, zsh (and other shells i suppose).
What i personally like to have is: type some letters, press Up, the previous commands starting with the same letters appear. Very powerful, i love it.
You have to bind the keys you want to history-beginning-search-backward and history-beginning-search-forward.
In case it's not enough for you, zsh has a lot of options, try to look in Zsh Line Editor and tell us.
For bash, less powerful but more common, Bash commands for history.
Use exclamation point:
> !<starts-with this string>
You can arrow up/down through all commands that started with that. I use "!v" all the time to get my previous command for opening a file with Vim.
You can also use a question mark to search beyond matching the beginning of the string,
> !?status
Can find "git status".
Use percol to dynamically search and navigate through your history with Ctrl-r.
install percol: sudo pip install percol
add the zsh-history-search code snippet to your .zshrc file.
After a Ctrl-r, you can see your whole history in the same window. Searching for a keyword (dynamically) narrows that list down. You can use key-bindings (like this emacs like config) to navigate up and down the list and eventually make a selection.
Here is a search for all sudo install commands available in history with sudo make install selected.
Enter issues the selected command.
We can also use fzf to fuzzy search the command history interactively.
Here is how to install:
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
Say yes to all its configs. After that, restart your zsh shell, and press Ctrl-R, whoa, interactive command history search pops up. Enjoy!
With the vim keybindings activated in zsh you can use vi-history-search-backward (/) when in vi command mode.
That's a feature available in fish, but it seems like someone made a zsh plugin for it. It's not available in standard ZSH.
If you don't want to add any keybindings, you can search by default using Ctrl+R to move backward & Ctrl+S to move forward.
You can start search with any of the key shortcuts Ctrl+R or Ctrl+S