more more more

This commit is contained in:
2025-07-13 18:58:27 -04:00
parent 101bc55f15
commit cace587a09
36 changed files with 610 additions and 1251 deletions

View File

@ -13,8 +13,8 @@ map("v", "<S-j>", ":m '>+1<CR>gv=gv", { desc = "Move selected text down." })
map("n", "<S-j>", "mzJ`z<cmd>delm z<CR>") -- when combining lines
map("n", "n", "nzzzv") -- when searching
map("n", "N", "Nzzzv")
map("n", "<C-d>", "<C-d>zzzv") -- half page jumping
map("n", "<C-u>", "<C-u>zzzv")
map("n", "<C-d>", "<C-d>zz") -- half page jumping
map("n", "<C-u>", "<C-u>zz")
map({ "n", "i" }, "<C-c>", "<Esc>")

View File

@ -1,10 +1,11 @@
local auto = core.misc.auto
-- color stuff
if vim.fn.has("termguicolors") then
vim.opt.termguicolors = true
end
-- make .h files default to c code
vim.filetype.add({ extension = { h = "c", }, })
-- numbers
vim.opt.number = true
vim.opt.relativenumber = true
@ -61,27 +62,16 @@ vim.g.netrw_liststyle = 1
vim.g.netrw_sizestyle = "H"
vim.g.netrw_hide = 1
-- border (this doesn't actually do anything within vim, I"m just setting it
-- here so it"s easy to find)
-- border (this doesn't actually do anything within vim, I'm just setting it
-- here so it's easy to find)
vim.g.border_style = "solid"
do -- folding
auto("FileType", {
callback = function()
-- use treesitter for folding
if require("nvim-treesitter.parsers").has_parser() then
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
else
vim.opt.foldmethod = "syntax"
end
end
})
vim.opt.foldmethod = "syntax"
vim.opt.foldlevelstart = 99
vim.opt.foldlevel = 99
vim.opt.foldenable = true
vim.o.fillchars = "fold: "
vim.o.fillchars = "fold: ,eob: "
vim.opt.foldtext = "v:lua.core.folding()"
end
@ -166,6 +156,10 @@ do -- statusline
return hl..lil_guy..reset
end
-- this is my statusline:
--
-- opts.lua [+] o/ λ1 163,61-60 88%
--
return table.concat {
"%t", -- file name
" %h", -- help buffer tag

View File

@ -1,10 +1,11 @@
return { "Saghen/blink.cmp",
branch = "v1.2.0",
requires = {
branch = "v1.*",
reqs = {
"xzbdmw/colorful-menu.nvim",
"L3MON4D3/LuaSnip"
},
function()
lazy = dep_short.auto("InsertEnter"),
load = function()
local colormenu = require("colorful-menu")
require("blink.cmp").setup {
keymap = {

View File

@ -1,5 +1,5 @@
return { "numToStr/Comment.nvim",
function()
load = function()
require("Comment").setup {
ignore = "^$"
}

View File

@ -1,7 +0,0 @@
return { "mfussenegger/nvim-dap-python",
requires = "mfussenegger/nvim-dap",
function()
local debugpy = core.mason.get_pkg_path("debugpy", "/venv/bin/python3")
require("dap-python").setup(debugpy)
end
}

View File

@ -1,27 +0,0 @@
return { "theHamsta/nvim-dap-virtual-text",
requires = {
"nvim-treesitter/nvim-treesitter",
"mfussenegger/nvim-dap"
},
function()
require("nvim-dap-virtual-text").setup {
virt_text_pos = vim.fn.has("nvim-0.10") == 1 and "inline" or "eol",
--- A callback that determines how a variable is displayed or whether it should be omitted
--- @param variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable
--- @param buf number
--- @param stackframe dap.StackFrame https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame
--- @param node userdata tree-sitter node identified as variable definition of reference (see `:h tsnode`)
--- @param options nvim_dap_virtual_text_options Current options for nvim-dap-virtual-text
--- @return string|nil A text how the virtual text should be displayed or nil, if this variable shouldn't be displayed
display_callback = function(variable, buf, stackframe, node, options)
-- by default, strip out new line characters
if options.virt_text_pos == "inline" then
return " = "..variable.value:gsub("%s+", " ")
else
return variable.name.." = "..variable.value:gsub("%s+", " ")
end
end
}
end
}

View File

@ -4,16 +4,19 @@ local keymap_restore = {}
--- make the default hover binding work for nvim-dap instead of lsp
local function set_hover_bind()
for _, buf in pairs(vim.api.nvim_list_bufs()) do
local keymaps = vim.api.nvim_buf_get_keymap(buf, 'n')
local keymaps = vim.api.nvim_buf_get_keymap(buf, "n")
for _, keymap in pairs(keymaps) do
if keymap.lhs == "K" then
table.insert(keymap_restore, keymap)
vim.api.nvim_buf_del_keymap(buf, 'n', 'K')
vim.api.nvim_buf_del_keymap(buf, "n", "K")
end
end
end
vim.keymap.set('n', 'K', require("dap.ui.widgets").hover,
{ silent = true })
map("n", "K", function()
require("dap.ui.widgets").hover(nil, {
border = vim.g.border_style
})
end, { silent = true })
end
--- revert the hover bind back to whatever it was
@ -30,59 +33,110 @@ local function unset_hover_bind()
keymap_restore = {}
end
return { "mfussenegger/nvim-dap",
requires = {
"mason-org/mason.nvim",
"nvim-telescope/telescope.nvim"
},
disable = not vim.fn.has("nvim-0.9.5"),
branch = "0.10.0",
function()
local dap = require("dap")
return {
{ "mfussenegger/nvim-dap",
reqs = {
"mason-org/mason.nvim",
"nvim-telescope/telescope.nvim"
},
deps = "theHamsta/nvim-dap-virtual-text",
disable = not vim.fn.has("nvim-0.9.5"),
branch = "0.10.0",
lazy = function(load)
load:keymap("n", "<leader>ec")
load:keymap("n", "<leader>el")
load:keymap("n", "<leader>et")
load:keymap("n", "<leader>eb")
load:keymap("n", "<leader>e]")
load:keymap("n", "<leader>e[")
load:keymap("n", "<leader>er")
load:keymap("n", "<leader>eR")
end,
load = function()
local dap = require("dap")
-- define codelldb
dap.adapters.codelldb = {
type = "executable",
command = "codelldb"
}
-- define the c configuration for codelldb
dap.configurations.c = {
{
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
-- define codelldb
dap.adapters.codelldb = {
type = "executable",
command = "codelldb"
}
}
-- and define them for cpp, zig, and rust
dap.configurations.cpp = dap.configurations.c
dap.configurations.zig = dap.configurations.c
dap.configurations.rust = dap.configurations.c
-- define the c configuration for codelldb
dap.configurations.c = {
{
name = "Launch file",
type = "codelldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd().."/", "file")
end,
-- keybinds
map("n", "<leader>ec", dap.continue, { desc = "dap continue" })
map("n", "<leader>el", dap.run_last, { desc = "dap run last" })
map("n", "<leader>et", function()
dap.terminate()
unset_hover_bind()
end, { desc = "dap terminate " })
map("n", "<leader>eb", require("dap.breakpoints").toggle, {
desc = "dap toggle breakpoint"
})
map("n", "<leader>e]", dap.step_over, { desc = "dap step over" })
map("n", "<leader>e[", dap.step_back, { desc = "dap step back" })
map("n", "<leader>er", dap.repl.toggle, { desc = "dap repl toggle" })
map("n", "<leader>eR", dap.restart, { desc = "dap restart" })
cwd = "${workspaceFolder}",
stopOnEntry = false
}
}
-- events
dap.listeners.after['event_initialized']['me'] = set_hover_bind
dap.listeners.after['event_terminated']['me'] = unset_hover_bind
end
-- and define them for cpp, zig, and rust
dap.configurations.cpp = dap.configurations.c
dap.configurations.zig = dap.configurations.c
dap.configurations.rust = dap.configurations.c
-- keybinds
map("n", "<leader>ec", dap.continue, { desc = "dap continue" })
map("n", "<leader>el", dap.run_last, { desc = "dap run last" })
map("n", "<leader>et", function()
dap.terminate()
unset_hover_bind()
end, { desc = "dap terminate " })
map("n", "<leader>eb", require("dap.breakpoints").toggle, {
desc = "dap toggle breakpoint"
})
map("n", "<leader>e]", dap.step_over, { desc = "dap step over" })
map("n", "<leader>e[", dap.step_back, { desc = "dap step back" })
map("n", "<leader>er", dap.repl.toggle, { desc = "dap repl toggle" })
map("n", "<leader>eR", dap.restart, { desc = "dap restart" })
-- events
dap.listeners.after["event_initialized"]["me"] = set_hover_bind
dap.listeners.after["event_terminated"]["me"] = unset_hover_bind
end
},
{ "theHamsta/nvim-dap-virtual-text",
reqs = {
"nvim-treesitter/nvim-treesitter",
"mfussenegger/nvim-dap"
},
lazy = dep_short.cmd("DapVirtualTextToggle"),
load = function()
require("nvim-dap-virtual-text").setup {
virt_text_pos = vim.fn.has("nvim-0.10") == 1 and "inline" or "eol",
--- A callback that determines how a variable is displayed or whether it should be omitted
--- @param variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable
--- @param buf number
--- @param stackframe dap.StackFrame https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame
--- @param node userdata tree-sitter node identified as variable definition of reference (see `:h tsnode`)
--- @param options nvim_dap_virtual_text_options Current options for nvim-dap-virtual-text
--- @return string|nil A text how the virtual text should be displayed or nil, if this variable shouldn't be displayed
display_callback = function(variable, buf, stackframe, node, options)
-- by default, strip out new line characters
if options.virt_text_pos == "inline" then
return " = "..variable.value:gsub("%s+", " ")
else
return variable.name.." = "..variable.value:gsub("%s+", " ")
end
end
}
end
},
{ "mfussenegger/nvim-dap-python",
reqs = "mfussenegger/nvim-dap",
lazy = dep_short.ft("python"),
load = function()
local debugpy = core.mason.get_pkg_path("debugpy", "/venv/bin/python3")
require("dap-python").setup(debugpy)
end
}
}

View File

@ -1,36 +0,0 @@
return { "j-hui/fidget.nvim",
disable = not vim.fn.has("nvim-0.9.0"),
branch = "v1.6.1",
function()
local notification_defaults = require("fidget.notification").default_config
notification_defaults["icon"] = ""
require("fidget").setup {
progress = {
display = {
progress_icon = {
pattern = "line",
period = 1
},
done_icon = ":)"
}
},
notification = {
filter = vim.log.levels.DEBUG,
override_vim_notify = true,
configs = {
default = notification_defaults
},
view = {
icon_separator = " ",
group_separator = "---",
group_separator_hl = "Comment"
},
window = {
zindex = 44,
relative = "editor"
}
}
}
end
}

View File

@ -2,7 +2,18 @@ local map = core.misc.map
return { "lewis6991/gitsigns.nvim",
disable = not vim.fn.has("nvim-0.9.0"),
function()
lazy = function(load)
load:auto({ "BufEnter", "BufNew" }, {
callback = function()
local paths = vim.fs.find({ ".git", }, { upward = true })
if #paths > 0 then
load:cleanup()
end
end
})
load:cmd("Gitsigns")
end,
load = function()
local gs = require("gitsigns")
gs.setup {

View File

@ -1,32 +0,0 @@
-- TODO: might end up writing my own because I like harpoon, but I hate that it
-- doesn't work properly without being pinned to a specific commit
local map = core.misc.map
return { "ThePrimeagen/harpoon",
disable = not vim.fn.has("nvim-0.8.0"),
commit = "e76cb03",
branch = "harpoon2",
requires = "nvim-lua/plenary.nvim",
function()
local harpoon = require("harpoon")
harpoon:setup()
map("n", "<leader>a", function()
harpoon:list():add()
vim.notify("added "..vim.fn.expand("%:t").." to quickmarks")
end, { desc = "add current file to quickmarks" })
map("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
map("n", "<C-h>", function() harpoon:list():select(1) end)
map("n", "<C-t>", function() harpoon:list():select(2) end)
map("n", "<C-n>", function() harpoon:list():select(3) end)
map("n", "<C-c>", function() harpoon:list():select(4) end)
-- Toggle previous & next buffers stored within Harpoon list
map("n", "<C-S-P>", function() harpoon:list():prev() end)
map("n", "<C-S-N>", function() harpoon:list():next() end)
end
}

View File

@ -1 +1,3 @@
return { "tweekmonster/helpful.vim" }
return { "tweekmonster/helpful.vim",
lazy = dep_short.cmd("HelpfulVersion")
}

View File

@ -1,5 +0,0 @@
return { "jbyuki/instant.nvim",
function()
vim.g.instant_username = "squibid"
end
}

View File

@ -1,4 +0,0 @@
return { "mfussenegger/nvim-jdtls",
disable = not vim.fn.has("nvim-0.6.0"),
requires = "mfussenegger/nvim-dap"
}

135
lua/conf/plugins/lsp.lua Normal file
View File

@ -0,0 +1,135 @@
local nonels_augroup = core.misc.augroup("nullls formatting")
return {
{ "neovim/nvim-lspconfig",
disable = not vim.fn.has("nvim-0.10.0"),
reqs = {
"mason-org/mason.nvim",
"mason-org/mason-lspconfig.nvim"
},
load = function()
core.lsp.setup()
require("mason-lspconfig").setup {
ensure_added = {
"clangd",
"mesonlsp",
"bashls",
"jdtls",
"lua_ls",
-- python
"basedpyright",
"mypy",
"black",
"debugpy"
}
}
end
},
{ "mason-org/mason.nvim",
disable = not vim.fn.has("nvim-0.7.0"),
load = function()
local mason = require("mason")
mason.setup {
ui = {
border = vim.g.border_style,
width = 0.8,
height = 0.9,
icons = {
package_installed = "+",
package_pending = "?",
package_uninstalled = "x"
}
},
keymaps = {
toggle_package_expand = "<CR>",
install_package = "i",
update_package = "u",
check_package_version = "c",
update_all_packages = "U",
check_outdated_packages = "C",
uninstall_package = "r",
cancel_installation = "<C-c>",
apply_language_filter = "<C-f>"
}
}
end
},
{ "j-hui/fidget.nvim",
disable = not vim.fn.has("nvim-0.9.0"),
branch = "v1.*",
lazy = dep_short.auto("LspAttach"),
load = function()
local notification_defaults = require("fidget.notification").default_config
notification_defaults["icon"] = ""
require("fidget").setup {
progress = {
display = {
progress_icon = {
pattern = "line",
period = 1
},
done_icon = ":)"
}
},
notification = {
filter = vim.log.levels.DEBUG,
override_vim_notify = true,
configs = {
default = notification_defaults
},
view = {
icon_separator = " ",
group_separator = "---",
group_separator_hl = "Comment"
},
window = {
zindex = 44,
relative = "editor"
}
}
}
end
},
{ "mfussenegger/nvim-jdtls",
disable = not vim.fn.has("nvim-0.6.0"),
reqs = "mfussenegger/nvim-dap",
lazy = dep_short.ft("java")
},
{ "nvimtools/none-ls.nvim",
lazy = dep_short.ft("python"),
load = function()
local null_ls = require("null-ls")
null_ls.setup {
sources = {
null_ls.builtins.formatting.black,
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = nonels_augroup,
buffer = bufnr
})
core.misc.auto("BufWritePre", {
group = nonels_augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end
})
end
end
}
end
}
}

View File

@ -1,26 +0,0 @@
return { "neovim/nvim-lspconfig",
disable = not vim.fn.has("nvim-0.10.0"),
requires = {
"mason-org/mason.nvim",
"mason-org/mason-lspconfig.nvim"
},
function()
core.lsp.setup()
require("mason-lspconfig").setup {
ensure_added = {
"clangd",
"mesonlsp",
"bashls",
"jdtls",
"lua_ls",
-- python
"basedpyright",
"mypy",
"black",
"debugpy"
}
}
end
}

View File

@ -1,12 +1,18 @@
local map, auto = core.misc.map, core.misc.auto
return { "L3MON4D3/LuaSnip",
branch = "v2.4.0",
branch = "v2.*",
disable = not vim.fn.has("nvim-0.7.0"),
config = function()
vim.cmd("make install_jsregexp")
end,
function()
lazy = function(load)
load:keymap("n", "<c-a>")
load:keymap("n", "<c-e>")
load:keymap("n", "<c-j>")
load:keymap("n", "<c-k>")
end,
load = function()
local luasnip = require("luasnip")
local types = require("luasnip.util.types")

View File

@ -1,31 +0,0 @@
return { "mason-org/mason.nvim",
disable = not vim.fn.has("nvim-0.7.0"),
function()
local mason = require("mason")
mason.setup {
ui = {
border = vim.g.border_style,
width = 0.8,
height = 0.9,
icons = {
package_installed = "+",
package_pending = "?",
package_uninstalled = "x"
}
},
keymaps = {
toggle_package_expand = "<CR>",
install_package = "i",
update_package = "u",
check_package_version = "c",
update_all_packages = "U",
check_outdated_packages = "C",
uninstall_package = "r",
cancel_installation = "<C-c>",
apply_language_filter = "<C-f>"
}
}
end
}

View File

@ -1,7 +1,7 @@
return { "mellow-theme/mellow.nvim",
disable = not vim.fn.has("nvim-0.8.0"),
requires = "nvim-treesitter/nvim-treesitter",
function()
reqs = "nvim-treesitter/nvim-treesitter",
load = function()
vim.g.mellow_variant = "dark"
local c = require("mellow.colors")[vim.g.mellow_variant]
@ -9,6 +9,9 @@ return { "mellow-theme/mellow.nvim",
-- stop inactive windows from having a darker bg
["NormalNC"] = { link = "Normal" },
-- make splits look cleaner
["WinSeparator"] = { link = "Normal" },
-- make floats darker
["NormalFloat"] = { fg = c.fg, bg = "#111111" },
["FloatBorder"] = { link = "NormalFloat" },

View File

@ -1,11 +1,12 @@
local map = core.misc.map
return { "danymat/neogen",
requires = {
reqs = {
"nvim-treesitter/nvim-treesitter",
"L3MON4D3/LuaSnip"
},
function()
lazy = dep_short.keymap("n", "<leader>d"),
load = function()
local neogen = require("neogen")
neogen.setup {
enabled = true,

View File

@ -1,30 +0,0 @@
local augroup = core.misc.augroup("nullls formatting")
return { "nvimtools/none-ls.nvim",
function()
local null_ls = require("null-ls")
null_ls.setup {
sources = {
null_ls.builtins.formatting.black,
null_ls.builtins.diagnostics.mypy
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = augroup,
buffer = bufnr
})
core.misc.auto("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end
})
end
end
}
end
}

View File

@ -1,6 +1,6 @@
return { "norcalli/nvim-colorizer.lua",
disable = not vim.fn.has("nvim-0.4.0") and not vim.fn.has("termguicolors"),
function()
load = function()
require("colorizer").setup(nil, {
names = false,
css = true

View File

@ -53,186 +53,190 @@ local permission_hlgroups = {
["x"] = "DiagnosticSignOk",
}
return { "stevearc/oil.nvim",
disable = not vim.fn.has("nvim-0.8.0"),
deps = {
{ "refractalize/oil-git-status.nvim",
function()
require("oil-git-status").setup {
symbols = { -- customize the symbols that appear in the git status columns
index = {
["A"] = "+",
["D"] = "-",
["M"] = "~",
},
working_tree = {
["A"] = "+",
["D"] = "-",
["M"] = "~",
}
}
}
return {
{ "stevearc/oil.nvim",
disable = not vim.fn.has("nvim-0.8.0"),
lazy = dep_short.keymap("n", "-"),
load = function()
-- Clear git status cache on refresh
local refresh = require("oil.actions").refresh
local orig_refresh = refresh.callback
refresh.callback = function(...)
git_status = new_git_status()
orig_refresh(...)
end
}
},
function()
-- Clear git status cache on refresh
local refresh = require("oil.actions").refresh
local orig_refresh = refresh.callback
refresh.callback = function(...)
git_status = new_git_status()
orig_refresh(...)
end
require("oil").setup {
-- ID is automatically added at the beginning, and name at the end
-- See :help oil-columns
columns = {
{
"permissions",
highlight = function(permission_str)
local hls = {}
for i = 1, #permission_str do
local char = permission_str:sub(i, i)
table.insert(hls, { permission_hlgroups[char], i - 1, i })
require("oil").setup {
-- ID is automatically added at the beginning, and name at the end
-- See :help oil-columns
columns = {
{
"permissions",
highlight = function(permission_str)
local hls = {}
for i = 1, #permission_str do
local char = permission_str:sub(i, i)
table.insert(hls, { permission_hlgroups[char], i - 1, i })
end
return hls
end,
},
{ "size", highlight = "@number" }
},
-- Window-local options to use for oil buffers
win_options = {
number = false,
relativenumber = false,
wrap = false,
signcolumn = "yes:2",
cursorcolumn = false,
foldcolumn = "0",
spell = false,
list = false,
conceallevel = 3,
concealcursor = "nvic"
},
-- Send deleted files to the trash instead of permanently deleting them (:help oil-trash)
delete_to_trash = false,
-- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits)
skip_confirm_for_simple_edits = false,
-- Selecting a new/moved/renamed file or directory will prompt you to save changes first
-- (:help prompt_save_on_select_new_entry)
prompt_save_on_select_new_entry = true,
-- Oil will automatically delete hidden buffers after this delay
-- You can set the delay to false to disable cleanup entirely
-- Note that the cleanup process only starts when none of the oil buffers are currently displayed
cleanup_delay_ms = 2000,
lsp_file_methods = {
-- Enable or disable LSP file operations
enabled = true,
-- Time to wait for LSP file operations to complete before skipping
timeout_ms = 1000,
-- Set to true to autosave buffers that are updated with LSP willRenameFiles
-- Set to "unmodified" to only save unmodified buffers
autosave_changes = "unmodified"
},
-- Constrain the cursor to the editable parts of the oil buffer
-- Set to `false` to disable, or "name" to keep it on the file names
constrain_cursor = "editable",
-- Set to true to watch the filesystem for changes and reload oil
watch_for_changes = false,
-- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap
-- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" })
-- Additionally, if it is a string that matches "actions.<name>",
-- it will use the mapping at require("oil.actions").<name>
-- Set to `false` to remove a keymap
-- See :help oil-actions for a list of all available actions
keymaps = {
["g?"] = { "actions.show_help", mode = "n" },
["<C-l>"] = "actions.refresh",
["<CR>"] = "actions.select",
["-"] = { "actions.parent", mode = "n" },
["_"] = { "actions.open_cwd", mode = "n" },
["`"] = { "actions.cd", mode = "n" },
["~"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" },
["gs"] = { "actions.change_sort", mode = "n" },
["gx"] = "actions.open_external",
["g."] = { "actions.toggle_hidden", mode = "n" },
["g\\"] = { "actions.toggle_trash", mode = "n" }
},
view_options = {
-- Show files and directories that start with "."
show_hidden = false,
-- This function defines what is considered a "hidden" file
is_hidden_file = function(name, bufnr)
local dir = require("oil").get_current_dir(bufnr)
local is_dotfile = vim.startswith(name, ".") and name ~= ".."
-- if no local directory (e.g. for ssh connections), just hide dotfiles
if not dir then
return is_dotfile
end
return hls
-- dotfiles are considered hidden unless tracked
if is_dotfile then
return not git_status[dir].tracked[name]
end
end,
-- This function defines what will never be shown, even when `show_hidden` is set
is_always_hidden = function(name, bufnr)
return false
end,
-- Sort file names with numbers in a more intuitive order for humans.
-- Can be "fast", true, or false. "fast" will turn it off for large directories.
natural_order = "fast",
-- Sort file and directory names case insensitive
case_insensitive = false,
sort = {
-- sort order can be "asc" or "desc"
-- see :help oil-columns to see which columns are sortable
{ "type", "asc" },
{ "name", "asc" },
},
-- Customize the highlight group for the file name
highlight_filename = function(entry, is_hidden, is_link_target, is_link_orphan)
return nil
end,
},
{ "size", highlight = "@number" }
},
-- Window-local options to use for oil buffers
win_options = {
number = false,
relativenumber = false,
wrap = false,
signcolumn = "yes:2",
cursorcolumn = false,
foldcolumn = "0",
spell = false,
list = false,
conceallevel = 3,
concealcursor = "nvic"
},
-- Send deleted files to the trash instead of permanently deleting them (:help oil-trash)
delete_to_trash = false,
-- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits)
skip_confirm_for_simple_edits = false,
-- Selecting a new/moved/renamed file or directory will prompt you to save changes first
-- (:help prompt_save_on_select_new_entry)
prompt_save_on_select_new_entry = true,
-- Oil will automatically delete hidden buffers after this delay
-- You can set the delay to false to disable cleanup entirely
-- Note that the cleanup process only starts when none of the oil buffers are currently displayed
cleanup_delay_ms = 2000,
lsp_file_methods = {
-- Enable or disable LSP file operations
enabled = true,
-- Time to wait for LSP file operations to complete before skipping
timeout_ms = 1000,
-- Set to true to autosave buffers that are updated with LSP willRenameFiles
-- Set to "unmodified" to only save unmodified buffers
autosave_changes = "unmodified"
},
-- Constrain the cursor to the editable parts of the oil buffer
-- Set to `false` to disable, or "name" to keep it on the file names
constrain_cursor = "editable",
-- Set to true to watch the filesystem for changes and reload oil
watch_for_changes = false,
-- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap
-- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" })
-- Additionally, if it is a string that matches "actions.<name>",
-- it will use the mapping at require("oil.actions").<name>
-- Set to `false` to remove a keymap
-- See :help oil-actions for a list of all available actions
keymaps = {
["g?"] = { "actions.show_help", mode = "n" },
["<C-l>"] = "actions.refresh",
["<CR>"] = "actions.select",
["-"] = { "actions.parent", mode = "n" },
["_"] = { "actions.open_cwd", mode = "n" },
["`"] = { "actions.cd", mode = "n" },
["~"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" },
["gs"] = { "actions.change_sort", mode = "n" },
["gx"] = "actions.open_external",
["g."] = { "actions.toggle_hidden", mode = "n" },
["g\\"] = { "actions.toggle_trash", mode = "n" }
},
view_options = {
-- Show files and directories that start with "."
show_hidden = false,
-- This function defines what is considered a "hidden" file
is_hidden_file = function(name, bufnr)
local dir = require("oil").get_current_dir(bufnr)
local is_dotfile = vim.startswith(name, ".") and name ~= ".."
-- if no local directory (e.g. for ssh connections), just hide dotfiles
if not dir then
return is_dotfile
end
-- dotfiles are considered hidden unless tracked
if is_dotfile then
return not git_status[dir].tracked[name]
end
end,
-- This function defines what will never be shown, even when `show_hidden` is set
is_always_hidden = function(name, bufnr)
return false
end,
-- Sort file names with numbers in a more intuitive order for humans.
-- Can be "fast", true, or false. "fast" will turn it off for large directories.
natural_order = "fast",
-- Sort file and directory names case insensitive
case_insensitive = false,
sort = {
-- sort order can be "asc" or "desc"
-- see :help oil-columns to see which columns are sortable
{ "type", "asc" },
{ "name", "asc" },
-- Configuration for the floating window in oil.open_float
float = {
border = vim.g.border_style
},
-- Customize the highlight group for the file name
highlight_filename = function(entry, is_hidden, is_link_target, is_link_orphan)
return nil
end,
},
-- Configuration for the floating window in oil.open_float
float = {
border = vim.g.border_style
},
-- Configuration for the floating action confirmation window
confirmation = {
border = vim.g.border_style
},
-- Configuration for the floating progress window
progress = {
border = vim.g.border_style
},
-- Configuration for the floating SSH window
ssh = {
border = vim.g.border_style
},
-- Configuration for the floating keymaps help window
keymaps_help = {
border = vim.g.border_style
-- Configuration for the floating action confirmation window
confirmation = {
border = vim.g.border_style
},
-- Configuration for the floating progress window
progress = {
border = vim.g.border_style
},
-- Configuration for the floating SSH window
ssh = {
border = vim.g.border_style
},
-- Configuration for the floating keymaps help window
keymaps_help = {
border = vim.g.border_style
}
}
}
map("n", "-", "<cmd>Oil<CR>")
end
map("n", "-", "<cmd>Oil<CR>")
end
},
{ "refractalize/oil-git-status.nvim",
reqs = "stevearc/oil.nvim",
lazy = dep_short.plugin("stevearc/oil.nvim"),
load = function()
require("oil-git-status").setup {
symbols = { -- customize the symbols that appear in the git status columns
index = {
["A"] = "+",
["D"] = "-",
["M"] = "~",
},
working_tree = {
["A"] = "+",
["D"] = "-",
["M"] = "~",
}
}
}
end
}
}

View File

@ -1,9 +0,0 @@
return { "ThePrimeagen/refactoring.nvim",
requires = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter"
},
function()
require('refactoring').setup {}
end
}

View File

@ -1,5 +1,6 @@
return { "nvzone/showkeys",
function()
lazy = dep_short.cmd("ShowKeysToggle"),
load = function()
require("showkeys").setup {
position = "top-right",
winopts = {

View File

@ -22,8 +22,13 @@ end
return { "nvim-telescope/telescope.nvim",
disable = not vim.fn.has("nvim-0.9.0"),
requires = {
"nvim-lua/plenary.nvim",
reqs = {
{ "nvim-lua/plenary.nvim",
-- lazy = function(load)
-- load:cmd("PlenaryBustedDirectory")
-- load:cmd("PlenaryBustedFile")
-- end
},
{ "nvim-telescope/telescope-fzf-native.nvim",
config = function()
vim.cmd("make")
@ -32,7 +37,19 @@ return { "nvim-telescope/telescope.nvim",
"nvim-telescope/telescope-ui-select.nvim"
},
function()
lazy = function(load)
load:cmd("Telescope")
load:keymap("n", "<leader>f")
load:keymap("n", "<leader>o")
load:keymap("n", "<leader>s")
load:keymap("n", "<leader>i")
load:keymap("n", "<leader>l")
load:keymap("n", "<leader>;")
load:keymap("n", "<leader>tc")
load:keymap("n", "<leader>tp")
end,
load = function()
local telescope = require("telescope")
local actions = require("telescope.actions")
@ -86,6 +103,9 @@ return { "nvim-telescope/telescope.nvim",
map("n", "<leader>l", telebuilt.lsp_document_symbols, {
desc = "Find symbols."
})
map("n", "<leader>;", telebuilt.lsp_workspace_symbols, {
desc = "Find Workspace symbols."
})
-- find over specific directories
map("n", "<leader>tc", function()

View File

@ -2,9 +2,8 @@
-- with nerd fonts or folke anymore also add support for TODO(name):
return { "folke/todo-comments.nvim",
requires = "nvim-lua/plenary.nvim",
disable = not vim.fn.has("nvim-0.8.0"),
function()
reqs = "nvim-lua/plenary.nvim",
load = function()
require("todo-comments").setup {
keywords = {
FIX = {

View File

@ -1,10 +0,0 @@
return { "nvim-treesitter/nvim-treesitter-context",
requires = "nvim-treesitter/nvim-treesitter",
function()
require("treesitter-context").setup {
max_lines = 2,
line_numbers = true,
trim_scope = 'inner'
}
end
}

View File

@ -1,50 +1,106 @@
return { "nvim-treesitter/nvim-treesitter",
disable = not vim.fn.has("nvim-0.10.0"),
config = function()
vim.cmd("TSUpdate")
end,
function()
require("nvim-treesitter.configs").setup {
-- good default parsers
ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown",
"markdown_inline", "java", "bash", "css", "html", "luadoc",
"make"
},
local map, auto = core.misc.map, core.misc.auto
-- indentation
indent = {
enable = true,
--- to highlight a buffer or not
---@param buf number buffer number
---@return boolean to_highlight
local function highlight(buf)
local ft = vim.api.nvim_get_option_value("ft", { buf = buf })
disable = function(lang, _)
-- disable indenting in php (it's more broken with than without)
return table.contains(({
"php"
}), lang)
end
},
-- disable highlighting on big files
local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > (1000 * 100 * 10) --[[1MB]] then
return false
end
-- fts to stop highlighting in
if table.contains({
"diff", "tex"
}, ft) then
return false
end
return true
end
--- to indent a buffer or not
---@param buf number buffer number
---@return boolean to_indent
local function indent(buf)
local ft = vim.api.nvim_get_option_value("ft", { buf = buf })
-- disable indentation on filetypes
if not table.contains({
"php"
}, ft) then
return false
end
return true
end
return {
{ "nvim-treesitter/nvim-treesitter",
branch = "main",
disable = not vim.fn.has("nvim-0.11.0"),
config = function()
vim.cmd("TSUpdate")
end,
load = function()
local treesitter = require("nvim-treesitter")
-- seems to not be very async despite the docs saying it is
-- default parsers to install
-- treesitter.install { "c", "lua", "vim", "vimdoc", "markdown",
-- "markdown_inline", "java", "bash", "css", "html", "luadoc", "make"
-- }
-- enable highlighting
highlight = {
enable = true,
-- use vim highlighting in addition to treesitter
additional_vim_regex_highlighting = true,
disable = function(lang, buf)
-- disable in some files where vim's builtin highlighting is better
if table.contains(({
"diff", "tex"
}), lang) then
return true
auto("FileType", {
callback = function(e)
-- I like both treesitter and default highlighting enabled
if highlight(e.buf) then
-- stop errors from showing up, I don't care
pcall(vim.treesitter.start)
vim.bo.syntax = "on"
end
-- disable in big files
local ok, stats = pcall(vim.uv.fs_stat,
vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > (1024 * 100 * 10) --[[1MB]] then
return true
-- indenting
if indent(e.buf) then
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
-- set the folding method
vim.opt.foldmethod = "expr"
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
end
})
end
},
{ "Wansmer/treesj",
disable = not vim.fn.has("nvim-0.9.0"),
reqs = "nvim-treesitter/nvim-treesitter",
lazy = function(load)
load:keymap("n", "<leader>j")
load:cmd("TSJToggle")
load:cmd("TSJSplit")
load:cmd("TSJJoin")
end,
load = function()
require("treesj").setup {
use_default_keymaps = false,
}
}
end
map("n", "<leader>j", require("treesj").toggle, { desc = "fold code" })
end
},
{ "windwp/nvim-ts-autotag",
reqs = "nvim-treesitter/nvim-treesitter",
disable = not vim.fn.has("nvim-0.9.5"),
-- lazy = dep_short.auto({ "BufReadPre", "BufNewFile" }),
load = function()
require("nvim-ts-autotag").setup {}
end
}
}

View File

@ -1,13 +0,0 @@
local map = core.misc.map
return { "Wansmer/treesj",
disable = not vim.fn.has("nvim-0.9.0"),
requires = "nvim-treesitter/nvim-treesitter",
function()
require("treesj").setup {
use_default_keymaps = false
}
map("n", "<leader>j", require("treesj").toggle, { desc = "fold code" })
end
}

View File

@ -1,7 +0,0 @@
return { "windwp/nvim-ts-autotag",
requires = "nvim-treesitter/nvim-treesitter",
disable = not vim.fn.has("nvim-0.9.5"),
function()
require("nvim-ts-autotag").setup {}
end
}

View File

@ -1,7 +1,8 @@
local map = core.misc.map
return { "mbbill/undotree",
function()
lazy = dep_short.keymap("n", "<leader>u"),
load = function()
if vim.g.loaded_undotree then
vim.g.undotree_DiffAutoOpen = 0
end

View File

@ -1,4 +1,5 @@
return { "lervag/vimtex",
lazy = dep_short.ft("tex"),
setup = function()
vim.g.vimtex_view_method = "zathura"
end

View File

@ -14,16 +14,20 @@ local function parse_line(linenr)
return nil
end
-- get a parser TODO: remove the pcall once nvim 0.12 hits and the function no
-- longer raises an error
local ok, parser = pcall(vim.treesitter.get_parser, bufnr)
if not ok then
if not ok or not parser then
return nil
end
-- get a query from the parser
local query = vim.treesitter.query.get(parser:lang(), "highlights")
if not query then
return nil
end
-- parse the current line
local tree = parser:parse({ linenr - 1, linenr })[1]
local result = {}
local line_pos = 0