Useful snippets

    IDE vim shortcut override settings

    2024-01-21

    Setup

    Install IdeaVim plugin

    Setup ctrl Q for toggling Vim on/off

    Keymaps

    Settings

    Turn Vim on

    reserve certain shortcuts to IDE

    like:

    • ctrl Q so we can toggle Vim efficiently
    • ctrl C to enable copying to OS registry
    • ctrl V to enable pasting from OS registry

    settings

     

     

    Zed

    {
      "context": "Editor && !menu",
      "bindings": {
        "ctrl-f": "buffer_search::Deploy",      // vim default: page down
        "ctrl-c": "editor::Copy",               // vim default: return to normal mode
        "ctrl-x": "editor::Cut",                // vim default: decrement
        "ctrl-v": "editor::Paste",              // vim default: visual block mode
        "ctrl-a": "editor::SelectAll",          // vim default: increment
        "ctrl-y": "editor::Undo",               // vim default: line up
        "ctrl-t": "project_symbols::Toggle",    // vim default: go to older tag
        "ctrl-o": "workspace::Open",            // vim default: go back
        "ctrl-s": "workspace::Save",            // vim default: show signature
        "ctrl-b": "workspace::ToggleLeftDock"   // vim default: down
      }
    },

    https://zed.dev/docs/vim#restoring-common-text-editing-and-zed-keybindings

     

    Jump to main component vim

    2025-12-15

    Vim/Neovim

    yank filename without extension to 'f'-registry

    :let @f = expand('%:t:r')<CR>
    

    search for "const [contents in 'f'-registry]"

    :execute '/const ' . @f<CR>:nohlsearch<CR>
    

    added together

    :let @f = expand('%:t:r')<CR>:execute '/const ' . @f<CR>:nohlsearch<CR>
    

    Ideavim

    Copy file name to + register and search for it. Do not execute immediately () as CopyFileName also includes the file extension

    :action CopyFileName<CR>/const <c-r>+
    

    ideavim plugins

    2026-08-17

    pre-installed:

    set surround "som i nvim surround, cs to change surrounding delimeters; visual mode + S' og ysiw( funker også
    set highlightedyank
    set matchit "html go to closing tag stuff
    set nerdtree
    set commentary
    set ideajoin
    

    må installere plugin for dette: (plugins -> marketplace)

    set anyobject