My Neovim configuration
  • Lua 87.6%
  • TeX 11.9%
  • Shell 0.5%
Find a file
2023-11-24 17:42:42 +01:00
lua/weeheavy add mor remaps like identation fix, epic block moving, scrolling optimization etc. 2023-11-24 17:42:42 +01:00
init.lua documentation 2023-11-21 13:29:49 +01:00
lazy-lock.json beauty salon 2023-11-21 17:57:14 +01:00
README.md document more about buffer handling 2023-11-24 17:36:56 +01:00

My Neovim configuration

Motivation

After doing my first steps with https://github.com/nvim-lua/kickstart.nvim, I decided to roll my own, custom, "lightweight" Neovim configuration in order to better understand Neovim and its configuration/customization, package managers, plugins etc. and have "my own" config that only includes things I really need.

Installation

  1. Install Neovim 0.9.x
  2. Install OS dependencies documented in init.lua
  3. Clone this Git repository to ~/.config/nvim

Finishing touches

  • Install Treesitter comment parser (to highlight FIXME:/NOTE:/TODO:/XXX:) with :TSInstall comment
  • Create a $HOME/.ignore file and add big, useless directories to it, so Telescope/ripgrep/fd can ignore those. My current list of files/directories is available in lua/weeheavy/plugins/telescope-fzf-native.lua

Speed

Output from lazy.nvim profiling (:Lazy, then P):

Startuptime: 52.04ms

Based on the actual CPU time of the Neovim process till UIEnter.
This is more accurate than `nvim --startuptime`.
  LazyStart 10.78ms
  LazyDone  48.72ms (+37.94ms)
  UIEnter   52.04ms (+3.32ms)

Plugins

Name Purpose URL
lazy.nvim Package manager https://github.com/folke/lazy.nvim
telescope.nvim Find, Filter, Preview, Pick https://github.com/nvim-telescope/telescope.nvim
telescope-fzf-native.nvim Fuzzy finder for Telescope https://github.com/nvim-telescope/telescope-fzf-native.nvim
nvim-treesitter Parser/syntax highlighting https://github.com/nvim-treesitter/nvim-treesitter
nvim-treesitter-context Shows current line context https://github.com/nvim-treesitter/nvim-treesitter-context
nvim-treesitter-textobjects ? https://github.com/nvim-treesitter/nvim-treesitter-textobjects
vim-sleuth Heuristically set tab/shift mode https://github.com/tpope/vim-sleuth
lsp-zero.nvim Accessible Language Server Protocol (LSP) https://github.com/VonHeikemen/lsp-zero.nvim
nightfox.nvim Theme with treesitter/lsp support https://github.com/EdenEast/nightfox.nvim
lualine.nvim Status line https://github.com/nvim-lualine/lualine.nvim
nvim-web-devicons filetype glyphs (icons) for plugins https://github.com/nvim-tree/nvim-web-devicons
gitsigns.nvim Git change indicator https://github.com/lewis6991/gitsigns.nvim
which-key.nvim Shows contextual key bindings https://github.com/folke/which-key.nvim

Command cheat sheet

Vim/Neovim

Basics

  • Space is set as the leader key

Plugin things and debugging

  • :so Source file
  • :checkhealth <pluginname> check for problems of a plugin. Use :checkhealth to check base and all plugins
  • :Lazy to bring up package manager UI
  • :verbose set expandtab? check where expandtab has been set last

Navigation

Code navigation
  • w move to start of next word (ignores punctuation due to remap)
  • e move to end of next word (ignores punctuation due to remap)
  • b move to start of previous word (ignores punctuation due to remap)
Code editing
  • leader+i re-indent whole file
  • i insert mode at cursor position
  • I insert mode at the beginning of the line
  • a insert mode one character after the current one
  • A insert mode at the end of the line
  • o insert mode a line below the cursor
  • O insert mode a line above the cursor
Visual mode
  • v visual mode at cursor position
  • V visual mode line mode
  • Ctrl+v visual block mode
Tab navigation

(Don't use tabs by default, but use buffers instead).

  • Ctrl+t to open a file in e.g. a Telescope finder in a new tab
  • gt or gT to switch between open tabs
Window navigation
  • Ctrl+wq close window
  • Ctrl+ws split window horizontally
  • Ctrl+wv split window vertically
  • Ctrl+<h/j/k/l> switch between split windows
Buffer navigation
  • Space+Space shows open buffers (via Telescope buffers)
  • :bd close current buffer

Telescope

Navigation in live_grep, find_files, git_status and file_browser

  • or Ctrl+n scroll down (next) file list
  • or Ctrl+p scroll up (previous) file list
  • Ctrl+d scroll down in preview
  • Ctrl+u scroll up in preview
  • Ctrl+/ help

Treesitter

  • :TSUpdate update all parsers
  • :TSModuleInfo show installed parsers

Open issues/TODOs