Home

Awesome

<div align="center"> <p> <a> <img alt="Linux" src="https://img.shields.io/badge/Linux-%23.svg?style=flat-square&logo=linux&color=FCC624&logoColor=black" /> </a> <a> <img alt="macOS" src="https://img.shields.io/badge/macOS-%23.svg?style=flat-square&logo=apple&color=000000&logoColor=white" /> </a> <a> <img alt="Windows" src="https://img.shields.io/badge/Windows-%23.svg?style=flat-square&logo=windows&color=0078D6&logoColor=white" /> </a> <a href="https://github.com/jdhao/nvim-config/releases/latest"> <img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" /> </a> <a href="https://github.com/neovim/neovim/releases/tag/stable"> <img src="https://img.shields.io/badge/Neovim-0.10.2-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/> </a> <a href="https://github.com/jdhao/nvim-config/search?l=vim-script"> <img src="https://img.shields.io/github/languages/top/jdhao/nvim-config" alt="Top languages"/> </a> <a href="https://github.com/jdhao/nvim-config/graphs/commit-activity"> <img src="https://img.shields.io/github/commit-activity/m/jdhao/nvim-config?style=flat-square" /> </a> <a href="https://github.com/jdhao/nvim-config/releases/tag/v0.10.1"> <img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.10.1?style=flat-square" /> </a> <a href="https://github.com/jdhao/nvim-config/graphs/contributors"> <img src="https://img.shields.io/github/contributors/jdhao/nvim-config?style=flat-square" /> </a> <a> <img src="https://img.shields.io/github/repo-size/jdhao/nvim-config?style=flat-square" /> </a> <a href="https://github.com/jdhao/nvim-config/blob/master/LICENSE"> <img src="https://img.shields.io/github/license/jdhao/nvim-config?style=flat-square&logo=GNU&label=License" alt="License"/> </a> </p> </div>

Introduction

This repo hosts my Nvim configuration for Linux, macOS, and Windows. init.lua is the config entry point for terminal Nvim, and ginit.vim is the additional config file for GUI client of Nvim.

My configurations are heavily documented to make it as clear as possible. While you can clone the whole repository and use it, it is not recommended though. Good configurations are personal. Everyone should have his or her unique config file. You are encouraged to copy from this repo the part you want and add it to your own config.

To reduce the possibility of breakage, this config is only maintained for the latest nvim stable release. No effort is spent on maintaining backward compatibility.

Install and setup

See doc here on how to install Nvim's dependencies, Nvim itself, and how to set up on different platforms (Linux, macOS, and Windows).

Features

UI Demo

For more UI demos, check here.

Start screen with dashboard-nvim

<p align="center"> <img src="https://user-images.githubusercontent.com/16662357/183256752-fb23b215-a6b8-4646-beed-9999f52d53f1.png" width="800"> </p>

File fuzzy finding using LeaderF

<p align="center"> <img src="https://user-images.githubusercontent.com/16662357/183257017-2d9d7605-3c4b-4e1d-8955-30998f9b6f28.gif" width="800"> </p>

Code autocompletion with nvim-cmp

<p align="center"> <img src="https://user-images.githubusercontent.com/16662357/128590006-0fc1451f-fac1-49b2-bb95-8aba21bfa44e.gif" width="800"> </p>

Git add, commit and push via fugitive.vim

<p align="center"> <img src="https://user-images.githubusercontent.com/16662357/128590833-aaa05d53-19ef-441d-a5a9-ba1bbd3936c1.gif" width="800"> </p>

Command-line autocompletion with wilder.nvim

<p align="center"> <img src="https://user-images.githubusercontent.com/16662357/147677787-8e5d229a-a16a-420e-98f5-88f2a1be84a2.gif" width="800"> </p>

Tags

<p align="center"> <img src="https://user-images.githubusercontent.com/16662357/128589584-4036a1a2-2e0a-4bbe-8aaf-ff8b91644648.jpg" width="800"> </p>

Cursor jump via hop.nvim

Go to a string starting with se

<p align="center"> <img src="https://user-images.githubusercontent.com/16662357/139459219-8a7e6ac4-1d24-4008-a370-b56773d7cb85.gif" width="800"> </p>

GUI-style notification with nvim-notify

<p align="center"> <img src="https://user-images.githubusercontent.com/16662357/128589873-aadb8264-1098-4834-9876-fa66a309be05.gif" width="800"> </p>

