Keyboard shortcuts

Press โ† or โ†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

Welcome to the my-nvim-config Documentation! ๐ŸŽ‰

my-nvim-config is a Neovim configuration designed to supercharge your productivity in no time. This documentation will help you get familiar with this custom setup and seamlessly integrate it into your workflow!

Installation

The installation has two parts:


Setting Up neovim

If you already have neovim installed on your machine, make sure it matches the version expected by this config.

The recommended way to install and switch neovim versions is mise. Avoid downloading release artifacts manually unless you have a specific reason to do so; mise is faster to use day to day and keeps version management predictable.

The current my-nvim-config setup pins NVIM_VERSION to 0.11.4. We are working on upgrading the config to support nvim 0.12.0 or newer.

  1. Search for available neovim versions
mise search neovim
mise ls-remote neovim
  1. Install and use the pinned neovim version globally
mise use neovim@0.11.4 -g
  1. Check the neovim version
nvim --version

The first line should report NVIM v0.11.4.

  1. Optional: install from GitHub releases manually

Manual artifact installation is slower and harder to maintain. Use it only when mise is not available in your environment.

NVIM_VERSION=v0.11.4
wget https://github.com/neovim/neovim/releases/download/"${NVIM_VERSION}"/nvim-linux64.tar.gz
rm -rf /usr/local/nvim-linux64 && tar -C /usr/local -zxvf nvim-linux64.tar.gz # as root

Setting Up the Config

mkdir -p $HOME/.config/nvim \
&& git clone https://github.com/kevinliao852/my-nvim-config.git $HOME/.config/nvim/

After setting up the config, type nvim on the terminal and wait a few seconds to have plugins installed.

Keymaps Documentation

This page lists the non-negotiable keymaps from keymaps.lua: P0 covers daily survival commands, and P1 covers important workflow accelerators. Minor toggles, legacy duplicates, and low-frequency helpers are intentionally omitted.

P0 Keymaps

Editing and Buffers

ModeKeyActionDescription
Normal<leader>w:wSave the current file
Normal<leader>c:qClose the current window
Normal<leader>q:bdDelete the current buffer
Normal<space>[:bprevGo to the previous buffer
Normal<space>]:bnextGo to the next buffer
Normal<Esc><Esc>:nohClear search highlighting
Insert<C-l><Esc>Leave Insert mode
Visual<C-l><Esc>Leave Visual mode
ModeKeyActionDescription
Normal<leader>ffTelescope find_filesFind files in the project
Normal<leader>fgTelescope live_grepSearch text across the project
Normal<leader>fbTelescope buffersSwitch between open buffers
Normal<C-t>Neotree toggleToggle the file tree

LSP and Code Navigation

ModeKeyActionDescription
Normalgdvim.lsp.buf.definitionGo to definition
NormalgDvim.lsp.buf.declarationGo to declaration
Normalgivim.lsp.buf.implementationGo to implementation
Normalgrvim.lsp.buf.referencesList references
NormalKLspsaga hover_docShow hover documentation
Normal<C-k>vim.lsp.buf.signature_helpShow signature help
Normal<space>rnvim.lsp.buf.renameRename symbol
Normal, Visualzivim.lsp.buf.code_actionOpen code actions
Normal<space>fvim.lsp.buf.formatFormat the current buffer
Visual<space>qfvim.lsp.buf.range_formattingFormat the selected range
Normalzjvim.diagnostic.goto_prevGo to previous diagnostic
Normalzkvim.diagnostic.goto_nextGo to next diagnostic
NormalzoLspsaga show_line_diagnosticsShow diagnostics for the current line

Git

ModeKeyActionDescription
Normal<leader>g:GOpen Fugitive Git status
Normal<space>gdGitsigns diffthis HEAD~1Diff current file against previous commit
Normal<space>gjGitsigns next_hunkGo to next Git hunk
Normal<space>gkGitsigns prev_hunkGo to previous Git hunk
Normal<space>gsGitsigns stage_hunkStage current hunk
Normal<space>guGitsigns undo_stage_hunkUndo staged hunk

Debugging

ModeKeyActionDescription
Normal<leader>dbdap.toggle_breakpoint()Toggle breakpoint
Normal<leader>dcdap.continue()Start or continue debugging
Normal<leader>didap.step_into()Step into
Normal<leader>dodap.step_over()Step over
Normal<Leader>dkdap.step_out()Step out
Normal<leader>dtdapui.toggle()Toggle DAP UI
Normal<leader>dqdap.terminate()Stop debugging

P1 Keymaps

ModeKeyActionDescription
Normal<space>aaharpoon.mark.add_file()Add current file to Harpoon
Normal<space>atharpoon.ui.toggle_quick_menu()Open Harpoon quick menu
Normal<space>awharpoon.ui.nav_next()Go to next Harpoon file
Normal<space>asharpoon.ui.nav_prev()Go to previous Harpoon file
Normal<leader>hvsplitSplit window to the left
Normal<leader>jsplit then move downSplit window below
Normal<leader>ksplitSplit window above/current
Normal<leader>lvsplit then move rightSplit window to the right
Normal<space><Tab>OutlineToggle symbols outline

