Improve perform

This commit is contained in:
huyjaky
2025-10-26 08:13:18 +07:00
parent 04c5dcd06a
commit bad1ed5cb2
14 changed files with 274 additions and 267 deletions

View File

@@ -3,158 +3,150 @@
-- as this provides autocomplete and documentation while editing
---@type LazySpec
return {
"AstroNvim/astrolsp",
---@type AstroLSPOpts
opts = {
-- Configuration table of features provided by AstroLSP
features = {
autoformat = false, -- enable or disable auto formatting on start
codelens = true, -- enable/disable codelens refresh on start
inlay_hints = false, -- enable/disable inlay hints on start
semantic_tokens = true, -- enable/disable semantic token highlighting
},
-- customize lsp formatting options
formatting = require("plugins.configs.lsp.formatting"),
-- enable servers that you already have installed without mason
"AstroNvim/astrolsp",
---@type AstroLSPOpts
opts = {
-- Configuration table of features provided by AstroLSP
features = {
autoformat = false, -- enable or disable auto formatting on start
codelens = true, -- enable/disable codelens refresh on start
inlay_hints = false, -- enable/disable inlay hints on start
semantic_tokens = true, -- enable/disable semantic token highlighting
},
-- customize lsp formatting options
formatting = require "plugins.configs.lsp.formatting",
-- enable servers that you already have installed without mason
servers = {},
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
config = {
-- clangd = require "plugins.configs.lsp.config.clangd",
basedpyright = require("plugins.configs.lsp.config.basedpyright"),
jedi_language_server = require("plugins.configs.lsp.config.jedi_language"),
pyright = require("plugins.configs.lsp.config.pyright"),
ruff = require("plugins.configs.lsp.config.ruff"),
pylsp = require("plugins.configs.lsp.config.pylsp"),
},
-- customize how language servers are attached
handlers = {
-- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server
-- function(server, opts) require("lspconfig")[server].setup(opts) end
-- config Ty
servers = {},
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
config = {
-- clangd = require "plugins.configs.lsp.config.clangd",
basedpyright = require "plugins.configs.lsp.config.basedpyright",
jedi_language_server = require "plugins.configs.lsp.config.jedi_language",
pyright = require "plugins.configs.lsp.config.pyright",
ruff = require "plugins.configs.lsp.config.ruff",
pylsp = require "plugins.configs.lsp.config.pylsp",
},
-- customize how language servers are attached
handlers = {
-- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server
-- function(server, opts) require("lspconfig")[server].setup(opts) end
-- config Ty
-- the key is the server that is being setup with `lspconfig`
-- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server
-- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed
},
-- Configure buffer local auto commands to add when attaching a language server
autocmds = {
-- first key is the `augroup` to add the auto commands to (:h augroup)
lsp_document_highlight = {
-- Optional condition to create/delete auto command group
-- can either be a string of a client capability or a function of `fun(client, bufnr): boolean`
-- condition will be resolved for each client on each execution and if it ever fails for all clients,
-- the auto commands will be deleted for that buffer
cond = "textDocument/documentHighlight",
-- cond = function(client, bufnr) return client.name == "lua_ls" end,
-- list of auto commands to set
{
-- events to trigger
event = { "CursorHold", "CursorHoldI" },
-- the rest of the autocmd options (:h nvim_create_autocmd)
desc = "Document Highlighting",
callback = function()
vim.lsp.buf.document_highlight()
end,
},
{
event = { "CursorMoved", "CursorMovedI", "BufLeave" },
desc = "Document Highlighting Clear",
callback = function()
vim.lsp.buf.clear_references()
end,
},
},
-- disable inlay hints in insert mode
disable_inlay_hints_on_insert = {
-- only create for language servers that support inlay hints
-- (and only if vim.lsp.inlay_hint is available)
cond = vim.lsp.inlay_hint and "textDocument/inlayHint" or false,
{
-- when going into insert mode
event = "InsertEnter",
desc = "disable inlay hints on insert",
callback = function(args)
local filter = { bufnr = args.buf }
-- if the inlay hints are currently enabled
if vim.lsp.inlay_hint.is_enabled(filter) then
-- disable the inlay hints
vim.lsp.inlay_hint.enable(false, filter)
-- create a single use autocommand to turn the inlay hints back on
-- when leaving insert mode
vim.api.nvim_create_autocmd("InsertLeave", {
buffer = args.buf,
once = true,
callback = function()
vim.lsp.inlay_hint.enable(true, filter)
end,
})
end
end,
},
},
},
-- mappings to be set up on attaching of a language server
mappings = {
n = {
},
},
-- A custom `on_attach` function to be run after the default `on_attach` function
-- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`)
on_attach = function(client, bufnr)
-- this would disable semanticTokensProvider for all clients
-- client.server_capabilities.semanticTokensProvider = nil
-- Disable ruff_lsp hover in favor of pyright
if client.name == "ruff" then
client.server_capabilities.hoverProvider = false
end
-- the key is the server that is being setup with `lspconfig`
-- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server
-- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed
-- if client.name == "pyright" then
-- -- disable pyright analysis features
-- client.server_capabilities.documentFormattingProvider = false
-- client.server_capabilities.hoverProvider = false
},
-- Configure buffer local auto commands to add when attaching a language server
autocmds = {
-- first key is the `augroup` to add the auto commands to (:h augroup)
lsp_document_highlight = {
-- Optional condition to create/delete auto command group
-- can either be a string of a client capability or a function of `fun(client, bufnr): boolean`
-- condition will be resolved for each client on each execution and if it ever fails for all clients,
-- the auto commands will be deleted for that buffer
cond = "textDocument/documentHighlight",
-- cond = function(client, bufnr) return client.name == "lua_ls" end,
-- list of auto commands to set
{
-- events to trigger
event = { "CursorHold", "CursorHoldI" },
-- the rest of the autocmd options (:h nvim_create_autocmd)
desc = "Document Highlighting",
callback = function() vim.lsp.buf.document_highlight() end,
},
{
event = { "CursorMoved", "CursorMovedI", "BufLeave" },
desc = "Document Highlighting Clear",
callback = function() vim.lsp.buf.clear_references() end,
},
},
-- disable inlay hints in insert mode
disable_inlay_hints_on_insert = {
-- only create for language servers that support inlay hints
-- (and only if vim.lsp.inlay_hint is available)
cond = vim.lsp.inlay_hint and "textDocument/inlayHint" or false,
{
-- when going into insert mode
event = "InsertEnter",
desc = "disable inlay hints on insert",
callback = function(args)
local filter = { bufnr = args.buf }
-- if the inlay hints are currently enabled
if vim.lsp.inlay_hint.is_enabled(filter) then
-- disable the inlay hints
vim.lsp.inlay_hint.enable(false, filter)
-- create a single use autocommand to turn the inlay hints back on
-- when leaving insert mode
vim.api.nvim_create_autocmd("InsertLeave", {
buffer = args.buf,
once = true,
callback = function() vim.lsp.inlay_hint.enable(true, filter) end,
})
end
end,
},
},
},
-- mappings to be set up on attaching of a language server
mappings = {
n = {},
},
-- A custom `on_attach` function to be run after the default `on_attach` function
-- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`)
on_attach = function(client, bufnr)
-- this would disable semanticTokensProvider for all clients
-- client.server_capabilities.semanticTokensProvider = nil
-- Disable ruff_lsp hover in favor of pyright
if client.name == "ruff" then
client.server_capabilities.hoverProvider = false
client.server_capabilities.completionProvider = false
end
-- end
-- if client.name == "pyright" then
-- -- disable pyright analysis features
-- client.server_capabilities.documentFormattingProvider = false
-- client.server_capabilities.hoverProvider = false
-- Disable completion feature of pyright
if client.name == "ty" then
client.server_capabilities.completionProvider = false
end
-- end
if client.name == "basedpyright" then
client.server_capabilities.completionProvider = false
client.server_capabilities.codeLensProvider = false
client.server_capabilities.colorProvider = false
client.server_capabilities.callHierarchyProvider = false
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
client.server_capabilities.declarationProvider = false
client.server_capabilities.documentLinkProvider = false
client.server_capabilities.definitionProvider = false
client.server_capabilities.documentOnTypeFormattingProvider = false
client.server_capabilities.documentSymbolProvider = false
client.server_capabilities.hoverProvider = false
client.server_capabilities.inlineCompletionProvider = false
client.server_capabilities.inlineValueProvider = false
client.server_capabilities.notebookDocumentSync = false
client.server_capabilities.signatureHelpProvider = false
client.server_capabilities.renameProvider = false
client.server_capabilities.typeDefinitionProvider = false
client.server_capabilities.workspaceSymbolProvider = false
client.server_capabilities.monikerProvider = false
client.server_capabilities.semanticTokensProvider = false
client.server_capabilities.referencesProvider = false
client.server_capabilities.implementationProvider = false
client.server_capabilities.foldingRangeProvider = false
client.server_capabilities.selectionRangeProvider = false
client.server_capabilities.linkedEditingRangeProvider = false
client.server_capabilities.executeCommandProvider = false
client.server_capabilities.workspace = {
workspaceFolders = { supported = false },
fileOperations = { supported = false }
}
end
end,
},
if client.name == "jedi_language_server" then client.server_capabilities.renameProvider = false end
if client.name == "basedpyright" then
-- client.server_capabilities.completionProvider = false
-- client.server_capabilities.hoverProvider = false
-- client.server_capabilities.renameProvider = false
-- client.server_capabilities.definitionProvider = false
client.server_capabilities.codeLensProvider = false
client.server_capabilities.colorProvider = false
client.server_capabilities.callHierarchyProvider = false
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
client.server_capabilities.declarationProvider = false
client.server_capabilities.documentLinkProvider = false
client.server_capabilities.documentOnTypeFormattingProvider = false
client.server_capabilities.documentSymbolProvider = false
client.server_capabilities.inlineCompletionProvider = false
client.server_capabilities.inlineValueProvider = false
client.server_capabilities.notebookDocumentSync = false
client.server_capabilities.signatureHelpProvider = false
client.server_capabilities.typeDefinitionProvider = false
client.server_capabilities.workspaceSymbolProvider = false
client.server_capabilities.monikerProvider = false
client.server_capabilities.semanticTokensProvider = false
client.server_capabilities.referencesProvider = false
client.server_capabilities.implementationProvider = false
client.server_capabilities.foldingRangeProvider = false
client.server_capabilities.selectionRangeProvider = false
client.server_capabilities.linkedEditingRangeProvider = false
client.server_capabilities.executeCommandProvider = false
client.server_capabilities.workspace = {
workspaceFolders = { supported = false },
fileOperations = { supported = false },
}
end
end,
},
}

