update nvim

This commit is contained in:
kYasuda
2026-08-31 13:48:36 -07:00
parent 67afa82778
commit 17086f43ec
59 changed files with 860 additions and 1798 deletions
@@ -1,137 +0,0 @@
return {
"sontungexpt/better-diagnostic-virtual-text",
-- event = "LspAttach",
enabled = true,
config = function()
local diagnostic = require("better-diagnostic-virtual-text")
local vt = require("better-diagnostic-virtual-text.api")
local tbl_insert = table.insert
local strdisplaywidth = vim.fn.strdisplaywidth
local space = function(n)
return string.rep(" ", n)
end
local SEVERITY_SUFFIXS = {
[vim.diagnostic.severity.ERROR] = "Error",
[vim.diagnostic.severity.WARN] = "Warn",
[vim.diagnostic.severity.INFO] = "Info",
[vim.diagnostic.severity.HINT] = "Hint",
}
vt.format_line_chunks = function(
ui_opts,
line_idx,
line_msg,
severity,
max_line_length,
lasted_line,
virt_text_offset,
should_display_below,
above_instead,
removed_parts,
diagnostic
)
local chunks = {}
local first_line = line_idx == 1
local severity_suffix = SEVERITY_SUFFIXS[severity]
local msg = string.format("[%s]: %s", diagnostic.code, line_msg)
local function hls(extend_hl_groups)
local default_groups = {
"DiagnosticVirtualText" .. severity_suffix,
"BetterDiagnosticVirtualText" .. severity_suffix,
}
if extend_hl_groups then
for i, hl in ipairs(extend_hl_groups) do
default_groups[2 + i] = hl
end
end
return default_groups
end
local message_highlight = hls()
if should_display_below then
local arrow_symbol = (above_instead and ui_opts.down_arrow or ui_opts.up_arrow):match("^%s*(.*)")
local space_offset = space(virt_text_offset)
if first_line then
if not removed_parts.arrow then
tbl_insert(chunks, {
space_offset .. arrow_symbol,
hls({
"BetterDiagnosticVirtualTextArrow",
"BetterDiagnosticVirtualTextArrow" .. severity_suffix,
}),
})
end
else
tbl_insert(chunks, {
space_offset .. space(strdisplaywidth(arrow_symbol)),
message_highlight,
})
end
else
local arrow_symbol = ui_opts.arrow
if first_line then
if not removed_parts.arrow then
tbl_insert(chunks, {
arrow_symbol,
hls({
"BetterDiagnosticVirtualTextArrow",
"BetterDiagnosticVirtualTextArrow" .. severity_suffix,
}),
})
end
else
tbl_insert(chunks, {
space(virt_text_offset + strdisplaywidth(arrow_symbol)),
message_highlight,
})
end
end
if not removed_parts.left_kept_space then
local tree_symbol = " "
if first_line then
if not lasted_line then
tree_symbol = above_instead and "" or ""
end
elseif lasted_line then
tree_symbol = above_instead and "" or ""
else
tree_symbol = ""
end
tbl_insert(chunks, {
tree_symbol,
hls({ "BetterDiagnosticVirtualTextTree", "BetterDiagnosticVirtualTextTree" .. severity_suffix }),
})
end
tbl_insert(chunks, {
msg,
message_highlight,
})
if not removed_parts.right_kept_space then
local last_space = space(max_line_length - strdisplaywidth(msg) + ui_opts.right_kept_space)
tbl_insert(chunks, { last_space, message_highlight })
end
return chunks
end
diagnostic.setup({
ui = {
wrap_line_after = 150, -- wrap the line after this length to avoid the virtual text is too long
left_kept_space = 3, --- the number of spaces kept on the left side of the virtual text, make sure it enough to custom for each line
right_kept_space = 3, --- the number of spaces kept on the right side of the virtual text, make sure it enough to custom for each line
arrow = "",
up_arrow = "",
down_arrow = "",
above = false, -- the virtual text will be displayed above the line
},
priority = 10000, -- the priority of virtual text
inline = true,
})
end,
}
+2 -2
View File
@@ -7,7 +7,7 @@ return {
-- numbers = function(opts)
-- return string.format("%s", opts.id)
-- end,
numbers = function(opts)
numbers = function(_opts)
return ""
end,
-- number_style = "superscript" | "subscript" | "" | { "none", "subscript" }, -- buffer_id at index 1, ordinal at index 2
@@ -45,7 +45,7 @@ return {
-- diagnostics = false | "nvim_lsp" | "coc",
diagnostics = "nvim_lsp",
diagnostics_update_in_insert = false,
diagnostics_indicator = function(count, level, diagnostics_dict, context)
diagnostics_indicator = function(_count, _level, diagnostics_dict, _context)
local s = " "
for e, n in pairs(diagnostics_dict) do
local sym = e == "error" and ""
+1 -7
View File
@@ -41,7 +41,6 @@ return {
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
mini = {
enabled = true,
indentscope_color = "",
@@ -51,11 +50,7 @@ return {
diffview = true,
fidget = true,
noice = true,
indent_blankline = {
enabled = true,
scope_color = "lavendar", -- catppuccin color (eg. `lavender`) Default: text
colored_indent_levels = true,
},
snacks = true,
copilot_vim = true,
native_lsp = {
enabled = true,
@@ -77,7 +72,6 @@ return {
background = true,
},
},
notify = true,
treesitter = true,
rainbow_delimiters = true,
render_markdown = true,
+40 -4
View File
@@ -6,6 +6,42 @@ return {
"j-hui/fidget.nvim",
"ravitemer/mcphub.nvim",
},
keys = {
{
"<leader>Cf",
function()
require("codecompanion").chat({ window_opts = { height = 1, layout = "buffer" } })
end,
desc = "Fullscreen chat",
},
{
"<leader>Ch",
function()
require("codecompanion").chat({
window_opts = { height = 0.24, layout = "horizontal", position = "bottom" },
})
end,
desc = "Horizontal chat",
},
{ "<leader>Cc", "<cmd>CodeCompanionChat Toggle<cr>", desc = "Toggle chat" },
{ "<leader>oc", "<cmd>CodeCompanionChat Toggle<cr>", desc = "Toggle chat" },
{
"<leader>Ci",
function()
vim.api.nvim_feedkeys(":CodeCompanion #{buffer} ", "n", false)
end,
mode = { "n", "v" },
desc = "Inline prompt",
silent = false,
},
{ "<leader>Ct", "<cmd>CodeCompanionChat Toggle<cr>", desc = "Toggle chat" },
{ "<leader>CA", "<cmd>CodeCompanionActions<cr>", desc = "Actions" },
{ "<leader>Ca", "<cmd>CodeCompanionChat Add<cr>", mode = "v", desc = "Add selection to chat" },
{ "<leader>Ce", "<cmd>CodeCompanion /explain<cr>", mode = "v", desc = "Explain selection" },
{ "<leader>Cf", "<cmd>CodeCompanion /fix<cr>", mode = "v", desc = "Fix selection" },
{ "<leader>Cl", "<cmd>CodeCompanion /lsp<cr>", mode = "v", desc = "Explain LSP diagnostics" },
{ "<leader>Ct", "<cmd>CodeCompanion /tests<cr>", mode = "v", desc = "Generate tests" },
},
opts = {
adapters = {
-- {{{ HTTP
@@ -177,7 +213,7 @@ return {
---@param adapter CodeCompanion.Adapter
---@param context table
---@return string
prompt_decorator = function(message, adapter, context)
prompt_decorator = function(message, _adapter, _context)
return string.format([[<prompt>%s</prompt>]], message)
end,
completion_provider = "cmp",
@@ -202,7 +238,7 @@ return {
action_palette = {
provider = "telescope",
width = 75,
heigth = 45,
height = 45,
},
chat = {
layout = "vertical",
@@ -291,7 +327,7 @@ return {
---@param tokens number
---@param adapter CodeCompanion.Adapter
---@return string
token_count = function(tokens, adapter)
token_count = function(tokens, _adapter)
return " (" .. tokens .. " tokens)"
end,
},
@@ -343,7 +379,7 @@ return {
},
},
init = function()
require("utils.codecompanion.fidget-spinner"):init()
require("utils.codecompanion.fidget-spinner").init()
require("utils.codecompanion.extmarks").setup()
end,
}
+8 -10
View File
@@ -1,18 +1,13 @@
return {
"stevearc/conform.nvim",
opts = {
on_init = function(client)
require("conform").formatters.shfmt = {
append_args = { "-i", "0", "-ci", "-sr" },
}
end,
formatters_by_ft = {
python = function(bufnr)
if require("conform").get_formatter_info("ruff_format", bufnr).available then
return {
"ruff_fix",
"ruff_format",
"ruff_organize_imports",
"ruff_format",
}
else
return { "isort", "black" }
@@ -25,14 +20,17 @@ return {
javascriptreact = { "prettier" },
typescript = { "prettier" },
typescriptreact = { "prettier" },
md = { "markdownlint" },
["*"] = { "codespell" },
markdown = { "markdownlint" },
["_"] = { "trim_whitespace" },
},
formatters = {
shfmt = {
append_args = { "-i", "0", "-ci", "-sr" },
},
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
-- lsp_format = "fallback",
lsp_format = "never",
},
},
}
@@ -1,3 +0,0 @@
return {
'AndreM222/copilot-lualine'
}
+3
View File
@@ -2,6 +2,9 @@ return {
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
keys = {
{ "<leader>cp", "<cmd>vertical Copilot panel<cr>", desc = "Copilot panel" },
},
opts = {
panel = {
enabled = true,
+22 -15
View File
@@ -1,6 +1,14 @@
return {
"sindrets/diffview.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
keys = {
{ "<leader>gdc", "<cmd>DiffviewClose<cr>", desc = "Close Diffview" },
{ "<leader>gdf", "<cmd>DiffviewFileHistory %<cr>", desc = "File history" },
{ "<leader>gdh", "<cmd>DiffviewHistory<cr>", desc = "Repository history" },
{ "<leader>gdo", "<cmd>DiffviewOpen<cr>", desc = "Open Diffview" },
{ "<leader>gdr", "<cmd>DiffviewRefresh<cr>", desc = "Refresh Diffview" },
{ "<leader>gdt", "<cmd>DiffviewToggleFiles<cr>", desc = "Toggle files" },
},
opts = {
view = {
-- Disable the default normal mode mapping for `<tab>`:
@@ -8,20 +16,19 @@ return {
-- Disable the default visual mode mapping for `gf`:
-- { "x", "gf", false },
},
},
hooks = {
diff_buf_read = function(bufnr)
-- Change local options in diff buffers
vim.opt_local.wrap = false
vim.opt_local.list = false
vim.opt_local.colorcolumn = { 80 }
end,
view_opened = function(view)
require("notify").notify(
("A new %s was opened on tab page %d!"):format(view.class:name(), view.tabpage),
"info",
{ timeout = 5000, title = "Diffview" }
)
end,
hooks = {
diff_buf_read = function()
vim.opt_local.wrap = false
vim.opt_local.list = false
vim.opt_local.colorcolumn = { 80 }
end,
view_opened = function(view)
vim.notify(
("A new %s was opened on tab page %d!"):format(view.class:name(), view.tabpage),
vim.log.levels.INFO,
{ timeout = 5000, title = "Diffview" }
)
end,
},
},
}
-19
View File
@@ -42,8 +42,6 @@ return {
icon_style = "Question", -- Highlight group for group icons
priority = 30, -- Ordering priority for LSP notification group
skip_history = true, -- Whether progress notifications should be omitted from history
-- How to format a progress message
format_message = require("fidget.progress.display").default_format_message,
-- How to format a progress annotation
format_annote = function(msg)
return msg.title
@@ -71,15 +69,6 @@ return {
filter = vim.log.levels.INFO, -- Minimum notifications level
history_size = 128, -- Number of removed messages to retain in history
override_vim_notify = false, -- Automatically override vim.notify() with Fidget
-- How to configure notification groups when instantiated
configs = { default = require("fidget.notification").default_config },
-- Conditionally redirect notifications to another backend
redirect = function(msg, level, opts)
if opts and opts.on_open then
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
end
end,
-- Options related to how notifications are rendered as text
view = {
stack_upwards = true, -- Display notification items from bottom to top
@@ -87,14 +76,6 @@ return {
group_separator = "---", -- Separator between notification groups
},
},
integration = {
["nvim-tree"] = {
enable = true, -- Integrate with nvim-tree/nvim-tree.lua (if installed)
},
["xcodebuild-nvim"] = {
enable = false, -- Integrate with wojciech-kulik/xcodebuild.nvim (if installed)
},
},
-- Options related to logging
logger = {
level = vim.log.levels.WARN, -- Minimum logging level
+26 -1
View File
@@ -1 +1,26 @@
return { "rmagatti/goto-preview" }
return {
"rmagatti/goto-preview",
keys = {
{
"gpc",
function()
require("goto-preview").close_all_win()
end,
desc = "Close preview windows",
},
{
"gpd",
function()
require("goto-preview").goto_preview_definition()
end,
desc = "Preview definition",
},
{
"gpi",
function()
require("goto-preview").goto_preview_implementation()
end,
desc = "Preview implementation",
},
},
}
+16
View File
@@ -1,5 +1,21 @@
return {
"3rd/image.nvim",
keys = {
{
"<leader>id",
function()
require("image").disable()
end,
desc = "Disable image rendering",
},
{
"<leader>ie",
function()
require("image").enable()
end,
desc = "Enable image rendering",
},
},
opts = {
backend = "kitty",
-- processor = "magick_rock", -- or "magick_cli"
+24
View File
@@ -1,6 +1,30 @@
local function find_and_paste_image()
local builtin = require("telescope.builtin")
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
builtin.find_files({
attach_mappings = function(_, map)
local function paste_image(prompt_bufnr)
local entry = action_state.get_selected_entry()
actions.close(prompt_bufnr)
require("img-clip").paste_image(nil, entry.path or entry[1])
end
map("i", "<CR>", paste_image)
map("n", "<CR>", paste_image)
return true
end,
})
end
return {
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
keys = {
{ "<leader>pi", find_and_paste_image, desc = "Find and paste image" },
{ "<leader>Ti", find_and_paste_image, desc = "Find and paste image" },
},
opts = {
default = {
-- file and directory options
+44 -94
View File
@@ -1,7 +1,7 @@
return {
"neovim/nvim-lspconfig",
dependencies = { "hrsh7th/cmp-nvim-lsp" },
config = function()
vim.notify = require("notify")
local servers = {
"bashls",
"basedpyright",
@@ -13,113 +13,63 @@ return {
"html",
"cssls",
"lua_ls",
"eslint",
-- "ts_ls",
"vtsls",
"ansiblels",
"docker_compose_language_service",
"docker_language_server",
"golangci_lint_ls",
"gopls",
"ruff",
}
local capabilities = require("cmp_nvim_lsp").default_capabilities()
for _, lsp in ipairs(servers) do
if lsp == "lua_ls" then
vim.lsp.config("lua_ls", {
capabilities = capabilities,
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if
path ~= vim.fn.stdpath("config")
and (vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc"))
then
return
end
end
vim.lsp.config("*", { capabilities = capabilities })
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
runtime = {
-- Tell the language server which version of Lua you're using
-- (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
-- Make the server aware of Neovim runtime files
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
-- Depending on the usage, you might want to add additional paths here.
-- "${3rd}/luv/library",
-- "${3rd}/busted/library",
"/usr/lib/lua-language-server/meta/3rd/busted/library",
},
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
-- library = vim.api.nvim_get_runtime_file("", true)
},
})
end,
settings = {
Lua = {},
vim.lsp.config("lua_ls", {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if
path ~= vim.fn.stdpath("config")
and (vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc"))
then
return
end
end
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
"/usr/lib/lua-language-server/meta/3rd/busted/library",
},
},
handlers = {},
root_dir = function(bufnr, on_dir)
if not vim.fn.bufname(bufnr):match("%.txt$") then
on_dir(vim.fn.getcwd())
end
end,
})
elseif lsp == "basedpyright" then
vim.lsp.config(lsp, {
capabilities = capabilities,
settings = {
basedpyright = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "openFilesOnly",
useLibraryCodeForTypes = true,
autoFormatStrings = true,
},
diagnosticMode = "openFilesOnly",
inlayHints = {
callArgumentNames = true,
},
allowedUntypedLibraries = true,
end,
settings = { Lua = {} },
})
vim.lsp.config("basedpyright", {
settings = {
basedpyright = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "openFilesOnly",
autoFormatStrings = true,
inlayHints = {
callArgumentNames = true,
},
diagnosticSeverityOverrides = {
reportMissingTypeStubs = true,
reportImportCycles = true,
reportUnusedImport = true,
},
python = {
analysis = {
ignore = { "*" },
},
},
},
})
elseif lsp == "ruff" then
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)
if client == nil then
return
end
if client.name == "ruff" then
-- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false
end
end,
desc = "LSP: Disable hover capability from Ruff",
})
vim.lsp.config(lsp, {
settings = {
configuration = vim.fn.stdpath("config") .. "/lua/utils/ruff.toml",
logLevel = "info",
},
})
end
vim.lsp.enable(lsp)
end
},
},
})
vim.lsp.enable(servers)
end,
}
+80 -90
View File
@@ -1,90 +1,80 @@
return {
"nvim-lualine/lualine.nvim",
config = function()
require("lualine").setup({
options = {
icons_enabled = true,
theme = "catppuccin",
-- theme = 'dracula',
-- theme = 'horizon',
-- theme = 'onedark',
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {},
always_divide_middle = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff" },
lualine_c = { "filename" },
lualine_x = {
{
"seachcount",
{ require("mcphub.extensions.lualine") },
"copilot",
symbols = {
status = {
icons = {
enabled = "",
sleep = "", -- auto-trigger disabled
disabled = " ",
warning = "",
unknown = "",
},
hl = {
enabled = "#50FA7B",
sleep = "#AEB7D0",
disabled = "#6272A4",
warning = "#FFB86C",
unknown = "#FF5555",
},
},
spinners = "dots", -- has some premade spinners
spinner_color = "#6272A4",
},
show_colors = true,
show_loading = true,
},
{
"diagnostics",
"fileformat",
symbols = {
unix = "", -- e712
dos = "", -- e70f
mac = "", -- e711
},
},
"encoding",
"fileformat",
{ "filetype", colored = true, icon_only = false },
},
lualine_y = { "progress" },
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {
{
"filename",
file_status = true, -- Displays file status (readonly status, modified status)
path = 0, -- 0: Just the filename
shorting_target = 40, -- Shortens path to leave 40 spaces in the window
symbols = {
modified = "[+]", -- Text to show when the file is modified.
readonly = "[-]", -- Text to show when the file is non-modifiable or readonly.
unnamed = "[No Name]", -- Text to show for unnamed buffers.
},
},
M,
},
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = { "quickfix", "fzf", "nvim-tree", "symbols-outline", "fugitive", "toggleterm", "man" },
})
end,
depends = { "kyazdani42/nvim-web-devicons" },
}
return {
"nvim-lualine/lualine.nvim",
dependencies = {
"AndreM222/copilot-lualine",
"nvim-tree/nvim-web-devicons",
"ravitemer/mcphub.nvim",
},
config = function()
require("lualine").setup({
options = {
theme = "catppuccin",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff" },
lualine_c = { "filename" },
lualine_x = {
"searchcount",
require("mcphub.extensions.lualine"),
{
"copilot",
symbols = {
status = {
icons = {
disabled = "",
enabled = "",
sleep = "",
unknown = " ",
warning = "",
},
hl = {
disabled = "#6272A4",
enabled = "#50FA7B",
sleep = "#AEB7D0",
unknown = "#FF5555",
warning = "#FFB86C",
},
},
spinners = "dots",
spinner_color = "#6272A4",
},
show_colors = true,
show_loading = true,
},
"diagnostics",
"encoding",
{
"fileformat",
symbols = { dos = "", mac = "", unix = "" },
},
{ "filetype", colored = true },
},
lualine_y = { "progress" },
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {
{
"filename",
file_status = true,
path = 0,
symbols = {
modified = "[+]",
readonly = "[-]",
unnamed = "[No Name]",
},
},
},
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
extensions = { "man", "quickfix", "toggleterm" },
})
end,
}
-1
View File
@@ -1,6 +1,5 @@
return {
"echasnovski/mini.diff",
depends = { "echasnovski/mini.nvim" },
config = function()
local diff = require("mini.diff")
diff.setup({
+13 -10
View File
@@ -1,10 +1,17 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
keys = {
{ "<leader>Nd", "<cmd>Noice dismiss<cr>", desc = "Dismiss messages" },
{ "<leader>Ne", "<cmd>Noice errors<cr>", desc = "Errors" },
{ "<leader>Nh", "<cmd>Noice telescope<cr>", desc = "Message history" },
{ "<leader>Nl", "<cmd>Noice last<cr>", desc = "Last message" },
{ "<leader>Ns", "<cmd>Noice stats<cr>", desc = "Statistics" },
},
opts = {
lsp = {
progress = {
enabled = true,
enabled = false,
-- Lsp Progress is formatted using the builtins for lsp_progress. See config.format.builtin
-- See the section on formatting for more details on how to customize.
--- @type NoiceFormat|string
@@ -99,10 +106,9 @@ return {
-- Noice can be used as `vim.notify` so you can route any notification like other messages
-- Notification messages have their level and other properties set.
-- event is always "notify" and kind can be any log level as a string
-- The default routes will forward notifications to nvim-notify
-- Keep command and message history available through Noice.
-- Benefit of using Noice for this is the routing and consistent history view
enabled = true,
view = "notify",
enabled = false,
},
documentation = {
view = "hover",
@@ -118,7 +124,9 @@ return {
markdown = {
hover = {
["|(%S-)|"] = vim.cmd.help, -- vim help links
["%[.-%]%((%S-)%)"] = require("noice.util").open, -- markdown links
["%[.-%]%((%S-)%)"] = function(url)
require("noice.util").open(url)
end, -- markdown links
},
highlights = {
["|%S-|"] = "@text.reference",
@@ -131,11 +139,6 @@ return {
},
},
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
"rcarriga/nvim-notify",
},
}
-75
View File
@@ -1,75 +0,0 @@
return {
"nvimtools/none-ls.nvim",
config = function()
local null_ls = require("null-ls")
local helpers = require("null-ls.helpers")
-- syncronous formatting
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local sources = {
null_ls.builtins.completion.luasnip,
-- null_ls.builtins.diagnostics.mypy,
null_ls.builtins.diagnostics.pydoclint,
null_ls.builtins.diagnostics.markdownlint,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.markdownlint,
null_ls.builtins.formatting.prettier, -- handled by lsp server
null_ls.builtins.formatting.shfmt.with({
filetypes = { "sh", "bash" },
extra_args = { "-i", "0", "-ci", "-sr" },
}),
null_ls.builtins.formatting.gofmt,
null_ls.builtins.formatting.goimports,
null_ls.builtins.formatting.goimports_reviser,
null_ls.builtins.hover.printenv,
}
require("null-ls").setup({
border = "rounded",
cmd = { "nvim" },
debounce = 250,
debug = false,
default_timeout = 5000,
diagnostic_config = {
virtual_text = false,
signs = true,
underline = true,
float = { border = "rounded", source = true },
severity_sort = true,
},
-- diagnostics_format = "#{m}",
diagnostics_format = "[#{c}] #{m} (#{s})",
fallback_severity = vim.diagnostic.severity.ERROR,
log_level = "warn",
notify_format = "[null-ls] %s",
on_init = nil,
on_exit = nil,
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", "Makefile", ".git"),
root_dir_async = nil,
should_attach = nil,
sources = sources,
temp_dir = nil,
update_in_insert = false,
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({
async = false,
bufnr = bufnr,
filter = function(client)
return client.name == "null-ls"
end,
})
end,
})
end
end,
})
end,
}
-20
View File
@@ -1,20 +0,0 @@
return {
"rcarriga/nvim-notify",
opts = {
background_colour = "#000000",
fps = 144,
icons = {
DEBUG = "",
ERROR = "",
INFO = "",
TRACE = "",
WARN = "",
},
level = 2,
minimum_width = 50,
render = "default",
stages = "fade_in_slide_out",
timeout = 3000,
top_down = true,
},
}
+1 -1
View File
@@ -3,7 +3,7 @@ return {
event = "InsertEnter",
config = true,
opts = {
enabled = function(bufnr)
enabled = function(_bufnr)
return true
end,
disable_filetype = { "TelescopePrompt", "spectre_panel" },
+4 -4
View File
@@ -22,7 +22,7 @@ return {
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
if vim.api.nvim_get_option_value("buftype", { buf = 0 }) == "prompt" then
return false
end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
@@ -43,7 +43,7 @@ return {
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, {
sources = cmp.config.sources({ { name = "async_path" } }, {
{ name = "cmdline", option = { ignore_cmds = { "Man", "!" } } },
}),
matching = { disallow_symbol_nonprefix_matching = false },
@@ -51,7 +51,7 @@ return {
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
require("cmp").setup({
cmp.setup({
snippet = {
expand = function(args)
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
@@ -180,7 +180,7 @@ return {
{ name = "render-markdown", group_index = 2 },
{
name = "html-css",
group_indx = 2,
group_index = 2,
option = {
enable_on = { "html", "jsx", "tsx", "typescript", "typescriptreact" }, -- html is enabled by default
notify = false,
+41 -27
View File
@@ -1,39 +1,53 @@
return {
"mfussenegger/nvim-lint",
event = { "BufNewFile", "BufReadPre" },
config = function()
local lint = require("lint")
local parser = require("lint.parser")
lint.linters.pydoclint = {
cmd = "pydoclint",
args = { "--show-filenames-in-every-violation-message=true", "-q" },
stdin = false,
stream = "stderr",
ignore_exitcode = true,
parser = parser.from_pattern("(.+):(%d+): (DOC%d+): (.+)", { "file", "lnum", "code", "message" }, nil, {
severity = vim.diagnostic.severity.WARN,
source = "pydoclint",
}),
}
local python_linters = { "ruff" }
if vim.fn.executable("pydoclint") == 1 then
table.insert(python_linters, "pydoclint")
end
lint.linters_by_ft = {
markdown = { "markdownlint" },
lua = { "luacheck" },
python = { "ruff" },
sh = { "shellcheck" },
json = { "jsonlint" },
yaml = { "yamllint" },
vim = { "vint" },
go = { "golangcilint" },
json = { "jsonlint" },
lua = { "luacheck" },
markdown = { "markdownlint" },
python = python_linters,
sh = { "shellcheck" },
typescript = { "eslint" },
typescriptreact = { "eslint" },
vim = { "vint" },
yaml = { "yamllint" },
}
lint.linters.jsonlint.cmd = "vscode-json-language-server"
lint.linters.shellcheck.args = {
"-s",
"bash",
"-o",
"all",
"-e",
"2250",
}
-- Save original function
local orig_try_lint = lint.try_lint
lint.try_lint = function(...)
local opts = select(2, ...)
local bufnr = (type(opts) == "table" and opts.bufnr) or vim.api.nvim_get_current_buf()
if vim.api.nvim_get_option_value("buftype", { buf = bufnr }) ~= "" then
return
end
return orig_try_lint(...)
end
lint.linters.shellcheck.args = { "-s", "bash", "-o", "all", "-e", "2250" }
local lint_group = vim.api.nvim_create_augroup("LintOnSave", { clear = true })
vim.api.nvim_create_autocmd("BufWritePost", {
group = lint_group,
callback = function(args)
if vim.bo[args.buf].buftype ~= "" then
return
end
lint.try_lint(nil, { bufnr = args.buf })
if vim.fn.executable("codespell") == 1 then
lint.try_lint("codespell", { bufnr = args.buf })
end
end,
})
end,
event = { "BufReadPre", "BufNewFile" },
}
-11
View File
@@ -1,11 +0,0 @@
return {
"nvim-tree/nvim-tree.lua",
version = "*",
lazy = false,
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("nvim-tree").setup({})
end,
}
+64 -38
View File
@@ -2,6 +2,68 @@ return {
"folke/snacks.nvim",
priority = 1000,
lazy = false,
keys = {
{
"<leader>fb",
function()
Snacks.explorer()
end,
desc = "File browser",
},
{
"<leader>gg",
function()
Snacks.lazygit()
end,
desc = "Lazygit",
},
{
"<leader>nc",
function()
Snacks.notifier.hide()
end,
desc = "Dismiss notifications",
},
{
"<leader>nh",
function()
Snacks.notifier.show_history()
end,
desc = "Notification history",
},
{
"<leader>nt",
function()
Snacks.explorer()
end,
desc = "File explorer",
},
{
"<leader>sn",
function()
Snacks.win({
file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1],
width = 0.6,
height = 0.6,
wo = {
spell = false,
wrap = false,
signcolumn = "yes",
statuscolumn = " ",
conceallevel = 3,
},
})
end,
desc = "Neovim news",
},
{
"<leader>Tn",
function()
Snacks.notifier.show_history()
end,
desc = "Notifications",
},
},
---@type snacks.Config
opts = {
-- your configuration comes here
@@ -73,7 +135,7 @@ return {
debug = "",
trace = "",
},
keep = function(notif)
keep = function()
return vim.fn.getcmdpos() > 0
end,
---@type snacks.notifier.style
@@ -92,43 +154,7 @@ return {
scroll = { enabled = false },
statuscolumn = { enabled = false },
words = { enabled = false },
terminal = {
enabled = true,
bo = {
filetype = "snacks_terminal",
},
wo = {},
keys = {
q = "hide",
gf = function(self)
local f = vim.fn.findfile(vim.fn.expand("<cfile>"), "**")
if f == "" then
Snacks.notify.warn("No file under cursor")
else
self:hide()
vim.schedule(function()
vim.cmd("e " .. f)
end)
end
end,
term_normal = {
"<esc>",
function(self)
self.esc_timer = self.esc_timer or (vim.uv or vim.loop).new_timer()
if self.esc_timer:is_active() then
self.esc_timer:stop()
vim.cmd("stopinsert")
else
self.esc_timer:start(200, 0, function() end)
return "<esc>"
end
end,
mode = "t",
expr = true,
desc = "Double escape to normal mode",
},
},
},
terminal = { enabled = false },
win = { enabled = true },
styles = {
input = {
+78 -15
View File
@@ -2,9 +2,7 @@ return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
-- "jonarrien/telescope-cmdline.nvim",
"nat-418/telescope-color-names.nvim",
"nvim-telescope/telescope-file-browser.nvim",
"ghassan0/telescope-glyph.nvim",
"nvim-telescope/telescope-ui-select.nvim",
{
@@ -13,6 +11,64 @@ return {
},
"folke/noice.nvim",
},
cmd = "Telescope",
keys = {
{ "//", "<cmd>Telescope current_buffer_fuzzy_find previewer=false<cr>", desc = "Find in current buffer" },
{
"??",
"<cmd>Telescope lsp_document_symbols theme=dropdown layout_config={width=0.5}<cr>",
desc = "Document symbols",
},
{ "<leader>bb", "<cmd>Telescope buffers<cr>", desc = "Buffers" },
{
"<leader>fc",
'<cmd>Telescope color_names theme=dropdown layout_config={width=0.45,height=25,prompt_position="bottom"} layout_strategy=vertical<cr>',
desc = "Color names",
},
{
"<leader>ff",
"<cmd>Telescope find_files find_command=rg,--ignore,--follow,--hidden,--files prompt_prefix=🔍<cr>",
desc = "Find files",
},
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live grep" },
{
"<leader>fG",
'<cmd>Telescope glyph theme=dropdown layout_config={width=0.45,height=35,prompt_position="bottom"} layout_strategy=vertical<cr>',
desc = "Glyphs",
},
{ "<leader>fr", "<cmd>Telescope oldfiles theme=dropdown layout_config={width=0.5}<cr>", desc = "Recent files" },
{ "<leader>gc", "<cmd>Telescope git_commits<cr>", desc = "Git commits" },
{ "<leader>gf", "<cmd>Telescope git_files<cr>", desc = "Git files" },
{ "<leader>hc", "<cmd>Telescope commands<cr>", desc = "Commands" },
{ "<leader>hk", "<cmd>Telescope keymaps<cr>", desc = "Keymaps" },
{ "<leader>hm", "<cmd>Telescope man_pages theme=dropdown layout_config={width=0.75}<cr>", desc = "Man pages" },
{ "<leader>hs", "<cmd>Telescope spell_suggest<cr>", desc = "Spelling suggestions" },
{ "<leader>ht", "<cmd>Telescope help_tags<cr>", desc = "Help tags" },
{ "<leader>hv", "<cmd>Telescope vim_options<cr>", desc = "Neovim options" },
{ "<leader>s/", "<cmd>Telescope search_history<cr>", desc = "Search history" },
{ "<leader>sF", "<cmd>Telescope fidget<cr>", desc = "Fidget history" },
{
"<leader>sf",
"<cmd>Telescope find_files find_command=rg,--ignore,--follow,--hidden,--files prompt_prefix=🔍<cr>",
desc = "Search files",
},
{ "<leader>sg", "<cmd>Telescope live_grep<cr>", desc = "Live grep" },
{ "<leader>sh", "<cmd>Telescope command_history<cr>", desc = "Command history" },
{ "<leader>sm", "<cmd>Telescope man_pages<cr>", desc = "Man pages" },
{ "<leader>Tc", "<cmd>Telescope colorscheme<cr>", desc = "Colorschemes" },
{
"<leader>TC",
'<cmd>Telescope color_names theme=dropdown layout_config={width=0.45,height=25,prompt_position="bottom"} layout_strategy=vertical<cr>',
desc = "Color names",
},
{
"<leader>Tg",
'<cmd>Telescope glyph theme=dropdown layout_config={width=0.45,height=35,prompt_position="bottom"} layout_strategy=vertical<cr>',
desc = "Glyphs",
},
{ "<leader>TN", "<cmd>Telescope noice theme=dropdown layout_config={width=0.75}<cr>", desc = "Noice history" },
{ "<leader>Tr", "<cmd>Telescope reloader<cr>", desc = "Reload Lua module" },
},
opts = {
defaults = {
-- Default configuration for telescope goes here:
@@ -95,19 +151,6 @@ return {
enabled = true,
},
},
file_browser = {
theme = "ivy",
-- disables netrw and use telescope-file-browser in its place
hijack_netrw = true,
mappings = {
["i"] = {
-- your custom insert mode mappings
},
["n"] = {
-- your custom normal mode mappings
},
},
},
-- ["ui-select"] = {
-- require("telescope.themes").get_dropdown({
-- winblend = 10,
@@ -119,4 +162,24 @@ return {
-- },
},
},
config = function(_, opts)
local telescope = require("telescope")
local actions = require("telescope.actions")
local config = require("telescope.config")
local vimgrep_arguments = vim.deepcopy(config.values.vimgrep_arguments)
vim.list_extend(vimgrep_arguments, { "--hidden", "--glob", "!**/.git/*" })
opts.defaults.vimgrep_arguments = vimgrep_arguments
opts.defaults.mappings = vim.tbl_deep_extend("force", opts.defaults.mappings or {}, {
i = {
["<C-h>"] = actions.results_scrolling_left,
["<C-l>"] = actions.results_scrolling_right,
},
})
telescope.setup(opts)
for _, extension in ipairs({ "color_names", "fzf", "glyph", "noice", "ui-select" }) do
pcall(telescope.load_extension, extension)
end
end,
}
+80 -1
View File
@@ -1,6 +1,52 @@
local terminals = {}
local function toggle(name)
return function()
terminals[name]:toggle()
end
end
return {
"akinsho/toggleterm.nvim",
version = "*",
keys = {
{ "<C-T>", "<cmd>ToggleTerm name=toggleterm<cr>", desc = "Toggle terminal" },
{ "<leader>-", "<cmd>ToggleTerm direction=horizontal<cr>", desc = "Toggle horizontal terminal" },
{ "<leader>|", "<cmd>ToggleTerm direction=vertical<cr>", desc = "Toggle vertical terminal" },
{ "<leader>ob", toggle("btop"), desc = "Open btop" },
{ "<leader>od", toggle("lazydocker"), desc = "Open Lazydocker" },
{
"<leader>oh",
"<cmd>ToggleTerm direction=horizontal name=toggleterm-hori<cr>",
desc = "Open horizontal terminal",
},
{ "<leader>oi", toggle("iotop"), desc = "Open iotop" },
{ "<leader>on", toggle("rmpc"), desc = "Open rmpc" },
{ "<leader>oN", toggle("nvtop"), desc = "Open nvtop" },
{ "<leader>op", toggle("ipython"), desc = "Open IPython" },
{ "<leader>oP", toggle("ipython-full"), desc = "Open full IPython" },
{ "<leader>ot", "<cmd>ToggleTerm name=toggleterm<cr>", desc = "Open terminal" },
{ "<leader>oT", "<cmd>ToggleTerm name=toggleterm-full direction=tab<cr>", desc = "Open full terminal" },
{
"<leader>ov",
"<cmd>ToggleTerm direction=vertical name=toggleterm-vert<cr>",
desc = "Open vertical terminal",
},
{ "<leader>tf", "<cmd>ToggleTerm name=toggleterm<cr>", desc = "Toggle terminal" },
{
"<leader>th",
"<cmd>ToggleTerm direction=horizontal name=toggleterm-hori<cr>",
desc = "Toggle horizontal terminal",
},
{ "<leader>ts", "<cmd>TermSelect<cr>", desc = "Select terminal" },
{ "<leader>tt", "<cmd>ToggleTerm name=toggleterm<cr>", desc = "Toggle terminal" },
{ "<leader>tT", "<cmd>ToggleTerm name=toggleterm-full direction=tab<cr>", desc = "Toggle full terminal" },
{
"<leader>tv",
"<cmd>ToggleTerm direction=vertical name=toggleterm-vert<cr>",
desc = "Toggle vertical terminal",
},
},
opts = {
-- size can be a number or function which is passed the current terminal
size = function(term)
@@ -10,7 +56,6 @@ return {
return vim.o.columns * 0.45
end
end,
open_mapping = { [[<c-t>]] }, -- or { [[<c-\>]], [[<c-¥>]] } if you also use a Japanese keyboard.
-- on_create = fun(t: Terminal), -- function to run when the terminal is first created
-- on_open = fun(t: Terminal), -- function to run when the terminal opens
-- on_close = fun(t: Terminal), -- function to run when the terminal closes
@@ -82,4 +127,38 @@ return {
horizontal_breakpoint = 135,
},
},
config = function(_, opts)
require("toggleterm").setup(opts)
local Terminal = require("toggleterm.terminal").Terminal
local programs = {
btop = { cmd = "/usr/bin/btop", display_name = "btop", direction = "tab", hidden = true },
ipython = { cmd = "ipython", display_name = "ipython", direction = "vertical", hidden = true },
["ipython-full"] = { cmd = "ipython", display_name = "ipython-full", direction = "tab", hidden = true },
iotop = { cmd = "sudo iotop", display_name = "iotop", direction = "tab", hidden = true },
lazydocker = { cmd = "lazydocker", display_name = "lazydocker", direction = "tab", hidden = true },
nvtop = { cmd = "nvtop", display_name = "nvtop", direction = "tab", hidden = true },
rmpc = { cmd = "rmpc", display_name = "rmpc", direction = "tab", hidden = true },
}
for name, program in pairs(programs) do
program.on_stderr = function(_, job, data, process_name)
vim.notify(
("%s encountered an error on job %d\n%s"):format(process_name, job, table.concat(data, "\n")),
vim.log.levels.ERROR
)
end
terminals[name] = Terminal:new(program)
end
local terminal_keys = vim.api.nvim_create_augroup("TerminalKeys", { clear = true })
vim.api.nvim_create_autocmd("TermOpen", {
group = terminal_keys,
pattern = "term://*",
callback = function(args)
vim.keymap.set("t", "<esc>", [[<C-\><C-n>]], { buffer = args.buf })
vim.keymap.set("t", "<C-w>", [[<C-\><C-n><C-w>]], { buffer = args.buf })
end,
})
end,
}
@@ -1 +0,0 @@
return { "tpope/vim-commentary" }