summaryrefslogtreecommitdiffstats
path: root/common/commandline/fish.fish
diff options
context:
space:
mode:
Diffstat (limited to 'common/commandline/fish.fish')
-rw-r--r--common/commandline/fish.fish37
1 files changed, 33 insertions, 4 deletions
diff --git a/common/commandline/fish.fish b/common/commandline/fish.fish
index 294849c..828d56f 100644
--- a/common/commandline/fish.fish
+++ b/common/commandline/fish.fish
@@ -5,12 +5,41 @@ set -g fish_key_bindings fish_vi_key_bindings
5bind -M insert ctrl-Z 'fg ; commandline -f repaint' 5bind -M insert ctrl-Z 'fg ; commandline -f repaint'
6 6
7function ssht 7function ssht
8 ssh -t "$argv" "tmux new-session -A -s 'ssh-$HOST'" 8 ssh -t "$argv" "tmux new-session -A -s 'ssh-$HOST'"
9end 9end
10 10
11function cdt 11function cdt
12 builtin cd (mktemp -d) 12 builtin cd (mktemp -d)
13 builtin pwd 13 builtin pwd
14end 14end
15 15
16# TODO: sll 16function sll --description "Recursively resolve a symbolic link"
17 for path in $argv
18 set -l seen_inodes
19
20 while test -L $path
21 set inode (stat -c %i $path)
22
23 if contains $inode $seen_inodes
24 echo "Infinite recursion detected"
25 return 1
26 end
27 set -a seen_inodes $inode
28
29 ll -d $path || return 1
30
31 set previous_dir (path dirname $path)
32 set path (readlink $path | path normalize)
33 if not string match -q "/*" $path
34 set path (path normalize "$previous_dir/$path")
35 end
36 end
37 ll -d $path || return 1
38 end
39end
40
41function expand_equal_command
42 type -P (string sub --start 2 $argv)
43end
44
45abbr -a expand_equal_command --position anywhere --regex "^=.+" --function expand_equal_command