Many improvements.

This commit is contained in:
Drew Galbraith 2025-04-27 20:57:49 -07:00
parent bcb5556f7c
commit 30e94f86f0
10 changed files with 247 additions and 7 deletions

View File

@ -1,5 +1,5 @@
require("config.lazy")
require("config.opts")
require("config.lsp")
require("config.keys")
require("config.opts")

View File

@ -1,11 +1,21 @@
{
"blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"gitsigns.nvim": { "branch": "main", "commit": "9cd665f46ab7af2e49d140d328b8e72ea1cf511b" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"material.nvim": { "branch": "main", "commit": "96285a62923ea8e38aea7b603099752da2a97e97" },
"mini.cursorword": { "branch": "main", "commit": "7d1b38a17834acbbc4feff8e42aedc4ed0c6ff06" },
"mini.icons": { "branch": "main", "commit": "910db5df9724d65371182948f921fce23c2c881e" },
"nord.nvim": { "branch": "main", "commit": "b4863217a6272ecd41862e09fdea0ba7b7e5f8f5" },
"nvim-lspconfig": { "branch": "master", "commit": "cb33dea610b7eff240985be9f6fe219920e630ef" },
"nvim-treesitter": { "branch": "master", "commit": "523a9e148919f58eb5a013f76787e57696e00c93" },
"mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" },
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
"nord.nvim": { "branch": "main", "commit": "1ee184dfd06ffadc19b7afc0ba4c5eca92dd836e" },
"nui.nvim": { "branch": "main", "commit": "8d5b0b568517935d3c84f257f272ef004d9f5a59" },
"nvim-lspconfig": { "branch": "master", "commit": "88d0824d85c0f74a012521d25678a5b01c76feb1" },
"nvim-treesitter": { "branch": "master", "commit": "3b308861a8d7d7bfbe9be51d52e54dcfd9fe3d38" },
"nvim-web-devicons": { "branch": "master", "commit": "50b5b06bff13a9b4eab946de7c7033649a6618a1" },
"rustaceanvim": { "branch": "master", "commit": "3a6af933d5870a419ee2be6e1bd397dfe46c96d2" },
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

View File

@ -1,18 +1,75 @@
require("which-key").add({
{ "<leader>b", group = "buffer" },
{ "<leader>bd", ":bd<CR>", name = "delete current" },
{ "<leader>c", group = "code" },
{ "<leader>ca", vim.lsp.buf.code_action, name = "code action" },
{ "<leader>cd", vim.diagnostic.open_float, name = "diagnostic" },
{ "<leader>e", Snacks.explorer.open, name = "explorer" },
{ "<leader>f", group = "find" },
{ "<leader>fb", Snacks.picker.buffers, name = "buffers" },
{ "<leader>ff", Snacks.picker.files, name = "files" },
{ "<leader>fg", Snacks.picker.grep, name = "grep" },
{ "<leader>g", group = "git" },
{ "<leader>gb", group = "blame" },
{ "<leader>gbf", ":Gitsigns blame<CR>", name = "file" },
{ "<leader>gbh", ":Gitsigns blame_line<CR>", name = "hover" },
{ "<leader>gbl", ":Gitsigns toggle_current_line_blame<CR>", name = "virtual text" },
{ "<leader>gh", group = "hunk" },
{ "<leader>ghr", ":Gitsigns reset_hunk<CR>", name = "reset hunk" },
{ "<leader>ghp", ":Gitsigns preview_hunk<CR>", name = "reset hunk" },
{ "<leader>s", group = "search" },
{ "<leader>ss", Snacks.picker.lsp_workspace_symbols, name = "symbols" },
{ "<leader>sg", Snacks.picker.grep, name = "grep" },
{ "<leader>u", group = "ui" },
{ "<leader>ut", Snacks.picker.colorschemes, name = "colorschemes" },
{
"<leader>ul",
function()
local ll = vim.diagnostic.config().virtual_lines
if ll == false then
ll = { current_line = true }
else
ll = false
end
vim.diagnostic.config({ virtual_lines = ll })
end,
name = "toggle lsp lines",
},
{ "<leader>w", group = "window" },
{ "<leader>wh", "<C-w>h", name = "left" },
{ "<leader>wj", "<C-w>j", name = "down" },
{ "<leader>wk", "<C-w>k", name = "right" },
{ "<leader>wl", "<C-w>l", name = "up" },
{ "<leader>wq", ":q<CR>", name = "quit" },
{ "g", group = "goto" },
{ "gd", vim.lsp.buf.definition, name = "definition" },
{ "gr", Snacks.picker.lsp_references, nowait = true, name = "references" },
{ "H", ":bprev<CR>", name = "previous buffer" },
{ "L", ":bnext<CR>", name = "next buffer" },
{
"[h",
function()
require("gitsigns").nav_hunk("prev")
end,
name = "Next Hunk",
},
{
"]h",
function()
require("gitsigns").nav_hunk("next")
end,
name = "Next Hunk",
},
})
Snacks.toggle.diagnostics():map("<leader>ud")

