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
This commit is contained in:
parent
ef5f1dfc5f
commit
4cb5bb7608
2 changed files with 144 additions and 89 deletions
|
@ -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", "<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>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
|
||||
vim.keymap.set("n", "<F1>", vim.lsp.buf.hover)
|
||||
vim.keymap.set("i", "<F1>", vim.lsp.buf.hover)
|
||||
|
|
|
@ -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 = {
|
||||
{
|
||||
"<S-F1>",
|
||||
function()
|
||||
require("which-key").show()
|
||||
end,
|
||||
mode = { "n", "v", "i" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"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",
|
||||
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", "<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" }),
|
||||
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 = {
|
||||
{
|
||||
"<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)
|
||||
end,
|
||||
},
|
||||
alpha.setup(dashboard.opts)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue