Skip to content
Yefer YV edited this page Jan 12, 2025 · 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/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

  • example install vscode-multiple-cursor

    add to your init.lua:

    add('https://github.com/vscode-neovim/vscode-multi-cursor.nvim')
    require('vscode-multi-cursor').setup()
    
    map('n', 'gb', 'mciw*<cmd>nohl<cr>', { remap = true, desc = "add virtual cursor (select and find)" })
    map('n', 'gB', 'mcgfn<cmd>nohl<cr>', { remap = true, desc = "add virtual cursor (find selected)" })
    map('n', 'go', 'mciwj<cmd>nohl<cr>', { remap = true, desc = "add virtual cursor down" })
    map('n', 'gO', 'mciwk<cmd>nohl<cr>', { remap = true, desc = "add virtual cursor up" })
    map('x', 'gb', 'mc*<cmd>nohl<cr>', { remap = true, desc = "add virtual cursor (select and find)" })
    map('x', 'gB', 'mc*<cmd>nohl<cr>', { remap = true, desc = "add virtual cursor (find selected)" })
    map('x', 'go', 'omcj<cmd>nohl<cr>', { remap = true, desc = "visual selected to virtual cursor (ctrl+left=prevword)" })
    map('x', 'gO', 'omck<cmd>nohl<cr>', { remap = true, desc = "visual selected to virtual cursor (ctrl+right=nextword)" })
    map(
      { "n" },
      "gW",
      function()
        vim.cmd [[ call feedkeys('viimi') ]]
        vim.defer_fn(function() vscode.action("cursorWordEndRightSelect") end, 100)
      end,
      { desc = "word-column multicursor (vscode only)" }
    )

install only RetroNvim's neovim

  • on linux/macos

    curl -L pixi.sh/install.sh | bash
    pixi global install nvim git
    curl -L https://raw.githubusercontent.com/YeferYV/RetroNvim/main/nvim/init.lua --create-dirs --output $HOME/.config/nvim/init.lua

    alternatively download retronvim's git-submodules too

    git clone --recursive https://YeferYV/RetroNvim ~/.config/retronvim
    NVIM_APPNAME=retronvim/nvim nvim

    additionally install yazi and lazygit with:

    pixi global install -c https://prefix.dev/rust-forge -c conda-forge yazi lazygit
  • on Windows 10/11 (using powershell)(relaunch terminal after installing dependencies to update PATH)

    winget install neovim.neovim.nightly git.git
    mkdir ${env:LOCALAPPDATA}/nvim
    curl https://raw.githubusercontent.com/YeferYV/RetroNvim/main/nvim/init.lua -outfile ${env:LOCALAPPDATA}/nvim/init.lua

    additionally install yazi, lazygit, and gcc using scoop package manager:

    set-executionpolicy remotesigned currentuser  # to allow script execution
    curl get.scoop.sh | iex                       # to install scoop
    scoop bucket add extras                       # to add more package repositories
    scoop install lazygit yazi gcc

    alternative way to install gcc using pixi package manager:

    winget install prefix-dev.pixi
    ~/appdata/local/pixi/bin/pixi global install m2w64-gcc                                                              # treesitter requires gcc
    [Environment]::SetEnvironmentVariable("PATH", "$env:PATH;$HOME\.pixi\envs\m2w64-gcc\Library\mingw-w64\bin", "user") # add gcc.exe to PATH permanently

    alternative way to install microsoft C compiler using winget package manager:

    gist tutorial youtube tutorial

    winget install Microsoft.VisualStudio.2022.BuilTools --force --override "--passive --wait --add Microsoft.VisualStudio.Workload.VCTools"
    [Environment]::SetEnvironmentVariable("PATH", "$env:PATH;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuilTools\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\cl.exe", "user") # PATH may change according to new version

    additionally add git-bash and git's unix commands to PATH permanently

    [Environment]::SetEnvironmentVariable("PATH", "$env:PATH;C:\Program Files\Git\bin", "user")
    [Environment]::SetEnvironmentVariable("PATH", "$env:PATH;C:\Program Files\Git\usr\bin", "user")

Msys2's zsh support for Windows terminal

  • copy Retronvim's .zshrc to ~/.zshrc then add this to your settings.json (ctrl+shift+p then open settings file (JSON))

    "profiles":
    {
        "list":
        [
            {
                "commandline": "sh -c 'HOME=/c/Users/$(whoami); msys2.cmd -shell zsh -full-path'",
                "guid": "{00000000-0000-0000-ba54-000000000001}",
                "icon": "%USERPROFILE%/scoop/apps/msys2/current/msys2.ico",
                "name": "zsh (MSYS2)",
                "startingDirectory": "%USERPROFILE%"
            },
        ]
    },
  • tip: ctrl + shift + m to enter marks-mode (tmux-like copy mode)

  • alt+o (keymap to open yazi) outputs string sequences on yazi v0.2.5 but not in <= v0.2.4 only in Msys2's zsh

slow h, j, k, l workaround or wait until vscode supports webgpu

  • 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

  • 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

  • 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: