Compare commits

...

3 commits

12 changed files with 387 additions and 378 deletions

View file

@ -78,9 +78,11 @@
python312Packages.pylatexenc
fd
# lsps / formatters
lua-language-server
# lsps (minimal because should be provided per-project by nix)
nixd
tinymist
# formatters
nixfmt-rfc-style
nodePackages_latest.prettier
taplo
@ -89,7 +91,6 @@
black
stylua
marksman
tinymist
];
};
@ -139,7 +140,6 @@
nvim-autopairs
nvim-lspconfig
intellitab-nvim
sleuth
which-key-nvim
telescope-nvim
markdown-preview-nvim
@ -188,7 +188,6 @@
"vim"
"vi"
];
neovim-unwrapped = pkgs.neovim-unwrapped;
};
categories = {
general = true;
@ -223,12 +222,7 @@
devShells = {
default = pkgs.mkShell {
name = defaultPackageName;
packages = [ defaultPackage ];
inputsFrom = with pkgs; [
lua-language-server
stylua
];
shellHook = '''';
packages = [ defaultPackage ] ++ (with pkgs; [ lua-language-server ]);
};
};

View file

@ -21,11 +21,11 @@ vim.opt.foldenable = false
vim.cmd.colorscheme("rose-pine")
require('nvim-treesitter.configs').setup({
require("nvim-treesitter.configs").setup({
ensure_installed = {},
sync_install = false,
auto_install = false,
modules = {"highlight", "incremental_selection", "indent"},
modules = { "highlight", "incremental_selection", "indent" },
ignore_install = {},
highlight = { enable = true },
disable = function(_, buf)
@ -35,7 +35,16 @@ require('nvim-treesitter.configs').setup({
return true
end
end,
additional_vim_regex_highlighting = false
additional_vim_regex_highlighting = false,
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<CR>",
node_incremental = "<C-k>",
scope_incremental = "<BS>",
node_decremental = "<C-j>",
},
},
})
vim.api.nvim_create_autocmd({
@ -49,6 +58,6 @@ vim.api.nvim_create_autocmd({
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank {higroup='Visual', timeout=300}
vim.highlight.on_yank({ higroup = "Visual", timeout = 300 })
end,
})

View file

@ -9,13 +9,6 @@ vim.keymap.set("t", "<C-Esc>", "<C-\\><C-n>")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "<leader>mr", function()
vim.cmd.CellularAutomaton("make_it_rain")
end)
vim.keymap.set("n", "<leader>bruh", function()
vim.cmd.CellularAutomaton("game_of_life")
end)
-- when searching, also center screen and reopen folds
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
@ -29,33 +22,10 @@ vim.keymap.set({ "n", "v" }, "<leader>Y", '"+Y', { desc = "yank rest of line to
vim.keymap.set({ "n", "v" }, "<leader>p", '"+p', { desc = "put after cursor from clipboard" })
vim.keymap.set({ "n", "v" }, "<leader>P", '"+P', { desc = "put before cursor from clipboard" })
vim.keymap.set("n", "<leader>gg", function()
vim.cmd.Neogit()
end, { desc = "Open neogit" })
vim.keymap.set("n", "<leader>gc", function()
vim.cmd.Neogit("kind=floating commit")
end, { desc = "Open neogit commit menu" })
vim.keymap.set("n", "<leader>u", function()
vim.cmd.UndotreeToggle()
end, { desc = "Toggle undotree" })
vim.keymap.set({ "n", "v" }, "<leader>cf", function()
require("conform").format({ async = true })
end)
vim.keymap.set({ "n", "v" }, "<leader>ctf", function()
if vim.g.disable_autoformat then
vim.g.disable_autoformat = false
else
vim.g.disable_autoformat = true
end
end, { desc = "Disable autoformat on save globally" })
vim.keymap.set({ "n", "v" }, "<leader>cbf", function()
if vim.b[0].disable_autoformat then
vim.b[0].disable_autoformat = false
else
vim.b[0].disable_autoformat = true
end
end, { desc = "Disable autoformat on save buffer" })
vim.keymap.set("i", "<Tab>", require("scripts.intellitab").indent)
-- Allow increment/decrement repeatedly in visual
vim.keymap.set("v", "<C-a>", "<C-a>gv")
vim.keymap.set("v", "<C-x>", "<C-x>gv")
vim.keymap.set("v", "g<C-a>", "g<C-a>gv")
vim.keymap.set("v", "g<C-x>", "g<C-x>gv")

View file

@ -20,179 +20,6 @@ return {
snippet_forward = "<Tab>",
snippet_backward = "<S-Tab>",
},
accept = {
create_undo_point = true,
auto_brackets = {
enabled = false,
default_brackets = { "(", ")" },
override_brackets_for_filetypes = {},
-- Overrides the default blocked filetypes
force_allow_filetypes = {},
blocked_filetypes = {},
-- Synchronously use the kind of the item to determine if brackets should be added
kind_resolution = {
enabled = true,
blocked_filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact", "vue" },
},
-- Asynchronously use semantic token to determine if brackets should be added
semantic_token_resolution = {
enabled = true,
blocked_filetypes = {},
},
},
},
trigger = {
completion = {
-- regex used to get the text when fuzzy matching
-- changing this may break some sources, so please report if you run into issues
-- todo: shouldnt this also affect the accept command? should this also be per language?
keyword_regex = "[%w_\\-]",
-- LSPs can indicate when to show the completion window via trigger characters
-- however, some LSPs (*cough* tsserver *cough*) return characters that would essentially
-- always show the window. We block these by default
blocked_trigger_characters = { " ", "\n", "\t" },
-- when true, will show the completion window when the cursor comes after a trigger character when entering insert mode
show_on_insert_on_trigger_character = true,
},
signature_help = {
enabled = false,
blocked_trigger_characters = {},
blocked_retrigger_characters = {},
-- when true, will show the signature help window when the cursor comes after a trigger character when entering insert mode
show_on_insert_on_trigger_character = true,
},
},
fuzzy = {
-- frencency tracks the most recently/frequently used items and boosts the score of the item
use_frecency = true,
-- proximity bonus boosts the score of items with a value in the buffer
use_proximity = true,
max_items = 200,
-- controls which sorts to use and in which order, these three are currently the only allowed options
sorts = { "label", "kind", "score" },
prebuiltBinaries = {
-- Whether or not to automatically download a prebuilt binary from github. If this is set to `false`
-- you will need to manually build the fuzzy binary dependencies by running `cargo build --release`
download = false,
-- When downloading a prebuilt binary force the downloader to resolve this version. If this is uset
-- then the downloader will attempt to infer the version from the checked out git tag (if any).
--
-- Beware that if the FFI ABI changes while tracking main then this may result in blink breaking.
forceVersion = nil,
},
},
sources = {
-- similar to nvim-cmp's sources, but we point directly to the source's lua module
-- multiple groups can be provided, where it'll fallback to the next group if the previous
-- returns no completion items
-- WARN: This API will have breaking changes during the beta
providers = {
{
{ "blink.cmp.sources.lsp" },
{ "blink.cmp.sources.path" },
{ "blink.cmp.sources.snippets", score_offset = -3 },
},
{ { "blink.cmp.sources.buffer" } },
},
-- FOR REF: full example
providers = {
{
-- all of these properties work on every source
{
"blink.cmp.sources.lsp",
keyword_length = 0,
score_offset = 0,
trigger_characters = { "f", "o", "o" },
opts = {},
},
-- the follow two sources have additional options
{
"blink.cmp.sources.path",
opts = {
trailing_slash = false,
label_trailing_slash = true,
get_cwd = function(context)
return vim.fn.expand(("#%d:p:h"):format(context.bufnr))
end,
show_hidden_files_by_default = true,
},
},
{
"blink.cmp.sources.snippets",
score_offset = -3,
-- similar to https://github.com/garymjr/nvim-snippets
opts = {
friendly_snippets = true,
search_paths = { vim.fn.stdpath("config") .. "/snippets" },
global_snippets = { "all" },
extended_filetypes = {},
ignored_filetypes = {},
},
},
},
{ { "blink.cmp.sources.buffer" } },
},
},
windows = {
autocomplete = {
min_width = 30,
max_width = 60,
max_height = 10,
border = "none",
winhighlight = "Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None",
-- keep the cursor X lines away from the top/bottom of the window
scrolloff = 2,
-- which directions to show the window,
-- falling back to the next direction when there's not enough space
direction_priority = { "s", "n" },
-- whether to preselect the first item in the completion list
preselect = true,
-- Controls how the completion items are rendered on the popup window
-- 'simple' will render the item's kind icon the left alongside the label
-- 'reversed' will render the label on the left and the kind icon + name on the right
-- 'function(blink.cmp.CompletionRenderContext): blink.cmp.Component[]' for custom rendering
draw = "simple",
-- Controls the cycling behavior when reaching the beginning or end of the completion list.
cycle = {
-- When `true`, calling `select_next` at the *bottom* of the completion list will select the *first* completion item.
from_bottom = true,
-- When `true`, calling `select_prev` at the *top* of the completion list will select the *last* completion item.
from_top = true,
},
},
documentation = {
min_width = 10,
max_width = 60,
max_height = 20,
border = "padded",
winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None",
-- which directions to show the documentation window,
-- for each of the possible autocomplete window directions,
-- falling back to the next direction when there's not enough space
direction_priority = {
autocomplete_north = { "e", "w", "n", "s" },
autocomplete_south = { "e", "w", "s", "n" },
},
auto_show = true,
auto_show_delay_ms = 500,
update_delay_ms = 100,
},
signature_help = {
min_width = 1,
max_width = 100,
max_height = 10,
border = "padded",
winhighlight = "Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder",
},
},
highlight = {
ns = vim.api.nvim_create_namespace("blink_cmp"),
-- sets the fallback highlight groups to nvim-cmp's highlight groups
@ -201,10 +28,6 @@ return {
use_nvim_cmp_as_default = false,
},
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- adjusts spacing to ensure icons are aligned
nerd_font_variant = "normal",
kind_icons = {
Text = "󰉿",
Method = "󰊕",

View file

@ -2,6 +2,40 @@ return {
"conform.nvim",
event = "BufWritePre",
cmd = "ConformInfo",
keys = {
{
"<leader>cf",
function()
require("conform").format({ async = true })
end,
desc = "Format code",
mode = { "n", "v" },
},
{
"<leader>ctf",
function()
if vim.g.disable_autoformat then
vim.g.disable_autoformat = false
else
vim.g.disable_autoformat = true
end
end,
desc = "Disable autoformat on save globally",
mode = { "n", "v" },
},
{
"<leader>cbf",
function()
if vim.b[0].disable_autoformat then
vim.b[0].disable_autoformat = false
else
vim.b[0].disable_autoformat = true
end
end,
desc = "Disable autoformat on save buffer",
mode = { "n", "v" },
},
},
after = function()
require("conform").setup({
format_on_save = function(bufnr)

View file

@ -1,23 +1,53 @@
return {
"harpoon2",
after = function()
local harpoon = require("harpoon")
vim.keymap.set("n", "<leader>a", function()
harpoon:list():add()
end)
vim.keymap.set("n", "<C-h><C-a>", function()
harpoon:list():select(1)
end)
vim.keymap.set("n", "<C-h><C-s>", function()
harpoon:list():select(2)
end)
vim.keymap.set("n", "<C-h><C-d>", function()
harpoon:list():select(3)
end)
vim.keymap.set("n", "<C-h><C-f>", function()
harpoon:list():select(4)
end)
require("harpoon"):setup()
end,
keys = {
{
"<leader>a",
function()
require("harpoon"):list():add()
end,
desc = "Add to harpoon",
mode = "n",
},
{
"<C-h><C-a>",
function()
require("harpoon"):list():select(1)
end,
desc = "Select harpoon 1",
mode = "n",
},
{
"<C-h><C-s>",
function()
require("harpoon"):list():select(2)
end,
desc = "Select harpoon 2",
mode = "n",
},
{
"<C-h><C-d>",
function()
require("harpoon"):list():select(3)
end,
desc = "Select harpoon 3",
mode = "n",
},
{
"<C-h><C-f>",
function()
require("harpoon"):list():select(4)
end,
desc = "Select harpoon 4",
mode = "n",
},
{
"<C-h><C-h>",
function()
require("lz.n").trigger_load("telescope.nvim")
local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files)
@ -38,8 +68,10 @@ return {
:find()
end
vim.keymap.set("n", "<C-h><C-h>", function()
toggle_telescope(harpoon:list())
end, { desc = "Open harpoon window" })
toggle_telescope(require("harpoon"):list())
end,
mode = "n",
desc = "toggle harpoon menu",
},
},
}

View file

@ -1,5 +1,6 @@
return {
"lsp-progress",
event = "LspAttach",
after = function()
require("lsp-progress").setup({
client_format = function(client_name, spinner, series_messages)

View file

@ -1,6 +1,5 @@
return {
"lualine.nvim",
event = "BufEnter",
after = function()
require("lualine").setup({
options = {
@ -25,6 +24,7 @@ return {
lualine_a = { "branch" },
lualine_b = {
function()
require("lz.n").trigger_load("lsp-progress")
return require("lsp-progress").progress()
end,
},

View file

@ -8,7 +8,9 @@ return {
require("plugins.lsp-progress"),
require("plugins.gitsigns"),
require("plugins.autopairs"),
{ "telescope-ui-select.nvim", priority = 70 },
require("plugins.trouble"),
require("plugins.toggleterm"),
{ "telescope-ui-select.nvim" },
{
"nvim-lspconfig",
event = "BufEnter",
@ -16,10 +18,6 @@ return {
require("lsp")
end,
},
{
"sleuth",
event = "BufEnter",
},
{
"which-key.nvim",
after = function()
@ -29,30 +27,10 @@ return {
end,
},
{ "nvim-web-devicons" },
{ "rose-pine" },
{ "render-markdown.nvim" },
{ "markdown-preview.nvim" },
{ "rose-pine", priority = 100 },
{
"trouble.nvim",
event = "LspAttach",
after = function()
require("trouble").setup()
vim.keymap.set("n", "<leader>xx", function()
vim.cmd("Trouble diagnostics toggle")
end, { desc = "Diagnostics" })
vim.keymap.set("n", "<leader>xX", function()
vim.cmd("Trouble diagnostics toggle filter.buf=0")
end, { desc = "Buffer diagnostics" })
vim.keymap.set("n", "<leader>cs", function()
vim.cmd("Trouble symbols toggle")
end, { desc = "Symbols" })
vim.keymap.set("n", "<leader>cl", function()
vim.cmd("Trouble lsp toggle win.position=right")
end, { desc = "LSP definitions / references /..." })
vim.keymap.set("n", "<leader>ql", function()
vim.cmd("Trouble qflist toggle")
end, { desc = "Quickfix list (trouble)" })
end,
"markdown-preview.nvim",
filetypes = { "markdown" },
},
{
"typst-preview",
@ -66,27 +44,6 @@ return {
})
end,
},
{
"toggleterm.nvim",
after = function()
require("toggleterm").setup({
shade_terminals = false,
})
vim.keymap.set({ "n", "t", "v" }, "<C-l>", function()
vim.cmd("ToggleTerm direction=float")
end)
vim.keymap.set("n", "<leader>tv", function()
vim.cmd("ToggleTerm direction=vertical")
end)
vim.keymap.set("n", "<leader>tt", function()
vim.cmd("ToggleTerm direction=horizontal")
end)
vim.keymap.set("n", "<leader>ts", function()
vim.cmd("TermSelect")
end)
end,
},
{
"mini.ai",
event = "BufEnter",
@ -109,9 +66,9 @@ return {
},
{
"mini.notify",
event = "BufEnter",
after = function()
require("mini.notify").setup({
-- handled by statusline
lsp_progress = { enable = false },
})
end,
@ -126,6 +83,24 @@ return {
{
"cellular-automaton.nvim",
cmd = "CellularAutomaton",
keys = {
{
"<leader>mr",
function()
vim.cmd.CellularAutomaton("make_it_rain")
end,
desc = "A surprise!",
mode = "n",
},
{
"<leader>bruh",
function()
vim.cmd.CellularAutomaton("game_of_life")
end,
desc = "A surprise!",
mode = "n",
},
},
},
{
"indent-blankline.nvim",
@ -150,13 +125,18 @@ return {
},
{
"mini.bufremove",
event = "BufEnter",
keys = {
{
"<leader>bd",
function()
MiniBufremove.delete()
end,
mode = { "n", "v" },
desc = "Close buffer",
},
},
after = function()
require("mini.bufremove").setup()
vim.keymap.set({ "n", "v" }, "<leader>bd", function()
MiniBufremove.delete()
end)
end,
},
{
@ -169,6 +149,29 @@ return {
{
"neogit",
cmd = "Neogit",
keys = {
{
"<leader>gg",
function()
vim.cmd.Neogit()
end,
desc = "Open neogit",
mode = "n",
},
{
"<leader>gc",
function()
vim.cmd.Neogit("kind=floating commit")
end,
desc = "Open neogit commit menu",
mode = "n",
},
},
before = function()
local lz = require("lz.n")
lz.trigger_load("diffview.nvim")
lz.trigger_load("telescope.nvim")
end,
after = function()
require("neogit").setup({
graph_style = "unicode",
@ -186,33 +189,31 @@ return {
{
"barbecue.nvim",
event = "BufEnter",
keys = {
{
"<C-j>",
function()
require("barbecue.ui").navigate(-1)
end,
desc = "Go to last treesitter node",
},
},
after = function()
require("barbecue").setup()
-- triggers CursorHold event faster
vim.opt.updatetime = 200
require("barbecue").setup({
create_autocmd = false, -- prevent barbecue from updating itself automatically
})
vim.api.nvim_create_autocmd({
"WinResized",
"BufWinEnter",
"CursorHold",
"InsertLeave",
-- include this if you have set `show_modified` to `true`
"BufModifiedSet",
}, {
group = vim.api.nvim_create_augroup("barbecue.updater", {}),
callback = function()
require("barbecue.ui").update()
end,
})
end,
},
{
"undotree",
cmd = "UndotreeToggle",
keys = {
{
"<leader>u",
function()
vim.cmd.UndotreeToggle()
end,
desc = "Toggle undotree",
mode = "n",
},
},
},
}

View file

@ -10,32 +10,86 @@ return {
})
require("telescope").load_extension("ui-select")
end,
keys = {
{
"<leader> ",
function()
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader> ", function()
local is_git = vim.fn.finddir(".git", vim.fn.getcwd() .. ";")
if is_git then
builtin.git_files()
else
builtin.find_files()
end
end, { desc = "Grep through all files tracked by git, or fall back to just cwd" })
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Grep through all files in cwd" })
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action)
vim.keymap.set("n", "<leader>/", builtin.live_grep)
vim.keymap.set("n", "<leader>k", builtin.buffers)
vim.keymap.set("n", "<leader>gd", builtin.lsp_definitions, { desc = "Go to LSP definition" })
vim.keymap.set("n", "<leader>gi", builtin.lsp_implementations, { desc = "Go to implementations" })
vim.keymap.set("n", "<leader>j", builtin.lsp_document_symbols, { desc = "Search through document symbols" })
vim.keymap.set(
"n",
"<leader>fs",
builtin.lsp_workspace_symbols,
{ desc = "Search through entire workspace symbols" }
)
vim.keymap.set("n", "<leader>fd", builtin.diagnostics, { desc = "Search through LSP diagnostics" })
end,
priority = 60,
desc = "Grep through all files tracked by git, or fall back to just cwd",
mode = "n",
},
{
"<leader>ff",
function()
require("telescope.builtin").find_files()
end,
desc = "Grep through all files in cwd",
mode = "n",
},
{ "<leader>ca", vim.lsp.buf.code_action, desc = "LSP Code Action", mode = "n" },
{
"<leader>/",
function()
require("telescope.builtin").live_grep()
end,
desc = "Live grep",
mode = "n",
},
{
"<leader>k",
function()
require("telescope.builtin").buffers()
end,
desc = "List buffers",
mode = "n",
},
{
"<leader>gd",
function()
require("telescope.builtin").lsp_definitions()
end,
desc = "Go to LSP definition",
mode = "n",
},
{
"<leader>gi",
function()
require("telescope.builtin").lsp_implementations()
end,
desc = "Go to implementations",
mode = "n",
},
{
"<leader>j",
function()
require("telescope.builtin").lsp_document_symbols()
end,
desc = "Search through document symbols",
mode = "n",
},
{
"<leader>fs",
function()
require("telescope.builtin").lsp_workspace_symbols()
end,
desc = "Search through entire workspace symbols",
mode = "n",
},
{
"<leader>fd",
function()
require("telescope.builtin").diagnostics()
end,
desc = "Search through LSP diagnostics",
mode = "n",
},
},
}

View file

@ -0,0 +1,42 @@
return {
"toggleterm.nvim",
keys = {
{
"<C-l>",
function()
vim.cmd("ToggleTerm direction=float")
end,
mode = { "n", "t", "v" },
desc = "Toggle terminal"
},
{
"<leader>tv",
function()
vim.cmd("ToggleTerm direction=vertical")
end,
desc = "Vertical terminal",
mode = "n",
},
{
"<leader>tt",
function()
vim.cmd("ToggleTerm direction=horizontal")
end,
desc = "Horizontal terminal",
mode = "n",
},
{
"<leader>ts",
function()
vim.cmd("TermSelect")
end,
desc = "Terminal select",
mode = "n",
},
},
after = function()
require("toggleterm").setup({
shade_terminals = false,
})
end,
}

49
lua/plugins/trouble.lua Normal file
View file

@ -0,0 +1,49 @@
return {
"trouble.nvim",
cmd = "Trouble",
after = function()
require("trouble").setup()
end,
keys = {
{
"<leader>xx",
function()
vim.cmd("Trouble diagnostics toggle")
end,
desc = "Diagnostics",
mode = "n",
},
{
"<leader>xX",
function()
vim.cmd("Trouble diagnostics toggle filter.buf=0")
end,
desc = "Buffer diagnostics",
mode = "n",
},
{
"<leader>cs",
function()
vim.cmd("Trouble symbols toggle")
end,
desc = "Symbols",
mode = "n",
},
{
"<leader>cl",
function()
vim.cmd("Trouble lsp toggle win.position=right")
end,
desc = "LSP definitions / references /...",
mode = "n",
},
{
"<leader>ql",
function()
vim.cmd("Trouble qflist toggle")
end,
desc = "Quickfix list (trouble)",
mode = "n",
},
},
}