Skip to content

TheKangChen/nvim0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neovim Zero [WIP]

A zero-plugin Neovim configuration derived from my main setup to git good at native Vim/Neovim features without relying on plugins. Despite its simplicity, this config is still completely usable for day-to-day editing ;)

Note

There are no plans to add plugins, only auto commands or custom commands where they make sense.


Dependencies

  • Language Servers (LSP):

    These must be installed via your system package manager (e.g. pacman on Arch, brew on macOS, etc.).

    • The LSPs I personally use are defined in the lsp directory.

    • To add another server:

      1. Create a file under lsp/ named <lsp_name>.lua.
      2. Add the lsp configurations to the file.
      3. In lua/config/lsp.lua, add your server to the Enable LSPs section:
      vim.lsp.enable({
          ...,
          "<lsp_name>",
      })

Tip

  • Glow: for Markdown previewing.

    Install it separately using your system’s package manager.


Installation

Option 1: Replace your existing config

If you want to fully switch to this setup, clone it into your Neovim configuration directory:

git clone https://github.com/TheKangChen/nvim0.git ~/.config/nvim

Important

If you already have an existing Neovim config, back it up first:

mv ~/.config/nvim ~/.config/nvim_backup

Then, launch Neovim:

nvim

Option 2: Run alongside your existing config

You can load this config under a different directory using Neovim’s NVIM_APPNAME environment variable.

git clone https://github.com/TheKangChen/nvim0.git ~/.config/nvim-zero

Then start Neovim with:

NVIM_APPNAME=nvim-zero nvim

Tip

You can create an alias in your bashrc or zshrc file to avoid typing all of this every time.

Neovim will treat ~/.config/nvim-zero as its config directory, keeping your main ~/.config/nvim untouched.

Update

To update configuration to latest version run this command inside the config directory (~/.config/nvim or ~/.config/nvim-zero):

git pull

Usage & Help

For general Vim help, use:

  • :help to open documentation
  • :Tutor for a 30-minute interactive Vim tutorial

Options

See lua/config/options.lua for all configuration options, or run :opt.

LSP Features

For the full range of features provided by Neovim’s built-in LSP, such as go-to definition, hover documentation, references, and more, use the :map command to see all available key bindings.

Completion

Completions rely entirely on Neovim’s built-in LSP client. They should appear automatically as you type. If not, try:

  • <Ctrl-X><Ctrl-O> for omni-completion
  • <Ctrl-N> to cycle through completions if available

Tip

See :help i_CTRL-X for more about completion sub-modes.

Code Actions

Use the gra keymap (in normal mode) to view and trigger available LSP code actions.

Spell Checking

Use z= (in normal mode) to view spelling suggestions for the word under the cursor.

Key Bindings

Here's a list of custom key mappings. To view all active mappings, use :map.

Key Map Description Key Map Description
<Space>qq
Write & quit all buffer
<Space>o
Open file in explorer
<Space>-
Window horizontal split
<Space>_
Open alt file in split
<Space>\
Window vertical split
<Space>|
Open alt file in vertical split
<Space>bn
Next buffer
<Space>bp
Previous buffer
<Space>bb
Switch to alternate file
<Space>mm
Open Explorer (Netrw)
<Space>ff
Find file
<Space>rc
Edit config file
<Space>tr
Switch to regular theme
<Space>
Switch to alternative theme
<Space>z
Toggle center cursor
<Space>p
Preview markdown in vertical split
<Space>e
Preview diagnostic in float
<Space>dl
Show all diagnostics in location list
<Space>dx
Toggle diagnostics virtual text
<Space>sS
Save session (global)
<Space>ss
Save session (local)
<Space>sl
Load saved session
<Space>T
Toggle floating terminal
<ESC>
Close floating terminal
K
LSP hover documentation
gh
LSP Signature documentation
gD
Go to declaration
gd
Go to definition
gra
LSP code action
grn
Rename all references
grr
LSP references
gri
LSP implementation
grt
LSP type definition
<Space>cf
Format buffer
<Ctrl-x><Ctrl-o>
Omni completion
<Space>v
Go to definition in vertical split
<Space>wa
Add workspace folder
<Space>wr
Remove workspace folder
<Space>wl
List workspace folders
<Ctrl-q>
Toggle quickfix window
<Space>a
Add current file to quickfix
<Space>1...9
Go to file #n on quickfix
<Ctrl-k>
Focus window top
<Ctrl-j>
Focus window below
<Ctrl-h>
Focus window left
<Ctrl-l>
Focus window right
<Alt-d>
Delete without yanking
<Alt-c>
Change without yanking
<Alt-j>
Move line down
<Alt-k>
Move line up
<Alt-h>
Unindent line
<Alt-l>
Indent line

Note

To change key bindings, go to lua/config/keymaps.lua and to change LSP related key bindings, go to lua/config/lsp.lua.


Plans

The base configuration is intentionally minimal, but I may add or refine keymaps, autocmds, default options, etc. as I continue to use this setup.

Road Map

  • Remove the floating terminal (keymap <leader>T). I mainly use tmux, so it’s not particularly useful. Keeping it for now just in case.
  • Add custom statusline
  • Auto commands highlighting tasks (e.g. TODO, BUG, FIX, INFO, etc.)

Inspiration

About

Zero plug neovim config

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages