A Developer In The mountains having fun

Some What Random Notes on VIM/NeoVIM

Remember that one the the strengths of VIM is that anything in it can be bound to a key command. Make your Vim experiance truely yours.

  • Need a quick terminal that is easy to copy/paste from inside of vim?

    use: :terminal — this will open a terminal bufffer :vsp | :terminal — will open a vertical split with the terminal.

  • Drowning in windows? try using ctl-w o to close all but the current window. All buffers will remain open but I find that I mostly only like one window open and this quickly resets to that during the times I use multiple windows.

  • normally write code in VIM but then start writing a long paragraph for some reason (maybe inside html) and hate the screen scrolling or not seeing everything? Quickly turn on line wrap with :set wrap you can turn if off with :set wrap false too.

  • protect a single buffer you already have open from accidental changes with the command setlocal readonly

Reformat the current buffer

  1. to set the current buffer through a system command you use :%!
  2. a somewhat common use for me is to format the current buffer in columns. The standard Linux command column is my goto for this.
:%!column -t

Comparing two or more files/buffers

from the command line

launch vim or neovim with the -d flag to enter diff mode

#> neovim -d file1.txt file2.txt

inside of NeoVIM

Other Sources

vimcasts vimdiff

More places to find me
follow me on Mastodon