Compare commits

...

2 commits

Author SHA1 Message Date
4cb5bb7608 Update lualine to include class/function names
Replace taglist with tabbar for better layout
Add `bQ` shortcut to close a buffer without writing changes
Move navigation shurtcuts to init.lua
2025-06-17 22:45:55 -07:00
ef5f1dfc5f Fix auto-save plugin init 2025-06-17 22:38:32 -07:00
3 changed files with 151 additions and 89 deletions

View file

@ -25,9 +25,9 @@ vim.cmd("set undofile")
-- Customize window border -- Customize window border
vim.diagnostic.config({ vim.diagnostic.config({
float = { float = {
border = "single", border = "single",
}, },
}) })
-- Custom Key Binds -- Custom Key Binds
@ -65,6 +65,17 @@ vim.keymap.set("n", "<leader>cd", ":Copilot disable<CR>", { desc = "Disable Copi
vim.keymap.set("n", "<leader>cc", ":CopilotChatToggle<CR>", { desc = "Toggle Copilot Chat" }) vim.keymap.set("n", "<leader>cc", ":CopilotChatToggle<CR>", { desc = "Toggle Copilot Chat" })
vim.keymap.set("n", "<leader>cx", ":CopilotChatReset<CR>", { desc = "Reset Copilot Chat" }) vim.keymap.set("n", "<leader>cx", ":CopilotChatReset<CR>", { desc = "Reset Copilot Chat" })
-- Configure Buffer Navigation
vim.keymap.set("n", "<A-left>", ":BufferPrevious<CR>", { desc = "Previous Buffer" })
vim.keymap.set("n", "<A-right>", ":BufferNext<CR>", { desc = "Next Buffer" })
vim.keymap.set("n", "<A-h>", ":BufferPrevious<CR>", { desc = "Previous Buffer" })
vim.keymap.set("n", "<A-l>", ":BufferNext<CR>", { desc = "Next Buffer" })
vim.keymap.set("n", "<leader>bq", ":BufferClose<CR>", { desc = "Close Buffer" })
vim.keymap.set("n", "<leader>bQ", ":BufferWipeout<CR>", { desc = "Wipeout Buffer" })
vim.keymap.set("n", "<A-q>", ":BufferClose<CR>", { desc = "Close Buffer" })
vim.keymap.set("n", "<leader>bp", ":BufferPrevious<CR>", { desc = "Previous Buffer" })
vim.keymap.set("n", "<leader>bn", ":BufferNext<CR>", { desc = "Next Buffer" })
-- Configure f-key shortcuts -- Configure f-key shortcuts
vim.keymap.set("n", "<F1>", vim.lsp.buf.hover) vim.keymap.set("n", "<F1>", vim.lsp.buf.hover)
vim.keymap.set("i", "<F1>", vim.lsp.buf.hover) vim.keymap.set("i", "<F1>", vim.lsp.buf.hover)

View file

@ -1,92 +1,136 @@
return { return {
{ {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() config = function()
require("lualine").setup({ require("lualine").setup({
options = { options = {
--`theme=codedark, --`theme=codedark,
component_separators = { left = "", right = "" }, component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" }, section_separators = { left = "", right = "" },
}, },
sections = { sections = {
lualine_a = { "mode" }, lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" }, lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { { "filename", path = 1 } }, lualine_c = {
lualine_x = { "encoding", "filetype" }, { "filename", path = 1 },
lualine_y = {
function()
-- Display an active Python virtual environment if active
local venv = os.getenv("VIRTUAL_ENV")
if venv then
return vim.fn.fnamemodify(venv, ":t")
-- Put other useful paths here as available
else
return ""
end
end,
},
lualine_z = { "location" },
},
})
end,
},
{
"romgrk/barbar.nvim", -- Determine class/function name
tag = "v1.9.0", function()
--init = function() local current_buff = vim.api.nvim_get_current_buf()
-- vim.g.barbar_auto_setup = false local current_node = vim.treesitter.get_node()
--end, if not current_node then
}, return ""
end
local class = nil
local func = nil
local expr = current_node
while expr do
if expr:type() == "function_definition" then
func = expr
elseif expr:type() == "class_definition" then
class = expr
end
expr = expr:parent()
end
{ if not func then
"folke/which-key.nvim", return ""
event = "VeryLazy", end
keys = { for child in func:iter_children() do
{ if child:type() == "identifier" then
"<S-F1>", func = child
function() break
require("which-key").show() end
end, end
mode = { "n", "v", "i" }, local func_text = vim.treesitter.get_node_text(func, current_buff)
}, if class then
}, for child in class:iter_children() do
}, if child:type() == "identifier" then
{ class = child
"yegappan/taglist", break
vim.keymap.set("n", "<leader>fs", ":TlistToggle<CR>", { desc = "Toggle Taglist" }), end
vim.cmd("let Tlist_Use_Right_Window = 1"), end
vim.cmd("let Tlist_Show_One_File = 1"), func_text = vim.treesitter.get_node_text(class, current_buff) .. ":" .. func_text
vim.cmd("let Tlist_WinWidth = 50"), end
}, if vim.bo.filetype == "lua" then
{ -- Patch out invalid parsing of lua (and other?) files
"goolord/alpha-nvim", return ""
vim.keymap.set("n", "<A-left>", ":BufferPrevious<CR>", { desc = "Previous Buffer" }), end
vim.keymap.set("n", "<A-right>", ":BufferNext<CR>", { desc = "Next Buffer" }), return func_text
vim.keymap.set("n", "<A-h>", ":BufferPrevious<CR>", { desc = "Previous Buffer" }), end,
vim.keymap.set("n", "<A-l>", ":BufferNext<CR>", { desc = "Next Buffer" }), },
vim.keymap.set("n", "<leader>bq", ":BufferClose<CR>", { desc = "Close Buffer" }), lualine_x = { "encoding", "filetype" },
vim.keymap.set("n", "<A-q>", ":BufferClose<CR>", { desc = "Close Buffer" }), lualine_y = {
vim.keymap.set("n", "<leader>bp", ":BufferPrevious<CR>", { desc = "Previous Buffer" }), function()
vim.keymap.set("n", "<leader>bn", ":BufferNext<CR>", { desc = "Next Buffer" }), -- Display an active Python virtual environment if active
dependencies = { "nvim-tree/nvim-web-devicons" }, local venv = os.getenv("VIRTUAL_ENV")
config = function() if venv then
local alpha = require("alpha") return vim.fn.fnamemodify(venv, ":t")
local dashboard = require("alpha.themes.startify") -- Put other useful paths here as available
else
return ""
end
end,
},
lualine_z = { "location" },
},
})
end,
},
{
"romgrk/barbar.nvim",
tag = "v1.9.1",
init = function()
vim.g.barbar_auto_setup = false
end,
opts = {
animation = false,
},
},
{
"folke/which-key.nvim",
event = "VeryLazy",
keys = {
{
"<S-F1>",
function()
require("which-key").show()
end,
mode = { "n", "v", "i" },
},
},
},
{
"preservim/tagbar",
vim.keymap.set("n", "<leader>fs", ":TagbarToggle<CR>", { desc = "Toggle Tagbar" }),
},
--{
-- "yegappan/taglist",
-- vim.keymap.set("n", "<leader>fs", ":TlistToggle<CR>", { desc = "Toggle Taglist" }),
-- vim.cmd("let Tlist_Use_Right_Window = 1"),
-- vim.cmd("let Tlist_Show_One_File = 1"),
-- vim.cmd("let Tlist_WinWidth = 50"),
--},
{
"goolord/alpha-nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.startify")
dashboard.section.header.val = { dashboard.section.header.val = {
" ", " ",
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ", " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ", " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ", " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ", " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ", " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ", " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
" ", " ",
} }
alpha.setup(dashboard.opts) alpha.setup(dashboard.opts)
end, end,
}, },
} }

View file

@ -8,6 +8,13 @@ return {
}, },
{ {
"pocco81/auto-save.nvim", "pocco81/auto-save.nvim",
event = { "InsertLeave", "TextChanged" },
config = function()
require("auto-save").setup({
enabled = true,
trigger_events = { "InsertLeave", "TextChanged" },
})
end,
keys = { keys = {
{ "<leader>as", "<cmd>ASToggle<cr>", desc = "Toggle Auto Save" }, { "<leader>as", "<cmd>ASToggle<cr>", desc = "Toggle Auto Save" },
}, },