1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Compare commits

..

1 Commits

20 changed files with 461 additions and 336 deletions

View File

@ -59,7 +59,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 [fzf-lua](https://github.com/ibhagwan/fzf-lua). + Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF).
+ 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).
@ -79,6 +79,7 @@ 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)
+ ...... + ......
@ -93,10 +94,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 fzf-lua ## File fuzzy finding using LeaderF
<p align="center"> <p align="center">
<img src="https://github.com/user-attachments/assets/3199e35d-121a-487b-bfd1-58eb69b0b48a" width="800"> <img src="https://user-images.githubusercontent.com/16662357/183257017-2d9d7605-3c4b-4e1d-8955-30998f9b6f28.gif" width="800">
</p> </p>
## Code autocompletion with nvim-cmp ## Code autocompletion with nvim-cmp

View File

@ -12,5 +12,3 @@ 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>

View File

@ -29,12 +29,5 @@ require("custom-autocmd")
require("mappings") require("mappings")
-- all the plugins installed and their configurations -- all the plugins installed and their configurations
vim.cmd("source " .. vim.fs.joinpath(config_dir, "viml_conf/plugins.vim")) vim.cmd("source " .. vim.fs.joinpath(config_dir, "viml_conf/plugins.vim"))
-- diagnostic related config
require("diagnostic-conf")
-- colorscheme settings -- colorscheme settings
local color_scheme = require("colorschemes") require("colorschemes")
-- Load a random colorscheme
color_scheme.rand_colorscheme()

View File

