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

Compare commits

..

3 Commits

Author SHA1 Message Date
jdhao
e08b17f335
optimize nvim startup time with lazy.nvim (#400) 2025-04-08 19:35:47 +02:00
jdhao
adddbc0ba6 remove indent-blankline and use mini.indentscope 2025-04-08 19:13:01 +02:00
jdhao
aadfdae677
switch from nvim-web-devicons to mini.icons (#399) 2025-04-08 19:11:20 +02:00
4 changed files with 67 additions and 88 deletions

View File

@ -1,4 +1,7 @@
require("fzf-lua").setup {
defaults = {
file_icons = "mini",
},
winopts = {
row = 0.5,
height = 0.7,

View File

@ -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,
})

View File

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

View File

@ -22,24 +22,19 @@ end
local plugin_specs = {
-- 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",
name = "nvim-cmp",
-- 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",
},
event = "InsertEnter",
config = function()
require("config.nvim-cmp")
end,
},
{
"neovim/nvim-lspconfig",
event = { "BufRead", "BufNewFile" },
@ -56,7 +51,7 @@ local plugin_specs = {
},
{
"nvim-treesitter/nvim-treesitter",
event = "VeryLazy",
lazy = true,
build = ":TSUpdate",
config = function()
require("config.treesitter")
@ -88,7 +83,7 @@ local plugin_specs = {
-- Super fast buffer jump
{
"smoka7/hop.nvim",
event = "VeryLazy",
keys = { "f" },
config = function()
require("config.nvim_hop")
end,
@ -112,17 +107,16 @@ local plugin_specs = {
},
{
"ibhagwan/fzf-lua",
-- optional for icon support
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("config.fzf-lua")
end,
event = "VeryLazy",
},
{
"MeanderingProgrammer/markdown.nvim",
main = "render-markdown",
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.
{ "navarasu/onedark.nvim", lazy = true },
@ -141,11 +135,22 @@ local plugin_specs = {
branch = "v2",
},
{ "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",
event = "VeryLazy",
event = "BufRead",
cond = firenvim_not_active,
config = function()
require("config.lualine")
@ -171,11 +176,16 @@ local plugin_specs = {
},
{
"lukas-reineke/indent-blankline.nvim",
event = "VeryLazy",
main = "ibl",
"echasnovski/mini.indentscope",
version = false,
config = function()
require("config.indent-blankline")
local mini_indent = require("mini.indentscope")
mini_indent.setup {
draw = {
animation = mini_indent.gen_animation.none(),
},
symbol = "",
}
end,
},
{
@ -201,7 +211,7 @@ local plugin_specs = {
end,
},
-- Highlight URLs inside vim
{ "itchyny/vim-highlighturl", event = "VeryLazy" },
{ "itchyny/vim-highlighturl", event = "BufReadPost" },
-- notification plugin
{
@ -212,6 +222,8 @@ local plugin_specs = {
end,
},
{ "nvim-lua/plenary.nvim", lazy = true },
-- 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.
{
@ -224,7 +236,6 @@ local plugin_specs = {
enabled = function()
return vim.g.is_win or vim.g.is_mac
end,
dependencies = { "nvim-lua/plenary.nvim" },
config = true, -- default settings
submodules = false, -- not needed, submodules are required only for tests
},
@ -252,7 +263,10 @@ local plugin_specs = {
},
-- Comment plugin
{ "tpope/vim-commentary", event = "VeryLazy" },
{ "tpope/vim-commentary", keys = {
{ "gc", mode = "n" },
{ "gc", mode = "v" },
} },
-- Multiple cursor plugin like Sublime Text?
-- 'mg979/vim-visual-multi'
@ -266,7 +280,7 @@ local plugin_specs = {
config = function()
require("config.yanky")
end,
event = "VeryLazy",
cmd = "YankyRingHistory",
},
-- Handy unix command inside Vim (Rename, Move etc.)
@ -322,10 +336,12 @@ local plugin_specs = {
config = function()
require("config.gitsigns")
end,
event = "BufRead",
},
{
"sindrets/diffview.nvim",
cmd = { "DiffviewOpen" },
},
{
@ -360,7 +376,7 @@ local plugin_specs = {
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
-- carefully to use its full power
@ -369,9 +385,6 @@ local plugin_specs = {
-- Plugin to manipulate character pairs quickly
{ "machakann/vim-sandwich", event = "VeryLazy" },
-- Add indent object for vim (useful for languages like Python)
{ "michaeljsmith/vim-indent-object", event = "VeryLazy" },
-- Only use these plugin on Windows and Mac and when LaTeX is installed
{
"lervag/vimtex",
@ -481,8 +494,7 @@ local plugin_specs = {
-- file explorer
{
"nvim-tree/nvim-tree.lua",
event = "VeryLazy",
dependencies = { "nvim-tree/nvim-web-devicons" },
keys = { "<space>s" },
config = function()
require("config.nvim-tree")
end,
@ -490,8 +502,7 @@ local plugin_specs = {
{
"j-hui/fidget.nvim",
event = "VeryLazy",
tag = "legacy",
event = "BufRead",
config = function()
require("config.fidget-nvim")
end,
@ -511,13 +522,12 @@ local plugin_specs = {
"CopilotC-Nvim/CopilotChat.nvim",
dependencies = {
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
{ "nvim-lua/plenary.nvim" }, -- for curl, log wrapper
},
opts = {
debug = true, -- Enable debugging
-- See Configuration section for rest
},
-- See Commands section for default commands if you want to lazy load on them
cmd = { "CopilotChat" },
},
{
"zbirenbaum/copilot.lua",
@ -534,7 +544,6 @@ local plugin_specs = {
config = function()
require("config.live-command")
end,
event = "VeryLazy",
},
{
-- show hint for code actions, the user can also implement code actions themselves,
@ -543,9 +552,11 @@ local plugin_specs = {
config = function()
require("config.lightbulb")
end,
event = "LspAttach",
},
{
"Bekaboo/dropbar.nvim",
event = "VeryLazy",
},
{
"catgoose/nvim-colorizer.lua",