Skip to content

About

Personal Neovim config, built from kickstart.nvim

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

customNvim

A small personal Neovim config (0.12+), built from kickstart.nvim. It uses the built-in vim.pack plugin manager. Leader = <Space>.

~/.config/nvim is a symlink to this folder. Open it with nvim . or v (fish function).

Layout

init.lua                 entry point: requires everything below, in order
lua/config/options.lua   editor settings
lua/config/keymaps.lua   keymaps that need no plugin (splits, ...)
lua/config/autocmds.lua  small automatic behaviours
lua/config/pack.lua      vim.pack helpers + plugin build hooks
lua/config/theme.lua     theme persistence + transparency
lua/config/health.lua    :checkhealth config
lua/plugins/*.lua        one file per feature (installs + configures its plugins)
tests/smoke.lua          automated checks (see "Tests")
nvim-pack-lock.json      exact plugin versions (generated by vim.pack)

Cheat sheet (all 35 custom keys)

Every key below is also listed in which-key (press <Space> and wait). Keys without <leader> (like <C-h>, ]c, grd) are shown in their group (window, git, code, find) and can be run from there too.

Key Mode Action File
<Esc> n Clear search highlight config/keymaps.lua
<C-h> <C-j> <C-k> <C-l> n Move to split left / below / above / right config/keymaps.lua
<C-Left> <C-Right> n Split narrower / wider config/keymaps.lua
<C-Up> <C-Down> n Split taller / shorter config/keymaps.lua
<leader>wv n Vertical split (opens right) config/keymaps.lua
<leader>ws n Horizontal split (opens below) config/keymaps.lua
<leader>wq n Close this split config/keymaps.lua
<leader>wo n Close all other splits ("only") config/keymaps.lua
<leader>e n Explorer: open at current file / jump back into it / close (when in it) plugins/explorer.lua
<leader>ff n Find files plugins/telescope.lua
<leader>fg n Find text in files (live grep) plugins/telescope.lua
<leader>fb n Find open buffers plugins/telescope.lua
<leader>fr n Find recent files plugins/telescope.lua
<leader>fh n Find help plugins/telescope.lua
<leader>fn n New file (asks for a path, creates missing folders) config/keymaps.lua
<leader>? n Search all keymaps plugins/telescope.lua
<leader>cf n, x Format buffer / selection plugins/format.lua
<leader>dd n Diagnostics list plugins/telescope.lua
grd n Go to definition (when an LSP is attached) plugins/lsp.lua
]c / [c n Next / previous git change (in git files) plugins/git.lua
<leader>gp n Git: preview change plugins/git.lua
<leader>gb n Git: blame line plugins/git.lua
<leader>gr n Git: reset change plugins/git.lua
<leader>tt n Pick theme (live preview, remembered) plugins/telescope.lua
<leader>tb n Toggle transparent background (remembered) plugins/themes.lua
<C-y> i Accept menu item, else Copilot suggestion plugins/completion.lua
<C-Right> i Accept next word of Copilot suggestion (else normal <C-Right>) plugins/copilot.lua
<Down> / <Up> i Next / previous Copilot suggestion (menu first if open, else move cursor) plugins/completion.lua

Built-in keys worth knowing (not remapped)

Key Action
K Hover docs
grn / gra Rename / code action
grr / gri / grt References / implementation / type definition
gO Symbols in this file
[d / ]d Previous / next diagnostic (opens its message)
<C-w>d Diagnostic under the cursor in a popup
<C-s> (insert) Signature help
gc{motion} / gcc Toggle comment (also gc in visual mode)
<C-o> / <C-i> Jump back / forward (e.g. after grd)

In the explorer: <CR> open, a new file or folder (end the name with / for a folder; new files open right away), d delete, r rename, c copy, m move, H show hidden files, / filter, ? all keys. <C-l> / <C-h> move between the explorer and your file.

New files, other ways: :e path/new.go and then :w, or in an unnamed buffer :w path/new.go. A plain :w fails there because the buffer has no name yet.

In completion: <C-n>/<C-p> move, <C-y> accept, <C-e> close, <C-space> open menu / docs.

Copilot suggestions (grey ghost text): appear while you type in insert mode. <C-y> accepts all of it, <C-Right> the next word, <Down>/<Up> show the next / previous suggestion. First time: run :CopilotSignIn (works from any window) and finish the sign-in in the browser (the free Copilot plan works). :CopilotSignOut signs out. .env, *.pem, *.key and SSH key files are never sent to Copilot, and telemetry is off. Settings are in lua/plugins/copilot.lua.

In Telescope: type to filter, <CR> open, <C-v>/<C-x> open in a vertical / horizontal split, <Esc> close.

Extending it

Add a plugin

  1. Create lua/plugins/<feature>.lua:
    local pack = require 'config.pack'
    pack.add { pack.gh 'owner/repo' }   -- installed on next start
    require('repo-module').setup {}
  2. Add require 'plugins.<feature>' to init.lua.
  3. Restart Neovim (:restart).

To remove a plugin: delete its file and its require line, restart, then run :lua vim.pack.del({ 'repo' }). To update plugins: :lua vim.pack.update(), review the list, then :write to apply.

Add a language server

In lua/plugins/lsp.lua:

  1. Add the server to SERVERS using its lspconfig name, with {} for the defaults, e.g. rust_analyzer = {}. The names are listed in :help lspconfig-all.
  2. Add its Mason package to MASON_PACKAGES, e.g. 'rust-analyzer'. The names are shown in :Mason.
  3. Optional: add a formatter in plugins/format.lua (formatters_by_ft), a linter in plugins/lint.lua (LINTERS_BY_FT), and the treesitter parser in plugins/treesitter.lua (PARSERS). A missing parser is also installed automatically when you open the file.
  4. Restart, then check :checkhealth vim.lsp.

Add a keybinding

vim.keymap.set('n', '<leader>fs', function() require('telescope.builtin').grep_string() end,
  { desc = 'Find word under cursor' })
  • Plugin keys go in that plugin's file. Plain editor keys go in config/keymaps.lua.
  • Always give a desc: it's what which-key and <leader>? show.
  • For a new group, add { '<leader>x', group = 'name' } to spec in plugins/which-key.lua.
  • Check that a key is free first: :verbose nmap <leader>fs.

Tests

cd ~/Work/customNvim
nvim --headless -c 'luafile tests/smoke.lua'   # exit code = number of failures
nvim -c checkhealth

About

Personal Neovim config, built from kickstart.nvim

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages