Skip to content
Kartik edited this page Nov 25, 2021 · 2 revisions

dotfiles

Setup Instructions

  • To setup vim:
bash <(curl -s https://raw.githubusercontent.com/kartik1998/dotfiles/master/scripts/vim-setup.sh)
  • Install ripgrep to support live grep:
brew install ripgrep #mac
sudo apt-get install ripgrep #ubuntu
  • To setup neovim:
git clone git@github.com:kartik1998/dotfiles.git`
cd dotfiles
# install neovim >= 0.5.1 first
bash neovim_setup.sh
  • Tmux conf:
curl -o ~/.tmux.conf https://raw.githubusercontent.com/kartik1998/dotfiles/master/tmux/tmux.conf

VIM config

The vim config is different for vim and neovim. (Mostly similar)
Neovim is targeted for main support.

Key bindings

Although reading through init.vim might be enough, some are listed for completeness. The mappings are fully customizable. Many familiar mapping patterns are setup as defaults.

Leader is <spacebar>

Mappings Action
<Leader-e> NerdTreeToggle
<C-q> To quit buffer / quit vim if number of buffers = 1
<C-ww> Move between windows
<C-w[Arrow/hjkl]> Move between windows directionally
<C-t> toggle terminal (doesn't work for vim)
<Leader-v> open in vertical split
<Leader-h> open in horizontal split
<Leader-b> List all buffers via telescope
<Leader-l> Prettify file
<Leader-[> previous buffer :bprev
<Leader-]> next buffer :bnext
<C-p> fuzzy search filenames
<C-f> fuzzy search words in current directory
<C-n> Select same word as multiple cursors
<Leader-m> maximize window
<Leader>gst git status
gd go to definition
gc comment visual selection
gcc comment a line
<C-u> page up
<C-d> pade down

Debugger

dotfiles

vimspector is used for debugging applications. docs.
You'll need a .vimspector.json file in your project to run the debugger.
Sample .vimspector.json:

{
  "configurations": {
    "run": {
      "adapter": "vscode-node",
      "configuration": {
        "request": "launch",
        "protocol": "auto",
        "stopOnEntry": true,
        "console": "integratedTerminal",
        "program": "${workspaceRoot}/index.js",
        "cwd": "${workspaceRoot}"
      },
      "breakpoints": {
        "exception": {
          "all": "Y",
          "uncaught": "Y"
        }
      }
    }
  }
}
Mappings Action
<Leader-ds> debugger start
<Leader-de> debugger end
<Leader-dc> debugger continue
<Leader-dr> debugger restart
<Leader-dt> toggle break point
<Leader-dT> clear break points
<Leader-dk> Step out
<Leader-dl> Step into
<Leader-dj> Step over
<Leader-drc> Run to cursor
  • .vimspector.json to attach to a node server:
  • run node --inspect <filename>.js and start the debugger with <Leader-ds>
{
  "configurations": {
    "run": {
      "adapter": "vscode-node",
      "default": true,
      "breakpoints": {
        "exception": {
          "all": "N",
          "uncaught": "N"
        }
      },
      "configuration": {
        "name": "Attaching to a process ID",
        "type": "node",
        "request": "attach",
        "skipFiles": ["node_modules/**/*.js", "<node_internals>/**/*.js"],
        "processId": "${processId}"
      }
    }
  }
}
Clone this wiki locally