From 085ff668ab45ac8d57c093e502b1175a86f2c14e Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Thu, 10 Jul 2025 01:29:48 +0530 Subject: Removed unnecessary packages. --- modules/tools/bat/default.nix | 22 ++ modules/tools/bat/theme.mustache.tmTheme | 120 ++++++++ modules/tools/default.nix | 15 +- modules/tools/editor/default.nix | 7 - modules/tools/editor/neovim/config/default.nix | 4 - modules/tools/editor/neovim/config/keybindings.lua | 5 - modules/tools/editor/neovim/config/options.lua | 41 --- modules/tools/editor/neovim/default.nix | 36 --- .../neovim/plugins/config/base16.mustache.lua | 12 - .../tools/editor/neovim/plugins/config/comment.lua | 1 - .../tools/editor/neovim/plugins/config/default.nix | 27 -- .../editor/neovim/plugins/config/dressing.lua | 1 - .../editor/neovim/plugins/config/lsp-config.lua | 75 ----- .../neovim/plugins/config/lualine.mustache.lua | 61 ---- .../neovim/plugins/config/noice.mustache.lua | 10 - .../editor/neovim/plugins/config/nvim-tree.lua | 15 - .../editor/neovim/plugins/config/nvim-ufo.lua | 21 -- .../editor/neovim/plugins/config/treesitter.nix | 13 - .../editor/neovim/plugins/config/which-key.lua | 5 - modules/tools/editor/neovim/plugins/default.nix | 31 -- modules/tools/feh/default.nix | 11 + modules/tools/file-manager/default.nix | 24 -- modules/tools/file-manager/lf/default.nix | 32 -- modules/tools/file-manager/lf/icons | 334 --------------------- modules/tools/file-manager/lsd/default.nix | 13 - modules/tools/file-manager/nnn/default.nix | 23 -- modules/tools/fzf/default.nix | 42 +++ modules/tools/htop/default.nix | 12 + modules/tools/kitty/default.nix | 47 +++ modules/tools/lsd/default.nix | 12 + modules/tools/neovim/config/default.nix | 4 + modules/tools/neovim/config/keybindings.lua | 5 + modules/tools/neovim/config/options.lua | 41 +++ modules/tools/neovim/default.nix | 36 +++ .../neovim/plugins/config/base16.mustache.lua | 12 + modules/tools/neovim/plugins/config/comment.lua | 1 + modules/tools/neovim/plugins/config/default.nix | 27 ++ modules/tools/neovim/plugins/config/dressing.lua | 1 + modules/tools/neovim/plugins/config/lsp-config.lua | 75 +++++ .../neovim/plugins/config/lualine.mustache.lua | 61 ++++ .../tools/neovim/plugins/config/noice.mustache.lua | 10 + modules/tools/neovim/plugins/config/nvim-tree.lua | 15 + modules/tools/neovim/plugins/config/nvim-ufo.lua | 21 ++ modules/tools/neovim/plugins/config/treesitter.nix | 13 + modules/tools/neovim/plugins/config/which-key.lua | 5 + modules/tools/neovim/plugins/default.nix | 31 ++ modules/tools/nnn/default.nix | 16 + modules/tools/system-monitor/default.nix | 7 - modules/tools/system-monitor/htop/default.nix | 12 - modules/tools/terminal/alacritty/default.nix | 83 ----- modules/tools/terminal/default.nix | 24 -- modules/tools/terminal/kitty/default.nix | 55 ---- modules/tools/terminal/tmux/default.nix | 11 - modules/tools/utils/default.nix | 7 - modules/tools/utils/fzf/default.nix | 42 --- modules/tools/viewer/bat/default.nix | 22 -- modules/tools/viewer/bat/theme.mustache.tmTheme | 120 -------- modules/tools/viewer/default.nix | 8 - modules/tools/viewer/feh/default.nix | 11 - modules/tools/zsh/default.nix | 25 ++ modules/tools/zsh/zshrc | 23 ++ 61 files changed, 697 insertions(+), 1199 deletions(-) create mode 100644 modules/tools/bat/default.nix create mode 100644 modules/tools/bat/theme.mustache.tmTheme delete mode 100644 modules/tools/editor/default.nix delete mode 100644 modules/tools/editor/neovim/config/default.nix delete mode 100644 modules/tools/editor/neovim/config/keybindings.lua delete mode 100644 modules/tools/editor/neovim/config/options.lua delete mode 100644 modules/tools/editor/neovim/default.nix delete mode 100644 modules/tools/editor/neovim/plugins/config/base16.mustache.lua delete mode 100644 modules/tools/editor/neovim/plugins/config/comment.lua delete mode 100644 modules/tools/editor/neovim/plugins/config/default.nix delete mode 100644 modules/tools/editor/neovim/plugins/config/dressing.lua delete mode 100644 modules/tools/editor/neovim/plugins/config/lsp-config.lua delete mode 100644 modules/tools/editor/neovim/plugins/config/lualine.mustache.lua delete mode 100644 modules/tools/editor/neovim/plugins/config/noice.mustache.lua delete mode 100644 modules/tools/editor/neovim/plugins/config/nvim-tree.lua delete mode 100644 modules/tools/editor/neovim/plugins/config/nvim-ufo.lua delete mode 100644 modules/tools/editor/neovim/plugins/config/treesitter.nix delete mode 100644 modules/tools/editor/neovim/plugins/config/which-key.lua delete mode 100644 modules/tools/editor/neovim/plugins/default.nix create mode 100644 modules/tools/feh/default.nix delete mode 100644 modules/tools/file-manager/default.nix delete mode 100644 modules/tools/file-manager/lf/default.nix delete mode 100644 modules/tools/file-manager/lf/icons delete mode 100644 modules/tools/file-manager/lsd/default.nix delete mode 100644 modules/tools/file-manager/nnn/default.nix create mode 100644 modules/tools/fzf/default.nix create mode 100644 modules/tools/htop/default.nix create mode 100644 modules/tools/kitty/default.nix create mode 100644 modules/tools/lsd/default.nix create mode 100644 modules/tools/neovim/config/default.nix create mode 100644 modules/tools/neovim/config/keybindings.lua create mode 100644 modules/tools/neovim/config/options.lua create mode 100644 modules/tools/neovim/default.nix create mode 100644 modules/tools/neovim/plugins/config/base16.mustache.lua create mode 100644 modules/tools/neovim/plugins/config/comment.lua create mode 100644 modules/tools/neovim/plugins/config/default.nix create mode 100644 modules/tools/neovim/plugins/config/dressing.lua create mode 100644 modules/tools/neovim/plugins/config/lsp-config.lua create mode 100644 modules/tools/neovim/plugins/config/lualine.mustache.lua create mode 100644 modules/tools/neovim/plugins/config/noice.mustache.lua create mode 100644 modules/tools/neovim/plugins/config/nvim-tree.lua create mode 100644 modules/tools/neovim/plugins/config/nvim-ufo.lua create mode 100644 modules/tools/neovim/plugins/config/treesitter.nix create mode 100644 modules/tools/neovim/plugins/config/which-key.lua create mode 100644 modules/tools/neovim/plugins/default.nix create mode 100644 modules/tools/nnn/default.nix delete mode 100644 modules/tools/system-monitor/default.nix delete mode 100644 modules/tools/system-monitor/htop/default.nix delete mode 100644 modules/tools/terminal/alacritty/default.nix delete mode 100644 modules/tools/terminal/default.nix delete mode 100644 modules/tools/terminal/kitty/default.nix delete mode 100644 modules/tools/terminal/tmux/default.nix delete mode 100644 modules/tools/utils/default.nix delete mode 100644 modules/tools/utils/fzf/default.nix delete mode 100644 modules/tools/viewer/bat/default.nix delete mode 100644 modules/tools/viewer/bat/theme.mustache.tmTheme delete mode 100644 modules/tools/viewer/default.nix delete mode 100644 modules/tools/viewer/feh/default.nix create mode 100644 modules/tools/zsh/default.nix create mode 100644 modules/tools/zsh/zshrc (limited to 'modules/tools') diff --git a/modules/tools/bat/default.nix b/modules/tools/bat/default.nix new file mode 100644 index 0000000..d459042 --- /dev/null +++ b/modules/tools/bat/default.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +{ + options.tools.bat = { + enable = lib.mkEnableOption "Enables bat."; + }; + + config = lib.mkIf config.tools.bat.enable { + programs.bat.enable = true; + programs.bat.config = { + tabs = "4"; + theme = "custom-theme"; + }; + # shell.alias."cat" = "${pkgs.bat}/bin/bat -pp"; + # shell.alias."less" = "${pkgs.bat}/bin/bat --paging always"; + # home.sessionVariables."PAGER" = "${pkgs.bat}/bin/bat --paging always"; + xdg.configFile."bat/themes/custom-theme.tmTheme".source + = config.scheme { + template = builtins.readFile ./theme.mustache.tmTheme; + }; + }; +} diff --git a/modules/tools/bat/theme.mustache.tmTheme b/modules/tools/bat/theme.mustache.tmTheme new file mode 100644 index 0000000..844b80d --- /dev/null +++ b/modules/tools/bat/theme.mustache.tmTheme @@ -0,0 +1,120 @@ + + + + name + customTheme + settings + + + + settings + + background + #{{base00-hex}} + foreground + #{{base05-hex}} + caret + #{{base07-hex}} + invisibles + #{{base03-hex}} + lineHighlight + #{{base02-hex}} + selection + #{{base03-hex}} + + + + + + scope + comment + settings + + foreground + #{{base04-hex}} + + + + + scope + string + settings + + foreground + #{{base0A-hex}} + + + + + scope + constant.numeric + settings + + foreground + #{{base09-hex}} + + + + + scope + variable + settings + + foreground + #{{base08-hex}} + + + + + scope + keyword + settings + + foreground + #{{base0D-hex}} + + + + + scope + support.function + settings + + foreground + #{{base0E-hex}} + + + + + scope + constant.language + settings + + foreground + #{{base0B-hex}} + + + + + scope + entity.name.tag + settings + + foreground + #{{base0C-hex}} + + + + + scope + invalid + settings + + foreground + #{{base0F-hex}} + + + + + + diff --git a/modules/tools/default.nix b/modules/tools/default.nix index 0180df9..20b661d 100644 --- a/modules/tools/default.nix +++ b/modules/tools/default.nix @@ -2,12 +2,15 @@ { imports = [ - ./editor - ./file-manager + ./bat + ./feh + ./fzf ./git - ./system-monitor - ./terminal - ./utils - ./viewer + ./htop + ./kitty + ./lsd + ./neovim + ./nnn + ./zsh ]; } diff --git a/modules/tools/editor/default.nix b/modules/tools/editor/default.nix deleted file mode 100644 index fd2da1a..0000000 --- a/modules/tools/editor/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -{ - imports = [ - ./neovim - ]; -} diff --git a/modules/tools/editor/neovim/config/default.nix b/modules/tools/editor/neovim/config/default.nix deleted file mode 100644 index 4514d2f..0000000 --- a/modules/tools/editor/neovim/config/default.nix +++ /dev/null @@ -1,4 +0,0 @@ -'' -${builtins.readFile ./options.lua} -${builtins.readFile ./keybindings.lua} -'' diff --git a/modules/tools/editor/neovim/config/keybindings.lua b/modules/tools/editor/neovim/config/keybindings.lua deleted file mode 100644 index 3f2c9bf..0000000 --- a/modules/tools/editor/neovim/config/keybindings.lua +++ /dev/null @@ -1,5 +0,0 @@ --- Navigate splits -vim.keymap.set("n", "", ":wincmd h", { silent = true }); -vim.keymap.set("n", "", ":wincmd j", { silent = true }); -vim.keymap.set("n", "", ":wincmd k", { silent = true }); -vim.keymap.set("n", "", ":wincmd l", { silent = true }); diff --git a/modules/tools/editor/neovim/config/options.lua b/modules/tools/editor/neovim/config/options.lua deleted file mode 100644 index fc0b04c..0000000 --- a/modules/tools/editor/neovim/config/options.lua +++ /dev/null @@ -1,41 +0,0 @@ -vim.g.mapleader = " "; -vim.g.maplocalleader = " "; - -vim.o.clipboard = "unnamedplus"; - -vim.o.number = true; -vim.o.list = true; -vim.o.listchars = "tab:| ,trail:_,lead:_"; - -vim.o.laststatus = 3; - -vim.o.signcolumn = "auto"; -vim.opt.fillchars = { eob = " " }; - -vim.o.tabstop = 3; -vim.o.shiftwidth = 0; -vim.o.expandtab = false; - -vim.o.updatetime = 300; - -vim.o.mouse = "a"; - --- Force all filetypes to use tabs -vim.api.nvim_create_autocmd("FileType", { - pattern = "*", - callback = function() - vim.bo.expandtab = false; - vim.bo.tabstop = 3; - vim.bo.shiftwidth = 0; - end, -}); - --- Exception that use spaces -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/default.nix b/modules/tools/editor/neovim/default.nix deleted file mode 100644 index 7d257ba..0000000 --- a/modules/tools/editor/neovim/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ pkgs, config, lib, ... }: - -{ - options.tools.editor.neovim = { - enable = lib.mkEnableOption "Enables neovim."; - profile = lib.mkOption { - type = lib.types.enum [ - "minimal" - "full" - ]; - default = "minimal"; - description = "The profile for neovim to use."; - }; - }; - - config = - let - plugins = import ./plugins { inherit config pkgs lib; }; - in lib.mkIf config.tools.editor.neovim.enable { - programs.neovim.enable = true; - programs.neovim.viAlias = true; - programs.neovim.vimAlias = true; - programs.neovim.vimdiffAlias = true; - programs.neovim.defaultEditor = true; - - home.packages = plugins.requirements; - - programs.neovim.extraLuaConfig = - '' -${import ./config} -${plugins.configuration} - ''; - - programs.neovim.plugins = plugins.list; - }; -} diff --git a/modules/tools/editor/neovim/plugins/config/base16.mustache.lua b/modules/tools/editor/neovim/plugins/config/base16.mustache.lua deleted file mode 100644 index 3c13fcc..0000000 --- a/modules/tools/editor/neovim/plugins/config/base16.mustache.lua +++ /dev/null @@ -1,12 +0,0 @@ -vim.o.termguicolors = true; -vim.opt.termguicolors = true; -vim.o.background = "dark"; -vim.g.base16colorspace = 256 -vim.cmd.colorscheme("base16-scheme"); - --- Overrides --- disable the background of line numbers -vim.api.nvim_set_hl(0, "LineNr", { link = "Normal" }); - --- change the color of the pane separator -vim.api.nvim_set_hl(0, "WinSeparator", { fg = "#{{base02-hex}}", bg = "None" }); diff --git a/modules/tools/editor/neovim/plugins/config/comment.lua b/modules/tools/editor/neovim/plugins/config/comment.lua deleted file mode 100644 index 9086261..0000000 --- a/modules/tools/editor/neovim/plugins/config/comment.lua +++ /dev/null @@ -1 +0,0 @@ -require("Comment").setup(); diff --git a/modules/tools/editor/neovim/plugins/config/default.nix b/modules/tools/editor/neovim/plugins/config/default.nix deleted file mode 100644 index dcdb371..0000000 --- a/modules/tools/editor/neovim/plugins/config/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ config }: - -let - fullExtra = if config.tools.editor.neovim.profile == "full" then -'' -${builtins.readFile ./lsp-config.lua} -${builtins.readFile ./dressing.lua} -${builtins.readFile (config.scheme { - template = builtins.readFile ./noice.mustache.lua; -})} -${builtins.readFile ./nvim-ufo.lua} -${builtins.readFile ./which-key.lua} -'' - else ""; -in -'' -${builtins.readFile ./comment.lua} -${builtins.readFile (config.scheme { - template = builtins.readFile ./lualine.mustache.lua; -})} -${import ./treesitter.nix { inherit config; }} -${builtins.readFile (config.scheme { - template = builtins.readFile ./base16.mustache.lua; -})} -${builtins.readFile ./nvim-tree.lua} -${fullExtra} -'' diff --git a/modules/tools/editor/neovim/plugins/config/dressing.lua b/modules/tools/editor/neovim/plugins/config/dressing.lua deleted file mode 100644 index 6d14d47..0000000 --- a/modules/tools/editor/neovim/plugins/config/dressing.lua +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index cca4116..0000000 --- a/modules/tools/editor/neovim/plugins/config/lsp-config.lua +++ /dev/null @@ -1,75 +0,0 @@ -local lspconfig = require("lspconfig"); - -local filetype_to_lsp = { - lua = { server = "lua_ls", executable = "lua-language-server" }, - cpp = { server = "clangd", executable = "clangd" }, - c = { server = "clangd", executable = "clangd" }, - python = { server = "pyright", executable = "pyright-langserver" }, - javascript = { server = "tsserver", executable = "typescript-language-server" }, - typescript = { server = "tsserver", executable = "typescript-language-server" }, - go = { server = "gopls", executable = "gopls" }, - html = { server = "html", executable = "vscode-html-language-server" }, - css = { server = "cssls", executable = "vscode-css-language-server" }, - json = { server = "jsonls", executable = "vscode-json-language-server" }, - bash = { server = "bashls", executable = "bash-language-server" }, - graphql = { server = "graphql", executable = "graphql-lsp" }, - dockerfile = { server = "dockerls", executable = "docker-langserver" }, - php = { server = "phpactor", executable = "phpactor" }, - rust = { server = "rust_analyzer", executable = "rust-analyzer" }, - haskell = { server = "hls", executable = "haskell-language-server-wrapper" }, - deno = { server = "denols", executable = "deno" }, - vim = { server = "vimls", executable = "vim-language-server" }, - elixir = { server = "elixirls", executable = "elixir-ls" }, - clojure = { server = "clojure_lsp", executable = "clojure-lsp" }, - scala = { server = "scala_metals", executable = "metals" }, - ruby = { server = "sorbet", executable = "srb" }, - zig = { server = "zls", executable = "zls" }, - kotlin = { server = "kotlin_language_server", executable = "kotlin-language-server" }, - java = { server = "jdtls", executable = "jdtls" }, - dart = { server = "dartls", executable = "dart" }, - yaml = { server = "yamlls", executable = "yaml-language-server" }, - perl = { server = "perlls", executable = "perl" }, - r = { server = "r_language_server", executable = "R" }, - tex = { server = "texlab", executable = "texlab" }, - swift = { server = "sourcekit", executable = "sourcekit-lsp" }, - svelte = { server = "svelteserver", executable = "svelteserver" }, - terraform = { server = "terraformls", executable = "terraform-ls" }, - vue = { server = "vls", executable = "vls" }, - markdown = { server = "marksman", executable = "marksman" }, - yaml = { server = "yamlls", executable = "yaml-language-server" }, -}; - --- Keeping track of all the lsps that have been already configured -local lsp_setup_done = {}; - --- Function to setup LSP based on filetype -local function setup_lsp(filetype) - local lsp = filetype_to_lsp[filetype]; - if lsp ~= nil and not lsp_setup_done[lsp.server] then - lsp_setup_done[lsp.server] = true; - if vim.fn.executable(lsp.executable) == 1 then - lspconfig[lsp.server].setup({}); - end - end -end - -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, -}); - --- Show diagnostics in a floating window when hovering over the line -vim.api.nvim_create_autocmd("CursorHold", { - callback = function() - vim.diagnostic.open_float(nil, { focusable = false }) - end, -}) - -local lsp_keymap_opts = { noremap = true, silent = true }; - -vim.keymap.set("n", "d", vim.lsp.buf.definition, lsp_keymap_opts); -vim.keymap.set("n", "i", vim.lsp.buf.implementation, lsp_keymap_opts); -vim.keymap.set("n", "r", vim.lsp.buf.references, lsp_keymap_opts); -vim.keymap.set("n", "k", vim.lsp.buf.hover, lsp_keymap_opts); diff --git a/modules/tools/editor/neovim/plugins/config/lualine.mustache.lua b/modules/tools/editor/neovim/plugins/config/lualine.mustache.lua deleted file mode 100644 index bf4f1d1..0000000 --- a/modules/tools/editor/neovim/plugins/config/lualine.mustache.lua +++ /dev/null @@ -1,61 +0,0 @@ -local lualine_theme = { - normal = { - a = { fg = "#{{base0D-hex}}", bg = "none", gui = "bold" }, - b = { fg = "#{{base05-hex}}", bg = "none" }, - c = { fg = "#{{base05-hex}}", bg = "none" }, - }, - insert = { - a = { fg = "#{{base0B-hex}}", bg = "none", gui = "bold" }, - }, - visual = { - a = { fg = "#{{base0E-hex}}", bg = "none", gui = "bold" }, - }, - replace = { - a = { fg = "#{{base08-hex}}", bg = "none", gui = "bold" }, - }, - command = { - a = { fg = "#{{base0A-hex}}", bg = "none", gui = "bold" }, - }, - inactive = { - a = { fg = "#{{base04-hex}}", bg = "none" }, - b = { fg = "#{{base04-hex}}", bg = "none" }, - c = { fg = "#{{base04-hex}}", bg = "none" }, - }, -}; - -local function macro_recording() - local recording_register = vim.fn.reg_recording() - if recording_register ~= "" then - return "@" .. recording_register - else - return "" - end -end - -require("lualine").setup { - options = { - icons_enabled = true, - theme = lualine_theme, - section_separators = "", - component_separators = "", - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { - "branch", - { - "diff", - colored = true, - symbols = { - added = " ", - modified = " ", - removed = " ", - } - } - }, - lualine_c = { "filename" }, - lualine_x = { macro_recording, "encoding", "fileformat", "filetype" }, - lualine_y = { "progress" }, - lualine_z = { "location" }, - }, -}; diff --git a/modules/tools/editor/neovim/plugins/config/noice.mustache.lua b/modules/tools/editor/neovim/plugins/config/noice.mustache.lua deleted file mode 100644 index a258c8e..0000000 --- a/modules/tools/editor/neovim/plugins/config/noice.mustache.lua +++ /dev/null @@ -1,10 +0,0 @@ -require("noice").setup(); - -vim.api.nvim_set_hl(0, "NoiceCommandOutput", { fg = "#{{base05-hex}}", bg = "#{{base00-hex}}" }); -vim.api.nvim_set_hl(0, "NoiceCmdline", { fg = "#{{base05-hex}}", bg = "#{{base00-hex}}" }); -vim.api.nvim_set_hl(0, "NoiceCmdlinePopup", { fg = "#{{base05-hex}}", bg = "#{{base00-hex}}" }); -vim.api.nvim_set_hl(0, "NoiceCmdlinePopupBorder", { fg = "#{{base03-hex}}", bg = "#{{base00-hex}}" }); -vim.api.nvim_set_hl(0, "NoiceError", { fg = "#{{base08-hex}}", bg = "#{{base00-hex}}" }); -vim.api.nvim_set_hl(0, "NoiceWarning", { fg = "#{{base0A-hex}}", bg = "#{{base00-hex}}" }); -vim.api.nvim_set_hl(0, "NoiceInfo", { fg = "#{{base0C-hex}}", bg = "#{{base00-hex}}" }); -vim.api.nvim_set_hl(0, "NoiceHint", { fg = "#{{base0B-hex}}", bg = "#{{base00-hex}}" }); diff --git a/modules/tools/editor/neovim/plugins/config/nvim-tree.lua b/modules/tools/editor/neovim/plugins/config/nvim-tree.lua deleted file mode 100644 index cdbef6a..0000000 --- a/modules/tools/editor/neovim/plugins/config/nvim-tree.lua +++ /dev/null @@ -1,15 +0,0 @@ -require("nvim-tree").setup { - filters = { - enable = false - }, - renderer = { - indent_markers = { - enable = true - }, - root_folder_label = function(path) - return vim.fn.fnamemodify(path, ":t") - end, - }, -}; - -vim.keymap.set("n", "", ":NvimTreeToggle", { silent = true }); diff --git a/modules/tools/editor/neovim/plugins/config/nvim-ufo.lua b/modules/tools/editor/neovim/plugins/config/nvim-ufo.lua deleted file mode 100644 index 641373f..0000000 --- a/modules/tools/editor/neovim/plugins/config/nvim-ufo.lua +++ /dev/null @@ -1,21 +0,0 @@ -require("ufo").setup { - provider_selector = function(bufnr, filetype, buftype) - return { - "treesitter", - "indent" - } - end, -}; - -vim.o.foldenable = true -vim.o.foldcolumn = '0' -vim.o.foldlevel = 99 -- Ensure all folds start open -vim.o.foldlevelstart = 99 - --- press K or capslockK -vim.keymap.set("n", "", function() - local winid = ufo.peekFoldedLinesUnderCursor() - if not winid then - vim.lsp.buf.hover() - end -end) diff --git a/modules/tools/editor/neovim/plugins/config/treesitter.nix b/modules/tools/editor/neovim/plugins/config/treesitter.nix deleted file mode 100644 index be0bdb6..0000000 --- a/modules/tools/editor/neovim/plugins/config/treesitter.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config }: - -'' -require("nvim-treesitter.configs").setup { - auto_install = true, - highlight = { - enable = true, - }, - parser_install_dir = "${config.xdg.dataHome}/nvim", -}; - -vim.opt.runtimepath:append("${config.xdg.dataHome}/nvim"); -'' diff --git a/modules/tools/editor/neovim/plugins/config/which-key.lua b/modules/tools/editor/neovim/plugins/config/which-key.lua deleted file mode 100644 index 1290432..0000000 --- a/modules/tools/editor/neovim/plugins/config/which-key.lua +++ /dev/null @@ -1,5 +0,0 @@ -local wk = require("which-key"); - -vim.keymap.set("n", "h", function() - wk.show({ global = true }) -end, { silent = true }); diff --git a/modules/tools/editor/neovim/plugins/default.nix b/modules/tools/editor/neovim/plugins/default.nix deleted file mode 100644 index f801519..0000000 --- a/modules/tools/editor/neovim/plugins/default.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ config, pkgs, lib }: - -{ - configuration = import ./config { inherit config; }; - - list = with pkgs.vimPlugins; lib.mkMerge [ - [ - comment-nvim - lualine-nvim - 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"; - })) - ] - (if config.tools.editor.neovim.profile == "full" then - [ - noice-nvim - dressing-nvim - nvim-lspconfig - nvim-ufo - ] - else []) - ]; - - requirements = with pkgs; [ - gcc # for treesitter - ]; -} diff --git a/modules/tools/feh/default.nix b/modules/tools/feh/default.nix new file mode 100644 index 0000000..8aa5631 --- /dev/null +++ b/modules/tools/feh/default.nix @@ -0,0 +1,11 @@ +{ config, lib, pkgs, ... }: + +{ + options.tools.feh = { + enable = lib.mkEnableOption "Enables feh."; + }; + + config = lib.mkIf config.tools.git.enable { + programs.feh.enable = true; + }; +} diff --git a/modules/tools/file-manager/default.nix b/modules/tools/file-manager/default.nix deleted file mode 100644 index 4889f5b..0000000 --- a/modules/tools/file-manager/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ lib, ... }: - -{ - imports = [ - ./lf - ./lsd - ./nnn - ]; - - options.tools.file-manager = { - default = lib.mkOption { - type = lib.types.enum [ - "nnn" - "lf" - ]; - description = "Default file manager."; - }; - - command = lib.mkOption { - type = lib.types.str; - description = "Command for the default file manager program."; - }; - }; -} diff --git a/modules/tools/file-manager/lf/default.nix b/modules/tools/file-manager/lf/default.nix deleted file mode 100644 index 2fab997..0000000 --- a/modules/tools/file-manager/lf/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - options.tools.file-manager.lf = { - enable = lib.mkEnableOption "Enables lf."; - }; - - config = lib.mkIf config.tools.file-manager.lf.enable { - tools.file-manager.default = lib.mkDefault "lf"; - tools.file-manager.command = - lib.mkIf - (config.tools.file-manager.default == "lf") - "${pkgs.lf}/bin/lf"; - - programs.lf.enable = true; - programs.lf.settings = { - hidden = true; - }; - programs.lf.previewer.source = pkgs.writeShellScript - "previewer.sh" - '' -#!/bin/sh -unset COLORTERM -${if config.tools.viewer.bat.enable then - "bat -pp --line-range=:500 --color=always" -else "cat"} "$1" - ''; - programs.lf.extraConfig = "set icons"; - - xdg.configFile."lf/icons".source = ./icons; - }; -} diff --git a/modules/tools/file-manager/lf/icons b/modules/tools/file-manager/lf/icons deleted file mode 100644 index 2e9d8a2..0000000 --- a/modules/tools/file-manager/lf/icons +++ /dev/null @@ -1,334 +0,0 @@ -# vim:ft=conf - -# These examples require Nerd Fonts or a compatible font to be used. -# See https://www.nerdfonts.com for more information. - -# file types (with matching order) -ln  # LINK -or  # ORPHAN -tw t # STICKY_OTHER_WRITABLE -ow  # OTHER_WRITABLE -st t # STICKY -di  # DIR -pi p # FIFO -so s # SOCK -bd b # BLK -cd c # CHR -su u # SETUID -sg g # SETGID -ex  # EXEC -fi  # FILE - -# file extensions (vim-devicons) -*.styl  -*.sass  -*.scss  -*.htm  -*.html  -*.slim  -*.haml  -*.ejs  -*.css  -*.less  -*.md  -*.mdx  -*.markdown  -*.rmd  -*.json  -*.webmanifest  -*.js  -*.mjs  -*.jsx  -*.rb  -*.gemspec  -*.rake  -*.php  -*.py  -*.pyc  -*.pyo  -*.pyd  -*.coffee  -*.mustache  -*.hbs  -*.conf  -*.ini  -*.yml  -*.yaml  -*.toml  -*.bat  -*.mk  -*.jpg  -*.jpeg  -*.bmp  -*.png  -*.webp  -*.gif  -*.ico  -*.twig  -*.cpp  -*.c++  -*.cxx  -*.cc  -*.cp  -*.c  -*.cs 󰌛 -*.h  -*.hh  -*.hpp  -*.hxx  -*.hs  -*.lhs  -*.nix  -*.lua  -*.java  -*.sh  -*.fish  -*.bash  -*.zsh  -*.ksh  -*.csh  -*.awk  -*.ps1  -*.ml λ -*.mli λ -*.diff  -*.db  -*.sql  -*.dump  -*.clj  -*.cljc  -*.cljs  -*.edn  -*.scala  -*.go  -*.dart  -*.xul  -*.sln  -*.suo  -*.pl  -*.pm  -*.t  -*.rss  -'*.f#'  -*.fsscript  -*.fsx  -*.fs  -*.fsi  -*.rs  -*.rlib  -*.d  -*.erl  -*.hrl  -*.ex  -*.exs  -*.eex  -*.leex  -*.heex  -*.vim  -*.ai  -*.psd  -*.psb  -*.ts  -*.tsx  -*.jl  -*.pp  -*.vue  -*.elm  -*.swift  -*.xcplayground  -*.tex 󰙩 -*.r 󰟔 -*.rproj 󰗆 -*.sol 󰡪 -*.pem  - -# file names (vim-devicons) (case-insensitive not supported in lf) -*gruntfile.coffee  -*gruntfile.js  -*gruntfile.ls  -*gulpfile.coffee  -*gulpfile.js  -*gulpfile.ls  -*mix.lock  -*dropbox  -*.ds_store  -*.gitconfig  -*.gitignore  -*.gitattributes  -*.gitlab-ci.yml  -*.bashrc  -*.zshrc  -*.zshenv  -*.zprofile  -*.vimrc  -*.gvimrc  -*_vimrc  -*_gvimrc  -*.bashprofile  -*favicon.ico  -*license  -*node_modules  -*react.jsx  -*procfile  -*dockerfile  -*docker-compose.yml  -*docker-compose.yaml  -*compose.yml  -*compose.yaml  -*rakefile  -*config.ru  -*gemfile  -*makefile  -*cmakelists.txt  -*robots.txt 󰚩 - -# file names (case-sensitive adaptations) -*Gruntfile.coffee  -*Gruntfile.js  -*Gruntfile.ls  -*Gulpfile.coffee  -*Gulpfile.js  -*Gulpfile.ls  -*Dropbox  -*.DS_Store  -*LICENSE  -*React.jsx  -*Procfile  -*Dockerfile  -*Docker-compose.yml  -*Docker-compose.yaml  -*Rakefile  -*Gemfile  -*Makefile  -*CMakeLists.txt  - -# file patterns (file name adaptations) -*jquery.min.js  -*angular.min.js  -*backbone.min.js  -*require.min.js  -*materialize.min.js  -*materialize.min.css  -*mootools.min.js  -*vimrc  -Vagrantfile  - -# archives or compressed (extensions from dircolors defaults) -*.tar  -*.tgz  -*.arc  -*.arj  -*.taz  -*.lha  -*.lz4  -*.lzh  -*.lzma  -*.tlz  -*.txz  -*.tzo  -*.t7z  -*.zip  -*.z  -*.dz  -*.gz  -*.lrz  -*.lz  -*.lzo  -*.xz  -*.zst  -*.tzst  -*.bz2  -*.bz  -*.tbz  -*.tbz2  -*.tz  -*.deb  -*.rpm  -*.jar  -*.war  -*.ear  -*.sar  -*.rar  -*.alz  -*.ace  -*.zoo  -*.cpio  -*.7z  -*.rz  -*.cab  -*.wim  -*.swm  -*.dwm  -*.esd  - -# image formats (extensions from dircolors defaults) -*.jpg  -*.jpeg  -*.mjpg  -*.mjpeg  -*.gif  -*.bmp  -*.pbm  -*.pgm  -*.ppm  -*.tga  -*.xbm  -*.xpm  -*.tif  -*.tiff  -*.png  -*.svg  -*.svgz  -*.mng  -*.pcx  -*.mov  -*.mpg  -*.mpeg  -*.m2v  -*.mkv  -*.webm  -*.ogm  -*.mp4  -*.m4v  -*.mp4v  -*.vob  -*.qt  -*.nuv  -*.wmv  -*.asf  -*.rm  -*.rmvb  -*.flc  -*.avi  -*.fli  -*.flv  -*.gl  -*.dl  -*.xcf  -*.xwd  -*.yuv  -*.cgm  -*.emf  -*.ogv  -*.ogx  - -# audio formats (extensions from dircolors defaults) -*.aac  -*.au  -*.flac  -*.m4a  -*.mid  -*.midi  -*.mka  -*.mp3  -*.mpc  -*.ogg  -*.ra  -*.wav  -*.oga  -*.opus  -*.spx  -*.xspf  - -# other formats -*.pdf  diff --git a/modules/tools/file-manager/lsd/default.nix b/modules/tools/file-manager/lsd/default.nix deleted file mode 100644 index d99413d..0000000 --- a/modules/tools/file-manager/lsd/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs, lib, config, ... }: - -{ - options.tools.file-manager.lsd = { - enable = lib.mkEnableOption "Enables lsd."; - }; - - config = lib.mkIf config.tools.file-manager.lsd.enable { - programs.lsd.enable = true; - programs.lsd.enableAliases = true; - programs.lsd.settings.icons.separator = " "; - }; -} diff --git a/modules/tools/file-manager/nnn/default.nix b/modules/tools/file-manager/nnn/default.nix deleted file mode 100644 index a41096c..0000000 --- a/modules/tools/file-manager/nnn/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - options.tools.file-manager.nnn = { - enable = lib.mkEnableOption "Enables nnn."; - }; - - 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 = - lib.mkIf - (config.tools.file-manager.default == "nnn") - "${nnnWithNerdIcons}/bin/nnn -H -d"; - - programs.nnn.enable = true; - 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..169a07f --- /dev/null +++ b/modules/tools/fzf/default.nix @@ -0,0 +1,42 @@ +{ 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 100%" + "--layout=reverse" + ''--pointer=\"${if config.fonts.nerdfont.fira-code.enable then " " else ">"}\"'' + ''--header=\" \"'' + ''--prompt=\" \"'' + ''--marker=\"✓ \"'' + "--border=none" + "--cycle" + "--no-info" + "--margin=\"1,2\"" + ]; + + programs.fzf.colors = with config.scheme.withHashtag; { + fg = base05; # Foreground + bg = "-1"; # Background (-1 for transparent) + hl = base0D; # Highlight + + "fg+" = base07; # Foreground for selected item + "bg+" = "-1"; # Background for selected item + "hl+" = base0D; # Highlight for selected item + + gutter = "-1"; # Remove the white margin at the left + + info = base0B; # Info text (usually count of items) + border = base03; # Border color + prompt = base0A; # Prompt text color + pointer = base0F; # 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/htop/default.nix b/modules/tools/htop/default.nix new file mode 100644 index 0000000..d4037e6 --- /dev/null +++ b/modules/tools/htop/default.nix @@ -0,0 +1,12 @@ +{ pkgs, lib, config, ... }: + +{ + options.tools.htop = { + enable = lib.mkEnableOption "Enables htop."; + }; + + config = lib.mkIf config.tools.htop.enable { + programs.htop.enable = true; + programs.htop.package = pkgs.htop-vim; + }; +} diff --git a/modules/tools/kitty/default.nix b/modules/tools/kitty/default.nix new file mode 100644 index 0000000..74b4519 --- /dev/null +++ b/modules/tools/kitty/default.nix @@ -0,0 +1,47 @@ +{ pkgs, config, lib, ... }: + +{ + options.tools.kitty = { + enable = lib.mkEnableOption "Enables kitty. WARNING! Currently faces problems with color rendering with picom."; + }; + + config = lib.mkIf config.tools.kitty.enable { + programs.kitty.enable = true; + programs.kitty.settings = with config.scheme.withHashtag; { + window_padding_width = 10; + font_size = config.fonts.size; + font_family = config.fonts.normal; + filter_notification = "all"; + update_check_interval = 0; # disable notifications + scrollback_indicator_opacity = "0.5"; + + dynamic_background_opacity = false; + allow_remote_control = false; + enable_audio_bell = false; + + background = base00; + foreground = base05; + text_composition_strategy = "legacy"; + + color0 = base00; # Black + color8 = base00; # Black + color1 = base08; # Red + color9 = base08; # Red + color2 = base0B; # Green + color10 = base0B; # Green + color3 = base0A; # Yellow + color11 = base0A; # Yellow + color4 = base0D; # Blue + color12 = base0D; # Blue + color5 = base0E; # Magenta + color13 = base0E; # Magenta + color6 = base0C; # Cyan + color14 = base0C; # Cyan + color7 = base05; # White + color15 = base05; # White + + selection_background = base03; + selection_foreground = base00; + }; + }; +} diff --git a/modules/tools/lsd/default.nix b/modules/tools/lsd/default.nix new file mode 100644 index 0000000..feb1481 --- /dev/null +++ b/modules/tools/lsd/default.nix @@ -0,0 +1,12 @@ +{ config, lib, ... }: + +{ + options.tools.lsd = { + enable = lib.mkEnableOption "Enables lsd."; + }; + + config = lib.mkIf config.tools.lsd.enable { + programs.lsd.enable = true; + programs.lsd.settings.icons.separator = " "; + }; +} diff --git a/modules/tools/neovim/config/default.nix b/modules/tools/neovim/config/default.nix new file mode 100644 index 0000000..4514d2f --- /dev/null +++ b/modules/tools/neovim/config/default.nix @@ -0,0 +1,4 @@ +'' +${builtins.readFile ./options.lua} +${builtins.readFile ./keybindings.lua} +'' diff --git a/modules/tools/neovim/config/keybindings.lua b/modules/tools/neovim/config/keybindings.lua new file mode 100644 index 0000000..3f2c9bf --- /dev/null +++ b/modules/tools/neovim/config/keybindings.lua @@ -0,0 +1,5 @@ +-- Navigate splits +vim.keymap.set("n", "", ":wincmd h", { silent = true }); +vim.keymap.set("n", "", ":wincmd j", { silent = true }); +vim.keymap.set("n", "", ":wincmd k", { silent = true }); +vim.keymap.set("n", "", ":wincmd l", { silent = true }); diff --git a/modules/tools/neovim/config/options.lua b/modules/tools/neovim/config/options.lua new file mode 100644 index 0000000..fc0b04c --- /dev/null +++ b/modules/tools/neovim/config/options.lua @@ -0,0 +1,41 @@ +vim.g.mapleader = " "; +vim.g.maplocalleader = " "; + +vim.o.clipboard = "unnamedplus"; + +vim.o.number = true; +vim.o.list = true; +vim.o.listchars = "tab:| ,trail:_,lead:_"; + +vim.o.laststatus = 3; + +vim.o.signcolumn = "auto"; +vim.opt.fillchars = { eob = " " }; + +vim.o.tabstop = 3; +vim.o.shiftwidth = 0; +vim.o.expandtab = false; + +vim.o.updatetime = 300; + +vim.o.mouse = "a"; + +-- Force all filetypes to use tabs +vim.api.nvim_create_autocmd("FileType", { + pattern = "*", + callback = function() + vim.bo.expandtab = false; + vim.bo.tabstop = 3; + vim.bo.shiftwidth = 0; + end, +}); + +-- Exception that use spaces +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/neovim/default.nix b/modules/tools/neovim/default.nix new file mode 100644 index 0000000..2c0b7aa --- /dev/null +++ b/modules/tools/neovim/default.nix @@ -0,0 +1,36 @@ +{ pkgs, config, lib, ... }: + +{ + options.tools.neovim = { + enable = lib.mkEnableOption "Enables neovim."; + profile = lib.mkOption { + type = lib.types.enum [ + "minimal" + "full" + ]; + default = "minimal"; + description = "The profile for neovim to use."; + }; + }; + + config = + let + plugins = import ./plugins { inherit config pkgs lib; }; + in lib.mkIf config.tools.neovim.enable { + programs.neovim.enable = true; + programs.neovim.viAlias = true; + programs.neovim.vimAlias = true; + programs.neovim.vimdiffAlias = true; + programs.neovim.defaultEditor = true; + + home.packages = plugins.requirements; + + programs.neovim.extraLuaConfig = + '' +${import ./config} +${plugins.configuration} + ''; + + programs.neovim.plugins = plugins.list; + }; +} diff --git a/modules/tools/neovim/plugins/config/base16.mustache.lua b/modules/tools/neovim/plugins/config/base16.mustache.lua new file mode 100644 index 0000000..3c13fcc --- /dev/null +++ b/modules/tools/neovim/plugins/config/base16.mustache.lua @@ -0,0 +1,12 @@ +vim.o.termguicolors = true; +vim.opt.termguicolors = true; +vim.o.background = "dark"; +vim.g.base16colorspace = 256 +vim.cmd.colorscheme("base16-scheme"); + +-- Overrides +-- disable the background of line numbers +vim.api.nvim_set_hl(0, "LineNr", { link = "Normal" }); + +-- change the color of the pane separator +vim.api.nvim_set_hl(0, "WinSeparator", { fg = "#{{base02-hex}}", bg = "None" }); diff --git a/modules/tools/neovim/plugins/config/comment.lua b/modules/tools/neovim/plugins/config/comment.lua new file mode 100644 index 0000000..9086261 --- /dev/null +++ b/modules/tools/neovim/plugins/config/comment.lua @@ -0,0 +1 @@ +require("Comment").setup(); diff --git a/modules/tools/neovim/plugins/config/default.nix b/modules/tools/neovim/plugins/config/default.nix new file mode 100644 index 0000000..9ae2485 --- /dev/null +++ b/modules/tools/neovim/plugins/config/default.nix @@ -0,0 +1,27 @@ +{ config }: + +let + fullExtra = if config.tools.neovim.profile == "full" then +'' +${builtins.readFile ./lsp-config.lua} +${builtins.readFile ./dressing.lua} +${builtins.readFile (config.scheme { + template = builtins.readFile ./noice.mustache.lua; +})} +${builtins.readFile ./nvim-ufo.lua} +${builtins.readFile ./which-key.lua} +'' + else ""; +in +'' +${builtins.readFile ./comment.lua} +${builtins.readFile (config.scheme { + template = builtins.readFile ./lualine.mustache.lua; +})} +${import ./treesitter.nix { inherit config; }} +${builtins.readFile (config.scheme { + template = builtins.readFile ./base16.mustache.lua; +})} +${builtins.readFile ./nvim-tree.lua} +${fullExtra} +'' diff --git a/modules/tools/neovim/plugins/config/dressing.lua b/modules/tools/neovim/plugins/config/dressing.lua new file mode 100644 index 0000000..6d14d47 --- /dev/null +++ b/modules/tools/neovim/plugins/config/dressing.lua @@ -0,0 +1 @@ +require("dressing").setup(); diff --git a/modules/tools/neovim/plugins/config/lsp-config.lua b/modules/tools/neovim/plugins/config/lsp-config.lua new file mode 100644 index 0000000..cca4116 --- /dev/null +++ b/modules/tools/neovim/plugins/config/lsp-config.lua @@ -0,0 +1,75 @@ +local lspconfig = require("lspconfig"); + +local filetype_to_lsp = { + lua = { server = "lua_ls", executable = "lua-language-server" }, + cpp = { server = "clangd", executable = "clangd" }, + c = { server = "clangd", executable = "clangd" }, + python = { server = "pyright", executable = "pyright-langserver" }, + javascript = { server = "tsserver", executable = "typescript-language-server" }, + typescript = { server = "tsserver", executable = "typescript-language-server" }, + go = { server = "gopls", executable = "gopls" }, + html = { server = "html", executable = "vscode-html-language-server" }, + css = { server = "cssls", executable = "vscode-css-language-server" }, + json = { server = "jsonls", executable = "vscode-json-language-server" }, + bash = { server = "bashls", executable = "bash-language-server" }, + graphql = { server = "graphql", executable = "graphql-lsp" }, + dockerfile = { server = "dockerls", executable = "docker-langserver" }, + php = { server = "phpactor", executable = "phpactor" }, + rust = { server = "rust_analyzer", executable = "rust-analyzer" }, + haskell = { server = "hls", executable = "haskell-language-server-wrapper" }, + deno = { server = "denols", executable = "deno" }, + vim = { server = "vimls", executable = "vim-language-server" }, + elixir = { server = "elixirls", executable = "elixir-ls" }, + clojure = { server = "clojure_lsp", executable = "clojure-lsp" }, + scala = { server = "scala_metals", executable = "metals" }, + ruby = { server = "sorbet", executable = "srb" }, + zig = { server = "zls", executable = "zls" }, + kotlin = { server = "kotlin_language_server", executable = "kotlin-language-server" }, + java = { server = "jdtls", executable = "jdtls" }, + dart = { server = "dartls", executable = "dart" }, + yaml = { server = "yamlls", executable = "yaml-language-server" }, + perl = { server = "perlls", executable = "perl" }, + r = { server = "r_language_server", executable = "R" }, + tex = { server = "texlab", executable = "texlab" }, + swift = { server = "sourcekit", executable = "sourcekit-lsp" }, + svelte = { server = "svelteserver", executable = "svelteserver" }, + terraform = { server = "terraformls", executable = "terraform-ls" }, + vue = { server = "vls", executable = "vls" }, + markdown = { server = "marksman", executable = "marksman" }, + yaml = { server = "yamlls", executable = "yaml-language-server" }, +}; + +-- Keeping track of all the lsps that have been already configured +local lsp_setup_done = {}; + +-- Function to setup LSP based on filetype +local function setup_lsp(filetype) + local lsp = filetype_to_lsp[filetype]; + if lsp ~= nil and not lsp_setup_done[lsp.server] then + lsp_setup_done[lsp.server] = true; + if vim.fn.executable(lsp.executable) == 1 then + lspconfig[lsp.server].setup({}); + end + end +end + +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, +}); + +-- Show diagnostics in a floating window when hovering over the line +vim.api.nvim_create_autocmd("CursorHold", { + callback = function() + vim.diagnostic.open_float(nil, { focusable = false }) + end, +}) + +local lsp_keymap_opts = { noremap = true, silent = true }; + +vim.keymap.set("n", "d", vim.lsp.buf.definition, lsp_keymap_opts); +vim.keymap.set("n", "i", vim.lsp.buf.implementation, lsp_keymap_opts); +vim.keymap.set("n", "r", vim.lsp.buf.references, lsp_keymap_opts); +vim.keymap.set("n", "k", vim.lsp.buf.hover, lsp_keymap_opts); diff --git a/modules/tools/neovim/plugins/config/lualine.mustache.lua b/modules/tools/neovim/plugins/config/lualine.mustache.lua new file mode 100644 index 0000000..bf4f1d1 --- /dev/null +++ b/modules/tools/neovim/plugins/config/lualine.mustache.lua @@ -0,0 +1,61 @@ +local lualine_theme = { + normal = { + a = { fg = "#{{base0D-hex}}", bg = "none", gui = "bold" }, + b = { fg = "#{{base05-hex}}", bg = "none" }, + c = { fg = "#{{base05-hex}}", bg = "none" }, + }, + insert = { + a = { fg = "#{{base0B-hex}}", bg = "none", gui = "bold" }, + }, + visual = { + a = { fg = "#{{base0E-hex}}", bg = "none", gui = "bold" }, + }, + replace = { + a = { fg = "#{{base08-hex}}", bg = "none", gui = "bold" }, + }, + command = { + a = { fg = "#{{base0A-hex}}", bg = "none", gui = "bold" }, + }, + inactive = { + a = { fg = "#{{base04-hex}}", bg = "none" }, + b = { fg = "#{{base04-hex}}", bg = "none" }, + c = { fg = "#{{base04-hex}}", bg = "none" }, + }, +}; + +local function macro_recording() + local recording_register = vim.fn.reg_recording() + if recording_register ~= "" then + return "@" .. recording_register + else + return "" + end +end + +require("lualine").setup { + options = { + icons_enabled = true, + theme = lualine_theme, + section_separators = "", + component_separators = "", + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { + "branch", + { + "diff", + colored = true, + symbols = { + added = " ", + modified = " ", + removed = " ", + } + } + }, + lualine_c = { "filename" }, + lualine_x = { macro_recording, "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, +}; diff --git a/modules/tools/neovim/plugins/config/noice.mustache.lua b/modules/tools/neovim/plugins/config/noice.mustache.lua new file mode 100644 index 0000000..a258c8e --- /dev/null +++ b/modules/tools/neovim/plugins/config/noice.mustache.lua @@ -0,0 +1,10 @@ +require("noice").setup(); + +vim.api.nvim_set_hl(0, "NoiceCommandOutput", { fg = "#{{base05-hex}}", bg = "#{{base00-hex}}" }); +vim.api.nvim_set_hl(0, "NoiceCmdline", { fg = "#{{base05-hex}}", bg = "#{{base00-hex}}" }); +vim.api.nvim_set_hl(0, "NoiceCmdlinePopup", { fg = "#{{base05-hex}}", bg = "#{{base00-hex}}" }); +vim.api.nvim_set_hl(0, "NoiceCmdlinePopupBorder", { fg = "#{{base03-hex}}", bg = "#{{base00-hex}}" }); +vim.api.nvim_set_hl(0, "NoiceError", { fg = "#{{base08-hex}}", bg = "#{{base00-hex}}" }); +vim.api.nvim_set_hl(0, "NoiceWarning", { fg = "#{{base0A-hex}}", bg = "#{{base00-hex}}" }); +vim.api.nvim_set_hl(0, "NoiceInfo", { fg = "#{{base0C-hex}}", bg = "#{{base00-hex}}" }); +vim.api.nvim_set_hl(0, "NoiceHint", { fg = "#{{base0B-hex}}", bg = "#{{base00-hex}}" }); diff --git a/modules/tools/neovim/plugins/config/nvim-tree.lua b/modules/tools/neovim/plugins/config/nvim-tree.lua new file mode 100644 index 0000000..cdbef6a --- /dev/null +++ b/modules/tools/neovim/plugins/config/nvim-tree.lua @@ -0,0 +1,15 @@ +require("nvim-tree").setup { + filters = { + enable = false + }, + renderer = { + indent_markers = { + enable = true + }, + root_folder_label = function(path) + return vim.fn.fnamemodify(path, ":t") + end, + }, +}; + +vim.keymap.set("n", "", ":NvimTreeToggle", { silent = true }); diff --git a/modules/tools/neovim/plugins/config/nvim-ufo.lua b/modules/tools/neovim/plugins/config/nvim-ufo.lua new file mode 100644 index 0000000..641373f --- /dev/null +++ b/modules/tools/neovim/plugins/config/nvim-ufo.lua @@ -0,0 +1,21 @@ +require("ufo").setup { + provider_selector = function(bufnr, filetype, buftype) + return { + "treesitter", + "indent" + } + end, +}; + +vim.o.foldenable = true +vim.o.foldcolumn = '0' +vim.o.foldlevel = 99 -- Ensure all folds start open +vim.o.foldlevelstart = 99 + +-- press K or capslockK +vim.keymap.set("n", "", function() + local winid = ufo.peekFoldedLinesUnderCursor() + if not winid then + vim.lsp.buf.hover() + end +end) diff --git a/modules/tools/neovim/plugins/config/treesitter.nix b/modules/tools/neovim/plugins/config/treesitter.nix new file mode 100644 index 0000000..be0bdb6 --- /dev/null +++ b/modules/tools/neovim/plugins/config/treesitter.nix @@ -0,0 +1,13 @@ +{ config }: + +'' +require("nvim-treesitter.configs").setup { + auto_install = true, + highlight = { + enable = true, + }, + parser_install_dir = "${config.xdg.dataHome}/nvim", +}; + +vim.opt.runtimepath:append("${config.xdg.dataHome}/nvim"); +'' diff --git a/modules/tools/neovim/plugins/config/which-key.lua b/modules/tools/neovim/plugins/config/which-key.lua new file mode 100644 index 0000000..1290432 --- /dev/null +++ b/modules/tools/neovim/plugins/config/which-key.lua @@ -0,0 +1,5 @@ +local wk = require("which-key"); + +vim.keymap.set("n", "h", function() + wk.show({ global = true }) +end, { silent = true }); diff --git a/modules/tools/neovim/plugins/default.nix b/modules/tools/neovim/plugins/default.nix new file mode 100644 index 0000000..b06cb24 --- /dev/null +++ b/modules/tools/neovim/plugins/default.nix @@ -0,0 +1,31 @@ +{ config, pkgs, lib }: + +{ + configuration = import ./config { inherit config; }; + + list = with pkgs.vimPlugins; lib.mkMerge [ + [ + comment-nvim + lualine-nvim + 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"; + })) + ] + (if config.tools.neovim.profile == "full" then + [ + noice-nvim + dressing-nvim + nvim-lspconfig + nvim-ufo + ] + else []) + ]; + + requirements = with pkgs; [ + gcc # for treesitter + ]; +} diff --git a/modules/tools/nnn/default.nix b/modules/tools/nnn/default.nix new file mode 100644 index 0000000..298f538 --- /dev/null +++ b/modules/tools/nnn/default.nix @@ -0,0 +1,16 @@ +{ config, pkgs, lib, ... }: + +{ + options.tools.nnn = { + enable = lib.mkEnableOption "Enables nnn."; + }; + + config = + let + nnnWithNerdIcons = pkgs.nnn.override ({ withNerdIcons = true; }); + in lib.mkIf config.tools.nnn.enable { + programs.nnn.enable = true; + programs.nnn.package = nnnWithNerdIcons; + programs.nnn.plugins.src = "${nnnWithNerdIcons}/share/plugins"; + }; +} diff --git a/modules/tools/system-monitor/default.nix b/modules/tools/system-monitor/default.nix deleted file mode 100644 index a5b569c..0000000 --- a/modules/tools/system-monitor/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -{ - imports = [ - ./htop - ]; -} diff --git a/modules/tools/system-monitor/htop/default.nix b/modules/tools/system-monitor/htop/default.nix deleted file mode 100644 index c19ab60..0000000 --- a/modules/tools/system-monitor/htop/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, lib, config, ... }: - -{ - options.tools.system-monitor.htop = { - enable = lib.mkEnableOption "Enables htop."; - }; - - config = lib.mkIf config.tools.system-monitor.htop.enable { - programs.htop.enable = true; - programs.htop.package = pkgs.htop-vim; - }; -} diff --git a/modules/tools/terminal/alacritty/default.nix b/modules/tools/terminal/alacritty/default.nix deleted file mode 100644 index fa3c080..0000000 --- a/modules/tools/terminal/alacritty/default.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ pkgs, config, lib, ... }: - -{ - options.tools.terminal.alacritty = { - enable = lib.mkEnableOption "Enables alacritty."; - }; - - config = lib.mkIf config.tools.terminal.alacritty.enable { - programs.alacritty.enable = true; - tools.terminal.default = lib.mkDefault "alacritty"; - tools.terminal.command = - lib.mkIf - (config.tools.terminal.default == "alacritty") - "${pkgs.alacritty}/bin/alacritty"; - - programs.alacritty.settings = { - window = { - opacity = 1.0; - padding = { - x = config.desktop.window-manager.gap; - y = config.desktop.window-manager.gap; - }; - decorations = "none"; - }; - - font = { - normal = { - family = config.fonts.normal; - style = "Retina"; - }; - bold = { - family = config.fonts.bold; - style = "Bold"; - }; - italic = { - family = config.fonts.italic; - }; - size = config.fonts.size; - }; - - colors = with config.scheme; { - primary = { - background = "0x${base00}"; - foreground = "0x${base05}"; - }; - normal = { - black = "0x${base00}"; - red = "0x${base08}"; - green = "0x${base0B}"; - yellow = "0x${base0A}"; - blue = "0x${base0D}"; - magenta = "0x${base0E}"; - cyan = "0x${base0C}"; - white = "0x${base05}"; - }; - bright = { - black = "0x${base03}"; - red = "0x${base08}"; - green = "0x${base0B}"; - yellow = "0x${base0A}"; - blue = "0x${base0D}"; - magenta = "0x${base0E}"; - cyan = "0x${base0C}"; - white = "0x${base07}"; - }; - dim = { - black = "0x${base01}"; - red = "0x${base08}"; - green = "0x${base0B}"; - yellow = "0x${base0A}"; - blue = "0x${base0D}"; - magenta = "0x${base0E}"; - cyan = "0x${base0C}"; - white = "0x${base04}"; - }; - }; - - shell = { - program = config.shell.command; - }; - }; - }; -} diff --git a/modules/tools/terminal/default.nix b/modules/tools/terminal/default.nix deleted file mode 100644 index 2e29bce..0000000 --- a/modules/tools/terminal/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ lib, ... }: - -{ - imports = [ - ./alacritty - ./kitty - ./tmux - ]; - - options.tools.terminal = { - command = lib.mkOption { - type = lib.types.str; - description = "Command for the terminal."; - }; - - default = lib.mkOption { - type = lib.types.enum [ - "kitty" - "alacritty" - ]; - description = "Default terminal."; - }; - }; -} diff --git a/modules/tools/terminal/kitty/default.nix b/modules/tools/terminal/kitty/default.nix deleted file mode 100644 index 94f013b..0000000 --- a/modules/tools/terminal/kitty/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ pkgs, config, lib, ... }: - -{ - options.tools.terminal.kitty = { - enable = lib.mkEnableOption "Enables kitty. WARNING! Currently faces problems with color rendering with picom."; - }; - - config = lib.mkIf config.tools.terminal.kitty.enable { - programs.kitty.enable = true; - tools.terminal.default = lib.mkDefault "kitty"; - tools.terminal.command = - lib.mkIf - (config.tools.terminal.default == "kitty") - "${pkgs.kitty}/bin/kitty"; - - programs.kitty.settings = with config.scheme.withHashtag; { - window_padding_width = config.desktop.window-manager.gap; - font_size = config.fonts.size; - font_family = config.fonts.normal; - filter_notification = "all"; - update_check_interval = 0; # disable notifications - scrollback_indicator_opacity = "0.5"; - - dynamic_background_opacity = false; - allow_remote_control = false; - enable_audio_bell = false; - - background = base00; - foreground = base05; - text_composition_strategy = "legacy"; - - color0 = base00; # Black - color8 = base00; # Black - color1 = base08; # Red - color9 = base08; # Red - color2 = base0B; # Green - color10 = base0B; # Green - color3 = base0A; # Yellow - color11 = base0A; # Yellow - color4 = base0D; # Blue - color12 = base0D; # Blue - color5 = base0E; # Magenta - color13 = base0E; # Magenta - color6 = base0C; # Cyan - color14 = base0C; # Cyan - color7 = base05; # White - color15 = base05; # White - - selection_background = base03; - selection_foreground = base00; - - shell = config.shell.command; - }; - }; -} diff --git a/modules/tools/terminal/tmux/default.nix b/modules/tools/terminal/tmux/default.nix deleted file mode 100644 index a77bbcb..0000000 --- a/modules/tools/terminal/tmux/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, config, lib, ... }: - -{ - options.tools.terminal.tmux = { - enable = lib.mkEnableOption "Enables tmus."; - }; - - config = lib.mkIf config.tools.terminal.tmux.enable { - programs.tmux.enable = true; - }; -} diff --git a/modules/tools/utils/default.nix b/modules/tools/utils/default.nix deleted file mode 100644 index 5d758fc..0000000 --- a/modules/tools/utils/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -{ - imports = [ - ./fzf - ]; -} diff --git a/modules/tools/utils/fzf/default.nix b/modules/tools/utils/fzf/default.nix deleted file mode 100644 index e6378bc..0000000 --- a/modules/tools/utils/fzf/default.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ config, lib,... }: - -{ - options.tools.utils.fzf = { - enable = lib.mkEnableOption "Enables fzf."; - }; - - config = lib.mkIf config.tools.utils.fzf.enable { - programs.fzf.enable = true; - programs.fzf.defaultOptions = [ - "--height 100%" - "--layout=reverse" - ''--pointer=\"${if config.fonts.nerdfont.fira-code.enable then " " else ">"}\"'' - ''--header=\" \"'' - ''--prompt=\" \"'' - ''--marker=\"✓ \"'' - "--border=none" - "--cycle" - "--no-info" - "--margin=\"1,2\"" - ]; - - programs.fzf.colors = with config.scheme.withHashtag; { - fg = base05; # Foreground - bg = "-1"; # Background (-1 for transparent) - hl = base0D; # Highlight - - "fg+" = base07; # Foreground for selected item - "bg+" = "-1"; # Background for selected item - "hl+" = base0D; # Highlight for selected item - - gutter = "-1"; # Remove the white margin at the left - - info = base0B; # Info text (usually count of items) - border = base03; # Border color - prompt = base0A; # Prompt text color - pointer = base0F; # 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/viewer/bat/default.nix b/modules/tools/viewer/bat/default.nix deleted file mode 100644 index 4d52a62..0000000 --- a/modules/tools/viewer/bat/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - options.tools.viewer.bat = { - enable = lib.mkEnableOption "Enables bat."; - }; - - config = lib.mkIf config.tools.viewer.bat.enable { - programs.bat.enable = true; - programs.bat.config = { - tabs = "4"; - theme = "custom-theme"; - }; - shell.alias."cat" = "${pkgs.bat}/bin/bat -pp"; - shell.alias."less" = "${pkgs.bat}/bin/bat --paging always"; - home.sessionVariables."PAGER" = "${pkgs.bat}/bin/bat --paging always"; - xdg.configFile."bat/themes/custom-theme.tmTheme".source - = config.scheme { - template = builtins.readFile ./theme.mustache.tmTheme; - }; - }; -} diff --git a/modules/tools/viewer/bat/theme.mustache.tmTheme b/modules/tools/viewer/bat/theme.mustache.tmTheme deleted file mode 100644 index 844b80d..0000000 --- a/modules/tools/viewer/bat/theme.mustache.tmTheme +++ /dev/null @@ -1,120 +0,0 @@ - - - - name - customTheme - settings - - - - settings - - background - #{{base00-hex}} - foreground - #{{base05-hex}} - caret - #{{base07-hex}} - invisibles - #{{base03-hex}} - lineHighlight - #{{base02-hex}} - selection - #{{base03-hex}} - - - - - - scope - comment - settings - - foreground - #{{base04-hex}} - - - - - scope - string - settings - - foreground - #{{base0A-hex}} - - - - - scope - constant.numeric - settings - - foreground - #{{base09-hex}} - - - - - scope - variable - settings - - foreground - #{{base08-hex}} - - - - - scope - keyword - settings - - foreground - #{{base0D-hex}} - - - - - scope - support.function - settings - - foreground - #{{base0E-hex}} - - - - - scope - constant.language - settings - - foreground - #{{base0B-hex}} - - - - - scope - entity.name.tag - settings - - foreground - #{{base0C-hex}} - - - - - scope - invalid - settings - - foreground - #{{base0F-hex}} - - - - - - diff --git a/modules/tools/viewer/default.nix b/modules/tools/viewer/default.nix deleted file mode 100644 index 01fd204..0000000 --- a/modules/tools/viewer/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: - -{ - imports = [ - ./bat - ./feh - ]; -} diff --git a/modules/tools/viewer/feh/default.nix b/modules/tools/viewer/feh/default.nix deleted file mode 100644 index d90e8b1..0000000 --- a/modules/tools/viewer/feh/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - options.tools.viewer.feh = { - enable = lib.mkEnableOption "Enables feh."; - }; - - config = lib.mkIf config.tools.viewer.feh.enable { - programs.feh.enable = true; - }; -} diff --git a/modules/tools/zsh/default.nix b/modules/tools/zsh/default.nix new file mode 100644 index 0000000..0f10e72 --- /dev/null +++ b/modules/tools/zsh/default.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + +{ + options.tools.zsh = { + enable = lib.mkEnableOption "Enables zsh."; + }; + + config = lib.mkIf config.tools.zsh.enable { + programs.zsh.enable = true; + programs.zsh.dotDir = ".config/zsh"; + programs.zsh.history.path = "${config.xdg.cacheHome}/zsh/history"; + programs.zsh.initContent = '' +${if config.tools.fzf.enable then + "eval \"$(fzf --zsh)\"" +else ""} +${builtins.readFile ./zshrc} +${if config.scripts.enable then + "export PATH=${config.home.homeDirectory}/scripts:$PATH" +else ""} + ''; + programs.kitty.settings.shell = lib.mkIf config.tools.kitty.enable "zsh"; + programs.zsh.shellAliases."nnn" = lib.mkIf config.tools.nnn.enable "nnn -H -d"; + # programs.zsh.shellAliases."ls" = lib.mkIf config.tools.lsd.enable "lsd"; + }; +} diff --git a/modules/tools/zsh/zshrc b/modules/tools/zsh/zshrc new file mode 100644 index 0000000..3465071 --- /dev/null +++ b/modules/tools/zsh/zshrc @@ -0,0 +1,23 @@ +setopt PROMPT_SUBST + +autoload -U colors && colors + +autoload -Uz vcs_info +precmd() { vcs_info } + +zstyle ':vcs_info:git:*' formats '%F{red}┄[%F{cyan}%b%c%F{blue}%a%F{red}]' +zstyle ':vcs_info:git:*' actionformats '%F{red}┄[%F{cyan}%b%c%F{blue}%a%F{red}]' + +zstyle ':vcs_info:*+set-message:*' hooks git-untracked git-dirty + +zstyle ':vcs_info:git:*' check-for-changes true +zstyle ':vcs_info:git:*' stagedstr ' %F{green}✓%f' +zstyle ':vcs_info:git:*' unstagedstr ' %F{red}✗%f' +zstyle ':vcs_info:git:*' aheadstr ' %F{blue}⬆%f' +zstyle ':vcs_info:git:*' behindstr ' %F{yellow}⬇%f' + +PROMPT='%F{red}╭──[%F{green}%m%F{red}@%F{blue}%n%F{red}]┄[%F{magenta}%~%F{red}]${vcs_info_msg_0_}%(?..%F{red}┄[%F{white}Exit status: %F{yellow}%?%F{red}] ) +╰─>%f ' + +bindkey "^[[3~" delete-char +bindkey "^?" backward-delete-char -- cgit v1.2.3