Server IP : 103.119.228.120 / Your IP : 52.14.6.41 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/zsh/5.0.2/functions/ |
Upload File : |
# This set of functions implements a sort of magic history searching. # After predict-on, typing characters causes the editor to look backward # in the history for the first line beginning with what you have typed so # far. After predict-off, editing returns to normal for the line found. # In fact, you often don't even need to use predict-off, because if the # line doesn't match something in the history, adding a key performs # standard completion --- though editing in the middle is liable to delete # the rest of the line. # # With the function based completion system (which is needed for this), # you should be able to type TAB at almost any point to advance the cursor # to the next "interesting" character position (usually the end of the # current word, but sometimes somewhere in the middle of the word). And # of course as soon as the entire line is what you want, you can accept # with RETURN, without needing to move the cursor to the end first. # # To use it: # autoload -Uz predict-on # zle -N predict-on # zle -N predict-off # bindkey '...' predict-on # bindkey '...' predict-off # Note that all functions are defined when you first type the predict-on # key, which means typing the predict-off key before that gives a harmless # error message. predict-on() { zle -N self-insert insert-and-predict zle -N magic-space insert-and-predict zle -N backward-delete-char delete-backward-and-predict zle -N delete-char-or-list delete-no-predict zstyle -t :predict verbose && zle -M predict-on return 0 } predict-off() { zle -A .self-insert self-insert zle -A .magic-space magic-space zle -A .backward-delete-char backward-delete-char zstyle -t :predict verbose && zle -M predict-off return 0 } insert-and-predict () { setopt localoptions noshwordsplit noksharrays if [[ $LBUFFER == *$'\012'* ]] || (( PENDING )) then # Editing a multiline buffer or pasting in a chunk of text; # it's unlikely prediction is wanted zstyle -t ":predict" toggle && predict-off zle .$WIDGET "$@" return elif [[ ${RBUFFER[1]} == ${KEYS[-1]} ]] then # Same as what's typed, just move on ((++CURSOR)) else LBUFFER="$LBUFFER$KEYS" if [[ $LASTWIDGET == (self-insert|magic-space|backward-delete-char) || $LASTWIDGET == (complete-word|accept-*|predict-*|zle-line-init) ]] then if ! zle .history-beginning-search-backward then RBUFFER="" if [[ ${KEYS[-1]} != ' ' ]] then unsetopt automenu recexact integer curs=$CURSOR pos nchar=${#LBUFFER//[^${KEYS[-1]}]} local -a +h comppostfuncs local crs curcontext="predict:${${curcontext:-:::}#*:}" comppostfuncs=( predict-limit-list ) zle complete-word # Decide where to leave the cursor. The dummy loop is used to # get out of that `case'. repeat 1 do zstyle -s ":predict" cursor crs case $crs in (complete) # At the place where the completion left it, if it is after # the character typed. [[ ${LBUFFER[-1]} = ${KEYS[-1]} ]] && break ;& (key) # Or maybe at the n'th occurrence of the character typed. pos=${BUFFER[(in:nchar:)${KEYS[-1]}]} if [[ pos -gt curs ]] then CURSOR=$pos break fi ;& (*) # Or else at the previous position. CURSOR=$curs esac done fi fi else zstyle -t ":predict" toggle && predict-off fi fi return 0 } delete-backward-and-predict() { if (( $#LBUFFER > 1 )) then setopt localoptions noshwordsplit noksharrays # When editing a multiline buffer, it's unlikely prediction is wanted; # or if the last widget was e.g. a motion, then probably the intent is # to actually edit the line, not change the search prefix. if [[ $LBUFFER = *$'\012'* || $LASTWIDGET != (self-insert|magic-space|backward-delete-char) ]] then zstyle -t ":predict" toggle && predict-off LBUFFER="$LBUFFER[1,-2]" else ((--CURSOR)) zle .history-beginning-search-forward || RBUFFER="" return 0 fi else zle .kill-whole-line fi } delete-no-predict() { [[ $WIDGET != delete-char-or-list || -n $RBUFFER ]] && predict-off zle .$WIDGET "$@" } # This is a helper function for autocompletion to prevent long lists # of matches from forcing a "do you wish to see all ...?" prompt. predict-limit-list() { if (( compstate[list_lines]+BUFFERLINES > LINES || ( compstate[list_max] != 0 && compstate[nmatches] > compstate[list_max] ) )) then compstate[list]='' elif zstyle -t ":predict" list always then compstate[list]='force list' fi } # Handle zsh autoloading conventions [[ -o kshautoload ]] || predict-on "$@"