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.
- Search for available
neovimversions
mise search neovim
mise ls-remote neovim
- Install and use the pinned
neovimversion globally
mise use neovim@0.11.4 -g
- Check the
neovimversion
nvim --version
The first line should report NVIM v0.11.4.
- 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
| Mode | Key | Action | Description |
|---|---|---|---|
| Normal | <leader>w | :w | Save the current file |
| Normal | <leader>c | :q | Close the current window |
| Normal | <leader>q | :bd | Delete the current buffer |
| Normal | <space>[ | :bprev | Go to the previous buffer |
| Normal | <space>] | :bnext | Go to the next buffer |
| Normal | <Esc><Esc> | :noh | Clear search highlighting |
| Insert | <C-l> | <Esc> | Leave Insert mode |
| Visual | <C-l> | <Esc> | Leave Visual mode |
Files and Project Search
| Mode | Key | Action | Description |
|---|---|---|---|
| Normal | <leader>ff | Telescope find_files | Find files in the project |
| Normal | <leader>fg | Telescope live_grep | Search text across the project |
| Normal | <leader>fb | Telescope buffers | Switch between open buffers |
| Normal | <C-t> | Neotree toggle | Toggle the file tree |
LSP and Code Navigation
| Mode | Key | Action | Description |
|---|---|---|---|
| Normal | gd | vim.lsp.buf.definition | Go to definition |
| Normal | gD | vim.lsp.buf.declaration | Go to declaration |
| Normal | gi | vim.lsp.buf.implementation | Go to implementation |
| Normal | gr | vim.lsp.buf.references | List references |
| Normal | K | Lspsaga hover_doc | Show hover documentation |
| Normal | <C-k> | vim.lsp.buf.signature_help | Show signature help |
| Normal | <space>rn | vim.lsp.buf.rename | Rename symbol |
| Normal, Visual | zi | vim.lsp.buf.code_action | Open code actions |
| Normal | <space>f | vim.lsp.buf.format | Format the current buffer |
| Visual | <space>qf | vim.lsp.buf.range_formatting | Format the selected range |
| Normal | zj | vim.diagnostic.goto_prev | Go to previous diagnostic |
| Normal | zk | vim.diagnostic.goto_next | Go to next diagnostic |
| Normal | zo | Lspsaga show_line_diagnostics | Show diagnostics for the current line |
Git
| Mode | Key | Action | Description |
|---|---|---|---|
| Normal | <leader>g | :G | Open Fugitive Git status |
| Normal | <space>gd | Gitsigns diffthis HEAD~1 | Diff current file against previous commit |
| Normal | <space>gj | Gitsigns next_hunk | Go to next Git hunk |
| Normal | <space>gk | Gitsigns prev_hunk | Go to previous Git hunk |
| Normal | <space>gs | Gitsigns stage_hunk | Stage current hunk |
| Normal | <space>gu | Gitsigns undo_stage_hunk | Undo staged hunk |
Debugging
| Mode | Key | Action | Description |
|---|---|---|---|
| Normal | <leader>db | dap.toggle_breakpoint() | Toggle breakpoint |
| Normal | <leader>dc | dap.continue() | Start or continue debugging |
| Normal | <leader>di | dap.step_into() | Step into |
| Normal | <leader>do | dap.step_over() | Step over |
| Normal | <Leader>dk | dap.step_out() | Step out |
| Normal | <leader>dt | dapui.toggle() | Toggle DAP UI |
| Normal | <leader>dq | dap.terminate() | Stop debugging |
P1 Keymaps
Navigation and Layout
| Mode | Key | Action | Description |
|---|---|---|---|
| Normal | <space>aa | harpoon.mark.add_file() | Add current file to Harpoon |
| Normal | <space>at | harpoon.ui.toggle_quick_menu() | Open Harpoon quick menu |
| Normal | <space>aw | harpoon.ui.nav_next() | Go to next Harpoon file |
| Normal | <space>as | harpoon.ui.nav_prev() | Go to previous Harpoon file |
| Normal | <leader>h | vsplit | Split window to the left |
| Normal | <leader>j | split then move down | Split window below |
| Normal | <leader>k | split | Split window above/current |
| Normal | <leader>l | vsplit then move right | Split window to the right |
| Normal | <space><Tab> | Outline | Toggle symbols outline |
Tests
| Mode | Key | Action | Description |
|---|---|---|---|
| Normal | <leader>tn | neotest.run.run() | Run nearest test |
| Normal | <leader>tt | neotest.run.run(current file) | Run the current test file |
| Normal | <leader>td | neotest.run.run({ strategy = "dap" }) | Debug nearest test |
| Normal | <leader>ts | neotest.run.stop() | Stop nearest test run |
| Normal | <leader>to | neotest.output.open({ enter = true }) | Open test output |
| Normal | <leader>tp | neotest.output_panel.toggle() | Toggle test output panel |
| Normal | <leader>tv | neotest.summary.toggle() | Toggle test summary |
AI Assistance
| Mode | Key | Action | Description |
|---|---|---|---|
| Insert | <C-J> | copilot#Accept() | Accept Copilot suggestion |
| Normal | <leader>ag | CodeCompanionChat | Open CodeCompanion chat |
| Normal | <leader>ah | CodeCompanionActions | Open CodeCompanion actions |
| Normal | <leader>i | ChatGPT | Open ChatGPT |
Supporting Tools
| Mode | Key | Action | Description |
|---|---|---|---|
| Normal | U | UndotreeToggle | Toggle undo history |
| Normal, Visual | ga | EasyAlign | Align text |
| Normal | <leader>xz | vim.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:
delvegolangci-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.