mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
22 Commits
7fa77fbfbf
...
v0.11.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
082111fa4e | ||
|
|
30b3c09dda | ||
|
|
3b964c3d1f | ||
|
|
999a1733cf | ||
|
|
b69dcb3a6b | ||
|
|
ea23f913b4 | ||
|
|
8839201450 | ||
|
|
ba991064b6 | ||
|
|
6c620ecc32 | ||
|
|
be862a83d6 | ||
|
|
488ba52644 | ||
|
|
e23d4bb661 | ||
|
|
510a5501c5 | ||
|
|
e08b17f335 | ||
|
|
adddbc0ba6 | ||
|
|
aadfdae677 | ||
|
|
5826161160 | ||
|
|
ea2b4a728d | ||
|
|
ad4a0e82dc | ||
|
|
9e6be1f001 | ||
|
|
c4160b6f85 | ||
|
|
60852c0473 |
19
README.md
19
README.md
@@ -10,10 +10,7 @@
|
|||||||
<img alt="Windows" src="https://img.shields.io/badge/Windows-%23.svg?style=flat-square&logo=windows&color=0078D6&logoColor=white" />
|
<img alt="Windows" src="https://img.shields.io/badge/Windows-%23.svg?style=flat-square&logo=windows&color=0078D6&logoColor=white" />
|
||||||
</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.11.0-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
<img src="https://img.shields.io/badge/Neovim-0.11.1-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
||||||
</a>
|
|
||||||
<a href="https://github.com/jdhao/nvim-config/releases/latest">
|
|
||||||
<img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" />
|
|
||||||
</a>
|
</a>
|
||||||
<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"/>
|
||||||
@@ -59,7 +56,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
|||||||
+ Language server protocol (LSP) support via [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig).
|
+ 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).
|
||||||
+ Better escaping from insert mode via [better-escape.vim](https://github.com/nvim-zh/better-escape.vim).
|
+ Better escaping from insert mode via [better-escape.vim](https://github.com/nvim-zh/better-escape.vim).
|
||||||
+ Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF).
|
+ Ultra-fast project-wide fuzzy searching via [fzf-lua](https://github.com/ibhagwan/fzf-lua).
|
||||||
+ Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary).
|
+ Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary).
|
||||||
+ Faster matching pair insertion and jump via [nvim-autopairs](https://github.com/windwp/nvim-autopairs).
|
+ Faster matching pair insertion and jump via [nvim-autopairs](https://github.com/windwp/nvim-autopairs).
|
||||||
+ Smarter and faster matching pair management (add, replace or delete) via [vim-sandwich](https://github.com/machakann/vim-sandwich).
|
+ Smarter and faster matching pair management (add, replace or delete) via [vim-sandwich](https://github.com/machakann/vim-sandwich).
|
||||||
@@ -69,7 +66,6 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
|||||||
+ File tree explorer via [nvim-tree.lua](https://github.com/nvim-tree/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).
|
+ 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).
|
+ Show search index and count with [nvim-hlslens](https://github.com/kevinhwang91/nvim-hlslens).
|
||||||
+ Command line auto-completion via [wilder.nvim](https://github.com/gelguy/wilder.nvim).
|
|
||||||
+ User-defined mapping hint via [which-key.nvim](https://github.com/folke/which-key.nvim).
|
+ User-defined mapping hint via [which-key.nvim](https://github.com/folke/which-key.nvim).
|
||||||
+ Asynchronous code execution via [asyncrun.vim](https://github.com/skywind3000/asyncrun.vim).
|
+ Asynchronous code execution via [asyncrun.vim](https://github.com/skywind3000/asyncrun.vim).
|
||||||
+ Code highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
|
+ Code highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
|
||||||
@@ -79,7 +75,6 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
|||||||
+ LaTeX editing and previewing via [vimtex](https://github.com/lervag/vimtex)
|
+ LaTeX editing and previewing via [vimtex](https://github.com/lervag/vimtex)
|
||||||
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
|
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
|
||||||
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
|
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
|
||||||
+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
|
|
||||||
+ Undo management via [vim-mundo](https://github.com/simnalamburt/vim-mundo)
|
+ Undo management via [vim-mundo](https://github.com/simnalamburt/vim-mundo)
|
||||||
+ Code folding with [nvim-ufo](https://github.com/kevinhwang91/nvim-ufo) and [statuscol.nvim](https://github.com/luukvbaal/statuscol.nvim)
|
+ Code folding with [nvim-ufo](https://github.com/kevinhwang91/nvim-ufo) and [statuscol.nvim](https://github.com/luukvbaal/statuscol.nvim)
|
||||||
+ ......
|
+ ......
|
||||||
@@ -94,10 +89,10 @@ For more UI demos, check [here](https://github.com/jdhao/nvim-config/issues/15).
|
|||||||
<img src="https://user-images.githubusercontent.com/16662357/183256752-fb23b215-a6b8-4646-beed-9999f52d53f1.png" width="800">
|
<img src="https://user-images.githubusercontent.com/16662357/183256752-fb23b215-a6b8-4646-beed-9999f52d53f1.png" width="800">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## File fuzzy finding using LeaderF
|
## File fuzzy finding using fzf-lua
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://user-images.githubusercontent.com/16662357/183257017-2d9d7605-3c4b-4e1d-8955-30998f9b6f28.gif" width="800">
|
<img src="https://github.com/user-attachments/assets/3199e35d-121a-487b-bfd1-58eb69b0b48a" width="800">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Code autocompletion with nvim-cmp
|
## Code autocompletion with nvim-cmp
|
||||||
@@ -112,12 +107,6 @@ For more UI demos, check [here](https://github.com/jdhao/nvim-config/issues/15).
|
|||||||
<img src="https://user-images.githubusercontent.com/16662357/128590833-aaa05d53-19ef-441d-a5a9-ba1bbd3936c1.gif" width="800">
|
<img src="https://user-images.githubusercontent.com/16662357/128590833-aaa05d53-19ef-441d-a5a9-ba1bbd3936c1.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Command-line autocompletion with wilder.nvim
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<img src="https://user-images.githubusercontent.com/16662357/147677787-8e5d229a-a16a-420e-98f5-88f2a1be84a2.gif" width="800">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
## Tags
|
## Tags
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
|||||||
@@ -12,3 +12,5 @@ set tabstop=4 " number of visual spaces per TAB
|
|||||||
set softtabstop=4 " number of spaces in tab when editing
|
set softtabstop=4 " number of spaces in tab when editing
|
||||||
set shiftwidth=4 " number of spaces to use for autoindent
|
set shiftwidth=4 " number of spaces to use for autoindent
|
||||||
set expandtab " expand tab to spaces so that tabs are spaces
|
set expandtab " expand tab to spaces so that tabs are spaces
|
||||||
|
|
||||||
|
nnoremap <buffer><silent> <space>f <cmd>silent !black %<CR>
|
||||||
|
|||||||
3
after/lsp/clangd.lua
Normal file
3
after/lsp/clangd.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
return {
|
||||||
|
filetypes = { "c", "cpp", "cc" },
|
||||||
|
}
|
||||||
8
after/lsp/ltex.lua
Normal file
8
after/lsp/ltex.lua
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
return {
|
||||||
|
filetypes = { "text", "plaintex", "tex", "markdown" },
|
||||||
|
settings = {
|
||||||
|
ltex = {
|
||||||
|
language = "en",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
14
after/lsp/lua_ls.lua
Normal file
14
after/lsp/lua_ls.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
-- settings for lua-language-server can be found on https://luals.github.io/wiki/settings/
|
||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = "LuaJIT",
|
||||||
|
},
|
||||||
|
hint = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
51
after/lsp/pyright.lua
Normal file
51
after/lsp/pyright.lua
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
-- For what diagnostic is enabled in which type checking mode, check doc:
|
||||||
|
-- https://github.com/microsoft/pyright/blob/main/docs/configuration.md#diagnostic-settings-defaults
|
||||||
|
-- Currently, the pyright also has some issues displaying hover documentation:
|
||||||
|
-- https://www.reddit.com/r/neovim/comments/1gdv1rc/what_is_causeing_the_lsp_hover_docs_to_looks_like/
|
||||||
|
|
||||||
|
local new_capability = {
|
||||||
|
-- this will remove some of the diagnostics that duplicates those from ruff, idea taken and adapted from
|
||||||
|
-- here: https://github.com/astral-sh/ruff-lsp/issues/384#issuecomment-1989619482
|
||||||
|
textDocument = {
|
||||||
|
publishDiagnostics = {
|
||||||
|
tagSupport = {
|
||||||
|
valueSet = { 2 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
hover = {
|
||||||
|
contentFormat = { "plaintext" },
|
||||||
|
dynamicRegistration = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
cmd = { "delance-langserver", "--stdio" },
|
||||||
|
settings = {
|
||||||
|
pyright = {
|
||||||
|
-- disable import sorting and use Ruff for this
|
||||||
|
disableOrganizeImports = true,
|
||||||
|
disableTaggedHints = false,
|
||||||
|
},
|
||||||
|
python = {
|
||||||
|
analysis = {
|
||||||
|
autoSearchPaths = true,
|
||||||
|
diagnosticMode = "workspace",
|
||||||
|
typeCheckingMode = "standard",
|
||||||
|
useLibraryCodeForTypes = true,
|
||||||
|
-- we can this setting below to redefine some diagnostics
|
||||||
|
diagnosticSeverityOverrides = {
|
||||||
|
deprecateTypingAliases = false,
|
||||||
|
},
|
||||||
|
-- inlay hint settings are provided by pylance?
|
||||||
|
inlayHints = {
|
||||||
|
callArgumentNames = "partial",
|
||||||
|
functionReturnTypes = true,
|
||||||
|
pytestParameters = true,
|
||||||
|
variableTypes = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
capabilities = new_capability,
|
||||||
|
}
|
||||||
8
after/lsp/ruff.lua
Normal file
8
after/lsp/ruff.lua
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
return {
|
||||||
|
init_options = {
|
||||||
|
-- the settings can be found here: https://docs.astral.sh/ruff/editors/settings/
|
||||||
|
settings = {
|
||||||
|
organizeImports = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -221,7 +221,7 @@ fi
|
|||||||
NVIM_DIR=$HOME/tools/nvim
|
NVIM_DIR=$HOME/tools/nvim
|
||||||
NVIM_SRC_NAME=$HOME/packages/nvim-linux64.tar.gz
|
NVIM_SRC_NAME=$HOME/packages/nvim-linux64.tar.gz
|
||||||
NVIM_CONFIG_DIR=$HOME/.config/nvim
|
NVIM_CONFIG_DIR=$HOME/.config/nvim
|
||||||
NVIM_LINK="https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz"
|
NVIM_LINK="https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.tar.gz"
|
||||||
if [[ ! -f "$NVIM_DIR/bin/nvim" ]]; then
|
if [[ ! -f "$NVIM_DIR/bin/nvim" ]]; then
|
||||||
echo "Installing Nvim"
|
echo "Installing Nvim"
|
||||||
echo "Creating nvim directory under tools directory"
|
echo "Creating nvim directory under tools directory"
|
||||||
|
|||||||
2
init.lua
2
init.lua
@@ -13,7 +13,7 @@ vim.loader.enable()
|
|||||||
|
|
||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
|
|
||||||
local expected_version = "0.11.0"
|
local expected_version = "0.11.1"
|
||||||
utils.is_compatible_version(expected_version)
|
utils.is_compatible_version(expected_version)
|
||||||
|
|
||||||
local config_dir = vim.fn.stdpath("config")
|
local config_dir = vim.fn.stdpath("config")
|
||||||
|
|||||||
@@ -23,19 +23,19 @@ conf.center = {
|
|||||||
{
|
{
|
||||||
icon = " ",
|
icon = " ",
|
||||||
desc = "Find File ",
|
desc = "Find File ",
|
||||||
action = "Leaderf file --popup",
|
action = "FzfLua files",
|
||||||
key = "<Leader> f f",
|
key = "<Leader> f f",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon = " ",
|
icon = " ",
|
||||||
desc = "Recently opened files ",
|
desc = "Recently opened files ",
|
||||||
action = "Leaderf mru --popup",
|
action = "FzfLua oldfiles",
|
||||||
key = "<Leader> f r",
|
key = "<Leader> f r",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon = " ",
|
icon = " ",
|
||||||
desc = "Project grep ",
|
desc = "Project grep ",
|
||||||
action = "Leaderf rg --popup",
|
action = "FzfLua live_grep",
|
||||||
key = "<Leader> f g",
|
key = "<Leader> f g",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
18
lua/config/fzf-lua.lua
Normal file
18
lua/config/fzf-lua.lua
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
require("fzf-lua").setup {
|
||||||
|
defaults = {
|
||||||
|
file_icons = "mini",
|
||||||
|
},
|
||||||
|
winopts = {
|
||||||
|
row = 0.5,
|
||||||
|
height = 0.7,
|
||||||
|
},
|
||||||
|
files = {
|
||||||
|
previewer = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>ff", "<cmd>FzfLua files<cr>", { desc = "Fuzzy find files" })
|
||||||
|
vim.keymap.set("n", "<leader>fg", "<cmd>FzfLua live_grep<cr>", { desc = "Fuzzy grep files" })
|
||||||
|
vim.keymap.set("n", "<leader>fh", "<cmd>FzfLua helptags<cr>", { desc = "Fuzzy grep tags in help files" })
|
||||||
|
vim.keymap.set("n", "<leader>ft", "<cmd>FzfLua btags<cr>", { desc = "Fuzzy search buffer tags" })
|
||||||
|
vim.keymap.set("n", "<leader>fb", "<cmd>FzfLua buffers<cr>", { desc = "Fuzzy search opened buffers" })
|
||||||
12
lua/config/git-conflict.lua
Normal file
12
lua/config/git-conflict.lua
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
require("git-conflict").setup {}
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "GitConflictResolved",
|
||||||
|
callback = function()
|
||||||
|
-- clear qf list
|
||||||
|
vim.fn.setqflist({}, "r")
|
||||||
|
|
||||||
|
-- reopen it?
|
||||||
|
vim.cmd([[GitConflictListQf]])
|
||||||
|
end,
|
||||||
|
})
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
local api = vim.api
|
|
||||||
|
|
||||||
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 = "IBLDisable",
|
|
||||||
})
|
|
||||||
|
|
||||||
api.nvim_create_autocmd("InsertLeave", {
|
|
||||||
pattern = "*",
|
|
||||||
group = gid,
|
|
||||||
callback = function()
|
|
||||||
if not vim.tbl_contains(exclude_ft, vim.bo.filetype) then
|
|
||||||
vim.cmd([[IBLEnable]])
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
@@ -1,12 +1,7 @@
|
|||||||
local api = vim.api
|
|
||||||
local keymap = vim.keymap
|
|
||||||
local lsp = vim.lsp
|
|
||||||
local lspconfig = require("lspconfig")
|
|
||||||
|
|
||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
group = vim.api.nvim_create_augroup("buf_behavior_conf", { clear = true }),
|
group = vim.api.nvim_create_augroup("lsp_buf_conf", { clear = true }),
|
||||||
callback = function(event_context)
|
callback = function(event_context)
|
||||||
local client = vim.lsp.get_client_by_id(event_context.data.client_id)
|
local client = vim.lsp.get_client_by_id(event_context.data.client_id)
|
||||||
-- vim.print(client.name, client.server_capabilities)
|
-- vim.print(client.name, client.server_capabilities)
|
||||||
@@ -22,10 +17,48 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
opts.silent = true
|
opts.silent = true
|
||||||
opts.buffer = bufnr
|
opts.buffer = bufnr
|
||||||
keymap.set(mode, l, r, opts)
|
vim.keymap.set(mode, l, r, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
map("n", "gd", vim.lsp.buf.definition, { desc = "go to definition" })
|
map("n", "gd", function()
|
||||||
|
vim.lsp.buf.definition {
|
||||||
|
on_list = function(options)
|
||||||
|
-- custom logic to avoid showing multiple definition when you use this style of code:
|
||||||
|
-- `local M.my_fn_name = function() ... end`.
|
||||||
|
-- See also post here: https://www.reddit.com/r/neovim/comments/19cvgtp/any_way_to_remove_redundant_definition_in_lua_file/
|
||||||
|
|
||||||
|
-- vim.print(options.items)
|
||||||
|
local unique_defs = {}
|
||||||
|
local def_loc_hash = {}
|
||||||
|
|
||||||
|
-- each item in options.items contain the location info for a definition provided by LSP server
|
||||||
|
for _, def_location in pairs(options.items) do
|
||||||
|
-- use filename and line number to uniquelly indentify a definition,
|
||||||
|
-- we do not expect/want multiple definition in single line!
|
||||||
|
local hash_key = def_location.filename .. def_location.lnum
|
||||||
|
|
||||||
|
if not def_loc_hash[hash_key] then
|
||||||
|
def_loc_hash[hash_key] = true
|
||||||
|
table.insert(unique_defs, def_location)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
options.items = unique_defs
|
||||||
|
|
||||||
|
-- set the location list
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
vim.fn.setloclist(0, {}, " ", options)
|
||||||
|
|
||||||
|
-- open the location list when we have more than 1 definitions found,
|
||||||
|
-- otherwise, jump directly to the definition
|
||||||
|
if #options.items > 1 then
|
||||||
|
vim.cmd.lopen()
|
||||||
|
else
|
||||||
|
vim.cmd([[silent! lfirst]])
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end, { desc = "go to definition" })
|
||||||
map("n", "<C-]>", vim.lsp.buf.definition)
|
map("n", "<C-]>", vim.lsp.buf.definition)
|
||||||
map("n", "K", function()
|
map("n", "K", function()
|
||||||
vim.lsp.buf.hover { border = "single", max_height = 25, max_width = 120 }
|
vim.lsp.buf.hover { border = "single", max_height = 25, max_width = 120 }
|
||||||
@@ -40,10 +73,6 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||||||
end, { desc = "list workspace folder" })
|
end, { desc = "list workspace folder" })
|
||||||
|
|
||||||
-- Set some key bindings conditional on server capabilities
|
-- Set some key bindings conditional on server capabilities
|
||||||
if client.server_capabilities.documentFormattingProvider and client.name ~= "lua_ls" then
|
|
||||||
map({ "n", "x" }, "<space>f", vim.lsp.buf.format, { desc = "format code" })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Disable ruff hover feature in favor of Pyright
|
-- Disable ruff hover feature in favor of Pyright
|
||||||
if client.name == "ruff" then
|
if client.name == "ruff" then
|
||||||
client.server_capabilities.hoverProvider = false
|
client.server_capabilities.hoverProvider = false
|
||||||
@@ -55,20 +84,20 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||||||
|
|
||||||
-- The blow command will highlight the current variable and its usages in the buffer.
|
-- The blow command will highlight the current variable and its usages in the buffer.
|
||||||
if client.server_capabilities.documentHighlightProvider then
|
if client.server_capabilities.documentHighlightProvider then
|
||||||
local gid = api.nvim_create_augroup("lsp_document_highlight", { clear = true })
|
local gid = vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true })
|
||||||
api.nvim_create_autocmd("CursorHold", {
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
group = gid,
|
group = gid,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
lsp.buf.document_highlight()
|
vim.lsp.buf.document_highlight()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
api.nvim_create_autocmd("CursorMoved", {
|
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||||
group = gid,
|
group = gid,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
lsp.buf.clear_references()
|
vim.lsp.buf.clear_references()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -77,139 +106,38 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||||||
desc = "Configure buffer keymap and behavior based on LSP",
|
desc = "Configure buffer keymap and behavior based on LSP",
|
||||||
})
|
})
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
-- Enable lsp servers when they are available
|
||||||
|
|
||||||
-- required by nvim-ufo
|
local capabilities = require("lsp_utils").get_default_capabilities()
|
||||||
capabilities.textDocument.foldingRange = {
|
|
||||||
dynamicRegistration = false,
|
vim.lsp.config("*", {
|
||||||
lineFoldingOnly = true,
|
capabilities = capabilities,
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 500,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- A mapping from lsp server name to the executable name
|
||||||
|
local enabled_lsp_servers = {
|
||||||
|
pyright = "delance-langserver",
|
||||||
|
ruff = "ruff",
|
||||||
|
lua_ls = "lua-language-server",
|
||||||
|
-- ltex = "ltex-ls",
|
||||||
|
-- clangd = "clangd",
|
||||||
|
vimls = "vim-language-server",
|
||||||
|
bashls = "bash-language-server",
|
||||||
|
yamlls = "yaml-language-server",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- For what diagnostic is enabled in which type checking mode, check doc:
|
for server_name, lsp_executable in pairs(enabled_lsp_servers) do
|
||||||
-- https://github.com/microsoft/pyright/blob/main/docs/configuration.md#diagnostic-settings-defaults
|
if utils.executable(lsp_executable) then
|
||||||
-- Currently, the pyright also has some issues displaying hover documentation:
|
vim.lsp.enable(server_name)
|
||||||
-- https://www.reddit.com/r/neovim/comments/1gdv1rc/what_is_causeing_the_lsp_hover_docs_to_looks_like/
|
else
|
||||||
|
local msg = string.format(
|
||||||
if utils.executable("pyright") then
|
"Executable '%s' for server '%s' not found! Server will not be enabled",
|
||||||
local new_capability = {
|
lsp_executable,
|
||||||
-- this will remove some of the diagnostics that duplicates those from ruff, idea taken and adapted from
|
server_name
|
||||||
-- here: https://github.com/astral-sh/ruff-lsp/issues/384#issuecomment-1989619482
|
)
|
||||||
textDocument = {
|
vim.notify(msg, vim.log.levels.WARN, { title = "Nvim-config" })
|
||||||
publishDiagnostics = {
|
end
|
||||||
tagSupport = {
|
|
||||||
valueSet = { 2 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
hover = {
|
|
||||||
contentFormat = { "plaintext" },
|
|
||||||
dynamicRegistration = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
local merged_capability = vim.tbl_deep_extend("force", capabilities, new_capability)
|
|
||||||
|
|
||||||
lspconfig.pyright.setup {
|
|
||||||
cmd = { "delance-langserver", "--stdio" },
|
|
||||||
capabilities = merged_capability,
|
|
||||||
settings = {
|
|
||||||
pyright = {
|
|
||||||
-- disable import sorting and use Ruff for this
|
|
||||||
disableOrganizeImports = true,
|
|
||||||
disableTaggedHints = false,
|
|
||||||
},
|
|
||||||
python = {
|
|
||||||
analysis = {
|
|
||||||
autoSearchPaths = true,
|
|
||||||
diagnosticMode = "workspace",
|
|
||||||
typeCheckingMode = "standard",
|
|
||||||
useLibraryCodeForTypes = true,
|
|
||||||
-- we can this setting below to redefine some diagnostics
|
|
||||||
diagnosticSeverityOverrides = {
|
|
||||||
deprecateTypingAliases = false,
|
|
||||||
},
|
|
||||||
-- inlay hint settings are provided by pylance?
|
|
||||||
inlayHints = {
|
|
||||||
callArgumentNames = "partial",
|
|
||||||
functionReturnTypes = true,
|
|
||||||
pytestParameters = true,
|
|
||||||
variableTypes = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
else
|
|
||||||
vim.notify("pyright not found!", vim.log.levels.WARN, { title = "Nvim-config" })
|
|
||||||
end
|
|
||||||
|
|
||||||
if utils.executable("ruff") then
|
|
||||||
require("lspconfig").ruff.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
init_options = {
|
|
||||||
-- the settings can be found here: https://docs.astral.sh/ruff/editors/settings/
|
|
||||||
settings = {
|
|
||||||
organizeImports = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
if utils.executable("ltex-ls") then
|
|
||||||
lspconfig.ltex.setup {
|
|
||||||
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 {
|
|
||||||
capabilities = capabilities,
|
|
||||||
filetypes = { "c", "cpp", "cc" },
|
|
||||||
flags = {
|
|
||||||
debounce_text_changes = 500,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- set up vim-language-server
|
|
||||||
if utils.executable("vim-language-server") then
|
|
||||||
lspconfig.vimls.setup {
|
|
||||||
flags = {
|
|
||||||
debounce_text_changes = 500,
|
|
||||||
},
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
else
|
|
||||||
vim.notify("vim-language-server not found!", vim.log.levels.WARN, { title = "Nvim-config" })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- set up bash-language-server
|
|
||||||
if utils.executable("bash-language-server") then
|
|
||||||
lspconfig.bashls.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- settings for lua-language-server can be found on https://luals.github.io/wiki/settings/
|
|
||||||
if utils.executable("lua-language-server") then
|
|
||||||
lspconfig.lua_ls.setup {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
runtime = {
|
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
|
||||||
version = "LuaJIT",
|
|
||||||
},
|
|
||||||
hint = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ require("lualine").setup {
|
|||||||
disabled_filetypes = {},
|
disabled_filetypes = {},
|
||||||
always_divide_middle = true,
|
always_divide_middle = true,
|
||||||
refresh = {
|
refresh = {
|
||||||
statusline = 500,
|
statusline = 1000,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
-- Setup nvim-cmp.
|
-- Setup nvim-cmp.
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
local lspkind = require("lspkind")
|
|
||||||
|
-- The extentions needed by nvim-cmp should be loaded beforehand
|
||||||
|
require("cmp_nvim_lsp")
|
||||||
|
require("cmp_path")
|
||||||
|
require("cmp_buffer")
|
||||||
|
require("cmp_omni")
|
||||||
|
require("cmp_nvim_ultisnips")
|
||||||
|
require("cmp_cmdline")
|
||||||
|
|
||||||
|
local MiniIcons = require("mini.icons")
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
@@ -43,21 +52,14 @@ cmp.setup {
|
|||||||
view = {
|
view = {
|
||||||
entries = "custom",
|
entries = "custom",
|
||||||
},
|
},
|
||||||
|
-- solution taken from https://github.com/echasnovski/mini.nvim/issues/1007#issuecomment-2258929830
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format {
|
format = function(_, vim_item)
|
||||||
mode = "symbol_text",
|
local icon, hl = MiniIcons.get("lsp", vim_item.kind)
|
||||||
menu = {
|
vim_item.kind = icon .. " " .. vim_item.kind
|
||||||
nvim_lsp = "[LSP]",
|
vim_item.kind_hl_group = hl
|
||||||
ultisnips = "[US]",
|
return vim_item
|
||||||
path = "[Path]",
|
end,
|
||||||
buffer = "[Buffer]",
|
|
||||||
emoji = "[Emoji]",
|
|
||||||
omni = "[Omni]",
|
|
||||||
},
|
|
||||||
show_labelDetails = true,
|
|
||||||
maxwidth = 40,
|
|
||||||
ellipsis_char = "...",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +72,23 @@ cmp.setup.filetype("tex", {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline("/", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "path" },
|
||||||
|
}, {
|
||||||
|
{ name = "cmdline" },
|
||||||
|
}),
|
||||||
|
matching = { disallow_symbol_nonprefix_matching = false },
|
||||||
|
})
|
||||||
|
|
||||||
-- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu
|
-- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
highlight! link CmpItemMenu Comment
|
highlight! link CmpItemMenu Comment
|
||||||
|
|||||||
@@ -228,8 +228,13 @@ api.nvim_create_autocmd("BufReadPre", {
|
|||||||
|
|
||||||
if fn.getfsize(f) > file_size_limit or fn.getfsize(f) == -2 then
|
if fn.getfsize(f) > file_size_limit or fn.getfsize(f) == -2 then
|
||||||
vim.o.eventignore = "all"
|
vim.o.eventignore = "all"
|
||||||
|
|
||||||
|
-- show ruler
|
||||||
|
vim.o.ruler = true
|
||||||
|
|
||||||
-- turning off relative number helps a lot
|
-- turning off relative number helps a lot
|
||||||
vim.wo.relativenumber = false
|
vim.wo.relativenumber = false
|
||||||
|
vim.wo.number = false
|
||||||
|
|
||||||
vim.bo.swapfile = false
|
vim.bo.swapfile = false
|
||||||
vim.bo.bufhidden = "unload"
|
vim.bo.bufhidden = "unload"
|
||||||
|
|||||||
15
lua/lsp_utils.lua
Normal file
15
lua/lsp_utils.lua
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.get_default_capabilities = function()
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
|
||||||
|
-- required by nvim-ufo
|
||||||
|
capabilities.textDocument.foldingRange = {
|
||||||
|
dynamicRegistration = false,
|
||||||
|
lineFoldingOnly = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
return capabilities
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -104,7 +104,7 @@ keymap.set("n", "<leader>v", "printf('`[%s`]', getregtype()[0])", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Always use very magic mode for searching
|
-- Always use very magic mode for searching
|
||||||
keymap.set("n", "/", [[/\v]])
|
-- keymap.set("n", "/", [[/\v]])
|
||||||
|
|
||||||
-- Search in selected region
|
-- Search in selected region
|
||||||
-- xnoremap / :<C-U>call feedkeys('/\%>'.(line("'<")-1).'l\%<'.(line("'>")+1)."l")<CR>
|
-- xnoremap / :<C-U>call feedkeys('/\%>'.(line("'<")-1).'l\%<'.(line("'>")+1)."l")<CR>
|
||||||
|
|||||||
@@ -22,24 +22,83 @@ end
|
|||||||
|
|
||||||
local plugin_specs = {
|
local plugin_specs = {
|
||||||
-- auto-completion engine
|
-- auto-completion engine
|
||||||
|
{ "hrsh7th/cmp-nvim-lsp", lazy = true },
|
||||||
|
{ "hrsh7th/cmp-path", lazy = true },
|
||||||
|
{ "hrsh7th/cmp-buffer", lazy = true },
|
||||||
|
{ "hrsh7th/cmp-omni", lazy = true },
|
||||||
|
{ "hrsh7th/cmp-cmdline", lazy = true },
|
||||||
|
{ "quangnguyen30192/cmp-nvim-ultisnips", lazy = true },
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
name = "nvim-cmp",
|
name = "nvim-cmp",
|
||||||
-- event = 'InsertEnter',
|
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
dependencies = {
|
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
"onsails/lspkind-nvim",
|
|
||||||
"hrsh7th/cmp-path",
|
|
||||||
"hrsh7th/cmp-buffer",
|
|
||||||
"hrsh7th/cmp-omni",
|
|
||||||
"quangnguyen30192/cmp-nvim-ultisnips",
|
|
||||||
},
|
|
||||||
config = function()
|
config = function()
|
||||||
require("config.nvim-cmp")
|
require("config.nvim-cmp")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
--{
|
||||||
|
-- "saghen/blink.cmp",
|
||||||
|
-- -- optional: provides snippets for the snippet source
|
||||||
|
-- dependencies = { "rafamadriz/friendly-snippets" },
|
||||||
|
|
||||||
|
-- -- use a release tag to download pre-built binaries
|
||||||
|
-- version = "1.*",
|
||||||
|
|
||||||
|
-- ---@module 'blink.cmp'
|
||||||
|
-- ---@type blink.cmp.Config
|
||||||
|
-- opts = {
|
||||||
|
-- -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||||
|
-- -- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||||
|
-- -- 'enter' for enter to accept
|
||||||
|
-- -- 'none' for no mappings
|
||||||
|
-- --
|
||||||
|
-- keymap = {
|
||||||
|
-- preset = "default",
|
||||||
|
-- ["<Tab>"] = { "select_next", "fallback" },
|
||||||
|
-- ["<S-Tab>"] = { "select_prev", "fallback" },
|
||||||
|
-- ["<Enter>"] = { "select_and_accept", "fallback" },
|
||||||
|
-- ["<C-U>"] = { "scroll_documentation_up", "fallback" },
|
||||||
|
-- ["<C-D>"] = { "scroll_documentation_down", "fallback" },
|
||||||
|
-- },
|
||||||
|
|
||||||
|
-- appearance = {
|
||||||
|
-- -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
|
-- -- Adjusts spacing to ensure icons are aligned
|
||||||
|
-- nerd_font_variant = "mono",
|
||||||
|
-- },
|
||||||
|
|
||||||
|
-- -- (Default) Only show the documentation popup when manually triggered
|
||||||
|
-- completion = {
|
||||||
|
-- documentation = {
|
||||||
|
-- auto_show = true,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
|
||||||
|
-- -- Default list of enabled providers defined so that you can extend it
|
||||||
|
-- -- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||||
|
-- sources = {
|
||||||
|
-- default = { "lsp", "path", "buffer" },
|
||||||
|
-- },
|
||||||
|
|
||||||
|
-- -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||||
|
-- -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||||
|
-- -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||||
|
-- --
|
||||||
|
-- -- See the fuzzy documentation for more information
|
||||||
|
-- fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||||
|
-- cmdline = {
|
||||||
|
-- completion = {
|
||||||
|
-- menu = {
|
||||||
|
-- auto_show = true,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- keymap = {
|
||||||
|
-- ["<Enter>"] = { "select_and_accept", "fallback" },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- opts_extend = { "sources.default" },
|
||||||
|
--},
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
event = { "BufRead", "BufNewFile" },
|
event = { "BufRead", "BufNewFile" },
|
||||||
@@ -56,7 +115,7 @@ local plugin_specs = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
event = "VeryLazy",
|
lazy = true,
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
config = function()
|
config = function()
|
||||||
require("config.treesitter")
|
require("config.treesitter")
|
||||||
@@ -77,10 +136,7 @@ local plugin_specs = {
|
|||||||
{
|
{
|
||||||
"vlime/vlime",
|
"vlime/vlime",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if utils.executable("sbcl") then
|
return utils.executable("sbcl")
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
end,
|
||||||
config = function(plugin)
|
config = function(plugin)
|
||||||
vim.opt.rtp:append(plugin.dir .. "/vim")
|
vim.opt.rtp:append(plugin.dir .. "/vim")
|
||||||
@@ -91,7 +147,7 @@ local plugin_specs = {
|
|||||||
-- Super fast buffer jump
|
-- Super fast buffer jump
|
||||||
{
|
{
|
||||||
"smoka7/hop.nvim",
|
"smoka7/hop.nvim",
|
||||||
event = "VeryLazy",
|
keys = { "f" },
|
||||||
config = function()
|
config = function()
|
||||||
require("config.nvim_hop")
|
require("config.nvim_hop")
|
||||||
end,
|
end,
|
||||||
@@ -106,20 +162,6 @@ local plugin_specs = {
|
|||||||
require("config.hlslens")
|
require("config.hlslens")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Yggdroot/LeaderF",
|
|
||||||
cmd = "Leaderf",
|
|
||||||
build = function()
|
|
||||||
local leaderf_path = plugin_dir .. "/LeaderF"
|
|
||||||
vim.opt.runtimepath:append(leaderf_path)
|
|
||||||
vim.cmd("runtime! plugin/leaderf.vim")
|
|
||||||
|
|
||||||
if not vim.g.is_win then
|
|
||||||
vim.cmd("LeaderfInstallCExtension")
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
@@ -129,18 +171,16 @@ local plugin_specs = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ibhagwan/fzf-lua",
|
"ibhagwan/fzf-lua",
|
||||||
-- optional for icon support
|
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
|
||||||
config = function()
|
config = function()
|
||||||
-- calling `setup` is optional for customization
|
require("config.fzf-lua")
|
||||||
require("fzf-lua").setup {}
|
|
||||||
end,
|
end,
|
||||||
|
event = "VeryLazy",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"MeanderingProgrammer/markdown.nvim",
|
"MeanderingProgrammer/markdown.nvim",
|
||||||
main = "render-markdown",
|
main = "render-markdown",
|
||||||
opts = {},
|
opts = {},
|
||||||
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" },
|
ft = { "markdown" },
|
||||||
},
|
},
|
||||||
-- 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.
|
||||||
{ "navarasu/onedark.nvim", lazy = true },
|
{ "navarasu/onedark.nvim", lazy = true },
|
||||||
@@ -159,11 +199,22 @@ local plugin_specs = {
|
|||||||
branch = "v2",
|
branch = "v2",
|
||||||
},
|
},
|
||||||
{ "rebelot/kanagawa.nvim", lazy = true },
|
{ "rebelot/kanagawa.nvim", lazy = true },
|
||||||
{ "nvim-tree/nvim-web-devicons", event = "VeryLazy" },
|
|
||||||
|
-- plugins to provide nerdfont icons
|
||||||
|
{
|
||||||
|
"echasnovski/mini.icons",
|
||||||
|
version = false,
|
||||||
|
config = function()
|
||||||
|
-- this is the compatibility fix for plugins that only support nvim-web-devicons
|
||||||
|
require("mini.icons").mock_nvim_web_devicons()
|
||||||
|
require("mini.icons").tweak_lsp_kind()
|
||||||
|
end,
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
event = "VeryLazy",
|
event = "BufRead",
|
||||||
cond = firenvim_not_active,
|
cond = firenvim_not_active,
|
||||||
config = function()
|
config = function()
|
||||||
require("config.lualine")
|
require("config.lualine")
|
||||||
@@ -189,11 +240,16 @@ local plugin_specs = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"echasnovski/mini.indentscope",
|
||||||
event = "VeryLazy",
|
version = false,
|
||||||
main = "ibl",
|
|
||||||
config = function()
|
config = function()
|
||||||
require("config.indent-blankline")
|
local mini_indent = require("mini.indentscope")
|
||||||
|
mini_indent.setup {
|
||||||
|
draw = {
|
||||||
|
animation = mini_indent.gen_animation.none(),
|
||||||
|
},
|
||||||
|
symbol = "▏",
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -219,7 +275,7 @@ local plugin_specs = {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- Highlight URLs inside vim
|
-- Highlight URLs inside vim
|
||||||
{ "itchyny/vim-highlighturl", event = "VeryLazy" },
|
{ "itchyny/vim-highlighturl", event = "BufReadPost" },
|
||||||
|
|
||||||
-- notification plugin
|
-- notification plugin
|
||||||
{
|
{
|
||||||
@@ -230,6 +286,8 @@ local plugin_specs = {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ "nvim-lua/plenary.nvim", lazy = true },
|
||||||
|
|
||||||
-- 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.
|
||||||
{
|
{
|
||||||
@@ -240,13 +298,8 @@ local plugin_specs = {
|
|||||||
vim.g.netrw_nogx = 1 -- disable netrw gx
|
vim.g.netrw_nogx = 1 -- disable netrw gx
|
||||||
end,
|
end,
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if vim.g.is_win or vim.g.is_mac then
|
return vim.g.is_win or vim.g.is_mac
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
|
||||||
config = true, -- default settings
|
config = true, -- default settings
|
||||||
submodules = false, -- not needed, submodules are required only for tests
|
submodules = false, -- not needed, submodules are required only for tests
|
||||||
},
|
},
|
||||||
@@ -256,19 +309,19 @@ local plugin_specs = {
|
|||||||
{
|
{
|
||||||
"liuchengxu/vista.vim",
|
"liuchengxu/vista.vim",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if utils.executable("ctags") then
|
return utils.executable("ctags")
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
cmd = "Vista",
|
cmd = "Vista",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Snippet engine and snippet template
|
-- Snippet engine and snippet template
|
||||||
{ "SirVer/ultisnips", dependencies = {
|
{
|
||||||
"honza/vim-snippets",
|
"SirVer/ultisnips",
|
||||||
}, event = "InsertEnter" },
|
dependencies = {
|
||||||
|
"honza/vim-snippets",
|
||||||
|
},
|
||||||
|
event = "InsertEnter",
|
||||||
|
},
|
||||||
|
|
||||||
-- Automatic insertion and deletion of a pair of characters
|
-- Automatic insertion and deletion of a pair of characters
|
||||||
{
|
{
|
||||||
@@ -278,7 +331,13 @@ local plugin_specs = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- Comment plugin
|
-- Comment plugin
|
||||||
{ "tpope/vim-commentary", event = "VeryLazy" },
|
{
|
||||||
|
"tpope/vim-commentary",
|
||||||
|
keys = {
|
||||||
|
{ "gc", mode = "n" },
|
||||||
|
{ "gc", mode = "v" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
-- Multiple cursor plugin like Sublime Text?
|
-- Multiple cursor plugin like Sublime Text?
|
||||||
-- 'mg979/vim-visual-multi'
|
-- 'mg979/vim-visual-multi'
|
||||||
@@ -292,7 +351,7 @@ local plugin_specs = {
|
|||||||
config = function()
|
config = function()
|
||||||
require("config.yanky")
|
require("config.yanky")
|
||||||
end,
|
end,
|
||||||
event = "VeryLazy",
|
cmd = "YankyRingHistory",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Handy unix command inside Vim (Rename, Move etc.)
|
-- Handy unix command inside Vim (Rename, Move etc.)
|
||||||
@@ -306,10 +365,7 @@ local plugin_specs = {
|
|||||||
{
|
{
|
||||||
"lyokha/vim-xkbswitch",
|
"lyokha/vim-xkbswitch",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if vim.g.is_mac and utils.executable("xkbswitch") then
|
return vim.g.is_mac and utils.executable("xkbswitch")
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
end,
|
||||||
event = { "InsertEnter" },
|
event = { "InsertEnter" },
|
||||||
},
|
},
|
||||||
@@ -317,17 +373,11 @@ local plugin_specs = {
|
|||||||
{
|
{
|
||||||
"Neur1n/neuims",
|
"Neur1n/neuims",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if vim.g.is_win then
|
return vim.g.is_win
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
end,
|
||||||
event = { "InsertEnter" },
|
event = { "InsertEnter" },
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Auto format tools
|
|
||||||
{ "sbdchd/neoformat", cmd = { "Neoformat" } },
|
|
||||||
|
|
||||||
-- Git command inside vim
|
-- Git command inside vim
|
||||||
{
|
{
|
||||||
"tpope/vim-fugitive",
|
"tpope/vim-fugitive",
|
||||||
@@ -339,7 +389,14 @@ local plugin_specs = {
|
|||||||
|
|
||||||
-- Better git log display
|
-- Better git log display
|
||||||
{ "rbong/vim-flog", cmd = { "Flog" } },
|
{ "rbong/vim-flog", cmd = { "Flog" } },
|
||||||
{ "akinsho/git-conflict.nvim", version = "*", config = true },
|
{
|
||||||
|
"akinsho/git-conflict.nvim",
|
||||||
|
version = "*",
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function()
|
||||||
|
require("config.git-conflict")
|
||||||
|
end,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ruifm/gitlinker.nvim",
|
"ruifm/gitlinker.nvim",
|
||||||
event = "User InGitRepo",
|
event = "User InGitRepo",
|
||||||
@@ -354,10 +411,12 @@ local plugin_specs = {
|
|||||||
config = function()
|
config = function()
|
||||||
require("config.gitsigns")
|
require("config.gitsigns")
|
||||||
end,
|
end,
|
||||||
|
event = "BufRead",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"sindrets/diffview.nvim",
|
"sindrets/diffview.nvim",
|
||||||
|
cmd = { "DiffviewOpen" },
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -368,23 +427,17 @@ local plugin_specs = {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Another markdown plugin
|
|
||||||
{ "preservim/vim-markdown", ft = { "markdown" } },
|
|
||||||
|
|
||||||
-- Faster footnote generation
|
-- Faster footnote generation
|
||||||
{ "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
|
||||||
{ "godlygeek/tabular", cmd = { "Tabularize" } },
|
{ "godlygeek/tabular", ft = { "markdown" } },
|
||||||
|
|
||||||
-- Markdown previewing (only for Mac and Windows)
|
-- Markdown previewing (only for Mac and Windows)
|
||||||
{
|
{
|
||||||
"iamcco/markdown-preview.nvim",
|
"iamcco/markdown-preview.nvim",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if vim.g.is_win or vim.g.is_mac then
|
return vim.g.is_win or vim.g.is_mac
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
end,
|
||||||
build = "cd app && npm install && git restore .",
|
build = "cd app && npm install && git restore .",
|
||||||
ft = { "markdown" },
|
ft = { "markdown" },
|
||||||
@@ -393,15 +446,12 @@ local plugin_specs = {
|
|||||||
{
|
{
|
||||||
"rhysd/vim-grammarous",
|
"rhysd/vim-grammarous",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if vim.g.is_mac then
|
return vim.g.is_mac
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
end,
|
||||||
ft = { "markdown" },
|
ft = { "markdown" },
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "chrisbra/unicode.vim", event = "VeryLazy" },
|
{ "chrisbra/unicode.vim", keys = { "ga" }, cmd = { "UnicodeSearch" } },
|
||||||
|
|
||||||
-- 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
|
||||||
@@ -410,17 +460,11 @@ local plugin_specs = {
|
|||||||
-- Plugin to manipulate character pairs quickly
|
-- Plugin to manipulate character pairs quickly
|
||||||
{ "machakann/vim-sandwich", event = "VeryLazy" },
|
{ "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
|
-- Only use these plugin on Windows and Mac and when LaTeX is installed
|
||||||
{
|
{
|
||||||
"lervag/vimtex",
|
"lervag/vimtex",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if utils.executable("latex") then
|
return utils.executable("latex")
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
end,
|
||||||
ft = { "tex" },
|
ft = { "tex" },
|
||||||
},
|
},
|
||||||
@@ -431,10 +475,7 @@ local plugin_specs = {
|
|||||||
{
|
{
|
||||||
"tmux-plugins/vim-tmux",
|
"tmux-plugins/vim-tmux",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if utils.executable("tmux") then
|
return utils.executable("tmux")
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
end,
|
||||||
ft = { "tmux" },
|
ft = { "tmux" },
|
||||||
},
|
},
|
||||||
@@ -451,8 +492,7 @@ local plugin_specs = {
|
|||||||
{
|
{
|
||||||
"glacambre/firenvim",
|
"glacambre/firenvim",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
local result = vim.g.is_win or vim.g.is_mac
|
return vim.g.is_win or vim.g.is_mac
|
||||||
return result
|
|
||||||
end,
|
end,
|
||||||
-- it seems that we can only call the firenvim function directly.
|
-- it seems that we can only call the firenvim function directly.
|
||||||
-- Using vim.fn or vim.cmd to call this function will fail.
|
-- Using vim.fn or vim.cmd to call this function will fail.
|
||||||
@@ -475,10 +515,7 @@ local plugin_specs = {
|
|||||||
{
|
{
|
||||||
"sakhnik/nvim-gdb",
|
"sakhnik/nvim-gdb",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if vim.g.is_win or vim.g.is_linux then
|
return vim.g.is_win or vim.g.is_linux
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
end,
|
||||||
build = { "bash install.sh" },
|
build = { "bash install.sh" },
|
||||||
lazy = true,
|
lazy = true,
|
||||||
@@ -490,20 +527,11 @@ local plugin_specs = {
|
|||||||
{
|
{
|
||||||
"ojroques/vim-oscyank",
|
"ojroques/vim-oscyank",
|
||||||
enabled = function()
|
enabled = function()
|
||||||
if vim.g.is_linux then
|
return vim.g.is_linux
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
end,
|
||||||
cmd = { "OSCYank", "OSCYankReg" },
|
cmd = { "OSCYank", "OSCYankReg" },
|
||||||
},
|
},
|
||||||
|
|
||||||
-- The missing auto-completion for cmdline!
|
|
||||||
{
|
|
||||||
"gelguy/wilder.nvim",
|
|
||||||
build = ":UpdateRemotePlugins",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- showing keybindings
|
-- showing keybindings
|
||||||
{
|
{
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
@@ -535,8 +563,7 @@ local plugin_specs = {
|
|||||||
-- file explorer
|
-- file explorer
|
||||||
{
|
{
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
event = "VeryLazy",
|
keys = { "<space>s" },
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
|
||||||
config = function()
|
config = function()
|
||||||
require("config.nvim-tree")
|
require("config.nvim-tree")
|
||||||
end,
|
end,
|
||||||
@@ -544,8 +571,7 @@ local plugin_specs = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"j-hui/fidget.nvim",
|
"j-hui/fidget.nvim",
|
||||||
event = "VeryLazy",
|
event = "BufRead",
|
||||||
tag = "legacy",
|
|
||||||
config = function()
|
config = function()
|
||||||
require("config.fidget-nvim")
|
require("config.fidget-nvim")
|
||||||
end,
|
end,
|
||||||
@@ -565,13 +591,12 @@ local plugin_specs = {
|
|||||||
"CopilotC-Nvim/CopilotChat.nvim",
|
"CopilotC-Nvim/CopilotChat.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
|
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
|
||||||
{ "nvim-lua/plenary.nvim" }, -- for curl, log wrapper
|
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
debug = true, -- Enable debugging
|
debug = true, -- Enable debugging
|
||||||
-- See Configuration section for rest
|
-- See Configuration section for rest
|
||||||
},
|
},
|
||||||
-- See Commands section for default commands if you want to lazy load on them
|
cmd = { "CopilotChat" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"zbirenbaum/copilot.lua",
|
"zbirenbaum/copilot.lua",
|
||||||
@@ -588,7 +613,6 @@ local plugin_specs = {
|
|||||||
config = function()
|
config = function()
|
||||||
require("config.live-command")
|
require("config.live-command")
|
||||||
end,
|
end,
|
||||||
event = "VeryLazy",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
-- show hint for code actions, the user can also implement code actions themselves,
|
-- show hint for code actions, the user can also implement code actions themselves,
|
||||||
@@ -597,9 +621,11 @@ local plugin_specs = {
|
|||||||
config = function()
|
config = function()
|
||||||
require("config.lightbulb")
|
require("config.lightbulb")
|
||||||
end,
|
end,
|
||||||
|
event = "LspAttach",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Bekaboo/dropbar.nvim",
|
"Bekaboo/dropbar.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"catgoose/nvim-colorizer.lua",
|
"catgoose/nvim-colorizer.lua",
|
||||||
|
|||||||
@@ -3,12 +3,11 @@ local version = vim.version
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
--- Check if an executable exists
|
||||||
|
--- @param name string An executable name/path
|
||||||
|
--- @return boolean
|
||||||
function M.executable(name)
|
function M.executable(name)
|
||||||
if fn.executable(name) > 0 then
|
return fn.executable(name) > 0
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- check whether a feature exists in Nvim
|
--- check whether a feature exists in Nvim
|
||||||
|
|||||||
@@ -34,85 +34,6 @@ let g:UltiSnipsSnippetDirectories=['UltiSnips', 'my_snippets']
|
|||||||
"""""""""""""""""""""""""" vlime settings """"""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""" vlime settings """"""""""""""""""""""""""""""""
|
||||||
command! -nargs=0 StartVlime call jobstart(printf("sbcl --load %s/vlime/lisp/start-vlime.lisp", g:package_home))
|
command! -nargs=0 StartVlime call jobstart(printf("sbcl --load %s/vlime/lisp/start-vlime.lisp", g:package_home))
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""LeaderF settings"""""""""""""""""""""
|
|
||||||
" Do not use cache file
|
|
||||||
let g:Lf_UseCache = 0
|
|
||||||
" Refresh each time we call leaderf
|
|
||||||
let g:Lf_UseMemoryCache = 0
|
|
||||||
|
|
||||||
" Ignore certain files and directories when searching files
|
|
||||||
let g:Lf_WildIgnore = {
|
|
||||||
\ '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',
|
|
||||||
\ '*.wmv', '*.mkv', '*.mp4', '*.rmvb', '*.ttf', '*.ttc', '*.otf',
|
|
||||||
\ '*.mp3', '*.aac']
|
|
||||||
\}
|
|
||||||
|
|
||||||
" Do not show fancy icons for Linux server.
|
|
||||||
if g:is_linux
|
|
||||||
let g:Lf_ShowDevIcons = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Only fuzzy-search files names
|
|
||||||
let g:Lf_DefaultMode = 'FullPath'
|
|
||||||
|
|
||||||
" Do not use version control tool to list files under a directory since
|
|
||||||
" submodules are not searched by default.
|
|
||||||
let g:Lf_UseVersionControlTool = 0
|
|
||||||
|
|
||||||
" Use rg as the default search tool
|
|
||||||
let g:Lf_DefaultExternalTool = "rg"
|
|
||||||
|
|
||||||
" show dot files
|
|
||||||
let g:Lf_ShowHidden = 1
|
|
||||||
|
|
||||||
" Disable default mapping
|
|
||||||
let g:Lf_ShortcutF = ''
|
|
||||||
let g:Lf_ShortcutB = ''
|
|
||||||
|
|
||||||
" set up working directory for git repository
|
|
||||||
let g:Lf_WorkingDirectoryMode = 'a'
|
|
||||||
|
|
||||||
" Search files in popup window
|
|
||||||
nnoremap <silent> <leader>ff :<C-U>Leaderf file --popup<CR>
|
|
||||||
|
|
||||||
" Grep project files in popup window
|
|
||||||
nnoremap <silent> <leader>fg :<C-U>Leaderf rg --no-messages --popup --nameOnly<CR>
|
|
||||||
|
|
||||||
" Search vim help files
|
|
||||||
nnoremap <silent> <leader>fh :<C-U>Leaderf help --popup<CR>
|
|
||||||
|
|
||||||
" Search tags in current buffer
|
|
||||||
nnoremap <silent> <leader>ft :<C-U>Leaderf bufTag --popup<CR>
|
|
||||||
|
|
||||||
" Switch buffers
|
|
||||||
nnoremap <silent> <leader>fb :<C-U>Leaderf buffer --popup<CR>
|
|
||||||
|
|
||||||
" Search recent files
|
|
||||||
nnoremap <silent> <leader>fr :<C-U>Leaderf mru --popup --absolute-path<CR>
|
|
||||||
|
|
||||||
let g:Lf_PopupColorscheme = 'gruvbox_material'
|
|
||||||
|
|
||||||
" Change keybinding in LeaderF prompt mode, use ctrl-n and ctrl-p to navigate
|
|
||||||
" 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
|
|
||||||
\}
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""" vista settings """"""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""" vista settings """"""""""""""""""""""""""""""""""
|
||||||
let g:vista#renderer#icons = {
|
let g:vista#renderer#icons = {
|
||||||
\ 'member': '',
|
\ 'member': '',
|
||||||
@@ -151,25 +72,6 @@ let g:neoformat_c_clangformat = {
|
|||||||
let g:neoformat_enabled_cpp = ['clangformat']
|
let g:neoformat_enabled_cpp = ['clangformat']
|
||||||
let g:neoformat_enabled_c = ['clangformat']
|
let g:neoformat_enabled_c = ['clangformat']
|
||||||
|
|
||||||
"""""""""""""""""""""""""vim-markdown settings"""""""""""""""""""
|
|
||||||
" Disable header folding
|
|
||||||
let g:vim_markdown_folding_disabled = 1
|
|
||||||
|
|
||||||
" Whether to use conceal feature in markdown
|
|
||||||
let g:vim_markdown_conceal = 1
|
|
||||||
|
|
||||||
" Disable math tex conceal and syntax highlight
|
|
||||||
let g:tex_conceal = ''
|
|
||||||
let g:vim_markdown_math = 0
|
|
||||||
|
|
||||||
" Support front matter of various format
|
|
||||||
let g:vim_markdown_frontmatter = 1 " for YAML format
|
|
||||||
let g:vim_markdown_toml_frontmatter = 1 " for TOML format
|
|
||||||
let g:vim_markdown_json_frontmatter = 1 " for JSON format
|
|
||||||
|
|
||||||
" Let the TOC window autofit so that it doesn't take too much space
|
|
||||||
let g:vim_markdown_toc_autofit = 1
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""markdown-preview settings"""""""""""""""""""
|
"""""""""""""""""""""""""markdown-preview settings"""""""""""""""""""
|
||||||
" Only setting this for suitable platforms
|
" Only setting this for suitable platforms
|
||||||
if g:is_win || g:is_mac
|
if g:is_win || g:is_mac
|
||||||
@@ -338,49 +240,3 @@ endif
|
|||||||
|
|
||||||
""""""""""""""""""""""""""""""nvim-gdb settings""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""nvim-gdb settings""""""""""""""""""""""""""""""
|
||||||
nnoremap <leader>dp :<C-U>GdbStartPDB python -m pdb %<CR>
|
nnoremap <leader>dp :<C-U>GdbStartPDB python -m pdb %<CR>
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""wilder.nvim settings""""""""""""""""""""""""""""""
|
|
||||||
call timer_start(250, { -> s:wilder_init() })
|
|
||||||
|
|
||||||
function! s:wilder_init() abort
|
|
||||||
try
|
|
||||||
call wilder#setup({
|
|
||||||
\ 'modes': [':', '/', '?'],
|
|
||||||
\ 'next_key': '<Tab>',
|
|
||||||
\ 'previous_key': '<S-Tab>',
|
|
||||||
\ 'accept_key': '<C-y>',
|
|
||||||
\ 'reject_key': '<C-e>'
|
|
||||||
\ })
|
|
||||||
|
|
||||||
call wilder#set_option('pipeline', [
|
|
||||||
\ wilder#branch(
|
|
||||||
\ wilder#cmdline_pipeline({
|
|
||||||
\ 'language': 'python',
|
|
||||||
\ 'fuzzy': 1,
|
|
||||||
\ 'sorter': wilder#python_difflib_sorter(),
|
|
||||||
\ 'debounce': 30,
|
|
||||||
\ }),
|
|
||||||
\ wilder#python_search_pipeline({
|
|
||||||
\ 'pattern': wilder#python_fuzzy_pattern(),
|
|
||||||
\ 'sorter': wilder#python_difflib_sorter(),
|
|
||||||
\ 'engine': 're',
|
|
||||||
\ 'debounce': 30,
|
|
||||||
\ }),
|
|
||||||
\ ),
|
|
||||||
\ ])
|
|
||||||
|
|
||||||
let l:hl = wilder#make_hl('WilderAccent', 'Pmenu', [{}, {}, {'foreground': '#f4468f'}])
|
|
||||||
call wilder#set_option('renderer', wilder#popupmenu_renderer({
|
|
||||||
\ 'highlighter': wilder#basic_highlighter(),
|
|
||||||
\ 'max_height': 15,
|
|
||||||
\ 'highlights': {
|
|
||||||
\ 'accent': l:hl,
|
|
||||||
\ },
|
|
||||||
\ 'left': [' ', wilder#popupmenu_devicons(),],
|
|
||||||
\ 'right': [' ', wilder#popupmenu_scrollbar(),],
|
|
||||||
\ 'apply_incsearch_fix': 0,
|
|
||||||
\ }))
|
|
||||||
catch /^Vim\%((\a\+)\)\=:E117/
|
|
||||||
echohl Error |echomsg "Wilder.nvim missing"| echohl None
|
|
||||||
endtry
|
|
||||||
endfunction
|
|
||||||
|
|||||||
Reference in New Issue
Block a user