diff options
Diffstat (limited to 'pkgs/custom-neovim')
| -rw-r--r-- | pkgs/custom-neovim/config/init.lua | 6 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/colorscheme.lua | 2 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/mappings.lua | 37 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/neovide.lua | 4 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/actions-preview.lua | 3 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/persisted.lua | 6 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/which-key.lua | 9 | ||||
| -rw-r--r-- | pkgs/custom-neovim/default.nix | 5 | ||||
| -rw-r--r-- | pkgs/custom-neovim/flake.lock | 6 | ||||
| -rw-r--r-- | pkgs/custom-neovim/git-plugins.nix | 20 |
10 files changed, 75 insertions, 23 deletions
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", "<leader>f", "Open file picker", ":Telescope find_files<cr>") -mapkey("n", "<leader>c", "Open recent file picker", ":Telescope oldfiles<cr>") --- mapkey("n", "<leader>e", "Open file explorer", ":Pick explorer<cr>") -mapkey("n", "<leader>b", "Open buffer picker", ":Telescope buffers<cr>") -mapkey("n", "<leader>/", "Open live grep picker", ":Telescope live_grep<cr>") -mapkey("n", "<leader>\\", "Open command palette", ":Telescope commands<cr>") -mapkey("n", "<leader>?", "Open help picker", ":Telescope help<cr>") -mapkey("n", "<leader>'", "Open last picker", ":Telescope resume<cr>") +mapkey("n", "<leader>f", "Open file picker", Snacks.picker.files) +mapkey("n", "<leader>c", "Open recent file picker", Snacks.picker.recent) +mapkey("n", "<leader>e", "Open file explorer", Snacks.picker.explorer) +mapkey("n", "<leader>b", "Open buffer picker", Snacks.picker.buffers) +mapkey("n", "<leader>B", "Open buffer live grep picker", Snacks.picker.grep_buffers) +mapkey("n", "<leader>y", "Open clipboard history picker", Snacks.picker.cliphist) +mapkey("n", "<leader>/", "Open live grep picker", Snacks.picker.grep) +mapkey("n", "<leader>\\", "Open command palette", Snacks.picker.commands) +mapkey("n", "<leader>?", "Open help picker", Snacks.picker.help) +mapkey("n", "<leader>p", "Open picker picker", Snacks.picker.pickers) +mapkey("n", "<leader>'", "Open last picker", Snacks.picker.resume) + +-- Commenting. +mapkey("n", "<C-c>", "Comment line", ":norm gcc<cr>") +mapkey("v", "<C-c>", "Comment line", ":norm gc<cr>") -- Tabs mapkey("n", "<leader>t", "Manage tabs", "") @@ -21,6 +28,10 @@ mapkey("n", "<leader>tq", "Close tab", ":tabclose<cr>") mapkey("n", "<leader>tn", "Go to next tab", ":tabnext<cr>") mapkey("n", "<leader>tp", "Go to previous tab", ":tabprev<cr>") +-- Sessions +mapkey("n", "<leader>s", "Manage sessions", "") +mapkey("n", "<leader>ss", "Open session picker", ":SessionSelect<cr") + -- QOL Keys mapkey("t", "<Esc><Esc>", "Exit terminal insert mode", "<C-\\><C-n>") vim.keymap.set("c", "<cr>", function() @@ -28,3 +39,13 @@ vim.keymap.set("c", "<cr>", function() return '<cr>' end, { expr = true }) -- Make enter complete command. mapkey("n", "<esc>", "Clear highlights", ":noh<cr>") -- 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"}, "<left>", "Correct the keypress", function() print("Try pressing h instead.") end) +mapkey({"n", "v"}, "<down>", "Correct the keypress", function() print("Try pressing j instead.") end) +mapkey({"n", "v"}, "<up>", "Correct the keypress", function() print("Try pressing k instead.") end) +mapkey({"n", "v"}, "<right>", "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", "<C-=>", function() - change_scale_factor(1) + change_scale_factor(0.05) end) vim.keymap.set("n", "<C-->", 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 = {"<c-w>", modes = {"n"}}, +-- loop = true, -- this will keep the popup open until you hit <esc> +-- }) diff --git a/pkgs/custom-neovim/default.nix b/pkgs/custom-neovim/default.nix index 20c32e1..860e476 100644 --- a/pkgs/custom-neovim/default.nix +++ b/pkgs/custom-neovim/default.nix @@ -35,12 +35,10 @@ in nvim-treesitter.withAllGrammars # All treesitter grammars. tabby-nvim # Tab bar. lualine-nvim # Status line. - telescope-nvim # Picker. # plenary-nvim # General Library. - plenary-nvim-git + # plenary-nvim-git alpha-nvim # Dashboard. persisted-nvim # Session manager. - # which-key-nvim which-key-nvim-git snacks-nvim @@ -65,6 +63,7 @@ in # LSP Servers lua-language-server # Lua LS nixd # Nix LS + nil marksman # Markdown LS # Formatters diff --git a/pkgs/custom-neovim/flake.lock b/pkgs/custom-neovim/flake.lock index 2750e17..dfbed26 100644 --- a/pkgs/custom-neovim/flake.lock +++ b/pkgs/custom-neovim/flake.lock @@ -37,11 +37,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1751949589, - "narHash": "sha256-mgFxAPLWw0Kq+C8P3dRrZrOYEQXOtKuYVlo9xvPntt8=", + "lastModified": 1752077645, + "narHash": "sha256-HM791ZQtXV93xtCY+ZxG1REzhQenSQO020cu6rHtAPk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9b008d60392981ad674e04016d25619281550a9d", + "rev": "be9e214982e20b8310878ac2baa063a961c1bdf6", "type": "github" }, "original": { diff --git a/pkgs/custom-neovim/git-plugins.nix b/pkgs/custom-neovim/git-plugins.nix new file mode 100644 index 0000000..6e26e40 --- /dev/null +++ b/pkgs/custom-neovim/git-plugins.nix @@ -0,0 +1,20 @@ +{pkgs, ...}: { + plenary-nvim-git = pkgs.vimPlugins.plenary-nvim.overrideAttrs (old: { + version = "git"; + src = pkgs.fetchFromGitHub { + owner = "emmanueltouzery"; + repo = "plenary.nvim"; + rev = "7750bc895a1f06aa7a940f5aea43671a74143be0"; + sha256 = "sha256-9Un7ekhBxcnmFE1xjCCFTZ7eqIbmXvQexpnhduAg4M0="; + }; + }); # go back to regular plenary when this commit is merged: https://github.com/nvim-lua/plenary.nvim/pull/649 + which-key-nvim-git = pkgs.vimPlugins.which-key-nvim.overrideAttrs (old: { + version = "git"; + src = pkgs.fetchFromGitHub { + owner = "cameronr"; + repo = "which-key.nvim"; + rev = "ab1a3b0d3005a95507ba6c18b96531d430370885"; + sha256 = "sha256-Zbs+Xd6kGfR+s/f6xhxXBdKJA2N4WqcJDPWVkGaM7S0="; + }; + }); # go back to regular which-key when this commit is merged: https://github.com/folke/which-key.nvim/pull/974 +} |
