From 0b17063da01796c3bd0eb5bb696736f3fe7ead23 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Thu, 30 Jan 2025 10:36:08 +0100 Subject: [PATCH] Fix % in cmdline mode for oil --- nvim/lua/plugins/oil.lua | 3 ++- nvim/lua/settings.lua | 25 ++++--------------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/nvim/lua/plugins/oil.lua b/nvim/lua/plugins/oil.lua index e1cf684..5e5e8da 100644 --- a/nvim/lua/plugins/oil.lua +++ b/nvim/lua/plugins/oil.lua @@ -3,7 +3,7 @@ return { "oil.nvim", lazy = false, keys = { - { "-", "Oil", desc = "Open parent directory" }, + { "-", "Oil", desc = "Open parent directory" }, { "", "Oil", desc = "Open parent directory" }, }, opts = { @@ -17,6 +17,7 @@ return { }, after = function(plug) require("oil").setup(plug.opts) + vim.cmd.cabbr({ args = { "", "%", "&filetype == 'oil' ? bufname('%')[6:] : '%'" } }) end } } diff --git a/nvim/lua/settings.lua b/nvim/lua/settings.lua index 313c157..6672b74 100644 --- a/nvim/lua/settings.lua +++ b/nvim/lua/settings.lua @@ -45,13 +45,15 @@ vim.opt.spell = true -- Can't specify this in wordmotion's config due to race conditions vim.g.wordmotion_nomap = true +-- Disable builtin sql completions which are bound to +vim.g.omni_sql_no_default_maps = 1 -- for all modes except terminal vim.keymap.set({ "i", "n", "o", "x", "v", "s", "l", "c" }, "", "") -- i don't use terminal that much so not having esc is okay vim.keymap.set("t", "", "", { desc = "Normal mode" }) --- Disable builtin sql completions which are bound to -vim.g.omni_sql_no_default_maps = 1 +-- Why is this not the default? +vim.keymap.set("c", "", "", { desc = "Begining" }) -- Stay in indent mode vim.keymap.set("v", "<", "Y", '"+y$', { desc = "Yank line to system vim.keymap.set({ "n", "x" }, "p", '"+p', { desc = "Past from system clipboard" }) vim.keymap.set({ "n", "x" }, "P", '"+P', { desc = "Past line from system clipboard" }) --- use osc52 so it works in ssh sessions --- see https://github.com/tmux/tmux/issues/4048 for more info - -if vim.env.TMUX ~= nil then - -- tmux osc52 is lame, we need to run `tmux refresh-client -l` before copying - -- vim.g.clipboard = { - -- name = "tmux", - -- copy = { - -- ["+"] = { "tmux", "load-buffer", "-w", "-" }, - -- ["*"] = { "tmux", "load-buffer", "-w", "-" }, - -- }, - -- paste = { - -- ["+"] = { "bash", "-c", "tmux refresh-client -l && sleep 0.05 && tmux save-buffer -" }, - -- ["*"] = { "bash", "-c", "tmux refresh-client -l && sleep 0.05 && tmux save-buffer -" }, - -- }, - -- cache_enabled = 0, - -- } -end - -- Quickfix list vim.keymap.set("n", "q", "cclose", { desc = "Close quickfix" })