@ -44,7 +44,14 @@ M.colorscheme_conf = {
vim.cmd([[colorscheme everforest]]) vim.cmd([[colorscheme everforest]])
end, end,
nightfox = function() nightfox = function()
vim.cmd([[colorscheme carbonfox]]) vim.cmd([[colorscheme nordfox]])
end,
catppuccin = function()
-- available option: latte, frappe, macchiato, mocha
vim.g.catppuccin_flavour = "frappe"
require("catppuccin").setup()
vim.cmd([[colorscheme catppuccin]])
end, end,
onedarkpro = function() onedarkpro = function()
-- set colorscheme after options -- set colorscheme after options
@ -66,9 +73,24 @@ M.colorscheme_conf = {
--- Use a random colorscheme from the pre-defined list of colorschemes. --- Use a random colorscheme from the pre-defined list of colorschemes.
M.rand_colorscheme = function() M.rand_colorscheme = function()
local colorscheme = utils.rand_element(vim.tbl_keys(M.colorscheme_conf)) local colorscheme = utils.rand_element(vim.tbl_keys(M.colorscheme_conf))
colorscheme = "gruvbox_material"
if not vim.tbl_contains(vim.tbl_keys(M.colorscheme_conf), colorscheme) then
local msg = "Invalid colorscheme: " .. colorscheme
vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" })
return
end
-- Load the colorscheme and its settings -- Load the colorscheme and its settings
M.colorscheme_conf[colorscheme]() M.colorscheme_conf[colorscheme]()
if vim.g.logging_level == "debug" then
local msg = "Colorscheme: " .. colorscheme
vim.notify(msg, vim.log.levels.DEBUG, { title = "nvim-config" })
end
end end
return M -- Load a random colorscheme
M.rand_colorscheme()

View File

@ -23,19 +23,19 @@ conf.center = {
{ {
icon = "󰈞 ", icon = "󰈞 ",
desc = "Find File ", desc = "Find File ",
action = "FzfLua files", action = "Leaderf file --popup",
key = "<Leader> f f", key = "<Leader> f f",
}, },
{ {
icon = "󰈢 ", icon = "󰈢 ",
desc = "Recently opened files ", desc = "Recently opened files ",
action = "FzfLua oldfiles", action = "Leaderf mru --popup",
key = "<Leader> f r", key = "<Leader> f r",
}, },
{ {
icon = "󰈬 ", icon = "󰈬 ",
desc = "Project grep ", desc = "Project grep ",
action = "FzfLua live_grep", action = "Leaderf rg --popup",
key = "<Leader> f g", key = "<Leader> f g",
}, },
{ {

View File

@ -1,18 +0,0 @@
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" })

View File

@ -1,12 +0,0 @@
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,
})

View File

@ -1,12 +0,0 @@
local glance = require("glance")
glance.setup {
height = 25,
border = {
enable = true,
},
}
vim.keymap.set("n", "<space>gd", "<cmd>Glance definitions<cr>")
vim.keymap.set("n", "<space>gr", "<cmd>Glance references<cr>")
vim.keymap.set("n", "<space>gi", "<cmd>Glance implementations<cr>")

View File

@ -0,0 +1,36 @@
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,
})

View File

@ -1,20 +0,0 @@
---@diagnostic disable: missing-fields
require("nvim-lightbulb").setup {
autocmd = {
enabled = true,
updatetime = -1,
},
---@diagnostic disable-next-line: unused-local
filter = function(client_name, result)
-- Ruff always sends these two actions even if there are no action to take,
-- so it is better to just ignore this to avoid noise. See also discussion below:
-- https://github.com/astral-sh/ruff-lsp/issues/91
local ignored_kinds = { "source.fixAll.ruff", "source.organizeImports.ruff" }
if vim.tbl_contains(ignored_kinds, result.kind) then
return false
end
return true
end,
}

View File

@ -1,81 +1,127 @@
local fn = vim.fn
local api = vim.api local api = vim.api
local keymap = vim.keymap local keymap = vim.keymap
local lsp = vim.lsp local lsp = vim.lsp
local diagnostic = vim.diagnostic
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local utils = require("utils") local utils = require("utils")
vim.api.nvim_create_autocmd("LspAttach", { -- set quickfix list from diagnostics in a certain buffer, not the whole workspace
group = vim.api.nvim_create_augroup("buf_behavior_conf", { clear = true }), local set_qflist = function(buf_num, severity)
callback = function(event_context) local diagnostics = nil
local client = vim.lsp.get_client_by_id(event_context.data.client_id) diagnostics = diagnostic.get(buf_num, { severity = severity })
-- vim.print(client.name, client.server_capabilities)
if not client then local qf_items = diagnostic.toqflist(diagnostics)
return vim.fn.setqflist({}, " ", { title = "Diagnostics", items = qf_items })
end
local bufnr = event_context.buf -- open quickfix by default
vim.cmd([[copen]])
end
-- Mappings. local custom_attach = function(client, bufnr)
local map = function(mode, l, r, opts) -- Mappings.
opts = opts or {} local map = function(mode, l, r, opts)
opts.silent = true opts = opts or {}
opts.buffer = bufnr opts.silent = true
keymap.set(mode, l, r, opts) opts.buffer = bufnr
end keymap.set(mode, l, r, opts)
end
map("n", "gd", vim.lsp.buf.definition, { desc = "go to definition" }) map("n", "gd", vim.lsp.buf.definition, { 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 = "rounded" }
end) end)
map("n", "<C-k>", vim.lsp.buf.signature_help) map("n", "<C-k>", vim.lsp.buf.signature_help)
map("n", "<space>rn", vim.lsp.buf.rename, { desc = "varialbe rename" }) map("n", "<space>rn", vim.lsp.buf.rename, { desc = "varialbe rename" })
map("n", "<space>ca", vim.lsp.buf.code_action, { desc = "LSP code action" }) map("n", "gr", vim.lsp.buf.references, { desc = "show references" })
map("n", "<space>wa", vim.lsp.buf.add_workspace_folder, { desc = "add workspace folder" }) map("n", "[d", function()
map("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, { desc = "remove workspace folder" }) diagnostic.jump { count = -1, float = true }
map("n", "<space>wl", function() end, { desc = "previous diagnostic" })
vim.print(vim.lsp.buf.list_workspace_folders()) map("n", "]d", function()
end, { desc = "list workspace folder" }) diagnostic.jump { count = 1, float = true }
end, { desc = "next diagnostic" })
-- 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" })
map("n", "<space>wl", function()
vim.print(vim.lsp.buf.list_workspace_folders())
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 if client.server_capabilities.documentFormattingProvider and client.name ~= "lua_ls" then
map({ "n", "x" }, "<space>f", vim.lsp.buf.format, { desc = "format code" }) map({ "n", "x" }, "<space>f", vim.lsp.buf.format, { desc = "format code" })
end end
-- Disable ruff hover feature in favor of Pyright -- Uncomment code below to enable inlay hint from language server, some LSP server supports inlay hint,
if client.name == "ruff" then -- but disable this feature by default, so you may need to enable inlay hint in the LSP server config.
client.server_capabilities.hoverProvider = false -- vim.lsp.inlay_hint.enable(true, {buffer=bufnr})
end
-- Uncomment code below to enable inlay hint from language server, some LSP server supports inlay hint, api.nvim_create_autocmd("CursorHold", {
-- but disable this feature by default, so you may need to enable inlay hint in the LSP server config. buffer = bufnr,
-- vim.lsp.inlay_hint.enable(true, {buffer=bufnr}) callback = function()
local float_opts = {
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = "rounded",
source = "always", -- show source in diagnostic popup window
prefix = " ",
}
-- The blow command will highlight the current variable and its usages in the buffer. if not vim.b.diagnostics_pos then
if client.server_capabilities.documentHighlightProvider then vim.b.diagnostics_pos = { nil, nil }
local gid = api.nvim_create_augroup("lsp_document_highlight", { clear = true }) end
api.nvim_create_autocmd("CursorHold", {
group = gid,
buffer = bufnr,
callback = function()
lsp.buf.document_highlight()
end,
})
api.nvim_create_autocmd("CursorMoved", { local cursor_pos = api.nvim_win_get_cursor(0)
group = gid, if
buffer = bufnr, (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2])
callback = function() and #diagnostic.get() > 0
lsp.buf.clear_references() then
end, diagnostic.open_float(nil, float_opts)
}) end
end
end, vim.b.diagnostics_pos = cursor_pos
nested = true, end,
desc = "Configure buffer keymap and behavior based on LSP", })
})
-- The blow command will highlight the current variable and its usages in the buffer.
if client.server_capabilities.documentHighlightProvider then
vim.cmd([[
hi! link LspReferenceRead Visual
hi! link LspReferenceText Visual
hi! link LspReferenceWrite Visual
]])
local gid = api.nvim_create_augroup("lsp_document_highlight", { clear = true })
api.nvim_create_autocmd("CursorHold", {
group = gid,
buffer = bufnr,
callback = function()
lsp.buf.document_highlight()
end,
})
api.nvim_create_autocmd("CursorMoved", {
group = gid,
buffer = bufnr,
callback = function()
lsp.buf.clear_references()
end,
})
end
if vim.g.logging_level == "debug" then
local msg = string.format("Language server %s started!", client.name)
vim.notify(msg, vim.log.levels.DEBUG, { title = "Nvim-config" })
end
end
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
@ -110,6 +156,7 @@ if utils.executable("pyright") then
lspconfig.pyright.setup { lspconfig.pyright.setup {
cmd = { "delance-langserver", "--stdio" }, cmd = { "delance-langserver", "--stdio" },
on_attach = custom_attach,
capabilities = merged_capability, capabilities = merged_capability,
settings = { settings = {
pyright = { pyright = {
@ -144,6 +191,7 @@ end
if utils.executable("ruff") then if utils.executable("ruff") then
require("lspconfig").ruff.setup { require("lspconfig").ruff.setup {
on_attach = custom_attach,
capabilities = capabilities, capabilities = capabilities,
init_options = { init_options = {
-- the settings can be found here: https://docs.astral.sh/ruff/editors/settings/ -- the settings can be found here: https://docs.astral.sh/ruff/editors/settings/
@ -154,8 +202,26 @@ if utils.executable("ruff") then
} }
end end
-- Disable ruff hover feature in favor of Pyright
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp_attach_disable_ruff_hover", { clear = true }),
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
-- vim.print(client.name, client.server_capabilities)
if client == nil then
return
end
if client.name == "ruff" then
client.server_capabilities.hoverProvider = false
end
end,
desc = "LSP: Disable hover capability from Ruff",
})
if utils.executable("ltex-ls") then if utils.executable("ltex-ls") then
lspconfig.ltex.setup { lspconfig.ltex.setup {
on_attach = custom_attach,
cmd = { "ltex-ls" }, cmd = { "ltex-ls" },
filetypes = { "text", "plaintex", "tex", "markdown" }, filetypes = { "text", "plaintex", "tex", "markdown" },
settings = { settings = {
@ -169,6 +235,7 @@ end
if utils.executable("clangd") then if utils.executable("clangd") then
lspconfig.clangd.setup { lspconfig.clangd.setup {
on_attach = custom_attach,
capabilities = capabilities, capabilities = capabilities,
filetypes = { "c", "cpp", "cc" }, filetypes = { "c", "cpp", "cc" },
flags = { flags = {
@ -180,6 +247,7 @@ end
-- set up vim-language-server -- set up vim-language-server
if utils.executable("vim-language-server") then if utils.executable("vim-language-server") then
lspconfig.vimls.setup { lspconfig.vimls.setup {
on_attach = custom_attach,
flags = { flags = {
debounce_text_changes = 500, debounce_text_changes = 500,
}, },
@ -192,6 +260,7 @@ end
-- set up bash-language-server -- set up bash-language-server
if utils.executable("bash-language-server") then if utils.executable("bash-language-server") then
lspconfig.bashls.setup { lspconfig.bashls.setup {
on_attach = custom_attach,
capabilities = capabilities, capabilities = capabilities,
} }
end end
@ -199,6 +268,7 @@ end
-- settings for lua-language-server can be found on https://luals.github.io/wiki/settings/ -- settings for lua-language-server can be found on https://luals.github.io/wiki/settings/
if utils.executable("lua-language-server") then if utils.executable("lua-language-server") then
lspconfig.lua_ls.setup { lspconfig.lua_ls.setup {
on_attach = custom_attach,
settings = { settings = {
Lua = { Lua = {
runtime = { runtime = {
@ -213,3 +283,18 @@ if utils.executable("lua-language-server") then
capabilities = capabilities, capabilities = capabilities,
} }
end end
-- global config for diagnostic
diagnostic.config {
underline = false,
virtual_text = false,
signs = {
text = {
[diagnostic.severity.ERROR] = "🆇",
[diagnostic.severity.WARN] = "⚠️",
[diagnostic.severity.INFO] = "",
[diagnostic.severity.HINT] = "",
},
},
severity_sort = true,
}

View File

@ -1,14 +1,6 @@
-- 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")
local MiniIcons = require("mini.icons")
cmp.setup { cmp.setup {
snippet = { snippet = {
@ -51,14 +43,21 @@ cmp.setup {
view = { view = {
entries = "custom", entries = "custom",
}, },
-- solution taken from https://github.com/echasnovski/mini.nvim/issues/1007#issuecomment-2258929830
formatting = { formatting = {
format = function(_, vim_item) format = lspkind.cmp_format {
local icon, hl = MiniIcons.get("lsp", vim_item.kind) mode = "symbol_text",
vim_item.kind = icon .. " " .. vim_item.kind menu = {
vim_item.kind_hl_group = hl nvim_lsp = "[LSP]",
return vim_item ultisnips = "[US]",
end, path = "[Path]",
buffer = "[Buffer]",
emoji = "[Emoji]",
omni = "[Omni]",
},
show_labelDetails = true,
maxwidth = 40,
ellipsis_char = "...",
},
}, },
} }

View File

@ -37,8 +37,7 @@ api.nvim_create_autocmd({ "CursorMoved" }, {
api.nvim_create_autocmd("TextYankPost", { api.nvim_create_autocmd("TextYankPost", {
pattern = "*", pattern = "*",
group = yank_group, group = yank_group,
---@diagnostic disable-next-line: unused-local callback = function(ev)
callback = function(context)
if vim.v.event.operator == "y" then if vim.v.event.operator == "y" then
vim.fn.setpos(".", vim.g.current_cursor_pos) vim.fn.setpos(".", vim.g.current_cursor_pos)
end end
@ -171,11 +170,7 @@ api.nvim_create_autocmd("ColorScheme", {
vim.api.nvim_set_hl(0, "Cursor2", { fg = "red", bg = "red" }) vim.api.nvim_set_hl(0, "Cursor2", { fg = "red", bg = "red" })
-- For floating windows border highlight -- For floating windows border highlight
vim.api.nvim_set_hl(0, "FloatBorder", { fg = "LightGreen", bg = "None", bold = true }) vim.api.nvim_set_hl(0, "FloatBorder", { fg = "LightGreen" })
local hl = vim.api.nvim_get_hl(0, { name = "NormalFloat" })
-- change the background color of floating window to None, so it blenders better
vim.api.nvim_set_hl(0, "NormalFloat", { fg = hl.fg, bg = "None" })
-- highlight for matching parentheses -- highlight for matching parentheses
vim.api.nvim_set_hl(0, "MatchParen", { bold = true, underline = true }) vim.api.nvim_set_hl(0, "MatchParen", { bold = true, underline = true })
@ -186,8 +181,7 @@ api.nvim_create_autocmd("BufEnter", {
pattern = "*", pattern = "*",
group = api.nvim_create_augroup("auto_close_win", { clear = true }), group = api.nvim_create_augroup("auto_close_win", { clear = true }),
desc = "Quit Nvim if we have only one window, and its filetype match our pattern", desc = "Quit Nvim if we have only one window, and its filetype match our pattern",
---@diagnostic disable-next-line: unused-local callback = function(ev)
callback = function(context)
local quit_filetypes = { "qf", "vista", "NvimTree" } local quit_filetypes = { "qf", "vista", "NvimTree" }
local should_quit = true local should_quit = true
@ -195,9 +189,9 @@ api.nvim_create_autocmd("BufEnter", {
for _, win in pairs(tabwins) do for _, win in pairs(tabwins) do
local buf = api.nvim_win_get_buf(win) local buf = api.nvim_win_get_buf(win)
local buf_type = vim.api.nvim_get_option_value("filetype", { buf = buf }) local bf = fn.getbufvar(buf, "&filetype")
if not vim.tbl_contains(quit_filetypes, buf_type) then if fn.index(quit_filetypes, bf) == -1 then
should_quit = false should_quit = false
end end
end end
@ -228,13 +222,8 @@ 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"

View File

@ -1,66 +0,0 @@
local diagnostic = vim.diagnostic
local api = vim.api
-- global config for diagnostic
diagnostic.config {
underline = false,
virtual_text = false,
virtual_lines = false,
signs = {
text = {
[diagnostic.severity.ERROR] = "🆇",
[diagnostic.severity.WARN] = "⚠️",
[diagnostic.severity.INFO] = "",
[diagnostic.severity.HINT] = "",
},
},
severity_sort = true,
float = {
source = true,
header = "Diagnostics:",
prefix = " ",
border = "single",
},
}
-- 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
-- this puts diagnostics from opened files to quickfix
vim.keymap.set("n", "<space>qw", diagnostic.setqflist, { desc = "put window diagnostics to qf" })
-- this puts diagnostics from current buffer to quickfix
vim.keymap.set("n", "<space>qb", function()
set_qflist(0)
end, { desc = "put buffer diagnostics to qf" })
-- automatically show diagnostic in float win for current line
api.nvim_create_autocmd("CursorHold", {
pattern = "*",
callback = function()
if #vim.diagnostic.get(0) == 0 then
return
end
if not vim.b.diagnostics_pos then
vim.b.diagnostics_pos = { nil, nil }
end
local cursor_pos = api.nvim_win_get_cursor(0)
if not vim.deep_equal(cursor_pos, vim.b.diagnostics_pos) then
diagnostic.open_float { width = 100 }
end
vim.b.diagnostics_pos = cursor_pos
end,
})

View File

@ -10,7 +10,7 @@ vim.g.is_win = (utils.has("win32") or utils.has("win64")) and true or false
vim.g.is_linux = (utils.has("unix") and (not utils.has("macunix"))) and true or false vim.g.is_linux = (utils.has("unix") and (not utils.has("macunix"))) and true or false
vim.g.is_mac = utils.has("macunix") and true or false vim.g.is_mac = utils.has("macunix") and true or false
vim.g.logging_level = vim.log.levels.INFO vim.g.logging_level = "info"
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- builtin variables -- -- builtin variables --
@ -69,6 +69,3 @@ vim.g.loaded_matchparen = 1
-- Disable sql omni completion, it is broken. -- Disable sql omni completion, it is broken.
vim.g.loaded_sql_completion = 1 vim.g.loaded_sql_completion = 1
-- control how to show health check window
vim.g.health = { style = nil }

View File

@ -23,6 +23,19 @@ keymap.set("n", "<leader>q", "<cmd>x<cr>", { silent = true, desc = "quit current
-- Quit all opened buffers -- Quit all opened buffers
keymap.set("n", "<leader>Q", "<cmd>qa!<cr>", { silent = true, desc = "quit nvim" }) keymap.set("n", "<leader>Q", "<cmd>qa!<cr>", { silent = true, desc = "quit nvim" })
-- Navigation in the location and quickfix list
keymap.set("n", "[l", "<cmd>lprevious<cr>zv", { silent = true, desc = "previous location item" })
keymap.set("n", "]l", "<cmd>lnext<cr>zv", { silent = true, desc = "next location item" })
keymap.set("n", "[L", "<cmd>lfirst<cr>zv", { silent = true, desc = "first location item" })
keymap.set("n", "]L", "<cmd>llast<cr>zv", { silent = true, desc = "last location item" })
keymap.set("n", "[q", "<cmd>cprevious<cr>zv", { silent = true, desc = "previous qf item" })
keymap.set("n", "]q", "<cmd>cnext<cr>zv", { silent = true, desc = "next qf item" })
keymap.set("n", "[Q", "<cmd>cfirst<cr>zv", { silent = true, desc = "first qf item" })
keymap.set("n", "]Q", "<cmd>clast<cr>zv", { silent = true, desc = "last qf item" })
-- Close location list or quickfix list if they are present, see https://superuser.com/q/355325/736190 -- Close location list or quickfix list if they are present, see https://superuser.com/q/355325/736190
keymap.set("n", [[\x]], "<cmd>windo lclose <bar> cclose <cr>", { keymap.set("n", [[\x]], "<cmd>windo lclose <bar> cclose <cr>", {
silent = true, silent = true,

View File

@ -22,19 +22,24 @@ 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 },
{ "quangnguyen30192/cmp-nvim-ultisnips", lazy = true },
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
name = "nvim-cmp", name = "nvim-cmp",
event = "InsertEnter", -- event = 'InsertEnter',
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,
}, },
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
event = { "BufRead", "BufNewFile" }, event = { "BufRead", "BufNewFile" },
@ -42,16 +47,10 @@ local plugin_specs = {
require("config.lsp") require("config.lsp")
end, end,
}, },
{
"dnlhc/glance.nvim",
config = function()
require("config.glance")
end,
event = "VeryLazy",
},
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
lazy = true, event = "VeryLazy",
build = ":TSUpdate", build = ":TSUpdate",
config = function() config = function()
require("config.treesitter") require("config.treesitter")
@ -72,7 +71,10 @@ local plugin_specs = {
{ {
"vlime/vlime", "vlime/vlime",
enabled = function() enabled = function()
return utils.executable("sbcl") if utils.executable("sbcl") then
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")
@ -83,7 +85,7 @@ local plugin_specs = {
-- Super fast buffer jump -- Super fast buffer jump
{ {
"smoka7/hop.nvim", "smoka7/hop.nvim",
keys = { "f" }, event = "VeryLazy",
config = function() config = function()
require("config.nvim_hop") require("config.nvim_hop")
end, end,
@ -98,6 +100,20 @@ 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",
@ -107,16 +123,18 @@ local plugin_specs = {
}, },
{ {
"ibhagwan/fzf-lua", "ibhagwan/fzf-lua",
-- optional for icon support
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() config = function()
require("config.fzf-lua") -- calling `setup` is optional for customization
require("fzf-lua").setup {}
end, end,
event = "VeryLazy",
}, },
{ {
"MeanderingProgrammer/markdown.nvim", "MeanderingProgrammer/markdown.nvim",
main = "render-markdown", main = "render-markdown",
opts = {}, opts = {},
ft = { "markdown" }, dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" },
}, },
-- 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 },
@ -135,22 +153,11 @@ 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 = "BufRead", event = "VeryLazy",
cond = firenvim_not_active, cond = firenvim_not_active,
config = function() config = function()
require("config.lualine") require("config.lualine")
@ -176,16 +183,11 @@ local plugin_specs = {
}, },
{ {
"echasnovski/mini.indentscope", "lukas-reineke/indent-blankline.nvim",
version = false, event = "VeryLazy",
main = "ibl",
config = function() config = function()
local mini_indent = require("mini.indentscope") require("config.indent-blankline")
mini_indent.setup {
draw = {
animation = mini_indent.gen_animation.none(),
},
symbol = "",
}
end, end,
}, },
{ {
@ -211,7 +213,7 @@ local plugin_specs = {
end, end,
}, },
-- Highlight URLs inside vim -- Highlight URLs inside vim
{ "itchyny/vim-highlighturl", event = "BufReadPost" }, { "itchyny/vim-highlighturl", event = "VeryLazy" },
-- notification plugin -- notification plugin
{ {
@ -222,8 +224,6 @@ 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.
{ {
@ -234,8 +234,13 @@ 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()
return vim.g.is_win or vim.g.is_mac if vim.g.is_win or vim.g.is_mac then
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
}, },
@ -245,7 +250,11 @@ local plugin_specs = {
{ {
"liuchengxu/vista.vim", "liuchengxu/vista.vim",
enabled = function() enabled = function()
return utils.executable("ctags") if utils.executable("ctags") then
return true
else
return false
end
end, end,
cmd = "Vista", cmd = "Vista",
}, },
@ -263,10 +272,7 @@ local plugin_specs = {
}, },
-- Comment plugin -- Comment plugin
{ "tpope/vim-commentary", keys = { { "tpope/vim-commentary", event = "VeryLazy" },
{ "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'
@ -280,7 +286,7 @@ local plugin_specs = {
config = function() config = function()
require("config.yanky") require("config.yanky")
end, end,
cmd = "YankyRingHistory", event = "VeryLazy",
}, },
-- Handy unix command inside Vim (Rename, Move etc.) -- Handy unix command inside Vim (Rename, Move etc.)
@ -294,7 +300,10 @@ local plugin_specs = {
{ {
"lyokha/vim-xkbswitch", "lyokha/vim-xkbswitch",
enabled = function() enabled = function()
return vim.g.is_mac and utils.executable("xkbswitch") if vim.g.is_mac and utils.executable("xkbswitch") then
return true
end
return false
end, end,
event = { "InsertEnter" }, event = { "InsertEnter" },
}, },
@ -302,7 +311,10 @@ local plugin_specs = {
{ {
"Neur1n/neuims", "Neur1n/neuims",
enabled = function() enabled = function()
return vim.g.is_win if vim.g.is_win then
return true
end
return false
end, end,
event = { "InsertEnter" }, event = { "InsertEnter" },
}, },
@ -321,14 +333,7 @@ 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",
@ -343,12 +348,10 @@ 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" },
}, },
{ {
@ -359,17 +362,23 @@ 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", ft = { "markdown" } }, { "godlygeek/tabular", cmd = { "Tabularize" } },
-- 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()
return vim.g.is_win or vim.g.is_mac if vim.g.is_win or vim.g.is_mac then
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" },
@ -378,12 +387,15 @@ local plugin_specs = {
{ {
"rhysd/vim-grammarous", "rhysd/vim-grammarous",
enabled = function() enabled = function()
return vim.g.is_mac if vim.g.is_mac then
return true
end
return false
end, end,
ft = { "markdown" }, ft = { "markdown" },
}, },
{ "chrisbra/unicode.vim", keys = { "ga" }, cmd = { "UnicodeSearch" } }, { "chrisbra/unicode.vim", event = "VeryLazy" },
-- Additional powerful text object for vim, this plugin should be studied -- Additional powerful text object for vim, this plugin should be studied
-- carefully to use its full power -- carefully to use its full power
@ -392,11 +404,17 @@ 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()
return utils.executable("latex") if utils.executable("latex") then
return true
end
return false
end, end,
ft = { "tex" }, ft = { "tex" },
}, },
@ -407,7 +425,10 @@ local plugin_specs = {
{ {
"tmux-plugins/vim-tmux", "tmux-plugins/vim-tmux",
enabled = function() enabled = function()
return utils.executable("tmux") if utils.executable("tmux") then
return true
end
return false
end, end,
ft = { "tmux" }, ft = { "tmux" },
}, },
@ -424,7 +445,8 @@ local plugin_specs = {
{ {
"glacambre/firenvim", "glacambre/firenvim",
enabled = function() enabled = function()
return vim.g.is_win or vim.g.is_mac local result = 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.
@ -447,7 +469,10 @@ local plugin_specs = {
{ {
"sakhnik/nvim-gdb", "sakhnik/nvim-gdb",
enabled = function() enabled = function()
return vim.g.is_win or vim.g.is_linux if vim.g.is_win or vim.g.is_linux then
return true
end
return false
end, end,
build = { "bash install.sh" }, build = { "bash install.sh" },
lazy = true, lazy = true,
@ -459,7 +484,10 @@ local plugin_specs = {
{ {
"ojroques/vim-oscyank", "ojroques/vim-oscyank",
enabled = function() enabled = function()
return vim.g.is_linux if vim.g.is_linux then
return true
end
return false
end, end,
cmd = { "OSCYank", "OSCYankReg" }, cmd = { "OSCYank", "OSCYankReg" },
}, },
@ -501,7 +529,8 @@ local plugin_specs = {
-- file explorer -- file explorer
{ {
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
keys = { "<space>s" }, event = "VeryLazy",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() config = function()
require("config.nvim-tree") require("config.nvim-tree")
end, end,
@ -509,7 +538,8 @@ local plugin_specs = {
{ {
"j-hui/fidget.nvim", "j-hui/fidget.nvim",
event = "BufRead", event = "VeryLazy",
tag = "legacy",
config = function() config = function()
require("config.fidget-nvim") require("config.fidget-nvim")
end, end,
@ -517,24 +547,19 @@ local plugin_specs = {
{ {
"folke/lazydev.nvim", "folke/lazydev.nvim",
ft = "lua", -- only load on lua files ft = "lua", -- only load on lua files
opts = { opts = {},
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
}, },
{ {
"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
}, },
cmd = { "CopilotChat" }, -- See Commands section for default commands if you want to lazy load on them
}, },
{ {
"zbirenbaum/copilot.lua", "zbirenbaum/copilot.lua",
@ -551,19 +576,18 @@ 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,
-- see discussion here: https://github.com/neovim/neovim/issues/14869 -- see discussion here: https://github.com/neovim/neovim/issues/14869
"kosayoda/nvim-lightbulb", "kosayoda/nvim-lightbulb",
config = function() config = function()
require("config.lightbulb") require("nvim-lightbulb").setup { autocmd = { enabled = true } }
end, end,
event = "LspAttach",
}, },
{ {
"Bekaboo/dropbar.nvim", "Bekaboo/dropbar.nvim",
event = "VeryLazy",
}, },
{ {
"catgoose/nvim-colorizer.lua", "catgoose/nvim-colorizer.lua",
@ -573,7 +597,6 @@ local plugin_specs = {
}, },
} }
---@diagnostic disable-next-line: missing-fields
require("lazy").setup { require("lazy").setup {
spec = plugin_specs, spec = plugin_specs,
ui = { ui = {

View File

@ -3,11 +3,12 @@ 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)
return fn.executable(name) > 0 if fn.executable(name) > 0 then
return true
end
return false
end end
--- check whether a feature exists in Nvim --- check whether a feature exists in Nvim

View File

@ -115,8 +115,6 @@ set shortmess+=S
" Disable showing intro message (:intro) " Disable showing intro message (:intro)
set shortmess+=I set shortmess+=I
set messagesopt=hit-enter,history:500
" Completion behaviour " Completion behaviour
" set completeopt+=noinsert " Auto select the first completion entry " set completeopt+=noinsert " Auto select the first completion entry
set completeopt+=menuone " Show menu even if there is only one item set completeopt+=menuone " Show menu even if there is only one item

View File

@ -34,6 +34,85 @@ 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': '',
@ -72,6 +151,25 @@ 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