Histfile in integrated terminal not the same as normal terminal - visual-studio-code

I just lost my terminal history in VS Code. I noticed it when trying to do a reverse search in the Integrated Terminal (CTRL+R).
To debug, I ran this command:
echo $HISTFILE
This gives me:
/var/folders/ky/ltbvkg9s1239m5c9bccj5xtc0000gn/T/johndoe-code-zsh/.zsh_history
I would expect the normal path of my ZSH history is shown instead, like I get in iTerm2 when running the same command.
/Users/johndoe/.zsh_history

I believe this is a bug with VSCode's ZSH shell integration, that has already been resolved on the Insiders version.
Here is the offending line (note the HISTFILE without $):
I've seen it merged into the release/1.74 branch so hopefully, a v1.74.1 is not too far away. In the meanwhile, you can switch to Insiders (side-by-side installation) or turn off shell integration as suggested in the other answer.

Try turning off the shell integration that's enabled by default ("terminal.integrated.shellIntegration.enabled") and then restart the terminal.
https://i.stack.imgur.com/1Ger0.png

I fixed the problem by just adding this two lines at the bottom of my ~/.zshrc file.
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Related

Is there an neovim version of vimdiff

I've started using nvim (neovim) recently. It generally works well, but when I run vimdiff, I noticed that I got the startup errors I got when I ran regular vim. I've fixed those so that both vim and nvim run without errors on my system, so vimdiff works fine now. But it makes me wonder: is there a neovim version of vimdiff? Or should I just maintain both vim and neovim so that regular vim works fine for vimdiff?
Yeah, you can use the -d option to open nvim in diff mode.
I noticed a question about this was posted on redit: https://www.reddit.com/r/neovim/comments/6rvsa2/nvimdiff/
The dialog there confirms that there is no corresponding nvimdiff that is shipped. The solution suggested there is to add an alias in your bashrc file:
alias vimdiff='nvim -d'
I'll do this.

Terminal will not open in Visual Studio Code

OS is linux.
Opening the terminal produces this error:
The terminal process failed to launch: Path to shell executable "bash" is not a file of a symlink.
The path to bash is correct in settings.json and the $PATH variable.
This is Visual Studio Code version 1.57.1. rolling back to an earlier version fixes the issue, so I made a bug report.
As jebeaudet said in his comment, edit the file
~/.config/Code/User/settings.json
and add this line
"terminal.integrated.profiles.linux": {"bash": {"path": "/bin/bash"}},
(in my case has occurs when upgrading from v1.55 to v1.60)
In my case, terminal.integrated.shell.linux wasn't set in settings.json which was causing the issue
I noticed the same problem since I upgraded to 1.57.1.
The problem shows up when I launch VSCODE from Gnome desktop or from the terminal without following the command code with a dot.
However if I enter "code ." then there is no problem.
I could not find "terminal.integrated.shell.linux" in the settings to set the path to the shell bash command.

Looking for help on setting up wsl in vscode terminal

If I'm in my terminal and open a file with the code command, vscode will launch and the terminal inside code will show my full zsh setup that I have configured in hyper terminal. But if I open up code through windows, and select wsl as my default shell, it's pretty much useless. Anything I try, like sudo, git, apt, etc will return a command not found message.
So if I want to commit any changes in the terminal inside code then I have to use the git bash shell. Is it possible to get my zsh working without first launching from my terminal emulator so I'm using wsl instead of git bash?
running wslconfig.exe /list in powershell showed me that WSL was set to docker as the default shell, so then running wslconfig.exe /setdefault "Ubuntu" in powershell fixed my problem.

Terminal started behaving badly when Zshell theme is present

Originally from here.
Versions:
VSCode Version: 1.46.1
OS Version: Windows_NT x64 10.0.20161
Steps to Reproduce:
Install debian-dev-boilerplate inside WSL.
Setup powerlevel 10k.
Clone a git repo and enter its folder.
git clone git#github.com:DanielAtKrypton/debian-dev-boilerplate.git
cd debian-dev-boilerplate
You should now see something like:
Open vscode from zshell. By typing at the zshell prompt:
code .
At this point the bug is revealed when the terminal is opened for the first time inside vscode. At first glance, the terminal renders correctly the powerlevel10k theme. After half a second, the theme is deactivated as can be seen in the next picture.
Does this issue occur when all extensions are disabled?:
Yes. The first time vscode is launched, it installs a vanilla (with no extensions) vscode-server to the linux distro. And still the bug happens.
It is interesting to note that in prior vscode versions this functionality was working alright. For any reason I don't know this issue started to happen in the last couple weeks.
Additional Info:
Here is the log file when running the commands:
code . --log trace
exthost.log
Most likely Powerlevel10k has been installed and/or loaded from ~/.zshrc incorrectly. The screenshot of VS Code shows robbyrussell theme, so I surmise that you are using Oh My Zsh. To install Powerlevel10k on top of Oh My Zsh you need to follow these instructions:
Run: git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.
Try running grep -E 'ZSH_THEME|/powerlevel10k' ~/.zshrc. The output must be exactly like below.
ZSH_THEME="powerlevel10k/powerlevel10k"
If it's not, you need to fix ~/.zshrc.

Visual Studio Code - Where is the terminal history saved?

I noticed that the command history is saved when using Visual Studio Code. Using the arrow up and down keys, I can toggle through previously issued commands in the integrated terminal.
Where is the terminal history saved on the drive? Is it possible to open a file in notepad (or notepad++) and investigate the complete history, delete it?
I'm using Windows 10, and I have concluded that deleting the folders C:\Users\john\.vscode and C:\Users\john\AppData\Roaming\Code will not delete the terminal history for a particular project.
VSCode terminal use external shell. For linux the default shell is bash, I am not so sure about window, but I guess the default shell for window is powershell.
If your terminal shell is indeed powershell, this should help you locate the log file.
On Linux & MacOS, type the following command to display the path of the history file:
echo $HISTFILE
The history file may be different between VSCode and your regular terminal.
So you should type this command within the integrated terminal.
On Ubuntu you can see your history using this command:
vi ~/.bash_history