migrate nvim config to 0.12.0: vim.pack, ui2, snacks -> mini, just general spring cleaning
This commit is contained in:
parent
d1178fbe59
commit
14b1a9b057
70 changed files with 1081 additions and 1483 deletions
|
|
@ -1,41 +0,0 @@
|
|||
local utils = require("utils")
|
||||
|
||||
local M = {}
|
||||
|
||||
local callbacks = {}
|
||||
local handle_count = 1
|
||||
|
||||
function M.setup()
|
||||
utils.set_keymap_list({
|
||||
{
|
||||
"<Leader>q",
|
||||
function()
|
||||
for _, cb in ipairs(callbacks) do
|
||||
if cb ~= nil then
|
||||
cb()
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
function M.register_on_close_cb(cb)
|
||||
assert(type(cb) == "function", "Callback must be a function")
|
||||
|
||||
local handle = handle_count
|
||||
handle_count = handle_count + 1
|
||||
table.insert(callbacks, cb)
|
||||
|
||||
return handle
|
||||
end
|
||||
|
||||
function M.remove_on_close_cb(cb_handle)
|
||||
assert(type(cb_handle) == "number", "Callback handle must be a number")
|
||||
assert(cb_handle > 0 and cb_handle <= #callbacks, "Invalid callback handle")
|
||||
assert(callbacks[cb_handle] ~= nil, "Callback does not exist")
|
||||
|
||||
callbacks[cb_handle] = nil
|
||||
end
|
||||
|
||||
return M
|
||||
22
nvim/lua/colorsync_integration.lua
Normal file
22
nvim/lua/colorsync_integration.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
local filepath = vim.fs.joinpath(os.getenv("HOME"), ".local/state/colorsync/current")
|
||||
|
||||
vim.api.nvim_create_augroup("ColorsyncEvents", { clear = true })
|
||||
|
||||
local handle = vim.uv.new_fs_event()
|
||||
if not handle then
|
||||
vim.notify("colorsync: failed to create fs event handle", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
handle:start(filepath, {}, function(err)
|
||||
if err then
|
||||
vim.schedule(function()
|
||||
vim.notify("colorsync: error watching " .. filepath .. "\n" .. err, vim.log.levels.ERROR)
|
||||
end)
|
||||
return
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_exec_autocmds("User", { pattern = "ColorsyncThemeChanged", modeline = false })
|
||||
end)
|
||||
end)
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
local utils = require("utils")
|
||||
local dap = require("dap")
|
||||
|
||||
local dir_path = "dap"
|
||||
utils.foreach(utils.get_file_names_in_dir(dir_path, "*.lua", true), function(adapter)
|
||||
dap.adapters[adapter] = require(dir_path .. "/" .. adapter)
|
||||
end)
|
||||
|
||||
vim.api.nvim_create_user_command("LaunchTemplate", function()
|
||||
local template = {
|
||||
'{',
|
||||
' "version": "0.2.0",',
|
||||
' "configurations": [',
|
||||
' {',
|
||||
' "type": "codelldb",',
|
||||
' "request": "launch",',
|
||||
' "name": "Launch",',
|
||||
' "program": "${workspaceFolder}/build/binary",',
|
||||
' "cwd": "${workspaceFolder}",',
|
||||
' "args": [],',
|
||||
' "stopOnEntry": false,',
|
||||
' "environment": []',
|
||||
' }',
|
||||
' ]',
|
||||
'}',
|
||||
}
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, template)
|
||||
end, {})
|
||||
|
||||
-- Do not define default fallbacks until I have a better way of handling a default selected configuration.
|
||||
-- I never want to be prompted for a configuration, we should have ae serialized active config which is always run unless changed.
|
||||
-- -- Define configurations
|
||||
-- dap.configurations.cpp = {
|
||||
-- {
|
||||
-- name = "Launch File",
|
||||
-- type = "codelldb",
|
||||
-- request = "launch",
|
||||
-- program = function()
|
||||
-- return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
-- end,
|
||||
-- cwd = "${workspaceFolder}",
|
||||
-- stopOnEntry = false,
|
||||
-- args = {},
|
||||
-- },
|
||||
-- }
|
||||
|
|
@ -1,14 +1,6 @@
|
|||
local sev = vim.diagnostic.severity
|
||||
vim.diagnostic.config({
|
||||
-- underline = true,
|
||||
-- This enables the diagnostics at end of line
|
||||
-- virtual_text = {
|
||||
-- prefix = "●",
|
||||
-- },
|
||||
-- Disable this whilst using tiny inline diagnostics
|
||||
virtual_text = false,
|
||||
-- This enables the separate buffer diagnostics
|
||||
-- virtual_lines = true,
|
||||
update_in_insert = true,
|
||||
signs = {
|
||||
text = {
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
local M = {}
|
||||
M.format_on_save = true
|
||||
|
||||
function M.format(force)
|
||||
local do_force = force or false
|
||||
if M.format_on_save or do_force then
|
||||
vim.lsp.buf.format()
|
||||
end
|
||||
end
|
||||
|
||||
function M.format_enable()
|
||||
M.format_on_save = true
|
||||
end
|
||||
|
||||
function M.format_disable()
|
||||
M.format_on_save = false
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
local user_commands = {
|
||||
{ "FormatEnable", "lua require('format_handler').format_enable()" },
|
||||
{ "FormatDisable", "lua require('format_handler').format_disable()" },
|
||||
{ "Format", "lua require('format_handler').format(true)" },
|
||||
}
|
||||
for _, cmd in ipairs(user_commands) do
|
||||
vim.api.nvim_command("command! " .. cmd[1] .. " " .. cmd[2])
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -7,7 +7,7 @@ g.maplocalleader = " "
|
|||
local move_up = { "v:count || mode(1)[0:1] == \"no\" ? \"k\" : \"gk\"", { expr = true } }
|
||||
local move_down = { "v:count || mode(1)[0:1] == \"no\" ? \"j\" : \"gj\"", { expr = true } }
|
||||
|
||||
utils.foreach({
|
||||
for _, mode_mapping in ipairs({
|
||||
{
|
||||
"n",
|
||||
{
|
||||
|
|
@ -17,6 +17,7 @@ utils.foreach({
|
|||
{ "grr", "<Nop>", },
|
||||
{ "gri", "<Nop>", },
|
||||
{ "gO", "<Nop>", },
|
||||
{ "grt", "<Nop>", },
|
||||
-- Navigation
|
||||
{ "<C-Left>", "<C-w>h", },
|
||||
{ "<C-Down>", "<C-w>j", },
|
||||
|
|
@ -48,9 +49,6 @@ utils.foreach({
|
|||
-- Maps to remove
|
||||
{ "<C-z>", "<Nop>", },
|
||||
|
||||
-- Marks are less frequently used than leaping, also, less relevant with arrow and fzf navigation.
|
||||
-- Prioritize regular m for leaping, and <leader>m for setting marks.
|
||||
-- { "<leader>m", "m", },
|
||||
{ "[d", function()
|
||||
vim.diagnostic.jump({ count = -1, float = false })
|
||||
end },
|
||||
|
|
@ -66,16 +64,20 @@ utils.foreach({
|
|||
vim.cmd.normal({ cmd })
|
||||
end
|
||||
end },
|
||||
{ "<C-t>", ":$tabnew %<CR>", { silent = true }, },
|
||||
-- These are mapped to C-1 through C-5 in ghostty, sending escape codes for F keys
|
||||
{ "<F5>", ":1tabn<CR>", { silent = true }, },
|
||||
{ "<F8>", ":2tabn<CR>", { silent = true }, },
|
||||
{ "<F10>", ":3tabn<CR>", { silent = true }, },
|
||||
{ "<F11>", ":4tabn<CR>", { silent = true }, },
|
||||
{ "<F12>", ":5tabn<CR>", { silent = true }, },
|
||||
{ "<C-t>", ":$tabnew %<CR>", { silent = true }, },
|
||||
{ "<F15>", ":1tabn<CR>", { silent = true }, },
|
||||
{ "<F16>", ":2tabn<CR>", { silent = true }, },
|
||||
{ "<F17>", ":3tabn<CR>", { silent = true }, },
|
||||
{ "<F18>", ":4tabn<CR>", { silent = true }, },
|
||||
{ "<F19>", ":5tabn<CR>", { silent = true }, },
|
||||
{ "<F20>", ":6tabn<CR>", { silent = true }, },
|
||||
{ "<F21>", ":7tabn<CR>", { silent = true }, },
|
||||
{ "<F22>", ":8tabn<CR>", { silent = true }, },
|
||||
|
||||
{ "z/", '/\\%><C-r>=line("w0")-1<CR>l\\%<<C-r>=line("w$")+1<CR>l', { silent = false, desc = "Search in viewport" }, },
|
||||
{ "z?", '?\\%><C-r>=line("w0")-1<CR>l\\%<<C-r>=line("w$")+1<CR>l', { silent = false, desc = "Search in viewport" }, }
|
||||
{ "z/", '/\\%><C-r>=line("w0")-1<CR>l\\%<<C-r>=line("w$")+1<CR>l', { silent = false, desc = "Search in viewport" }, },
|
||||
{ "z?", '?\\%><C-r>=line("w0")-1<CR>l\\%<<C-r>=line("w$")+1<CR>l', { silent = false, desc = "Search in viewport" }, },
|
||||
|
||||
{ "<leader>u", ":Undotree<CR>", { silent = true } },
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -88,9 +90,6 @@ utils.foreach({
|
|||
{ "<tab>", ">gv", },
|
||||
{ "<S-tab>", "<gv", },
|
||||
|
||||
-- Marks are less frequently used than leaping, also, less relevant with arrow and fzf navigation.
|
||||
-- Prioritize regular m for leaping, and <leader>m for setting marks.
|
||||
{ "<leader>m", "m", },
|
||||
{ "/", "<C-\\><C-n>`</\\%V", },
|
||||
{ "?", "<C-\\><C-n>`>?\\%V", },
|
||||
},
|
||||
|
|
@ -111,8 +110,6 @@ utils.foreach({
|
|||
{ "<C-q>", "<C-\\><C-N>", },
|
||||
}
|
||||
},
|
||||
}, function(mode_mapping)
|
||||
local mode = mode_mapping[1]
|
||||
local mappings = mode_mapping[2]
|
||||
utils.set_keymap_list(mappings, mode)
|
||||
end)
|
||||
}) do
|
||||
utils.set_keymap_list(mode_mapping[2], mode_mapping[1])
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Initialize plugins, add a plugin by creating a new file in the plugins dir
|
||||
require("lazy").setup("plugs", {
|
||||
git = {
|
||||
timeout = 300
|
||||
},
|
||||
dev = {
|
||||
path = "~/dev/git/",
|
||||
fallback = true,
|
||||
},
|
||||
})
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
local inlay_hints_handler = require("inlay_hints_handler")
|
||||
local format_handler = require("format_handler")
|
||||
local utils = require("utils")
|
||||
|
||||
local lsp = vim.lsp.buf
|
||||
local api = vim.api
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.configure_generic_client(client, bufnr)
|
||||
inlay_hints_handler.add_buffer(bufnr)
|
||||
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
api.nvim_buf_create_user_command(bufnr, "Format", lsp.format, { nargs = 0 })
|
||||
api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
format_handler.format()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Built-in LSP completion.
|
||||
-- Could switch to this if they just appeared automatically when typing, and didn't
|
||||
-- only rely on showing when the servers completionCharacters are typed.
|
||||
-- if client:supports_method("textDocument/completion") then
|
||||
-- vim.lsp.completion.enable(true, client.id, bufnr, { autotrigger = true })
|
||||
-- end
|
||||
|
||||
for mode, keys in pairs({
|
||||
n = {
|
||||
{ "K", function() lsp.hover() end, { buffer = bufnr } },
|
||||
{ "<leader>a", function() lsp.code_action() end, { buffer = bufnr } },
|
||||
},
|
||||
i = {
|
||||
{ "<C-s>", function() lsp.signature_help() end, { buffer = bufnr } },
|
||||
},
|
||||
}) do
|
||||
utils.set_keymap_list(keys, mode)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -1,14 +1,81 @@
|
|||
local utils = require("utils")
|
||||
local lsplib = require("lsplib")
|
||||
local inlay_hints_handler = require("inlay_hints_handler")
|
||||
|
||||
local format_on_save = true
|
||||
|
||||
vim.api.nvim_create_user_command("FormatEnable", function() format_on_save = true end, {})
|
||||
vim.api.nvim_create_user_command("FormatDisable", function() format_on_save = false end, {})
|
||||
vim.api.nvim_create_user_command("Format", function() vim.lsp.buf.format() end, {})
|
||||
|
||||
vim.lsp.config("*", {
|
||||
root_markers = { ".git" },
|
||||
})
|
||||
|
||||
local servers = {}
|
||||
utils.foreach(utils.get_file_names_in_dir("../lsp", "*.lua", true), function(server_name)
|
||||
table.insert(servers, server_name)
|
||||
end)
|
||||
local lsp_dir = vim.fs.joinpath(vim.fn.stdpath("config"), "lsp")
|
||||
for name, type in vim.fs.dir(lsp_dir) do
|
||||
if type == "file" and name:match("%.lua$") then
|
||||
table.insert(servers, (name:gsub("%.lua$", "")))
|
||||
end
|
||||
end
|
||||
|
||||
local lsp_pick_ns = vim.api.nvim_create_namespace("lsp_pick")
|
||||
local function lsp_pick(scope)
|
||||
vim.lsp.buf[scope]({
|
||||
on_list = function(options)
|
||||
if #options.items == 1 then
|
||||
local item = options.items[1]
|
||||
vim.cmd("normal! m'")
|
||||
vim.cmd.drop(item.filename)
|
||||
if item.lnum <= vim.api.nvim_buf_line_count(0) then
|
||||
vim.api.nvim_win_set_cursor(0, { item.lnum, (item.col or 1) - 1 })
|
||||
end
|
||||
return
|
||||
end
|
||||
local cwd = (vim.uv.cwd() or "") .. "/"
|
||||
local home = (vim.env.HOME or "") .. "/"
|
||||
for _, item in ipairs(options.items) do
|
||||
local icon, icon_hl = MiniIcons.get("file", item.filename)
|
||||
local rel = item.filename
|
||||
if rel:sub(1, #cwd) == cwd then
|
||||
rel = rel:sub(#cwd + 1)
|
||||
elseif rel:sub(1, #home) == home then
|
||||
rel = "~/" .. rel:sub(#home + 1)
|
||||
end
|
||||
local prefix = string.format("%s:%d:%d:", rel, item.lnum, item.col or 0)
|
||||
item.path = item.filename
|
||||
item.icon_hl = icon_hl
|
||||
item.icon_end = #icon
|
||||
item.prefix_end = #icon + 1 + #prefix
|
||||
item.text = string.format("%s %s %s", icon, prefix, vim.trim(item.text or ""))
|
||||
end
|
||||
MiniPick.start({
|
||||
source = {
|
||||
name = string.format("LSP (%s)", scope),
|
||||
items = options.items,
|
||||
show = function(buf_id, items_to_show, query)
|
||||
MiniPick.default_show(buf_id, items_to_show, query)
|
||||
vim.api.nvim_buf_clear_namespace(buf_id, lsp_pick_ns, 0, -1)
|
||||
for i, item in ipairs(items_to_show) do
|
||||
vim.api.nvim_buf_set_extmark(buf_id, lsp_pick_ns, i - 1, 0, {
|
||||
end_col = item.icon_end,
|
||||
hl_group = item.icon_hl,
|
||||
priority = 200,
|
||||
})
|
||||
vim.api.nvim_buf_set_extmark(buf_id, lsp_pick_ns, i - 1, item.icon_end + 1, {
|
||||
end_col = item.prefix_end,
|
||||
hl_group = "Comment",
|
||||
priority = 200,
|
||||
})
|
||||
end
|
||||
end,
|
||||
preview = MiniPick.default_preview,
|
||||
choose = MiniPick.default_choose,
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
vim.lsp.enable(servers)
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
|
|
@ -17,6 +84,33 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||
local bufnr = args.buf
|
||||
assert(client, "LspAttach: client is nil")
|
||||
|
||||
lsplib.configure_generic_client(client, bufnr)
|
||||
end
|
||||
inlay_hints_handler.add_buffer(bufnr)
|
||||
|
||||
if client:supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Format", vim.lsp.buf.format, { nargs = 0 })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
if format_on_save then vim.lsp.buf.format() end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
for mode, keys in pairs({
|
||||
n = {
|
||||
{ "K", function() vim.lsp.buf.hover() end, { buf = bufnr } },
|
||||
{ "<leader>a", function() vim.lsp.buf.code_action() end, { buf = bufnr } },
|
||||
{ "gd", function() lsp_pick("definition") end, { buf = bufnr } },
|
||||
{ "gD", function() lsp_pick("declaration") end, { buf = bufnr } },
|
||||
{ "gr", function() lsp_pick("references") end, { buf = bufnr, nowait = true } },
|
||||
{ "gi", function() lsp_pick("implementation") end, { buf = bufnr } },
|
||||
{ "gt", function() lsp_pick("type_definition") end, { buf = bufnr } },
|
||||
},
|
||||
i = {
|
||||
{ "<C-s>", function() vim.lsp.buf.signature_help() end, { buf = bufnr } },
|
||||
},
|
||||
}) do
|
||||
utils.set_keymap_list(keys, mode)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
return {
|
||||
"saghen/blink.cmp",
|
||||
dependencies = {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
dependencies = { "rafamadriz/friendly-snippets", },
|
||||
config = function()
|
||||
local ls = require("luasnip")
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
ls.filetype_extend("typescriptreact", { "html" })
|
||||
ls.filetype_extend("javascriptreact", { "html" })
|
||||
|
||||
ls.config.set_config({
|
||||
enable_autosnippets = false,
|
||||
store_selection_keys = false,
|
||||
})
|
||||
end
|
||||
},
|
||||
},
|
||||
version = "1.*",
|
||||
opts = {
|
||||
keymap = { preset = "super-tab" },
|
||||
|
||||
appearance = {
|
||||
nerd_font_variant = "mono"
|
||||
},
|
||||
|
||||
-- (Default) Only show the documentation popup when manually triggered
|
||||
completion = {
|
||||
documentation = {
|
||||
auto_show = false,
|
||||
},
|
||||
menu = {
|
||||
draw = {
|
||||
-- We don't need label_description now because label and label_description are already
|
||||
-- combined together in label by colorful-menu.nvim.
|
||||
columns = { { "kind_icon" }, { "label", gap = 1 } },
|
||||
components = {
|
||||
label = {
|
||||
text = function(ctx)
|
||||
return require("colorful-menu").blink_components_text(ctx)
|
||||
end,
|
||||
highlight = function(ctx)
|
||||
return require("colorful-menu").blink_components_highlight(ctx)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
snippets = {
|
||||
preset = "luasnip",
|
||||
-- Disable snippet navigation while keeping expansion
|
||||
active = function() return false end,
|
||||
},
|
||||
-- Default list of enabled providers defined so that you can extend it
|
||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "buffer", },
|
||||
per_filetype = {
|
||||
codecompanion = { "codecompanion", },
|
||||
},
|
||||
},
|
||||
|
||||
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||
--
|
||||
-- See the fuzzy documentation for more information
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" }
|
||||
},
|
||||
opts_extend = { "sources.default" },
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
"esmuellert/codediff.nvim",
|
||||
dependencies = { "MunifTanjim/nui.nvim" },
|
||||
cmd = "CodeDiff",
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
return {
|
||||
"xzbdmw/colorful-menu.nvim",
|
||||
opts = {},
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
return {
|
||||
"mawkler/demicolon.nvim",
|
||||
dependenies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
opts = {
|
||||
keymaps = {
|
||||
repeat_motions = "stateful",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
event = "VeryLazy",
|
||||
lazy = true,
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
return {
|
||||
"dmtrKovalenko/fff.nvim",
|
||||
build = "nix run .#release",
|
||||
lazy = false,
|
||||
keys = {
|
||||
{
|
||||
"<leader>f",
|
||||
function() require("fff").find_files() end,
|
||||
desc = "FFFind files",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
local close_handler = require("close_handler")
|
||||
|
||||
local close_cb_handle = 0
|
||||
|
||||
return {
|
||||
"rmagatti/goto-preview",
|
||||
dependencies = { "rmagatti/logger.nvim" },
|
||||
event = "BufEnter",
|
||||
config = true, -- necessary as per https://github.com/rmagatti/goto-preview/issues/88
|
||||
opts = {
|
||||
post_open_hook = function(_, _)
|
||||
close_cb_handle = close_handler.register_on_close_cb(function()
|
||||
require("goto-preview").close_all_win()
|
||||
end)
|
||||
end,
|
||||
post_close_hook = function(_, _)
|
||||
close_handler.remove_on_close_cb(close_cb_handle)
|
||||
end,
|
||||
border = { "↖", "─", "┐", "│", "┘", "─", "└", "│" },
|
||||
focus_on_open = true,
|
||||
stack_floating_preview_windows = false,
|
||||
preview_window_title = { enable = true, position = "left" },
|
||||
vim_ui_input = false,
|
||||
},
|
||||
keys = {
|
||||
{ "gp", function() require("goto-preview").goto_preview_definition() end, },
|
||||
{ "gy", function() require("goto-preview").goto_preview_type_definition() end, },
|
||||
},
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
local utils = require("utils")
|
||||
|
||||
return {
|
||||
"b0o/incline.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "[g", function() require("gitsigns").nav_hunk("prev") end, },
|
||||
{ "]g", function() require("gitsigns").nav_hunk("next") end, },
|
||||
}
|
||||
}
|
||||
},
|
||||
config = function()
|
||||
local function setup_incline()
|
||||
require("incline").setup({
|
||||
window = {
|
||||
padding = 0,
|
||||
},
|
||||
hide = {
|
||||
cursorline = true,
|
||||
},
|
||||
render = function(props)
|
||||
local fullpath = vim.api.nvim_buf_get_name(props.buf)
|
||||
local filename = vim.fn.fnamemodify(fullpath, ":t")
|
||||
if filename == "" then
|
||||
filename = "[No Name]"
|
||||
end
|
||||
|
||||
local function get_ft_icon()
|
||||
local ft_icon, ft_color = require("nvim-web-devicons").get_icon_color(filename)
|
||||
return { (ft_icon or "") .. " ", guifg = ft_color, guibg = "none" }
|
||||
end
|
||||
|
||||
local function get_file_path()
|
||||
local path_display = ""
|
||||
if fullpath == "" then
|
||||
path_display = filename
|
||||
else
|
||||
local parts = {}
|
||||
for part in string.gmatch(vim.fn.fnamemodify(fullpath, ":.:h"), "[^/]+") do
|
||||
table.insert(parts, part)
|
||||
end
|
||||
|
||||
local ellipsis = "…"
|
||||
local max_path_parts = 2
|
||||
if #parts > max_path_parts then
|
||||
local start_index = #parts - max_path_parts + 1
|
||||
path_display = ellipsis .. "/" .. table.concat(parts, "/", start_index)
|
||||
elseif #parts > 0 then
|
||||
path_display = table.concat(parts, "/")
|
||||
end
|
||||
|
||||
if path_display ~= "" then
|
||||
path_display = path_display .. "/" .. filename
|
||||
else
|
||||
path_display = filename
|
||||
end
|
||||
end
|
||||
|
||||
return { path_display .. " ┊", gui = vim.bo[props.buf].modified and "bold,italic" or "bold" }
|
||||
end
|
||||
|
||||
local function get_git_diff()
|
||||
local icons = { removed = "", changed = "", added = "" }
|
||||
local signs = vim.b[props.buf].gitsigns_status_dict
|
||||
local labels = {}
|
||||
if signs == nil then
|
||||
return labels
|
||||
end
|
||||
for name, icon in pairs(icons) do
|
||||
if tonumber(signs[name]) and signs[name] > 0 then
|
||||
table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name })
|
||||
end
|
||||
end
|
||||
if #labels > 0 then
|
||||
table.insert(labels, { "┊ " })
|
||||
end
|
||||
return labels
|
||||
end
|
||||
|
||||
local function get_diagnostic_label()
|
||||
local icons = { error = "", warn = "", info = "", hint = "" }
|
||||
local label = {}
|
||||
|
||||
for severity, icon in pairs(icons) do
|
||||
local n = #vim.diagnostic.get(props.buf,
|
||||
{ severity = vim.diagnostic.severity[string.upper(severity)] })
|
||||
if n > 0 then
|
||||
table.insert(label, { icon .. " " .. n .. " ", group = "DiagnosticSign" .. severity })
|
||||
end
|
||||
end
|
||||
if #label > 0 then
|
||||
table.insert(label, { "┊ " })
|
||||
end
|
||||
return label
|
||||
end
|
||||
|
||||
return {
|
||||
{ " " },
|
||||
{ get_diagnostic_label() },
|
||||
{ get_git_diff() },
|
||||
{ get_ft_icon() },
|
||||
{ get_file_path() },
|
||||
{ " " }
|
||||
}
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
utils.create_user_event_cb("ColorsyncThemeChanged", setup_incline, "ColorsyncEvents")
|
||||
setup_incline()
|
||||
end
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua",
|
||||
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" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
"saghen/blink.cmp",
|
||||
opts = {
|
||||
sources = {
|
||||
-- add lazydev to your completion providers
|
||||
default = { "lazydev", "lsp", "path", "snippets", "buffer" },
|
||||
providers = {
|
||||
lazydev = {
|
||||
name = "LazyDev",
|
||||
module = "lazydev.integrations.blink",
|
||||
-- make lazydev completions top priority (see `:h blink.cmp`)
|
||||
score_offset = 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
return {
|
||||
"saecki/live-rename.nvim",
|
||||
opts = {
|
||||
-- Send a `textDocument/prepareRename` request to the server to
|
||||
-- determine the word to be renamed, can be slow on some servers.
|
||||
-- Otherwise fallback to using `<cword>`.
|
||||
prepare_rename = true,
|
||||
--- The timeout for the `textDocument/prepareRename` request and final
|
||||
--- `textDocument/rename` request when submitting.
|
||||
request_timeout = 1500,
|
||||
-- Make an initial `textDocument/rename` request to gather other
|
||||
-- occurences which are edited and use these ranges to preview.
|
||||
-- If disabled only the word under the cursor will have a preview.
|
||||
show_other_ocurrences = true,
|
||||
-- Try to infer patterns from the initial `textDocument/rename` request
|
||||
-- and use these to show hopefully better edit previews.
|
||||
use_patterns = true,
|
||||
-- The register which is used to temporarily record a macro into. This
|
||||
-- macro can then be executed on other symbols using the `macrorepeat`
|
||||
-- rename option.
|
||||
scratch_register = "l",
|
||||
keys = {
|
||||
submit = {
|
||||
{ "n", "<cr>" },
|
||||
{ "v", "<cr>" },
|
||||
{ "i", "<cr>" },
|
||||
},
|
||||
cancel = {
|
||||
{ "n", "<esc>" },
|
||||
{ "n", "q" },
|
||||
},
|
||||
},
|
||||
hl = {
|
||||
current = "CurSearch",
|
||||
others = "Search",
|
||||
},
|
||||
}
|
||||
,
|
||||
keys = {
|
||||
{ "<leader>r", function()
|
||||
require("live-rename").rename({ cursorpos = 0 })
|
||||
end },
|
||||
},
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
local utils = require("utils")
|
||||
|
||||
local function resize_mode()
|
||||
if require("window_management").is_in_resizing_mode() then
|
||||
return "▲ Resizing ▼ "
|
||||
else
|
||||
return " "
|
||||
end
|
||||
end
|
||||
|
||||
local tabs = {
|
||||
"tabs",
|
||||
use_mode_colors = true,
|
||||
tabs_color = {
|
||||
active = "lualine_b_command",
|
||||
},
|
||||
show_modified_status = false,
|
||||
component_separators = {
|
||||
left = "",
|
||||
right = ""
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
event = "VeryLazy",
|
||||
lazy = true,
|
||||
config = function()
|
||||
local function setup_lualine()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = require("norrsken.integrations.lualine"),
|
||||
globalstatus = true,
|
||||
section_separators = {
|
||||
left = "",
|
||||
right = "",
|
||||
},
|
||||
component_separators = {
|
||||
left = "",
|
||||
right = ""
|
||||
},
|
||||
icons_enabled = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = {
|
||||
"branch",
|
||||
{
|
||||
"diagnostics",
|
||||
sources = { "nvim_lsp" },
|
||||
sections = { "error", "warn", "info", "hint" },
|
||||
update_in_insert = false,
|
||||
},
|
||||
resize_mode,
|
||||
},
|
||||
lualine_c = { tabs },
|
||||
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
})
|
||||
end
|
||||
|
||||
utils.create_user_event_cb("ColorsyncThemeChanged", setup_lualine, "ColorsyncEvents")
|
||||
setup_lualine()
|
||||
end
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
return {
|
||||
"OXY2DEV/markview.nvim",
|
||||
lazy = false,
|
||||
priority = 49,
|
||||
dependencies = {
|
||||
"saghen/blink.cmp"
|
||||
},
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
return {
|
||||
"NeogitOrg/neogit",
|
||||
event = "VeryLazy",
|
||||
lazy = true,
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader>v", function() require("neogit").open() end }
|
||||
},
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
return {
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
{ "MunifTanjim/nui.nvim", lazy = true },
|
||||
},
|
||||
opts = {
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
},
|
||||
signature = {
|
||||
auto_open = true,
|
||||
opts = {
|
||||
position = {
|
||||
row = 2,
|
||||
col = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = false, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = true, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
notify = {
|
||||
level = "warn",
|
||||
},
|
||||
views = {
|
||||
cmdline_popup = {
|
||||
border = {
|
||||
style = "single",
|
||||
padding = { 0, 0 },
|
||||
},
|
||||
},
|
||||
cmdline_popupmenu = {
|
||||
border = {
|
||||
style = "single",
|
||||
padding = { 0, 0 },
|
||||
},
|
||||
},
|
||||
hover = {
|
||||
border = {
|
||||
style = "single",
|
||||
},
|
||||
},
|
||||
confirm = {
|
||||
border = {
|
||||
style = "single",
|
||||
},
|
||||
},
|
||||
popup = {
|
||||
border = {
|
||||
style = "single",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
return {
|
||||
"LarssonMartin1998/nvim-norrsken",
|
||||
priority = 1010,
|
||||
opts = {
|
||||
integrations = {
|
||||
lualine = true,
|
||||
blink = true,
|
||||
noice = true,
|
||||
incline = true,
|
||||
neogit = true,
|
||||
tiny_inline_diagnostics = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
local utils = require("utils")
|
||||
local inlay_hints_handler = require("inlay_hints_handler")
|
||||
|
||||
local is_debug_mode_active = false
|
||||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
opts = {
|
||||
controls = {
|
||||
enabled = false,
|
||||
},
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{
|
||||
id = "watches",
|
||||
size = 0.5
|
||||
},
|
||||
{
|
||||
id = "stacks",
|
||||
size = 0.5
|
||||
}
|
||||
},
|
||||
position = "bottom",
|
||||
size = 15
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
-- Special adapters
|
||||
{ "leoluz/nvim-dap-go", opts = {} },
|
||||
|
||||
{ "nvim-neotest/nvim-nio", lazy = true },
|
||||
{ "LiadOz/nvim-dap-repl-highlights", opts = {} },
|
||||
{ "theHamsta/nvim-dap-virtual-text", opts = {} },
|
||||
{ "Weissle/persistent-breakpoints.nvim", opts = { load_breakpoints_event = { "BufReadPost" } } },
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
|
||||
local virtual_text = require("nvim-dap-virtual-text/virtual_text")
|
||||
local breakpoint_api = require("persistent-breakpoints.api")
|
||||
|
||||
local stepping_keymaps = {
|
||||
{ "<F10>", function() dap.step_over() end },
|
||||
{ "<F11>", function() dap.step_into() end },
|
||||
{ "<F12>", function() dap.step_out() end },
|
||||
{
|
||||
"<leader>dc",
|
||||
function()
|
||||
local columns = vim.o.columns
|
||||
local lines = vim.o.lines
|
||||
|
||||
require("dapui").float_element("console", {
|
||||
enter = true,
|
||||
title = "output",
|
||||
border = "rounded",
|
||||
position = "center",
|
||||
width = math.floor(columns * 0.8),
|
||||
height = math.floor(lines * 0.6),
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
||||
local dap_signs = {
|
||||
{ "DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" } },
|
||||
{ "DapBreakpointRejected", { text = "🔵", texthl = "", linehl = "", numhl = "" } },
|
||||
{ "DapBreakpointCondition", { text = "🟥", texthl = "", linehl = "", numhl = "" } },
|
||||
}
|
||||
|
||||
for _, sign in ipairs(dap_signs) do
|
||||
vim.fn.sign_define(unpack(sign))
|
||||
end
|
||||
|
||||
local function enter_debug_mode()
|
||||
if is_debug_mode_active then
|
||||
return
|
||||
end
|
||||
|
||||
utils.set_keymap_list(stepping_keymaps)
|
||||
is_debug_mode_active = true
|
||||
|
||||
inlay_hints_handler.disable()
|
||||
require("dapui").open()
|
||||
end
|
||||
|
||||
local function exit_debug_mode()
|
||||
if not is_debug_mode_active then
|
||||
return
|
||||
end
|
||||
|
||||
utils.del_keymap_list(stepping_keymaps)
|
||||
is_debug_mode_active = false
|
||||
|
||||
inlay_hints_handler.restore()
|
||||
virtual_text.clear_virtual_text()
|
||||
require("dapui").close()
|
||||
end
|
||||
|
||||
for _, request in ipairs({
|
||||
{ "attach", enter_debug_mode },
|
||||
{ "launch", enter_debug_mode },
|
||||
}) do
|
||||
dap.listeners.before[request[1]]["dapui_config"] = request[2]
|
||||
end
|
||||
|
||||
for _, event in ipairs({
|
||||
{ "event_terminated", exit_debug_mode },
|
||||
{ "event_exited", exit_debug_mode },
|
||||
}) do
|
||||
dap.listeners.after[event[1]]["dapui_config"] = event[2]
|
||||
end
|
||||
|
||||
local function dap_stop()
|
||||
dap.terminate()
|
||||
dap.close()
|
||||
exit_debug_mode()
|
||||
end
|
||||
|
||||
utils.set_keymap_list({
|
||||
{ "<leader>dr", dap.continue },
|
||||
{ "<leader>bt", breakpoint_api.toggle_breakpoint },
|
||||
{ "<leader>bc", breakpoint_api.set_conditional_breakpoint },
|
||||
{ "<leader>br", breakpoint_api.clear_all_breakpoints },
|
||||
{ "<leader>ds", dap_stop },
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
return {
|
||||
"kosayoda/nvim-lightbulb",
|
||||
opts = {
|
||||
hide_in_unfocused_buffer = true,
|
||||
code_lenses = true,
|
||||
sign = { enabled = true, },
|
||||
virtual_text = { enabled = false, },
|
||||
float = { enabled = false, },
|
||||
status_text = { enabled = false, },
|
||||
autocmd = { enabled = true, updatetime = 25, },
|
||||
},
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
"folke/persistence.nvim",
|
||||
event = "BufReadPre", -- this will only start session saving when an actual file was opened
|
||||
opts = {}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
"nvim-lua/plenary.nvim",
|
||||
branch = "master",
|
||||
lazy = true,
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
return {
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^5",
|
||||
ft = { "rust" },
|
||||
config = function()
|
||||
vim.g.rustaceanvim = {
|
||||
inlay_hints = {
|
||||
highlight = "NonText",
|
||||
},
|
||||
tools = {
|
||||
hover_actions = {
|
||||
auto_focus = true,
|
||||
replace_builtin_hover = true,
|
||||
},
|
||||
},
|
||||
server = {
|
||||
on_attach = require("lsplib").configure_generic_client,
|
||||
default_settings = {
|
||||
["rust-analyzer"] = {
|
||||
inlayHints = {
|
||||
chainingHints = true,
|
||||
parameterHints = true,
|
||||
typeHints = true,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
experimental = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
return {
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
opts = {
|
||||
styles = {
|
||||
notification = { border = "single", },
|
||||
notification_history = { border = "single", },
|
||||
blame_line = { border = "single", },
|
||||
input = { border = "single", },
|
||||
scratch = { border = "single", },
|
||||
snacks_image = { border = "single", },
|
||||
},
|
||||
gitbrowse = {
|
||||
enabled = true,
|
||||
what = "branch",
|
||||
},
|
||||
picker = {
|
||||
enabled = true,
|
||||
ui_select = true,
|
||||
formatters = {
|
||||
filename_first = true,
|
||||
truncate = 40,
|
||||
filename_only = false,
|
||||
icon_width = 2,
|
||||
git_status_hl = true,
|
||||
},
|
||||
sources = {
|
||||
recent = {
|
||||
filter = {
|
||||
cwd = true,
|
||||
paths = {
|
||||
[vim.fn.stdpath("data")] = false,
|
||||
[vim.fn.stdpath("cache")] = false,
|
||||
[vim.fn.stdpath("state")] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
files = {
|
||||
hidden = true,
|
||||
}
|
||||
},
|
||||
win = {
|
||||
input = { border = "single", },
|
||||
list = { border = "single", },
|
||||
preview = { border = "single", },
|
||||
},
|
||||
layouts = {
|
||||
default = {
|
||||
layout = {
|
||||
backdrop = false,
|
||||
row = 1,
|
||||
width = 0.6,
|
||||
min_width = 80,
|
||||
height = 0.95,
|
||||
border = "none",
|
||||
box = "vertical",
|
||||
{
|
||||
box = "vertical",
|
||||
border = "single",
|
||||
title = "{title} {live} {flags}",
|
||||
title_pos = "center",
|
||||
{ win = "input", height = 1, border = "bottom" },
|
||||
{ win = "list", border = "none" },
|
||||
},
|
||||
{ win = "preview", title = "{preview}", height = 0.65, border = "single" },
|
||||
},
|
||||
},
|
||||
select = {
|
||||
preview = false,
|
||||
layout = {
|
||||
backdrop = false,
|
||||
width = 0.5,
|
||||
min_width = 80,
|
||||
height = 0.4,
|
||||
min_height = 3,
|
||||
box = "vertical",
|
||||
border = "single",
|
||||
title = "{title}",
|
||||
title_pos = "center",
|
||||
{ win = "input", height = 1, border = "bottom" },
|
||||
{ win = "list", border = "none" },
|
||||
{ win = "preview", title = "{preview}", height = 0.4, border = "top" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
dashboard = {
|
||||
enabled = true,
|
||||
preset = {
|
||||
keys = {
|
||||
{ icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" },
|
||||
{ icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" },
|
||||
{ icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" },
|
||||
{ icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" },
|
||||
{ icon = " ", key = "s", desc = "Restore Session", section = "session" },
|
||||
{ icon = " ", key = "L", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil },
|
||||
{ icon = " ", key = "q", desc = "Quit", action = ":qa" },
|
||||
},
|
||||
},
|
||||
},
|
||||
debug = { enabled = true, },
|
||||
indent = {
|
||||
enabled = true,
|
||||
animate = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
input = { enabled = true, },
|
||||
notifier = {
|
||||
enabled = true,
|
||||
padding = false,
|
||||
},
|
||||
quickfile = { enabled = true, },
|
||||
scroll = {
|
||||
enabled = false,
|
||||
animate = {
|
||||
duration = { step = 5, total = 500 },
|
||||
easing = "outCirc",
|
||||
},
|
||||
animate_repeat = {
|
||||
delay = 100,
|
||||
duration = { step = 3, total = 50 },
|
||||
easing = "outCirc",
|
||||
},
|
||||
},
|
||||
words = {
|
||||
enabled = true,
|
||||
debounce = 100,
|
||||
},
|
||||
zen = {
|
||||
enabled = false,
|
||||
toggles = { dim = false, },
|
||||
on_open = function()
|
||||
_G["snacks_zen_mode"] = true
|
||||
end,
|
||||
on_close = function()
|
||||
_G["snacks_zen_mode"] = false
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "gB", function() Snacks.gitbrowse() end, },
|
||||
|
||||
{ "<leader>z", function() Snacks.zen() end, },
|
||||
|
||||
{ "<leader>g", function() Snacks.picker.grep() end, },
|
||||
{ "<leader>b", function() Snacks.picker.buffers() end, },
|
||||
{ "<leader>l", function() Snacks.picker.git_log_file() end, },
|
||||
{ "<leader>o", function() Snacks.picker.lsp_workspace_symbols() end, },
|
||||
{ "<leader>s", function() Snacks.picker.lsp_symbols() end, },
|
||||
{ "<leader>n", function() Snacks.picker.notifications({ win = { preview = { wo = { wrap = true } } } }) end },
|
||||
{ "<leader>d", function() Snacks.picker.diagnostics({ win = { preview = { wo = { wrap = true } } } }) end },
|
||||
|
||||
{ "<leader>e", function() Snacks.rename.rename_file({}) end },
|
||||
|
||||
{ "gd", function() Snacks.picker.lsp_definitions() end, },
|
||||
{ "gD", function() Snacks.picker.lsp_declarations() end, },
|
||||
{ "gr", function() Snacks.picker.lsp_references() end, nowait = true, },
|
||||
{ "gi", function() Snacks.picker.lsp_implementations() end, },
|
||||
{ "gt", function() Snacks.picker.lsp_type_definitions() end, },
|
||||
},
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "VeryLazy",
|
||||
callback = function()
|
||||
_G.inspect = function(...)
|
||||
Snacks.debug.inspect(...)
|
||||
end
|
||||
_G.backtrace = function()
|
||||
Snacks.debug.backtrace()
|
||||
end
|
||||
vim.print = _G.inspect
|
||||
end,
|
||||
})
|
||||
end
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
return {
|
||||
"kylechui/nvim-surround",
|
||||
version = "*",
|
||||
event = "VeryLazy",
|
||||
lazy = true,
|
||||
opts = {
|
||||
-- Make sure that we never get whitespaces when adding surroundings
|
||||
surrounds = {
|
||||
["("] = { add = { "(", ")" }, },
|
||||
["{"] = { add = { "{", "}" }, },
|
||||
["<"] = { add = { "<", ">" }, },
|
||||
["["] = { add = { "[", "]" }, },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
return {
|
||||
"rachartier/tiny-glimmer.nvim",
|
||||
opts = {
|
||||
refresh_interval_ms = 6,
|
||||
overwrite = {
|
||||
auto_map = true,
|
||||
paste = {
|
||||
enabled = true,
|
||||
default_animation = {
|
||||
name = "fade",
|
||||
settings = {
|
||||
from_color = "DiffText",
|
||||
},
|
||||
},
|
||||
},
|
||||
undo = {
|
||||
enabled = true,
|
||||
default_animation = {
|
||||
name = "fade",
|
||||
settings = {
|
||||
from_color = "DiffDelete",
|
||||
},
|
||||
},
|
||||
},
|
||||
redo = {
|
||||
enabled = true,
|
||||
default_animation = {
|
||||
name = "fade",
|
||||
settings = {
|
||||
from_color = "DiffAdd",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
animations = {
|
||||
fade = {
|
||||
chars_for_max_duration = 1,
|
||||
to_color = "Folded"
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
return {
|
||||
"rachartier/tiny-inline-diagnostic.nvim",
|
||||
event = "VeryLazy",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("tiny-inline-diagnostic").setup({
|
||||
preset = "modern",
|
||||
transparent_bg = false,
|
||||
transparent_cursorline = false,
|
||||
options = {
|
||||
multilines = {
|
||||
enabled = true,
|
||||
always_show = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.diagnostic.config({ virtual_text = false })
|
||||
end
|
||||
}
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
local function ts_select(query)
|
||||
return function() require("nvim-treesitter-textobjects.select").select_textobject(query, "textobjects") end
|
||||
end
|
||||
|
||||
local function ts_move_prev(query)
|
||||
return function() require("nvim-treesitter-textobjects.move").goto_previous_start(query, "textobjects") end
|
||||
end
|
||||
|
||||
local function ts_move_next(query)
|
||||
return function() require("nvim-treesitter-textobjects.move").goto_next_start(query, "textobjects") end
|
||||
end
|
||||
|
||||
-- TODO: Move away from master branch after updating to Neovim 0.12 and use the rewrite
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
branch = "master",
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
opts = {
|
||||
max_lines = 2, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
multiline_threshold = 3, -- Maximum number of lines to show for a single context
|
||||
trim_scope = "inner", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
}
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
branch = "main",
|
||||
init = function()
|
||||
-- Disable entire built-in ftplugin mappings to avoid conflicts.
|
||||
-- See https://github.com/neovim/neovim/tree/master/runtime/ftplugin for built-in ftplugins.
|
||||
vim.g.no_plugin_maps = true
|
||||
end,
|
||||
opts = {
|
||||
select = {
|
||||
lookahead = true,
|
||||
},
|
||||
move = {
|
||||
set_jumps = true,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
-- select
|
||||
{ "ic", ts_select("@class.inner"), mode = { "x", "o" } },
|
||||
{ "ac", ts_select("@class.outer"), mode = { "x", "o" } },
|
||||
{ "ii", ts_select("@conditional.inner"), mode = { "x", "o" } },
|
||||
{ "ai", ts_select("@conditional.outer"), mode = { "x", "o" } },
|
||||
{ "if", ts_select("@function.inner"), mode = { "x", "o" } },
|
||||
{ "af", ts_select("@function.outer"), mode = { "x", "o" } },
|
||||
{ "il", ts_select("@loop.inner"), mode = { "x", "o" } },
|
||||
{ "al", ts_select("@loop.outer"), mode = { "x", "o" } },
|
||||
{ "ia", ts_select("@attribute.inner"), mode = { "x", "o" } },
|
||||
{ "aa", ts_select("@attribute.outer"), mode = { "x", "o" } },
|
||||
-- move
|
||||
{ "[f", ts_move_prev("@function.outer"), mode = { "n", "x", "o" } },
|
||||
{ "[i", ts_move_prev("@conditional.outer"), mode = { "n", "x", "o" } },
|
||||
{ "[c", ts_move_prev("@class.outer"), mode = { "n", "x", "o" } },
|
||||
{ "[l", ts_move_prev("@loop.outer"), mode = { "n", "x", "o" } },
|
||||
{ "]f", ts_move_next("@function.outer"), mode = { "n", "x", "o" } },
|
||||
{ "]i", ts_move_next("@conditional.outer"), mode = { "n", "x", "o" } },
|
||||
{ "]c", ts_move_next("@class.outer"), mode = { "n", "x", "o" } },
|
||||
{ "]l", ts_move_next("@loop.outer"), mode = { "n", "x", "o" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"bash",
|
||||
"lua",
|
||||
"c",
|
||||
"cpp",
|
||||
"c_sharp",
|
||||
"rust",
|
||||
"cmake",
|
||||
"make",
|
||||
"yaml",
|
||||
"ninja",
|
||||
"gitignore",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"hyprlang",
|
||||
"json",
|
||||
"html",
|
||||
"hlsl",
|
||||
"glsl",
|
||||
"gdshader",
|
||||
"gdscript",
|
||||
"dockerfile",
|
||||
"dart",
|
||||
"go",
|
||||
"zig",
|
||||
"css",
|
||||
"regex",
|
||||
"dap_repl",
|
||||
"muttrc",
|
||||
"python",
|
||||
"latex",
|
||||
"typst",
|
||||
"ruby",
|
||||
"svelte",
|
||||
"typescript",
|
||||
"just",
|
||||
"tsx",
|
||||
"javascript",
|
||||
"jsonc",
|
||||
},
|
||||
sync_install = false,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = { enable = true },
|
||||
})
|
||||
end
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
return {
|
||||
"mcauley-penney/visual-whitespace.nvim",
|
||||
config = true,
|
||||
event = "ModeChanged *:[vV\22]",
|
||||
opts = {},
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
local utils = require("utils")
|
||||
local terminal_window = nil
|
||||
local terminal_bufnr = nil
|
||||
|
||||
local function open_terminal_window()
|
||||
local utils = require("utils")
|
||||
if terminal_bufnr and vim.api.nvim_buf_is_valid(terminal_bufnr) and utils.is_buf_buftype(terminal_bufnr, "terminal") then
|
||||
if terminal_bufnr and vim.api.nvim_buf_is_valid(terminal_bufnr) and vim.bo[terminal_bufnr].buftype == "terminal" then
|
||||
vim.cmd("botright split")
|
||||
terminal_window = vim.api.nvim_get_current_win()
|
||||
vim.api.nvim_win_set_buf(terminal_window, terminal_bufnr)
|
||||
|
|
@ -21,7 +21,6 @@ local function toggle_terminal()
|
|||
return
|
||||
end
|
||||
|
||||
local utils = require("utils")
|
||||
open_terminal_window()
|
||||
|
||||
local term_height = vim.api.nvim_get_option_value("lines", {})
|
||||
|
|
|
|||
|
|
@ -1,34 +1,16 @@
|
|||
local M = {}
|
||||
|
||||
M.colorsync_theme = nil
|
||||
|
||||
function M.set_keymap_list(keymap_list, mode)
|
||||
mode = mode or "n"
|
||||
M.foreach(keymap_list, function(mapping)
|
||||
for _, mapping in ipairs(keymap_list) do
|
||||
vim.keymap.set(mode, mapping[1], mapping[2], mapping[3] or {})
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function M.del_keymap_list(keymap_list, mode)
|
||||
mode = mode or "n"
|
||||
M.foreach(keymap_list, function(mapping)
|
||||
for _, mapping in ipairs(keymap_list) do
|
||||
vim.keymap.del(mode, mapping[1])
|
||||
end)
|
||||
end
|
||||
|
||||
function M.get_file_names_in_dir(dir, expr, strip_extension)
|
||||
local path = vim.fn.stdpath("config") .. "/lua/" .. dir
|
||||
local files_str = vim.fn.globpath(path, expr, true)
|
||||
local has_line_breaks = vim.fn.match(files_str, [[\n]]) > -1
|
||||
local files = has_line_breaks and vim.fn.split(files_str, "\n") or { files_str }
|
||||
|
||||
local should_strip_extension = strip_extension or false
|
||||
if should_strip_extension then
|
||||
return vim.tbl_map(function(file)
|
||||
return vim.fn.fnamemodify(file, ":t:r")
|
||||
end, files)
|
||||
else
|
||||
return files
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -37,61 +19,6 @@ function M.validate_bufnr(bufnr)
|
|||
return bufnr == 0 and vim.api.nvim_get_current_buf() or bufnr
|
||||
end
|
||||
|
||||
function M.xpcallmsg(fn, err_msg, err_container)
|
||||
return xpcall(fn, function(err)
|
||||
if err_container then
|
||||
table.insert(err_container, err_msg .. ": " .. err)
|
||||
else
|
||||
error(err_msg .. ": " .. err)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function M.foreach(t, f)
|
||||
for _, v in pairs(t) do
|
||||
f(v)
|
||||
end
|
||||
end
|
||||
|
||||
function M.create_user_event_cb(event_name, function_callback, augroup)
|
||||
assert(event_name and event_name ~= "", "Event name must be provided")
|
||||
assert(function_callback and type(function_callback) == "function", "Callback must be a valid function")
|
||||
|
||||
local cmd = {
|
||||
callback = function_callback,
|
||||
pattern = event_name,
|
||||
}
|
||||
|
||||
if augroup then
|
||||
cmd.group = augroup
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("User", cmd)
|
||||
end
|
||||
|
||||
function M.broadcast_event(event_name)
|
||||
vim.api.nvim_command("doautocmd <nomodeline> User " .. event_name)
|
||||
end
|
||||
|
||||
function M.add_opts_to_all_mappings(mappings, opts)
|
||||
assert(opts and mappings)
|
||||
|
||||
for _, modes in pairs(mappings) do
|
||||
for _, mapping in pairs(modes) do
|
||||
local existing_opts = mapping.opts or {}
|
||||
mapping.opts = vim.tbl_extend("force", existing_opts, opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.is_buf_filetype(bufnr, filetype)
|
||||
return vim.api.nvim_get_option_value("filetype", { buf = bufnr }) == filetype
|
||||
end
|
||||
|
||||
function M.is_buf_buftype(bufnr, buftype)
|
||||
return vim.api.nvim_get_option_value("buftype", { buf = bufnr }) == buftype
|
||||
end
|
||||
|
||||
function M.lock_buf_to_window(win_id, bufnr, filetype)
|
||||
local augroup_id = vim.api.nvim_create_augroup("LockWindow" .. win_id, { clear = true })
|
||||
|
||||
|
|
@ -108,7 +35,7 @@ function M.lock_buf_to_window(win_id, bufnr, filetype)
|
|||
return
|
||||
end
|
||||
|
||||
if M.is_buf_filetype(current_buf, filetype) then
|
||||
if vim.bo[current_buf].filetype == filetype then
|
||||
bufnr = current_buf
|
||||
return
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,14 +10,11 @@ opt.clipboard = "unnamedplus"
|
|||
|
||||
-- Highlight the currently selected row
|
||||
opt.cursorline = true
|
||||
opt.cursorlineopt = "both"
|
||||
opt.cursorlineopt = "line"
|
||||
|
||||
opt.breakindent = true
|
||||
opt.breakindentopt = "list:-1"
|
||||
|
||||
-- Disable home screen
|
||||
opt.shortmess:append("sI")
|
||||
|
||||
-- Signcolumn
|
||||
opt.signcolumn = "yes:2" -- Adds a spacing to the left which can contain gutter icons
|
||||
opt.fillchars = { eob = " " } -- Remove the fill character for empty lines which defaults to: "~"
|
||||
|
|
@ -49,7 +46,7 @@ opt.swapfile = false
|
|||
opt.splitright = true
|
||||
opt.splitbelow = true
|
||||
|
||||
-- Removes the extra command line bar at the bottom, using lualine instead
|
||||
-- Hide the cmdline bar when not in use; UI2 shows a float when needed
|
||||
opt.cmdheight = 0
|
||||
|
||||
-- Statusline
|
||||
|
|
@ -68,10 +65,6 @@ opt.list = false
|
|||
-- Sessions
|
||||
opt.sessionoptions = { "buffers", "curdir", "winsize", "winpos", "tabpages", "skiprtp" }
|
||||
|
||||
-- Builtin LSP completion tweaks
|
||||
-- See comment in lspsetup autocmd for LspAttach
|
||||
-- opt.completeopt = "menu,menuone,noselect,fuzzy"
|
||||
|
||||
opt.fileignorecase = true
|
||||
|
||||
-- This makes window sizing more controllable, with this set to true theyre always the same size.
|
||||
|
|
@ -85,7 +78,7 @@ opt.shiftround = true
|
|||
opt.redrawtime = 150
|
||||
|
||||
-- Disable lots of unnecessary warning notifications
|
||||
opt.shortmess = "acstFOSW"
|
||||
opt.shortmess = "acstFOSWI"
|
||||
|
||||
-- Allows to select one more after EOL
|
||||
opt.virtualedit = "onemore"
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ end
|
|||
local function swap_window(dir_char)
|
||||
assert(dir_char == "h" or dir_char == "j" or dir_char == "k" or dir_char == "l", "Invalid direction character")
|
||||
|
||||
local function can_swap_window(window)
|
||||
local function should_skip_swap(window)
|
||||
if not window then
|
||||
return true
|
||||
end
|
||||
|
|
@ -95,7 +95,7 @@ local function swap_window(dir_char)
|
|||
end
|
||||
|
||||
local current_window = vim.api.nvim_get_current_win()
|
||||
if can_swap_window(current_window) then
|
||||
if should_skip_swap(current_window) then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ local function swap_window(dir_char)
|
|||
local adjacent_window = get_adjacent_window(dir_char)
|
||||
assert(adjacent_window ~= nil, "Invalid adjacent window from get_adjacent_window")
|
||||
|
||||
if can_swap_window(adjacent_window) then
|
||||
if should_skip_swap(adjacent_window) then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ local function exit_resizing_mode()
|
|||
assert(is_in_resizing_mode, "Not in resizing mode")
|
||||
|
||||
is_in_resizing_mode = false
|
||||
utils.broadcast_event(on_resize_mode_exit_event)
|
||||
vim.api.nvim_exec_autocmds("User", { pattern = on_resize_mode_exit_event, modeline = false })
|
||||
|
||||
assert(not is_in_resizing_mode, "Failed to exit resizing mode")
|
||||
end
|
||||
|
|
@ -240,7 +240,7 @@ local function enter_resizing_mode()
|
|||
end
|
||||
|
||||
is_in_resizing_mode = true
|
||||
utils.broadcast_event(on_resize_mode_enter_event)
|
||||
vim.api.nvim_exec_autocmds("User", { pattern = on_resize_mode_enter_event, modeline = false })
|
||||
|
||||
assert(is_in_resizing_mode, "Failed to enter resizing mode")
|
||||
end
|
||||
|
|
@ -297,8 +297,10 @@ function M.setup()
|
|||
|
||||
local window_management_augroup = "WindowManagementEvents"
|
||||
vim.api.nvim_create_augroup(window_management_augroup, { clear = true })
|
||||
utils.create_user_event_cb(on_resize_mode_enter_event, on_resize_mode_enter, window_management_augroup)
|
||||
utils.create_user_event_cb(on_resize_mode_exit_event, on_resize_mode_exit, window_management_augroup)
|
||||
vim.api.nvim_create_autocmd("User",
|
||||
{ pattern = on_resize_mode_enter_event, callback = on_resize_mode_enter, group = window_management_augroup })
|
||||
vim.api.nvim_create_autocmd("User",
|
||||
{ pattern = on_resize_mode_exit_event, callback = on_resize_mode_exit, group = window_management_augroup })
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue