From 216e662dbdeaaf993d8d73c015dde842f53e4c21 Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Fri, 6 Oct 2023 01:14:52 +0200 Subject: [PATCH] add alternative config to try to get clean of emacs --- home/rachel.nix | 116 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 1 deletion(-) diff --git a/home/rachel.nix b/home/rachel.nix index e91744c..53d0cd4 100644 --- a/home/rachel.nix +++ b/home/rachel.nix @@ -109,7 +109,6 @@ in XAUTHORITY = "${homeDir}/.local/share/Xauthority"; PASH_KEYID = "3E4A909C8FEF6E3783699C79DFC26EF8EDAD6D71"; QT_AUTO_SCREEN_FACTOR = 1; - EDITOR = "emacsclient"; PATH = "${homeDir}/bin:$PATH"; }; shellAliases = { @@ -176,5 +175,120 @@ in init.defaultBranch = "master"; }; }; + + neovim = { + defaultEditor = true; + enable = true; + vimAlias = true; + extraLuaConfig = '' + require("tmux").setup({ copy_sync = { redirect_to_clipboard = true } }); + ''; + extraConfig = '' + set rnu nu + set ts=2 sw=2 expandtab + set clipboard=unnamedplus + set laststatus=2 noshowmode + let g:lightline = { 'colorscheme': 'gruvbox' } + colorscheme gruvbox + hi Normal guibg=NONE ctermbg=NONE + ''; + plugins = with pkgs.vimPlugins; [ + surround-nvim + comment-nvim + vimtex + gruvbox-nvim + lightline-vim + lightline-gruvbox-vim + tmux-nvim + ]; + }; + + tmux = { + enable = true; + clock24 = true; + escapeTime = 0; + keyMode = "vi"; + mouse = false; + shortcut = "a"; + extraConfig = '' + bind h split -hb -c '#{pane_current_path}' + bind j split -v -c '#{pane_current_path}' + bind k split -vb -c '#{pane_current_path}' + bind l split -h -c '#{pane_current_path}' + + is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'" + + bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' + bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' + bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' + bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' + + bind-key -T copy-mode-vi 'C-h' select-pane -L + bind-key -T copy-mode-vi 'C-j' select-pane -D + bind-key -T copy-mode-vi 'C-k' select-pane -U + bind-key -T copy-mode-vi 'C-l' select-pane -R + + bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1' + bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1' + bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1' + bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1' + + bind-key -T copy-mode-vi M-h resize-pane -L 1 + bind-key -T copy-mode-vi M-j resize-pane -D 1 + bind-key -T copy-mode-vi M-k resize-pane -U 1 + bind-key -T copy-mode-vi M-l resize-pane -R 1 + + set-option -g status on + set-option -g status-style bg=default + set-option -g status-style fg="#FF7F50" + set-option -g status-interval 2 + set-option -g status-justify "centre" + set-option -g status-right " λ " + + set -g status-interval 1 + set-window-option -g window-status-separator "-" + set-window-option -g window-status-current-format " #[fg=#df73ff bold]!![ #{b:pane_current_path}/ ] #{b:window_index} $ #{b:pane_current_command}!! " + set-window-option -g window-status-format " #{b:window_index} [ #{b:pane_current_path}/ ] #{b:pane_current_command} " + ''; + }; + + alacritty = { + enable = true; + settings = { + window = { + padding.x = 5; + padding.y = 5; + decoration = "none"; + }; + dynamic_title = false; + mouse_hide_when_typing = true; + draw_bold_text_with_bright_colors = false; + scrolling.history = 0; + font = { + normal.family = "SAX2"; + size = 11; + }; + shell.program = + let tmux-menu = pkgs.writeScript "tmux-menu" '' + s="$(tmux ls 2>/dev/null)" + [ "$s" ] && s="$s + " + c=$(${pkgs.fzf}/bin/fzf -1 <<-EOF + ''${s}New Session + Raw Shell + EOF + ) || exit + case "$c" in + "New Session") + read -p "Name? " -r n + ${pkgs.tmux}/bin/tmux new -s "$n" ;; + "Raw Shell") + ${pkgs.bash}/bin/bash ;; + *) + ${pkgs.tmux}/bin/tmux attach-session -t "''${c%%:*}" ;; + esac + ''; in "${tmux-menu}"; + }; + }; }; }