aboutsummaryrefslogtreecommitdiff
path: root/programs
diff options
context:
space:
mode:
Diffstat (limited to 'programs')
-rw-r--r--programs/bash.nix41
-rw-r--r--programs/tmux.nix5
2 files changed, 41 insertions, 5 deletions
diff --git a/programs/bash.nix b/programs/bash.nix
index 9ad3217..2a3cb97 100644
--- a/programs/bash.nix
+++ b/programs/bash.nix
@@ -23,7 +23,6 @@
23 rless = "less -r"; 23 rless = "less -r";
24 tmux = "tmux -u"; 24 tmux = "tmux -u";
25 tree = "tree -C"; 25 tree = "tree -C";
26 vim = "nvim";
27 tb = "nc termbin.com 9999"; 26 tb = "nc termbin.com 9999";
28 n = "j"; 27 n = "j";
29 28
@@ -35,6 +34,7 @@
35 gl = "git log -p --abbrev-commit --pretty=medium"; 34 gl = "git log -p --abbrev-commit --pretty=medium";
36 glo = "git log --pretty=oneline --abbrev-commit"; 35 glo = "git log --pretty=oneline --abbrev-commit";
37 gst = "git status --short"; 36 gst = "git status --short";
37 gwls = "git worktree list";
38 }; 38 };
39 39
40 shellOptions = [ 40 shellOptions = [
@@ -78,6 +78,45 @@
78 export PS1="\n\001\e[0;36m\002λ\001\e[0m\002 "; 78 export PS1="\n\001\e[0;36m\002λ\001\e[0m\002 ";
79 export PS2="> "; 79 export PS2="> ";
80 80
81 # git functions
82
83 function fuzzy_worktree () {
84 # 1: function that operates on the fzf result
85 # 2: an optional query
86 query="''${2:- }"
87 out=$(
88 set -o pipefail && \
89 git worktree list | \
90 fzf --min-height=15 \
91 --preview-window=up,10 \
92 --preview='git log --color=always -n10 --oneline {2}' \
93 --cycle -1 \
94 -q "$query" | \
95 awk '{print $1}'
96 )
97 [ $? -eq 0 ] && echo "$out" && $1 $out
98 }
99
100 function gwj () {
101 fuzzy_worktree __cd $@
102 }
103
104 function gwa () {
105 git worktree add "$1" && cd "$1"
106 }
107
108 function gwrm () {
109 fuzzy_worktree __rm $@
110 }
111
112 function __cd() {
113 cd "$1"
114 }
115
116 function __rm() {
117 git worktree remove "$1"
118 }
119
81 ''; 120 '';
82 121
83 }; 122 };
diff --git a/programs/tmux.nix b/programs/tmux.nix
index 8679222..e5c5aa1 100644
--- a/programs/tmux.nix
+++ b/programs/tmux.nix
@@ -26,6 +26,7 @@
26 setw -g pane-base-index 1 26 setw -g pane-base-index 1
27 27
28 # pane binds 28 # pane binds
29 unbind-key E
29 bind-key h select-pane -L 30 bind-key h select-pane -L
30 bind-key n select-pane -D 31 bind-key n select-pane -D
31 bind-key e select-pane -U 32 bind-key e select-pane -U
@@ -58,10 +59,6 @@
58 bind-key -T copy-mode-vi r send-keys -X rectangle-toggle 59 bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
59 bind P paste-buffer 60 bind P paste-buffer
60 61
61 bind E command-prompt -p "Command:" \
62 "run \"tmux list-panes -a -F '##{session_name}:##{window_index}.##{pane_index}' \
63 | xargs -I PANE tmux send-keys -t PANE '%1' Enter\""
64
65 set-window-option -g allow-rename off 62 set-window-option -g allow-rename off
66 63
67 set -g pane-border-style fg=colour11 64 set -g pane-border-style fg=colour11