Tests

ModeKeyActionDescription
Normal<leader>tnneotest.run.run()Run nearest test
Normal<leader>ttneotest.run.run(current file)Run the current test file
Normal<leader>tdneotest.run.run({ strategy = "dap" })Debug nearest test
Normal<leader>tsneotest.run.stop()Stop nearest test run
Normal<leader>toneotest.output.open({ enter = true })Open test output
Normal<leader>tpneotest.output_panel.toggle()Toggle test output panel
Normal<leader>tvneotest.summary.toggle()Toggle test summary

AI Assistance

ModeKeyActionDescription
Insert<C-J>copilot#Accept()Accept Copilot suggestion
Normal<leader>agCodeCompanionChatOpen CodeCompanion chat
Normal<leader>ahCodeCompanionActionsOpen CodeCompanion actions
Normal<leader>iChatGPTOpen ChatGPT

Supporting Tools

ModeKeyActionDescription
NormalUUndotreeToggleToggle undo history
Normal, VisualgaEasyAlignAlign text
Normal<leader>xzvim.lsp.inlay_hint.enable(...)Toggle inlay hints

Building Docker Image

The aim of this note is to provide a ready-to-use Dockerfile in which the nvim config has already been set.

The primary benefit of using this Dockerfile is to quickly set up an development environment but not pollute your existing host machine. You can freely tweak its layout to suit your needs.

FROM ubuntu:24.04

SHELL ["/bin/bash", "-c"]

ARG USERNAME=appuser
ENV HOME=/home/$USERNAME

RUN groupadd -g 1001 $USERNAME && \
    useradd -u 1001 -g $USERNAME -m -s /bin/bash $USERNAME && \
    apt update && \
    DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends \
    curl gcc git make wget vim unzip zip python3-dev python3-venv -y && \
    apt clean && rm -rf /var/lib/apt/lists/*

USER $USERNAME

ENV NVIM_DIR="$HOME/.nvm"
ARG NVIM_VERSION=v0.10.3

WORKDIR $HOME

RUN mkdir -p $HOME/.local && \
    wget https://github.com/neovim/neovim/releases/download/"${NVIM_VERSION}"/nvim-linux64.tar.gz && \
    tar -C $HOME/.local -zxvf nvim-linux64.tar.gz && \
    rm -f nvim-linux64.tar.gz && \
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \
    source $HOME/.nvm/nvm.sh && \
    nvm install stable

ENV GOROOT="${HOME}/.g/go"
ENV PATH="$HOME/.local/nvim-linux64/bin:${HOME}/.g/bin:${GOROOT}/bin:${GOPATH}/bin:$PATH"
ENV G_MIRROR=https://golang.google.cn/dl/

RUN source $HOME/.bashrc && \
    curl -sSL https://raw.githubusercontent.com/voidint/g/master/install.sh | bash && \
    g install 1.24.2 && \
    mkdir -p $HOME/.config/nvim && \
    git clone https://github.com/mukappalambda/my-nvim-config.git $HOME/.config/nvim && \
    cd $HOME/.config/nvim && \
    git checkout develop && \
    cd $HOME && \
    echo "alias v=nvim" >> $HOME/.bashrc

WORKDIR $HOME/src

CMD ["/bin/bash"]

To build the image, run:

docker build -t my-nvim-config .

To create a container using this image, run:

docker run -it --rm my-nvim-config

Setup Go Development Environment

The followings are the recommended tools to set up:

  • delve
  • golangci-lint

delve

Installing delve:

go install github.com/go-delve/delve/cmd/dlv@latest

Navigate here to see more details.


golangci-lint

Two methods shown here to install golangci-lint:

  • Using the official script
  • Using mise

Installing golangci-lint using the official script:

Using the official script

Use pre-built binary (Recommended)

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0

Use go toolchain (arenโ€™t guaranteed to work)

go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0

Reference: golangci-lint documentation

Using mise

mise use golangci-lint -g

Setup Java Development Environment

We use jdtls as the language server for java.

To install jdtls, refer to Installation.

After installation, make sure to set the JDTLS_HOME environment variable on your machine, and the jdtls executable should be under $JDTLS_HOME/bin:

$ $JDTLS_HOME/bin/jdtls -h
usage: jdtls [-h] [--validate-java-version] [--no-validate-java-version] [--java-executable JAVA_EXECUTABLE] [--jvm-arg JVM_ARG] [-data DATA]

options:
  -h, --help            show this help message and exit
  --validate-java-version
  --no-validate-java-version
  --java-executable JAVA_EXECUTABLE
                        Path to java executable used to start runtime.
  --jvm-arg JVM_ARG     An additional JVM option (can be used multiple times. Note, use with equal sign. For example: --jvm-arg=-Dlog.level=ALL
  -data DATA

Open up a Java project managed by gradle or maven, you should see the Java Language Server is up and running.

In normal mode, you can also type :LspInfo to see the language server details.