From 0d0c8343f3bf3be022a3b7d9d2ccb0769aae95f9 Mon Sep 17 00:00:00 2001 From: triethyl Date: Fri, 8 Aug 2025 11:36:00 -0400 Subject: neovim: improved working with buffers (and misc) --- pkgs/custom-neovim/config/init.lua | 1 + pkgs/custom-neovim/config/lua/mappings.lua | 30 ++++++++++++++-------- pkgs/custom-neovim/config/lua/plugins/comment.lua | 2 +- .../config/lua/plugins/mini/tabline.lua | 13 +++++++++- pkgs/custom-neovim/config/lua/statusline.lua | 10 -------- pkgs/custom-neovim/design.md | 13 +++++----- 6 files changed, 40 insertions(+), 29 deletions(-) (limited to 'pkgs') diff --git a/pkgs/custom-neovim/config/init.lua b/pkgs/custom-neovim/config/init.lua index a350729..b7c82a2 100644 --- a/pkgs/custom-neovim/config/init.lua +++ b/pkgs/custom-neovim/config/init.lua @@ -31,6 +31,7 @@ require("plugins.actions-preview") require("plugins.mini.git") require("plugins.mini.pairs") require("plugins.ts-autotag") +require("plugins.comment") -- Misc Plugins: require("plugins.presence") diff --git a/pkgs/custom-neovim/config/lua/mappings.lua b/pkgs/custom-neovim/config/lua/mappings.lua index 1379973..da2cf17 100644 --- a/pkgs/custom-neovim/config/lua/mappings.lua +++ b/pkgs/custom-neovim/config/lua/mappings.lua @@ -7,8 +7,6 @@ vim.g.mapleader = ' ' -- Pickers mapkey("n", "f", "Open file picker", ":lua Snacks.picker.files()") mapkey("n", "l", "Open recent file picker", ":lua Snacks.picker.recent()") -mapkey("n", "b", "Open buffer picker", ":lua Snacks.picker.buffers()") -mapkey("n", "B", "Open buffer live grep picker", ":lua Snacks.picker.grep_buffers()") mapkey("n", "y", "Open clipboard history picker", ":lua Snacks.picker.cliphist()") mapkey("n", "/", "Open live grep picker", ":lua Snacks.picker.grep()") mapkey("n", "\\", "Open command palette", ":lua Snacks.picker.commands()") @@ -17,7 +15,11 @@ mapkey("n", "p", "Open picker picker", ":lua Snacks.picker.pickers() mapkey("n", "'", "Open last picker", ":lua Snacks.picker.resume()") mapkey("n", "", "Open smart picker", ":lua Snacks.picker.smart()") mapkey("n", "z", "Open zoxide picker", ":lua Snacks.picker.zoxide()") -mapkey("n", "T", "Open treesitter picker", ":Namu treesitter") +mapkey("n", "R", "Open treesitter picker", ":Namu treesitter") +mapkey("n", "k", "Open colorscheme picker", ":Namu colorscheme") + +-- Dropbar +mapkey("n", "j", "Open dropdown", ":lua require('dropbar.api').pick()") -- Tabs mapkey("n", "t", "Manage tabs", "") @@ -25,13 +27,21 @@ mapkey("n", "to", "Open new tab", ":tabnew") mapkey("n", "tc", "Close tab", ":tabclose") mapkey("n", "tt", "Go to next tab", ":tabnext") mapkey("n", "tT", "Go to previous tab", ":tabprev") -mapkey("n", "tr", "Rename current tab", function() - vim.ui.input({ prompt = "Rename tab: "}, function(input) - if input then - vim.cmd.TabRename(input) - end - end) -end) +-- mapkey("n", "tr", "Rename current tab", function() +-- vim.ui.input({ prompt = "Rename tab: "}, function(input) +-- if input then +-- vim.cmd.TabRename(input) +-- end +-- end) +-- end) + +-- Buffers +mapkey("n", "b", "Manage buffers", "") +mapkey("n", "bb", "Go to next buffer", ":bn") +mapkey("n", "bB", "Go to previous buffer", ":bp") +mapkey("n", "bc", "Delete current buffer", ":bd") +mapkey("n", "bp", "Open buffer picker", ":lua Snacks.picker.buffers()") +mapkey("n", "bg", "Open buffer live grep picker", ":lua Snacks.picker.grep_buffers()") -- Windows mapkey("n", "w", "Manage windows", "") diff --git a/pkgs/custom-neovim/config/lua/plugins/comment.lua b/pkgs/custom-neovim/config/lua/plugins/comment.lua index 4ff0380..bd47faf 100644 --- a/pkgs/custom-neovim/config/lua/plugins/comment.lua +++ b/pkgs/custom-neovim/config/lua/plugins/comment.lua @@ -1 +1 @@ -require("comment").setup() +require("Comment").setup() diff --git a/pkgs/custom-neovim/config/lua/plugins/mini/tabline.lua b/pkgs/custom-neovim/config/lua/plugins/mini/tabline.lua index 9045285..90ba53a 100644 --- a/pkgs/custom-neovim/config/lua/plugins/mini/tabline.lua +++ b/pkgs/custom-neovim/config/lua/plugins/mini/tabline.lua @@ -1 +1,12 @@ -require("mini.tabline").setup() +require("mini.tabline").setup { + format = function(buf_id, label) + local suffix = vim.bo[buf_id].modified and '[+] ' or '' + return MiniTabline.default_format(buf_id, label) .. suffix + end +} + +local link_hl = Utils.link_highlight + +link_hl("MiniTablineModifiedHidden", "MiniTablineHidden") +link_hl("MiniTablineModifiedVisible", "MiniTablineVisible") +link_hl("MiniTablineModifiedCurrent", "MiniTablineCurrent") diff --git a/pkgs/custom-neovim/config/lua/statusline.lua b/pkgs/custom-neovim/config/lua/statusline.lua index d83231a..b7f293d 100644 --- a/pkgs/custom-neovim/config/lua/statusline.lua +++ b/pkgs/custom-neovim/config/lua/statusline.lua @@ -1,15 +1,5 @@ -- Statusline --- TODO: Components to add --- --- mode --- git branch --- --- cwd --- --- lsp diagnostics --- lsp status - -- Highlight pattern local hi_pattern = '%%#%s#%s%%*' diff --git a/pkgs/custom-neovim/design.md b/pkgs/custom-neovim/design.md index fcaa453..903efa5 100644 --- a/pkgs/custom-neovim/design.md +++ b/pkgs/custom-neovim/design.md @@ -10,15 +10,14 @@ ## Todo -- add quick window switcher plugin -- make tabby run on highlight groups -- add modified tags to tabby -- prevent dropbar filename from truncating - add keybind to activate dropbar drop down menu - find dropbar load autocommand and modify to work on winenter to prevent no dropbar when splitting -- make splits automatically equalize when window resized -- add arrows to binds - make lazyvim launch with default shell bash - make mini.git run commands from cwd instead of git root -- make nix file autoindent work properly (maybe remove smartindent?) - add more binds to mini.files +- make autocomplete accept the current completion when I resume typing +- Add LSP status to status bar + +## Todo if possible +- make splits automatically equalize when window resized +- prevent dropbar filename from truncating -- cgit v1.2.3