diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 6502efa..4231707 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -25,9 +25,9 @@ vim.cmd("set undofile") -- Customize window border vim.diagnostic.config({ - float = { - border = "single", - }, + float = { + border = "single", + }, }) -- Custom Key Binds @@ -65,6 +65,17 @@ vim.keymap.set("n", "cd", ":Copilot disable", { desc = "Disable Copi vim.keymap.set("n", "cc", ":CopilotChatToggle", { desc = "Toggle Copilot Chat" }) vim.keymap.set("n", "cx", ":CopilotChatReset", { desc = "Reset Copilot Chat" }) +-- Configure Buffer Navigation +vim.keymap.set("n", "", ":BufferPrevious", { desc = "Previous Buffer" }) +vim.keymap.set("n", "", ":BufferNext", { desc = "Next Buffer" }) +vim.keymap.set("n", "", ":BufferPrevious", { desc = "Previous Buffer" }) +vim.keymap.set("n", "", ":BufferNext", { desc = "Next Buffer" }) +vim.keymap.set("n", "bq", ":BufferClose", { desc = "Close Buffer" }) +vim.keymap.set("n", "bQ", ":BufferWipeout", { desc = "Wipeout Buffer" }) +vim.keymap.set("n", "", ":BufferClose", { desc = "Close Buffer" }) +vim.keymap.set("n", "bp", ":BufferPrevious", { desc = "Previous Buffer" }) +vim.keymap.set("n", "bn", ":BufferNext", { desc = "Next Buffer" }) + -- Configure f-key shortcuts vim.keymap.set("n", "", vim.lsp.buf.hover) vim.keymap.set("i", "", vim.lsp.buf.hover) diff --git a/.config/nvim/lua/plugins/chrome.lua b/.config/nvim/lua/plugins/chrome.lua index 0ab72a4..147dee3 100644 --- a/.config/nvim/lua/plugins/chrome.lua +++ b/.config/nvim/lua/plugins/chrome.lua @@ -1,92 +1,136 @@ return { - { - "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - require("lualine").setup({ - options = { - --`theme=codedark, - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { "branch", "diff", "diagnostics" }, - lualine_c = { { "filename", path = 1 } }, - lualine_x = { "encoding", "filetype" }, - 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, - }, - { + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("lualine").setup({ + options = { + --`theme=codedark, + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { + { "filename", path = 1 }, - "romgrk/barbar.nvim", - tag = "v1.9.0", - --init = function() - -- vim.g.barbar_auto_setup = false - --end, - }, + -- Determine class/function name + function() + local current_buff = vim.api.nvim_get_current_buf() + local current_node = vim.treesitter.get_node() + 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 - { - "folke/which-key.nvim", - event = "VeryLazy", - keys = { - { - "", - function() - require("which-key").show() - end, - mode = { "n", "v", "i" }, - }, - }, - }, - { - "yegappan/taglist", - vim.keymap.set("n", "fs", ":TlistToggle", { 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", - vim.keymap.set("n", "", ":BufferPrevious", { desc = "Previous Buffer" }), - vim.keymap.set("n", "", ":BufferNext", { desc = "Next Buffer" }), - vim.keymap.set("n", "", ":BufferPrevious", { desc = "Previous Buffer" }), - vim.keymap.set("n", "", ":BufferNext", { desc = "Next Buffer" }), - vim.keymap.set("n", "bq", ":BufferClose", { desc = "Close Buffer" }), - vim.keymap.set("n", "", ":BufferClose", { desc = "Close Buffer" }), - vim.keymap.set("n", "bp", ":BufferPrevious", { desc = "Previous Buffer" }), - vim.keymap.set("n", "bn", ":BufferNext", { desc = "Next Buffer" }), - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - local alpha = require("alpha") - local dashboard = require("alpha.themes.startify") + if not func then + return "" + end + for child in func:iter_children() do + if child:type() == "identifier" then + func = child + break + end + end + 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 + break + end + end + func_text = vim.treesitter.get_node_text(class, current_buff) .. ":" .. func_text + end + if vim.bo.filetype == "lua" then + -- Patch out invalid parsing of lua (and other?) files + return "" + end + return func_text + end, + }, + lualine_x = { "encoding", "filetype" }, + 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", + tag = "v1.9.1", + init = function() + vim.g.barbar_auto_setup = false + end, + opts = { + animation = false, + }, + }, + { + "folke/which-key.nvim", + event = "VeryLazy", + keys = { + { + "", + function() + require("which-key").show() + end, + mode = { "n", "v", "i" }, + }, + }, + }, + { + "preservim/tagbar", + vim.keymap.set("n", "fs", ":TagbarToggle", { desc = "Toggle Tagbar" }), + }, + --{ + -- "yegappan/taglist", + -- vim.keymap.set("n", "fs", ":TlistToggle", { 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) - end, - }, + alpha.setup(dashboard.opts) + end, + }, } diff --git a/.config/nvim/lua/plugins/history.lua b/.config/nvim/lua/plugins/history.lua index 1c50b72..eb2567a 100644 --- a/.config/nvim/lua/plugins/history.lua +++ b/.config/nvim/lua/plugins/history.lua @@ -8,6 +8,13 @@ return { }, { "pocco81/auto-save.nvim", + event = { "InsertLeave", "TextChanged" }, + config = function() + require("auto-save").setup({ + enabled = true, + trigger_events = { "InsertLeave", "TextChanged" }, + }) + end, keys = { { "as", "ASToggle", desc = "Toggle Auto Save" }, },