Skip to content

ruicsh/nvim-config

Repository files navigation

Neovim IDE configuration

My configuration for Neovim, mostly for frontend development (TypeScript, CSS, python, rust).

  • Editor - enhanced vim motions, extended text objects, folding
  • Code - formatter, comments, code completion, AI powered suggestions
  • AI Assistant - suggestions, chat, system prompts, operations, chat history
  • LSP - Language Server Protocol client, symbols navigation, diagnostics
  • Syntax - highlighting, syntax aware motions, text objects
  • Git integration - status, diff, conflicts, commit message editor, buffer integration
  • Search - fuzzy find anything, files, git changed, last buffers
  • UI - files and directory explorer, notifications, command palette

Works on Neovim v0.11.5

Screenshots

screenshot

Theme

Plugins

68 plugins

Code

Editor

Windows

Git

Navigation

LSP/Syntax/Tools

Config

Config

Complex configuration options.

foldtext Text displayed for a closed fold
formatoptions Format options
standard-plugins Disable unused standard plugins
statusline Content of the status line

Filetypes

Custom configuration, keymaps, and features dependent on the file's type.

dockerfile Dockerfile
python Python

Autocmds

New features built around autocmds (events).

auto-close-buffer-if-deleted Auto close buffer when deleted from disk
auto-resize-splits Auto resize splits when window is resized
cmdline Clean up after use, hide hit-enter messages on blur
open-help-panel Open Help in side panel
show-cursorline-only-active Show cursorline only on active window.

Custom

Random features added.

duplicate-comment Duplicate and comment
indent-ast-nodes AST aware indentation
lsp-keymaps Keymaps (LSP)
lsp-highlight-references Highlight references (LSP)
lsp-jump-to-references Jump to references (LSP)
vim-messages Display :messages on a separate window

Keymaps

Files explorer

  • <leader>f open directory explorer
  • <leader>F open current working directory
  • <c-p> preview file
  • <c-w>s open in horizontal split
  • <c-w>t open in new tab
  • <c-w>v open in vertical split
  • <leader>. last picker
  • <leader><leader> fuzzy find files

Buffers

  • <bs> switch to last
  • q close
  • <leader>, list

Bookmarks

  • \{a,s,d,f,g} jump to
  • \\{a,s,d,f,g} save to
  • <leader>\ list

Alternate buffer

  • == switch to
  • =<space> switch to source
  • =m switch to template
  • =s switch to style
  • =t switch to test

Navigation

  • { jump up 6 lines
  • } jump down 6 lines
  • '' jump to position before last jump
  • '. jump to position where last change was made
  • s jump with labels
  • '{a-z}' jump to marked position
  • mm jump to matching pair
  • [[ jump to earlier position (]] later)

Windows

  • | switch
  • q close
  • <c-q> quit
  • <c-w>t move file to new tab
  • <c-w>m move window
  • <c-w>x swap windows

