Files
NixOS-Hyprland/assets/Intro-to-Neovim.md
Don Williams f927acbe7b Fixed filenames for cheatsheets
On branch ddubs-dev
 Your branch is up to date with 'origin/ddubs-dev'.

 Changes to be committed:
	modified:   README.md
	renamed:    assets/Intro-to-Neovim-on-ddubsos.es.md -> assets/Intro-to-Neovim.es.md
	renamed:    assets/Intro-to-Neovim-on-ddubsos.md -> assets/Intro-to-Neovim.md
2025-11-01 17:53:39 -04:00

6.0 KiB
Raw Permalink Blame History

Intro to Neovim

Welcome! This cheatsheet introduces Neovim as configured with nixvim

It focuses on beginner tasks and the key plugins and keymaps in this setup.

Highlights of this configuration

  • Modern UI: Catppuccin theme, Lualine statusline, bufferline, icons
  • File explorer: Neotree
  • Search: Telescope (find files, ripgrep live search)
  • LSP: Language Server Protocol (syntax, diagnostics, formatting on save)
  • Diagnostics UI: Trouble list; whichkey helper; notify popups
  • Terminal: ToggleTerm (inline terminal); LazyGit integration
  • Markdown: Live preview
  • Motions: hop and leap for fast jumping
  • Commenting, autocompletion, snippets, autopairs

What is the Leader key?

  • The “leader” is a prefix for custom shortcuts. In this config, its typically Space. Try pressing Space and you should see a whichkey popup listing available groups.
  • Notation: ff means press Space, then f, then f.

First steps

  • Start Neovim: from a terminal, run:
    nvim
    
  • Get help: press h to open a :help prompt, or H to open help for the word under cursor.
  • Escape Insert mode: press jk quickly (mapped to ).

Basic navigation and modes

  • Modes: Normal (default), Insert (i), Visual (v), Command (:)
  • Move: h left, j down, k up, l right
  • Words: w next word, b back word, e end of word
  • Lines: 0 start, ^ first nonblank, $ end
  • Screens: Ctrlf forward page, Ctrlb back page
  • Search: /pattern, n next, N previous; clear highlights with nh

Open, create, read files

  • Open a file:
    :e path/to/file
    
  • Create a new file (just edit a new name):
    :e newfile.txt
    
  • Read a file into current buffer at cursor:
    :r path/to/otherfile
    
  • Read command output into buffer:
    :r !ls -la
    

Save and quit

  • Save: :w
  • Quit: :q
  • Save and quit: :wq (or :x)
  • Quit without saving: :q!
  • Save all: :wa
  • Close buffer (keep window): :bd

Windows and buffers

  • Split window: :sp (horizontal), :vsp (vertical)
  • Move between windows: Ctrlw h/j/k/l
  • Next/previous buffer: :bnext / :bprevious
  • List buffers: :ls

Clipboard, copy/paste

  • This config enables system clipboard (unnamedplus) and Wayland/X11 providers, so yanks go to your system clipboard.
  • Copy text: y in normal/visual (yy for a whole line)
  • Paste: p (after cursor) or P (before cursor)
  • System clipboard explicitly: "+y to copy, "+p to paste

File explorer (Neotree)

  • Toggle Neotree: e or fe
  • In Neotree (common defaults):
    • Enter: open
    • a: add file/directory
    • r: rename
    • d: delete
    • y: copy, p: paste (within Neotree)
    • s / v: open in split / vsplit (varies by setup)

Search (Telescope)

  • Find files by name: ff
  • Live grep (ripgrep content search): lg
  • Common Telescope controls: Up/Down to navigate, Enter to open, Ctrlq to send to quickfix list, Esc to close

Terminal and LazyGit

  • Toggle inline terminal: t
  • In the terminal buffer: press Ctrl\ then Ctrln to return to Normal mode if needed
  • LazyGit integration is enabled; run:
    :LazyGit
    

Diagnostics and LSP

  • Diagnostic list (Trouble): dt (toggle)
  • Next/previous diagnostic: dj / dk
  • Show diagnostic for current line: dl
  • Formatting on save is enabled where supported. You can also run:
    :lua vim.lsp.buf.format()
    
  • LSP info / servers:
    :LspInfo
    

Comments, completion, pairs, snippets

  • Comments (commentnvim defaults):
    • gcc to toggle comment on current line
    • gc in visual mode to toggle selection
  • Autocompletion (nvimcmp): starts automatically; use Enter/Tab per your insertmode behavior
  • Autopairs: brackets/quotes autoclose
  • Snippets (luasnip): many language snippets are available; expand with Tab/Enter (depends on context)

Markdown preview

  • Toggle Markdown live preview: mp

Motion helpers

  • hop and leap are enabled for fast jumping; try searching for a character or pattern (consult :help hop and :help leap for details). Great for quickly moving around large files.

Spellcheck

  • English spellcheck is enabled with a programming wordlist that autoupdates on first run.
  • Useful commands:
    • Toggle spell: :set spell / :set nospell
    • Next/prev misspelling: ]s / [s
    • Suggestions for word under cursor: z=
    • Add word to dictionary: zg
    • Undo added word: zw

Git integration

  • Signs in the gutter (gitsigns) show added/changed lines.
  • Diffview is available for rich diffs:
    :DiffviewOpen
    :DiffviewClose
    

Notifications and help

  • Notifications appear via nvimnotify.
  • F1 is disabled to prevent accidental help popups; use:
    • h to open :help prompt
    • H for help on word under cursor

Whichkey and cheatsheet

  • Press the leader (Space) to see a whichkey popup of available keys.
  • A cheatsheet plugin is enabled—explore keymaps interactively.

Troubleshooting

  • Check health:
    :checkhealth
    
  • See messages/notifications:
    :messages
    
  • If completion/diagnostics feel off, reload LSP:
    :LspRestart
    

Quick reference

  • Modes: i (insert), v (visual), Esc (back to normal), : (command)
  • Save/quit: :w / :q / :wq / :q!
  • Open/create: :e file
  • Read file into current: :r file
  • Search: /pattern then n/N; clear highlights nh
  • File explorer: e (Neotree)
  • Find files: ff; Live grep: lg
  • Terminal: t; LazyGit: :LazyGit
  • Diagnostics: dt (list), dj / dk (nav), dl (line)
  • Help: h, H

Tip: Start with whichkey. Press Space and follow the onscreen hints to discover available actions in this setup.