add upto
This commit is contained in:
parent
da454a7247
commit
ef2965d319
4 changed files with 17 additions and 1 deletions
1
completions/upto.fish
Normal file
1
completions/upto.fish
Normal file
|
@ -0,0 +1 @@
|
|||
complete -c upto -a '(pwd | tr "/" "\n")' -f
|
|
@ -1,3 +1,4 @@
|
|||
jorgebucaran/fisher
|
||||
0rax/fishline
|
||||
dracula/fish
|
||||
markcial/upto
|
||||
|
|
|
@ -4,7 +4,8 @@ SETUVAR __fish_initialized:3400
|
|||
SETUVAR _fisher_0rax_2F_fishline_files:/home/zoe/\x2econfig/fish/functions/__fishline_segment\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__fishline_segment_close\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__fishline_test\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__fishline_usage\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__fishline_version\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_arrow\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_clock\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_conda\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_exectime\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_fish\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_fullpwd\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_git\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_invert\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_jobs\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_n\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_pwd\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_root\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_screen\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_separator\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_sigstatus\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_space\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_status\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_user\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_userhost\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_vfish\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_vimode\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_write\x2efish\x1e/home/zoe/\x2econfig/fish/functions/fishline\x2efish\x1e/home/zoe/\x2econfig/fish/conf\x2ed/fishline\x2dinit\x2efish\x1e/home/zoe/\x2econfig/fish/conf\x2ed/fishline\x2dthemes\x1e/home/zoe/\x2econfig/fish/completions/fishline\x2efish
|
||||
SETUVAR _fisher_dracula_2F_fish_files:/home/zoe/\x2econfig/fish/conf\x2ed/dracula\x2efish
|
||||
SETUVAR _fisher_jorgebucaran_2F_fisher_files:/home/zoe/\x2econfig/fish/functions/fisher\x2efish\x1e/home/zoe/\x2econfig/fish/completions/fisher\x2efish
|
||||
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1e0rax/fishline\x1edracula/fish
|
||||
SETUVAR _fisher_markcial_2F_upto_files:/home/zoe/\x2econfig/fish/functions/upto\x2efish\x1e/home/zoe/\x2econfig/fish/completions/upto\x2efish
|
||||
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1e0rax/fishline\x1edracula/fish\x1emarkcial/upto
|
||||
SETUVAR fish_color_autosuggestion:\x2d\x2ditalics\x1ewhite
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:blue
|
||||
|
|
13
functions/upto.fish
Normal file
13
functions/upto.fish
Normal file
|
@ -0,0 +1,13 @@
|
|||
function upto -a where -d "Go up to a certain directory"
|
||||
set -l pieces ( pwd | tr "/" "\n")
|
||||
|
||||
if contains -- $where $pieces
|
||||
set -l p (contains --index -- $where $pieces)
|
||||
set -l dest (printf "%s\n" $pieces[1..$p] | tr "\n" "/")
|
||||
cd "$dest"
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
return 1
|
||||
end
|
Loading…
Reference in a new issue