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, feel free to skip this step.
- Select the
neovim
version
neovim version | Command |
---|---|
v0.9.x | NVIM_VERSION=v0.9.5 |
v0.10.x | NVIM_VERSION=v0.10.3 |
For other versions, please refer to neovim’s releases page.
- Install
neovim
from pre-compiled binary
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
$PATH
variable
Bash
-
echo 'PATH=/usr/local/nvim-linux64/bin:$PATH' >> $HOME/.bashrc source $HOME/.bashrc
-
Zsh
-
echo 'PATH=/usr/local/nvim-linux64/bin:$PATH' >> $HOME/.zshrc source $HOME/.zshrc
-
- Check the
neovim
version
nvim --version
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 outlines the key mappings used in the Neovim configuration. Each mapping is listed along with its function for better clarity and usability.
🔥 Vim Basic Keymaps
Mode | Key Combination | Action | Description |
---|---|---|---|
Normal | <leader>c | :q<CR> | Closes the current Neovim window |
Normal | <leader>w | :w<CR> | Saves the current file |
Normal | <Esc><Esc> | :noh<CR> | Clears search highlighting |
Normal | <space>[ | :bprev<CR> | Moves to the previous buffer |
Normal | <space>] | :bnext<CR> | Moves to the next buffer |
Normal | <leader>q | :bd<CR> | Closes the current buffer |
Insert | <C-l> | <Esc> | Exits Insert mode |
Visual | <C-l> | <Esc> | Exits Visual mode |
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.