diff --git a/lua/timmypidashev/options.lua b/lua/timmypidashev/options.lua index 4a4e718..4aa7be9 100644 --- a/lua/timmypidashev/options.lua +++ b/lua/timmypidashev/options.lua @@ -9,7 +9,7 @@ opt.autoindent = true -- UI opt.number = true -opt.relativenumber = true +opt.relativenumber = false opt.termguicolors = true opt.laststatus = 3 opt.wrap = false diff --git a/lua/timmypidashev/plugins.lua b/lua/timmypidashev/plugins.lua index 658e75e..a8bf82a 100644 --- a/lua/timmypidashev/plugins.lua +++ b/lua/timmypidashev/plugins.lua @@ -9,7 +9,6 @@ vim.pack.add({ { src = "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim" }, { src = "https://github.com/wakatime/vim-wakatime" }, { src = "https://github.com/nvim-lua/plenary.nvim" }, - { src = "https://github.com/ThePrimeagen/harpoon", version = "harpoon2" }, { src = "https://github.com/romgrk/barbar.nvim" }, { src = "https://github.com/stevearc/oil.nvim" }, @@ -46,6 +45,7 @@ vim.pack.add({ -- Local dev plugins vim.opt.rtp:prepend(vim.fn.expand("~/Projects/timmypidashev/verse.nvim")) +vim.opt.rtp:prepend(vim.fn.expand("~/Projects/homze/calculator/editors/neovim")) require("timmypidashev.plugins.darkbox") require("timmypidashev.plugins.lualine") @@ -55,7 +55,6 @@ require("timmypidashev.plugins.mason") require("timmypidashev.plugins.blink") require("timmypidashev.plugins.lsp") require("timmypidashev.plugins.starter") -require("timmypidashev.plugins.harpoon") require("timmypidashev.plugins.barbar") require("timmypidashev.plugins.oil") require("timmypidashev.plugins.fzf") @@ -73,3 +72,4 @@ require("timmypidashev.plugins.camouflage") require("timmypidashev.plugins.videre") require("timmypidashev.plugins.tinyglimmer") require("timmypidashev.plugins.render-markdown") +require("timmypidashev.plugins.calc") diff --git a/lua/timmypidashev/plugins/barbar.lua b/lua/timmypidashev/plugins/barbar.lua index 6611118..38872d4 100644 --- a/lua/timmypidashev/plugins/barbar.lua +++ b/lua/timmypidashev/plugins/barbar.lua @@ -4,14 +4,11 @@ require("barbar").setup({ animation = true, auto_hide = false, tabpages = true, - exclude_ft = { "dashboard", "oil" }, + exclude_ft = { "oil", "dashboard" }, icons = { buffer_index = true, - button = false, -- hide the close × on tabs + button = false, filetype = { enabled = true }, - -- Barbar's default preset uses a different separator glyph for inactive - -- tabs (▎ vs │), which visibly shifts the pipe when switching tabs. - -- Explicitly set all states to the same glyph. separator = { left = "│", right = "" }, inactive = { separator = { left = "│", right = "" } }, visible = { separator = { left = "│", right = "" } }, @@ -22,74 +19,19 @@ require("barbar").setup({ }, }) --- Personal barbar highlight tweaks on top of darkbox: --- 1. All separator pipes share one muted color (matches WinSeparator). --- 2. Active tab's index number is green so the selected tab pops. -local function barbar_highlights() - local bg = vim.api.nvim_get_hl(0, { name = "Normal", link = false }).bg - local win_sep = vim.api.nvim_get_hl(0, { name = "WinSeparator", link = false }) - local sep_fg = win_sep and win_sep.fg - - if sep_fg then - for _, group in ipairs({ - "BufferCurrentSign", - "BufferVisibleSign", - "BufferInactiveSign", - "BufferAlternateSign", - }) do - vim.api.nvim_set_hl(0, group, { fg = sep_fg, bg = bg }) - end - end - - local green = vim.api.nvim_get_hl(0, { name = "DarkboxGreen", link = false }).fg - if green then - vim.api.nvim_set_hl(0, "BufferCurrentIndex", { fg = green, bg = bg, bold = true }) - end -end - -barbar_highlights() -vim.api.nvim_create_autocmd("ColorScheme", { - callback = barbar_highlights, -}) - local map = vim.keymap.set local opts = { silent = true } --- If the current window is the oil sidebar, refocus the main editor window --- first. Otherwise barbar commands (BufferGoto, BufferClose, etc.) act on the --- oil window instead of the file area. -local function focus_main() - if vim.bo.filetype ~= "oil" then return end - for _, win in ipairs(vim.api.nvim_tabpage_list_wins(0)) do - local buf = vim.api.nvim_win_get_buf(win) - if vim.bo[buf].filetype ~= "oil" then - vim.api.nvim_set_current_win(win) - return - end - end -end - -local function barbar_cmd(cmd) - return function() - focus_main() - vim.cmd(cmd) - end -end - --- Leader + N → jump to tab N for i = 1, 9 do - map("n", "" .. i, barbar_cmd("BufferGoto " .. i), opts) + map("n", "" .. i, "BufferGoto " .. i .. "", opts) end -map("n", "0", barbar_cmd("BufferLast"), opts) +map("n", "0", "BufferLast", opts) --- Navigation -map("n", ",", barbar_cmd("BufferPrevious"), opts) -map("n", ".", barbar_cmd("BufferNext"), opts) +map("n", ",", "BufferPrevious", opts) +map("n", ".", "BufferNext", opts) --- Reorder -map("n", "<", barbar_cmd("BufferMovePrevious"), opts) -map("n", ">", barbar_cmd("BufferMoveNext"), opts) +map("n", "<", "BufferMovePrevious", opts) +map("n", ">", "BufferMoveNext", opts) --- Close -map("n", "c", barbar_cmd("BufferClose"), opts) -map("n", "bp", barbar_cmd("BufferPin"), opts) +map("n", "c", "BufferClose", opts) +map("n", "bp", "BufferPin", opts) diff --git a/lua/timmypidashev/plugins/calc.lua b/lua/timmypidashev/plugins/calc.lua new file mode 100644 index 0000000..319fd90 --- /dev/null +++ b/lua/timmypidashev/plugins/calc.lua @@ -0,0 +1 @@ +require("calc").setup() diff --git a/lua/timmypidashev/plugins/harpoon.lua b/lua/timmypidashev/plugins/harpoon.lua deleted file mode 100644 index 45ae42e..0000000 --- a/lua/timmypidashev/plugins/harpoon.lua +++ /dev/null @@ -1,15 +0,0 @@ -local harpoon = require("harpoon") -harpoon:setup() - -local map = vim.keymap.set - -map("n", "a", function() harpoon:list():add() end, { desc = "Harpoon add file" }) -map("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, { desc = "Harpoon menu" }) - -map("n", "", function() harpoon:list():select(1) end, { desc = "Harpoon slot 1" }) -map("n", "", function() harpoon:list():select(2) end, { desc = "Harpoon slot 2" }) -map("n", "", function() harpoon:list():select(3) end, { desc = "Harpoon slot 3" }) -map("n", "", function() harpoon:list():select(4) end, { desc = "Harpoon slot 4" }) - -map("n", "", function() harpoon:list():next() end, { desc = "Harpoon next" }) -map("n", "", function() harpoon:list():prev() end, { desc = "Harpoon prev" }) diff --git a/lua/timmypidashev/plugins/oil.lua b/lua/timmypidashev/plugins/oil.lua index 8260aa8..60bb9f5 100644 --- a/lua/timmypidashev/plugins/oil.lua +++ b/lua/timmypidashev/plugins/oil.lua @@ -5,133 +5,6 @@ require("oil").setup({ view_options = { show_hidden = true, }, - keymaps = { - ["g?"] = "actions.show_help", - [""] = { - desc = "Open in main window if sidebar, else select", - callback = function() - local oil = require("oil") - local entry = oil.get_cursor_entry() - if not entry then return end - - -- If this oil window isn't a sidebar, use default behavior. - if not vim.wo.winfixwidth then - oil.select() - return - end - - -- Directory: navigate within sidebar. - if entry.type == "directory" then - oil.select() - return - end - - -- File: find a non-oil window to open in. - local main_win - for _, w in ipairs(vim.api.nvim_tabpage_list_wins(0)) do - local b = vim.api.nvim_win_get_buf(w) - if vim.bo[b].filetype ~= "oil" then - main_win = w - break - end - end - - local path = oil.get_current_dir() .. entry.name - if main_win then - vim.api.nvim_set_current_win(main_win) - vim.cmd("edit " .. vim.fn.fnameescape(path)) - else - vim.cmd("rightbelow vsplit " .. vim.fn.fnameescape(path)) - end - end, - }, - [""] = { "actions.select", opts = { vertical = true } }, - [""] = { "actions.select", opts = { horizontal = true } }, - [""] = { "actions.select", opts = { tab = true } }, - [""] = "actions.preview", - [""] = "actions.close", - [""] = "actions.refresh", - ["-"] = "actions.parent", - ["_"] = "actions.open_cwd", - ["`"] = "actions.cd", - ["~"] = { "actions.cd", opts = { scope = "tab" } }, - ["gs"] = "actions.change_sort", - ["gx"] = "actions.open_external", - ["g."] = "actions.toggle_hidden", - ["g\\"] = "actions.toggle_trash", - }, - use_default_keymaps = false, }) -local SIDEBAR_WIDTH = 30 - --- Fish-style shortened cwd: ~/P/t/neovimrc -local function fish_cwd() - local cwd = vim.fn.getcwd() - local home = vim.env.HOME or "" - if home ~= "" and cwd:sub(1, #home) == home then - cwd = "~" .. cwd:sub(#home + 1) - end - local parts = vim.split(cwd, "/", { plain = true }) - for i = 1, #parts - 1 do - local p = parts[i] - if p ~= "" and p ~= "~" then - parts[i] = p:sub(1, 1) - end - end - return table.concat(parts, "/") -end - -local function find_sidebar() - for _, win in ipairs(vim.api.nvim_list_wins()) do - local buf = vim.api.nvim_win_get_buf(win) - if vim.bo[buf].filetype == "oil" and vim.api.nvim_win_get_config(win).relative == "" then - return win - end - end -end - -local function set_offset(width) - local ok, api = pcall(require, "barbar.api") - if ok then api.set_offset(width, fish_cwd()) end -end - -local function open_sidebar() - local existing = find_sidebar() - if existing then - vim.api.nvim_set_current_win(existing) - return - end - -- Suppress redraw so we don't flash the parent window's buffer in the new - -- split before :Oil takes over. - local save_lazyredraw = vim.o.lazyredraw - vim.o.lazyredraw = true - vim.cmd("topleft vsplit | vertical resize " .. SIDEBAR_WIDTH .. " | Oil") - vim.wo.number = false - vim.wo.relativenumber = false - vim.wo.signcolumn = "no" - vim.wo.winfixwidth = true - set_offset(SIDEBAR_WIDTH) - vim.o.lazyredraw = save_lazyredraw - vim.cmd("redraw") -end - -local function close_sidebar() - local existing = find_sidebar() - if existing then - vim.api.nvim_win_close(existing, true) - set_offset(0) - end -end - --- Keep the barbar label in sync with cwd changes. -vim.api.nvim_create_autocmd("DirChanged", { - callback = function() - if find_sidebar() then set_offset(SIDEBAR_WIDTH) end - end, -}) - -vim.keymap.set("n", "-", "Oil", { desc = "Oil parent dir (current window)" }) -vim.keymap.set("n", "e", open_sidebar, { desc = "Open / focus Oil sidebar" }) -vim.keymap.set("n", "E", close_sidebar, { desc = "Close Oil sidebar" }) -vim.keymap.set("n", "o", "w", { desc = "Cycle windows" }) +vim.keymap.set("n", "e", "Oil", { desc = "Open Oil" })