From 8ca815550f676d13e11980ae33aec0eb90d1b1e6 Mon Sep 17 00:00:00 2001 From: jasmine Date: Tue, 6 Aug 2024 13:11:01 +0800 Subject: [PATCH 1/4] Update telescope --- config/plugins/utils/neoclip.nix | 18 ++++++++ config/plugins/utils/software-licenses.nix | 14 ++++++ config/plugins/utils/telescope.nix | 50 +++++++++++++++++++++- 3 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 config/plugins/utils/neoclip.nix create mode 100644 config/plugins/utils/software-licenses.nix diff --git a/config/plugins/utils/neoclip.nix b/config/plugins/utils/neoclip.nix new file mode 100644 index 0000000..ff81c2f --- /dev/null +++ b/config/plugins/utils/neoclip.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: + +{ + extraPlugins = [(pkgs.vimUtils.buildVimPlugin { + name = "neoclip"; + src = pkgs.fetchFromGitHub { + owner = "AckslD"; + repo = "nvim-neoclip.lua"; + rev = "709c97f"; + hash = "sha256-8ZPmxVM4dzjJxAYUHRMCiAQBxZEGHtsgSCNlCZBRBWo="; + }; + })]; + + extraConfigLua = "require('neoclip').setup({ + default_register = {'\"', '+'} + })"; +} + diff --git a/config/plugins/utils/software-licenses.nix b/config/plugins/utils/software-licenses.nix new file mode 100644 index 0000000..c3784ce --- /dev/null +++ b/config/plugins/utils/software-licenses.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: + +{ + extraPlugins = [(pkgs.vimUtils.buildVimPlugin { + name = "software-licenses"; + src = pkgs.fetchFromGitHub { + owner = "chip"; + repo = "telescope-software-licenses.nvim"; + rev = "fb5fc33"; + hash = "sha256-luyCjkZSm1F6qoRpP5hHRAx4632u6JFuX2s7m2s8y60="; + }; + })]; +} + diff --git a/config/plugins/utils/telescope.nix b/config/plugins/utils/telescope.nix index 745263b..f261d60 100644 --- a/config/plugins/utils/telescope.nix +++ b/config/plugins/utils/telescope.nix @@ -1,17 +1,63 @@ { ... }: { + imports = [ + ./neoclip.nix # Persistent clipboard. + ./software-licenses.nix # View common software licenses. + ]; + plugins.telescope = { enable = true; + # Install some telescope extensions. + extensions = { + # Enable native fuzzy finder. + fzf-native = { + enable = true; + }; + }; + + # Configure our telescope keymaps. keymaps = { "ff" = { action = "find_files"; - options.desc = "Find Files"; + options = { + desc = "Find project files"; + }; }; "fb" = { action = "buffers"; - options.desc = "Buffers"; + options = { + desc = "Find open buffers"; + }; + }; + "/" = { + action = "live_grep"; + options = { + desc = "Grep (root dir)"; + }; + }; + ":" = { + action = "command_history"; + options = { + desc = "Command History"; + }; + }; + "p" = { + action = "neoclip"; + options.desc = "Persistent Clipboard"; + }; + "sc" = { + action = "commands"; + options = { + desc = "Search Commands"; + }; + }; + "sl" = { + action = "software-licenses find"; + options = { + desc = "Search Software Licenses"; + }; }; }; }; From aad30182e6f4e79e7cbe74e7421ac7dc9a240e2c Mon Sep 17 00:00:00 2001 From: jasmine Date: Tue, 6 Aug 2024 16:05:45 +0800 Subject: [PATCH 2/4] Update lualine --- config/plugins/ui/lualine.nix | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/config/plugins/ui/lualine.nix b/config/plugins/ui/lualine.nix index c52baf7..49be531 100644 --- a/config/plugins/ui/lualine.nix +++ b/config/plugins/ui/lualine.nix @@ -16,7 +16,11 @@ sectionSeparators = { left = ""; right = ""; }; # Display components in tabline - tabline.lualine_a = [ { name = "buffers"; } ]; + tabline = { + lualine_a = [ { name = "buffers"; } ]; + lualine_x = [ { name = "hostname"; } ]; + lualine_z = [ { name = "encoding"; } ]; + }; # Lualine has sections as shown below # +-------------------------------------------------+ @@ -24,7 +28,7 @@ # +-------------------------------------------------+ sections = { # Section A - lualine_a = [ { name = "mode"; icon = ""; } ]; + lualine_a = [ { name = "mode"; } ]; # Section B lualine_b = [ @@ -34,34 +38,30 @@ # Git diff status { name = "diff"; extraConfig.symbols = { - added = " "; - modified = " "; - removed = " "; - }; - } - - # Diagnostic count from nvim_lsp - { name = "diagnostics"; - extraConfig = { - sources = [ "nvim_lsp" ]; - symbols = { - error = " "; - warn = " "; - info = " "; - hint = "󰝶 "; - }; + added = "+"; + modified = "~"; + removed = "-"; }; } ]; # Section C - lualine_c = [ { name = "filename"; extraConfig = { path = 1; }; } ]; + lualine_c = [ { name = "filename"; } ]; # Section X lualine_x = [ - { name = "encoding"; } - { name = "fileformat"; } - { name = "filetype"; } + # Diagnostic count from nvim_lsp + { name = "diagnostics"; + extraConfig = { + sources = [ "nvim_lsp" ]; + symbols = { + error = "error:"; + warn = "warning:"; + info = "info:"; + hint = "hint:"; + }; + }; + } ]; # Section Y From 72d54681196987a8dd7de9901cb9ca29b3dd9094 Mon Sep 17 00:00:00 2001 From: jasmine Date: Tue, 6 Aug 2024 21:06:23 +0800 Subject: [PATCH 3/4] Update gitsigns --- config/plugins/git/gitsigns.nix | 102 ++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/config/plugins/git/gitsigns.nix b/config/plugins/git/gitsigns.nix index 8b2e57d..010f9dd 100644 --- a/config/plugins/git/gitsigns.nix +++ b/config/plugins/git/gitsigns.nix @@ -4,5 +4,107 @@ plugins.gitsigns = { enable = true; }; + + keymaps = [ + { + mode = [ "n" "v" ]; + key = "hs"; + action = "Gitsigns stage_hunk"; + options = { + silent = true; + desc = "Stage Hunk"; + }; + } + + { + mode = [ "n" "v" ]; + key = "hr"; + action = "Gitsigns reset_hunk"; + options = { + silent = true; + desc = "Reset Hunk"; + }; + } + + { + mode = "n"; + key = "hS"; + action = "Gitsigns stage_buffer"; + options = { + silent = true; + desc = "Stage Buffer"; + }; + } + + { + mode = "n"; + key = "hu"; + action = "Gitsigns undo_stage_hunk"; + options = { + silent = true; + desc = "Undo Staged Hunk"; + }; + } + + { + mode = "n"; + key = "hR"; + action = "Gitsigns reset_buffer"; + options = { + silent = true; + desc = "Reset Buffer"; + }; + } + + { + mode = "n"; + key = "hp"; + action = "Gitsigns preview_hunk_inline"; + options = { + silent = true; + desc = "Preview Hunk"; + }; + } + + { + mode = "n"; + key = "hb"; + action = "Gitsigns blame"; + options = { + silent = true; + desc = "View Blame"; + }; + } + + { + mode = "n"; + key = "tb"; + action = "Gitsigns toggle_current_line_blame"; + options = { + silent = true; + desc = "Toggle Blame"; + }; + } + + { + mode = "n"; + key = "hd"; + action = "Gitsigns diffthis"; + options = { + silent = true; + desc = "View Diff"; + }; + } + + { + mode = "n"; + key = "td"; + action = "Gitsigns toggle_deleted"; + options = { + silent = true; + desc = "Toggle Deleted"; + }; + } + ]; } From cacb3603a6a3c0a2817e5417171d7729f5d039fa Mon Sep 17 00:00:00 2001 From: jasmine Date: Tue, 6 Aug 2024 21:06:54 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 399c6ad..e104592 100644 --- a/README.md +++ b/README.md @@ -35,4 +35,4 @@ nix run git+https://git.sajenim.dev/jasmine/nvim.nix.git ## References * [dc-tec/nixvim](https://github.com/dc-tec/nixvim) - +* [elythh/nixvim](https://github.com/elythh/nixvim)