diff --git a/compdef/_sfs b/compdef/_sfs new file mode 100644 index 0000000..0031697 --- /dev/null +++ b/compdef/_sfs @@ -0,0 +1,15 @@ +#compdef sfs + +if compset -P 1 '*:'; then + _remote_files -- ssh +elif compset -P 1 '*@'; then + _wanted hosts expl host _ssh_hosts -r: -S: +else + _alternative \ + 'hosts:remote host name:_ssh_hosts -r: -S:' \ + 'users:user:_ssh_users -qS@' +fi + +_ssh_users () { + _combination -s '[:@]' my-accounts users-hosts users "$@" +} diff --git a/compdef/_sshfs b/compdef/_sshfs new file mode 100644 index 0000000..30ac01c --- /dev/null +++ b/compdef/_sshfs @@ -0,0 +1,66 @@ +#compdef sshfs + +local curcontext="$curcontext" state state_descr line +typeset -A opt_args +integer ret=1 + +# TODO: in the "user@host" argument, the "user@" part should be optional +_arguments -C -S : \ + '(-)'{-h,--help}'[display help information]' \ + '(-)'{-V,--version}'[display version information]' \ + '-p[specify TCP port]:tcp port:_ports' \ + '-C[enable compression]' \ + '-F[specify ssh config file]:file:_files' \ + '*-o[specify mount options]:options:->options' \ + '(-f)-d[enable debug output]' \ + '-f[foreground]' \ + '-s[disable multithreaded operation]' \ + ':remote directory:_remote_files -/ -- ssh:' \ + ':mountpoint:_files -/' && ret=0 + +if [[ $state == options ]]; then + _values -s , "sshfs or fuse or mount options" \ + debug reconnect delay_connect sshfs_sync no_readahead sync_readdir sshfs_debug \ + 'cache:cache setting:(yes no)' \ + 'cache_max_size:size [10000]' \ + 'cache_timeout:timeout (seconds) [20]' \ + cache_{stat,dir,link}_timeout:'timeout (seconds)' \ + 'cache_clean_interval:interval [60]' \ + 'cache_min_clean_interval:interval [5]' \ + 'workaround:workaround:(none all rename delaysrv truncate nobuflimit)' \ + 'idmap:user/group mapping:(none user file)' \ + uidfile:file:_files \ + gidfile:file:_files \ + 'nomap:type:(ignore error)' \ + 'ssh_command:ssh command:_command_names' \ + 'ssh_protocol:version:(1 2)' \ + sftp_server:path:_files \ + directport:port:_ports \ + slave disable_hardlink transform_symlinks follow_symlinks no_check_root password_stdin \ + allow_other allow_root auto_unmount nonempty default_permissions \ + fsname:filesystem\ name \ + subtype:filesystem\ type \ + large_read \ + max_read:max\ size \ + hard_remove use_ino readdir_ino direct_io kernel_cache auto_cache \ + 'umask:permissions' \ + 'uid:owner' 'gid:group' \ + 'entry_timeout:timeout (seconds) [1]' \ + 'negative_timeout:timeout (seconds) [0]' \ + 'attr_timeout:timeout (seconds) [1]' \ + 'ac_attr_timeout:timeout (seconds) [= attr_timeout]' \ + noforget \ + 'remember:time (seconds)' \ + nopath intr \ + 'intr_signal:signal [10]' \ + modules:module \ + max_write:size \ + max_readahead:readahead \ + max_background:number \ + congestion_threshold:threshold \ + async_read sync_read atomic_o_trunc big_writes no_remote_lock no_remote_flock \ + no_remote_posix_lock splice_write splice_move splice_read \ + from_code:charset to_code:charset subdir:_directories rellinks && ret=0 +fi + +return ret diff --git a/modules/bindings/init b/modules/bindings/init index 835076b..7f11629 100644 --- a/modules/bindings/init +++ b/modules/bindings/init @@ -75,6 +75,18 @@ local function accept-or-recall-and-infer-history() { fi } zle -N accept-or-recall-and-infer-history - - bindkey "\e^M" accept-or-recall-and-infer-history + +if exists incstring; then + local function inc-last-command() { + if [[ -z $BUFFER ]]; then + BUFFER=$(incstring "$(history -n -1)"); + else + BUFFER=$(incstring "$BUFFER"); + fi + zle vi-end-of-line + } + zle -N inc-last-command + bindkey "^A" inc-last-command +fi +