From 58fa41a2104e546f6a1c0cabb33feed2c2f708c4 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Fri, 4 Oct 2024 21:03:01 +0200 Subject: [PATCH] Update --- docs/TODO.md | 12 +- home/programs/nvim/colorscheme.nix | 47 +++- home/programs/nvim/default.nix | 3 +- home/programs/nvim/keymaps.nix | 336 ++++++++++++++++++++---- home/programs/nvim/plugins/cmp.nix | 7 +- home/programs/nvim/plugins/lsp.nix | 9 +- home/programs/nvim/plugins/markdown.nix | 2 +- home/programs/nvim/plugins/tree.nix | 17 -- home/programs/nvim/plugins/ui.nix | 44 +++- home/programs/nvim/plugins/utils.nix | 22 -- home/programs/nvim/plugins/zen-mode.nix | 31 --- home/programs/shell/tmux.nix | 3 +- home/scripts/hyprfocus/default.nix | 48 ++-- home/system/batsignal/default.nix | 2 +- home/system/hyprland/default.nix | 18 +- 15 files changed, 417 insertions(+), 184 deletions(-) delete mode 100644 home/programs/nvim/plugins/zen-mode.nix diff --git a/docs/TODO.md b/docs/TODO.md index 41d83ca..82aa11e 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -3,19 +3,21 @@ feel free to contribute <3 ([CONTRIBUTING.md](CONTRIBUTING.md)) - [ ] Hyprshade (replacement for gammastep) -- [ ] !!! Qutebrowser Bitwarden integration (I need this.) + - [ ] !!! Qutebrowser Bitwarden integration (I need this.) - [ ] Hyprland - [ ] Fix screenshots (screenshot region's border shows up in the screenshot, hyprshot jq error?) and add in the scripts doc +- [ ] Nixy + - [ ] Open Keybindings - [ ] Nixvim + - [ ] Markdown tab size 2 - [ ] Harpoon - [ ] UFO for folding - [ ] neotest golang - - [ ] Keymaps: - - Trouble - - Tagbar (actually not working) - - Markdown + - [ ] nvim dap - [ ] + - [ ] - [ ] Update docs +- [ ] Workflow README ## Server diff --git a/home/programs/nvim/colorscheme.nix b/home/programs/nvim/colorscheme.nix index 3759971..1084855 100644 --- a/home/programs/nvim/colorscheme.nix +++ b/home/programs/nvim/colorscheme.nix @@ -1,11 +1,46 @@ { programs.nixvim = { - enable = true; - colorschemes.catppuccin = { - enable = true; - settings = { - transparent_background = true; - flavour = "mocha"; + colorschemes = { + catppuccin = { + enable = true; + settings = { + background = { + light = "macchiato"; + dark = "mocha"; + }; + flavour = + "mocha"; # "latte", "mocha", "frappe", "macchiato" or raw lua code + disable_bold = false; + disable_italic = false; + disable_underline = false; + transparent_background = true; + term_colors = true; + integrations = { + cmp = true; + noice = true; + notify = true; + neotree = true; + harpoon = true; + gitsigns = true; + which_key = true; + illuminate = { enabled = true; }; + treesitter = true; + treesitter_context = true; + telescope.enabled = true; + indent_blankline.enabled = true; + mini.enabled = true; + native_lsp = { + enabled = true; + inlay_hints = { background = true; }; + underlines = { + errors = [ "underline" ]; + hints = [ "underline" ]; + information = [ "underline" ]; + warnings = [ "underline" ]; + }; + }; + }; + }; }; }; }; diff --git a/home/programs/nvim/default.nix b/home/programs/nvim/default.nix index ed42c93..42ae0da 100644 --- a/home/programs/nvim/default.nix +++ b/home/programs/nvim/default.nix @@ -8,10 +8,11 @@ ./plugins/tree.nix ./plugins/ui.nix ./plugins/utils.nix - ./plugins/zen-mode.nix ./options.nix ./colorscheme.nix ./keymaps.nix ]; + + programs.nixvim.enable = true; } diff --git a/home/programs/nvim/keymaps.nix b/home/programs/nvim/keymaps.nix index 3b2761c..abd331b 100644 --- a/home/programs/nvim/keymaps.nix +++ b/home/programs/nvim/keymaps.nix @@ -1,59 +1,287 @@ { - programs.nixvim.keymaps = [ - { - key = "fm"; - action = "lua vim.lsp.buf.format()"; - options.desc = "LSP Format"; - } + programs.nixvim = { + plugins.which-key = { + enable = true; + settings = { + icons = { + breadcrumb = "»"; + group = "+"; + separator = ""; # ➜ + }; + spec = [ + # General Mappings + { + __unkeyed-1 = "c"; + mode = [ "n" "v" ]; + group = "+code"; + } + { + __unkeyed-1 = "d"; + mode = [ "n" "v" ]; + group = "+debug"; + } + { + __unkeyed-1 = "s"; + mode = "n"; + group = "+search"; + } + { + __unkeyed-1 = "t"; + mode = "n"; + group = "+trouble"; + } + { + __unkeyed-1 = "u"; + mode = "n"; + group = "+ui"; + } + { + __unkeyed-1 = "w"; + mode = "n"; + group = "+windows"; + } + ]; + win = { + border = "none"; + wo.winblend = 0; + }; + }; + }; - # UI - { - key = "uw"; - action = "set wrap!"; - options.desc = "Toggle word wrapping"; - } - { - key = "uW"; - action = "set linebreak!"; - options.desc = "Toggle linebreak"; - } + keymaps = [ + # General Mappings + { + key = "e"; + action = "Oil --float"; + options.desc = "Oil"; + } + { + key = "-"; + action = "Oil"; + options.desc = "Oil"; + } + { + key = ""; + action = "TmuxNavigateLeft"; + } + { + key = ""; + action = "TmuxNavigateDown"; + } + { + key = ""; + action = "TmuxNavigateUp"; + } + { + key = ""; + action = "TmuxNavigateRight"; + } - { - key = "uz"; - action = "ZenMode"; - options.desc = "Toggle ZenMode"; - } + # UI + { + key = "uw"; + action = "set wrap!"; + options.desc = "Toggle word wrapping"; + } + { + key = "ul"; + action = "set linebreak!"; + options.desc = "Toggle linebreak"; + } + { + key = "us"; + action = "set spell!"; + options.desc = "Toggle spellcheck"; + } + { + key = "uc"; + action = "set cursorline!"; + options.desc = "Toggle cursorline"; + } + { + key = "un"; + action = "set number!"; + options.desc = "Toggle line numbers"; + } + { + key = "ur"; + action = "set relativenumber!"; + options.desc = "Toggle relative line numbers"; + } + { + key = "ut"; + action = "set showtabline=2"; + options.desc = "Show tabline"; + } + { + key = "uT"; + action = "set showtabline=0"; + options.desc = "Hide tabline"; + } - # Trouble - { - key = "tx"; - action = "Trouble diagnostics toggle"; - options.desc = "Diagnostics (Trouble)"; - } - { - key = "tX"; - action = "Trouble diagnostics toggle filter.buf=0"; - options.desc = "Buffer Diagnostics (Trouble)"; - } - { - key = "ts"; - action = "Trouble symbols toggle focus=false"; - options.desc = "Symbols (Trouble)"; - } - { - key = "tl"; - action = "Trouble lsp toggle focus=false win.position=right"; - options.desc = "LSP Definitions / references / ... (Trouble)"; - } - { - key = "tL"; - action = "Trouble loclist toggle"; - options.desc = "Location List (Trouble)"; - } - { - key = "tQ"; - action = "Trouble qflist toggle"; - options.desc = "Quickfix List (Trouble)"; - } - ]; + # Search + { + key = " "; + action = "lua require('telescope.builtin').find_files()"; + options.desc = "Telescope"; + } + { + key = "sg"; + action = "lua require('telescope.builtin').live_grep()"; + options.desc = "Livegrep"; + } + { + key = "sf"; + action = "lua require('telescope.builtin').find_files()"; + options.desc = "Find Files"; + } + { + key = "sb"; + action = "lua require('telescope.builtin').buffers()"; + options.desc = "Buffers"; + } + { + key = "sh"; + action = "lua require('telescope.builtin').help_tags()"; + options.desc = "Help Tags"; + } + { + key = "sc"; + action = "lua require('telescope.builtin').commands()"; + options.desc = "Commands"; + } + { + key = "sm"; + action = "lua require('telescope.builtin').marks()"; + options.desc = "Marks"; + } + { + key = "so"; + action = "lua require('telescope.builtin').oldfiles()"; + options.desc = "Oldfiles"; + } + { + key = "ss"; + action = "lua require('telescope.builtin').spell_suggest()"; + options.desc = "Spell Suggest"; + } + { + key = "st"; + action = "lua require('telescope.builtin').treesitter()"; + options.desc = "Treesitter"; + } + { + key = "sr"; + action = ":noh"; + options.desc = "Reset search"; + } + + # Trouble + { + key = "tx"; + action = "Trouble diagnostics toggle"; + options.desc = "Diagnostics (Trouble)"; + } + { + key = "tX"; + action = "Trouble diagnostics toggle filter.buf=0"; + options.desc = "Buffer Diagnostics (Trouble)"; + } + { + key = "ts"; + action = "Trouble symbols toggle focus=false"; + options.desc = "Symbols (Trouble)"; + } + { + key = "tl"; + action = "Trouble lsp toggle focus=false win.position=right"; + options.desc = "LSP Definitions / references / ... (Trouble)"; + } + { + key = "tL"; + action = "Trouble loclist toggle"; + options.desc = "Location List (Trouble)"; + } + { + key = "tQ"; + action = "Trouble qflist toggle"; + options.desc = "Quickfix List (Trouble)"; + } + + # Windows + { + key = "ws"; + action = "split"; + options.desc = "Split"; + } + { + key = "wv"; + action = "vsplit"; + options.desc = "VSplit"; + } + { + key = "wd"; + action = "close"; + options.desc = "Close"; + } + + # code + { + key = "cd"; + action = "lua vim.lsp.buf.definition()"; + options.desc = "LSP Definition"; + } + { + key = "cr"; + action = "lua vim.lsp.buf.references()"; + options.desc = "LSP References"; + } + { + key = "ci"; + action = "lua vim.lsp.buf.implementation()"; + options.desc = "LSP Implementation"; + } + { + key = "ct"; + action = "lua vim.lsp.buf.type_definition()"; + options.desc = "LSP Type Definition"; + } + { + key = "cs"; + action = "lua vim.lsp.buf.signature_help()"; + options.desc = "LSP Signature Help"; + } + { + key = "ch"; + action = "lua vim.lsp.buf.hover()"; + options.desc = "LSP Hover"; + } + { + key = "ca"; + action = "lua vim.lsp.buf.code_action()"; + options.desc = "LSP Code Action"; + } + { + key = "cf"; + action = "lua vim.lsp.buf.formatting()"; + options.desc = "LSP Formatting"; + } + { + key = "ce"; + action = "lua vim.lsp.diagnostic.show_line_diagnostics()"; + options.desc = "LSP Line Diagnostics"; + } + { + key = "cn"; + action = "lua vim.lsp.diagnostic.goto_next()"; + options.desc = "LSP Next Diagnostic"; + } + { + key = "cp"; + action = "lua vim.lsp.diagnostic.goto_prev()"; + options.desc = "LSP Previous Diagnostic"; + } + + ]; + }; } diff --git a/home/programs/nvim/plugins/cmp.nix b/home/programs/nvim/plugins/cmp.nix index 55b2da7..49ab51d 100644 --- a/home/programs/nvim/plugins/cmp.nix +++ b/home/programs/nvim/plugins/cmp.nix @@ -15,7 +15,10 @@ sources = [ { name = "nvim_lsp"; } { name = "luasnip"; } - { name = "buffer"; } + { + name = "buffer"; + option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; + } { name = "nvim_lua"; } { name = "path"; } ]; @@ -80,7 +83,7 @@ completion = { winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,Search:PmenuSel"; - scrollbar = true; + scrollbar = false; sidePadding = 0; border = [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ]; }; diff --git a/home/programs/nvim/plugins/lsp.nix b/home/programs/nvim/plugins/lsp.nix index ce2d13b..8c27add 100644 --- a/home/programs/nvim/plugins/lsp.nix +++ b/home/programs/nvim/plugins/lsp.nix @@ -9,16 +9,9 @@ gopls.enable = true; nixd.enable = true; tailwindcss.enable = true; - # html.enable = true; # FIXME: broken for some reason + html.enable = true; svelte.enable = true; marksman.enable = true; - ltex = { - enable = false; - settings = { - enabled = false; - language = "en"; - }; - }; }; keymaps.lspBuf = { "gd" = "definition"; diff --git a/home/programs/nvim/plugins/markdown.nix b/home/programs/nvim/plugins/markdown.nix index 00bc975..f4fe872 100644 --- a/home/programs/nvim/plugins/markdown.nix +++ b/home/programs/nvim/plugins/markdown.nix @@ -9,7 +9,7 @@ extraConfigLua = "require('render-markdown').setup({})"; plugins = { mkdnflow = { - enable = true; + enable = false; mappings = { # Main diff --git a/home/programs/nvim/plugins/tree.nix b/home/programs/nvim/plugins/tree.nix index 6e753ee..d0eb537 100644 --- a/home/programs/nvim/plugins/tree.nix +++ b/home/programs/nvim/plugins/tree.nix @@ -40,22 +40,5 @@ }; }; }; - keymaps = [ - { - key = "-"; - action = "Oil"; - options.desc = "Oil"; - } - { - key = "e"; - action = "Oil --float"; - options.desc = "Oil"; - } - { - key = "E"; - action = "Neotree toggle"; - options.desc = "Neotree"; - } - ]; }; } diff --git a/home/programs/nvim/plugins/ui.nix b/home/programs/nvim/plugins/ui.nix index 1c7cce5..200debd 100644 --- a/home/programs/nvim/plugins/ui.nix +++ b/home/programs/nvim/plugins/ui.nix @@ -9,14 +9,54 @@ Headline1.bold = true; }; plugins = { - lualine.enable = true; + lualine = { + enable = true; + settings = { + options = { + sections = { + lualine_a = [ "mode" ]; + lualine_b = [ ]; + lualine_c = [ ]; + lualine_y = [{ + __unkeyed-1 = "aerial"; + colored = true; + cond = { + __raw = '' + function() + local buf_size_limit = 1024 * 1024 + if vim.api.nvim_buf_get_offset(0, vim.api.nvim_buf_line_count(0)) > buf_size_limit then + return false + end + + return true + end + ''; + }; + dense = false; + dense_sep = "."; + depth = { __raw = "nil"; }; + sep = " ) "; + }]; + lualine_z = [{ __unkeyed-1 = "location"; }]; + }; + tabline = { + lualine_a = [{ + __unkeyed-1 = "buffers"; + symbols = { alternate_file = ""; }; + }]; + lualine_z = [ "tabs" ]; + }; + }; + }; + }; + dap.enable = true; web-devicons.enable = true; noice.enable = true; gitsigns = { enable = true; settings.current_line_blame = false; }; - bufferline.enable = true; + # bufferline.enable = true; trouble.enable = true; indent-blankline.enable = true; which-key.enable = true; diff --git a/home/programs/nvim/plugins/utils.nix b/home/programs/nvim/plugins/utils.nix index bf9d58c..e7799cb 100644 --- a/home/programs/nvim/plugins/utils.nix +++ b/home/programs/nvim/plugins/utils.nix @@ -13,10 +13,6 @@ friendly-snippets.enable = true; telescope = { enable = true; - keymaps = { - "fg" = "live_grep"; - " " = "find_files"; - }; extensions.fzf-native = { enable = true; }; }; treesitter = { @@ -29,23 +25,5 @@ }; treesitter-context.enable = true; }; - keymaps = [ - { - key = ""; - action = "TmuxNavigateLeft"; - } - { - key = ""; - action = "TmuxNavigateDown"; - } - { - key = ""; - action = "TmuxNavigateUp"; - } - { - key = ""; - action = "TmuxNavigateRight"; - } - ]; }; } diff --git a/home/programs/nvim/plugins/zen-mode.nix b/home/programs/nvim/plugins/zen-mode.nix deleted file mode 100644 index 17732ca..0000000 --- a/home/programs/nvim/plugins/zen-mode.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - programs.nixvim.plugins.zen-mode = { - enable = true; - settings = { - on_open = '' - function() - require("gitsigns.actions").toggle_current_line_blame() - vim.opt.relativenumber = false - vim.opt.signcolumn = "no" - vim.opt.wrap = true - vim.opt.linebreak = true - end - ''; - plugins = { - gitsigns = { enabled = true; }; - options = { - enabled = true; - ruler = false; - showcmd = false; - }; - tmux = { enabled = true; }; - }; - window = { - backdrop = 0.95; - height = 1; - options = { signcolumn = "no"; }; - width = 0.9; - }; - }; - }; -} diff --git a/home/programs/shell/tmux.nix b/home/programs/shell/tmux.nix index 9a326ad..ec89ab5 100644 --- a/home/programs/shell/tmux.nix +++ b/home/programs/shell/tmux.nix @@ -25,7 +25,8 @@ plugins = with pkgs; [ tmuxPlugins.vim-tmux-navigator tmuxPlugins.resurrect - tmuxPlugins.nord + tmuxPlugins.sensible + tmuxPlugins.tokyo-night-tmux ]; }; } diff --git a/home/scripts/hyprfocus/default.nix b/home/scripts/hyprfocus/default.nix index e72f2af..0626755 100644 --- a/home/scripts/hyprfocus/default.nix +++ b/home/scripts/hyprfocus/default.nix @@ -1,19 +1,35 @@ { pkgs, ... }: let - hyprfocus = pkgs.writeShellScriptBin "hyprfocus" '' - hyprctl keyword "general:gaps_in" 0 - hyprctl keyword "general:gaps_out" 0 - # TODO: Fix this: - hyprpanel-toggle - hyprctl keyword "general:border_size" 1 - hyprctl keyword "decoration:rounding" 0 - hyprctl keyword "decoration:drop_shadow" false - hyprctl keyword "decoration:inactive_opacity" 0.98 - hyprctl keyword "decoration:active_opacity" 1 - ''; + hyprfocus-on = pkgs.writeShellScriptBin "hyprfocus-on" + # bash + '' + hyprctl keyword "general:gaps_in" 0 + hyprctl keyword "general:gaps_out" 0 + # TODO: Fix this: + hyprpanel-toggle + hyprctl keyword "general:border_size" 1 + hyprctl keyword "decoration:rounding" 0 + hyprctl keyword "decoration:drop_shadow" false + hyprctl keyword "decoration:inactive_opacity" 0.98 + hyprctl keyword "decoration:active_opacity" 1 + echo "1" > /tmp/hyprfocus + ''; - hyprfocus-kill = pkgs.writeShellScriptBin "hyprfocus-kill" '' - hyprctl reload - hyprpanel-reload - ''; -in { home.packages = [ hyprfocus hyprfocus-kill ]; } + hyprfocus-off = pkgs.writeShellScriptBin "hyprfocus-off" + # bash + '' + hyprctl reload + hyprpanel-reload + rm /tmp/hyprfocus + ''; + + hyprfocus-toggle = pkgs.writeShellScriptBin "hyprfocus-toggle" + # bash + '' + if [ -f /tmp/hyprfocus ]; then + hyprfocus-kill + else + hyprfocus + fi + ''; +in { home.packages = [ hyprfocus-on hyprfocus-off hyprfocus-toggle ]; } diff --git a/home/system/batsignal/default.nix b/home/system/batsignal/default.nix index 812874a..b5d908c 100644 --- a/home/system/batsignal/default.nix +++ b/home/system/batsignal/default.nix @@ -1,6 +1,6 @@ { services.batsignal = { enable = true; - extraArgs = [ "-c 10" "-w 30" "-f 97" ]; + extraArgs = [ "-c 10" "-w 30" "-f disabled" ]; }; } diff --git a/home/system/hyprland/default.nix b/home/system/hyprland/default.nix index 989db76..d410f0c 100644 --- a/home/system/hyprland/default.nix +++ b/home/system/hyprland/default.nix @@ -36,7 +36,6 @@ xwayland.enable = true; systemd.enable = true; package = inputs.hyprland.packages."${pkgs.system}".hyprland; - plugins = [ inputs.hyprland-plugins.packages.${pkgs.system}.hyprexpo ]; settings = { "$mod" = "SUPER"; @@ -55,21 +54,6 @@ ",prefered,auto,1" ]; - plugin = { - hyprexpo = { - columns = 2; - gap_size = 5; - bg_col = "rgb(111111)"; - workspace_method = - "center current"; # [center/first] [workspace] e.g. first 1 or center m+1 - - enable_gesture = true; # laptop touchpad - gesture_fingers = 3; # 3 or 4 - gesture_distance = 300; # how far is the "max" - gesture_positive = true; # positive = swipe down. Negative = swipe up. - }; - }; - bind = [ "$mod, RETURN, exec, ${pkgs.kitty}/bin/kitty" # Kitty "$mod, E, exec, ${pkgs.xfce.thunar}/bin/thunar" # Thunar @@ -78,7 +62,7 @@ "$mod, L, exec, ${pkgs.hyprlock}/bin/hyprlock" # Lock "$mod, X, exec, powermenu" # Powermenu "$mod, SPACE, exec, menu" # Launcher - "$shiftMod, SPACE, hyprexpo:expo, toggle" # HyprExpo + "$shiftMod, SPACE, exec, hyprfocus-toggle" # Toggle HyprFocus "$mod, Q, killactive," # Close window "$mod, T, togglefloating," # Toggle Floating