Tag: vim

  • Faster Vim window navigation

    Vim does two things when you open a file: Like Tmux, Vim allows us to split windows and navigate between them. By splitting a window, you are technically duplicating the current buffer. Here are the commands to split windows vertically and horizontally, respectively: The commands for switching between windows are: I like to remap the…

  • Quick automation in Vim with macros

    A macro lets you record a sequence of commands to a registry. The macro can be replayed with the following command (once by default). You can view the macro using the reg command. Finally, these commands will edit the macro in a new buffer. Example Consider the following file. Suppose we want to move each…

  • Neovim vs Vim

    I started in Vim, but after a while, I replaced Vim with Neovim. I find that Neovim has more sensible defaults, “looks” better, and has good Language Server Protocol (LSP) integration and syntax highlighting plugins. I also prefer the Lua configuration setup in Neovim compared to Vim and Vimscript, even though I don’t do a…

  • Basic Vim movements

    These are pretty much the keys I use to move around in Vim (or Neovim). Key Explanation h Move the cursor left. j Move the cursor down. k Move the cursor up. l Move the cursor right. gg Go to the first line of the document. G Go to the last line of the document…

  • Helpful Vim commands

    Vim has a lot of built-in commands that are very helpful. The following table lists commands I tend to use often. However, this is not even the tip of the command iceberg Vim offers. Command Explanation :%s/foo/bar/g Replace all instances of “foo” with “bar”. :g/foobar/d Delete all lines containing “foobar”. d$ Delete the current line…