forked from skywind3000/z.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.fish
43 lines (34 loc) · 1.21 KB
/
init.fish
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/env fish
if test -z "$XDG_DATA_HOME"
set -U _ZL_DATA_DIR "$HOME/.local/share/zlua"
else
set -U _ZL_DATA_DIR "$XDG_DATA_HOME/zlua"
end
set -x _ZL_DATA "$_ZL_DATA_DIR/zlua.txt" 2> /dev/null
set -U _ZL_DATA "$_ZL_DATA_DIR/zlua.txt" 2> /dev/null
if test ! -e "$_ZL_DATA"
if test ! -e "$_ZL_DATA_DIR"
mkdir -p -m 700 "$_ZL_DATA_DIR" 2> /dev/null
end
end
set -x _ZL_DATA "$_ZL_DATA"
set _zlua_dir (dirname (status --current-filename))
if test -e $_zlua_dir/z.lua
if type -q lua
lua $_zlua_dir/z.lua --init fish enhanced once echo | source
else if type -q lua5.3
lua5.3 $_zlua_dir/z.lua --init fish enhanced once echo | source
else if type -q lua5.2
lua5.2 $_zlua_dir/z.lua --init fish enhanced once echo | source
else if type -q lua5.1
lua5.1 $_zlua_dir/z.lua --init fish enhanced once echo | source
else
echo "init z.lua failed, not find lua in your system"
end
alias zc='z -c' # restrict matches to subdirs of $PWD
alias zz='z -i' # cd with interactive selection
alias zf='z -I' # use fzf to select in multiple matches
alias zb='z -b' # quickly cd to the parent directory
set -U ZLUA_SCRIPT "$ZLUA_SCRIPT" 2> /dev/null
set -U ZLUA_LUAEXE "$ZLUA_LUAEXE" 2> /dev/null
end