Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
247 commits
Select commit Hold shift + click to select a range
cb8c920
update which-key conf and some mappings
jdhao Jul 24, 2024
ca74300
update to neovim version 0.10.1
jdhao Jul 25, 2024
e815de2
update plugin for markdown preview
jdhao Jul 26, 2024
719fbfc
update lua_ls settings
jdhao Jul 30, 2024
6e137fe
make firenvim work again
jdhao Jul 30, 2024
9efadac
update lazy.nvim config
jdhao Jul 31, 2024
bbb8545
update lualine config
jdhao Aug 1, 2024
beec97c
Fix firenvim and LeaderF build issues
jdhao Aug 2, 2024
784b435
update LeaderF settings
jdhao Aug 2, 2024
bf49e90
change value for option 'splitkeep'
jdhao Aug 4, 2024
7f4772f
update setting for colorscheme gruvbox-material
jdhao Aug 4, 2024
69643e1
use plugin nvim-ufo for better folding
jdhao Aug 4, 2024
933b887
update config for nvim-ufo
jdhao Aug 4, 2024
e165276
fix error when there is no cursor word
jdhao Aug 4, 2024
fe95658
Add colorscheme arctic.nvim
jdhao Aug 4, 2024
5502d29
update config related to folding
jdhao Aug 5, 2024
44e9e5a
Fix lua_ls diagnostic warnings
jdhao Aug 5, 2024
acc3ed7
show error message only when no word is under cursor
jdhao Aug 5, 2024
b728b39
update type hint for functions
jdhao Aug 5, 2024
794b098
Add git blame mapping
jdhao Aug 5, 2024
b3a26e4
update load condtion for nvim-tree
jdhao Aug 5, 2024
b30cc9e
update user dictionary
jdhao Aug 5, 2024
262ad6a
Add new colorscheme kanagawa
jdhao Aug 5, 2024
e6f95ce
Update installation doc
jdhao Aug 5, 2024
4c697d8
change name of lualine config
jdhao Aug 6, 2024
8af8ebd
remove statusline.lua
jdhao Aug 6, 2024
fd6df98
Update nvim-ufo settings
jdhao Aug 6, 2024
f1062a3
filter fold level sign for statuscol.nvim
jdhao Aug 6, 2024
cfc0089
add plugin lazydev.nvim
jdhao Aug 6, 2024
85232b8
Update mapping of plugin open-browser.vim
jdhao Aug 9, 2024
9ff7693
update git related mappings
jdhao Aug 9, 2024
a602d98
fix git mapping issue
jdhao Aug 9, 2024
659f410
move version check into function
jdhao Aug 15, 2024
d90273d
remove lua_ls conf in favor of lazydev.nvim
jdhao Aug 15, 2024
6e60475
Use gx.nvim for browsing in Browser
jdhao Aug 15, 2024
eff98d0
update README
jdhao Aug 17, 2024
256c37a
update vim-fugitive mapping
jdhao Aug 17, 2024
f9780c2
update config for bufferline.nvim
jdhao Aug 17, 2024
c3d8dc3
Add mapping to delete other buffers
jdhao Aug 17, 2024
95d3b2f
remove setting for JSON file
jdhao Aug 19, 2024
3904cd4
Update config for handling large files
jdhao Aug 19, 2024
d150f39
Add new plugins
jdhao Aug 19, 2024
a3c8b3d
Update configuration for nvim-cmp
jdhao Aug 19, 2024
21522bd
update config for yanky
jdhao Aug 25, 2024
e3930e8
remove unused plugins
jdhao Aug 25, 2024
12b0ff0
Move autocmd in viml to Lua
jdhao Aug 27, 2024
4b4ff5f
Add error handling for resuming the cursor
jdhao Aug 29, 2024
fa79647
Fix type for option relativenumber
jdhao Aug 29, 2024
9071e04
Make * and # search case aware
jdhao Aug 29, 2024
a9fc298
update documentation for resuming cursor position
jdhao Aug 29, 2024
51f8109
restructure init.lua
jdhao Aug 31, 2024
db380ca
remove inspect() from lua _G table
jdhao Sep 1, 2024
81f64ed
Use absolute path for viml config
jdhao Sep 2, 2024
154cde3
Add plugin live-command.nvim
jdhao Sep 19, 2024
b9cf3cc
update conf for plugin live-command.nvim
jdhao Sep 20, 2024
3040fa7
use a cmp-fork for now
jdhao Oct 9, 2024
d715ce8
update supported nvim version to 0.10.2
jdhao Oct 9, 2024
5426c88
update Leaderf setting
jdhao Nov 5, 2024
4171f19
Add plugin nvim-lightbulb to hint code actions
jdhao Nov 5, 2024
590bd6c
use stylua to format lua files
jdhao Nov 5, 2024
94cade0
enable inlayhint for lua_ls server
jdhao Nov 5, 2024
97f7293
Enable LSP format also for visual selection
jdhao Nov 5, 2024
9769c24
Switch Python LSP for completion and add ruff
jdhao Nov 5, 2024
fe3d5e5
remove plugin committia.vim
jdhao Nov 5, 2024
1141a18
update config for pyright
jdhao Nov 6, 2024
8dfae27
use plaintext for pyright hover request
jdhao Nov 7, 2024
d86f599
update the fold level allowed for statuscol.nvim
jdhao Nov 8, 2024
8880268
custom command update
jdhao Nov 26, 2024
7645751
Update readme
jdhao Nov 26, 2024
ab75189
Fix command CopyPath issue
jdhao Nov 29, 2024
d941be4
update lualine config
jdhao Dec 8, 2024
64b41fb
use native lua api instead of vim.cmd
jdhao Dec 19, 2024
54eb3ca
install new plugins
jdhao Dec 19, 2024
917ab82
update dict
jdhao Dec 19, 2024
5328c47
reformat with stylua
jdhao Dec 19, 2024
1d66475
make option showcmd shown in statusline instead
jdhao Dec 19, 2024
7e70651
silently format lua file using stylua
jdhao Dec 19, 2024
f95d4c0
disable mouse
jdhao Dec 20, 2024
a02f317
update supported nvim version to v0.10.3
jdhao Dec 22, 2024
c7fb090
update README
jdhao Dec 22, 2024
9a6584b
add plugin colorzier
jdhao Jan 28, 2025
70e9943
update supported nvim version to latest stable
jdhao Feb 12, 2025
94497c0
snack config update
jdhao Feb 12, 2025
7f53743
remove automcd to go to last place
jdhao Feb 14, 2025
ee4bce4
enable mouse in normal mode
jdhao Feb 15, 2025
28bda34
Update lualine config (#375)
jdhao Feb 15, 2025
ac42171
Lualine async git info (#376)
jdhao Feb 16, 2025
2242961
Remove obsolete func (#377)
jdhao Feb 16, 2025
4b8c490
fix gitsign word_diff flickering issue (#378)
jdhao Feb 16, 2025
93166c6
update colorscheme config (#379)
jdhao Feb 16, 2025
ab059bb
use treesitter-textobjects instead (#380)
jdhao Feb 16, 2025
2383eb7
switch back to nvim-cmp (#381)
jdhao Feb 16, 2025
a00e1fd
Remove luarocks (#383)
jdhao Mar 5, 2025
8cba1ba
Install treesitter on all systems (#384)
Okarin99 Mar 21, 2025
f005a83
Nvim version bump (#385)
jdhao Mar 26, 2025
5f662f1
update various config after nvim 0.11 release (#386)
jdhao Mar 28, 2025
a8a1b92
update floating window highlight (#387)
jdhao Mar 28, 2025
12147be
Use glance.nvim for lsp references/implementations preview (#388)
jdhao Mar 30, 2025
0816fae
Separate diagnostic config from lsp ones (#389)
jdhao Mar 30, 2025
b82c1c1
update colorscheme (#390)
jdhao Mar 30, 2025
265f171
remove unused variable
jdhao Mar 30, 2025
625a4ff
update config for lazydev and nvim-lightbulb (#391)
jdhao Mar 30, 2025
72e6480
Use LspAttach to configure buffer behavior (#392)
jdhao Mar 30, 2025
bfc5316
Add option messagesopt config
jdhao Mar 30, 2025
d17289c
use builtin log level enum to specify log level (#393)
jdhao Mar 30, 2025
f76ef3d
fix diagnostic issues
jdhao Mar 30, 2025
7fa77fb
fix typo (#394)
zhuangya Mar 31, 2025
60852c0
Switch from LeaderF to Fzf-lua as the default fuzzy finder (#395)
jdhao Apr 2, 2025
c4160b6
update handling of large files (#396)
jdhao Apr 2, 2025
9e6be1f
update type hints
jdhao Apr 2, 2025
ad4a0e8
Simplify condition check (#397)
jdhao Apr 2, 2025
ea2b4a7
remove plugin vim-markdown (#398)
jdhao Apr 4, 2025
5826161
move fzf-lua config to separate file
jdhao Apr 4, 2025
aadfdae
switch from nvim-web-devicons to mini.icons (#399)
jdhao Apr 8, 2025
adddbc0
remove indent-blankline and use mini.indentscope
jdhao Apr 8, 2025
e08b17f
optimize nvim startup time with lazy.nvim (#400)
jdhao Apr 8, 2025
510a550
update config for git-conflict.nvim (#401)
jdhao Apr 11, 2025
e23d4bb
use black to format python file
jdhao Apr 11, 2025
488ba52
use new api vim.lsp.config for lsp configuration (#402)
jdhao Apr 22, 2025
be862a8
Use new lsp configuration structure (#403)
jdhao Apr 26, 2025
6c620ec
update the enabled lsp server list
jdhao Apr 26, 2025
ba99106
change lualine refresh interval
jdhao Apr 26, 2025
8839201
upgrade nvim to 0.11.1 (#404)
jdhao Apr 26, 2025
ea23f91
set default conf for all LSP in one place (#405)
jdhao Apr 26, 2025
b69dcb3
fix neovim link for linux install script (#408)
aleeraser Apr 30, 2025
999a173
use nvim-cmp for cmd line completion
jdhao Apr 30, 2025
3b964c3
remove format mapping for lsp
jdhao Apr 30, 2025
30b3c09
update readme
jdhao Apr 30, 2025
082111f
update LSP config (#410)
jdhao May 13, 2025
ec55700
bump supported nvim version to 0.11.2 (#412)
jdhao Jun 2, 2025
6c10223
change kanagawa theme variant
jdhao Jun 3, 2025
448f239
Add new bunch of colorschemes (#413)
jdhao Jun 3, 2025
88044b2
add new colorscheme citruszest (#414)
jdhao Jun 4, 2025
6e6a09e
Add support for markdown ref-style link (#415)
jdhao Jun 7, 2025
ae5e7c5
Add plugin neogit
jdhao Jun 7, 2025
52426e0
Remove config for neoformat
jdhao Jun 7, 2025
d721546
Fix filetype detection issue for nvim 0.11.2 (#416)
jdhao Jun 12, 2025
2931964
fix git conflict related error
jdhao Jun 12, 2025
b2aedf8
update config for plugin live-command (#417)
jdhao Jun 12, 2025
2293a0d
Move blink-cmp config to dedicated file (#418)
jdhao Jun 15, 2025
feb9b53
support deepwiki (#419)
jdhao Jun 21, 2025
a872921
bump supported nvim version
jdhao Jul 20, 2025
3dfb4d1
update plugin specs (#425)
jdhao Aug 5, 2025
63791b1
fix colorscheme name for makurai
jdhao Aug 5, 2025
c1990d9
[fzf-lua] fix recently opened files (#427)
rubenderaeve Aug 18, 2025
0ee09b0
Map the feature of q in normal mode to Q (#430)
jdhao Aug 24, 2025
9d7d356
update diffopt to include inline diff (#432)
jdhao Aug 25, 2025
d41c48a
feat: close float win more easily when not needed (#433)
jdhao Aug 28, 2025
2f5eb88
change mini.nvim organization (#434)
jdhao Aug 30, 2025
b243644
Bump supported nvim version to 0.11.4 (#435)
jdhao Sep 1, 2025
6e3621a
use colorscheme cmd as function (#438)
jdhao Sep 14, 2025
0fd25e2
Use new labubu icon for dashboard (#439)
jdhao Sep 14, 2025
360513d
update url for plugin render-markdown
jdhao Sep 24, 2025
3175b8f
feat: open jira ticket with gx :) (#444)
jdhao Oct 24, 2025
1bffe84
fzf-lua: do not ignore files
jdhao Oct 24, 2025
04d9079
feat: load env variable from .env (#445)
jdhao Oct 26, 2025
7a33e22
refactor: use vim.fs for path joining (#446)
jdhao Oct 26, 2025
3a439b2
feat: add mapping for JSON file format (#447)
jdhao Oct 26, 2025
72849d1
remove mappings for adding a blank line (#448)
jdhao Oct 26, 2025
b6050a9
update diagnostic config (#449)
jdhao Oct 26, 2025
be966db
fzf-lua config update: respect ignore files (#450)
jdhao Oct 29, 2025
c98531e
move vim plugin config to plugin_specs.lua (#451)
jdhao Nov 1, 2025
279b7ce
update README
jdhao Nov 1, 2025
28839c3
update README
jdhao Nov 1, 2025
6173ae9
support nvim 0.11.5 (#452)
jdhao Nov 2, 2025
6265982
Fix git branch status issue in statusline (#453)
jdhao Dec 19, 2025
bc74317
update stylua config (#454)
jdhao Dec 24, 2025
bc2c11e
check if file is formatted (#456)
jdhao Jan 24, 2026
3353922
ci: add github action to check lua code format (#457)
jdhao Jan 24, 2026
30c305c
Update format check ci (#458)
jdhao Jan 24, 2026
53c34c2
bump supported nvim version
jdhao Jan 28, 2026
95c13f5
Support visual mode for json format (#459)
jdhao Jan 30, 2026
94bb7b7
check if executable is available
jdhao Jan 31, 2026
dff6b5e
feat: switch to main branch of nvim-treesitter (#461)
jdhao Feb 1, 2026
b167ac1
remove copilot plugins (#462)
jdhao Feb 4, 2026
835d882
remove e-ink-colorscheme
jdhao Feb 6, 2026
eb3e61b
remove e-ink from colorscheme module
jdhao Feb 6, 2026
e25c8ce
use dashboard from snacks.nvim (#463)
jdhao Feb 6, 2026
8e4bf54
always check if the partial cmd is valid
jdhao Feb 6, 2026
310e922
update dict
jdhao Feb 8, 2026
148bee9
enable autoread by default
jdhao Feb 8, 2026
c077baa
migrate options.vim to lua module (#464)
jdhao Feb 8, 2026
d88eb43
update conf for blink-cmp (#465)
jdhao Feb 14, 2026
6cced23
fix function style
jdhao Feb 14, 2026
e8f9552
Add opencode.nvim
jdhao Feb 14, 2026
d6387f9
Add vim-illuminate to highlight cursor word (#466)
jdhao Feb 14, 2026
aa9ce61
update conf for vim-illuminate (#467)
jdhao Feb 14, 2026
6d589ef
Update conf for vim-illuminate
jdhao Feb 14, 2026
75bb903
refactor: move python env extraction to a function (#469)
jdhao Feb 28, 2026
9fcf680
migrate python filetype conf to lua (#470)
jdhao Feb 28, 2026
9c256e7
migrate filetype conf for lua to lua script
jdhao Mar 1, 2026
d0fc098
Remove plugin git-conflict.nvim (#471)
jdhao Mar 12, 2026
a14e86d
Remove plugin vim-snippets
jdhao Mar 12, 2026
72fbdef
update config for plugins (#472)
jdhao Mar 13, 2026
6894eca
update python filetype conf
jdhao Mar 13, 2026
081c79e
disable normal mode map for backslash
jdhao Mar 13, 2026
4b0a929
refactor: change lsp config location
jdhao Mar 14, 2026
94d1ec5
Add neovim runtime path to lua_ls library
jdhao Mar 14, 2026
d5718f1
Add treesitter support for diff
jdhao Mar 14, 2026
00793e7
fix treesitter config
jdhao Mar 14, 2026
111aadb
Remove .luarc.jsonc
jdhao Mar 14, 2026
2c2354d
Add completion support for lsp settings (#473)
jdhao Mar 15, 2026
45495c4
Add colorscheme oxocarbon (#474)
jdhao Mar 17, 2026
6b936df
Add mapping for conflict resolution (#475)
jdhao Mar 20, 2026
afe30a5
improve colorscheme loading (#476)
jdhao Mar 20, 2026
bc9fbcd
Add two diff-related plugins (#477)
jdhao Mar 21, 2026
09f947b
Add mapping to manage tabs (#478)
jdhao Mar 21, 2026
cfb0710
change default float win border style
jdhao Mar 26, 2026
e56acc8
Upgrade to nvim 0.12 (#479)
jdhao Apr 2, 2026
0ce16c6
use native lsp method to get lsp log path
jdhao Apr 3, 2026
7a85148
Use nvim native intro page (#480)
jdhao Apr 3, 2026
dbbedb3
redefine reload using command restart
jdhao Apr 3, 2026
e76f25b
update spell
jdhao Apr 3, 2026
e89e9f0
update lualine section separator
jdhao Apr 7, 2026
4ba3af1
bump supported nvim version
jdhao Apr 7, 2026
c028d1b
set up gopls and basic go formatting
jdhao Apr 7, 2026
db61060
enable gopls and golangci-lint
jdhao Apr 7, 2026
71f4f49
update treesitter config
jdhao Apr 7, 2026
84a991c
update nvim-tree conf
jdhao Apr 8, 2026
2797c1e
update tab settings for golang
jdhao Apr 9, 2026
5a8a85d
update fzf-lua conf
jdhao Apr 9, 2026
4b77f68
change lazy load for UltiSnips
jdhao Apr 11, 2026
bae3370
use ZR to restart nvim
jdhao Apr 11, 2026
a892a19
Add map to run single golang source
jdhao Apr 11, 2026
f182ee4
Add theme ember
jdhao Apr 12, 2026
e986b4b
Add snippets for golang
jdhao Apr 12, 2026
c56cc54
fix format
jdhao Apr 12, 2026
994d4d0
feat: auto-save file
jdhao Apr 14, 2026
f514017
Add config for nvim-lint
jdhao Apr 14, 2026
df541ad
Add conf for codebook
jdhao Apr 14, 2026
556b93b
fix plugin organization
jdhao Apr 14, 2026
cf547a0
update config for neovide
jdhao Apr 14, 2026
53e2428
update ui2 config
jdhao Apr 14, 2026
2b29beb
Show vertical help window
jdhao Apr 15, 2026
e300e96
Update readme
jdhao Apr 15, 2026
ce1e0fb
Move config for help file to help.lua
jdhao Apr 15, 2026
ac613ca
feat: q to quit man file
jdhao Apr 16, 2026
607afd3
fzf-lua: read rg config from env
jdhao Apr 16, 2026
3ec9f77
Addref: disable logging
jdhao Apr 17, 2026
8bcd7fb
Add colorscheme lake-dweller and alabaster
jdhao Apr 17, 2026
d5aa473
bump supported nvim version
jdhao Apr 23, 2026
253bc1b
Remove ltex
jdhao Apr 30, 2026
79c4f9f
Disable background color for floating win border
jdhao Apr 30, 2026
8f28ed5
Add theme thorn.nvim
jdhao Apr 30, 2026
1d00bfa
Configure inlayHints for gopls
jdhao May 3, 2026
652e95b
feat: use command to control LSP inlayHints
jdhao May 5, 2026
ad997f9
set up python provider
jdhao May 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Format Check
on:
pull_request:
paths:
- '**.lua'
push:
branches:
- main
paths:
- '**.lua'

jobs:
format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install StyLua
uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: false
- name: Run stylua
run: |
stylua --check .
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ en.utf-8.add.spl
.netrwhist
*.log
.DS_Store
lazy-lock.json
.env*
2 changes: 2 additions & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# config for stylua, ref: https://github.com/JohnnyMorganz/StyLua
syntax = "Lua51"
column_width = 100
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
Expand Down
71 changes: 31 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,15 @@
<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.9.5-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
<img src="https://img.shields.io/badge/Neovim-0.12.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.9.5">
<img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.9.5?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>
Expand All @@ -33,6 +27,9 @@
<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>
<a href="https://deepwiki.com/jdhao/nvim-config">
<img src="https://deepwiki.com/badge.svg" alt="deepwiki"/>
</a>
</p>
</div>

Expand Down Expand Up @@ -62,28 +59,26 @@ and how to set up on different platforms (Linux, macOS, and Windows).
+ Language server protocol (LSP) support via [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig).
+ Git integration via [vim-fugitive](https://github.com/tpope/vim-fugitive).
+ Better escaping from insert mode via [better-escape.vim](https://github.com/nvim-zh/better-escape.vim).
+ Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF).
+ Ultra-fast project-wide fuzzy searching via [fzf-lua](https://github.com/ibhagwan/fzf-lua).
+ Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary).
+ Faster matching pair insertion and jump via [nvim-autopairs](https://github.com/windwp/nvim-autopairs).
+ Smarter and faster matching pair management (add, replace or delete) via [vim-sandwich](https://github.com/machakann/vim-sandwich).
+ Fast buffer jump via [hop.nvim](https://github.com/phaazon/hop.nvim).
+ Fast buffer jump via [hop.nvim](https://github.com/smoka7/hop.nvim).
+ Powerful snippet insertion via [Ultisnips](https://github.com/SirVer/ultisnips).
+ Beautiful statusline via [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim).
+ File tree explorer via [nvim-tree.lua](https://github.com/nvim-tree/nvim-tree.lua).
+ Better quickfix list with [nvim-bqf](https://github.com/kevinhwang91/nvim-bqf).
+ Show search index and count with [nvim-hlslens](https://github.com/kevinhwang91/nvim-hlslens).
+ Command line auto-completion via [wilder.nvim](https://github.com/gelguy/wilder.nvim).
+ User-defined mapping hint via [which-key.nvim](https://github.com/folke/which-key.nvim).
+ Asynchronous code execution via [asyncrun.vim](https://github.com/skywind3000/asyncrun.vim).
+ Code highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
+ Code editing using true nvim inside browser via [firenvim](https://github.com/glacambre/firenvim).
+ Beautiful colorscheme via [sainnhe/gruvbox-material](https://github.com/sainnhe/gruvbox-material) and other colorschemes.
+ Markdown writing and previewing via [vim-markdown](https://github.com/preservim/vim-markdown) and [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).
+ Markdown previewing via [render-markdown.nvim](https://github.com/MeanderingProgrammer/render-markdown.nvim)
+ LaTeX editing and previewing via [vimtex](https://github.com/lervag/vimtex)
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
+ Undo management via [vim-mundo](https://github.com/simnalamburt/vim-mundo)
+ Code folding with [nvim-ufo](https://github.com/kevinhwang91/nvim-ufo) and [statuscol.nvim](https://github.com/luukvbaal/statuscol.nvim)
+ ......

# UI Demo
Expand All @@ -96,10 +91,10 @@ For more UI demos, check [here](https://github.com/jdhao/nvim-config/issues/15).
<img src="https://user-images.githubusercontent.com/16662357/183256752-fb23b215-a6b8-4646-beed-9999f52d53f1.png" width="800">
</p>

## File fuzzy finding using LeaderF
## File fuzzy finding using fzf-lua

<p align="center">
<img src="https://user-images.githubusercontent.com/16662357/183257017-2d9d7605-3c4b-4e1d-8955-30998f9b6f28.gif" width="800">
<img src="https://github.com/user-attachments/assets/3199e35d-121a-487b-bfd1-58eb69b0b48a" width="800">
</p>

## Code autocompletion with nvim-cmp
Expand All @@ -114,12 +109,6 @@ For more UI demos, check [here](https://github.com/jdhao/nvim-config/issues/15).
<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">
Expand All @@ -140,6 +129,12 @@ Go to a string starting with `se`
<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 `,`.
Expand All @@ -155,7 +150,6 @@ Some of the shortcuts I use frequently are listed here. In the following shortcu
| `<leader>v` | Normal | Linux/macOS/Win | Reselect last pasted text |
| `<leader>ev` | Normal | Linux/macOS/Win | Edit Nvim config in a new tabpage |
| `<leader>sv` | Normal | Linux/macOS/Win | Reload Nvim config |
| `<leader>st` | Normal | Linux/macOS/Win | Show highlight group for cursor text |
| `<leader>q` | Normal | Linux/macOS/Win | Quit current window |
| `<leader>Q` | Normal | Linux/macOS/Win | Quit all window and close Nvim |
| `<leader>w` | Normal | Linux/macOS/Win | Save current buffer content |
Expand All @@ -165,12 +159,14 @@ Some of the shortcuts I use frequently are listed here. In the following shortcu
| `<space>t` | Normal | Linux/macOS/Win | Toggle tag window (show project tags in the right window) |
| `<leader>gs` | Normal | Linux/macOS/Win | Show Git status result |
| `<leader>gw` | Normal | Linux/macOS/Win | Run Git add for current file |
| `<leader>gd` | Normal | Linux/macOS/Win | Run git diff for current file |
| `<leader>gc` | Normal | Linux/macOS/Win | Run git commit |
| `<leader>gpl` | Normal | Linux/macOS/Win | Run git pull |
| `<leader>gpu` | Normal | Linux/macOS/Win | Run git push |
| `<leader>gl` | Normal/Visual | Linux/macOS/Win | Get perm link for current/visually-select lines
| `<leader>gb` | Normal | macOS | Browse current git repo in browser
| `<leader>gbd` | Normal | Linux/macOS/Win | Delete a branch |
| `<leader>gbn` | Normal | Linux/macOS/Win | Create a new branch |
| `<leader>gl` | Normal/Visual | Linux/macOS/Win | Get perm link for current/visually-select lines |
| `<leader>gbr` | Normal | macOS | Browse current git repo in browser |
| `<leader>gb` | Visual | macOS | Blame current line |
| `<F9>` | Normal | Linux/macOS/Win | Compile&run current source file (for C++, LaTeX, Lua, Python) |
| `<F11>` | Normal | Linux/macOS/Win | Toggle spell checking |
| `<F12>` | Normal | Linux/macOS/Win | Toggle paste mode |
Expand All @@ -180,22 +176,23 @@ Some of the shortcuts I use frequently are listed here. In the following shortcu
| `{operator}iB` | Normal | Linux/macOS/Win | Operate in the whole buffer, `{operator}` can be `v`, `y`, `c`, `d` etc. |
| `Alt-k` | Normal | Linux/macOS/Win | Move current line or selected lines up |
| `Alt-j` | Normal | Linux/macOS/Win | Move current line or selected lines down |
| `Alt-m` | Normal | macOS/Win | Markdown previewing in system browser |
| `Alt-Shift-m` | Normal | macOS/Win | Stopping Markdown previewing in system browser |
| `ob` | Normal/Visual | macOS/Win | Open link under cursor or search visual selection |
| `ctrl-u` | Insert | Linux/macOS/Win | Turn word under cursor to upper case |
| `ctrl-t` | Insert | Linux/macOS/Win | Turn word under cursor to title case |
| `jk` | Insert | Linux/macOS/Win | Return to Normal mode without lagging |
| `ZR` | Normal | Linux/macOS/Win | Restart nvim without quitting |


# Custom commands

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

| command | description | example |
|------------|-------------------------------------------------------------------------|--------------------------------|
| `Redir` | capture command output to a tabpage for easier inspection. | `Redir hi` |
| `Edit` | edit multiple files at the same time, supports globing | `Edit *.vim` |
| `Datetime` | print current date and time or convert Unix time stamp to date and time | `Datetime 12345` or `Datetime` |
| command | description | example |
|--------------|-------------------------------------------------------------------------|--------------------------------|
| `Redir` | capture command output to a tabpage for easier inspection. | `Redir hi` |
| `Edit` | edit multiple files at the same time, supports globing | `Edit *.vim` |
| `Datetime` | print current date and time or convert Unix time stamp to date and time | `Datetime 12345` or `Datetime` |
| `JSONFormat` | format a JSON file | `JSONFormat` |
| `CopyPath` | copy current file path to clipboard | `CopyPath relative` |

# Contributing

Expand All @@ -209,10 +206,4 @@ If you still have an issue, [open a new issue](https://github.com/jdhao/nvim-con
# Further readings

Some of the resources that I find helpful in mastering Nvim is documented [here](docs/nvim_resources.md).
You may also be interested in my posts on configuring Nvim:

+ My nvim notes can be found [here](https://jdhao.github.io/categories/Nvim/)
+ [Using Neovim for Three years](https://jdhao.github.io/2021/12/31/using_nvim_after_three_years/)
+ [Config nvim on Linux for Python development](https://jdhao.github.io/2018/12/24/centos_nvim_install_use_guide_en/)
+ [Nvim config on Windows 10](https://jdhao.github.io/2018/11/15/neovim_configuration_windows/)
+ [Nvim-qt config on Windows 10](https://jdhao.github.io/2019/01/17/nvim_qt_settings_on_windows/)
You may also be interested in my posts on configuring Nvim [here](https://jdhao.github.io/categories/Nvim/).
20 changes: 20 additions & 0 deletions after/ftplugin/go.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local opt = vim.opt

-- General tab settings
opt.tabstop = 4 -- Number of visual spaces per TAB
opt.softtabstop = 4 -- Number of spaces in tab when editing
opt.shiftwidth = 4 -- Number of spaces to use for autoindent
opt.expandtab = false -- Expand tab to spaces so that tabs are spaces

-- gofumpt adds more rule to gofmt, and is compatible with gofmt,
-- so also https://github.com/mvdan/gofumpt
vim.keymap.set("n", "<Space>f", function()
vim.cmd([[silent !gofumpt -w %]])
end, { buffer = true, silent = true })

vim.keymap.set("n", "<F9>", function()
vim.cmd([[!go run %]])
end, {
buffer = true,
silent = true,
})
9 changes: 9 additions & 0 deletions after/ftplugin/help.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
local win_width = vim.api.nvim_win_get_width(0)

-- do not change layout if the screen is not wide enough
if win_width < 200 then
return
end

-- L means to put window to leftmost
vim.cmd.wincmd([[L]])
4 changes: 4 additions & 0 deletions after/ftplugin/json.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.keymap.set({ "n", "v" }, "<space>f", ":JSONFormat<cr>", {
buffer = true,
silent = true,
})
6 changes: 0 additions & 6 deletions after/ftplugin/json.vim

This file was deleted.

11 changes: 11 additions & 0 deletions after/ftplugin/lua.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Disable inserting comment leader after hitting o/O/<Enter>
vim.opt_local.formatoptions:remove { "o", "r" }

vim.keymap.set("n", "<F9>", "<cmd>luafile %<CR>", {
buffer = true,
silent = true,
})
vim.keymap.set("n", "<Space>f", "<cmd>silent !stylua %<CR>", {
buffer = true,
silent = true,
})
9 changes: 0 additions & 9 deletions after/ftplugin/lua.vim

This file was deleted.

4 changes: 4 additions & 0 deletions after/ftplugin/man.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- q to quit quickly
vim.keymap.set("n", "q", "<cmd>q<CR>", {
desc = "quit nvim",
})
107 changes: 107 additions & 0 deletions after/ftplugin/markdown.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
local function add_reference_at_end(label, url, title)
vim.schedule(function()
local bufnr = vim.api.nvim_get_current_buf()
local line_count = vim.api.nvim_buf_line_count(bufnr)

-- Prepare reference definition
local ref_def = "[" .. label .. "]: " .. url
if title and title ~= "" then
ref_def = ref_def .. ' "' .. title .. '"'
end

-- Check if references section exists
local buffer_lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)

local has_ref_section = false
for _, line in ipairs(buffer_lines) do
if line:match("^%s*<!%-%-.*[Rr]eferences.*%-%->[%s]*$") then
has_ref_section = true
break
end
end

local lines_to_add = {}
-- Add references header if it doesn't exist
if not has_ref_section then
if #lines_to_add == 0 then
table.insert(lines_to_add, "")
end
table.insert(lines_to_add, "<!-- References -->")
end

table.insert(lines_to_add, ref_def)

-- Insert at buffer end
vim.api.nvim_buf_set_lines(bufnr, line_count, line_count, false, lines_to_add)
end)
end

local function get_ref_link_labels()
local labels = {}
local seen = {} -- To avoid duplicates
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)

for _, line in ipairs(lines) do
-- Pattern explanation:
-- %[.-%] matches [link text] (non-greedy)
-- %[(.-)%] matches [label] and captures the label content
local start_pos = 1
while start_pos <= #line do
local match_start, match_end, label = string.find(line, "%[.-%]%[(.-)%]", start_pos)
if not match_start then
break
end

-- Only add unique labels
if label and label ~= "" and not seen[label] then
table.insert(labels, label)
seen[label] = true
end

start_pos = match_end + 1
end
end

return labels
end

local function count_consecutive_spaces(str)
-- Remove leading spaces first
local trimmed = str:match("^%s*(.*)")
local count = 0

-- Count each sequence of one or more consecutive spaces
for spaces in trimmed:gmatch("%s+") do
count = count + 1
end
return count
end

vim.api.nvim_buf_create_user_command(0, "AddRef", function(opts)
local args = vim.split(opts.args, " ", { trimempty = true })

if #args < 2 then
vim.print("Usage: :AddRef <label> <url>")
return
end

local label = args[1]
local url = args[2]

add_reference_at_end(label, url, "")
end, {
desc = "Add reference link at buffer end",
nargs = "+",
complete = function(arg_lead, cmdline, curpos)
-- vim.print(string.format("arg_lead: '%s', cmdline: '%s', curpos: %d", arg_lead, cmdline, curpos))

-- only complete the first argument
if count_consecutive_spaces(cmdline) > 1 then
-- we are now starting the second argument, so no completion anymore
return {}
end

local ref_link_labels = get_ref_link_labels()
return ref_link_labels
end,
})
Loading