View File

@ -31,5 +31,8 @@ require("lazy").setup({
-- colorscheme that will be used when installing plugins.
install = {},
-- automatically check for plugin updates
checker = { enabled = true },
checker = {
enabled = true,
notify = false,
},
})

View File

@ -1,5 +1,7 @@
require("lspconfig").basedpyright.setup({})
require("lspconfig").ruff.setup({})
local capabilities = require("blink.cmp").get_lsp_capabilities()
require("lspconfig").basedpyright.setup({ capabilities = capabilities })
require("lspconfig").ruff.setup({ capabilities = capabilities })
require("lspconfig").lua_ls.setup({
on_init = function(client)
@ -31,4 +33,73 @@ require("lspconfig").lua_ls.setup({
settings = {
Lua = {},
},
capabilities = capabilities,
})
vim.g.rustaceanvim = {
-- Plugin configuration
-- tools = {
-- },
-- LSP configuration
server = {
-- on_attach = function(client, bufnr)
-- -- you can also put keymaps in here
--end,
default_settings = {
-- rust-analyzer language server configuration
["rust-analyzer"] = {
cargoWatch = true,
cargo = {
allFeatures = true,
allTargets = false,
loadOutDirsFromCheck = true,
buildScripts = {
enable = true,
},
},
checkOnSave = {
allFeatures = true,
allTargets = false,
},
diagnostics = {
enable = true,
},
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
files = {
excludeDirs = {
".direnv",
".git",
".github",
".gitlab",
"bin",
"node_modules",
"target",
"venv",
".venv",
},
},
},
},
},
-- DAP configuration
dap = {},
}
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
callback = function(args)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = args.buf,
callback = function()
vim.lsp.buf.format({ async = false, id = args.data.client_id })
end,
})
end,
})

View File

@ -1,9 +1,22 @@
vim.opt.termguicolors = true
vim.cmd("colorscheme tokyonight")
vim.wo.number = true
vim.wo.relativenumber = true
vim.diagnostic.config({
virtual_text = true,
virtual_lines = {
current_line = true,
},
update_in_insert = true,
signs = true,
})
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})

8
lua/plugins/editor.lua Normal file
View File

@ -0,0 +1,8 @@
return {
{ "echasnovski/mini.pairs", event = "BufEnter", version = "*", opts = {} },
{ "echasnovski/mini.cursorword", event = "BufEnter", version = "*", opts = {} },
{
"folke/trouble.nvim",
opts = {},
},
}

22
lua/plugins/git.lua Normal file
View File

@ -0,0 +1,22 @@
return {
{
"lewis6991/gitsigns.nvim",
opts = {
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
untracked = { text = "" },
},
signs_staged = {
add = { text = "" },
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
},
},
},
}

View File

@ -4,4 +4,22 @@ return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
},
{
"mrcjkb/rustaceanvim",
version = "^6", -- Recommended
lazy = false, -- This plugin is already lazy
enabled = true,
},
{
"saghen/blink.cmp",
version = "1.*",
opts = {
keymap = {
preset = "enter",
},
sources = {
default = { "lsp", "path", "buffer" },
},
},
},
}

View File

@ -13,4 +13,42 @@ return {
end
end,
},
{
"akinsho/bufferline.nvim",
version = "*",
dependencies = "nvim-tree/nvim-web-devicons",
opts = {
options = {
diagnostics = "nvim_lsp",
show_close_icon = false,
separator_style = "slant",
offsets = {
{
filetype = "snacks_layout_box",
text = "󰙅 File Explorer",
separator = true,
},
},
},
},
},
{
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
-- "rcarriga/nvim-notify",
},
opts = {
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
},
},
},
}