0

I'm using zsh from vscode integrated terminal

i also use hyper terminal, warp and iterm2 for other purposes but i like to use the integreated terminal while in vscode. i actually enjoy my heavy .zshrc config on external terminals, but i often get the popup "your shell environment is taking too long to load" from vscode. Tbh, i don't mind the popup itself, but i think that a lot of the features that are useful outside vscode are not needed inside.

How can i set a different .zshrc to load only to be used by the vscode integreated terminal ?

tried conditional loading from my .zshrc but don't like it

tried setting it in the vscode-settings.json

  1. this self-answer confused me more
  2. this i think points in the right direction but i am not sure how to use task.json

my env:

  • macOS 13.1 22C65 arm64
  • Apple M1 Max
  • vscode (1.74.11ad8d514439d5077d2b0b7ee64d2ce82a9308e5a for arm64)
  • zsh 5.9 (arm-apple-darwin22.1.0)
aaurso
  • 21
  • 3
  • I don't know visual studio, so just some musings instead of an answer: Does VStudio set specific environment variables (or can you configure it to do so), when running your shell? You could then catch this variable in your `~/.zshenv` and, if you know that you are under VStudio, set the variable `ZDOTDIR` to the directory containing your zsh setup files. – user1934428 Dec 15 '22 at 15:54
  • 1
    Actually, if VStudio allows you to define environment variables when running your shell, you could define there the `ZDOTDIR` and then cause all setup files to be executed from that directory. – user1934428 Dec 15 '22 at 15:55
  • solved it, i don't know how to self-answer the question so i will write here: – aaurso Dec 16 '22 at 18:17

1 Answers1

2

These are the settings to change in “settings.json”:
I created 3 profiles:

  1. zsh-minimal with the vscode minimal config -> new ZDOTDIR
  2. zsh-full with my usual heavy config -> probably not necessary since it is $HOME by default i think
  3. bash, just in case i fu everything

set to null old profiles ( zsh and zsh(2)) to delete them from profiles selection dropdown menu, as per official documentation.

“terminal.integrated.defaultProfile.osx”: “zsh-minimal”,
“terminal.integrated.profiles.osx”: {
    "zsh-minimal": {
        "title": "zsh-minimal",
        "path": "/opt/homebrew/bin//zsh",
        "icon": "terminal",
        "color": "terminal.ansiMagenta",
        "args": [
            "-l",
            "-i"
        ],
        "cwd": "${workspaceFolder}",
        "env": {
            "ZDOTDIR": "/Users/MYUSERNAME/.homesick/repos/MYUSERNAME-dotfiles/home/vscode_zsh"
        },
    },
    "zsh-full": {
        "title": "zsh-full",
        "path": "/opt/homebrew/bin//zsh",
        "icon": "terminal",
        "color": "terminal.ansiCyan",
        "args": [
            "-l",
            "-i"
        ],
        "cwd": "${workspaceFolder}",
        "env": {
            "ZDOTDIR": "/Users/MYUSERNAME/"
        },
    },
    "bash": {
        "title": "bash",
        "path": "/bin/bash",
        "icon": "terminal",
        "color": "terminal.ansiWhite",
        "args": [
            "-l",
            "-i"
        ],
        "cwd": "${workspaceFolder}",
    },
    "zsh":  null, 
    "zsh (2)": null,
}
Ermiya Eskandary
  • 15,323
  • 3
  • 31
  • 44
aaurso
  • 21
  • 3