View File

@@ -12,7 +12,6 @@ return {
colorscheme = "bamboo-multiplex",
-- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes
highlights = require "plugins.configs.ui.highlights",
-- Icons can be configured throughout the interface
icons = require "plugins.configs.ui.icons",
status = require "plugins.configs.ui.status",

View File

@@ -7,48 +7,53 @@ return {
end,
},
{
"Saghen/blink.cmp",
opts = {
keymap = {
"Saghen/blink.cmp",
opts = {
keymap = {
preset = "default",
["<C-f>"] = false,
["<C-n>"] = false,
["<C-p>"] = false,
},
completion = {
list = { selection = { preselect = true, auto_insert = true } },
ghost_text = {
term = {
enabled = false,
},
menu = {
auto_show = function(ctx)
return ctx.mode ~= "cmdline"
end,
draw = {
columns = {
{ "kind_icon", "label", gap = 1 },
{ "kind" },
completion = {
list = {
selection = {
preselect = true,
-- auto_insert = true,
},
components = {
kind = {
highlight = function(ctx)
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
return hl
end,
inlay_hints = {
enabled = false,
in_insert = false,
}
},
ghost_text = {
enabled = false,
},
menu = {
auto_show = function(ctx) return ctx.mode ~= "cmdline" end,
draw = {
columns = {
{ "kind_icon", "label", gap = 1 },
{ "kind", gap = 1},
},
},
},
},
accept = {
auto_brackets = { enabled = true },
},
documentation = {
auto_show = true,
auto_show_delay_ms = 0,
window = {
border = "rounded",
winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None",
accept = {
auto_brackets = { enabled = false },
},
documentation = {
auto_show = false,
auto_show_delay_ms = 0,
window = {
border = "rounded",
winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None",
},
},
},
},
}
}
},
}

View File

@@ -9,17 +9,17 @@ return {
disableLanguageServices = false,
disableOrganizeImports = true,
disableTaggedHints = true,
useLibraryCodeForTypes = true,
analysis = {
autoSearchPath = false,
autoSearchPath = true,
useLibraryCodeForTypes = true,
logLevel = "Trace",
typeCheckingMode = "standard",
deprecateTypingAliases = false,
inlayHints = {
variableTypes = true,
callArgumentNames = false,
functionReturnTypes = true,
-- functionReturnTypes = true,
genericTypes = true,
callArgumentNames = true,
},
ignore = {
"**/unsloth_compiled_cache/**",

View File

@@ -10,11 +10,16 @@ return {
hover = {
enable = true,
},
signatureHelp = {
enable = false,
},
workspace = {
-- environmentPath = "/home/duckq1u/miniconda3/envs/OCR3/bin/python",
environmentPath = vim.fn.exepath "python",
ignore = {
"/home/duckq1u/miniconda3/envs/OCR3/lib/python3.11/site-packages/transformers/mode ls/albert/configuration_albert.py",
-- "/home/duckq1u/miniconda3/envs/OCR3/lib/python3.11/site-packages/transformers/model/albert/configuration_albert.py",
-- "/home/duckq1u/miniconda3/envs/ocr2/lib/python3.12/site-packages/transformers/models/albert/configuration_albert.py",
"**configuration_albert.py",
"**/unsloth_compiled_cache/**",
},
},
@@ -24,8 +29,9 @@ return {
"numpy",
"pandas",
"torch",
"torchvision",
"pytorch_lightning"
-- "torchmetrics",
-- "pytorch_lightning",
},
},
},

View File

@@ -12,7 +12,9 @@ return {
DiagnosticVirtualTextWarn = { fg = get_hlgroup("DiagnosticWarn").fg, bg = "none" },
CursorLineNr = { fg = "#FFD700", bg = "none", bold = true },
CursorLine = { fg = "none", bg = "#004C4C", bold = true },
CursorLine = { fg = "none", bg = "#005C4C", bold = true },
CursorColumn = { fg = "none", bg = "#005C4C", bold = true },
Visual = { fg = "#000000", bg = "#FFFFFF", bold = true },
-- remove background of inlay hints

View File

@@ -8,8 +8,8 @@ return {
icons = {
type = "󰜁 ",
parameter = "󰏪 ",
offspec = " ", -- hint kind not defined in official LSP spec
unknown = " ", -- hint kind is nil
offspec = "󰀒 ", -- hint kind not defined in official LSP spec
unknown = " ", -- hint kind is nil
},
label = {
truncateAtChars = 100,

View File

@@ -14,5 +14,4 @@ return {
-- Disabled development plugins
{ "mfussenegger/nvim-dap", enabled = false },
{ "jay-babu/mason-nvim-dap.nvim", enabled = false },
{ "brenton-leighton/multiple-cursors.nvim", enabled = false },
}

View File

@@ -1,35 +0,0 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- Customize Mason
---@type LazySpec
return {
-- use mason-tool-installer for automatically installing Mason packages
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
-- overrides `require("mason-tool-installer").setup(...)`
opts = {
-- Make sure to use the names found in `:Mason`
ensure_installed = {
-- install language servers
"lua-language-server",
-- install debuggers
"jedi_language_server",
"ruff",
"basedpyright",
-- install any other package
"tree-sitter-cli",
},
ui = {
border = "single",
width = 0.8,
height = 0.9,
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
},
},
}

View File

@@ -1,22 +1,38 @@
-- Motion, Navigation and Multiple Cursors
return {
-- Multi-cursors support
{
"brenton-leighton/multiple-cursors.nvim",
version = "*",
opts = {},
keys = {
{ "<C-Down>", "<Cmd>MultipleCursorsAddDown<CR>", mode = { "n", "i", "x" } },
{ "<C-Up>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "i", "x" } },
{ "<A-LeftMouse>", "<Cmd>MultipleCursorsMouseAddDelete<CR>", mode = { "n", "i" } },
{ "<Leader>a", "<Cmd>MultipleCursorsAddMatches<CR>", mode = { "n", "x" } },
{ "<C-D>", "<Cmd>MultipleCursorsAddJumpNextMatch<CR>", mode = { "n", "x" } },
},
},
-- Alternative multi-cursor plugin
{
"mg979/vim-visual-multi",
event = "BufRead",
event = { "User AstroFile", "InsertEnter" },
dependencies = {
"AstroNvim/astrocore",
---@param opts astrocoreopts
opts = function(_, opts)
if not opts.options then opts.options = {} end
if not opts.options.g then opts.options.g = {} end
opts.options.g.VM_silent_exit = 1
opts.options.g.VM_show_warnings = 0
if not opts.autocmds then opts.autocmds = {} end
opts.autocmds.visual_multi_exit = {
{
event = "User",
pattern = "visual_multi_exit",
desc = "Avoid spurious 'hit-enter-prompt' when exiting vim-visual-multi",
callback = function()
vim.o.cmdheight = 1
vim.schedule(function() vim.o.cmdheight = opts.options.opt.cmdheight end)
end,
},
}
if not opts.mappings then opts.mappings = require("astrocore").empty_map_table() end
local maps = assert(opts.mappings)
maps.n["<C-up>"] = { "<C-u>call vm#commands#add_cursor_up(0, v:count1)<cr>", desc = "Add cursor above" }
maps.n["<C-down>"] = { "<C-u>call vm#commands#add_cursor_down(0, v:count1)<cr>", desc = "Add cursor below" }
end,
},
},
-- Better move by word
{
@@ -29,7 +45,7 @@ return {
{ "ge", "<Cmd>lua require('spider').motion('ge')<CR>", mode = { "n", "o", "x" }, desc = "Spider-ge" },
},
},
-- Better character motion
{
"folke/flash.nvim",
@@ -52,7 +68,7 @@ return {
},
},
},
-- Move code block
{
"echasnovski/mini.move",

View File

@@ -29,7 +29,7 @@ return {
width = 50
},
enable_git_status = false,
enable_diagnostics = false,
enable_diagnostics = true,
git_status_async = false,
},
},

View File

@@ -38,4 +38,27 @@ return {
},
},
},
{
"OXY2DEV/markview.nvim",
ft = function()
local plugin = require("lazy.core.config").spec.plugins["markview.nvim"]
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
return opts.filetypes or { "markdown", "quarto", "rmd" }
end,
dependencies = {
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed =
require("astrocore").list_insert_unique(opts.ensure_installed, { "html", "markdown", "markdown_inline" })
end
end,
},
opts = {
preview = {
hybrid_modes = { "n" },
headings = { shift_width = 0 },
},
},
},
}

View File

@@ -53,7 +53,7 @@ return {
{
"altermo/ultimate-autopair.nvim",
event = "InsertEnter",
-- branch = "v0.6",
branch = "v0.6",
opts = {
cmap = false,
extensions = {