code folding with nvim-ufo and statuscol.nvim

<p align="center"> <img src="https://github.com/user-attachments/assets/a01a56b2-7c91-43de-b305-f2fbaa81dcec" width="800"> </p>

Shortcuts

Some of the shortcuts I use frequently are listed here. In the following shortcuts, <leader> represents ASCII character ,.

ShortcutModeplatformDescription
<leader>ffNormalLinux/macOS/WinFuzzy file searching in a floating window
<leader>fhNormalLinux/macOS/WinFuzzy help file grepping in a floating window
<leader>fgNormalLinux/macOS/WinFuzzy project-wide grepping in a floating window
<leader>ftNormalLinux/macOS/WinFuzzy buffer tag searching in a floating window
<leader>fbNormalLinux/macOS/WinFuzzy buffer switching in a floating window
<leader><Space>NormalLinux/macOS/WinRemove trailing white spaces
<leader>vNormalLinux/macOS/WinReselect last pasted text
<leader>evNormalLinux/macOS/WinEdit Nvim config in a new tabpage
<leader>svNormalLinux/macOS/WinReload Nvim config
<leader>stNormalLinux/macOS/WinShow highlight group for cursor text
<leader>qNormalLinux/macOS/WinQuit current window
<leader>QNormalLinux/macOS/WinQuit all window and close Nvim
<leader>wNormalLinux/macOS/WinSave current buffer content
<leader>yNormalLinux/macOS/WinCopy the content of entire buffer to default register
<leader>clNormalLinux/macOS/WinToggle cursor column
<leader>cdNormalLinux/macOS/WinChange current working directory to to the dir of current buffer
<space>tNormalLinux/macOS/WinToggle tag window (show project tags in the right window)
<leader>gsNormalLinux/macOS/WinShow Git status result
<leader>gwNormalLinux/macOS/WinRun Git add for current file
<leader>gcNormalLinux/macOS/WinRun git commit
<leader>gplNormalLinux/macOS/WinRun git pull
<leader>gpuNormalLinux/macOS/WinRun git push
<leader>gbdNormalLinux/macOS/WinDelete a branch
<leader>gbnNormalLinux/macOS/WinCreate a new branch
<leader>glNormal/VisualLinux/macOS/WinGet perm link for current/visually-select lines
<leader>gbrNormalmacOSBrowse current git repo in browser
<leader>gbVisualmacOSBlame current line
<F9>NormalLinux/macOS/WinCompile&run current source file (for C++, LaTeX, Lua, Python)
<F11>NormalLinux/macOS/WinToggle spell checking
<F12>NormalLinux/macOS/WinToggle paste mode
\xNormalLinux/macOS/WinClose location or quickfix window
\dNormalLinux/macOS/WinClose current buffer and go to previous buffer
{count}gbNormalLinux/macOS/WinGo to buffer {count} or next buffer in the buffer list.
{operator}iBNormalLinux/macOS/WinOperate in the whole buffer, {operator} can be v, y, c, d etc.
Alt-kNormalLinux/macOS/WinMove current line or selected lines up
Alt-jNormalLinux/macOS/WinMove current line or selected lines down
Alt-mNormalmacOS/WinMarkdown previewing in system browser
Alt-Shift-mNormalmacOS/WinStopping Markdown previewing in system browser
obNormal/VisualmacOS/WinOpen link under cursor or search visual selection
ctrl-uInsertLinux/macOS/WinTurn word under cursor to upper case
ctrl-tInsertLinux/macOS/WinTurn word under cursor to title case
jkInsertLinux/macOS/WinReturn to Normal mode without lagging

Custom commands

In addition to commands provided by various plugins, I have also created some custom commands for personal use.

commanddescriptionexample
Redircapture command output to a tabpage for easier inspection.Redir hi
Editedit multiple files at the same time, supports globingEdit *.vim
Datetimeprint current date and time or convert Unix time stamp to date and timeDatetime 12345 or Datetime
JSONFormatformat a JSON fileJSONFormat

Contributing

If you find anything that needs improving, do not hesitate to point it out or create a PR.

If you come across an issue, you can first use :checkhealth command provided by nvim to trouble-shoot yourself. Please read carefully the messages provided by health check.

If you still have an issue, open a new issue.

Further readings

Some of the resources that I find helpful in mastering Nvim is documented here. You may also be interested in my posts on configuring Nvim: