fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
d835c5252
master
1# localization: tier1 2# This function is typically bound to Alt-W, it is used to list man page entries 3# for the command under the cursor. 4function __fish_whatis_current_token -d"Show man page entries or function description related to the token under the cursor" 5set -l token( commandline -pt) 6 7test -n " $token " 8or return 9 10set -l desc" $token : nothing appropriate." 11 12set -l tokentype( type --type$token 2> /dev/null) 13 14switch " $tokentype " 15case function 16set -l funcinfo( functions $token --details --verbose) 17 18test $funcinfo [ 5 ] != n/a 19and set desc" $token - $funcinfo [ 5 ] " 20 21case builtin 22# Since man pages can be localized, we can't look for "NAME". 23set desc( __fish_print_help $token | sed -n 4p| string trim) 24 25case file 26set -l tmpdesc( whatis $token 2> /dev/null) 27and set desc$tmpdesc 28end 29 30__fish_echo string join\n --$desc 31end