mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6df27d1c22 | ||
|
|
7f6627cfa1 | ||
|
|
7ff11a9760 | ||
|
|
cc4688d089 | ||
|
|
8a1b3193a4 | ||
|
|
e92362041c | ||
|
|
63ff776758 | ||
|
|
41c8c81f21 | ||
|
|
997c6286df | ||
|
|
359621b126 | ||
|
|
4dc2d9575b | ||
|
|
fc1c447319 | ||
|
|
1391ca7ff1 | ||
|
|
6a6f8ff597 | ||
|
|
946e65662b |
@@ -13,7 +13,7 @@
|
|||||||
<img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" />
|
<img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/neovim/neovim/releases/tag/stable">
|
<a href="https://github.com/neovim/neovim/releases/tag/stable">
|
||||||
<img src="https://img.shields.io/badge/Neovim-0.9.1-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
<img src="https://img.shields.io/badge/Neovim-0.9.2-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/jdhao/nvim-config/search?l=vim-script">
|
<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"/>
|
<img src="https://img.shields.io/github/languages/top/jdhao/nvim-config" alt="Top languages"/>
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
<a href="https://github.com/jdhao/nvim-config/graphs/commit-activity">
|
<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" />
|
<img src="https://img.shields.io/github/commit-activity/m/jdhao/nvim-config?style=flat-square" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/jdhao/nvim-config/releases/tag/v0.9.1">
|
<a href="https://github.com/jdhao/nvim-config/releases/tag/v0.9.2">
|
||||||
<img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.9.1?style=flat-square" />
|
<img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.9.2?style=flat-square" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/jdhao/nvim-config/graphs/contributors">
|
<a href="https://github.com/jdhao/nvim-config/graphs/contributors">
|
||||||
<img src="https://img.shields.io/github/contributors/jdhao/nvim-config?style=flat-square" />
|
<img src="https://img.shields.io/github/contributors/jdhao/nvim-config?style=flat-square" />
|
||||||
@@ -57,7 +57,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
|||||||
|
|
||||||
# Features #
|
# Features #
|
||||||
|
|
||||||
+ Plugin management via [Packer.nvim](https://github.com/wbthomason/packer.nvim).
|
+ Plugin management via [Lazy.nvim](https://github.com/folke/lazy.nvim).
|
||||||
+ Code, snippet, word auto-completion via [nvim-cmp](https://github.com/hrsh7th/nvim-cmp).
|
+ Code, snippet, word auto-completion via [nvim-cmp](https://github.com/hrsh7th/nvim-cmp).
|
||||||
+ Language server protocol (LSP) support via [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig).
|
+ 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).
|
+ Git integration via [vim-fugitive](https://github.com/tpope/vim-fugitive).
|
||||||
|
|||||||
@@ -141,9 +141,7 @@ function! utils#Inside_git_repo() abort
|
|||||||
if match(res, 'true') == -1
|
if match(res, 'true') == -1
|
||||||
return v:false
|
return v:false
|
||||||
else
|
else
|
||||||
" Manually trigger a special user autocmd InGitRepo (to use it for
|
" Manually trigger a special user autocmd InGitRepo (used lazyloading.
|
||||||
" lazyloading of fugitive by packer.nvim).
|
|
||||||
" See also https://github.com/wbthomason/packer.nvim/discussions/534.
|
|
||||||
doautocmd User InGitRepo
|
doautocmd User InGitRepo
|
||||||
return v:true
|
return v:true
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ set scrolloff=3
|
|||||||
" Use mouse to select and resize windows, etc.
|
" Use mouse to select and resize windows, etc.
|
||||||
set mouse=nic " Enable mouse in several mode
|
set mouse=nic " Enable mouse in several mode
|
||||||
set mousemodel=popup " Set the behaviour of mouse
|
set mousemodel=popup " Set the behaviour of mouse
|
||||||
set mousescroll=ver:1,hor:6
|
set mousescroll=ver:1,hor:0
|
||||||
|
|
||||||
" Disable showing current mode on command line since statusline plugins can show it.
|
" Disable showing current mode on command line since statusline plugins can show it.
|
||||||
set noshowmode
|
set noshowmode
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ lua require('plugins')
|
|||||||
" To use these shortcuts: first activate command line with `:`, then input the
|
" To use these shortcuts: first activate command line with `:`, then input the
|
||||||
" short alias, e.g., `pi`, then press <space>, the alias will be expanded to
|
" short alias, e.g., `pi`, then press <space>, the alias will be expanded to
|
||||||
" the full command automatically.
|
" the full command automatically.
|
||||||
call utils#Cabbrev('pi', 'PackerInstall')
|
call utils#Cabbrev('pi', 'Lazy install')
|
||||||
call utils#Cabbrev('pud', 'PackerUpdate')
|
call utils#Cabbrev('pud', 'Lazy update')
|
||||||
call utils#Cabbrev('pc', 'PackerClean')
|
call utils#Cabbrev('pc', 'Lazy clean')
|
||||||
call utils#Cabbrev('ps', 'PackerSync')
|
call utils#Cabbrev('ps', 'Lazy sync')
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" configurations for vim script plugin "
|
" configurations for vim script plugin "
|
||||||
@@ -401,7 +401,7 @@ function! s:wilder_init() abort
|
|||||||
\ 'apply_incsearch_fix': 0,
|
\ 'apply_incsearch_fix': 0,
|
||||||
\ }))
|
\ }))
|
||||||
catch /^Vim\%((\a\+)\)\=:E117/
|
catch /^Vim\%((\a\+)\)\=:E117/
|
||||||
echohl Error |echomsg "Wilder.nvim missing: run :PackerSync to fix."|echohl None
|
echohl Error |echomsg "Wilder.nvim missing"| echohl None
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ vim-language-server is installed in the same directory as the node executable.
|
|||||||
|
|
||||||
### Git
|
### Git
|
||||||
|
|
||||||
Git is required by plugin manager [packer.nvim](https://github.com/wbthomason/packer.nvim) and other git-related plugins.
|
Git is required by plugin manager [lazy.nvim](https://github.com/folke/lazy.nvim) and other git-related plugins.
|
||||||
|
|
||||||
For Linux and macOS, Git is usually pre-installed.
|
For Linux and macOS, Git is usually pre-installed.
|
||||||
The version of Git on the Linux system may be too old so that plugins may break.
|
The version of Git on the Linux system may be too old so that plugins may break.
|
||||||
@@ -201,22 +201,6 @@ After installing Nvim, we need to set the path to nvim correctly.
|
|||||||
|
|
||||||
After installing nvim and all the dependencies, we will install plugin managers and set up this config.
|
After installing nvim and all the dependencies, we will install plugin managers and set up this config.
|
||||||
|
|
||||||
### Install plugin manager packer.nvim
|
|
||||||
|
|
||||||
I use packer.nvim to manage my plugins. We need to install packer.nvim on our system first.
|
|
||||||
|
|
||||||
For Windows, if curl is installed, run the following command (on PowerShell):
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone --depth=1 https://github.com/wbthomason/packer.nvim "$env:LOCALAPPDATA\nvim-data\site\pack\packer\opt\packer.nvim"
|
|
||||||
```
|
|
||||||
|
|
||||||
For macOS and Linux, run the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone --depth=1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/opt/packer.nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
### How to install this configuration
|
### How to install this configuration
|
||||||
|
|
||||||
On Linux and macOS, the directory is `~/.config/nvim`.
|
On Linux and macOS, the directory is `~/.config/nvim`.
|
||||||
@@ -228,7 +212,7 @@ then go to this directory, and run the following command:
|
|||||||
git clone --depth=1 https://github.com/jdhao/nvim-config.git .
|
git clone --depth=1 https://github.com/jdhao/nvim-config.git .
|
||||||
```
|
```
|
||||||
|
|
||||||
After that, when we first open nvim, run command `:PackerSync` to install all the plugins.
|
After that, when we first open nvim, all the plugins will be installed automatically.
|
||||||
Since I use quite a lot of plugins (more than 60), it may take some time to install all of them.
|
Since I use quite a lot of plugins (more than 60), it may take some time to install all of them.
|
||||||
|
|
||||||
[^1]: Use `echo %userprofile%` to see where your `$HOME` is.
|
[^1]: Use `echo %userprofile%` to see where your `$HOME` is.
|
||||||
|
|||||||
@@ -252,13 +252,7 @@ fi
|
|||||||
|
|
||||||
git clone --depth=1 https://github.com/jdhao/nvim-config.git "$NVIM_CONFIG_DIR"
|
git clone --depth=1 https://github.com/jdhao/nvim-config.git "$NVIM_CONFIG_DIR"
|
||||||
|
|
||||||
echo "Installing packer.nvim"
|
|
||||||
if [[ ! -d ~/.local/share/nvim/site/pack/packer/opt/packer.nvim ]]; then
|
|
||||||
git clone --depth=1 https://github.com/wbthomason/packer.nvim \
|
|
||||||
~/.local/share/nvim/site/pack/packer/opt/packer.nvim
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Installing nvim plugins, please wait"
|
echo "Installing nvim plugins, please wait"
|
||||||
"$NVIM_DIR/bin/nvim" -c "autocmd User PackerComplete quitall" -c "PackerSync"
|
"$NVIM_DIR/bin/nvim" -c "autocmd User LazyInstall quitall" -c "lua require('lazy').install()"
|
||||||
|
|
||||||
echo "Finished installing Nvim and its dependencies!"
|
echo "Finished installing Nvim and its dependencies!"
|
||||||
|
|||||||
8
init.lua
8
init.lua
@@ -11,19 +11,17 @@
|
|||||||
-- StackOverflow: https://stackoverflow.com/users/6064933/jdhao
|
-- StackOverflow: https://stackoverflow.com/users/6064933/jdhao
|
||||||
vim.loader.enable()
|
vim.loader.enable()
|
||||||
|
|
||||||
local api = vim.api
|
|
||||||
local version = vim.version
|
local version = vim.version
|
||||||
|
|
||||||
-- check if we have the latest stable version of nvim
|
-- check if we have the latest stable version of nvim
|
||||||
local expected_ver = "0.9.1"
|
local expected_ver = "0.9.2"
|
||||||
local ev = version.parse(expected_ver)
|
local ev = version.parse(expected_ver)
|
||||||
local actual_ver = version()
|
local actual_ver = version()
|
||||||
|
|
||||||
if version.cmp(ev, actual_ver) ~= 0 then
|
if version.cmp(ev, actual_ver) ~= 0 then
|
||||||
local _ver = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch)
|
local _ver = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch)
|
||||||
local msg = string.format("Unsupported nvim version: expect %s, but got %s instead!", expected_ver, _ver)
|
local msg = string.format("Expect nvim %s, but got %s instead. Use at your own risk!", expected_ver, _ver)
|
||||||
api.nvim_err_writeln(msg)
|
vim.api.nvim_err_writeln(msg)
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local core_conf_files = {
|
local core_conf_files = {
|
||||||
|
|||||||
88
lazy-lock.json
Normal file
88
lazy-lock.json
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"LeaderF": { "branch": "master", "commit": "9c4451d2c1a6ea1f32e39fe52d58f6f5655b231d" },
|
||||||
|
"asyncrun.vim": { "branch": "master", "commit": "42385d54b8546c163b946fd50eed2103ef7993c9" },
|
||||||
|
"better-escape.vim": { "branch": "master", "commit": "6b16a45a839727977277f6ab11bded63e9ed86bb" },
|
||||||
|
"bufferline.nvim": { "branch": "main", "commit": "9961d87bb3ec008213c46ba14b3f384a5f520eb5" },
|
||||||
|
"catppuccin": { "branch": "main", "commit": "85e93601e0f0b48aa2c6bbfae4d0e9d7a1898280" },
|
||||||
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
|
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||||
|
"cmp-nvim-ultisnips": { "branch": "main", "commit": "24bca5c3e137b28cd87442d4fc51a2b312dd99cc" },
|
||||||
|
"cmp-omni": { "branch": "main", "commit": "9436e6cdd7c5dfa24a99a60d9280b24dbdea3649" },
|
||||||
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
|
"committia.vim": { "branch": "master", "commit": "0b4df1a7f48ffbc23b009bd14d58ee1be541917c" },
|
||||||
|
"dashboard-nvim": { "branch": "master", "commit": "bbe0234168501b8ba46f24b4fb3cb7c5b88c0784" },
|
||||||
|
"delimitMate": { "branch": "master", "commit": "537a1da0fa5eeb88640425c37e545af933c56e1b" },
|
||||||
|
"dressing.nvim": { "branch": "master", "commit": "c1e1d5fa44fe08811b6ef4aadac2b50e602f9504" },
|
||||||
|
"edge": { "branch": "master", "commit": "a4fd4f458331d42677d992f428235c491b2016aa" },
|
||||||
|
"emmylua-nvim": { "branch": "master", "commit": "38720eb5f1dac8e87254fd944dbe0959b2e67d94" },
|
||||||
|
"everforest": { "branch": "master", "commit": "83b666410d7ae0eccf96dbbe3b4b6ac5b8172d38" },
|
||||||
|
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
|
||||||
|
"firenvim": { "branch": "master", "commit": "138424db463e6c0e862a05166a4ccc781cd7c19d" },
|
||||||
|
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "907ae8636016aab2f283576fc60d46ca3427e579" },
|
||||||
|
"gruvbox-material": { "branch": "master", "commit": "b5f8c6a6c1cda630c53b061b765068a0898d47a3" },
|
||||||
|
"hop.nvim": { "branch": "master", "commit": "1a1eceafe54b5081eae4cb91c723abd1d450f34b" },
|
||||||
|
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
|
||||||
|
"kanagawa.nvim": { "branch": "master", "commit": "a4e99f089110c6d00bc33f5497709200e914e763" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
|
||||||
|
"lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
||||||
|
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
|
||||||
|
"material.nvim": { "branch": "main", "commit": "1ecaa2d065a1ea308bd7702a77c2bf35ede8f536" },
|
||||||
|
"monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
|
||||||
|
"neoformat": { "branch": "master", "commit": "0c285d7a7c06a6ee88db70871a274797693fce42" },
|
||||||
|
"nightfox.nvim": { "branch": "main", "commit": "e886e39e592e89f316536a6f070365a9d88901c9" },
|
||||||
|
"nord.nvim": { "branch": "master", "commit": "15fbfc38a83980b93e169b32a1bf64757f1e2bf4" },
|
||||||
|
"nvim-bqf": { "branch": "main", "commit": "a906a9dfc1bd7b3ac51ac954e32e157ffad9a7cd" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
||||||
|
"nvim-hlslens": { "branch": "main", "commit": "f0281591a59e95400babf61a96e59ba20e5c9533" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "cc388d3f6b9c7c943ae2b2dcd46ad470fd257f91" },
|
||||||
|
"nvim-notify": { "branch": "master", "commit": "94859430020f5cf32a1b97ddd9e596fed9db7981" },
|
||||||
|
"nvim-tree.lua": { "branch": "master", "commit": "94c7c810af205c0f00c8f105dcf490c8eb17658a" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "bf8b089eecef9e9e8c1765f81613a2fd5e49175c" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "973ab742f143a796a779af4d786ec409116a0d87" },
|
||||||
|
"onedark.nvim": { "branch": "master", "commit": "dac8c39812dae025255c9069a260e1f69d967927" },
|
||||||
|
"onedarkpro.nvim": { "branch": "main", "commit": "fa861b992471d55f653751f1fea8769ca536a554" },
|
||||||
|
"open-browser.vim": { "branch": "master", "commit": "7d4c1d8198e889d513a030b5a83faa07606bac27" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
|
||||||
|
"rose-pine": { "branch": "main", "commit": "e29002cbee4854a9c8c4b148d8a52fae3176070f" },
|
||||||
|
"sonokai": { "branch": "master", "commit": "17308ee6d9c764bfc1e0fa97213e7a99701b4144" },
|
||||||
|
"tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" },
|
||||||
|
"targets.vim": { "branch": "master", "commit": "642d3a4ce306264b05ea3219920b13ea80931767" },
|
||||||
|
"telescope-symbols.nvim": { "branch": "master", "commit": "f2060117d965df4a626f068a4ebbd8ee051aa076" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "59812c26d826e8c717e29406267ea1260f71e103" },
|
||||||
|
"ultisnips": { "branch": "master", "commit": "24a3ebb36687b6d59a19d63173713575b486d739" },
|
||||||
|
"unicode.vim": { "branch": "master", "commit": "c8aa12b1e2e1b6254885b12bdb239ce6c885fdb1" },
|
||||||
|
"vim-auto-save": { "branch": "master", "commit": "2e3e54ea4c0fc946c21b0a4ee4c1c295ba736ee8" },
|
||||||
|
"vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" },
|
||||||
|
"vim-conflicted": { "branch": "master", "commit": "068c320796f807ac4961618e3e62316773803996" },
|
||||||
|
"vim-eunuch": { "branch": "master", "commit": "67f3dd32b4dcd1c427085f42ff5f29c7adc645c6" },
|
||||||
|
"vim-flog": { "branch": "master", "commit": "58c1d39ec42f92d23a1204b1869e5d1dece8b86c" },
|
||||||
|
"vim-fugitive": { "branch": "master", "commit": "6fcb0ad03982de646e3fecb6915e585651b9a9fb" },
|
||||||
|
"vim-grammarous": { "branch": "master", "commit": "db46357465ce587d5325e816235b5e92415f8c05" },
|
||||||
|
"vim-highlighturl": { "branch": "master", "commit": "012fee983e03913db6ba6393307eac434999b896" },
|
||||||
|
"vim-indent-object": { "branch": "master", "commit": "5c5b24c959478929b54a9e831a8e2e651a465965" },
|
||||||
|
"vim-markdown": { "branch": "master", "commit": "cc82d88e2a791f54d2b6e2b26e41f743351ac947" },
|
||||||
|
"vim-markdownfootnotes": { "branch": "master", "commit": "2b288149f48cfaf7465d25bb094ed62898f5e5b0" },
|
||||||
|
"vim-matchup": { "branch": "master", "commit": "6dbe108230c7dbbf00555b7d4d9f6a891837ef07" },
|
||||||
|
"vim-mundo": { "branch": "master", "commit": "b53d35fb5ca9923302b9ef29e618ab2db4cc675e" },
|
||||||
|
"vim-obsession": { "branch": "master", "commit": "fe9d3e1a9a50171e7d316a52e1e56d868e4c1fe5" },
|
||||||
|
"vim-python-pep8-indent": { "branch": "master", "commit": "60ba5e11a61618c0344e2db190210145083c91f8" },
|
||||||
|
"vim-pythonsense": { "branch": "master", "commit": "9200a57629c904ed2ab8c9b2e8c5649d311794ba" },
|
||||||
|
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
|
||||||
|
"vim-sandwich": { "branch": "master", "commit": "c5a2cc438ce6ea2005c556dc833732aa53cae21a" },
|
||||||
|
"vim-scriptease": { "branch": "master", "commit": "18511d389675d773994215ddb572ccdc2b72f52b" },
|
||||||
|
"vim-snippets": { "branch": "master", "commit": "ccc2fa1529d372f7ac16d5eb07a385a72b50e05d" },
|
||||||
|
"vim-swap": { "branch": "master", "commit": "9358bfdc5e377aa13e7c2c2dd8699ba32b0dcf83" },
|
||||||
|
"vim-tmux": { "branch": "master", "commit": "cfe76281efc29890548cf9eedd42ad51c7a1faf0" },
|
||||||
|
"vim-toml": { "branch": "main", "commit": "d36caa6b1cf508a4df1c691f915572fc02143258" },
|
||||||
|
"vim-xkbswitch": { "branch": "master", "commit": "42b55bfec8f6dbd715135ce582a6f769831face1" },
|
||||||
|
"vimtex": { "branch": "master", "commit": "2b8a5f16a5768b3ae1780c266b73022dbb658af1" },
|
||||||
|
"vista.vim": { "branch": "master", "commit": "40daf5e97be70a90465182fbbdfba92442bfd8e1" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" },
|
||||||
|
"whitespace.nvim": { "branch": "master", "commit": "f0fc9e9c4ce3f7d2166e9e5a069b64b9ca4a3f15" },
|
||||||
|
"wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" },
|
||||||
|
"yanky.nvim": { "branch": "main", "commit": "4c85d8d6808d9859e72f8bd6c25302199e6a5eac" },
|
||||||
|
"zen-mode.nvim": { "branch": "main", "commit": "68f554702de63f4b7b6b6d4bcb10178f41a0acc7" }
|
||||||
|
}
|
||||||
@@ -129,16 +129,6 @@ M.rand_colorscheme = function()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Load the colorscheme, because all the colorschemes are declared as opt plugins, so the colorscheme isn't loaded yet.
|
|
||||||
local status = utils.add_pack(M.colorscheme2dir[colorscheme])
|
|
||||||
|
|
||||||
if not status then
|
|
||||||
local msg = string.format("Colorscheme %s is not installed. Run PackerSync to install.", colorscheme)
|
|
||||||
vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" })
|
|
||||||
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Load the colorscheme and its settings
|
-- Load the colorscheme and its settings
|
||||||
M[colorscheme]()
|
M[colorscheme]()
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ local activate_hlslens = function(direction)
|
|||||||
local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction)
|
local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction)
|
||||||
local status, msg = pcall(vim.cmd, cmd)
|
local status, msg = pcall(vim.cmd, cmd)
|
||||||
|
|
||||||
|
-- Deal with the case that there is no such pattern in current buffer.
|
||||||
if not status then
|
if not status then
|
||||||
-- 13 is the index where real error message starts
|
local start_idx, _ = string.find(msg, 'E486', 1, true)
|
||||||
msg = msg:sub(13)
|
local msg_part = string.sub(msg, start_idx)
|
||||||
api.nvim_err_writeln(msg)
|
api.nvim_err_writeln(msg_part)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ if utils.executable("lua-language-server") then
|
|||||||
-- see also https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace .
|
-- see also https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace .
|
||||||
-- Lua-dev.nvim also has similar settings for lua ls, https://github.com/folke/neodev.nvim/blob/main/lua/neodev/luals.lua .
|
-- Lua-dev.nvim also has similar settings for lua ls, https://github.com/folke/neodev.nvim/blob/main/lua/neodev/luals.lua .
|
||||||
library = {
|
library = {
|
||||||
fn.stdpath("data") .. "/site/pack/packer/opt/emmylua-nvim",
|
fn.stdpath("data") .. "/lazy/emmylua-nvim",
|
||||||
fn.stdpath("config"),
|
fn.stdpath("config"),
|
||||||
},
|
},
|
||||||
maxPreload = 2000,
|
maxPreload = 2000,
|
||||||
|
|||||||
@@ -18,12 +18,6 @@ nvim_tree.setup {
|
|||||||
number = false,
|
number = false,
|
||||||
relativenumber = false,
|
relativenumber = false,
|
||||||
signcolumn = "yes",
|
signcolumn = "yes",
|
||||||
mappings = {
|
|
||||||
custom_only = false,
|
|
||||||
list = {
|
|
||||||
-- user mappings go here
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
renderer = {
|
renderer = {
|
||||||
indent_markers = {
|
indent_markers = {
|
||||||
@@ -85,7 +79,7 @@ nvim_tree.setup {
|
|||||||
enable = true,
|
enable = true,
|
||||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||||
exclude = {
|
exclude = {
|
||||||
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
|
filetype = { "notify", "qf", "diff", "fugitive", "fugitiveblame" },
|
||||||
buftype = { "nofile", "terminal", "help" },
|
buftype = { "nofile", "terminal", "help" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -17,14 +17,33 @@ api.nvim_create_autocmd({ "BufRead" }, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- highlight yanked region, see `:h lua-highlight`
|
-- highlight yanked region, see `:h lua-highlight`
|
||||||
|
local yank_group = api.nvim_create_augroup("highlight_yank", { clear = true })
|
||||||
api.nvim_create_autocmd({ "TextYankPost" }, {
|
api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
group = api.nvim_create_augroup("highlight_yank", { clear = true }),
|
group = yank_group,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.highlight.on_yank { higroup = "YankColor", timeout = 300 }
|
vim.highlight.on_yank { higroup = "YankColor", timeout = 300 }
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
api.nvim_create_autocmd({ "CursorMoved" }, {
|
||||||
|
pattern = "*",
|
||||||
|
group = yank_group,
|
||||||
|
callback = function()
|
||||||
|
vim.g.current_cursor_pos = vim.fn.getcurpos()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
api.nvim_create_autocmd("TextYankPost", {
|
||||||
|
pattern = "*",
|
||||||
|
group = yank_group,
|
||||||
|
callback = function(ev)
|
||||||
|
if vim.v.event.operator == 'y' then
|
||||||
|
vim.fn.setpos('.', vim.g.current_cursor_pos)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Auto-create dir when saving a file, in case some intermediate directory does not exist
|
-- Auto-create dir when saving a file, in case some intermediate directory does not exist
|
||||||
api.nvim_create_autocmd({ "BufWritePre" }, {
|
api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
|
|||||||
@@ -201,20 +201,6 @@ end
|
|||||||
-- insert semicolon in the end
|
-- insert semicolon in the end
|
||||||
keymap.set("i", "<A-;>", "<Esc>miA;<Esc>`ii")
|
keymap.set("i", "<A-;>", "<Esc>miA;<Esc>`ii")
|
||||||
|
|
||||||
-- Keep cursor position after yanking
|
|
||||||
keymap.set("n", "y", "myy")
|
|
||||||
|
|
||||||
api.nvim_create_autocmd("TextYankPost", {
|
|
||||||
pattern = "*",
|
|
||||||
group = api.nvim_create_augroup("restore_after_yank", { clear = true }),
|
|
||||||
callback = function()
|
|
||||||
vim.cmd([[
|
|
||||||
silent! normal! `y
|
|
||||||
silent! delmarks y
|
|
||||||
]])
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Go to the beginning and end of current line in insert mode quickly
|
-- Go to the beginning and end of current line in insert mode quickly
|
||||||
keymap.set("i", "<C-A>", "<HOME>")
|
keymap.set("i", "<C-A>", "<HOME>")
|
||||||
keymap.set("i", "<C-E>", "<END>")
|
keymap.set("i", "<C-E>", "<END>")
|
||||||
|
|||||||
549
lua/plugins.lua
549
lua/plugins.lua
@@ -1,396 +1,503 @@
|
|||||||
local api = vim.api
|
|
||||||
local fn = vim.fn
|
|
||||||
|
|
||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
|
|
||||||
-- The root dir to install all plugins. Plugins are under opt/ or start/ sub-directory.
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
vim.g.plugin_home = fn.stdpath("data") .. "/site/pack/packer"
|
|
||||||
|
|
||||||
--- Install packer if it has not been installed.
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
--- Return:
|
vim.fn.system {
|
||||||
--- true: if this is a fresh install of packer
|
"git",
|
||||||
--- false: if packer has been installed
|
"clone",
|
||||||
local function packer_ensure_install()
|
"--filter=blob:none",
|
||||||
-- Where to install packer.nvim -- the package manager (we make it opt)
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
local packer_dir = vim.g.plugin_home .. "/opt/packer.nvim"
|
"--branch=stable", -- latest stable release
|
||||||
|
lazypath,
|
||||||
if fn.glob(packer_dir) ~= "" then
|
}
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Auto-install packer in case it hasn't been installed.
|
|
||||||
vim.api.nvim_echo({ { "Installing packer.nvim", "Type" } }, true, {})
|
|
||||||
|
|
||||||
local packer_repo = "https://github.com/wbthomason/packer.nvim"
|
|
||||||
local install_cmd = string.format("!git clone --depth=1 %s %s", packer_repo, packer_dir)
|
|
||||||
vim.cmd(install_cmd)
|
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
local fresh_install = packer_ensure_install()
|
|
||||||
|
|
||||||
-- Load packer.nvim
|
|
||||||
vim.cmd("packadd packer.nvim")
|
|
||||||
|
|
||||||
local packer = require("packer")
|
|
||||||
local packer_util = require("packer.util")
|
|
||||||
|
|
||||||
-- check if firenvim is active
|
-- check if firenvim is active
|
||||||
local firenvim_not_active = function()
|
local firenvim_not_active = function()
|
||||||
return not vim.g.started_by_firenvim
|
return not vim.g.started_by_firenvim
|
||||||
end
|
end
|
||||||
|
|
||||||
packer.startup {
|
local plugin_specs = {
|
||||||
function(use)
|
|
||||||
use { "wbthomason/packer.nvim", opt = true }
|
|
||||||
|
|
||||||
use { "onsails/lspkind-nvim", event = "VimEnter" }
|
|
||||||
-- auto-completion engine
|
-- auto-completion engine
|
||||||
use { "hrsh7th/nvim-cmp", after = "lspkind-nvim", config = [[require('config.nvim-cmp')]] }
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
-- event = 'InsertEnter',
|
||||||
|
event = "VeryLazy",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"onsails/lspkind-nvim",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-omni",
|
||||||
|
"hrsh7th/cmp-emoji",
|
||||||
|
"quangnguyen30192/cmp-nvim-ultisnips",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("config.nvim-cmp")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- nvim-cmp completion sources
|
{
|
||||||
use { "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" }
|
"neovim/nvim-lspconfig",
|
||||||
use { "hrsh7th/cmp-path", after = "nvim-cmp" }
|
event = { "BufRead", "BufNewFile" },
|
||||||
use { "hrsh7th/cmp-buffer", after = "nvim-cmp" }
|
config = function()
|
||||||
use { "hrsh7th/cmp-omni", after = "nvim-cmp" }
|
require("config.lsp")
|
||||||
use { "quangnguyen30192/cmp-nvim-ultisnips", after = { "nvim-cmp", "ultisnips" } }
|
end,
|
||||||
if vim.g.is_mac then
|
},
|
||||||
use { "hrsh7th/cmp-emoji", after = "nvim-cmp" }
|
|
||||||
end
|
|
||||||
|
|
||||||
-- nvim-lsp configuration (it relies on cmp-nvim-lsp, so it should be loaded after cmp-nvim-lsp).
|
{
|
||||||
use { "neovim/nvim-lspconfig", after = "cmp-nvim-lsp", config = [[require('config.lsp')]] }
|
|
||||||
|
|
||||||
if vim.g.is_mac then
|
|
||||||
use {
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
event = "BufEnter",
|
enabled = function()
|
||||||
run = ":TSUpdate",
|
if vim.g.is_mac then
|
||||||
config = [[require('config.treesitter')]],
|
return true
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
event = "VeryLazy",
|
||||||
|
build = ":TSUpdate",
|
||||||
|
config = function()
|
||||||
|
require("config.treesitter")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- Python indent (follows the PEP8 style)
|
-- Python indent (follows the PEP8 style)
|
||||||
use { "Vimjas/vim-python-pep8-indent", ft = { "python" } }
|
{ "Vimjas/vim-python-pep8-indent", ft = { "python" } },
|
||||||
|
|
||||||
-- Python-related text object
|
-- Python-related text object
|
||||||
use { "jeetsukumaran/vim-pythonsense", ft = { "python" } }
|
{ "jeetsukumaran/vim-pythonsense", ft = { "python" } },
|
||||||
|
|
||||||
use { "machakann/vim-swap", event = "VimEnter" }
|
{ "machakann/vim-swap", event = "VeryLazy" },
|
||||||
|
|
||||||
-- IDE for Lisp
|
-- IDE for Lisp
|
||||||
|
-- 'kovisoft/slimv'
|
||||||
|
{
|
||||||
|
"vlime/vlime",
|
||||||
|
enabled = function()
|
||||||
if utils.executable("sbcl") then
|
if utils.executable("sbcl") then
|
||||||
-- use 'kovisoft/slimv'
|
return true
|
||||||
use { "vlime/vlime", rtp = "vim/", ft = { "lisp" } }
|
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
config = function(plugin)
|
||||||
|
vim.opt.rtp:append(plugin.dir .. "/vim")
|
||||||
|
end,
|
||||||
|
ft = { "lisp" },
|
||||||
|
},
|
||||||
|
|
||||||
-- Super fast buffer jump
|
-- Super fast buffer jump
|
||||||
use {
|
{
|
||||||
"phaazon/hop.nvim",
|
"phaazon/hop.nvim",
|
||||||
event = "VimEnter",
|
event = "VeryLazy",
|
||||||
config = function()
|
config = function()
|
||||||
vim.defer_fn(function()
|
vim.defer_fn(function()
|
||||||
require("config.nvim_hop")
|
require("config.nvim_hop")
|
||||||
end, 2000)
|
end, 2000)
|
||||||
end,
|
end,
|
||||||
}
|
},
|
||||||
|
|
||||||
-- Show match number and index for searching
|
-- Show match number and index for searching
|
||||||
use {
|
{
|
||||||
"kevinhwang91/nvim-hlslens",
|
"kevinhwang91/nvim-hlslens",
|
||||||
branch = "main",
|
branch = "main",
|
||||||
keys = { { "n", "*" }, { "n", "#" }, { "n", "n" }, { "n", "N" } },
|
keys = { "*", "#", "n", "N" },
|
||||||
config = [[require('config.hlslens')]],
|
config = function()
|
||||||
}
|
require("config.hlslens")
|
||||||
|
end,
|
||||||
-- File search, tag search and more
|
},
|
||||||
if vim.g.is_win then
|
{
|
||||||
use { "Yggdroot/LeaderF", cmd = "Leaderf" }
|
"Yggdroot/LeaderF",
|
||||||
else
|
cmd = "Leaderf",
|
||||||
use { "Yggdroot/LeaderF", cmd = "Leaderf", run = ":LeaderfInstallCExtension" }
|
build = function()
|
||||||
|
if not vim.g.is_win then
|
||||||
|
vim.cmd(":LeaderfInstallCExtension")
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
use {
|
},
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
requires = { { "nvim-lua/plenary.nvim" } },
|
dependencies = {
|
||||||
}
|
"nvim-telescope/telescope-symbols.nvim",
|
||||||
-- search emoji and other symbols
|
},
|
||||||
use { "nvim-telescope/telescope-symbols.nvim", after = "telescope.nvim" }
|
},
|
||||||
|
|
||||||
-- A list of colorscheme plugin you may want to try. Find what suits you.
|
-- A list of colorscheme plugin you may want to try. Find what suits you.
|
||||||
use { "navarasu/onedark.nvim", opt = true }
|
{ "navarasu/onedark.nvim", lazy = true },
|
||||||
use { "sainnhe/edge", opt = true }
|
{ "sainnhe/edge", lazy = true },
|
||||||
use { "sainnhe/sonokai", opt = true }
|
{ "sainnhe/sonokai", lazy = true },
|
||||||
use { "sainnhe/gruvbox-material", opt = true }
|
{ "sainnhe/gruvbox-material", lazy = true },
|
||||||
use { "shaunsingh/nord.nvim", opt = true }
|
{ "shaunsingh/nord.nvim", lazy = true },
|
||||||
use { "sainnhe/everforest", opt = true }
|
{ "sainnhe/everforest", lazy = true },
|
||||||
use { "EdenEast/nightfox.nvim", opt = true }
|
{ "EdenEast/nightfox.nvim", lazy = true },
|
||||||
use { "rebelot/kanagawa.nvim", opt = true }
|
{ "rebelot/kanagawa.nvim", lazy = true },
|
||||||
use { "catppuccin/nvim", as = "catppuccin", opt = true }
|
{ "catppuccin/nvim", name = "catppuccin", lazy = true },
|
||||||
use({ "rose-pine/neovim", as = 'rose-pine', opt = true })
|
{ "rose-pine/neovim", name = "rose-pine", lazy = true },
|
||||||
use { "olimorris/onedarkpro.nvim", opt = true }
|
{ "olimorris/onedarkpro.nvim", lazy = true },
|
||||||
use { "tanvirtin/monokai.nvim", opt = true }
|
{ "tanvirtin/monokai.nvim", lazy = true },
|
||||||
use { "marko-cerovac/material.nvim", opt = true }
|
{ "marko-cerovac/material.nvim", lazy = true },
|
||||||
|
|
||||||
use { "nvim-tree/nvim-web-devicons", event = "VimEnter" }
|
{ "nvim-tree/nvim-web-devicons", event = "VeryLazy" },
|
||||||
|
|
||||||
use {
|
{
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
event = "VimEnter",
|
event = "VeryLazy",
|
||||||
cond = firenvim_not_active,
|
cond = firenvim_not_active,
|
||||||
config = [[require('config.statusline')]],
|
config = function()
|
||||||
}
|
require("config.statusline")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
use { "akinsho/bufferline.nvim", event = "VimEnter",
|
{
|
||||||
|
"akinsho/bufferline.nvim",
|
||||||
|
event = { "BufEnter" },
|
||||||
cond = firenvim_not_active,
|
cond = firenvim_not_active,
|
||||||
config = [[require('config.bufferline')]] }
|
config = function()
|
||||||
|
require("config.bufferline")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- fancy start screen
|
-- fancy start screen
|
||||||
use { "nvimdev/dashboard-nvim", event = "VimEnter",
|
{
|
||||||
|
"nvimdev/dashboard-nvim",
|
||||||
cond = firenvim_not_active,
|
cond = firenvim_not_active,
|
||||||
config = [[require('config.dashboard-nvim')]]
|
config = function()
|
||||||
}
|
require("config.dashboard-nvim")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
use {
|
{
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
event = "VimEnter",
|
event = "VeryLazy",
|
||||||
config = [[require('config.indent-blankline')]],
|
config = function()
|
||||||
}
|
require("config.indent-blankline")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- Highlight URLs inside vim
|
-- Highlight URLs inside vim
|
||||||
use { "itchyny/vim-highlighturl", event = "VimEnter" }
|
{ "itchyny/vim-highlighturl", event = "VeryLazy" },
|
||||||
|
|
||||||
-- notification plugin
|
-- notification plugin
|
||||||
use {
|
{
|
||||||
"rcarriga/nvim-notify",
|
"rcarriga/nvim-notify",
|
||||||
event = "BufEnter",
|
event = "VeryLazy",
|
||||||
config = function()
|
config = function()
|
||||||
vim.defer_fn(function()
|
vim.defer_fn(function()
|
||||||
require("config.nvim-notify")
|
require("config.nvim-notify")
|
||||||
end, 2000)
|
end, 2000)
|
||||||
end,
|
end,
|
||||||
}
|
},
|
||||||
|
|
||||||
-- For Windows and Mac, we can open an URL in the browser. For Linux, it may
|
-- For Windows and Mac, we can open an URL in the browser. For Linux, it may
|
||||||
-- not be possible since we maybe in a server which disables GUI.
|
-- not be possible since we maybe in a server which disables GUI.
|
||||||
|
{
|
||||||
|
"tyru/open-browser.vim",
|
||||||
|
enabled = function()
|
||||||
if vim.g.is_win or vim.g.is_mac then
|
if vim.g.is_win or vim.g.is_mac then
|
||||||
-- open URL in browser
|
return true
|
||||||
use { "tyru/open-browser.vim", event = "VimEnter" }
|
else
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
|
event = "VeryLazy",
|
||||||
|
},
|
||||||
|
|
||||||
-- Only install these plugins if ctags are installed on the system
|
-- Only install these plugins if ctags are installed on the system
|
||||||
if utils.executable("ctags") then
|
|
||||||
-- show file tags in vim window
|
-- show file tags in vim window
|
||||||
use { "liuchengxu/vista.vim", cmd = "Vista" }
|
{
|
||||||
|
"liuchengxu/vista.vim",
|
||||||
|
enabled = function()
|
||||||
|
if utils.executable("ctags") then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
|
cmd = "Vista",
|
||||||
|
},
|
||||||
|
|
||||||
-- Snippet engine and snippet template
|
-- Snippet engine and snippet template
|
||||||
use { "SirVer/ultisnips", event = "InsertEnter" }
|
{ "SirVer/ultisnips", dependencies = {
|
||||||
use { "honza/vim-snippets", after = "ultisnips" }
|
"honza/vim-snippets",
|
||||||
|
}, event = "InsertEnter" },
|
||||||
|
|
||||||
-- Automatic insertion and deletion of a pair of characters
|
-- Automatic insertion and deletion of a pair of characters
|
||||||
use { "Raimondi/delimitMate", event = "InsertEnter" }
|
{ "Raimondi/delimitMate", event = "InsertEnter" },
|
||||||
|
|
||||||
-- Comment plugin
|
-- Comment plugin
|
||||||
use { "tpope/vim-commentary", event = "VimEnter" }
|
{ "tpope/vim-commentary", event = "VeryLazy" },
|
||||||
|
|
||||||
-- Multiple cursor plugin like Sublime Text?
|
-- Multiple cursor plugin like Sublime Text?
|
||||||
-- use 'mg979/vim-visual-multi'
|
-- 'mg979/vim-visual-multi'
|
||||||
|
|
||||||
-- Autosave files on certain events
|
-- Autosave files on certain events
|
||||||
use { "907th/vim-auto-save", event = "InsertEnter" }
|
{ "907th/vim-auto-save", event = "InsertEnter" },
|
||||||
|
|
||||||
-- Show undo history visually
|
-- Show undo history visually
|
||||||
use { "simnalamburt/vim-mundo", cmd = { "MundoToggle", "MundoShow" } }
|
{ "simnalamburt/vim-mundo", cmd = { "MundoToggle", "MundoShow" } },
|
||||||
|
|
||||||
-- better UI for some nvim actions
|
-- better UI for some nvim actions
|
||||||
use {'stevearc/dressing.nvim'}
|
{ "stevearc/dressing.nvim" },
|
||||||
|
|
||||||
-- Manage your yank history
|
-- Manage your yank history
|
||||||
use({
|
{
|
||||||
"gbprod/yanky.nvim",
|
"gbprod/yanky.nvim",
|
||||||
config = [[require('config.yanky')]]
|
cmd = { "YankyRingHistory" },
|
||||||
})
|
config = function()
|
||||||
|
require("config.yanky")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- Handy unix command inside Vim (Rename, Move etc.)
|
-- Handy unix command inside Vim (Rename, Move etc.)
|
||||||
use { "tpope/vim-eunuch", cmd = { "Rename", "Delete" } }
|
{ "tpope/vim-eunuch", cmd = { "Rename", "Delete" } },
|
||||||
|
|
||||||
-- Repeat vim motions
|
-- Repeat vim motions
|
||||||
use { "tpope/vim-repeat", event = "VimEnter" }
|
{ "tpope/vim-repeat", event = "VeryLazy" },
|
||||||
|
|
||||||
use { "nvim-zh/better-escape.vim", event = { "InsertEnter" } }
|
{ "nvim-zh/better-escape.vim", event = { "InsertEnter" } },
|
||||||
|
|
||||||
if vim.g.is_mac then
|
{
|
||||||
use { "lyokha/vim-xkbswitch", event = { "InsertEnter" } }
|
"lyokha/vim-xkbswitch",
|
||||||
elseif vim.g.is_win then
|
enabled = function()
|
||||||
use { "Neur1n/neuims", event = { "InsertEnter" } }
|
if vim.g.is_mac and utils.executable("xkbswitch") then
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
event = { "InsertEnter" },
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"Neur1n/neuims",
|
||||||
|
enabled = function()
|
||||||
|
if vim.g.is_win then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
event = { "InsertEnter" },
|
||||||
|
},
|
||||||
|
|
||||||
-- Auto format tools
|
-- Auto format tools
|
||||||
use { "sbdchd/neoformat", cmd = { "Neoformat" } }
|
{ "sbdchd/neoformat", cmd = { "Neoformat" } },
|
||||||
|
|
||||||
-- Git command inside vim
|
-- Git command inside vim
|
||||||
use { "tpope/vim-fugitive", event = "User InGitRepo", config = [[require('config.fugitive')]] }
|
{
|
||||||
|
"tpope/vim-fugitive",
|
||||||
|
event = "User InGitRepo",
|
||||||
|
config = function()
|
||||||
|
require("config.fugitive")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- Better git log display
|
-- Better git log display
|
||||||
use { "rbong/vim-flog", requires = "tpope/vim-fugitive", cmd = { "Flog" } }
|
{ "rbong/vim-flog", cmd = { "Flog" } },
|
||||||
|
{ "christoomey/vim-conflicted", cmd = { "Conflicted" } },
|
||||||
use { "christoomey/vim-conflicted", requires = "tpope/vim-fugitive", cmd = { "Conflicted" } }
|
{
|
||||||
|
|
||||||
use {
|
|
||||||
"ruifm/gitlinker.nvim",
|
"ruifm/gitlinker.nvim",
|
||||||
requires = "nvim-lua/plenary.nvim",
|
|
||||||
event = "User InGitRepo",
|
event = "User InGitRepo",
|
||||||
config = [[require('config.git-linker')]],
|
config = function()
|
||||||
}
|
require("config.git-linker")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- Show git change (change, delete, add) signs in vim sign column
|
-- Show git change (change, delete, add) signs in vim sign column
|
||||||
use { "lewis6991/gitsigns.nvim", config = [[require('config.gitsigns')]] }
|
{
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
config = function()
|
||||||
|
require("config.gitsigns")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- Better git commit experience
|
-- Better git commit experience
|
||||||
use { "rhysd/committia.vim", opt = true, setup = [[vim.cmd('packadd committia.vim')]] }
|
{ "rhysd/committia.vim", lazy = true },
|
||||||
|
{
|
||||||
use { "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] }
|
"kevinhwang91/nvim-bqf",
|
||||||
|
ft = "qf",
|
||||||
|
config = function()
|
||||||
|
require("config.bqf")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- Another markdown plugin
|
-- Another markdown plugin
|
||||||
use { "preservim/vim-markdown", ft = { "markdown" } }
|
{ "preservim/vim-markdown", ft = { "markdown" } },
|
||||||
|
|
||||||
-- Faster footnote generation
|
-- Faster footnote generation
|
||||||
use { "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } }
|
{ "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } },
|
||||||
|
|
||||||
-- Vim tabular plugin for manipulate tabular, required by markdown plugins
|
-- Vim tabular plugin for manipulate tabular, required by markdown plugins
|
||||||
use { "godlygeek/tabular", cmd = { "Tabularize" } }
|
{ "godlygeek/tabular", cmd = { "Tabularize" } },
|
||||||
|
|
||||||
-- Markdown previewing (only for Mac and Windows)
|
-- Markdown previewing (only for Mac and Windows)
|
||||||
if vim.g.is_win or vim.g.is_mac then
|
{
|
||||||
use {
|
|
||||||
"iamcco/markdown-preview.nvim",
|
"iamcco/markdown-preview.nvim",
|
||||||
run = "cd app && npm install",
|
enabled = function()
|
||||||
|
if vim.g.is_win or vim.g.is_mac then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
build = "cd app && npm install",
|
||||||
ft = { "markdown" },
|
ft = { "markdown" },
|
||||||
}
|
},
|
||||||
end
|
|
||||||
|
|
||||||
use { "folke/zen-mode.nvim", cmd = "ZenMode", config = [[require('config.zen-mode')]] }
|
{
|
||||||
|
"folke/zen-mode.nvim",
|
||||||
|
cmd = "ZenMode",
|
||||||
|
config = function()
|
||||||
|
require("config.zen-mode")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"rhysd/vim-grammarous",
|
||||||
|
enabled = function()
|
||||||
if vim.g.is_mac then
|
if vim.g.is_mac then
|
||||||
use { "rhysd/vim-grammarous", ft = { "markdown" } }
|
return true
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
ft = { "markdown" },
|
||||||
|
},
|
||||||
|
|
||||||
use { "chrisbra/unicode.vim", event = "VimEnter" }
|
{ "chrisbra/unicode.vim", event = "VeryLazy" },
|
||||||
|
|
||||||
-- Additional powerful text object for vim, this plugin should be studied
|
-- Additional powerful text object for vim, this plugin should be studied
|
||||||
-- carefully to use its full power
|
-- carefully to use its full power
|
||||||
use { "wellle/targets.vim", event = "VimEnter" }
|
{ "wellle/targets.vim", event = "VeryLazy" },
|
||||||
|
|
||||||
-- Plugin to manipulate character pairs quickly
|
-- Plugin to manipulate character pairs quickly
|
||||||
use { "machakann/vim-sandwich", event = "VimEnter" }
|
{ "machakann/vim-sandwich", event = "VeryLazy" },
|
||||||
|
|
||||||
-- Add indent object for vim (useful for languages like Python)
|
-- Add indent object for vim (useful for languages like Python)
|
||||||
use { "michaeljsmith/vim-indent-object", event = "VimEnter" }
|
{ "michaeljsmith/vim-indent-object", event = "VeryLazy" },
|
||||||
|
|
||||||
-- Only use these plugin on Windows and Mac and when LaTeX is installed
|
-- Only use these plugin on Windows and Mac and when LaTeX is installed
|
||||||
|
{
|
||||||
|
"lervag/vimtex",
|
||||||
|
enabled = function()
|
||||||
if utils.executable("latex") then
|
if utils.executable("latex") then
|
||||||
use { "lervag/vimtex", ft = { "tex" } }
|
return true
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
ft = { "tex" },
|
||||||
|
},
|
||||||
|
|
||||||
-- Since tmux is only available on Linux and Mac, we only enable these plugins
|
-- Since tmux is only available on Linux and Mac, we only enable these plugins
|
||||||
-- for Linux and Mac
|
-- for Linux and Mac
|
||||||
if utils.executable("tmux") then
|
|
||||||
-- .tmux.conf syntax highlighting and setting check
|
-- .tmux.conf syntax highlighting and setting check
|
||||||
use { "tmux-plugins/vim-tmux", ft = { "tmux" } }
|
{
|
||||||
|
"tmux-plugins/vim-tmux",
|
||||||
|
enabled = function()
|
||||||
|
if utils.executable("tmux") then
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
ft = { "tmux" },
|
||||||
|
},
|
||||||
|
|
||||||
-- Modern matchit implementation
|
-- Modern matchit implementation
|
||||||
use { "andymass/vim-matchup", event = "VimEnter" }
|
{ "andymass/vim-matchup", event = "BufRead" },
|
||||||
|
{ "tpope/vim-scriptease", cmd = { "Scriptnames", "Message", "Verbose" } },
|
||||||
use { "tpope/vim-scriptease", cmd = { "Scriptnames", "Message", "Verbose" } }
|
|
||||||
|
|
||||||
-- Asynchronous command execution
|
-- Asynchronous command execution
|
||||||
use { "skywind3000/asyncrun.vim", opt = true, cmd = { "AsyncRun" } }
|
{ "skywind3000/asyncrun.vim", lazy = true, cmd = { "AsyncRun" } },
|
||||||
|
{ "cespare/vim-toml", ft = { "toml" }, branch = "main" },
|
||||||
use { "cespare/vim-toml", ft = { "toml" }, branch = "main" }
|
|
||||||
|
|
||||||
-- Edit text area in browser using nvim
|
-- Edit text area in browser using nvim
|
||||||
if vim.g.is_win or vim.g.is_mac then
|
{
|
||||||
use {
|
|
||||||
"glacambre/firenvim",
|
"glacambre/firenvim",
|
||||||
run = function()
|
enabled = function()
|
||||||
fn["firenvim#install"](0)
|
if vim.g.is_win or vim.g.is_mac then
|
||||||
end,
|
return true
|
||||||
opt = true,
|
|
||||||
setup = [[vim.cmd('packadd firenvim')]],
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
build = function()
|
||||||
|
vim.fn["firenvim#install"](0)
|
||||||
|
end,
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
|
|
||||||
-- Debugger plugin
|
-- Debugger plugin
|
||||||
|
{
|
||||||
|
"sakhnik/nvim-gdb",
|
||||||
|
enabled = function()
|
||||||
if vim.g.is_win or vim.g.is_linux then
|
if vim.g.is_win or vim.g.is_linux then
|
||||||
use { "sakhnik/nvim-gdb", run = { "bash install.sh" }, opt = true, setup = [[vim.cmd('packadd nvim-gdb')]] }
|
return true
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
build = { "bash install.sh" },
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
|
|
||||||
-- Session management plugin
|
-- Session management plugin
|
||||||
use { "tpope/vim-obsession", cmd = "Obsession" }
|
{ "tpope/vim-obsession", cmd = "Obsession" },
|
||||||
|
|
||||||
|
{
|
||||||
|
"ojroques/vim-oscyank",
|
||||||
|
enabled = function()
|
||||||
if vim.g.is_linux then
|
if vim.g.is_linux then
|
||||||
use { "ojroques/vim-oscyank", cmd = { "OSCYank", "OSCYankReg" } }
|
return true
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
cmd = { "OSCYank", "OSCYankReg" },
|
||||||
|
},
|
||||||
|
|
||||||
-- The missing auto-completion for cmdline!
|
-- The missing auto-completion for cmdline!
|
||||||
use { "gelguy/wilder.nvim", opt = true, setup = [[vim.cmd('packadd wilder.nvim')]] }
|
{
|
||||||
|
"gelguy/wilder.nvim",
|
||||||
|
build = ":UpdateRemotePlugins",
|
||||||
|
},
|
||||||
|
|
||||||
-- showing keybindings
|
-- showing keybindings
|
||||||
use {
|
{
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
event = "VimEnter",
|
event = "VeryLazy",
|
||||||
config = function()
|
config = function()
|
||||||
vim.defer_fn(function()
|
vim.defer_fn(function()
|
||||||
require("config.which-key")
|
require("config.which-key")
|
||||||
end, 2000)
|
end, 2000)
|
||||||
end,
|
end,
|
||||||
}
|
},
|
||||||
|
|
||||||
-- show and trim trailing whitespaces
|
-- show and trim trailing whitespaces
|
||||||
use { "jdhao/whitespace.nvim", event = "VimEnter" }
|
{ "jdhao/whitespace.nvim", event = "VeryLazy" },
|
||||||
|
|
||||||
-- file explorer
|
-- file explorer
|
||||||
use {
|
{
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
requires = { "nvim-tree/nvim-web-devicons" },
|
keys = { "<space>s" },
|
||||||
config = [[require('config.nvim-tree')]],
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
}
|
config = function()
|
||||||
|
require("config.nvim-tree")
|
||||||
use { "ii14/emmylua-nvim", ft = "lua" }
|
end,
|
||||||
|
},
|
||||||
use { "j-hui/fidget.nvim", after = "nvim-lspconfig", tag = "legacy", config = [[require('config.fidget-nvim')]] }
|
|
||||||
|
{ "ii14/emmylua-nvim", ft = "lua" },
|
||||||
|
{
|
||||||
|
"j-hui/fidget.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
tag = "legacy",
|
||||||
|
config = function()
|
||||||
|
require("config.fidget-nvim")
|
||||||
end,
|
end,
|
||||||
config = {
|
|
||||||
max_jobs = 16,
|
|
||||||
compile_path = packer_util.join_paths(fn.stdpath("data"), "site", "lua", "packer_compiled.lua"),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- For fresh install, we need to install plugins. Otherwise, we just need to require `packer_compiled.lua`.
|
-- configuration for lazy itself.
|
||||||
if fresh_install then
|
local lazy_opts = {
|
||||||
-- We run packer.sync() here, because only after packer.startup, can we know which plugins to install.
|
ui = {
|
||||||
-- So plugin installation should be done after the startup process.
|
border = "rounded",
|
||||||
packer.sync()
|
title = "Plugin Manager",
|
||||||
else
|
title_pos = "center",
|
||||||
local status, _ = pcall(require, "packer_compiled")
|
},
|
||||||
if not status then
|
}
|
||||||
local msg = "File packer_compiled.lua not found: run PackerSync to fix!"
|
|
||||||
vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Auto-generate packer_compiled.lua file
|
require("lazy").setup(plugin_specs, lazy_opts)
|
||||||
api.nvim_create_autocmd({ "BufWritePost" }, {
|
|
||||||
pattern = "*/nvim/lua/plugins.lua",
|
|
||||||
group = api.nvim_create_augroup("packer_auto_compile", { clear = true }),
|
|
||||||
callback = function(ctx)
|
|
||||||
local cmd = "source " .. ctx.file
|
|
||||||
vim.cmd(cmd)
|
|
||||||
vim.cmd("PackerCompile")
|
|
||||||
vim.notify("PackerCompile done!", vim.log.levels.INFO, { title = "Nvim-config" })
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -458,3 +458,12 @@ pyright
|
|||||||
stubgen
|
stubgen
|
||||||
pylance
|
pylance
|
||||||
variadic
|
variadic
|
||||||
|
Vimium
|
||||||
|
Databricks
|
||||||
|
Jira
|
||||||
|
databricks
|
||||||
|
FastAPI
|
||||||
|
pylintrc
|
||||||
|
PYTHONPATH
|
||||||
|
Uvicorn
|
||||||
|
qpdf
|
||||||
|
|||||||
Reference in New Issue
Block a user