diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2024-10-03 22:03:12 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2024-10-03 22:03:12 +0530 |
| commit | 1474caa8f624aa568ea011629d1aec4ae2aca3c1 (patch) | |
| tree | 52ba6bda3c8b2b7839543e71271931122b587900 /modules/tools | |
| parent | 6349cff878c36336ed9027423aaebf98ac883501 (diff) | |
| download | home-manager-config-1474caa8f624aa568ea011629d1aec4ae2aca3c1.tar.gz home-manager-config-1474caa8f624aa568ea011629d1aec4ae2aca3c1.zip | |
Using fzf as the application launcher.
Diffstat (limited to 'modules/tools')
| -rw-r--r-- | modules/tools/default.nix | 3 | ||||
| -rw-r--r-- | modules/tools/editor/neovim/config/keybindings.lua | 3 | ||||
| -rw-r--r-- | modules/tools/editor/neovim/config/options.lua | 16 | ||||
| -rw-r--r-- | modules/tools/editor/neovim/plugins/config/default.nix | 1 | ||||
| -rw-r--r-- | modules/tools/editor/neovim/plugins/config/dressing.lua | 1 | ||||
| -rw-r--r-- | modules/tools/editor/neovim/plugins/config/lsp-config.lua | 17 | ||||
| -rw-r--r-- | modules/tools/editor/neovim/plugins/config/nvim-tree.lua | 2 | ||||
| -rw-r--r-- | modules/tools/editor/neovim/plugins/default.nix | 2 | ||||
| -rw-r--r-- | modules/tools/file-manager/nnn/default.nix | 13 | ||||
| -rw-r--r-- | modules/tools/fzf/default.nix | 35 | ||||
| -rw-r--r-- | modules/tools/git/default.nix | 12 |
11 files changed, 78 insertions, 27 deletions
diff --git a/modules/tools/default.nix b/modules/tools/default.nix index bf96557..266e900 100644 --- a/modules/tools/default.nix +++ b/modules/tools/default.nix @@ -1,9 +1,10 @@ -{ lib, config, ... }: +{ ... }: { imports = [ ./editor ./file-manager + ./fzf ./git ./system-monitor ./viewer diff --git a/modules/tools/editor/neovim/config/keybindings.lua b/modules/tools/editor/neovim/config/keybindings.lua index 3e8e0fa..3f2c9bf 100644 --- a/modules/tools/editor/neovim/config/keybindings.lua +++ b/modules/tools/editor/neovim/config/keybindings.lua @@ -3,6 +3,3 @@ vim.keymap.set("n", "<C-h>", ":wincmd h<CR>", { silent = true }); vim.keymap.set("n", "<C-j>", ":wincmd j<CR>", { silent = true }); vim.keymap.set("n", "<C-k>", ":wincmd k<CR>", { silent = true }); vim.keymap.set("n", "<C-l>", ":wincmd l<CR>", { silent = true }); - --- NvimTree -vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>", { silent = true }); diff --git a/modules/tools/editor/neovim/config/options.lua b/modules/tools/editor/neovim/config/options.lua index 450e613..bd475c7 100644 --- a/modules/tools/editor/neovim/config/options.lua +++ b/modules/tools/editor/neovim/config/options.lua @@ -31,11 +31,11 @@ vim.api.nvim_create_autocmd("FileType", { }); -- Exception that use spaces --- vim.api.nvim_create_autocmd("FileType", { --- pattern = {}, --- callback = function() --- vim.bo.expandtab = true; --- vim.bo.tabstop = 2; --- vim.bo.shiftwidth = 2; --- end, --- }); +vim.api.nvim_create_autocmd("FileType", { + pattern = { "yaml" }, + callback = function() + vim.bo.expandtab = true; + vim.bo.tabstop = 2; + vim.bo.shiftwidth = 2; + end, +}); diff --git a/modules/tools/editor/neovim/plugins/config/default.nix b/modules/tools/editor/neovim/plugins/config/default.nix index 6dff0b9..81407d7 100644 --- a/modules/tools/editor/neovim/plugins/config/default.nix +++ b/modules/tools/editor/neovim/plugins/config/default.nix @@ -4,6 +4,7 @@ let extra = if config.tools.editor.neovim.configuration == "full" then '' ${builtins.readFile ./lsp-config.lua} +${builtins.readFile ./dressing.lua} ${builtins.readFile (config.scheme { template = builtins.readFile ./noice.mustache.lua; })} diff --git a/modules/tools/editor/neovim/plugins/config/dressing.lua b/modules/tools/editor/neovim/plugins/config/dressing.lua new file mode 100644 index 0000000..6d14d47 --- /dev/null +++ b/modules/tools/editor/neovim/plugins/config/dressing.lua @@ -0,0 +1 @@ +require("dressing").setup(); diff --git a/modules/tools/editor/neovim/plugins/config/lsp-config.lua b/modules/tools/editor/neovim/plugins/config/lsp-config.lua index 88f063d..d440c67 100644 --- a/modules/tools/editor/neovim/plugins/config/lsp-config.lua +++ b/modules/tools/editor/neovim/plugins/config/lsp-config.lua @@ -45,23 +45,24 @@ local lsp_setup_done = {}; -- Function to setup LSP based on filetype local function setup_lsp(filetype) local lsp = filetype_to_lsp[filetype]; - if lsp and not lsp_setup_done[lsp.server] then + if lsp ~= nil and not lsp_setup_done[lsp.server] then lsp_setup_done[lsp.server] = true; - if vim.fn.executable(lsp.executable) then + if vim.fn.executable(lsp.executable) == 1 then lspconfig[lsp.server].setup({}); - vim.lsp.start(); end end end -vim.keymap.set("n", "gd", vim.lsp.buf.definition, { noremap = true, silent = true }); -vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { noremap = true, silent = true }); -vim.keymap.set("n", "gr", vim.lsp.buf.references, { noremap = true, silent = true }); -vim.keymap.set("n", "gk", vim.lsp.buf.hover, { noremap = true, silent = true }); - vim.api.nvim_create_autocmd("FileType", { pattern = "*", -- Match all file types callback = function() setup_lsp(vim.bo.filetype); -- Call the setup_lsp function only if the filetype is in the mapping end, }); + +local lsp_keymap_opts = { noremap = true, silent = true }; + +vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, lsp_keymap_opts); +vim.keymap.set("n", "<leader>i", vim.lsp.buf.implementation, lsp_keymap_opts); +vim.keymap.set("n", "<leader>r", vim.lsp.buf.references, lsp_keymap_opts); +vim.keymap.set("n", "<leader>k", vim.lsp.buf.hover, lsp_keymap_opts); diff --git a/modules/tools/editor/neovim/plugins/config/nvim-tree.lua b/modules/tools/editor/neovim/plugins/config/nvim-tree.lua index c6c4102..cdbef6a 100644 --- a/modules/tools/editor/neovim/plugins/config/nvim-tree.lua +++ b/modules/tools/editor/neovim/plugins/config/nvim-tree.lua @@ -11,3 +11,5 @@ require("nvim-tree").setup { end, }, }; + +vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>", { silent = true }); diff --git a/modules/tools/editor/neovim/plugins/default.nix b/modules/tools/editor/neovim/plugins/default.nix index d2a58b1..61c046c 100644 --- a/modules/tools/editor/neovim/plugins/default.nix +++ b/modules/tools/editor/neovim/plugins/default.nix @@ -10,6 +10,7 @@ nvim-treesitter nvim-web-devicons nvim-tree-lua + which-key-nvim (base16-vim.overrideAttrs (old: { patchPhase = "ln -s ${config.scheme base16-vim} colors/base16-scheme.vim"; })) @@ -17,6 +18,7 @@ (if config.tools.editor.neovim.configuration == "full" then [ noice-nvim + dressing-nvim nvim-lspconfig ] else null) diff --git a/modules/tools/file-manager/nnn/default.nix b/modules/tools/file-manager/nnn/default.nix index 73b5c9d..7426153 100644 --- a/modules/tools/file-manager/nnn/default.nix +++ b/modules/tools/file-manager/nnn/default.nix @@ -5,16 +5,19 @@ enable = lib.mkEnableOption "Enables nnn."; }; - config = lib.mkIf config.tools.file-manager.nnn.enable { + config = + let + nnnWithNerdIcons = pkgs.nnn.override ({ withNerdIcons = true; }); + in lib.mkIf config.tools.file-manager.nnn.enable { tools.file-manager.default = lib.mkDefault "nnn"; tools.file-manager.command = if config.tools.file-manager.default == "nnn" then - lib.mkForce "${pkgs.nnn}/bin/nnn -H -d" + lib.mkForce "${nnnWithNerdIcons}/bin/nnn -H -d" else ""; programs.nnn.enable = true; - programs.nnn.package = pkgs.nnn.override ({ withNerdIcons = true; }); - programs.nnn.plugins.src = "${pkgs.nnn}/share/plugins"; - shell.alias."nnn" = "nnn -H -d"; + programs.nnn.package = nnnWithNerdIcons; + programs.nnn.plugins.src = "${nnnWithNerdIcons}/share/plugins"; + shell.alias."nnn" = "${nnnWithNerdIcons}/bin/nnn -H -d"; }; } diff --git a/modules/tools/fzf/default.nix b/modules/tools/fzf/default.nix new file mode 100644 index 0000000..5ed8442 --- /dev/null +++ b/modules/tools/fzf/default.nix @@ -0,0 +1,35 @@ +{ config, lib,... }: + +{ + options.tools.fzf = { + enable = lib.mkEnableOption "Enables fzf."; + }; + + config = lib.mkIf config.tools.fzf.enable { + programs.fzf.enable = true; + programs.fzf.defaultOptions = [ + "--height 40%" + "--layout=reverse" + (if config.fonts.nerdfont.fira-code.enable then "--pointer=\"\"" else "--pointer=\">\"") + "--header=\" \"" + "--border=none" + ]; + + programs.fzf.colors = with config.scheme.withHashtag; { + fg = base05; # Foreground + bg = base00; # Background + hl = base0D; # Highlight + + "fg+" = base07; # Foreground for selected item + "bg+" = base01; # Background for selected item + "hl+" = base0D; # Highlight for selected item + + info = base0B; # Info text (usually count of items) + border = base03; # Border color + prompt = base0A; # Prompt text color + pointer = base07; # Pointer color (e.g., > for selected) + marker = base0C; # Marker color (e.g., for multi-select) + spinner = base0C; # Spinner color (during search) + }; + }; +} diff --git a/modules/tools/git/default.nix b/modules/tools/git/default.nix index 135cbc6..798db39 100644 --- a/modules/tools/git/default.nix +++ b/modules/tools/git/default.nix @@ -3,12 +3,20 @@ { options.tools.git = { enable = lib.mkEnableOption "Enables git."; + username = lib.mkOption { + type = lib.types.str; + description = "Github username."; + }; + email = lib.mkOption { + type = lib.types.str; + description = "Github email."; + }; }; config = lib.mkIf config.tools.git.enable { programs.git.enable = true; - programs.git.userEmail = "54011232+arpitchakladar@users.noreply.github.com"; - programs.git.userName = "Arpit Chakladar"; + programs.git.userName = config.tools.git.username; + programs.git.userEmail = config.tools.git.email; programs.git.extraConfig = { credential.helper = "store --file ${config.xdg.cacheHome}/git/credential"; core.askPass = ""; |
