From bdf869a2e3fe5f693577a6962e565b47a2289100 Mon Sep 17 00:00:00 2001 From: albert Date: Tue, 2 Apr 2024 18:23:07 +0900 Subject: [PATCH] Update --- README.md | 7 ++ home-manager/common/software/cli/bash.nix | 2 +- .../common/software/cli/nixvim/base.nix | 87 ++----------------- .../common/software/cli/nixvim/keymaps.nix | 82 +++++++++++++++++ home-manager/common/software/cli/tmux.nix | 6 +- 5 files changed, 98 insertions(+), 86 deletions(-) create mode 100644 home-manager/common/software/cli/nixvim/keymaps.nix diff --git a/README.md b/README.md index bf40e24c..6f41e826 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,13 @@ nix develop -c /etc/nixos/git/docs/setup.sh --- # To Do List +* [ ] fixes + * fix vim theming in tmux + * change tmux bracket angles + * change vim bracket angles + * find a better sidebar for vim + * try the outliner tool again for vim + ## Host Specific ### framework-server * [ ] Try this https://www.ntop.org/products/traffic-analysis/ntop/ diff --git a/home-manager/common/software/cli/bash.nix b/home-manager/common/software/cli/bash.nix index d1b773c2..22a9df5b 100644 --- a/home-manager/common/software/cli/bash.nix +++ b/home-manager/common/software/cli/bash.nix @@ -37,7 +37,7 @@ GPG_TTY=$(tty) EDITOR=vim ssh-add > /dev/null &> /dev/null - [ -z "$TMUX" ] && { tmux attach || exec tmux new-session && exit;} + # [ -z "$TMUX" ] && { tmux attach || exec tmux new-session && exit;} ''; sessionVariables = { # Set the GTK Theme diff --git a/home-manager/common/software/cli/nixvim/base.nix b/home-manager/common/software/cli/nixvim/base.nix index 514fbc71..5dc88f75 100644 --- a/home-manager/common/software/cli/nixvim/base.nix +++ b/home-manager/common/software/cli/nixvim/base.nix @@ -1,6 +1,7 @@ { inputs, pkgs, lib, theme, ... }: { imports = [ ./alpha.nix + ./keymaps.nix inputs.nixvim.homeManagerModules.nixvim ] ++ lib.optional (builtins.isString theme) ../../../../../stylix/themes/${theme}/home-manager/nixvim.nix; @@ -25,88 +26,9 @@ breakindent = true; colorcolumn = "100"; showmode = false; + termguicolors = true; }; - keymaps = let - map = mode: key: action: { mode = mode; key = key; action = action; }; - nmap = key: action: map [ "n" ] key action; - nvmap = key: action: map [ "n" "v" ] key action; - # imap = key: action: map [ "i" ] key action; - desc = d: { options.desc = d; }; - silent = { options.silent = true; }; - expr = { options.expr = true; }; - in [ - # Unmap keys that aren't useful, or that we want to use for different things - (nvmap "" "" // silent) - (nvmap "" "" // silent) - (nvmap "s" "" // silent) - # Redo - (nmap "R" "") - # Copy and paste - (nvmap "y" "\"+y" // desc "Cop[y] to clipboard") - (nvmap "p" "\"+p" // desc "[P]aste from clipboard") - # Jump to start/end of line - (nvmap "H" "0") - (nvmap "L" "$") - # Navigate up and down word wrapped text as if it were not word wrapped - (nmap "k" "v:count == 0 ? 'gk' : 'k'" // silent // expr) - (nmap "j" "v:count == 0 ? 'gj' : 'j'" // silent // expr) - # Center cursor when jumping foward or back - (nmap "" "zz") - (nmap "" "zz") - # Insert Mode - - # Normal Mode - # NVimTree - (nmap "n" "" // desc "[N]vimTree") - (nmap "nf" ":NvimTreeFocus" // desc "[F]ocus NvimTree") - (nmap "nt" ":NvimTreeToggle" // desc "[T]oggle NvimTree") - (nmap "ns" ":NvimTreeFindFile"// desc "[S]earch NvimTree") - (nmap "nc" ":NvimTreeClose" // desc "[C]lose NvimTree") - (nmap "nr" ":NvimTreeRefresh" // desc "[R]efresh NvimTree") - (nmap "nT" ":NoiceTelescope" // desc "Noice [T]elescope") - # ToggleTerm - (nmap "Tt" ":ToggleTerm" // desc "[T]oggle Terminal") - (nmap "Ts" ":TermSelect" // desc "[S]elect a terminal") - # Fugitive - (nmap "gc" ":Git cam \"" // desc "[C]ommit" ) - (nmap "gp" ":Git push" // desc "Git [p]ush") - (nmap "gP" ":Git pull" // desc "[P]ull") - (nmap "ga" ":Git add " // desc "[A]dd file...") - (nmap "gb" ":Git blame" // desc "[B]lame") - (nmap "gd" ":Git diff" // desc "[D]iff") - # Trouble - (nmap "tf" ":Trouble" // desc "[F]ocus") - (nmap "tt" ":TroubleToggle" // desc "[T]oggle") - (nmap "tc" ":TroubleClose" // desc "[C]lose") - # Navbuddy - (nmap "N" ":Navbuddy" // desc "[N]avbuddy") - # Window Management - (nmap "wh" ":wincmd h" // desc "Move left") - (nmap "wl" ":wincmd l" // desc "Move right") - (nmap "wj" ":wincmd j" // desc "Move down") - (nmap "wk" ":wincmd k" // desc "Move up") - (nmap "wn" ":wincmd w" // desc "Move to next") - (nmap "wN" ":wincmd p" // desc "Move to previous") - (nmap "wc" ":wincmd c" // desc "[C]lose active window") - (nmap "woh" ":wincmd n" // desc "Open [H]orizontal window") - (nmap "wov" ":wincmd v" // desc "Open [V]ertical window") - # resize window - (nmap "wrh" ":resize " // desc "Resize Horizontal") - (nmap "wrv" ":vertical resize " // desc "Resize Vertical") - # Buffer Management - (nmap "bn" ":bnext" // desc "Next buffer") - (nmap "bN" ":bNext" // desc "Previous buffer") - (nmap "bc" ":bdelete" // desc "[c]lose buffer") - (nmap "bt" ":enew" // desc "New [T]ab") - # Multicursors - (nmap "ms" ":MCstart" // desc "[S]tart Multicorsor") - (nmap "mv" ":MCvisual" // desc "[V]isual Multicorsor") - (nmap "mc" ":MCclear" // desc "[C]lear Multicorsor") - (nmap "mu" ":MCunderCursor" // desc "Select [U]nder Corsor") - (nmap "mp" ":MCpattern" // desc "Select [P]attern") - ]; - plugins = { # Testing noice = { @@ -335,12 +257,13 @@ catppuccin.enable = true; dracula.enable = true; oxocarbon.enable = true; + ayu.enable = true; + kanagawa.enable = true; }; extraPlugins = with pkgs.vimPlugins; [ - awesome-vim-colorschemes everforest - onehalf + onedark-nvim rose-pine melange-nvim ]; diff --git a/home-manager/common/software/cli/nixvim/keymaps.nix b/home-manager/common/software/cli/nixvim/keymaps.nix new file mode 100644 index 00000000..6d5aa8bf --- /dev/null +++ b/home-manager/common/software/cli/nixvim/keymaps.nix @@ -0,0 +1,82 @@ +{ ... }: { + programs.nixvim.keymaps = + let + map = mode: key: action: { mode = mode; key = key; action = action; }; + nmap = key: action: map [ "n" ] key action; + nvmap = key: action: map [ "n" "v" ] key action; + # imap = key: action: map [ "i" ] key action; + desc = d: { options.desc = d; }; + silent = { options.silent = true; }; + expr = { options.expr = true; }; + in [ + # Unmap keys that aren't useful, or that we want to use for different things + (nvmap "" "" // silent) + (nvmap "" "" // silent) + (nvmap "s" "" // silent) + # Redo + (nmap "R" "") + # Copy and paste + (nvmap "y" "\"+y" // desc "Cop[y] to clipboard") + (nvmap "p" "\"+p" // desc "[P]aste from clipboard") + # Jump to start/end of line + (nvmap "H" "0") + (nvmap "L" "$") + # Navigate up and down word wrapped text as if it were not word wrapped + (nmap "k" "v:count == 0 ? 'gk' : 'k'" // silent // expr) + (nmap "j" "v:count == 0 ? 'gj' : 'j'" // silent // expr) + # Center cursor when jumping foward or back + (nmap "" "zz") + (nmap "" "zz") + # Insert Mode + + # Normal Mode + # NVimTree + (nmap "n" "" // desc "[N]vimTree") + (nmap "nf" ":NvimTreeFocus" // desc "[F]ocus NvimTree") + (nmap "nt" ":NvimTreeToggle" // desc "[T]oggle NvimTree") + (nmap "ns" ":NvimTreeFindFile"// desc "[S]earch NvimTree") + (nmap "nc" ":NvimTreeClose" // desc "[C]lose NvimTree") + (nmap "nr" ":NvimTreeRefresh" // desc "[R]efresh NvimTree") + (nmap "nT" ":NoiceTelescope" // desc "Noice [T]elescope") + # ToggleTerm + (nmap "Tt" ":ToggleTerm" // desc "[T]oggle Terminal") + (nmap "Ts" ":TermSelect" // desc "[S]elect a terminal") + # Fugitive + (nmap "gc" ":Git cam \"" // desc "[C]ommit" ) + (nmap "gp" ":Git push" // desc "Git [p]ush") + (nmap "gP" ":Git pull" // desc "[P]ull") + (nmap "ga" ":Git add " // desc "[A]dd file...") + (nmap "gb" ":Git blame" // desc "[B]lame") + (nmap "gd" ":Git diff" // desc "[D]iff") + # Trouble + (nmap "tf" ":Trouble" // desc "[F]ocus") + (nmap "tt" ":TroubleToggle" // desc "[T]oggle") + (nmap "tc" ":TroubleClose" // desc "[C]lose") + # Navbuddy + (nmap "N" ":Navbuddy" // desc "[N]avbuddy") + # Window Management + (nmap "wh" ":wincmd h" // desc "Move left") + (nmap "wl" ":wincmd l" // desc "Move right") + (nmap "wj" ":wincmd j" // desc "Move down") + (nmap "wk" ":wincmd k" // desc "Move up") + (nmap "wn" ":wincmd w" // desc "Move to next") + (nmap "wN" ":wincmd p" // desc "Move to previous") + (nmap "wc" ":wincmd c" // desc "[C]lose active window") + (nmap "woh" ":wincmd n" // desc "Open [H]orizontal window") + (nmap "wov" ":wincmd v" // desc "Open [V]ertical window") + # resize window + (nmap "wrh" ":resize " // desc "Resize Horizontal") + (nmap "wrv" ":vertical resize " // desc "Resize Vertical") + # Buffer Management + (nmap "bn" ":bnext" // desc "Next buffer") + (nmap "bN" ":bNext" // desc "Previous buffer") + (nmap "bc" ":bdelete" // desc "[c]lose buffer") + (nmap "bt" ":enew" // desc "New [T]ab") + # Multicursors + (nmap "ms" ":MCstart" // desc "[S]tart Multicorsor") + (nmap "mv" ":MCvisual" // desc "[V]isual Multicorsor") + (nmap "mc" ":MCclear" // desc "[C]lear Multicorsor") + (nmap "mu" ":MCunderCursor" // desc "Select [U]nder Corsor") + (nmap "mp" ":MCpattern" // desc "Select [P]attern") + ]; +} diff --git a/home-manager/common/software/cli/tmux.nix b/home-manager/common/software/cli/tmux.nix index b009e5f5..758c50ef 100644 --- a/home-manager/common/software/cli/tmux.nix +++ b/home-manager/common/software/cli/tmux.nix @@ -8,7 +8,7 @@ { plugin = power-theme; extraConfig = '' - set -g @tmux_power_theme '#${config.lib.stylix.colors.base06}' + set -g @tmux_power_theme '#${config.lib.stylix.colors.base05}' set -g @tmux_power_right_arrow_icon ' ' set -g @tmux_power_left_arrow_icon ' ' set -g @tmux_power_prefix_highlight_pos 'R' @@ -29,8 +29,8 @@ extraConfig = '' bind | split-window -h bind - split-window -v - bind n swap-window -t +1 - bind N swap-window -t -1 + bind n next-window + bind N previous-window ''; }; }