diff --git a/flake.lock b/flake.lock index 091046e..5bf5b91 100644 --- a/flake.lock +++ b/flake.lock @@ -98,6 +98,22 @@ "type": "github" } }, + "cmp-async-path": { + "flake": false, + "locked": { + "lastModified": 1673896803, + "narHash": "sha256-dgAiVbdMiKjiKWk+dJf/Zz8T20+D4OalGH5dTzYi5aM=", + "owner": "FelipeLema", + "repo": "cmp-async-path", + "rev": "d8229a93d7b71f22c66ca35ac9e6c6cd850ec61d", + "type": "github" + }, + "original": { + "owner": "FelipeLema", + "repo": "cmp-async-path", + "type": "github" + } + }, "comment-box-nvim": { "flake": false, "locked": { @@ -669,6 +685,7 @@ "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", "attic": "attic", "bufferline-nvim": "bufferline-nvim", + "cmp-async-path": "cmp-async-path", "comment-box-nvim": "comment-box-nvim", "copilot-lua": "copilot-lua", "flake-utils": "flake-utils", diff --git a/flake.nix b/flake.nix index 91c1d6a..6be401c 100644 --- a/flake.nix +++ b/flake.nix @@ -39,6 +39,9 @@ bufferline-nvim.flake = false; bufferline-nvim.url = "github:akinsho/bufferline.nvim"; + cmp-async-path.url = "github:FelipeLema/cmp-async-path"; + cmp-async-path.flake = false; + comment-box-nvim.flake = false; comment-box-nvim.url = "github:LudoPinelli/comment-box.nvim"; diff --git a/modules/config/theming/catppuccin-frappe.nix b/modules/config/theming/catppuccin-frappe.nix index 8be760f..6be8d62 100644 --- a/modules/config/theming/catppuccin-frappe.nix +++ b/modules/config/theming/catppuccin-frappe.nix @@ -9,6 +9,7 @@ in (import ./catppuccin.nix { inherit config lib pkgs; + flavor = "mocha"; rosewater = "f2d5cf"; flamingo = "eebebe"; pink = "f4b8e4"; diff --git a/modules/config/theming/catppuccin-latte.nix b/modules/config/theming/catppuccin-latte.nix index 3cf64d8..96051cb 100644 --- a/modules/config/theming/catppuccin-latte.nix +++ b/modules/config/theming/catppuccin-latte.nix @@ -9,6 +9,7 @@ in (import ./catppuccin.nix { inherit config lib pkgs; + flavor = "mocha"; rosewater = "dc8a78"; flamingo = "dd7878"; pink = "ea76cb"; diff --git a/modules/config/theming/catppuccin-macchiato.nix b/modules/config/theming/catppuccin-macchiato.nix index f4f02f6..c8e0a6c 100644 --- a/modules/config/theming/catppuccin-macchiato.nix +++ b/modules/config/theming/catppuccin-macchiato.nix @@ -9,6 +9,7 @@ in (import ./catppuccin.nix { inherit config lib pkgs; + flavor = "mocha"; rosewater = "f4dbd6"; flamingo = "f0c6c6"; pink = "f5bde6"; diff --git a/modules/config/theming/catppuccin-mocha.nix b/modules/config/theming/catppuccin-mocha.nix index 6b39aa6..4cfc510 100644 --- a/modules/config/theming/catppuccin-mocha.nix +++ b/modules/config/theming/catppuccin-mocha.nix @@ -9,6 +9,7 @@ in (import ./catppuccin.nix { inherit config lib pkgs; + flavor = "mocha"; rosewater = "f5e0dc"; flamingo = "f2cdcd"; pink = "f5c2e7"; diff --git a/modules/config/theming/catppuccin.nix b/modules/config/theming/catppuccin.nix index 0c8d8a9..17c9118 100644 --- a/modules/config/theming/catppuccin.nix +++ b/modules/config/theming/catppuccin.nix @@ -1,4 +1,6 @@ { config +, pkgs +, flavor , rosewater , flamingo , pink @@ -127,6 +129,12 @@ color7 #${subtext1} color15 #${subtext0} ''; + tmux.plugins = with pkgs.tmuxPlugins; [ + { + plugin = catppuccin; + extraConfig = "set -g @catppuccin_flavour '${flavor}'"; + } + ]; zathura.extraConfig = '' set window-title-basename "true" set selection-clipboard "clipboard" diff --git a/modules/config/theming/dracula.nix b/modules/config/theming/dracula.nix index 317926a..d6aca86 100644 --- a/modules/config/theming/dracula.nix +++ b/modules/config/theming/dracula.nix @@ -1,5 +1,6 @@ { config , lib +, pkgs , ... }: @@ -97,6 +98,9 @@ in active_border_color #f8f8f2 inactive_border_color #6272a4 ''; + tmux.plugins = with pkgs.tmuxPlugins; [ + dracula + ]; zathura.extraConfig = '' set window-title-basename "true" set selection-clipboard "clipboard" diff --git a/modules/profiles/base.nix b/modules/profiles/base.nix index 7d1c6e7..6f2fb3f 100644 --- a/modules/profiles/base.nix +++ b/modules/profiles/base.nix @@ -62,6 +62,8 @@ in fish.enable = true; git.enable = true; gpg.enable = true; + navi.enable = true; + tmux.enable = true; }; }; @@ -98,8 +100,8 @@ in exa gparted neofetch + reptyr ripgrep - tmux up viu wget @@ -143,7 +145,6 @@ in ]; }; zoxide.enable = true; - navi.enable = true; }; home = { username = "moritz"; diff --git a/modules/profiles/desktop.nix b/modules/profiles/desktop.nix index ef5a639..855c581 100644 --- a/modules/profiles/desktop.nix +++ b/modules/profiles/desktop.nix @@ -48,7 +48,6 @@ with lib; { pavucontrol stable.libreoffice # HACK to fix build error stable.signal-desktop - synology-drive-client texlive.combined.scheme-full thunderbird vlc diff --git a/modules/profiles/personal.nix b/modules/profiles/personal.nix index 6bf7167..80bb527 100644 --- a/modules/profiles/personal.nix +++ b/modules/profiles/personal.nix @@ -57,4 +57,8 @@ with lib; }; }; }; + + environment.systemPackages = with pkgs; [ + synology-drive-client + ]; } diff --git a/modules/programs/default.nix b/modules/programs/default.nix index 788e8fd..bf1d830 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -18,6 +18,7 @@ ./ledger ./logseq.nix ./miracast.nix + ./navi ./nvim ./python.nix ./rofi @@ -25,6 +26,7 @@ ./ssh.nix ./sway.nix ./thunar.nix + ./tmux.nix ./zathura.nix ./zsh.nix ]; diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 1101cbf..549a363 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -27,9 +27,7 @@ in fish = { enable = true; shellAbbrs = shellConfig.abbreviations; - shellAliases = shellConfig.aliases; - shellInit = '' # Vi Mode fish_vi_key_bindings diff --git a/modules/programs/navi/cheats/reptyr.cheat b/modules/programs/navi/cheats/reptyr.cheat new file mode 100644 index 0000000..1ea2e55 --- /dev/null +++ b/modules/programs/navi/cheats/reptyr.cheat @@ -0,0 +1,6 @@ +% tmux, reptyr + +# send background process to tmux +bg && disown && tmux new "$SHELL -c 'reptyr '" + +$ process: ps x -eo pid,tty,stat | awk '$2 ~ /pts/' | awk '$3 ~ /T/' | cut -d" " -f1 --- --preview "ps -p {} -o cmd" diff --git a/modules/programs/navi/default.nix b/modules/programs/navi/default.nix new file mode 100644 index 0000000..1772d61 --- /dev/null +++ b/modules/programs/navi/default.nix @@ -0,0 +1,20 @@ +{ config, lib, ... }: + +with lib; +let + cfg = config.my.programs.navi; +in +{ + options.my.programs.navi.enable = mkEnableOption "navi"; + + config = mkIf cfg.enable { + home-manager.users.moritz = { + programs.navi.enable = true; + xdg.dataFile."navi/cheats/personal" = { + enable = true; + recursive = true; + source = ./cheats; + }; + }; + }; +} diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 4d566e9..101343f 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -66,6 +66,7 @@ in yamlfmt ]; plugins = with pkgs.vimPlugins; [ + cmp-async-path cmp-nvim-lsp cmp_luasnip copilot-cmp diff --git a/modules/programs/nvim/init.lua b/modules/programs/nvim/init.lua index bd08d4c..d7bc4e7 100644 --- a/modules/programs/nvim/init.lua +++ b/modules/programs/nvim/init.lua @@ -21,6 +21,13 @@ vim.api.nvim_create_autocmd("InsertEnter", { require("luasnip.loaders.from_vscode").lazy_load() require("copilot_cmp").setup() + local default_sources = { + { name = "async_path", priority = 4 }, + { name = "copilot", priority = 3 }, + { name = "luasnip", priority = 2 }, + { name = "nvim_lsp", priority = 4 }, + } + cmp.setup({ formatting = { format = require("lspkind").cmp_format({ @@ -63,13 +70,14 @@ vim.api.nvim_create_autocmd("InsertEnter", { end end, { "i", "s" }), }), - sources = { - { name = "buffer", priority = 1 }, - { name = "copilot", priority = 8 }, - { name = "luasnip", priority = 7 }, - { name = "nvim_lsp", priority = 9 }, - { name = "orgmode", priority = 9 }, - }, + sources = default_sources, + }) + + cmp.setup.filetype("org", { + sources = vim.tbl_deep_extend("force", default_sources, { + { name = "buffer", priority = 5 }, + { name = "orgmode", priority = 5 }, + }), }) end, }) diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix new file mode 100644 index 0000000..ef01b1f --- /dev/null +++ b/modules/programs/tmux.nix @@ -0,0 +1,82 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.my.programs.tmux; + + tmux-sessionizer = pkgs.writeShellApplication { + name = "ts"; + runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd ]; + text = '' + #!/usr/bin/env bash + + if [[ $# -eq 1 ]]; then + selected=$1 + else + selected=$(fd -gH '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | fzf) + fi + + if [[ -z $selected ]]; then + exit 0 + fi + + selected_name=$(basename "$selected" | tr . _) + + if ! tmux has-session -t="$selected_name" 2> /dev/null; then + tmux new-session -ds "$selected_name" -c "$selected" + fi + + if [[ -z ''${TMUX+x} ]]; then + tmux attach -t "$selected_name" + else + tmux switch-client -t "$selected_name" + fi + ''; + }; + +in +{ + options.my.programs.tmux = { + enable = mkEnableOption "tmux"; + autoAttach = mkEnableOption "autoAttach"; + }; + + config = mkIf cfg.enable { + my.shell.abbreviations.t = "tmux"; + + home-manager.users.moritz.home.packages = [ tmux-sessionizer ]; + home-manager.users.moritz.programs = { + tmux = { + enable = true; + clock24 = true; + customPaneNavigationAndResize = true; + keyMode = "vi"; + mouse = true; + newSession = true; + prefix = "C-Space"; + sensibleOnTop = false; + plugins = with pkgs.tmuxPlugins; [ + sensible + tmux-fzf + yank + ]; + }; + fzf.tmux.enableShellIntegration = true; + fish.interactiveShellInit = + let + insideVariables = [ "$TMUX" "$INSIDE_EMACS" "$EMACS" "$VIM" "$VSCODE_RESOLVING_ENVIRONMENT" ]; + insideVariableMissing = concatStringsSep " && " (map (x: "test -z ${x}") insideVariables); + in + mkIf cfg.autoAttach + '' + if ! fish_is_root_user && test "$TERM_PROGRAM" != 'vscode' && ${insideVariableMissing} + if test -z $tmux_autostarted + set -x tmux_autostarted true + ts + end + end + ''; + + }; + }; +} diff --git a/overlays/vimPlugins.nix b/overlays/vimPlugins.nix index 1f56a3c..71a81a1 100644 --- a/overlays/vimPlugins.nix +++ b/overlays/vimPlugins.nix @@ -26,11 +26,11 @@ with lib.my; src = inputs.lspsaga-nvim; }); - advanced-git-search-nvim = prev.vimUtils.buildVimPluginFrom2Nix { - pname = "advanced-git-search-nvim"; - version = mkVersionInput inputs.advanced-git-search-nvim; - src = inputs.advanced-git-search-nvim; - }; + cmp-async-path = prev.vimPlugins.cmp-path.overrideAttrs (old: { + pname = "cmp-async-path"; + version = mkVersionInput inputs.cmp-async-path; + src = inputs.cmp-async-path; + }); comment-box-nvim = prev.vimUtils.buildVimPluginFrom2Nix { pname = "comment-box-nvim";