Search

  • <leader>/ search in workspace
  • <leader>? search in directory
  • <leader>g/ search current word in workspace
  • g/ search current word / selection
  • G/ search current word (no jumps)
  • [/ search first occurrence
  • gr/ replace current word / selection
  • gb/ web search current word
  • g./ repeat last search
  • <c-w>/ search first occurence in new window
  • <c-r>/ repeat last search
  • 's jump back to where search started

Editing

  • [<space> add blank line above cursor (]<space> below)
  • [p paste to new line above (]p below)
  • ycc duplicate a line, comment out the first line.
  • <a-up> move selection up
  • <a-down> move selection down
  • <tab> toggle fold
  • <s-tab> toggle all folds

Insert/Command mode

  • <c-b> jump character backward

  • <c-f> jump character forward

  • <a-b> jump word backward

  • <a-f> jump word forward

  • <c-a> jump to line start

  • <c-e> jump to line end

  • <c-h> delete character backward

  • <c-d> delete character forward

  • <a-bs> delete word backward

  • <a-d> delete word forward

  • <c-k> delete line backward

  • <c-u> delete line forward

  • <a-d><a-d> delete whole line

  • <a-up> move current line up

  • <a-down> move current line down

Text objects

  • a function argument
  • b brackets ({}, (), [])
  • c comment
  • % entire file
  • f function
  • h git hunk
  • m matching pair
  • q quotes (", ', `)
  • s single word in different cases
  • t HTML tags

Change text cases

  • <leader>~- to kebab-case
  • <leader>~_ to snake_case
  • <leader>~C to CONSTANT_CASE
  • <leader>~U to UPPER CASE
  • <leader>~c to camelCase
  • <leader>~p to PascalCase
  • <leader>~u to lower case

Yank current filepath

  • %% path (relative)
  • %D directory (absolute)
  • %d directory (relative)
  • %f filename
  • %n basename
  • %p path (absolute)

Operators

  • sa{motion}{char} add surrounding character
  • sd{char} delete surrounding character
  • sr{target}{replacement} replace surrounding character
  • S{char} add surrounding character (visual mode)
  • <leader>x{motion1}<leader>x{motion2} exchange
  • <leader>r{motion} replace
  • <leader>s{motion} sort

MultiCursor

  • <s-down> add cursor below (<s-up> for above)
  • <leader><s-down> skip cursor below (<leader><s-up> for above)
  • <c-s-down> add cursor to next match (<c-s-up> for previous)
  • <leader><c-s-down> skip cursor next match (<leader><c-s-up> for previous)
  • <leader>x delete cursor
  • <esc> clear cursors

Completion

  • <c-n> show/next entry
  • <c-p> previous entry
  • <cr> confirm
  • <c-e> hide
  • <c-f> scroll docs forward
  • <c-b> scroll docs backward

Snippets

  • <tab> expand
  • <tab> jump to next tabstop
  • <s-tab> jump to previous tabstop
  • <c-c> cancel

AI chat

  • <leader>aa open
  • <leader>am models
  • <c-]> accept
  • <c-x> reset

AI suggestions

  • <c-]> accept
  • <c-}> accept next edit
  • <a-e> dismiss
  • <a-]> accept word
  • <a-[> accept line
  • <a-n> show next
  • <a-p> show previous

AI chat

  • <leader>ac commit message (ft:gitcommit)
  • <leader>ae explain
  • <leader>af fix
  • <leader>ai implement
  • <leader>ao optimize
  • <leader>ap pull request review
  • <leader>aq architect
  • <leader>ar review
  • <leader>at tests
  • <leader>aw refactor

AI agent

  • <a-a>a new session
  • <a-a>\ toggle
  • <a-a>A ask about buffer
  • <a-a>a ask about selection
  • <a-a>p select prompt
  • <a-a>c copy message
  • <c-U> scroll up
  • <c-D> scroll down

Logging

  • glv insert variable log below
  • glV insert variable log above
  • glp insert plain log below
  • glP insert plain log above
  • glb insert batch log below
  • gla add to batch log
  • glk insert breakpoint below
  • glK insert breakpoint above
  • glt insert timestamp below
  • glT insert timestamp below
  • <leader>glt insert timestamp above/below

Syntax (AST)

  • <c-h> jump to parent node
  • <c-j> jump to next sibling node
  • <c-k> jump to previous sibling node
  • <c-l> jump to child node
  • <c-H> swap with left node
  • <c-J> swap with down node
  • <c-K> swap with up node
  • <c-L> swap with right node
  • ]a jump to next parameter start ([a previous)
  • ]f jump to next function start ([f previous)

LSP

  • K display hover information for symbol
  • gO list symbols in document
  • gd jump to definition
  • go jump to type definition
  • gra code actions
  • grt jump to type definition
  • gri jump to implementation
  • grn rename symbol
  • grr list references
  • grI toggle inlay hints
  • gD jump to declaration
  • <c-]> jump to definition
  • <c-w>] jump to definition (vsplit)
  • <leader>dd open diagnostics (buffer)
  • <leader>dD open diagnostics (workspace)
  • [r jump to previous symbol reference (]r next)
  • [x jump to previous error (]x next)

Git

  • [c previous change (]c next)
  • <leader>h$ blame line
  • <leader>h% current file history
  • <leader>h~ diff {git-rev}
  • <leader>hP push --force-with-lease
  • <leader>hR reset buffer
  • <leader>hS stage buffer
  • <leader>hb branches
  • <leader>hd diff HEAD
  • <leader>he log file
  • <leader>hh status
  • <leader>hl log
  • <leader>hp push
  • <leader>hr reset hunk
  • <leader>hs stage hunk
  • <leader>hu push --set-upstream origin HEAD
  • <leader>hx open file in browser

Git merge conflicts

  • [x previous conflict (]x next)
  • c0 choose none
  • cb choose both
  • co choose ours
  • ct choose theirs

Test runner

  • <leader>ba run all
  • <leader>bb run last
  • <leader>be run file
  • <leader>bn run nearest
  • <leader>bq close output

Application

  • <leader>na autocmds
  • <leader>nh help
  • <leader>nH highlights
  • <leader>nk keymaps
  • <leader>nn vim-messages

© 2024 Rui Costa, MIT License

About

There are many like it, but this one is mine.

Resources

License

Stars

Watchers

Forks