Skip to content
Yefer YV edited this page Jun 9, 2024 · 10 revisions

change/add whichkey keymaps

  • add this to your settings.json
{
  "whichkey.bindingOverrides": [
    {
      "keys": "g.s",
      "name": "Go to line",
      "type": "command",
      "command":"workbench.action.gotoLine",
    }
  ]
}

read more

add your-cool-plugin

  • copy retronvim's init.lua and add your plugins/modification:

    cp ~/.vscode/extensions/yeferyv.retronvim-0.0.2/nvim/init.lua ~/.config/retronvim/init.lua

    add to your settings.json:

    "vscode-neovim.neovimInitVimPaths.linux": "$HOME/.config/retronvim/init.lua"

    open (to test/debug) with:

    NVIM_APPNAME=retronvim nvim

slow h, j, k, l workaround

  • add this to your keybindings.json, but won't restore cursor position when moving up and down, neither <number>h,<number>j,<number>k,<number>l, gh, gl, gnh, gph will be supported, and a extra fake space (e.g. r<fake space> will modify r<end of line>) is navigable at the end of line, press <esc> two or more times if h, j, k and l doesn't want to use the vscode arrows keys remaps (e.g. sometimes after flash.nvim), added by default on Windows 10/11

    {
      "key": "h",
      "command": "cursorLeft",
      "when": "editorTextFocus && !(neovim.fullMode =~ /^(f|r)/) && neovim.mode != 'insert' && neovim.mode != 'visual'"
    },
    {
      "key": "j",
      "command": "cursorDown",
      "when": "editorTextFocus && !(neovim.fullMode =~ /^(f|r)/) && neovim.mode != 'insert' && neovim.mode != 'visual'"
    },
    {
      "key": "k",
      "command": "cursorUp",
      "when": "editorTextFocus && !(neovim.fullMode =~ /^(f|r)/) && neovim.mode != 'insert' && neovim.mode != 'visual'"
    },
    {
      "key": "l",
      "command": "cursorRight",
      "when": "editorTextFocus && !(neovim.fullMode =~ /^(f|r)/) && neovim.mode != 'insert' && neovim.mode != 'visual'"
    },
    

    a alternative/old version but doesn't support flash.nvim nor replace mode

    { "key": "h", "command": "cursorLeft", "when": "editorTextFocus && neovim.mode == 'normal' && ( isLinux || isMac || isWindows || isWeb)" },
    { "key": "j", "command": "cursorDown", "when": "editorTextFocus && neovim.mode == 'normal' && ( isLinux || isMac || isWindows || isWeb )" },
    { "key": "k", "command": "cursorUp", "when": "editorTextFocus && neovim.mode == 'normal' && ( isLinux || isMac || isWindows || isWeb )" },
    { "key": "l", "command": "cursorRight", "when": "editorTextFocus && neovim.mode == 'normal' && ( isLinux || isMac || isWindows || isWeb )" }
    

gnh, gph not working on Windows10

  • disable cursorLeft, cursorDown, cursorUp, cursorRight (which were mapped to h, j, k, l for performance on Windows10). add this to your keybindings.json

    { "key": "h", "command": "-cursorLeft", "when": "editorTextFocus && neovim.mode == 'normal' && ( isWindows || isWeb )" },
    { "key": "j", "command": "-cursorDown", "when": "editorTextFocus && neovim.mode == 'normal' && ( isWindows || isWeb )" },
    { "key": "k", "command": "-cursorUp", "when": "editorTextFocus && neovim.mode == 'normal' && ( isWindows || isWeb )" },
    { "key": "l", "command": "-cursorRight", "when": "editorTextFocus && neovim.mode == 'normal' && ( isWindows || isWeb )" }
    

install conda

  • with scoop using zsh (msys2), see: https://github.com/conda/conda/issues/9922 scoop insall mambaforge then add to your ~/.zshrc: eval "$('/c/path/to/miniconda3/Scripts/conda.exe' 'shell.zsh' 'hook' | sed -e 's/"$CONDA_EXE" $_CE_M $_CE_CONDA "$@"/"$CONDA_EXE" $_CE_M $_CE_CONDA "$@" | tr -d \x27\\r\x27/g')" then relaunch vscode and choose your virtual environment (view vscode statusbar and click to change)

  • with nixpkgs

    nix-env -iA nixpkgs.conda
    echo 'source $HOME/.conda/etc/profile.d/conda.sh' | tee -a ~/.bashrc -a ~/.zshrc | sh
    conda install --name base conda=24.3.0
    conda update conda
    

    then choose your virtual environment (view vscode statusbar and click to change)

  • with brew

    brew install mambaforge
    conda init
    

    then relaunch vscode and choose your virtual environment (view vscode statusbar and click to change)

  • cheatsheet: curl cht.sh/conda

pixi virtual environment

  • there's a pull request https://github.com/microsoft/vscode-python/pull/22968 to support pixi virtual environment then you will be able to choose your virtual environment inside vscode meanwhile run pixi init to initialize a project then pixi add python to add dependencies then pixi shell on linux/mac/windows or pixi run zsh on msys2 to activate a virtual environment then launch code . then select the virtual environment (view vscode statusbar and click to change), then the python LSP (completion, diagnostics ...) for external libraries should work

  • alternatively in a new terminal run pixi init > pixi add python > pixi run zsh (the last command should be executed in every new terminal)

  • RetroNvim already adds "python.defaultInterpreterPath": ".\\.pixi\\envs\\default\\python.exe" in settings.json as default virtual-environment/interpreter on Windows 10 if overwritten then manually choose the pixi virtual environment (view vscode statusbar and click to change) .\\.pixi\\envs\\default\\python.exe on windows and ./.pixi/envs/default/bin/python on linux/macos

  • cheatsheet: https://pixi.sh/latest/basic_usage https://code.visualstudio.com/docs/python/environments

additional chrome extensions:

additional vscode extensions:

Clone this wiki locally