skip to Main Content

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

enter image description here

3

Answers


  1. Chosen as BEST ANSWER

    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
    

  2. 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

    Login or Signup to reply.
  3. 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 $):

    Code diff

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search