Neovim

My notes on this editor, so I don’t forget
Linux

Put the .appimage in ~/.local/bin.

Recommended:

sudo apt-get install make gcc ripgrep unzip git xclip

To test a different setup, simply rename ~/.config/nvim and delete/rename all nvim folders in .local:

~/.local/share/nvim
~/.local/state/nvim

This is also created:

~/.cache/nvim

From Scratch

Installing the lazy package manager needs the following files:

~/.config/nvim
├── lua
│   ├── config
│   │   └── lazy.lua
└── init.lua

Create ~/.config/nvim/lua/config/lazy.lua and Put the code into lazy.lua and tell init.luaabout it:

require("config.lazy")

After restart, it pulls the git repo and neovim now uses the lazy package manager.

To install a package e.g. Telescope, create an arbitrary .lua file in config/plugins and return a table:

return {
    {
        "nvim-telescope/telescope.nvim",
        opts = {}
    },
}

In lazy.lua we already specified the pluginsfolder as the folder to look for plugin specs.

This is the folder structure now:

└── ~/
    └── .config/
        └── nvim/
              ├── lua
              │   ├── config
              │   │   └── lazy.lua
              │   └── plugins
              │       ├── importThis.lua
              └── init.lua

Kickstart

└── ~/
    └── .config/
        └── nvim/
            ├── lua/
            │   ├── custom/
            │   │   └── plugins/
            │   │       └── init.lua
            │   └── kickstart/
            │       ├── plugins/
            │       │   ├── spec1.lua
            │       │   ├── spec2.lua
            │       │   └── ...
            │       └── health.lua    
            └── init.lua

NvChad

Overview of keymaps with Telescope keymaps or NvCheatsheet

.
└── ~/
    └── .config/
        └── nvim/
            ├── lua/
            │   ├── configs/
            │   │   ├── config1.lua
            │   │   ├── config2.lua
            │   │   └── ...
            │   ├── plugins/
            │   │   └── init.lua
            │   ├── spec1.lua
            │   ├── spec2.lua
            │   └── ...    
            └── init.lua

Vertical split with :vsplit

LazyVim

To make outline.nvim work, need to disable trouble.

flash.nvim

Highlights matches and let’s you jump to each:

https://github.com/folke/flash.nvim

To install, just paste the return{...} statement into .config/nvim/init.lua (NVChad)

Multi-Line Editing

  • Ctrl-v for V-Block mode, select lines
  • Shift-I
  • type
  • ESC

Search And Replace

This works with selected lines:

:s/old/new

Copy to System Clipboard

Just install xclip

Disable auto-complete

temporarily disable for current buffer:

:lua require('cmp').setup.buffer { enabled = false }

or globally:

:lua require('cmp').setup { enabled = false }

Install ripgrep

For grep (<leader>/):

Fedora: sudo dnf install ripgrep

Back to top