diff --git a/config/default.nix b/config/default.nix index 7159945..42d8d1e 100644 --- a/config/default.nix +++ b/config/default.nix @@ -10,5 +10,11 @@ # Syntax Highlighting ./plugins/treesitter/default.nix + + # Git + ./plugins/git/lazygit.nix + + # Utils + ./plugins/utils/telescope.nix ]; } diff --git a/config/plugins/git/lazygit.nix b/config/plugins/git/lazygit.nix new file mode 100644 index 0000000..4336ebf --- /dev/null +++ b/config/plugins/git/lazygit.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: { + + extraPlugins = with pkgs.vimPlugins; [ + lazygit-nvim + ]; + + extraConfigLua = '' + require("telescope").load_extension("lazygit") + ''; + + keymaps = [ + { + mode = "n"; + key = "gg"; + action = "LazyGit"; + options = { + desc = "LazyGit (root dir)"; + }; + } + ]; +}; diff --git a/config/plugins/utils/telescope.nix b/config/plugins/utils/telescope.nix new file mode 100644 index 0000000..ddcb801 --- /dev/null +++ b/config/plugins/utils/telescope.nix @@ -0,0 +1,210 @@ +{ + plugins.telescope = { + enable = true; + extensions = { + file-browser = { + enable = true; + }; + fzf-native = { + enable = true; + }; + }; + settings = { + defaults = { + layout_config = { + horizontal = { + prompt_position = "top"; + }; + }; + sorting_strategy = "ascending"; + }; + }; + keymaps = { + "" = { + action = "find_files, {}"; + options = { + desc = "Find project files"; + }; + }; + "/" = { + action = "live_grep"; + options = { + desc = "Grep (root dir)"; + }; + }; + ":" = { + action = "command_history, {}"; + options = { + desc = "Command History"; + }; + }; + "b" = { + action = "buffers, {}"; + options = { + desc = "+buffer"; + }; + }; + "ff" = { + action = "find_files, {}"; + options = { + desc = "Find project files"; + }; + }; + "fr" = { + action = "live_grep, {}"; + options = { + desc = "Find text"; + }; + }; + "fR" = { + action = "resume, {}"; + options = { + desc = "Resume"; + }; + }; + "fg" = { + action = "oldfiles, {}"; + options = { + desc = "Recent"; + }; + }; + "fb" = { + action = "buffers, {}"; + options = { + desc = "Buffers"; + }; + }; + "" = { + action = "git_files, {}"; + options = { + desc = "Search git files"; + }; + }; + "gc" = { + action = "git_commits, {}"; + options = { + desc = "Commits"; + }; + }; + "gs" = { + action = "git_status, {}"; + options = { + desc = "Status"; + }; + }; + "sa" = { + action = "autocommands, {}"; + options = { + desc = "Auto Commands"; + }; + }; + "sb" = { + action = "current_buffer_fuzzy_find, {}"; + options = { + desc = "Buffer"; + }; + }; + "sc" = { + action = "command_history, {}"; + options = { + desc = "Command History"; + }; + }; + "sC" = { + action = "commands, {}"; + options = { + desc = "Commands"; + }; + }; + "sD" = { + action = "diagnostics, {}"; + options = { + desc = "Workspace diagnostics"; + }; + }; + "sh" = { + action = "help_tags, {}"; + options = { + desc = "Help pages"; + }; + }; + "sH" = { + action = "highlights, {}"; + options = { + desc = "Search Highlight Groups"; + }; + }; + "sk" = { + action = "keymaps, {}"; + options = { + desc = "Keymaps"; + }; + }; + "sM" = { + action = "man_pages, {}"; + options = { + desc = "Man pages"; + }; + }; + "sm" = { + action = "marks, {}"; + options = { + desc = "Jump to Mark"; + }; + }; + "so" = { + action = "vim_options, {}"; + options = { + desc = "Options"; + }; + }; + "sR" = { + action = "resume, {}"; + options = { + desc = "Resume"; + }; + }; + "uC" = { + action = "colorscheme, {}"; + options = { + desc = "Colorscheme preview"; + }; + }; + }; + }; + keymaps = [ + { + mode = "n"; + key = "sd"; + action = "Telescope diagnostics bufnr=0"; + options = { + desc = "Document diagnostics"; + }; + } + { + mode = "n"; + key = "fe"; + action = "Telescope file_browser"; + options = { + desc = "File browser"; + }; + } + { + mode = "n"; + key = "fE"; + action = "Telescope file_browser path=%:p:h select_buffer=true"; + options = { + desc = "File browser"; + }; + } + ]; + extraConfigLua = '' + require("telescope").setup{ + pickers = { + colorscheme = { + enable_preview = true + } + } + } + ''; +}