mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df9491b05b | ||
|
|
17d2e3ab3e | ||
|
|
2c9948300d | ||
|
|
dfaa3d97a5 | ||
|
|
8d74fcb75c | ||
|
|
b1f0ef63ef | ||
|
|
54ca6d4191 | ||
|
|
97af59e670 | ||
|
|
4d8ef868ad | ||
|
|
3137850db6 | ||
|
|
eccdc62f38 | ||
|
|
ad483a7dc0 | ||
|
|
6df27d1c22 | ||
|
|
7f6627cfa1 | ||
|
|
7ff11a9760 | ||
|
|
cc4688d089 | ||
|
|
8a1b3193a4 | ||
|
|
e92362041c | ||
|
|
63ff776758 | ||
|
|
41c8c81f21 | ||
|
|
997c6286df | ||
|
|
359621b126 | ||
|
|
4dc2d9575b | ||
|
|
fc1c447319 | ||
|
|
1391ca7ff1 | ||
|
|
6a6f8ff597 | ||
|
|
946e65662b | ||
|
|
4a6379ca5d | ||
|
|
855a88b532 | ||
|
|
892cd49f06 | ||
|
|
e53ee104ec | ||
|
|
671c78df9b | ||
|
|
1608a36dd3 | ||
|
|
450f058da5 | ||
|
|
e2f348cb37 | ||
|
|
fc8175d32d | ||
|
|
4034b6b673 | ||
|
|
67a4b6e6d0 | ||
|
|
bb27d93433 | ||
|
|
9d9c3ef32f | ||
|
|
00e8c77b23 | ||
|
|
7bb3ccc275 | ||
|
|
ee38046ebc | ||
|
|
6c873a32da | ||
|
|
9ca65fd942 | ||
|
|
cc3a7d6ebd | ||
|
|
f3a359a2fa | ||
|
|
9a4d71db88 | ||
|
|
dc597004df | ||
|
|
644993a89e | ||
|
|
164d6129f8 | ||
|
|
cde21f6f67 | ||
|
|
8746c7eb11 | ||
|
|
7c44997289 | ||
|
|
bfdb3f5a26 | ||
|
|
76ced0e265 | ||
|
|
e84d18a204 | ||
|
|
6429e8364c | ||
|
|
f2c6900a8d | ||
|
|
116aaa0675 | ||
|
|
12f3ca9d1f | ||
|
|
7e7944a30c | ||
|
|
53c17aea96 |
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2022 jdhao
|
||||
Copyright (c) 2018-2023 jdhao
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
10
README.md
10
README.md
@@ -13,7 +13,7 @@
|
||||
<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.8.1-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
||||
<img src="https://img.shields.io/badge/Neovim-0.9.5-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"/>
|
||||
@@ -21,8 +21,8 @@
|
||||
<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.8.1">
|
||||
<img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.8.1?style=flat-square" />
|
||||
<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" />
|
||||
@@ -57,7 +57,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
||||
|
||||
# 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).
|
||||
+ 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).
|
||||
@@ -69,7 +69,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
||||
+ Fast buffer jump via [hop.nvim](https://github.com/phaazon/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/kyazdani42/nvim-tree.lua).
|
||||
+ 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).
|
||||
|
||||
6
after/ftplugin/json.vim
Normal file
6
after/ftplugin/json.vim
Normal file
@@ -0,0 +1,6 @@
|
||||
" let the initial folding state be that all folds are closed.
|
||||
set foldlevel=0
|
||||
|
||||
" Use nvim-treesitter for folding
|
||||
set foldmethod=expr
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
||||
@@ -128,11 +128,22 @@ endfunction
|
||||
|
||||
" Output current time or unix timestamp in human-readable format.
|
||||
function! utils#iso_time(timestamp) abort
|
||||
if a:timestamp
|
||||
return strftime('%Y-%m-%d %H:%M:%S%z', a:timestamp)
|
||||
" Get current datetime
|
||||
if !a:timestamp
|
||||
return strftime('%Y-%m-%d %H:%M:%S%z')
|
||||
endif
|
||||
|
||||
return strftime('%Y-%m-%d %H:%M:%S%z')
|
||||
" this timestamp in expressed in milliseconds
|
||||
if len(a:timestamp) == 13
|
||||
let l:timestamp = a:timestamp[:-4]
|
||||
" this timestamp in expressed in microseconds
|
||||
elseif len(a:timestamp) == 16
|
||||
let l:timestamp = a:timestamp[:-7]
|
||||
else
|
||||
let l:timestamp = a:timestamp
|
||||
endif
|
||||
return strftime('%Y-%m-%d %H:%M:%S%z', l:timestamp)
|
||||
|
||||
endfunction
|
||||
|
||||
" Check if we are inside a Git repo.
|
||||
@@ -141,9 +152,7 @@ function! utils#Inside_git_repo() abort
|
||||
if match(res, 'true') == -1
|
||||
return v:false
|
||||
else
|
||||
" Manually trigger a special user autocmd InGitRepo (to use it for
|
||||
" lazyloading of fugitive by packer.nvim).
|
||||
" See also https://github.com/wbthomason/packer.nvim/discussions/534.
|
||||
" Manually trigger a special user autocmd InGitRepo (used lazyloading.
|
||||
doautocmd User InGitRepo
|
||||
return v:true
|
||||
endif
|
||||
|
||||
@@ -65,7 +65,7 @@ pip install -U pynvim
|
||||
[python-lsp-server (pylsp)](https://github.com/python-lsp/python-lsp-server) is a Python [Language Server](https://microsoft.github.io/language-server-protocol/) for completion, linting, go to definition, etc.
|
||||
|
||||
```
|
||||
pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort
|
||||
pip install 'python-lsp-server[all]' pylsp-mypy python-lsp-isort python-lsp-black
|
||||
```
|
||||
|
||||
Note the executable for pylsp is also named `pylsp`. You need to set its PATH correctly.
|
||||
@@ -111,7 +111,7 @@ vim-language-server is installed in the same directory as the node executable.
|
||||
|
||||
### 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.
|
||||
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.
|
||||
|
||||
### 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
|
||||
|
||||
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 .
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
[^1]: Use `echo %userprofile%` to see where your `$HOME` is.
|
||||
|
||||
@@ -68,7 +68,7 @@ fi
|
||||
|
||||
# Install some Python packages used by Nvim plugins.
|
||||
echo "Installing Python packages"
|
||||
declare -a PY_PACKAGES=("pynvim" 'python-lsp-server[all]' "black" "vim-vint" "pyls-isort" "pylsp-mypy")
|
||||
declare -a PY_PACKAGES=("pynvim" 'python-lsp-server[all]' "vim-vint" "python-lsp-isort" "pylsp-mypy" "python-lsp-black")
|
||||
|
||||
if [[ "$SYSTEM_PYTHON" = true ]]; then
|
||||
echo "Using system Python to install $(PY_PACKAGES)"
|
||||
@@ -124,27 +124,27 @@ fi
|
||||
#######################################################################
|
||||
# lua-language-server #
|
||||
#######################################################################
|
||||
SUMNEKO_LUA_DIR=$HOME/tools/lua-language-server
|
||||
SUMNEKO_LUA_SRC_NAME=$HOME/packages/lua-language-server.tar.gz
|
||||
SUMNEKO_LUA_LINK="https://github.com/sumneko/lua-language-server/releases/download/3.5.3/lua-language-server-3.5.3-linux-x64.tar.gz"
|
||||
LUA_LS_DIR=$HOME/tools/lua-language-server
|
||||
LUA_LS_SRC=$HOME/packages/lua-language-server.tar.gz
|
||||
LUA_LS_LINK="https://github.com/LuaLS/lua-language-server/releases/download/3.6.11/lua-language-server-3.6.11-linux-x64.tar.gz"
|
||||
|
||||
if [[ -z "$(command -v lua-language-server)" ]] && [[ ! -f "$SUMNEKO_LUA_DIR/bin/lua-language-server" ]]; then
|
||||
if [[ -z "$(command -v lua-language-server)" ]] && [[ ! -f "$LUA_LS_DIR/bin/lua-language-server" ]]; then
|
||||
echo 'Install lua-language-server'
|
||||
if [[ ! -f $SUMNEKO_LUA_SRC_NAME ]]; then
|
||||
if [[ ! -f $LUA_LS_SRC ]]; then
|
||||
echo "Downloading lua-language-server and renaming"
|
||||
wget $SUMNEKO_LUA_LINK -O "$SUMNEKO_LUA_SRC_NAME"
|
||||
wget $LUA_LS_LINK -O "$LUA_LS_SRC"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$SUMNEKO_LUA_DIR" ]]; then
|
||||
if [[ ! -d "$LUA_LS_DIR" ]]; then
|
||||
echo "Creating lua-language-server directory under tools directory"
|
||||
mkdir -p "$SUMNEKO_LUA_DIR"
|
||||
echo "Extracting to directory $SUMNEKO_LUA_DIR"
|
||||
mkdir -p "$LUA_LS_DIR"
|
||||
echo "Extracting to directory $LUA_LS_DIR"
|
||||
|
||||
tar zxvf "$SUMNEKO_LUA_SRC_NAME" -C "$SUMNEKO_LUA_DIR"
|
||||
tar zxvf "$LUA_LS_SRC" -C "$LUA_LS_DIR"
|
||||
fi
|
||||
|
||||
if [[ "$ADD_TO_SYSTEM_PATH" = true ]] && [[ "$USE_BASH_SHELL" = true ]]; then
|
||||
echo "export PATH=\"$SUMNEKO_LUA_DIR/bin:\$PATH\"" >> "$HOME/.bash_profile"
|
||||
echo "export PATH=\"$LUA_LS_DIR/bin:\$PATH\"" >> "$HOME/.bash_profile"
|
||||
fi
|
||||
else
|
||||
echo "lua-language-server is already installed. Skip installing it."
|
||||
@@ -252,13 +252,7 @@ fi
|
||||
|
||||
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"
|
||||
"$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!"
|
||||
|
||||
@@ -27,7 +27,7 @@ scoop install miniconda3
|
||||
pip install -U pynvim
|
||||
|
||||
# Install python-language-server
|
||||
pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort
|
||||
pip install 'python-lsp-server[all]' pylsp-mypy python-lsp-isort
|
||||
|
||||
# Install visual c++ redistribution
|
||||
scoop install vcredist2022
|
||||
@@ -36,19 +36,19 @@ scoop install vcredist2022
|
||||
scoop install 7zip
|
||||
|
||||
# Install lua-language-server
|
||||
$sumneko_lua_link = "https://github.com/sumneko/lua-language-server/releases/download/3.5.3/lua-language-server-3.5.3-win32-x64.zip"
|
||||
$sumneko_lua_install_dir = "D:\portable_tools"
|
||||
$sumneko_lua_src_dir = "$sumneko_lua_install_dir\lua-language-server.zip"
|
||||
$sumneko_lua_dir = "$sumneko_lua_install_dir\lua-language-server"
|
||||
$lua_ls_link = "https://github.com/LuaLS/lua-language-server/releases/download/3.6.11/lua-language-server-3.6.11-win32-x64.zip"
|
||||
$lua_ls_install_dir = "D:\portable_tools"
|
||||
$lua_ls_src_path = "$lua_ls_install_dir\lua-language-server.zip"
|
||||
$lua_ls_dir = "$lua_ls_install_dir\lua-language-server"
|
||||
|
||||
# Download file, ref: https://stackoverflow.com/a/51225744/6064933
|
||||
Invoke-WebRequest $sumneko_lua_link -OutFile "$sumneko_lua_src_dir"
|
||||
Invoke-WebRequest $lua_ls_link -OutFile "$lua_ls_src_path"
|
||||
|
||||
# Extract the zip file using 7zip, ref: https://stackoverflow.com/a/41933215/6064933
|
||||
7z x "$sumneko_lua_src_dir" -o"$sumneko_lua_dir"
|
||||
7z x "$lua_ls_src_path" -o"$lua_ls_dir"
|
||||
|
||||
# Setup PATH env variable, ref: https://stackoverflow.com/q/714877/6064933
|
||||
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$sumneko_lua_dir\bin", "Machine")
|
||||
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$lua_ls_dir\bin", "Machine")
|
||||
|
||||
# Install neovim nightly
|
||||
scoop bucket add versions
|
||||
|
||||
36
init.lua
36
init.lua
@@ -4,21 +4,24 @@
|
||||
-- I would not recommend cloning this repo and replace your own config. Good configurations are personal,
|
||||
-- built over time with a lot of polish.
|
||||
--
|
||||
-- Author: Jie-dong Hao
|
||||
-- Author: Jiedong Hao
|
||||
-- Email: jdhao@hotmail.com
|
||||
-- Blog: https://jdhao.github.io/
|
||||
-- GitHub: https://github.com/jdhao
|
||||
-- StackOverflow: https://stackoverflow.com/users/6064933/jdhao
|
||||
vim.loader.enable()
|
||||
|
||||
local api = vim.api
|
||||
local utils = require("utils")
|
||||
local version = vim.version
|
||||
|
||||
-- check if we have the latest stable version of nvim
|
||||
local expected_ver = "0.8.1"
|
||||
local nvim_ver = utils.get_nvim_version()
|
||||
local expected_ver = "0.9.5"
|
||||
local ev = version.parse(expected_ver)
|
||||
local actual_ver = version()
|
||||
|
||||
if nvim_ver ~= expected_ver then
|
||||
local msg = string.format("Unsupported nvim version: expect %s, but got %s instead!", expected_ver, nvim_ver)
|
||||
api.nvim_err_writeln(msg)
|
||||
return
|
||||
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 msg = string.format("Expect nvim %s, but got %s instead. Use at your own risk!", expected_ver, _ver)
|
||||
vim.api.nvim_err_writeln(msg)
|
||||
end
|
||||
|
||||
local core_conf_files = {
|
||||
@@ -30,9 +33,16 @@ local core_conf_files = {
|
||||
"colorschemes.lua", -- colorscheme settings
|
||||
}
|
||||
|
||||
local viml_conf_dir = vim.fn.stdpath("config") .. "/viml_conf"
|
||||
-- source all the core config files
|
||||
for _, name in ipairs(core_conf_files) do
|
||||
local path = string.format("%s/core/%s", vim.fn.stdpath("config"), name)
|
||||
local source_cmd = "source " .. path
|
||||
vim.cmd(source_cmd)
|
||||
for _, file_name in ipairs(core_conf_files) do
|
||||
if vim.endswith(file_name, 'vim') then
|
||||
local path = string.format("%s/%s", viml_conf_dir, file_name)
|
||||
local source_cmd = "source " .. path
|
||||
vim.cmd(source_cmd)
|
||||
else
|
||||
local module_name, _ = string.gsub(file_name, "%.lua", "")
|
||||
package.loaded[module_name] = nil
|
||||
require(module_name)
|
||||
end
|
||||
end
|
||||
|
||||
87
lazy-lock.json
Normal file
87
lazy-lock.json
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"LeaderF": { "branch": "master", "commit": "a77f45791edeaa82fa75c5959ca73a59d7549549" },
|
||||
"asyncrun.vim": { "branch": "master", "commit": "61cc3081963a12048e00e89f8cedc8bd1cb83b8c" },
|
||||
"better-escape.vim": { "branch": "master", "commit": "6b16a45a839727977277f6ab11bded63e9ed86bb" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "357cc8f8eeb64702e6fcf2995e3b9becee99a5d3" },
|
||||
"catppuccin": { "branch": "main", "commit": "fc537040147f0374a22b88142a20eb6781141f0b" },
|
||||
"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": "4ef610bbd85a5ee4e97e09450c0daecbdc60de86" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"committia.vim": { "branch": "master", "commit": "0b4df1a7f48ffbc23b009bd14d58ee1be541917c" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "8721edccead31c07c2cda0bc5ac75b0491b5adcd" },
|
||||
"delimitMate": { "branch": "master", "commit": "537a1da0fa5eeb88640425c37e545af933c56e1b" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "1f2d1206a03bd3add8aedf6251e4534611de577f" },
|
||||
"edge": { "branch": "master", "commit": "a4fd4f458331d42677d992f428235c491b2016aa" },
|
||||
"emmylua-nvim": { "branch": "master", "commit": "c8f3c20276041c2b847cf041bca5928671b2eaa0" },
|
||||
"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": "ff01d34daaed72f271a8ffa088a7e839a60c640f" },
|
||||
"gruvbox-material": { "branch": "master", "commit": "c75bf1e96fdc33b8b3b613e5172a0acdba198fca" },
|
||||
"hop.nvim": { "branch": "master", "commit": "1cbaa79457e6b5e9b04e6d5d8d19bd6b65ffa2be" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "0fe34b4c1b926e106d105d3ae88ef6cbf6743572" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "33c447b96e1cb1a5a2be87982d5d32bb5054079d" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
|
||||
"material.nvim": { "branch": "main", "commit": "6989f7e0076f4fa4e01056bd62c785cf0fef4caf" },
|
||||
"monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
|
||||
"neoformat": { "branch": "master", "commit": "aedb6f9d3f53d5da229095f7d761d749f8c5c7e0" },
|
||||
"nightfox.nvim": { "branch": "main", "commit": "fe2fc7b93d66349eff2c5baa6cec922ee3958f56" },
|
||||
"nord.nvim": { "branch": "master", "commit": "0a22a387c92bb3b46e3d245522712ae7497bec38" },
|
||||
"nvim-bqf": { "branch": "main", "commit": "8784eebf34371049b641646d00232c2603215297" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
||||
"nvim-hlslens": { "branch": "main", "commit": "f0281591a59e95400babf61a96e59ba20e5c9533" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "cab7233cd6a89ec952dfd40c4b74341b1165830e" },
|
||||
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "53b0bcaadaffb505acff230578b56a86ec1ab38a" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "783e5fc3079680b307e8ac518935317907e71a59" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "a1e6268779411048a87f767a27380089362a0ce2" },
|
||||
"onedark.nvim": { "branch": "master", "commit": "826fb77e9ca92d3c0f3d937328663d4a6dc7fee1" },
|
||||
"onedarkpro.nvim": { "branch": "main", "commit": "7c02b4eeb310173ef6d741e60200d72b76923eae" },
|
||||
"open-browser.vim": { "branch": "master", "commit": "7d4c1d8198e889d513a030b5a83faa07606bac27" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
|
||||
"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": "74ce793a60759e3db0d265174f137fb627430355" },
|
||||
"ultisnips": { "branch": "master", "commit": "f6d1501b630cb783b0af8507c5588328f826d40f" },
|
||||
"unicode.vim": { "branch": "master", "commit": "bc20d0fb3331a7b41708388c56bb8221c2104da7" },
|
||||
"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": "cbe9dfa162c178946afa689dd3f42d4ea8bf89c1" },
|
||||
"vim-grammarous": { "branch": "master", "commit": "db46357465ce587d5325e816235b5e92415f8c05" },
|
||||
"vim-highlighturl": { "branch": "master", "commit": "012fee983e03913db6ba6393307eac434999b896" },
|
||||
"vim-indent-object": { "branch": "master", "commit": "5c5b24c959478929b54a9e831a8e2e651a465965" },
|
||||
"vim-markdown": { "branch": "master", "commit": "4e9b4deda11d05a157ab34e97f76089669b5b7af" },
|
||||
"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": "cbb20643b7bfe721902dac5760bf0d4889fb5f7e" },
|
||||
"vista.vim": { "branch": "master", "commit": "58dabc027909330970ac549e52bf799a723878c5" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" },
|
||||
"whitespace.nvim": { "branch": "master", "commit": "f0fc9e9c4ce3f7d2166e9e5a069b64b9ca4a3f15" },
|
||||
"wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" },
|
||||
"yanky.nvim": { "branch": "main", "commit": "cc3fc03c780a14f189290edcf1c47dc1306626d4" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" }
|
||||
}
|
||||
@@ -16,7 +16,6 @@ M.colorscheme2dir = {
|
||||
nightfox = "nightfox.nvim",
|
||||
kanagawa = "kanagawa.nvim",
|
||||
catppuccin = "catppuccin",
|
||||
rose_pine = "rose-pine",
|
||||
onedarkpro = "onedarkpro.nvim",
|
||||
monokai = "monokai.nvim",
|
||||
material = "material.nvim",
|
||||
@@ -94,23 +93,9 @@ M.catppuccin = function()
|
||||
vim.cmd([[colorscheme catppuccin]])
|
||||
end
|
||||
|
||||
M.rose_pine = function()
|
||||
require('rose-pine').setup({
|
||||
--- @usage 'main' | 'moon'
|
||||
dark_variant = 'moon',
|
||||
})
|
||||
|
||||
-- set colorscheme after options
|
||||
vim.cmd('colorscheme rose-pine')
|
||||
end
|
||||
|
||||
M.onedarkpro = function()
|
||||
require("onedarkpro").setup({
|
||||
dark_theme = "onedark", -- The default dark theme
|
||||
})
|
||||
|
||||
-- set colorscheme after options
|
||||
vim.cmd('colorscheme onedarkpro')
|
||||
vim.cmd('colorscheme onedark_vivid')
|
||||
end
|
||||
|
||||
M.monokai = function()
|
||||
@@ -133,16 +118,6 @@ M.rand_colorscheme = function()
|
||||
return
|
||||
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
|
||||
M[colorscheme]()
|
||||
|
||||
@@ -9,7 +9,7 @@ require("bufferline").setup {
|
||||
icon = "▎", -- this should be omitted if indicator style is not 'icon'
|
||||
style = "icon",
|
||||
},
|
||||
buffer_close_icon = "",
|
||||
buffer_close_icon = "",
|
||||
modified_icon = "●",
|
||||
close_icon = "",
|
||||
left_trunc_marker = "",
|
||||
|
||||
@@ -2,7 +2,8 @@ local api = vim.api
|
||||
local keymap = vim.keymap
|
||||
local dashboard = require("dashboard")
|
||||
|
||||
dashboard.custom_header = {
|
||||
local conf = {}
|
||||
conf.header = {
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
@@ -18,46 +19,52 @@ dashboard.custom_header = {
|
||||
" ",
|
||||
}
|
||||
|
||||
dashboard.custom_center = {
|
||||
conf.center = {
|
||||
{
|
||||
icon = " ",
|
||||
icon = " ",
|
||||
desc = "Find File ",
|
||||
action = "Leaderf file --popup",
|
||||
shortcut = "<Leader> f f",
|
||||
key = "<Leader> f f",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
icon = " ",
|
||||
desc = "Recently opened files ",
|
||||
action = "Leaderf mru --popup",
|
||||
shortcut = "<Leader> f r",
|
||||
key = "<Leader> f r",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
icon = " ",
|
||||
desc = "Project grep ",
|
||||
action = "Leaderf rg --popup",
|
||||
shortcut = "<Leader> f g",
|
||||
key = "<Leader> f g",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
icon = " ",
|
||||
desc = "Open Nvim config ",
|
||||
action = "tabnew $MYVIMRC | tcd %:p:h",
|
||||
shortcut = "<Leader> e v",
|
||||
key = "<Leader> e v",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "New file ",
|
||||
action = "enew",
|
||||
shortcut = "e ",
|
||||
key = "e",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
icon = " ",
|
||||
desc = "Quit Nvim ",
|
||||
-- desc = "Quit Nvim ",
|
||||
action = "qa",
|
||||
shortcut = "q ",
|
||||
key = "q",
|
||||
},
|
||||
}
|
||||
|
||||
dashboard.setup({
|
||||
theme = 'doom',
|
||||
shortcut_type = 'number',
|
||||
config = conf
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd("FileType", {
|
||||
pattern = "dashboard",
|
||||
group = api.nvim_create_augroup("dashboard_enter", { clear = true }),
|
||||
|
||||
@@ -2,24 +2,36 @@ local keymap = vim.keymap
|
||||
local gitlinker = require("gitlinker")
|
||||
|
||||
gitlinker.setup {
|
||||
callbacks = {
|
||||
["dev.azure.com"] = function(url_data)
|
||||
vim.print(url_data)
|
||||
local url = require"gitlinker.hosts".get_base_https_url(url_data)
|
||||
|
||||
if url_data.lstart then
|
||||
if url_data.lend == nil then
|
||||
url_data.lend = url_data.lstart
|
||||
end
|
||||
url = url .. "?path=/" .. url_data.file .. "&version=GC" .. url_data.rev .. "&line=" .. url_data.lstart .. "&lineEnd=" .. url_data.lend .. "&lineStartColumn=1" .. "&lineEndColumn=120"
|
||||
end
|
||||
return url
|
||||
end
|
||||
},
|
||||
mappings = nil,
|
||||
}
|
||||
|
||||
keymap.set({ "n", "v" }, "<leader>gl", "", {
|
||||
keymap.set({ "n", "v" }, "<leader>gl", function()
|
||||
local mode = string.lower(vim.fn.mode())
|
||||
gitlinker.get_buf_range_url(mode)
|
||||
end, {
|
||||
silent = true,
|
||||
desc = "get git permlink",
|
||||
callback = function()
|
||||
local mode = string.lower(vim.fn.mode())
|
||||
gitlinker.get_buf_range_url(mode)
|
||||
end,
|
||||
})
|
||||
|
||||
keymap.set("n", "<leader>gb", "", {
|
||||
keymap.set("n", "<leader>gb", function()
|
||||
gitlinker.get_repo_url({
|
||||
action_callback = gitlinker.actions.open_in_browser
|
||||
})
|
||||
end, {
|
||||
silent = true,
|
||||
desc = "browse repo in browser",
|
||||
callback = function()
|
||||
gitlinker.get_repo_url({
|
||||
action_callback = gitlinker.actions.open_in_browser
|
||||
})
|
||||
end
|
||||
})
|
||||
|
||||
@@ -12,10 +12,11 @@ local activate_hlslens = function(direction)
|
||||
local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction)
|
||||
local status, msg = pcall(vim.cmd, cmd)
|
||||
|
||||
-- Deal with the case that there is no such pattern in current buffer.
|
||||
if not status then
|
||||
-- 13 is the index where real error message starts
|
||||
msg = msg:sub(13)
|
||||
api.nvim_err_writeln(msg)
|
||||
local start_idx, _ = string.find(msg, 'E486', 1, true)
|
||||
local msg_part = string.sub(msg, start_idx)
|
||||
api.nvim_err_writeln(msg_part)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
local api = vim.api
|
||||
|
||||
local exclude_ft = { "help", "git", "markdown", "snippets", "text", "gitconfig", "alpha" }
|
||||
require("indent_blankline").setup {
|
||||
-- U+2502 may also be a good choice, it will be on the middle of cursor.
|
||||
-- U+250A is also a good choice
|
||||
char = "▏",
|
||||
show_end_of_line = false,
|
||||
disable_with_nolist = true,
|
||||
buftype_exclude = { "terminal" },
|
||||
filetype_exclude = exclude_ft,
|
||||
local exclude_ft = { "help", "git", "markdown", "snippets", "text", "gitconfig", "alpha", "dashboard" }
|
||||
|
||||
require("ibl").setup {
|
||||
indent = {
|
||||
-- -- U+2502 may also be a good choice, it will be on the middle of cursor.
|
||||
-- -- U+250A is also a good choice
|
||||
char = "▏",
|
||||
},
|
||||
scope = {
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
},
|
||||
exclude = {
|
||||
filetypes = exclude_ft,
|
||||
buftypes = { "terminal" },
|
||||
},
|
||||
}
|
||||
|
||||
local gid = api.nvim_create_augroup("indent_blankline", { clear = true })
|
||||
api.nvim_create_autocmd("InsertEnter", {
|
||||
pattern = "*",
|
||||
group = gid,
|
||||
command = "IndentBlanklineDisable",
|
||||
command = "IBLDisable",
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd("InsertLeave", {
|
||||
@@ -23,7 +30,7 @@ api.nvim_create_autocmd("InsertLeave", {
|
||||
group = gid,
|
||||
callback = function()
|
||||
if not vim.tbl_contains(exclude_ft, vim.bo.filetype) then
|
||||
vim.cmd([[IndentBlanklineEnable]])
|
||||
vim.cmd([[IBLEnable]])
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -6,6 +6,18 @@ local diagnostic = vim.diagnostic
|
||||
|
||||
local utils = require("utils")
|
||||
|
||||
-- set quickfix list from diagnostics in a certain buffer, not the whole workspace
|
||||
local set_qflist = function(buf_num, severity)
|
||||
local diagnostics = nil
|
||||
diagnostics = diagnostic.get(buf_num, { severity = severity })
|
||||
|
||||
local qf_items = diagnostic.toqflist(diagnostics)
|
||||
vim.fn.setqflist({}, ' ', { title = 'Diagnostics', items = qf_items })
|
||||
|
||||
-- open quickfix by default
|
||||
vim.cmd[[copen]]
|
||||
end
|
||||
|
||||
local custom_attach = function(client, bufnr)
|
||||
-- Mappings.
|
||||
local map = function(mode, l, r, opts)
|
||||
@@ -23,7 +35,10 @@ local custom_attach = function(client, bufnr)
|
||||
map("n", "gr", vim.lsp.buf.references, { desc = "show references" })
|
||||
map("n", "[d", diagnostic.goto_prev, { desc = "previous diagnostic" })
|
||||
map("n", "]d", diagnostic.goto_next, { desc = "next diagnostic" })
|
||||
map("n", "<space>q", diagnostic.setqflist, { desc = "put diagnostic to qf" })
|
||||
-- this puts diagnostics from opened files to quickfix
|
||||
map("n", "<space>qw", diagnostic.setqflist, { desc = "put window diagnostics to qf" })
|
||||
-- this puts diagnostics from current buffer to quickfix
|
||||
map("n", "<space>qb", function() set_qflist(bufnr) end, { desc = "put buffer diagnostics to qf" })
|
||||
map("n", "<space>ca", vim.lsp.buf.code_action, { desc = "LSP code action" })
|
||||
map("n", "<space>wa", vim.lsp.buf.add_workspace_folder, { desc = "add workspace folder" })
|
||||
map("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, { desc = "remove workspace folder" })
|
||||
@@ -99,17 +114,40 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
if utils.executable("pylsp") then
|
||||
local venv_path = os.getenv('VIRTUAL_ENV')
|
||||
local py_path = nil
|
||||
-- decide which python executable to use for mypy
|
||||
if venv_path ~= nil then
|
||||
py_path = venv_path .. "/bin/python3"
|
||||
else
|
||||
py_path = vim.g.python3_host_prog
|
||||
end
|
||||
|
||||
lspconfig.pylsp.setup {
|
||||
on_attach = custom_attach,
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
-- formatter options
|
||||
black = { enabled = true },
|
||||
autopep8 = { enabled = false },
|
||||
yapf = { enabled = false },
|
||||
-- linter options
|
||||
pylint = { enabled = true, executable = "pylint" },
|
||||
ruff = { enabled = false },
|
||||
pyflakes = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
-- type checker
|
||||
pylsp_mypy = {
|
||||
enabled = true,
|
||||
overrides = { "--python-executable", py_path, true },
|
||||
report_progress = true,
|
||||
live_mode = false
|
||||
},
|
||||
-- auto-completion options
|
||||
jedi_completion = { fuzzy = true },
|
||||
pyls_isort = { enabled = true },
|
||||
pylsp_mypy = { enabled = true },
|
||||
-- import sorting
|
||||
isort = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -131,6 +169,20 @@ end
|
||||
-- vim.notify("pyright not found!", vim.log.levels.WARN, {title = 'Nvim-config'})
|
||||
-- end
|
||||
|
||||
if utils.executable("ltex-ls") then
|
||||
lspconfig.ltex.setup {
|
||||
on_attach = custom_attach,
|
||||
cmd = { "ltex-ls" },
|
||||
filetypes = { "text", "plaintex", "tex", "markdown" },
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "en"
|
||||
},
|
||||
},
|
||||
flags = { debounce_text_changes = 300 },
|
||||
}
|
||||
end
|
||||
|
||||
if utils.executable("clangd") then
|
||||
lspconfig.clangd.setup {
|
||||
on_attach = custom_attach,
|
||||
@@ -140,8 +192,6 @@ if utils.executable("clangd") then
|
||||
debounce_text_changes = 500,
|
||||
},
|
||||
}
|
||||
else
|
||||
vim.notify("clangd not found!", vim.log.levels.WARN, { title = "Nvim-config" })
|
||||
end
|
||||
|
||||
-- set up vim-language-server
|
||||
@@ -166,8 +216,8 @@ if utils.executable("bash-language-server") then
|
||||
end
|
||||
|
||||
if utils.executable("lua-language-server") then
|
||||
-- settings for lua-language-server can be found on https://github.com/sumneko/lua-language-server/wiki/Settings .
|
||||
lspconfig.sumneko_lua.setup {
|
||||
-- settings for lua-language-server can be found on https://github.com/LuaLS/lua-language-server/wiki/Settings .
|
||||
lspconfig.lua_ls.setup {
|
||||
on_attach = custom_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
@@ -181,10 +231,10 @@ if utils.executable("lua-language-server") then
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files,
|
||||
-- see also https://github.com/sumneko/lua-language-server/wiki/Libraries#link-to-workspace .
|
||||
-- Lua-dev.nvim also has similar settings for sumneko lua, https://github.com/folke/lua-dev.nvim/blob/main/lua/lua-dev/sumneko.lua .
|
||||
-- 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 .
|
||||
library = {
|
||||
fn.stdpath("data") .. "/site/pack/packer/opt/emmylua-nvim",
|
||||
fn.stdpath("data") .. "/lazy/emmylua-nvim",
|
||||
fn.stdpath("config"),
|
||||
},
|
||||
maxPreload = 2000,
|
||||
@@ -197,10 +247,10 @@ if utils.executable("lua-language-server") then
|
||||
end
|
||||
|
||||
-- Change diagnostic signs.
|
||||
fn.sign_define("DiagnosticSignError", { text = "✗", texthl = "DiagnosticSignError" })
|
||||
fn.sign_define("DiagnosticSignWarn", { text = "!", texthl = "DiagnosticSignWarn" })
|
||||
fn.sign_define("DiagnosticSignInformation", { text = "", texthl = "DiagnosticSignInfo" })
|
||||
fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||
fn.sign_define("DiagnosticSignError", { text = '🆇', texthl = "DiagnosticSignError" })
|
||||
fn.sign_define("DiagnosticSignWarn", { text = '⚠️', texthl = "DiagnosticSignWarn" })
|
||||
fn.sign_define("DiagnosticSignInfo", { text = 'ℹ️', texthl = "DiagnosticSignInfo" })
|
||||
fn.sign_define("DiagnosticSignHint", { text = '', texthl = "DiagnosticSignHint" })
|
||||
|
||||
-- global config for diagnostic
|
||||
diagnostic.config {
|
||||
|
||||
@@ -7,26 +7,16 @@ nvim_tree.setup {
|
||||
hijack_cursor = false,
|
||||
hijack_netrw = true,
|
||||
hijack_unnamed_buffer_when_opening = false,
|
||||
ignore_buffer_on_setup = false,
|
||||
open_on_setup = false,
|
||||
open_on_setup_file = false,
|
||||
open_on_tab = false,
|
||||
sort_by = "name",
|
||||
update_cwd = false,
|
||||
view = {
|
||||
width = 30,
|
||||
hide_root_folder = false,
|
||||
side = "left",
|
||||
preserve_window_proportions = false,
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
signcolumn = "yes",
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {
|
||||
-- user mappings go here
|
||||
},
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
@@ -50,7 +40,6 @@ nvim_tree.setup {
|
||||
update_cwd = false,
|
||||
ignore_list = {},
|
||||
},
|
||||
ignore_ft_on_setup = {},
|
||||
system_open = {
|
||||
cmd = "",
|
||||
args = {},
|
||||
@@ -89,7 +78,7 @@ nvim_tree.setup {
|
||||
enable = true,
|
||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||
exclude = {
|
||||
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
|
||||
filetype = { "notify", "qf", "diff", "fugitive", "fugitiveblame" },
|
||||
buftype = { "nofile", "terminal", "help" },
|
||||
},
|
||||
},
|
||||
@@ -113,6 +102,7 @@ nvim_tree.setup {
|
||||
},
|
||||
}
|
||||
|
||||
keymap.set("n", "<space>s", function()
|
||||
return require("nvim-tree").toggle(false, true)
|
||||
end, { silent = true, desc = "toggle nvim-tree" })
|
||||
keymap.set("n", "<space>s", require("nvim-tree.api").tree.toggle, {
|
||||
silent = true,
|
||||
desc = "toggle nvim-tree",
|
||||
})
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
vim.cmd([[hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff]])
|
||||
vim.cmd([[hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff]])
|
||||
vim.cmd([[hi HopNextKey2 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff]])
|
||||
|
||||
local keymap = vim.keymap
|
||||
local hop = require("hop")
|
||||
hop.setup {
|
||||
@@ -18,3 +14,14 @@ keymap.set({ "n", "v", "o" }, "f", "", {
|
||||
end,
|
||||
desc = "nvim-hop char2",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
pattern = "*",
|
||||
callback = function ()
|
||||
vim.cmd([[
|
||||
hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||
hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||
hi HopNextKey2 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||
]])
|
||||
end
|
||||
})
|
||||
|
||||
@@ -93,10 +93,31 @@ local diff = function()
|
||||
local add_num = git_status.added
|
||||
|
||||
local info = { added = add_num, modified = modify_num, removed = remove_num }
|
||||
-- vim.pretty_print(info)
|
||||
-- vim.print(info)
|
||||
return info
|
||||
end
|
||||
|
||||
local virtual_env = function()
|
||||
-- only show virtual env for Python
|
||||
if vim.bo.filetype ~= 'python' then
|
||||
return ""
|
||||
end
|
||||
|
||||
local conda_env = os.getenv('CONDA_DEFAULT_ENV')
|
||||
local venv_path = os.getenv('VIRTUAL_ENV')
|
||||
|
||||
if venv_path == nil then
|
||||
if conda_env == nil then
|
||||
return ""
|
||||
else
|
||||
return string.format(" %s (conda)", conda_env)
|
||||
end
|
||||
else
|
||||
local venv_name = vim.fn.fnamemodify(venv_path, ':t')
|
||||
return string.format(" %s (venv)", venv_name)
|
||||
end
|
||||
end
|
||||
|
||||
require("lualine").setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
@@ -116,6 +137,10 @@ require("lualine").setup {
|
||||
"diff",
|
||||
source = diff,
|
||||
},
|
||||
{
|
||||
virtual_env,
|
||||
color = { fg = 'black', bg = "#F1CA81" }
|
||||
}
|
||||
},
|
||||
lualine_c = {
|
||||
"filename",
|
||||
@@ -127,6 +152,11 @@ require("lualine").setup {
|
||||
spell,
|
||||
color = { fg = "black", bg = "#a7c080" },
|
||||
},
|
||||
{
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
symbols = {error = '🆇 ', warn = '⚠️ ', info = 'ℹ️ ', hint = ' '},
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
"encoding",
|
||||
@@ -140,13 +170,11 @@ require("lualine").setup {
|
||||
},
|
||||
"filetype",
|
||||
},
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = {
|
||||
lualine_y = {
|
||||
"location",
|
||||
{
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
},
|
||||
"progress",
|
||||
},
|
||||
lualine_z = {
|
||||
{
|
||||
trailing_space,
|
||||
color = "WarningMsg",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
require("nvim-treesitter.configs").setup {
|
||||
ensure_installed = { "python", "cpp", "lua", "vim" },
|
||||
ensure_installed = { "python", "cpp", "lua", "vim", "json", "toml" },
|
||||
ignore_install = {}, -- List of parsers to ignore installing
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
|
||||
13
lua/config/yanky.lua
Normal file
13
lua/config/yanky.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
require("yanky").setup({
|
||||
ring = {
|
||||
history_length = 50,
|
||||
storage = "memory",
|
||||
},
|
||||
preserve_cursor_position = {
|
||||
enabled = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- cycle through the yank history, only work after paste
|
||||
vim.keymap.set("n", "[y", "<Plug>(YankyCycleForward)")
|
||||
vim.keymap.set("n", "]y", "<Plug>(YankyCycleBackward)")
|
||||
@@ -17,14 +17,33 @@ api.nvim_create_autocmd({ "BufRead" }, {
|
||||
})
|
||||
|
||||
-- highlight yanked region, see `:h lua-highlight`
|
||||
local yank_group = api.nvim_create_augroup("highlight_yank", { clear = true })
|
||||
api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||
pattern = "*",
|
||||
group = api.nvim_create_augroup("highlight_yank", { clear = true }),
|
||||
group = yank_group,
|
||||
callback = function()
|
||||
vim.highlight.on_yank { higroup = "YankColor", timeout = 300 }
|
||||
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
|
||||
api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
pattern = "*",
|
||||
|
||||
@@ -5,7 +5,7 @@ local utils = require('utils')
|
||||
|
||||
-- Inspect something
|
||||
function _G.inspect(item)
|
||||
vim.pretty_print(item)
|
||||
vim.print(item)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------
|
||||
@@ -201,20 +201,6 @@ end
|
||||
-- insert semicolon in the end
|
||||
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
|
||||
keymap.set("i", "<C-A>", "<HOME>")
|
||||
keymap.set("i", "<C-E>", "<END>")
|
||||
502
lua/plugin_specs.lua
Normal file
502
lua/plugin_specs.lua
Normal file
@@ -0,0 +1,502 @@
|
||||
local utils = require("utils")
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system {
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
}
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- check if firenvim is active
|
||||
local firenvim_not_active = function()
|
||||
return not vim.g.started_by_firenvim
|
||||
end
|
||||
|
||||
local plugin_specs = {
|
||||
-- auto-completion engine
|
||||
{
|
||||
"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,
|
||||
},
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufRead", "BufNewFile" },
|
||||
config = function()
|
||||
require("config.lsp")
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
enabled = function()
|
||||
if vim.g.is_mac then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
event = "VeryLazy",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("config.treesitter")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Python indent (follows the PEP8 style)
|
||||
{ "Vimjas/vim-python-pep8-indent", ft = { "python" } },
|
||||
|
||||
-- Python-related text object
|
||||
{ "jeetsukumaran/vim-pythonsense", ft = { "python" } },
|
||||
|
||||
{ "machakann/vim-swap", event = "VeryLazy" },
|
||||
|
||||
-- IDE for Lisp
|
||||
-- 'kovisoft/slimv'
|
||||
{
|
||||
"vlime/vlime",
|
||||
enabled = function()
|
||||
if utils.executable("sbcl") then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
config = function(plugin)
|
||||
vim.opt.rtp:append(plugin.dir .. "/vim")
|
||||
end,
|
||||
ft = { "lisp" },
|
||||
},
|
||||
|
||||
-- Super fast buffer jump
|
||||
{
|
||||
"smoka7/hop.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("config.nvim_hop")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Show match number and index for searching
|
||||
{
|
||||
"kevinhwang91/nvim-hlslens",
|
||||
branch = "main",
|
||||
keys = { "*", "#", "n", "N" },
|
||||
config = function()
|
||||
require("config.hlslens")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"Yggdroot/LeaderF",
|
||||
cmd = "Leaderf",
|
||||
build = function()
|
||||
if not vim.g.is_win then
|
||||
vim.cmd(":LeaderfInstallCExtension")
|
||||
end
|
||||
end,
|
||||
},
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope-symbols.nvim",
|
||||
},
|
||||
},
|
||||
|
||||
-- A list of colorscheme plugin you may want to try. Find what suits you.
|
||||
{ "navarasu/onedark.nvim", lazy = true },
|
||||
{ "sainnhe/edge", lazy = true },
|
||||
{ "sainnhe/sonokai", lazy = true },
|
||||
{ "sainnhe/gruvbox-material", lazy = true },
|
||||
{ "shaunsingh/nord.nvim", lazy = true },
|
||||
{ "sainnhe/everforest", lazy = true },
|
||||
{ "EdenEast/nightfox.nvim", lazy = true },
|
||||
{ "rebelot/kanagawa.nvim", lazy = true },
|
||||
{ "catppuccin/nvim", name = "catppuccin", lazy = true },
|
||||
{ "olimorris/onedarkpro.nvim", lazy = true },
|
||||
{ "tanvirtin/monokai.nvim", lazy = true },
|
||||
{ "marko-cerovac/material.nvim", lazy = true },
|
||||
|
||||
{ "nvim-tree/nvim-web-devicons", event = "VeryLazy" },
|
||||
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
cond = firenvim_not_active,
|
||||
config = function()
|
||||
require("config.statusline")
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
event = { "BufEnter" },
|
||||
cond = firenvim_not_active,
|
||||
config = function()
|
||||
require("config.bufferline")
|
||||
end,
|
||||
},
|
||||
|
||||
-- fancy start screen
|
||||
{
|
||||
"nvimdev/dashboard-nvim",
|
||||
cond = firenvim_not_active,
|
||||
config = function()
|
||||
require("config.dashboard-nvim")
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = "VeryLazy",
|
||||
main = 'ibl',
|
||||
config = function()
|
||||
require("config.indent-blankline")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Highlight URLs inside vim
|
||||
{ "itchyny/vim-highlighturl", event = "VeryLazy" },
|
||||
|
||||
-- notification plugin
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("config.nvim-notify")
|
||||
end,
|
||||
},
|
||||
|
||||
-- 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.
|
||||
{
|
||||
"tyru/open-browser.vim",
|
||||
enabled = function()
|
||||
if vim.g.is_win or vim.g.is_mac then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end,
|
||||
event = "VeryLazy",
|
||||
},
|
||||
|
||||
-- Only install these plugins if ctags are installed on the system
|
||||
-- show file tags in vim window
|
||||
{
|
||||
"liuchengxu/vista.vim",
|
||||
enabled = function()
|
||||
if utils.executable("ctags") then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end,
|
||||
cmd = "Vista",
|
||||
},
|
||||
|
||||
-- Snippet engine and snippet template
|
||||
{ "SirVer/ultisnips", dependencies = {
|
||||
"honza/vim-snippets",
|
||||
}, event = "InsertEnter" },
|
||||
|
||||
-- Automatic insertion and deletion of a pair of characters
|
||||
{ "Raimondi/delimitMate", event = "InsertEnter" },
|
||||
|
||||
-- Comment plugin
|
||||
{ "tpope/vim-commentary", event = "VeryLazy" },
|
||||
|
||||
-- Multiple cursor plugin like Sublime Text?
|
||||
-- 'mg979/vim-visual-multi'
|
||||
|
||||
-- Autosave files on certain events
|
||||
{ "907th/vim-auto-save", event = "InsertEnter" },
|
||||
|
||||
-- Show undo history visually
|
||||
{ "simnalamburt/vim-mundo", cmd = { "MundoToggle", "MundoShow" } },
|
||||
|
||||
-- better UI for some nvim actions
|
||||
{ "stevearc/dressing.nvim" },
|
||||
|
||||
-- Manage your yank history
|
||||
{
|
||||
"gbprod/yanky.nvim",
|
||||
cmd = { "YankyRingHistory" },
|
||||
config = function()
|
||||
require("config.yanky")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Handy unix command inside Vim (Rename, Move etc.)
|
||||
{ "tpope/vim-eunuch", cmd = { "Rename", "Delete" } },
|
||||
|
||||
-- Repeat vim motions
|
||||
{ "tpope/vim-repeat", event = "VeryLazy" },
|
||||
|
||||
{ "nvim-zh/better-escape.vim", event = { "InsertEnter" } },
|
||||
|
||||
{
|
||||
"lyokha/vim-xkbswitch",
|
||||
enabled = function()
|
||||
if vim.g.is_mac and utils.executable("xkbswitch") then
|
||||
return true
|
||||
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
|
||||
{ "sbdchd/neoformat", cmd = { "Neoformat" } },
|
||||
|
||||
-- Git command inside vim
|
||||
{
|
||||
"tpope/vim-fugitive",
|
||||
event = "User InGitRepo",
|
||||
config = function()
|
||||
require("config.fugitive")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Better git log display
|
||||
{ "rbong/vim-flog", cmd = { "Flog" } },
|
||||
{ "christoomey/vim-conflicted", cmd = { "Conflicted" } },
|
||||
{
|
||||
"ruifm/gitlinker.nvim",
|
||||
event = "User InGitRepo",
|
||||
config = function()
|
||||
require("config.git-linker")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Show git change (change, delete, add) signs in vim sign column
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
require("config.gitsigns")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Better git commit experience
|
||||
{ "rhysd/committia.vim", lazy = true },
|
||||
|
||||
{
|
||||
"sindrets/diffview.nvim"
|
||||
},
|
||||
|
||||
{
|
||||
"kevinhwang91/nvim-bqf",
|
||||
ft = "qf",
|
||||
config = function()
|
||||
require("config.bqf")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Another markdown plugin
|
||||
{ "preservim/vim-markdown", ft = { "markdown" } },
|
||||
|
||||
-- Faster footnote generation
|
||||
{ "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } },
|
||||
|
||||
-- Vim tabular plugin for manipulate tabular, required by markdown plugins
|
||||
{ "godlygeek/tabular", cmd = { "Tabularize" } },
|
||||
|
||||
-- Markdown previewing (only for Mac and Windows)
|
||||
{
|
||||
"iamcco/markdown-preview.nvim",
|
||||
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" },
|
||||
},
|
||||
|
||||
{
|
||||
"folke/zen-mode.nvim",
|
||||
cmd = "ZenMode",
|
||||
config = function()
|
||||
require("config.zen-mode")
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"rhysd/vim-grammarous",
|
||||
enabled = function()
|
||||
if vim.g.is_mac then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
},
|
||||
|
||||
{ "chrisbra/unicode.vim", event = "VeryLazy" },
|
||||
|
||||
-- Additional powerful text object for vim, this plugin should be studied
|
||||
-- carefully to use its full power
|
||||
{ "wellle/targets.vim", event = "VeryLazy" },
|
||||
|
||||
-- Plugin to manipulate character pairs quickly
|
||||
{ "machakann/vim-sandwich", event = "VeryLazy" },
|
||||
|
||||
-- Add indent object for vim (useful for languages like Python)
|
||||
{ "michaeljsmith/vim-indent-object", event = "VeryLazy" },
|
||||
|
||||
-- Only use these plugin on Windows and Mac and when LaTeX is installed
|
||||
{
|
||||
"lervag/vimtex",
|
||||
enabled = function()
|
||||
if utils.executable("latex") then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
ft = { "tex" },
|
||||
},
|
||||
|
||||
-- Since tmux is only available on Linux and Mac, we only enable these plugins
|
||||
-- for Linux and Mac
|
||||
-- .tmux.conf syntax highlighting and setting check
|
||||
{
|
||||
"tmux-plugins/vim-tmux",
|
||||
enabled = function()
|
||||
if utils.executable("tmux") then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
ft = { "tmux" },
|
||||
},
|
||||
|
||||
-- Modern matchit implementation
|
||||
{ "andymass/vim-matchup", event = "BufRead" },
|
||||
{ "tpope/vim-scriptease", cmd = { "Scriptnames", "Message", "Verbose" } },
|
||||
|
||||
-- Asynchronous command execution
|
||||
{ "skywind3000/asyncrun.vim", lazy = true, cmd = { "AsyncRun" } },
|
||||
{ "cespare/vim-toml", ft = { "toml" }, branch = "main" },
|
||||
|
||||
-- Edit text area in browser using nvim
|
||||
{
|
||||
"glacambre/firenvim",
|
||||
enabled = function()
|
||||
if vim.g.is_win or vim.g.is_mac then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
build = function()
|
||||
vim.fn["firenvim#install"](0)
|
||||
end,
|
||||
lazy = true,
|
||||
},
|
||||
|
||||
-- Debugger plugin
|
||||
{
|
||||
"sakhnik/nvim-gdb",
|
||||
enabled = function()
|
||||
if vim.g.is_win or vim.g.is_linux then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
build = { "bash install.sh" },
|
||||
lazy = true,
|
||||
},
|
||||
|
||||
-- Session management plugin
|
||||
{ "tpope/vim-obsession", cmd = "Obsession" },
|
||||
|
||||
{
|
||||
"ojroques/vim-oscyank",
|
||||
enabled = function()
|
||||
if vim.g.is_linux then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
cmd = { "OSCYank", "OSCYankReg" },
|
||||
},
|
||||
|
||||
-- The missing auto-completion for cmdline!
|
||||
{
|
||||
"gelguy/wilder.nvim",
|
||||
build = ":UpdateRemotePlugins",
|
||||
},
|
||||
|
||||
-- showing keybindings
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("config.which-key")
|
||||
end,
|
||||
},
|
||||
|
||||
-- show and trim trailing whitespaces
|
||||
{ "jdhao/whitespace.nvim", event = "VeryLazy" },
|
||||
|
||||
-- file explorer
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
keys = { "<space>s" },
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("config.nvim-tree")
|
||||
end,
|
||||
},
|
||||
|
||||
{ "ii14/emmylua-nvim", ft = "lua" },
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
event = "VeryLazy",
|
||||
tag = "legacy",
|
||||
config = function()
|
||||
require("config.fidget-nvim")
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
-- configuration for lazy itself.
|
||||
local lazy_opts = {
|
||||
ui = {
|
||||
border = "rounded",
|
||||
title = "Plugin Manager",
|
||||
title_pos = "center",
|
||||
},
|
||||
}
|
||||
|
||||
require("lazy").setup(plugin_specs, lazy_opts)
|
||||
395
lua/plugins.lua
395
lua/plugins.lua
@@ -1,395 +0,0 @@
|
||||
local api = vim.api
|
||||
local fn = vim.fn
|
||||
|
||||
local utils = require("utils")
|
||||
|
||||
-- The root dir to install all plugins. Plugins are under opt/ or start/ sub-directory.
|
||||
vim.g.plugin_home = fn.stdpath("data") .. "/site/pack/packer"
|
||||
|
||||
--- Install packer if it has not been installed.
|
||||
--- Return:
|
||||
--- true: if this is a fresh install of packer
|
||||
--- false: if packer has been installed
|
||||
local function packer_ensure_install()
|
||||
-- Where to install packer.nvim -- the package manager (we make it opt)
|
||||
local packer_dir = vim.g.plugin_home .. "/opt/packer.nvim"
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
local firenvim_not_active = function()
|
||||
return not vim.g.started_by_firenvim
|
||||
end
|
||||
|
||||
packer.startup {
|
||||
function(use)
|
||||
-- it is recommended to put impatient.nvim before any other plugins
|
||||
use { "lewis6991/impatient.nvim", config = [[require('impatient')]] }
|
||||
|
||||
use { "wbthomason/packer.nvim", opt = true }
|
||||
|
||||
use { "onsails/lspkind-nvim", event = "VimEnter" }
|
||||
-- auto-completion engine
|
||||
use { "hrsh7th/nvim-cmp", after = "lspkind-nvim", config = [[require('config.nvim-cmp')]] }
|
||||
|
||||
-- nvim-cmp completion sources
|
||||
use { "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" }
|
||||
use { "hrsh7th/cmp-path", after = "nvim-cmp" }
|
||||
use { "hrsh7th/cmp-buffer", after = "nvim-cmp" }
|
||||
use { "hrsh7th/cmp-omni", after = "nvim-cmp" }
|
||||
use { "quangnguyen30192/cmp-nvim-ultisnips", after = { "nvim-cmp", "ultisnips" } }
|
||||
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",
|
||||
event = "BufEnter",
|
||||
run = ":TSUpdate",
|
||||
config = [[require('config.treesitter')]],
|
||||
}
|
||||
end
|
||||
|
||||
-- Python indent (follows the PEP8 style)
|
||||
use { "Vimjas/vim-python-pep8-indent", ft = { "python" } }
|
||||
|
||||
-- Python-related text object
|
||||
use { "jeetsukumaran/vim-pythonsense", ft = { "python" } }
|
||||
|
||||
use { "machakann/vim-swap", event = "VimEnter" }
|
||||
|
||||
-- IDE for Lisp
|
||||
if utils.executable("sbcl") then
|
||||
-- use 'kovisoft/slimv'
|
||||
use { "vlime/vlime", rtp = "vim/", ft = { "lisp" } }
|
||||
end
|
||||
|
||||
-- Super fast buffer jump
|
||||
use {
|
||||
"phaazon/hop.nvim",
|
||||
event = "VimEnter",
|
||||
config = function()
|
||||
vim.defer_fn(function()
|
||||
require("config.nvim_hop")
|
||||
end, 2000)
|
||||
end,
|
||||
}
|
||||
|
||||
-- Show match number and index for searching
|
||||
use {
|
||||
"kevinhwang91/nvim-hlslens",
|
||||
branch = "main",
|
||||
keys = { { "n", "*" }, { "n", "#" }, { "n", "n" }, { "n", "N" } },
|
||||
config = [[require('config.hlslens')]],
|
||||
}
|
||||
|
||||
-- File search, tag search and more
|
||||
if vim.g.is_win then
|
||||
use { "Yggdroot/LeaderF", cmd = "Leaderf" }
|
||||
else
|
||||
use { "Yggdroot/LeaderF", cmd = "Leaderf", run = ":LeaderfInstallCExtension" }
|
||||
end
|
||||
|
||||
use {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
requires = { { "nvim-lua/plenary.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.
|
||||
use { "navarasu/onedark.nvim", opt = true }
|
||||
use { "sainnhe/edge", opt = true }
|
||||
use { "sainnhe/sonokai", opt = true }
|
||||
use { "sainnhe/gruvbox-material", opt = true }
|
||||
use { "shaunsingh/nord.nvim", opt = true }
|
||||
use { "sainnhe/everforest", opt = true }
|
||||
use { "EdenEast/nightfox.nvim", opt = true }
|
||||
use { "rebelot/kanagawa.nvim", opt = true }
|
||||
use { "catppuccin/nvim", as = "catppuccin", opt = true }
|
||||
use({ "rose-pine/neovim", as = 'rose-pine', opt = true })
|
||||
use { "olimorris/onedarkpro.nvim", opt = true }
|
||||
use { "tanvirtin/monokai.nvim", opt = true }
|
||||
use { "marko-cerovac/material.nvim", opt = true }
|
||||
|
||||
use { "kyazdani42/nvim-web-devicons", event = "VimEnter" }
|
||||
|
||||
use {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VimEnter",
|
||||
cond = firenvim_not_active,
|
||||
config = [[require('config.statusline')]],
|
||||
}
|
||||
|
||||
use { "akinsho/bufferline.nvim", event = "VimEnter",
|
||||
cond = firenvim_not_active,
|
||||
config = [[require('config.bufferline')]] }
|
||||
|
||||
-- fancy start screen
|
||||
use { "glepnir/dashboard-nvim", event = "VimEnter",
|
||||
cond = firenvim_not_active,
|
||||
config = [[require('config.dashboard-nvim')]]
|
||||
}
|
||||
|
||||
use {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = "VimEnter",
|
||||
config = [[require('config.indent-blankline')]],
|
||||
}
|
||||
|
||||
-- Highlight URLs inside vim
|
||||
use { "itchyny/vim-highlighturl", event = "VimEnter" }
|
||||
|
||||
-- notification plugin
|
||||
use {
|
||||
"rcarriga/nvim-notify",
|
||||
event = "BufEnter",
|
||||
config = function()
|
||||
vim.defer_fn(function()
|
||||
require("config.nvim-notify")
|
||||
end, 2000)
|
||||
end,
|
||||
}
|
||||
|
||||
-- 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.
|
||||
if vim.g.is_win or vim.g.is_mac then
|
||||
-- open URL in browser
|
||||
use { "tyru/open-browser.vim", event = "VimEnter" }
|
||||
end
|
||||
|
||||
-- Only install these plugins if ctags are installed on the system
|
||||
if utils.executable("ctags") then
|
||||
-- show file tags in vim window
|
||||
use { "liuchengxu/vista.vim", cmd = "Vista" }
|
||||
end
|
||||
|
||||
-- Snippet engine and snippet template
|
||||
use { "SirVer/ultisnips", event = "InsertEnter" }
|
||||
use { "honza/vim-snippets", after = "ultisnips" }
|
||||
|
||||
-- Automatic insertion and deletion of a pair of characters
|
||||
use { "Raimondi/delimitMate", event = "InsertEnter" }
|
||||
|
||||
-- Comment plugin
|
||||
use { "tpope/vim-commentary", event = "VimEnter" }
|
||||
|
||||
-- Multiple cursor plugin like Sublime Text?
|
||||
-- use 'mg979/vim-visual-multi'
|
||||
|
||||
-- Autosave files on certain events
|
||||
use { "907th/vim-auto-save", event = "InsertEnter" }
|
||||
|
||||
-- Show undo history visually
|
||||
use { "simnalamburt/vim-mundo", cmd = { "MundoToggle", "MundoShow" } }
|
||||
|
||||
-- Manage your yank history
|
||||
if vim.g.is_win or vim.g.is_mac then
|
||||
use { "svermeulen/vim-yoink", event = "VimEnter" }
|
||||
end
|
||||
|
||||
-- Handy unix command inside Vim (Rename, Move etc.)
|
||||
use { "tpope/vim-eunuch", cmd = { "Rename", "Delete" } }
|
||||
|
||||
-- Repeat vim motions
|
||||
use { "tpope/vim-repeat", event = "VimEnter" }
|
||||
|
||||
use { "nvim-zh/better-escape.vim", event = { "InsertEnter" } }
|
||||
|
||||
if vim.g.is_mac then
|
||||
use { "lyokha/vim-xkbswitch", event = { "InsertEnter" } }
|
||||
elseif vim.g.is_win then
|
||||
use { "Neur1n/neuims", event = { "InsertEnter" } }
|
||||
end
|
||||
|
||||
-- Auto format tools
|
||||
use { "sbdchd/neoformat", cmd = { "Neoformat" } }
|
||||
|
||||
-- Git command inside vim
|
||||
use { "tpope/vim-fugitive", event = "User InGitRepo", config = [[require('config.fugitive')]] }
|
||||
|
||||
-- Better git log display
|
||||
use { "rbong/vim-flog", requires = "tpope/vim-fugitive", cmd = { "Flog" } }
|
||||
|
||||
use { "christoomey/vim-conflicted", requires = "tpope/vim-fugitive", cmd = { "Conflicted" } }
|
||||
|
||||
use {
|
||||
"ruifm/gitlinker.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
event = "User InGitRepo",
|
||||
config = [[require('config.git-linker')]],
|
||||
}
|
||||
|
||||
-- Show git change (change, delete, add) signs in vim sign column
|
||||
use { "lewis6991/gitsigns.nvim", config = [[require('config.gitsigns')]] }
|
||||
|
||||
-- Better git commit experience
|
||||
use { "rhysd/committia.vim", opt = true, setup = [[vim.cmd('packadd committia.vim')]] }
|
||||
|
||||
use { "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] }
|
||||
|
||||
-- Another markdown plugin
|
||||
use { "preservim/vim-markdown", ft = { "markdown" } }
|
||||
|
||||
-- Faster footnote generation
|
||||
use { "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } }
|
||||
|
||||
-- Vim tabular plugin for manipulate tabular, required by markdown plugins
|
||||
use { "godlygeek/tabular", cmd = { "Tabularize" } }
|
||||
|
||||
-- Markdown previewing (only for Mac and Windows)
|
||||
if vim.g.is_win or vim.g.is_mac then
|
||||
use {
|
||||
"iamcco/markdown-preview.nvim",
|
||||
run = "cd app && npm install",
|
||||
ft = { "markdown" },
|
||||
}
|
||||
end
|
||||
|
||||
use { "folke/zen-mode.nvim", cmd = "ZenMode", config = [[require('config.zen-mode')]] }
|
||||
|
||||
if vim.g.is_mac then
|
||||
use { "rhysd/vim-grammarous", ft = { "markdown" } }
|
||||
end
|
||||
|
||||
use { "chrisbra/unicode.vim", event = "VimEnter" }
|
||||
|
||||
-- Additional powerful text object for vim, this plugin should be studied
|
||||
-- carefully to use its full power
|
||||
use { "wellle/targets.vim", event = "VimEnter" }
|
||||
|
||||
-- Plugin to manipulate character pairs quickly
|
||||
use { "machakann/vim-sandwich", event = "VimEnter" }
|
||||
|
||||
-- Add indent object for vim (useful for languages like Python)
|
||||
use { "michaeljsmith/vim-indent-object", event = "VimEnter" }
|
||||
|
||||
-- Only use these plugin on Windows and Mac and when LaTeX is installed
|
||||
if utils.executable("latex") then
|
||||
use { "lervag/vimtex", ft = { "tex" } }
|
||||
end
|
||||
|
||||
-- Since tmux is only available on Linux and Mac, we only enable these plugins
|
||||
-- for Linux and Mac
|
||||
if utils.executable("tmux") then
|
||||
-- .tmux.conf syntax highlighting and setting check
|
||||
use { "tmux-plugins/vim-tmux", ft = { "tmux" } }
|
||||
end
|
||||
|
||||
-- Modern matchit implementation
|
||||
use { "andymass/vim-matchup", event = "VimEnter" }
|
||||
|
||||
use { "tpope/vim-scriptease", cmd = { "Scriptnames", "Message", "Verbose" } }
|
||||
|
||||
-- Asynchronous command execution
|
||||
use { "skywind3000/asyncrun.vim", opt = true, cmd = { "AsyncRun" } }
|
||||
|
||||
use { "cespare/vim-toml", ft = { "toml" }, branch = "main" }
|
||||
|
||||
-- Edit text area in browser using nvim
|
||||
if vim.g.is_win or vim.g.is_mac then
|
||||
use {
|
||||
"glacambre/firenvim",
|
||||
run = function()
|
||||
fn["firenvim#install"](0)
|
||||
end,
|
||||
opt = true,
|
||||
setup = [[vim.cmd('packadd firenvim')]],
|
||||
}
|
||||
end
|
||||
|
||||
-- Debugger plugin
|
||||
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')]] }
|
||||
end
|
||||
|
||||
-- Session management plugin
|
||||
use { "tpope/vim-obsession", cmd = "Obsession" }
|
||||
|
||||
if vim.g.is_linux then
|
||||
use { "ojroques/vim-oscyank", cmd = { "OSCYank", "OSCYankReg" } }
|
||||
end
|
||||
|
||||
-- The missing auto-completion for cmdline!
|
||||
use { "gelguy/wilder.nvim", opt = true, setup = [[vim.cmd('packadd wilder.nvim')]] }
|
||||
|
||||
-- showing keybindings
|
||||
use {
|
||||
"folke/which-key.nvim",
|
||||
event = "VimEnter",
|
||||
config = function()
|
||||
vim.defer_fn(function()
|
||||
require("config.which-key")
|
||||
end, 2000)
|
||||
end,
|
||||
}
|
||||
|
||||
-- show and trim trailing whitespaces
|
||||
use { "jdhao/whitespace.nvim", event = "VimEnter" }
|
||||
|
||||
-- file explorer
|
||||
use {
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
requires = { "kyazdani42/nvim-web-devicons" },
|
||||
config = [[require('config.nvim-tree')]],
|
||||
}
|
||||
|
||||
use { "ii14/emmylua-nvim", ft = "lua" }
|
||||
|
||||
use { "j-hui/fidget.nvim", after = "nvim-lspconfig", config = [[require('config.fidget-nvim')]] }
|
||||
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`.
|
||||
if fresh_install then
|
||||
-- We run packer.sync() here, because only after packer.startup, can we know which plugins to install.
|
||||
-- So plugin installation should be done after the startup process.
|
||||
packer.sync()
|
||||
else
|
||||
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
|
||||
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,
|
||||
})
|
||||
@@ -31,13 +31,6 @@ function M.may_create_dir(dir)
|
||||
end
|
||||
end
|
||||
|
||||
function M.get_nvim_version()
|
||||
local actual_ver = vim.version()
|
||||
|
||||
local nvim_ver_str = string.format("%d.%d.%d", actual_ver.major, actual_ver.minor, actual_ver.patch)
|
||||
return nvim_ver_str
|
||||
end
|
||||
|
||||
--- Generate random integers in the range [Low, High], inclusive,
|
||||
--- adapted from https://stackoverflow.com/a/12739441/6064933
|
||||
--- @low: the lower value for this range
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
" some abbreviations
|
||||
iabbrev reqire require
|
||||
iabbrev serveral several
|
||||
|
||||
@@ -45,3 +45,6 @@ function! s:md_to_pdf() abort
|
||||
echoerr "Error running command"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" json format
|
||||
command! -range JSONFormat <line1>,<line2>!python -m json.tool
|
||||
|
||||
@@ -453,3 +453,17 @@ SQLite
|
||||
Pgadmin
|
||||
Datagrip
|
||||
mysql
|
||||
cwd
|
||||
pyright
|
||||
stubgen
|
||||
pylance
|
||||
variadic
|
||||
Vimium
|
||||
Databricks
|
||||
Jira
|
||||
databricks
|
||||
FastAPI
|
||||
pylintrc
|
||||
PYTHONPATH
|
||||
Uvicorn
|
||||
qpdf
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
scriptencoding utf-8
|
||||
|
||||
" change fillchars for folding, vertical split, end of buffer, and message separator
|
||||
set fillchars=fold:\ ,vert:\│,eob:\ ,msgsep:‾
|
||||
|
||||
" Paste mode toggle, it seems that Nvim's bracketed paste mode
|
||||
" does not work very well for nvim-qt, so we use good-old paste mode
|
||||
set pastetoggle=<F12>
|
||||
set fillchars=fold:\ ,vert:\│,eob:\ ,msgsep:‾,diff:╱
|
||||
|
||||
" Split window below/right when creating horizontal/vertical windows
|
||||
set splitbelow splitright
|
||||
@@ -75,7 +71,7 @@ set scrolloff=3
|
||||
" Use mouse to select and resize windows, etc.
|
||||
set mouse=nic " Enable mouse in several mode
|
||||
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.
|
||||
set noshowmode
|
||||
@@ -176,6 +172,7 @@ set diffopt+=filler " show filler for deleted lines
|
||||
set diffopt+=closeoff " turn off diff when one file window is closed
|
||||
set diffopt+=context:3 " context for diff
|
||||
set diffopt+=internal,indent-heuristic,algorithm:histogram
|
||||
set diffopt+=linematch:60
|
||||
|
||||
set nowrap " do no wrap
|
||||
set noruler
|
||||
@@ -1,16 +1,16 @@
|
||||
scriptencoding utf-8
|
||||
|
||||
" Plugin specification and lua stuff
|
||||
lua require('plugins')
|
||||
lua require('plugin_specs')
|
||||
|
||||
" Use short names for common plugin manager commands to simplify typing.
|
||||
" 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
|
||||
" the full command automatically.
|
||||
call utils#Cabbrev('pi', 'PackerInstall')
|
||||
call utils#Cabbrev('pud', 'PackerUpdate')
|
||||
call utils#Cabbrev('pc', 'PackerClean')
|
||||
call utils#Cabbrev('ps', 'PackerSync')
|
||||
call utils#Cabbrev('pi', 'Lazy install')
|
||||
call utils#Cabbrev('pud', 'Lazy update')
|
||||
call utils#Cabbrev('pc', 'Lazy clean')
|
||||
call utils#Cabbrev('ps', 'Lazy sync')
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" configurations for vim script plugin "
|
||||
@@ -42,7 +42,7 @@ let g:Lf_UseMemoryCache = 0
|
||||
|
||||
" Ignore certain files and directories when searching files
|
||||
let g:Lf_WildIgnore = {
|
||||
\ 'dir': ['.git', '__pycache__', '.DS_Store'],
|
||||
\ 'dir': ['.git', '__pycache__', '.DS_Store', '*_cache'],
|
||||
\ 'file': ['*.exe', '*.dll', '*.so', '*.o', '*.pyc', '*.jpg', '*.png',
|
||||
\ '*.gif', '*.svg', '*.ico', '*.db', '*.tgz', '*.tar.gz', '*.gz',
|
||||
\ '*.zip', '*.bin', '*.pptx', '*.xlsx', '*.docx', '*.pdf', '*.tmp',
|
||||
@@ -109,6 +109,20 @@ let g:Lf_PopupColorscheme = 'gruvbox_material'
|
||||
" items.
|
||||
let g:Lf_CommandMap = {'<C-J>': ['<C-N>'], '<C-K>': ['<C-P>']}
|
||||
|
||||
" do not preview results, it will add the file to buffer list
|
||||
let g:Lf_PreviewResult = {
|
||||
\ 'File': 0,
|
||||
\ 'Buffer': 0,
|
||||
\ 'Mru': 0,
|
||||
\ 'Tag': 0,
|
||||
\ 'BufTag': 1,
|
||||
\ 'Function': 1,
|
||||
\ 'Line': 0,
|
||||
\ 'Colorscheme': 0,
|
||||
\ 'Rg': 0,
|
||||
\ 'Gtags': 0
|
||||
\}
|
||||
|
||||
""""""""""""""""""""""""""""open-browser.vim settings"""""""""""""""""""
|
||||
if g:is_win || g:is_mac
|
||||
" Disable netrw's gx mapping.
|
||||
@@ -137,31 +151,6 @@ let g:mundo_width = 80
|
||||
|
||||
nnoremap <silent> <Space>u :MundoToggle<CR>
|
||||
|
||||
""""""""""""""""""""""""""""vim-yoink settings"""""""""""""""""""""""""
|
||||
if g:is_win || g:is_mac
|
||||
" ctrl-n and ctrl-p will not work if you add the TextChanged event to vim-auto-save events.
|
||||
" nmap <c-n> <plug>(YoinkPostPasteSwapBack)
|
||||
" nmap <c-p> <plug>(YoinkPostPasteSwapForward)
|
||||
|
||||
" The following p/P mappings are also needed for ctrl-n and ctrl-p to work
|
||||
" nmap p <plug>(YoinkPaste_p)
|
||||
" nmap P <plug>(YoinkPaste_P)
|
||||
|
||||
" Cycle the yank stack with the following mappings
|
||||
nmap [y <plug>(YoinkRotateBack)
|
||||
nmap ]y <plug>(YoinkRotateForward)
|
||||
|
||||
" Do not change the cursor position
|
||||
nmap y <plug>(YoinkYankPreserveCursorPosition)
|
||||
xmap y <plug>(YoinkYankPreserveCursorPosition)
|
||||
|
||||
" Move cursor to end of paste after multiline paste
|
||||
let g:yoinkMoveCursorToEndOfPaste = 0
|
||||
|
||||
" Record yanks in system clipboard
|
||||
let g:yoinkSyncSystemClipboardOnFocus = 1
|
||||
endif
|
||||
|
||||
""""""""""""""""""""""""""""better-escape.vim settings"""""""""""""""""""""""""
|
||||
let g:better_escape_interval = 200
|
||||
|
||||
@@ -412,7 +401,7 @@ function! s:wilder_init() abort
|
||||
\ 'apply_incsearch_fix': 0,
|
||||
\ }))
|
||||
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
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user