aboutsummaryrefslogtreecommitdiffhomepage
path: root/init/functions
diff options
context:
space:
mode:
Diffstat (limited to 'init/functions')
-rw-r--r--init/functions/__fish_complete_bittorrent.fish33
-rw-r--r--init/functions/__fish_complete_directory.fish22
-rw-r--r--init/functions/__fish_complete_ls.fish109
-rw-r--r--init/functions/__fish_complete_man.fish27
-rw-r--r--init/functions/__fish_complete_pids.fish8
-rw-r--r--init/functions/__fish_complete_ssh.fish61
-rw-r--r--init/functions/__fish_complete_subcommand.fish36
-rw-r--r--init/functions/__fish_complete_suffix.fish26
-rw-r--r--init/functions/__fish_complete_tex.fish10
-rw-r--r--init/functions/__fish_contains_opt.fish53
-rw-r--r--init/functions/__fish_describe_command.fish15
-rw-r--r--init/functions/__fish_gnu_complete.fish29
-rw-r--r--init/functions/__fish_is_first_token.fish15
-rw-r--r--init/functions/__fish_list_current_token.fish20
-rw-r--r--init/functions/__fish_move_last.fish27
-rw-r--r--init/functions/__fish_no_arguments.fish15
-rw-r--r--init/functions/__fish_print_filesystems.fish8
-rw-r--r--init/functions/__fish_print_hostnames.fish16
-rw-r--r--init/functions/__fish_print_packages.fish55
-rw-r--r--init/functions/cd.fish35
-rw-r--r--init/functions/contains.fish49
-rw-r--r--init/functions/dirh.fish26
-rw-r--r--init/functions/dirs.fish9
-rw-r--r--init/functions/fish_prompt.fish20
-rw-r--r--init/functions/help.fish94
-rw-r--r--init/functions/la.fish7
-rw-r--r--init/functions/ll.fish7
-rw-r--r--init/functions/ls.fish18
-rw-r--r--init/functions/nextd.fish50
-rw-r--r--init/functions/open.fish12
-rw-r--r--init/functions/popd.fish13
-rw-r--r--init/functions/prevd.fish51
-rw-r--r--init/functions/prompt_pwd.fish21
-rw-r--r--init/functions/psub.fish54
-rw-r--r--init/functions/pushd.fish8
-rw-r--r--init/functions/pwd.fish7
-rw-r--r--init/functions/trap.fish136
-rw-r--r--init/functions/type.fish134
-rw-r--r--init/functions/umask.fish206
-rw-r--r--init/functions/vared.fish47
40 files changed, 0 insertions, 1589 deletions
diff --git a/init/functions/__fish_complete_bittorrent.fish b/init/functions/__fish_complete_bittorrent.fish
deleted file mode 100644
index 1f1a21ad..00000000
--- a/init/functions/__fish_complete_bittorrent.fish
+++ /dev/null
@@ -1,33 +0,0 @@
-# Bittorrent commands
-
-function __fish_complete_bittorrent
- complete -c $argv -l max_uploads -x -d (_ "Maximum uploads at once")
- complete -c $argv -l keepalive_interval -x -d (_ "Number of seconds between keepalives")
- complete -c $argv -l download_slice_size -x -d (_ "Bytes per request")
- complete -c $argv -l request_backlog -x -d (_ "Requests per pipe")
- complete -c $argv -l max_message_length -x -d (_ "Maximum length prefix encoding")
- complete -c $argv -l ip -d (_ "IP to report to the tracker") -x -a "(__fish_print_addresses)"
- complete -c $argv -l minport -d (_ "Minimum port to listen to")
- complete -c $argv -l maxport -d (_ "Maximum port to listen to")
- complete -c $argv -l responsefile -r -d (_ "File for server response")
- complete -c $argv -l url -x -d (_ "URL to get file from")
- complete -c $argv -l saveas -r -d (_ "Local file target")
- complete -c $argv -l timeout -x -d (_ "Time to close inactive socket")
- complete -c $argv -l timeout_check_interval -x -d (_ "Time between checking timeouts")
- complete -c $argv -l max_slice_length -x -d (_ "Maximum outgoing slice length")
- complete -c $argv -l max_rate_period -x -d (_ "Maximum time to guess rate")
- complete -c $argv -l bind -x -d (_ "IP to bind to locally") -a "(__fish_print_addresses)"
- complete -c $argv -l display_interval -x -d (_ "Time between screen updates")
- complete -c $argv -l rerequest_interval -x -d (_ "Time to wait between requesting more peers")
- complete -c $argv -l min_peers -x -d (_ "Minimum number of peers to not do requesting")
- complete -c $argv -l http_timeout -x -d (_ "Number of seconds before assuming http timeout")
- complete -c $argv -l max_initiate -x -d (_ "Number of peers at which to stop initiating new connections")
- complete -c $argv -l max_allow_in -x -d (_ "Maximum number of connections to allow")
- complete -c $argv -l check_hashes -x -d (_ "Whether to check hashes on disk")
- complete -c $argv -l max_upload_rate -x -d (_ "Maximum kB/s to upload at")
- complete -c $argv -l snub_time -x -d (_ "Seconds to wait for data to come in before assuming choking")
- complete -c $argv -l spew -x -d (_ "Whether to display diagnostic info")
- complete -c $argv -l rarest_first_cutoff -x -d (_ "Number of downloads at which to switch from random to rarest first")
- complete -c $argv -l min_uploads -x -d (_ "Number of uploads to fill out to with optimistic unchokes")
- complete -c $argv -l report_hash_failiures -x -d (_ "Whether to inform the user that hash failures occur")
-end
diff --git a/init/functions/__fish_complete_directory.fish b/init/functions/__fish_complete_directory.fish
deleted file mode 100644
index af3844d5..00000000
--- a/init/functions/__fish_complete_directory.fish
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Find directories that complete $argv[1], output them as completions
-# with description $argv[2] if defined, otherwise use 'Directory'
-#
-
-function __fish_complete_directory -d "Complete using directories"
-
- set -- comp $argv[1]
- set -- desc (_ Directory)
-
- if test (count $argv) -gt 1
- set desc $argv[2]
- end
-
- eval "set -- dirs "$comp"*/"
-
- if test $dirs[1]
- printf "%s\t$desc\n" $dirs
- end
-
-end
-
diff --git a/init/functions/__fish_complete_ls.fish b/init/functions/__fish_complete_ls.fish
deleted file mode 100644
index 0aac5ea4..00000000
--- a/init/functions/__fish_complete_ls.fish
+++ /dev/null
@@ -1,109 +0,0 @@
-#
-# Completions for the ls command and its aliases
-#
-
-# Test if we are using GNU ls
-
-function __fish_complete_ls -d "Compleletions for ls and it's aliases"
-
- set -l is_gnu
- ls --version >/dev/null ^/dev/null; and set is_gnu --is-gnu
-
- set -l cmds -c $argv
-
- # Shared ls switches
-
- __fish_gnu_complete $cmds -s a -l all -d (_ "Show hidden") $is_gnu
- __fish_gnu_complete $cmds -s A -l almost-all -d (_ "Show hidden except . and ..") $is_gnu
- __fish_gnu_complete $cmds -s F -l classify -d (_ "Append filetype indicator") $is_gnu
- __fish_gnu_complete $cmds -s H -l dereference-command-line -d (_ "Follow symlinks") $is_gnu
- __fish_gnu_complete $cmds -s L -l dereference -d (_ "Follow symlinks") $is_gnu
- __fish_gnu_complete $cmds -s R -l recursive -d (_ "List subdirectory recursively") $is_gnu
- __fish_gnu_complete $cmds -s b -l escape -d (_ "Octal escapes for non graphic characters") $is_gnu
- __fish_gnu_complete $cmds -s d -l directory -d (_ "List directories, not their content") $is_gnu
- __fish_gnu_complete $cmds -s h -l human-readable -d (_ "Human readable sizes") $is_gnu
- __fish_gnu_complete $cmds -s i -l inode -d (_ "Print inode number of files") $is_gnu
- __fish_gnu_complete $cmds -s n -l numeric-uid-gid -d (_ "Long format, numeric IDs") $is_gnu
- __fish_gnu_complete $cmds -s p -l file-type -d (_ "Append filetype indicator") $is_gnu
- __fish_gnu_complete $cmds -s q -l hide-control-chars -d (_ "Replace non-graphic characters with '?'") $is_gnu
- __fish_gnu_complete $cmds -s r -l reverse -d (_ "Reverse sort order") $is_gnu
- __fish_gnu_complete $cmds -s s -l size -d (_ "Print size of files") $is_gnu
-
- complete $cmds -s C -d (_ "List by columns")
- complete $cmds -s S -d (_ "Sort by size")
- complete $cmds -s c -d (_ "Show and sort by ctime")
- complete $cmds -s f -d (_ "Don't sort")
- complete $cmds -s g -d (_ "Long format without owner")
- complete $cmds -s k -d (_ "Set blocksize to 1kB")
- complete $cmds -s l -d (_ "Long format")
- complete $cmds -s m -d (_ "Comma separated format")
- complete $cmds -s t -d (_ "Sort by modification time")
- complete $cmds -s u -d (_ "Show access time")
- complete $cmds -s x -d (_ "List entries by lines")
- complete $cmds -s 1 -d (_ "List one file per line")
-
- if test -n "$is_gnu"
-
- # GNU specific features
-
- complete $cmds -l author -d (_ "Print author")
- complete $cmds -l blocksize -x -d (_ "Set block size")
- complete $cmds -s B -l ignore-backups -d (_ "Ignore files ending with ~")
- complete $cmds -l color -f -a "never always auto" -d (_ "Use colors")
- complete $cmds -s D -l dired -d (_ "Generate dired output")
- complete $cmds -l format -x -a "across commas horizontal long single-column verbose vertical" -d (_ "List format")
- complete $cmds -l full-time -d (_ "Long format, full-iso time")
- complete $cmds -s G -l no-group -d (_ "Don't print group information")
- complete $cmds -l si -d (_ "Human readable sizes, powers of 1000")
- complete $cmds -l dereference-command-line-symlink-to-dir #-d (_ "Follow directory symlinks from command line")
- complete $cmds -l indicator-style -x -a "none classify file-type" -d (_ "Append filetype indicator")
- complete $cmds -s I -l ignore -r -d (_ "Skip entries matching pattern")
- complete $cmds -s N -l literal -d (_ "Print raw entry names")
- complete $cmds -s o -d (_ "Long format without groups")
- complete $cmds -l show-control-chars -d (_ "Non graphic as-is")
- complete $cmds -s Q -l quote-name -d (_ "Enclose entry in quotes")
- complete $cmds -l quoting-style -x -a "literal locale shell shell-always c escape" -d (_ "Select quoting style")
- complete $cmds -l sort -x -d (_ "Sort criteria") -a "
- extension\t'Sort by file extension'
- none\tDon't\ sort
- size\t'Sort by size'
- time\t'Sort by modification time'
- version\t'Sort by version'
- status\t'Sort by file status modification time'
- atime\t'Sort by access time'
- access\t'Sort by access time'
- use\t'Sort by access time'
- "
- complete $cmds -l time -x -d (_ "Show time type") -a "
- time\t'Sort by modification time'
- access\t'Sort by access time'
- use\t'Sort by use time'
- ctime\t'Sort by file status modification time'
- status\t'Sort by status time'
- "
- complete $cmds -l time-style -x -a "full-iso long-iso iso locale" -d (_ "Select time style")
- complete $cmds -s T -l tabsize -x -a "1 2 3 4 5 6 7 8 9 10 11 12" -d (_ "Assume tab stops at each COLS")
- complete $cmds -s U -d (_ "Do not sort")
- complete $cmds -s v -d (_ "Sort by version")
- complete $cmds -s w -l width -x -d (_ "Assume screen width")
- complete $cmds -s X -d (_ "Sort by extension")
- complete $cmds -l help -d (_ "Display help and exit")
- complete $cmds -l version -d (_ "Display version and exit")
-
- else
-
- # If not a GNU system, assume we have standard BSD ls features instead
-
- complete $cmds -s B -d (_ "Octal escapes for non graphic characters")
- complete $cmds -s G -d (_ "Use colors")
- complete $cmds -s I -d (_ "Prevent -A from being automatically set for root")
- complete $cmds -s P -d (_ "Don't follow symlinks")
- complete $cmds -s T -d (_ "Show modification time")
- complete $cmds -s W -d (_ "Show whiteouts when scanning directories")
- complete $cmds -s Z -d (_ "Display each file's MAC label")
- complete $cmds -s o -d (_ "Include the file flags in a long (-l) output")
- complete $cmds -s w -d (_ "Print raw entry names")
-
- end
-
-end \ No newline at end of file
diff --git a/init/functions/__fish_complete_man.fish b/init/functions/__fish_complete_man.fish
deleted file mode 100644
index fa116956..00000000
--- a/init/functions/__fish_complete_man.fish
+++ /dev/null
@@ -1,27 +0,0 @@
-
-function __fish_complete_man
- if test (commandline -ct)
-
- # Try to guess what section to search in. If we don't know, we
- # use [^)]*, which should match any section
-
- set section ""
- set prev (commandline -poc)
- set -e prev[1]
- while count $prev
- switch $prev[1]
- case '-**'
-
- case '*'
- set section $prev[1]
- end
- set -e prev[1]
- end
-
- set section $section"[^)]*"
-
- # Do the actual search
- apropos (commandline -ct) | grep \^(commandline -ct) | sed -n -e 's/\([^ ]*\).*(\('$section'\)) *- */\1\t\2: /p'
- end
-end
-
diff --git a/init/functions/__fish_complete_pids.fish b/init/functions/__fish_complete_pids.fish
deleted file mode 100644
index 42fcc571..00000000
--- a/init/functions/__fish_complete_pids.fish
+++ /dev/null
@@ -1,8 +0,0 @@
-function __fish_complete_pids -d "Print a list of process identifiers along with brief descriptions"
- # This may be a bit slower, but it's nice - having the tty displayed is really handy
- ps --no-heading -o pid,comm,tty --ppid %self -N | sed -r 's/ *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+)$/\1\t\2 [\3]/' ^/dev/null
-
- # If the above is too slow, this is faster but a little less useful
- # pgrep -l -v -P %self | sed 's/ /\t/'
-end
-
diff --git a/init/functions/__fish_complete_ssh.fish b/init/functions/__fish_complete_ssh.fish
deleted file mode 100644
index d1aa6f82..00000000
--- a/init/functions/__fish_complete_ssh.fish
+++ /dev/null
@@ -1,61 +0,0 @@
-
-function __fish_complete_ssh -d "common completions for ssh commands"
-
- complete -c $argv -s 1 -d (_ "Protocoll version 1 only")
- complete -c $argv -s 2 -d (_ "Protocoll version 2 only")
- complete -c $argv -s 4 -d (_ "IPv4 addresses only")
- complete -c $argv -s 6 -d (_ "IPv6 addresses only")
- complete -c $argv -s C -d (_ "Compress all data")
- complete -xc $argv -s c -d (_ "Encryption algorithm") -a "blowfish 3des des"
- complete -r -c $argv -s F -d (_ "Configuration file")
- complete -r -c $argv -s i -d (_ "Identity file")
- complete -x -c $argv -s o -d (_ "Options") -a "
- AddressFamily
- BatchMode
- BindAddress
- ChallengeResponseAuthentication
- CheckHostIP
- Cipher
- Ciphers
- Compression
- CompressionLevel
- ConnectionAttempts
- ConnectTimeout
- ControlMaster
- ControlPath
- GlobalKnownHostsFile
- GSSAPIAuthentication
- GSSAPIDelegateCredentials
- Host
- HostbasedAuthentication
- HostKeyAlgorithms
- HostKeyAlias
- HostName
- IdentityFile
- IdentitiesOnly
- LogLevel
- MACs
- NoHostAuthenticationForLocalhost
- NumberOfPasswordPrompts
- PasswordAuthentication
- Port
- PreferredAuthentications
- Protocol
- ProxyCommand
- PubkeyAuthentication
- RhostsRSAAuthentication
- RSAAuthentication
- SendEnv
- ServerAliveInterval
- ServerAliveCountMax
- SmartcardDevice
- StrictHostKeyChecking
- TCPKeepAlive
- UsePrivilegedPort
- User
- UserKnownHostsFile
- VerifyHostKeyDNS
- "
- complete -c $argv -s v -d (_ "Verbose mode")
-end
-
diff --git a/init/functions/__fish_complete_subcommand.fish b/init/functions/__fish_complete_subcommand.fish
deleted file mode 100644
index 60ecc35a..00000000
--- a/init/functions/__fish_complete_subcommand.fish
+++ /dev/null
@@ -1,36 +0,0 @@
-function __fish_complete_subcommand -d "Complete subcommand"
- set -l res ""
- set -l had_cmd 0
- set -l cmd (commandline -cop) (commandline -ct)
- set -l skip_next 1
-
- for i in $cmd
-
- if test "$skip_next" = 1
- set skip_next 0
- continue
- end
-
- if test "$had_cmd" = 1
- set res "$res $i"
- else
-
- if contains -- $i $argv
- set skip_next 1
- continue
- end
-
- switch $i
- case '-*'
-
- case '*'
- set had_cmd 1
- set res $i
- end
- end
- end
-
- printf "%s\n" (commandline -ct)(complete -C $res)
-
-end
-
diff --git a/init/functions/__fish_complete_suffix.fish b/init/functions/__fish_complete_suffix.fish
deleted file mode 100644
index 78c5d2e0..00000000
--- a/init/functions/__fish_complete_suffix.fish
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Find files that complete $argv[1], has the suffix $argv[2], and
-# output them as completions with description $argv[3]
-#
-
-function __fish_complete_suffix -d "Complete using files"
-
- set -- comp $argv[1]
- set -- suff $argv[2]
- set -- desc $argv[3]
-
- set -- base (echo $comp |sed -e 's/\.[a-zA-Z0-9]*$//')
- eval "set -- files $base*$suff"
-
- if test $files[1]
- printf "%s\t$desc\n" $files
- end
-
- #
- # Also do directory completion, since there might be files
- # with the correct suffix in a subdirectory
- #
-
- __fish_complete_directory $comp
-
-end
diff --git a/init/functions/__fish_complete_tex.fish b/init/functions/__fish_complete_tex.fish
deleted file mode 100644
index 871aa41a..00000000
--- a/init/functions/__fish_complete_tex.fish
+++ /dev/null
@@ -1,10 +0,0 @@
-
-function __fish_complete_tex -d "Common completions for all tex commands"
-
- complete -c $argv -o help -d (_ "Display help and exit")
- complete -c $argv -o version -d (_ "Display version and exit")
- complete -c $argv -x -a "(
- __fish_complete_suffix (commandline -ct) .tex '(La)TeX file'
- )"
-
-end
diff --git a/init/functions/__fish_contains_opt.fish b/init/functions/__fish_contains_opt.fish
deleted file mode 100644
index 5b06007e..00000000
--- a/init/functions/__fish_contains_opt.fish
+++ /dev/null
@@ -1,53 +0,0 @@
-
-function __fish_contains_opt -d "Checks if a specific option has been given in the current commandline"
- set -l next_short
-
- set -l short_opt
- set -l long_opt
-
- for i in $argv
- if test $next_short
- set next_short
- set -- short_opt $short_opt $i
- else
- switch $i
- case -s
- set next_short 1
- case '-*'
- echo __fish_contains_opt: Unknown option $i
- return 1
-
- case '**'
- set -- long_opt $long_opt $i
- end
- end
- end
-
- for i in $short_opt
-
- if test -z $i
- continue
- end
-
- if commandline -cpo | grep -- "^-"$i"\|^-[^-]*"$i >/dev/null
- return 0
- end
-
- if commandline -ct | grep -- "^-"$i"\|^-[^-]*"$i >/dev/null
- return 0
- end
- end
-
- for i in $long_opt
- if test -z $i
- continue
- end
-
- if contains -- --$i (commandline -cpo)
- return 0
- end
- end
-
- return 1
-end
-
diff --git a/init/functions/__fish_describe_command.fish b/init/functions/__fish_describe_command.fish
deleted file mode 100644
index 50d3870a..00000000
--- a/init/functions/__fish_describe_command.fish
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# This function is used internally by the fish command completion code
-#
-
-function __fish_describe_command -d "Command used to find descriptions for commands"
- apropos $argv | awk -v FS=" +- +" '{
- split($1, names, ", ");
- for (name in names)
- if (names[name] ~ /^'"$argv"'.* *\([18]\)/) {
- sub("( |\t)*\\([18]\\)", "", names[name]);
- print names[name] "\t" $2;
- }
- }'
-end
-
diff --git a/init/functions/__fish_gnu_complete.fish b/init/functions/__fish_gnu_complete.fish
deleted file mode 100644
index 9aeb0ba8..00000000
--- a/init/functions/__fish_gnu_complete.fish
+++ /dev/null
@@ -1,29 +0,0 @@
-function __fish_gnu_complete -d "Wrapper for the complete builtin. Skips the long completions on non-GNU systems"
- set is_gnu 0
-
- # Check if we are using a gnu system
- for i in (seq (count $argv))
- switch $argv[$i]
-
- case -g --is-gnu
- set -e argv[$i]
- set is_gnu 1
- break
- end
- end
-
- # Remove long option if not on a gnu system
- if test $is_gnu = 0
- for i in (seq (count $argv))
- if test $argv[$i] = -l
- set -e argv[$i]
- set -e argv[$i]
- break
- end
- end
- end
-
- complete $argv
-
-end
-
diff --git a/init/functions/__fish_is_first_token.fish b/init/functions/__fish_is_first_token.fish
deleted file mode 100644
index e2ca69b1..00000000
--- a/init/functions/__fish_is_first_token.fish
+++ /dev/null
@@ -1,15 +0,0 @@
-
-function __fish_is_first_token -d 'Test if no non-switch argument has been specified yet'
- set -- cmd (commandline -poc)
- set -e -- cmd[1]
- for i in $cmd
- switch $i
- case '-*'
-
- case '*'
- return 1;
- end
- end
- return 0
-end
-
diff --git a/init/functions/__fish_list_current_token.fish b/init/functions/__fish_list_current_token.fish
deleted file mode 100644
index b31aac40..00000000
--- a/init/functions/__fish_list_current_token.fish
+++ /dev/null
@@ -1,20 +0,0 @@
-
-#
-# This function is bound to Alt-L, it is used to list the contents of
-# the directory under the cursor
-#
-
-function __fish_list_current_token -d "List contents of token under the cursor if it is a directory, otherwise list the contents of the current directory"
- set val (eval echo (commandline -t))
- if test -d $val
- ls $val
- else
- set dir (dirname $val)
- if test $dir != . -a -d $dir
- ls $dir
- else
- ls
- end
- end
-end
-
diff --git a/init/functions/__fish_move_last.fish b/init/functions/__fish_move_last.fish
deleted file mode 100644
index 965072cd..00000000
--- a/init/functions/__fish_move_last.fish
+++ /dev/null
@@ -1,27 +0,0 @@
-function __fish_move_last -d "Move the last element of a directory history from src to dest"
- set -l src $argv[1]
- set -l dest $argv[2]
-
- set -l size_src (count $$src)
-
- if test $size_src = 0
- # Cannot make this step
- printf (_ "Hit end of history...\n")
- return 1
- end
-
- # Append current dir to the end of the destination
- set -g (echo $dest) $$dest (command pwd)
-
- set ssrc $$src
-
- # Change dir to the last entry in the source dir-hist
- builtin cd $ssrc[$size_src]
-
- # Keep all but the last from the source dir-hist
- set -e (echo $src)[$size_src]
-
- # All ok, return success
- return 0
-end
-
diff --git a/init/functions/__fish_no_arguments.fish b/init/functions/__fish_no_arguments.fish
deleted file mode 100644
index e47a4272..00000000
--- a/init/functions/__fish_no_arguments.fish
+++ /dev/null
@@ -1,15 +0,0 @@
-
-function __fish_no_arguments -d "Internal fish function"
- set -l cmd (commandline -poc) (commandline -tc)
- set -e cmd[1]
- for i in $cmd
- switch $i
- case '-*'
-
- case '*'
- return 1
- end
- end
- return 0
-end
-
diff --git a/init/functions/__fish_print_filesystems.fish b/init/functions/__fish_print_filesystems.fish
deleted file mode 100644
index 0eeea3c8..00000000
--- a/init/functions/__fish_print_filesystems.fish
+++ /dev/null
@@ -1,8 +0,0 @@
-
-function __fish_print_filesystems -d "Print a list of all known filesystem types"
- set -l fs adfs affs autofs coda coherent cramfs devpts efs ext ext2 ext3
- set fs $fs hfs hpfs iso9660 jfs minix msdos ncpfs nfs ntfs proc qnx4 ramfs
- set fs $fs reiserfs romfs smbfs sysv tmpfs udf ufs umsdos vfat xenix xfs xiafs
- printf "%s\n" $fs
-end
-
diff --git a/init/functions/__fish_print_hostnames.fish b/init/functions/__fish_print_hostnames.fish
deleted file mode 100644
index f6de9784..00000000
--- a/init/functions/__fish_print_hostnames.fish
+++ /dev/null
@@ -1,16 +0,0 @@
-
-function __fish_print_hostnames -d "Print a list of known hostnames"
-
- # Print all hosts from /etc/hosts
- if test -f /etc/hosts
- sed </etc/hosts -e 's/[0-9.]*\( \|\t\)*\(.*\)/\2/'|sed -e 's/\#.*//'|tr \t \n |grep -v '^$'
- end
- # Print nfs servers from /etc/fstab
- if test -f /etc/fstab
- grep </etc/fstab "^\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\|[a-zA-Z.]*\):"|cut -d : -f 1
- end
-
- # Print hosts with known ssh keys
- cat ~/.ssh/known_hosts{,2} ^/dev/null|cut -d ' ' -f 1| cut -d , -f 1
-end
-
diff --git a/init/functions/__fish_print_packages.fish b/init/functions/__fish_print_packages.fish
deleted file mode 100644
index 03e52314..00000000
--- a/init/functions/__fish_print_packages.fish
+++ /dev/null
@@ -1,55 +0,0 @@
-
-function __fish_print_packages
-
- # apt-cache is much, much faster than rpm, and can do this in real
- # time. We use it if available.
-
- switch (commandline -tc)
- case '-**'
- return
- end
-
- #Get the word 'Package' in the current language
- set -l package (_ Package)
-
- if which apt-cache >/dev/null ^/dev/null
- # Apply the following filters to output of apt-cache:
- # 1) Remove package names with parentesis in them, since these seem to not correspond to actual packages as reported by rpm
- # 2) Remove package names that are .so files, since these seem to not correspond to actual packages as reported by rpm
- # 3) Remove path information such as /usr/bin/, as rpm packages do not have paths
-
- apt-cache --no-generate pkgnames (commandline -tc)|grep -v \( |grep -v '\.so\(\.[0-9]\)*$'|sed -e 's/\/.*\///'|sed -e 's/$/\t'$package'/'
- return
- end
-
- # Rpm is too slow for this job, so we set it up to do completions
- # as a background job and cache the results.
-
- if which rpm >/dev/null ^/dev/null
-
- # If the cache is less than five minutes old, we do not recalculate it
-
- set cache_file /tmp/.rpm-cache.$USER
- if test -f $cache_file
- cat $cache_file
- set age (echo (date +%s) - (stat -c '%Y' $cache_file) | bc)
- set max_age 250
- if test $age -lt $max_age
- return
- end
- end
-
- # Remove package version information from output and pipe into cache file
- rpm -qa >$cache_file |sed -e 's/-[^-]*-[^-]*$//' | sed -e 's/$/\t'$package'/' &
- end
-
- # This completes the package name from the portage tree.
- # True for installing new packages. Function for printing
- # installed on the system packages is in completions/emerge.fish
- if which emerge >/dev/null ^/dev/null
- emerge -s \^(commandline -tc) |grep "^*" |cut -d\ -f3 |cut -d/ -f2
- return
- end
-
-end
-
diff --git a/init/functions/cd.fish b/init/functions/cd.fish
deleted file mode 100644
index e9287c4b..00000000
--- a/init/functions/cd.fish
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# The following functions add support for a directory history
-#
-
-function cd -d (_ "Change directory")
-
- # Skip history in subshells
- if status --is-command-substitution
- builtin cd $argv
- return $status
- end
-
- # Avoid set completions
- set previous (command pwd)
-
- if test $argv[1] = - ^/dev/null
- if test $__fish_cd_direction = next ^/dev/null
- nextd
- else
- prevd
- end
- return $status
- end
-
- builtin cd $argv[1]
-
- if test $status = 0 -a (command pwd) != $previous
- set -g dirprev $dirprev $previous
- set -e dirnext
- set -g __fish_cd_direction prev
- end
-
- return $status
-end
-
diff --git a/init/functions/contains.fish b/init/functions/contains.fish
deleted file mode 100644
index 331794c7..00000000
--- a/init/functions/contains.fish
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# This file defines various shellscript functions. Most of them are
-# meant to be used directly by the user, but some of them, typically
-# the ones whose name start with '__fish_', are only meant to be used
-# internally by fish.
-#
-
-function contains -d (_ "Test if a key is contained in a set of values")
- while set -q argv
- switch $argv[1]
- case '-h' '--h' '--he' '--hel' '--help'
- help contains
- return
-
- case '--'
- # End the loop, the next argument is the key
- set -e argv[1]
- break
-
- case '-*'
- printf (_ "%s: Unknown option '%s'\n") contains $argv[$i]
- help contains
- return 1
-
- case '*'
- # End the loop, we found the key
- break
-
- end
- set -e argv[1]
- end
-
- if not set -q argv
- printf (_ "%s: Key not specified\n") contains
- return 1
- end
-
- set -- key $argv[1]
- set -e argv[1]
-
- #
- # Loop through values
- #
-
- printf "%s\n" $argv|grep -Fx -- $key >/dev/null
- return $status
-end
-
-
diff --git a/init/functions/dirh.fish b/init/functions/dirh.fish
deleted file mode 100644
index 8be46c81..00000000
--- a/init/functions/dirh.fish
+++ /dev/null
@@ -1,26 +0,0 @@
-
-function dirh -d (_ "Print the current directory history (the back- and fwd- lists)")
- # Avoid set comment
- set -l current (command pwd)
- set -l separator " "
- set -l line_len (echo (count $dirprev) + (echo $dirprev $current $dirnext | wc -m) | bc)
- if test $line_len -gt $COLUMNS
- # Print one entry per line if history is long
- set separator "\n"
- end
-
- for i in $dirprev
- echo -n -e $i$separator
- end
-
- set_color $fish_color_history_current
- echo -n -e $current$separator
- set_color normal
-
- for i in (seq (echo (count $dirnext)) -1 1)
- echo -n -e $dirnext[$i]$separator
- end
-
- echo
-end
-
diff --git a/init/functions/dirs.fish b/init/functions/dirs.fish
deleted file mode 100644
index cde428aa..00000000
--- a/init/functions/dirs.fish
+++ /dev/null
@@ -1,9 +0,0 @@
-function dirs -d (_ "Print directory stack")
- echo -n (command pwd)" "
- for i in $dirstack
- echo -n $i" "
- end
- echo
-end
-
-
diff --git a/init/functions/fish_prompt.fish b/init/functions/fish_prompt.fish
deleted file mode 100644
index f1c67012..00000000
--- a/init/functions/fish_prompt.fish
+++ /dev/null
@@ -1,20 +0,0 @@
-# Set the default prompt command. Make sure that every terminal escape
-# string has a newline before and after, so that fish will know how
-# long it is.
-
-function fish_prompt -d (_ "Write out the prompt")
-
- # Just calculate these once, to save a few cycles when displaying the prompt
- if not set -q __fish_prompt_hostname
- set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
- end
-
- if not set -q __fish_prompt_normal
- set -g __fish_prompt_normal (set_color normal)
- end
-
- set -l prompt_color (set_color $fish_color_cwd)
-
- printf '%s@%s %s%s%s> \n' $USER $__fish_prompt_hostname "$prompt_color" (prompt_pwd) "$__fish_prompt_normal"
-end
-
diff --git a/init/functions/help.fish b/init/functions/help.fish
deleted file mode 100644
index f61822ff..00000000
--- a/init/functions/help.fish
+++ /dev/null
@@ -1,94 +0,0 @@
-
-#
-# help should use 'open' to find a suitable browser, but only
-# if there is a mime database _and_ DISPLAY is set, since the
-# browser will most likely be graphical. Since most systems which
-# have a mime databe also have the htmlview program, this is mostly a
-# theoretical problem.
-#
-
-function help -d (_ "Show help for the fish shell")
-
- # Declare variables to set correct scope
- set -l fish_browser
- set -l fish_browser_bg
-
- set -l h syntax completion editor job-control todo bugs history killring help
- set h $h color prompt title variables builtin-overview changes expand
- set h $h expand-variable expand-home expand-brace expand-wildcard
- set -l help_topics $h expand-command-substitution expand-process
-
- #
- # Find a suitable browser for viewing the help pages. This is needed
- # by the help function defined below.
- #
- set -l graphical_browsers htmlview x-www-browser firefox galeon mozilla konqueror epiphany opera netscape
- set -l text_browsers htmlview www-browser links elinks lynx w3m
-
- if test $BROWSER
- # User has manualy set a preferred browser, so we respect that
- set fish_browser $BROWSER
-
- # If browser is known to be graphical, put into background
- if contains -- $BROWSER $graphical_browsers
- set fish_browser_bg 1
- end
- else
- # Check for a text-based browser.
- for i in $text_browsers
- if which $i 2>/dev/null >/dev/null
- set fish_browser $i
- break
- end
- end
-
- # If we are in a graphical environment, check if there is a graphical
- # browser to use instead.
- if test "$DISPLAY" -a \( "$XAUTHORITY" = "$HOME/.Xauthority" -o "$XAUTHORITY" = "" \)
- for i in $graphical_browsers
- if which $i 2>/dev/null >/dev/null
- set fish_browser $i
- set fish_browser_bg 1
- break
- end
- end
- end
- end
-
- if test -z $fish_browser
- printf (_ '%s: Could not find a web browser.\n') help
- printf (_ 'Please set the variable $BROWSER to a suitable browser and try again\n\n')
- return 1
- end
-
- set fish_help_item $argv[1]
-
- switch "$fish_help_item"
- case ""
- set fish_help_page index.html
- case "."
- set fish_help_page "builtins.html\#source"
- case difference
- set fish_help_page difference.html
- case globbing
- set fish_help_page "index.html\#expand"
- case (builtin -n)
- set fish_help_page "builtins.html\#$fish_help_item"
- case contains count dirh dirs help mimedb nextd open popd prevd pushd set_color tokenize psub umask type vared
- set fish_help_page "commands.html\#$fish_help_item"
- case $help_topics
- set fish_help_page "index.html\#$fish_help_item"
- case "*"
- if which $fish_help_item >/dev/null ^/dev/null
- man $fish_help_item
- return
- end
- set fish_help_page "index.html"
- end
-
- if test $fish_browser_bg
- eval $fish_browser file://$__fish_help_dir/$fish_help_page \&
- else
- eval $fish_browser file://$__fish_help_dir/$fish_help_page
- end
-end
diff --git a/init/functions/la.fish b/init/functions/la.fish
deleted file mode 100644
index 4fddc3b1..00000000
--- a/init/functions/la.fish
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# These are very common and useful
-#
-function la -d (_ "List contents of directory, including hidden files in directory using long format")
- ls -lah $argv
-end
-
diff --git a/init/functions/ll.fish b/init/functions/ll.fish
deleted file mode 100644
index bfe290ab..00000000
--- a/init/functions/ll.fish
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# These are very common and useful
-#
-function ll -d (_ "List contents of directory using long format")
- ls -lh $argv
-end
-
diff --git a/init/functions/ls.fish b/init/functions/ls.fish
deleted file mode 100644
index aa20f219..00000000
--- a/init/functions/ls.fish
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Make ls use colors if we are on a system that supports this
-#
-
-if ls --version 1>/dev/null 2>/dev/null
- # This is GNU ls
- function ls -d (_ "List contents of directory")
- command ls --color=auto --indicator-style=classify $argv
- end
-else
- # BSD, OS X and a few more support colors through the -G switch instead
- if ls / -G 1>/dev/null 2>/dev/null
- function ls -d (_ "List contents of directory")
- command ls -G $argv
- end
- end
-end
-
diff --git a/init/functions/nextd.fish b/init/functions/nextd.fish
deleted file mode 100644
index bf6f32f8..00000000
--- a/init/functions/nextd.fish
+++ /dev/null
@@ -1,50 +0,0 @@
-
-function nextd -d (_ "Move forward in the directory history")
- # Parse arguments
- set -l show_hist 0
- set -l times 1
- for i in (seq (count $argv))
- switch $argv[$i]
- case '-l' --l --li --lis --list
- set show_hist 1
- continue
- case '-*'
- printf (_ "%s: Unknown option %s\n" ) nextd $argv[$i]
- return 1
- case '*'
- if test $argv[$i] -ge 0 ^/dev/null
- set times $argv[$i]
- else
- printf (_ "%s: The number of positions to skip must be a non-negative integer\n" ) nextd
- return 1
- end
- continue
- end
- end
-
- # Traverse history
- set -l code 1
- for i in (seq $times)
- # Try one step backward
- if __fish_move_last dirnext dirprev;
- # We consider it a success if we were able to do at least 1 step
- # (low expectations are the key to happiness ;)
- set code 0
- else
- break
- end
- end
-
- # Show history if needed
- if test $show_hist = 1
- dirh
- end
-
- # Set direction for 'cd -'
- if test $code = 0 ^/dev/null
- set -g __fish_cd_direction prev
- end
-
- # All done
- return $code
-end
diff --git a/init/functions/open.fish b/init/functions/open.fish
deleted file mode 100644
index 9e61f236..00000000
--- a/init/functions/open.fish
+++ /dev/null
@@ -1,12 +0,0 @@
-
-#
-# This allows us to use 'open FILENAME' to open a given file in the default
-# application for the file.
-#
-
-if not test (uname) = Darwin
- function open -d (_ "Open file in default application")
- mimedb -l -- $argv
- end
-end
-
diff --git a/init/functions/popd.fish b/init/functions/popd.fish
deleted file mode 100644
index f8b8a532..00000000
--- a/init/functions/popd.fish
+++ /dev/null
@@ -1,13 +0,0 @@
-
-function popd -d (_ "Pop dir from stack")
- if test $dirstack[1]
- cd $dirstack[1]
- else
- printf (_ "%s: Directory stack is empty...") popd
- return 1
- end
-
- set -e dirstack[1]
-
-end
-
diff --git a/init/functions/prevd.fish b/init/functions/prevd.fish
deleted file mode 100644
index 000a5792..00000000
--- a/init/functions/prevd.fish
+++ /dev/null
@@ -1,51 +0,0 @@
-
-function prevd -d (_ "Move back in the directory history")
- # Parse arguments
- set -l show_hist 0
- set -l times 1
- for i in (seq (count $argv))
- switch $argv[$i]
- case '-l' --l --li --lis --list
- set show_hist 1
- continue
- case '-*'
- printf (_ "%s: Unknown option %s\n" ) prevd $argv[$i]
- return 1
- case '*'
- if test $argv[$i] -ge 0 ^/dev/null
- set times $argv[$i]
- else
- printf (_ "The number of positions to skip must be a non-negative integer\n")
- return 1
- end
- continue
- end
- end
-
- # Traverse history
- set -l code 1
- for i in (seq $times)
- # Try one step backward
- if __fish_move_last dirprev dirnext;
- # We consider it a success if we were able to do at least 1 step
- # (low expectations are the key to happiness ;)
- set code 0
- else
- break
- end
- end
-
- # Show history if needed
- if test $show_hist = 1
- dirh
- end
-
- # Set direction for 'cd -'
- if test $code = 0 ^/dev/null
- set -g __fish_cd_direction next
- end
-
- # All done
- return $code
-end
-
diff --git a/init/functions/prompt_pwd.fish b/init/functions/prompt_pwd.fish
deleted file mode 100644
index 709ccca6..00000000
--- a/init/functions/prompt_pwd.fish
+++ /dev/null
@@ -1,21 +0,0 @@
-
-if test (uname) = Darwin
- function prompt_pwd -d (_ "Print the current working directory, shortend to fit the prompt")
- if test "$PWD" != "$HOME"
- printf "%s" (echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|" -e 's-/\([^/]\)\([^/]*\)-/\1-g')
- echo $PWD|sed -e 's-.*/[^/]\([^/]*$\)-\1-'
- else
- echo '~'
- end
- end
-else
- function prompt_pwd -d (_ "Print the current working directory, shortend to fit the prompt")
- if test "$PWD" != "$HOME"
- printf "%s" (echo $PWD|sed -e "s|^$HOME|~|" -e 's-/\([^/]\)\([^/]*\)-/\1-g')
- echo $PWD|sed -e 's-.*/[^/]\([^/]*$\)-\1-'
- else
- echo '~'
- end
- end
-end
-
diff --git a/init/functions/psub.fish b/init/functions/psub.fish
deleted file mode 100644
index fd59cd95..00000000
--- a/init/functions/psub.fish
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-function psub -d (_ "Read from stdin into a file and output the filename. Remove the file when the command that called psub exits.")
-
- set -l filename
- set -l funcname
-
- if count $argv >/dev/null
- switch $argv[1]
- case '-h*' --h --he --hel --help
-
- help psub
- return 0
-
- case '*'
- printf (_ "%s: Unknown argument '%s'\n") psub $argv[1]
- return 1
- end
- end
-
- if not status --is-command-substitution
- echo psub: Not inside of command substitution >&2
- return
- end
-
- # Find unique file name for writing output to
- while true
- set filename /tmp/.psub.(echo %self).(random);
- if not test -e $filename
- break;
- end
- end
-
- # Write output to pipe. This needs to be done in the background so
- # that the command substitution exits without needing to wait for
- # all the commands to exit
- mkfifo $filename
- cat >$filename &
-
- # Write filename to stdout
- echo $filename
-
- # Find unique function name
- while true
- set funcname __fish_psub_(random);
- if not functions $funcname >/dev/null ^/dev/null
- break;
- end
- end
-
- # Make sure we erase file when caller exits
- eval function $funcname --on-job-exit caller\; rm $filename\; functions -e $funcname\; end
-
-end
diff --git a/init/functions/pushd.fish b/init/functions/pushd.fish
deleted file mode 100644
index 5c4f288e..00000000
--- a/init/functions/pushd.fish
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-function pushd -d (_ "Push directory to stack")
- # Comment to avoid set completions
- set -g dirstack (command pwd) $dirstack
- cd $argv[1]
-end
-
diff --git a/init/functions/pwd.fish b/init/functions/pwd.fish
deleted file mode 100644
index 678fecb4..00000000
--- a/init/functions/pwd.fish
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Make pwd print out the home directory as a tilde.
-#
-
-function pwd -d (_ "Print working directory")
- command pwd | sed -e 's|/private||' -e "s|^$HOME|~|"
-end
diff --git a/init/functions/trap.fish b/init/functions/trap.fish
deleted file mode 100644
index 74940dbe..00000000
--- a/init/functions/trap.fish
+++ /dev/null
@@ -1,136 +0,0 @@
-
-function __trap_translate_signal
- set upper (echo $argv[1]|tr a-z A-Z)
- if expr $upper : 'SIG.*' >/dev/null
- echo $upper | cut -c 4-
- else
- echo $upper
- end
-end
-
-function __trap_switch
-
- switch $argv[1]
- case EXIT
- echo --on-exit %self
-
- case '*'
- echo --on-signal $argv[1]
- end
-
-end
-
-function trap -d 'Perform an action when the shell recives a signal'
-
- set -l mode
- set -l cmd
- set -l sig
- set -l shortopt
- set -l longopt
-
- set -l shortopt -o lph
- set -l longopt
- if not getopt -T >/dev/null
- set longopt -l print,help,list-signals
- end
-
- if not getopt -n type -Q $shortopt $longopt -- $argv
- return 1
- end
-
- set -l tmp (getopt $shortopt $longopt -- $argv)
-
- eval set opt $tmp
-
- while count $opt >/dev/null
- switch $opt[1]
- case -h --help
- help trap
- return 0
-
- case -p --print
- set mode print
-
- case -l --list-signals
- set mode list
-
- case --
- set -e opt[1]
- break
-
- end
- set -e opt[1]
- end
-
- if not count $mode >/dev/null
-
- switch (count $opt)
-
- case 0
- set mode print
-
- case 1
- set mode clear
-
- case '*'
- if test opt[1] = -
- set -e opt[1]
- set mode clear
- else
- set mode set
- end
- end
- end
-
- switch $mode
- case clear
- for i in $opt
- set -- sig (__trap_translate_signal $i)
- if test $sig
- functions -e __trap_handler_$sig
- end
- end
-
- case set
- set -l cmd $opt[1]
- set -e opt[1]
-
- for i in $opt
-
- set -l -- sig (__trap_translate_signal $i)
- set -- sw (__trap_switch $sig)
-
- if test $sig
- eval "function __trap_handler_$sig $sw; $cmd; end"
- else
- return 1
- end
- end
-
- case print
- set -l names
-
- if count $opt >/dev/null
- set -- names $opt
- else
- set -- names (functions -na|grep "^__trap_handler_"|sed -e 's/__trap_handler_//' )
- end
-
- for i in $names
-
- set -- sig (__trap_translate_signal $i)
-
- if test sig
- functions __trap_handler_$i
- else
- return 1
- end
-
- end
-
- case list
- kill -l
-
- end
-
-end
diff --git a/init/functions/type.fish b/init/functions/type.fish
deleted file mode 100644
index bb5c75e0..00000000
--- a/init/functions/type.fish
+++ /dev/null
@@ -1,134 +0,0 @@
-
-function type -d (_ "Print the type of a command")
-
- # Initialize
- set -l status 1
- set -l mode normal
- set -l selection all
-
- #
- # Get options
- #
- set -l shortopt -o tpPafh
- set -l longopt
- if not getopt -T >/dev/null
- set longopt -l type,path,force-path,all,no-functions,help
- end
-
- if not getopt -n type -Q $shortopt $longopt -- $argv
- return 1
- end
-
- set -l tmp (getopt $shortopt $longopt -- $argv)
-
- set -l opt
- eval set opt $tmp
-
- for i in $opt
- switch $i
- case -t --type
- set mode type
-
- case -p --path
- set mode path
-
- case -P --force-path
- set mode path
- set selection files
-
- case -a --all
- set selection multi
-
- case -f --no-functions
- set selection files
-
- case -h --help
- help type
- return 0
-
- case --
- break
-
- end
- end
-
- # Check all possible types for the remaining arguments
- for i in $argv
-
- switch $i
- case '-*'
- continue
- end
-
- # Found will be set to 1 if a match is found
- set found 0
-
- if test $selection != files
-
- if contains -- $i (functions -na)
- set status 0
- set found 1
- switch $mode
- case normal
- printf (_ '%s is a function with definition\n') $i
- functions $i
-
- case type
- printf (_ 'function\n')
-
- case path
- echo
-
- end
- if test $selection != multi
- continue
- end
- end
-
- if contains -- $i (builtin -n)
- set status 0
- set found 1
- switch $mode
- case normal
- printf (_ '%s is a builtin\n') $i
-
- case type
- printf (_ 'builtin\n')
-
- case path
- echo
- end
- if test $selection != multi
- continue
- end
- end
-
- end
-
- if which $i ^/dev/null >/dev/null
- set status 0
- set found 1
- switch $mode
- case normal
- printf (_ '%s is %s\n') $i (which $i)
-
- case type
- printf (_ 'file\n')
-
- case path
- which $i
- end
- if test $selection != multi
- continue
- end
- end
-
- if test $found = 0
- printf (_ "%s: Could not find '%s'") type $i
- end
-
- end
-
- return $status
-end
-
diff --git a/init/functions/umask.fish b/init/functions/umask.fish
deleted file mode 100644
index afca8f5f..00000000
--- a/init/functions/umask.fish
+++ /dev/null
@@ -1,206 +0,0 @@
-
-function __fish_umask_parse -d "Internal umask function"
- # Test if already a valid octal mask, and pad it with zeros
- if echo $argv | grep -E '^(0|)[0-7]{1,3}$' >/dev/null
- for i in (seq (echo 5-(echo $argv|wc -c)|bc)); set argv 0$argv; end
- echo $argv
- else
- # Test if argument really is a valid symbolic mask
- if not echo $argv | grep -E '^(((u|g|o|a|)(=|\+|-)|)(r|w|x)*)(,(((u|g|o|a|)(=|\+|-)|)(r|w|x)*))*$' >/dev/null
- printf (_ "%s: Invalid mask '%s'\n") umask $argv >&2
- return 1
- end
-
- set -l implicit_all
-
- # Insert inverted umask into res variable
-
- set -l mode
- set -l val
- set -l tmp $umask
- set -l res
-
- for i in 1 2 3
- set tmp (echo $tmp|cut -c 2-)
- set res[$i] (echo 7-(echo $tmp|cut -c 1)|bc)
- end
-
- set -l el (echo $argv|tr , \n)
- for i in $el
- switch $i
- case 'u*'
- set idx 1
- set i (echo $i| cut -c 2-)
-
- case 'g*'
- set idx 2
- set i (echo $i| cut -c 2-)
-
- case 'o*'
- set idx 3
- set i (echo $i| cut -c 2-)
-
- case 'a*'
- set idx 1 2 3
- set i (echo $i| cut -c 2-)
-
- case '*'
- set implicit_all 1
- set idx 1 2 3
- end
-
- switch $i
- case '=*'
- set mode set
- set i (echo $i| cut -c 2-)
-
- case '+*'
- set mode add
- set i (echo $i| cut -c 2-)
-
- case '-*'
- set mode remove
- set i (echo $i| cut -c 2-)
-
- case '*'
- if not count $implicit_all >/dev/null
- printf (_ "%s: Invalid mask '%s'\n") umask $argv >&2
- return
- end
- set mode set
- end
-
- if not echo $perm|grep -E '^(r|w|x)*$' >/dev/null
- printf (_ "%s: Invalid mask '%s'\n") umask $argv >&2
- return
- end
-
- set val 0
- if echo $i |grep 'r' >/dev/null
- set val 4
- end
- if echo $i |grep 'w' >/dev/null
- set val (echo $val + 2|bc)
- end
- if echo $i |grep 'x' >/dev/null
- set val (echo $val + 1|bc)
- end
-
- for j in $idx
- switch $mode
- case set
- set res[$j] $val
-
- case add
- set res[$j] (perl -e 'print( ( '$res[$j]'|'$val[$j]' )."\n" )')
-
- case remove
- set res[$j] (perl -e 'print( ( (7-'$res[$j]')&'$val[$j]' )."\n" )')
- end
- end
- end
-
- for i in 1 2 3
- set res[$i] (echo 7-$res[$i]|bc)
- end
- echo 0$res[1]$res[2]$res[3]
- end
-end
-
-function __fish_umask_print_symbolic
- set -l res ""
- set -l letter a u g o
-
- for i in 2 3 4
- set res $res,$letter[$i]=
- set val (echo $umask|cut -c $i)
-
- if contains $val 0 1 2 3
- set res {$res}r
- end
-
- if contains $val 0 1 4 5
- set res {$res}w
- end
-
- if contains $val 0 2 4 6
- set res {$res}x
- end
-
- end
-
- echo $res|cut -c 2-
-end
-
-function umask -d (_ "Set default file permission mask")
-
- set -l as_command 0
- set -l symbolic 0
-
- set -l shortopt -o pSh
- set -l longopt
- if not getopt -T >/dev/null
- set longopt -l as-command,symbolic,help
- end
-
- if not getopt -n umask -Q $shortopt $longopt -- $argv
- return 1
- end
-
- set -l tmp (getopt $shortopt $longopt -- $argv)
-
- eval set opt $tmp
-
- while count $opt >/dev/null
-
- switch $opt[1]
- case -h --help
- help umask
- return 0
-
- case -p --as-command
- set as_command 1
-
- case -S --symbolic
- set symbolic 1
-
- case --
- set -e opt[1]
- break
-
- end
-
- set -e opt[1]
-
- end
-
- switch (count $opt)
-
- case 0
- if not set -q umask
- set -g umask 113
- end
- if test $as_command -eq 1
- echo umask $umask
- else
- if test $symbolic -eq 1
- __fish_umask_print_symbolic $umask
- else
- echo $umask
- end
- end
-
- case 1
- set -l parsed (__fish_umask_parse $opt)
- if test (count $parsed) -eq 1
- set -g umask $parsed
- return 0
- end
- return 1
-
- case '*'
- printf (_ '%s: Too many arguments\n') umask >&2
-
- end
-
-end
diff --git a/init/functions/vared.fish b/init/functions/vared.fish
deleted file mode 100644
index b9414d84..00000000
--- a/init/functions/vared.fish
+++ /dev/null
@@ -1,47 +0,0 @@
-
-#
-# This is a neat function, stolen from zsh. It allows you to edit the
-# value of a variable interactively.
-#
-
-function vared -d (_ "Edit variable value")
- if test (count $argv) = 1
- switch $argv
-
- case '-h' '--h' '--he' '--hel' '--help'
- help vared
-
- case '-*'
- printf (_ "%s: Unknown option %s\n") vared $argv
-
- case '*'
- if test (count $$argv ) -lt 2
- set init ''
- if test $$argv
- set -- init $$argv
- end
- set prompt 'set_color green; echo '$argv'; set_color normal; echo "> "'
- read -p $prompt -c $init tmp
-
- # If variable already exists, do not add any
- # switches, so we don't change export rules. But
- # if it does not exist, we make the variable
- # global, so that it will not die when this
- # function dies
-
- if test $$argv
- set -- $argv $tmp
- else
- set -g -- $argv $tmp
- end
-
- else
-
- printf (_ '%s: %s is an array variable. Use %svared%s %s[n] to edit the n:th element of %s\n') $argv (set_color $fish_color_command) (set_color $fish_color_normal) vared $argv $argv
- end
- end
- else
- printf (_ '%s: Expected exactly one argument, got %s.\n\nSynopsis:\n\t%svared%s VARIABLE\n') vared (count $argv) (set_color $fish_color_command) (set_color $fish_color_normal)
- end
-end
-