From 33110b04651e1bedd8189a95c661bed0b952bd64 Mon Sep 17 00:00:00 2001 From: jasmine Date: Thu, 15 May 2025 17:56:05 +0800 Subject: [PATCH 1/2] migrate to oil.nvim --- config/default.nix | 2 +- config/plugins/editor/sessions.nix | 4 ---- config/plugins/ui/neo-tree.nix | 22 ---------------------- config/plugins/utils/oil.nix | 16 ++++++++++++++++ 4 files changed, 17 insertions(+), 27 deletions(-) delete mode 100644 config/plugins/ui/neo-tree.nix create mode 100644 config/plugins/utils/oil.nix diff --git a/config/default.nix b/config/default.nix index f8466cb..41bb13f 100644 --- a/config/default.nix +++ b/config/default.nix @@ -18,7 +18,6 @@ # UI plugins ./plugins/ui/lualine.nix - ./plugins/ui/neo-tree.nix ./plugins/ui/web-devicons.nix ./plugins/ui/whichkey.nix @@ -34,6 +33,7 @@ # Utils ./plugins/utils/markdown-preview.nix ./plugins/utils/render-markdown.nix + ./plugins/utils/oil.nix ./plugins/utils/telescope.nix ./plugins/utils/todo-comments.nix ./plugins/utils/vimtex.nix diff --git a/config/plugins/editor/sessions.nix b/config/plugins/editor/sessions.nix index 265adab..b627ce8 100644 --- a/config/plugins/editor/sessions.nix +++ b/config/plugins/editor/sessions.nix @@ -1,10 +1,6 @@ { ... }: { plugins.auto-session = { enable = true; - settings = { - pre_save_cmds = ["Neotree close"]; - post_restore_cmds = ["Neotree show"]; - }; }; keymaps = [ diff --git a/config/plugins/ui/neo-tree.nix b/config/plugins/ui/neo-tree.nix deleted file mode 100644 index 5d643da..0000000 --- a/config/plugins/ui/neo-tree.nix +++ /dev/null @@ -1,22 +0,0 @@ -{...}: { - plugins.neo-tree = { - enable = true; - eventHandlers = { - neo_tree_window_after_open = '' - function(_) - vim.cmd("wincmd =") - end - ''; - }; - closeIfLastWindow = true; - }; - - keymaps = [ - { - mode = "n"; - key = "e"; - action = "Neotree"; - options.desc = "focus_neotree"; - } - ]; -} diff --git a/config/plugins/utils/oil.nix b/config/plugins/utils/oil.nix new file mode 100644 index 0000000..89ed043 --- /dev/null +++ b/config/plugins/utils/oil.nix @@ -0,0 +1,16 @@ +{ ... }: { + plugins.oil = { + enable = true; + }; + + keymaps = [ + { + mode = "n"; + key = "-"; + action = "Oil"; + options = { + desc = "Open parent directory"; + }; + } + ]; +} From b54625d28553402a17d8936eda5245ef8d555718 Mon Sep 17 00:00:00 2001 From: jasmine Date: Thu, 15 May 2025 18:27:26 +0800 Subject: [PATCH 2/2] update telescope keymap --- config/keymaps.nix | 9 +++++ config/plugins/editor/sessions.nix | 4 +- config/plugins/lsp/conform.nix | 4 +- config/plugins/utils/telescope.nix | 63 +++++++++++++----------------- 4 files changed, 41 insertions(+), 39 deletions(-) diff --git a/config/keymaps.nix b/config/keymaps.nix index 2266688..b87f479 100644 --- a/config/keymaps.nix +++ b/config/keymaps.nix @@ -11,6 +11,15 @@ }; } + { # prefix: find + mode = ["n"]; + key = "f"; + action = ""; + options = { + desc = "+find"; + }; + } + { # focus window left mode = ["n"]; key = ""; diff --git a/config/plugins/editor/sessions.nix b/config/plugins/editor/sessions.nix index b627ce8..4230e55 100644 --- a/config/plugins/editor/sessions.nix +++ b/config/plugins/editor/sessions.nix @@ -6,10 +6,10 @@ keymaps = [ { mode = ["n"]; - key = "ss"; + key = "fs"; action = ":SessionSearch"; options = { - desc = "Search sessions"; + desc = "Find sessions"; silent = true; }; } diff --git a/config/plugins/lsp/conform.nix b/config/plugins/lsp/conform.nix index 8631886..520bdfd 100644 --- a/config/plugins/lsp/conform.nix +++ b/config/plugins/lsp/conform.nix @@ -56,14 +56,14 @@ keymaps = [ { mode = ""; - key = "f"; + key = "F"; action.__raw = '' function() require('conform').format { async = true, lsp_fallback = true } end ''; options = { - desc = "format_buffer"; + desc = "Format buffer"; }; } ]; diff --git a/config/plugins/utils/telescope.nix b/config/plugins/utils/telescope.nix index 9002a02..5c63029 100644 --- a/config/plugins/utils/telescope.nix +++ b/config/plugins/utils/telescope.nix @@ -12,47 +12,40 @@ # Configure our telescope keymaps. keymaps = { - "/" = { - action = "live_grep"; - options = { - desc = "live_grep"; - }; - }; - ":" = { - action = "command_history"; - options = { - desc = "command_history"; - }; - }; - - # Search - "sb" = { - action = "buffers"; - options = { - desc = "Search open buffers"; - }; - }; - "sc" = { - action = "commands"; - options = { - desc = "Search Commands"; - }; - }; - "sf" = { + # Find + "ff" = { action = "find_files"; options = { - desc = "Search project files"; + desc = "Find project files"; + }; + }; + "fg" = { + action = "live_grep"; + options = { + desc = "Find pattern"; + }; + }; + "fb" = { + action = "buffers"; + options = { + desc = "Find open buffers"; + }; + }; + "fh" = { + action = "help_tags"; + options = { + desc = "Find help tags"; + }; + }; + "fc" = { + action = "commands"; + options = { + desc = "Find commands"; }; }; - # List + # Git List "glc" = { - action = "git_bcommits"; - options = { - desc = "List git commits"; - }; - }; - "glC" = { action = "git_commits"; options = { desc = "List git commits";