]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Make some functions autoloadable
authorSergey Matveev <stargrave@stargrave.org>
Sun, 28 Nov 2021 08:25:32 +0000 (11:25 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 27 Jan 2022 11:35:14 +0000 (14:35 +0300)
zsh/.zsh/functions/cf [new file with mode: 0644]
zsh/.zsh/functions/f [new file with mode: 0644]
zsh/.zsh/functions/g [new file with mode: 0644]
zsh/.zsh/functions/ssht [new file with mode: 0644]
zsh/.zsh/rc/010autoload.zsh [new file with mode: 0644]
zsh/.zsh/rc/010cf.zsh [deleted file]
zsh/.zsh/rc/010f.zsh [deleted file]
zsh/.zsh/rc/010grep.zsh
zsh/.zsh/rc/010ssh.zsh
zsh/.zsh/rc/010torn.zsh [deleted file]

diff --git a/zsh/.zsh/functions/cf b/zsh/.zsh/functions/cf
new file mode 100644 (file)
index 0000000..f0ab759
--- /dev/null
@@ -0,0 +1,6 @@
+local dir=$(bfs -L ${1:-.} -mindepth 1 \
+    -path "*/\.git" -prune -o \
+    -path "*/\.redo" -prune -o \
+    -type d -print 2>/dev/null |
+        fzf --height 40% --reverse --preview="tree -CN {}")
+[[ -z $dir ]] || { print -s cd $dir ; cd $dir }
diff --git a/zsh/.zsh/functions/f b/zsh/.zsh/functions/f
new file mode 100644 (file)
index 0000000..5f02d04
--- /dev/null
@@ -0,0 +1 @@
+bfs . -name "*$1*" -print
diff --git a/zsh/.zsh/functions/g b/zsh/.zsh/functions/g
new file mode 100644 (file)
index 0000000..7900244
--- /dev/null
@@ -0,0 +1,11 @@
+local GREP_ARGS=(
+    --devices=skip
+    --colour=always
+    --with-filename
+    --line-number
+    --dereference-recursive
+    --binary-files=without-match
+    --exclude-dir=.git
+    --exclude-dir=.tags
+)
+grep $GREP_ARGS $@ | less
diff --git a/zsh/.zsh/functions/ssht b/zsh/.zsh/functions/ssht
new file mode 100644 (file)
index 0000000..bc50397
--- /dev/null
@@ -0,0 +1,2 @@
+local t="-t 0"
+TERM=xterm ssh -C -t $1 "tmux has-session $t && tmux attach-session $t || tmux new-session $t"
diff --git a/zsh/.zsh/rc/010autoload.zsh b/zsh/.zsh/rc/010autoload.zsh
new file mode 100644 (file)
index 0000000..e253807
--- /dev/null
@@ -0,0 +1 @@
+for f (~/.zsh/functions/*) autoload ${f:t}
diff --git a/zsh/.zsh/rc/010cf.zsh b/zsh/.zsh/rc/010cf.zsh
deleted file mode 100644 (file)
index 757409b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-cf() {
-    local dir=$(bfs -L ${1:-.} -mindepth 1 \
-        -path "*/\.git" -prune -o \
-        -path "*/\.redo" -prune -o \
-        -type d -print 2>/dev/null |
-            fzf --height 40% --reverse --preview="tree -CN {}")
-    [[ -z $dir ]] || { print -s cd $dir ; cd $dir }
-}
diff --git a/zsh/.zsh/rc/010f.zsh b/zsh/.zsh/rc/010f.zsh
deleted file mode 100644 (file)
index 3626ac5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-f() {
-    bfs . -name "*$1*" -print
-}
index e2d979ea071a5e9b52ad06360b1a157314d235b2..7a327ea8a3ef7fbca3ade6e989caa4fb56f5735e 100644 (file)
@@ -1,15 +1,2 @@
-GREP_ARGS=(
-    --devices=skip
-    --colour=always
-    --with-filename
-    --line-number
-    --dereference-recursive
-    --binary-files=without-match
-    --exclude-dir=.git
-    --exclude-dir=.tags
-)
-g() {
-    grep $GREP_ARGS $@ | less
-}
 alias -g G="| grep --colour=always"
 alias gg="git grep "
index 1d257702e0dbdfdc73dd6d8e3a774151ad3facc5..81e8118a85c89fcb83aaa0de3252e59da17d1567 100644 (file)
@@ -1,6 +1,2 @@
 alias ssh="TERM=xterm ssh"
 alias sshnm="ssh -S none"
-ssht() {
-    local t="-t 0"
-    TERM=xterm ssh -C -t $1 "tmux has-session $t && tmux attach-session $t || tmux new-session $t"
-}
diff --git a/zsh/.zsh/rc/010torn.zsh b/zsh/.zsh/rc/010torn.zsh
deleted file mode 100644 (file)
index f122d5b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-autoload torn