From 4675a023e85fb0c188cbf1916decff43ab95a692 Mon Sep 17 00:00:00 2001 From: triethyl Date: Tue, 15 Jul 2025 14:47:28 -0400 Subject: working on custom neovim --- pkgs/custom-neovim/config/init.lua | 6 ++-- pkgs/custom-neovim/config/lua/colorscheme.lua | 2 +- pkgs/custom-neovim/config/lua/mappings.lua | 37 +++++++++++++++++----- pkgs/custom-neovim/config/lua/neovide.lua | 4 +-- .../config/lua/plugins/actions-preview.lua | 3 ++ .../custom-neovim/config/lua/plugins/persisted.lua | 6 ++-- .../custom-neovim/config/lua/plugins/which-key.lua | 9 +++++- 7 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 pkgs/custom-neovim/config/lua/plugins/actions-preview.lua (limited to 'pkgs/custom-neovim/config') diff --git a/pkgs/custom-neovim/config/init.lua b/pkgs/custom-neovim/config/init.lua index 503f174..41b518b 100644 --- a/pkgs/custom-neovim/config/init.lua +++ b/pkgs/custom-neovim/config/init.lua @@ -4,7 +4,6 @@ require("art") -- Require config parts. require("options") -require("mappings") require("autocommands") require("colorscheme") require("neovide") @@ -13,12 +12,15 @@ require("neovide") -- UI Plugins: require("plugins.lualine") require("plugins.tabby") --- require("plugins.telescope") require("plugins.which-key") require("plugins.snacks") +-- require("plugins.alpha") -- LSP Plugins: require("plugins.lspconfig") -- Misc Plugins: require("plugins.presence") + +-- Require mappings last. +require("mappings") diff --git a/pkgs/custom-neovim/config/lua/colorscheme.lua b/pkgs/custom-neovim/config/lua/colorscheme.lua index ed03aef..03f0ad3 100644 --- a/pkgs/custom-neovim/config/lua/colorscheme.lua +++ b/pkgs/custom-neovim/config/lua/colorscheme.lua @@ -25,7 +25,7 @@ vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, { link_highlight("TelescopePromptPrefix", "Variable") -- Snacks-specific highlights - link_highlight("SnacksPickerDir", "SnacksPickerFile") + -- link_highlight("SnacksPickerDir", "SnacksPickerFile") end end, }) diff --git a/pkgs/custom-neovim/config/lua/mappings.lua b/pkgs/custom-neovim/config/lua/mappings.lua index 15a28e5..dcad4b2 100644 --- a/pkgs/custom-neovim/config/lua/mappings.lua +++ b/pkgs/custom-neovim/config/lua/mappings.lua @@ -5,14 +5,21 @@ local mapkey = utils.mapkey vim.g.mapleader = ' ' -- Pickers -mapkey("n", "f", "Open file picker", ":Telescope find_files") -mapkey("n", "c", "Open recent file picker", ":Telescope oldfiles") --- mapkey("n", "e", "Open file explorer", ":Pick explorer") -mapkey("n", "b", "Open buffer picker", ":Telescope buffers") -mapkey("n", "/", "Open live grep picker", ":Telescope live_grep") -mapkey("n", "\\", "Open command palette", ":Telescope commands") -mapkey("n", "?", "Open help picker", ":Telescope help") -mapkey("n", "'", "Open last picker", ":Telescope resume") +mapkey("n", "f", "Open file picker", Snacks.picker.files) +mapkey("n", "c", "Open recent file picker", Snacks.picker.recent) +mapkey("n", "e", "Open file explorer", Snacks.picker.explorer) +mapkey("n", "b", "Open buffer picker", Snacks.picker.buffers) +mapkey("n", "B", "Open buffer live grep picker", Snacks.picker.grep_buffers) +mapkey("n", "y", "Open clipboard history picker", Snacks.picker.cliphist) +mapkey("n", "/", "Open live grep picker", Snacks.picker.grep) +mapkey("n", "\\", "Open command palette", Snacks.picker.commands) +mapkey("n", "?", "Open help picker", Snacks.picker.help) +mapkey("n", "p", "Open picker picker", Snacks.picker.pickers) +mapkey("n", "'", "Open last picker", Snacks.picker.resume) + +-- Commenting. +mapkey("n", "", "Comment line", ":norm gcc") +mapkey("v", "", "Comment line", ":norm gc") -- Tabs mapkey("n", "t", "Manage tabs", "") @@ -21,6 +28,10 @@ mapkey("n", "tq", "Close tab", ":tabclose") mapkey("n", "tn", "Go to next tab", ":tabnext") mapkey("n", "tp", "Go to previous tab", ":tabprev") +-- Sessions +mapkey("n", "s", "Manage sessions", "") +mapkey("n", "ss", "Open session picker", ":SessionSelect", "Exit terminal insert mode", "") vim.keymap.set("c", "", function() @@ -28,3 +39,13 @@ vim.keymap.set("c", "", function() return '' end, { expr = true }) -- Make enter complete command. mapkey("n", "", "Clear highlights", ":noh") -- Make esc clear highlights + +-- Visual Movement Keys. +mapkey({"n", "v"}, "j", "Go down visually", "gj") +mapkey({"n", "v"}, "k", "Go up visually", "gk") + +-- Learn hjkl. +mapkey({"n", "v"}, "", "Correct the keypress", function() print("Try pressing h instead.") end) +mapkey({"n", "v"}, "", "Correct the keypress", function() print("Try pressing j instead.") end) +mapkey({"n", "v"}, "", "Correct the keypress", function() print("Try pressing k instead.") end) +mapkey({"n", "v"}, "", "Correct the keypress", function() print("Try pressing l instead.") end) diff --git a/pkgs/custom-neovim/config/lua/neovide.lua b/pkgs/custom-neovim/config/lua/neovide.lua index dc804fc..d088413 100644 --- a/pkgs/custom-neovim/config/lua/neovide.lua +++ b/pkgs/custom-neovim/config/lua/neovide.lua @@ -8,10 +8,10 @@ if vim.g.neovide then vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + delta end vim.keymap.set("n", "", function() - change_scale_factor(1) + change_scale_factor(0.05) end) vim.keymap.set("n", "", function() - change_scale_factor(-1) + change_scale_factor(-0.05) end) -- Standard terminal emulator keymaps. diff --git a/pkgs/custom-neovim/config/lua/plugins/actions-preview.lua b/pkgs/custom-neovim/config/lua/plugins/actions-preview.lua new file mode 100644 index 0000000..0e3cc02 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/actions-preview.lua @@ -0,0 +1,3 @@ +require("actions-preview").setup { + backend = {"snacks"} +} diff --git a/pkgs/custom-neovim/config/lua/plugins/persisted.lua b/pkgs/custom-neovim/config/lua/plugins/persisted.lua index d3a5814..6f0273e 100644 --- a/pkgs/custom-neovim/config/lua/plugins/persisted.lua +++ b/pkgs/custom-neovim/config/lua/plugins/persisted.lua @@ -1,3 +1,3 @@ -require("persisted").setup() - -require("telescope").load_extension("persisted") +require("persisted").setup { + autostart = true, +} diff --git a/pkgs/custom-neovim/config/lua/plugins/which-key.lua b/pkgs/custom-neovim/config/lua/plugins/which-key.lua index 612af14..3d31fa7 100644 --- a/pkgs/custom-neovim/config/lua/plugins/which-key.lua +++ b/pkgs/custom-neovim/config/lua/plugins/which-key.lua @@ -1,3 +1,10 @@ require("which-key").setup { - preset = "modern", + preset = "helix", + delay = 0, } + +-- Show hydra mode for changing windows +-- require("which-key").show({ +-- keys = {"", modes = {"n"}}, +-- loop = true, -- this will keep the popup open until you hit +-- }) -- cgit v1.2.3