📄 readline.0
字号:
READLINE(3) READLINE(3)NNAAMMEE readline - get a line from a user with editingSSYYNNOOPPSSIISS ##iinncclluuddee <<ssttddiioo..hh>> ##iinncclluuddee <<rreeaaddlliinnee//rreeaaddlliinnee..hh>> ##iinncclluuddee <<rreeaaddlliinnee//hhiissttoorryy..hh>> _c_h_a_r _* rreeaaddlliinnee (_c_o_n_s_t _c_h_a_r _*_p_r_o_m_p_t);CCOOPPYYRRIIGGHHTT Readline is Copyright (C) 1989-2004 by the Free Software Foundation, Inc.DDEESSCCRRIIPPTTIIOONN rreeaaddlliinnee will read a line from the terminal and return it, using pprroommpptt as a prompt. If pprroommpptt is NNUULLLL or the empty string, no prompt is issued. The line returned is allocated with _m_a_l_l_o_c(3); the caller must free it when finished. The line returned has the final newline removed, so only the text of the line remains. rreeaaddlliinnee offers editing capabilities while the user is entering the line. By default, the line editing commands are similar to those of emacs. A vi-style line editing interface is also available. This manual page describes only the most basic use of rreeaaddlliinnee. Much more functionality is available; see _T_h_e _G_N_U _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y and _T_h_e _G_N_U _H_i_s_t_o_r_y _L_i_b_r_a_r_y for additional information.RREETTUURRNN VVAALLUUEE rreeaaddlliinnee returns the text of the line read. A blank line returns the empty string. If EEOOFF is encountered while reading a line, and the line is empty, NNUULLLL is returned. If an EEOOFF is read with a non-empty line, it is treated as a newline.NNOOTTAATTIIOONN An emacs-style notation is used to denote keystrokes. Control keys are denoted by C-_k_e_y, e.g., C-n means Control-N. Similarly, _m_e_t_a keys are denoted by M-_k_e_y, so M-x means Meta-X. (On keyboards without a _m_e_t_a key, M-_x means ESC _x, i.e., press the Escape key then the _x key. This makes ESC the _m_e_t_a _p_r_e_f_i_x. The combination M-C-_x means ESC-Control-_x, or press the Escape key then hold the Control key while pressing the _x key.) Readline commands may be given numeric _a_r_g_u_m_e_n_t_s, which normally act as a repeat count. Sometimes, however, it is the sign of the argument that is significant. Passing a negative argument to a command that acts in the forward direction (e.g., kkiillll--lliinnee) causes that command to act in a backward direction. Commands whose behavior with arguments deviates from this are noted. When a command is described as _k_i_l_l_i_n_g text, the text deleted is saved for possible future retrieval (_y_a_n_k_i_n_g). The killed text is saved in a _k_i_l_l _r_i_n_g. Consecutive kills cause the text to be accumulated into one unit, which can be yanked all at once. Commands which do not kill text separate the chunks of text on the kill ring.IINNIITTIIAALLIIZZAATTIIOONN FFIILLEE Readline is customized by putting commands in an initialization file (the _i_n_p_u_t_r_c file). The name of this file is taken from the value of the IINNPPUUTTRRCC environment variable. If that variable is unset, the default is _~_/_._i_n_p_u_t_r_c. When a program which uses the readline library starts up, the init file is read, and the key bindings and variables are set. There are only a few basic constructs allowed in the readline init file. Blank lines are ignored. Lines beginning with a ## are com- ments. Lines beginning with a $$ indicate conditional constructs. Other lines denote key bindings and variable settings. Each program using this library may add its own commands and bindings. For example, placing M-Control-u: universal-argument or C-Meta-u: universal-argument into the _i_n_p_u_t_r_c would make M-C-u execute the readline command _u_n_i_v_e_r_- _s_a_l_-_a_r_g_u_m_e_n_t. The following symbolic character names are recognized while processing key bindings: _D_E_L, _E_S_C, _E_S_C_A_P_E, _L_F_D, _N_E_W_L_I_N_E, _R_E_T, _R_E_T_U_R_N, _R_U_B_O_U_T, _S_P_A_C_E, _S_P_C, and _T_A_B. In addition to command names, readline allows keys to be bound to a string that is inserted when the key is pressed (a _m_a_c_r_o). KKeeyy BBiinnddiinnggss The syntax for controlling key bindings in the _i_n_p_u_t_r_c file is simple. All that is required is the name of the command or the text of a macro and a key sequence to which it should be bound. The name may be speci- fied in one of two ways: as a symbolic key name, possibly with _M_e_t_a_- or _C_o_n_t_r_o_l_- prefixes, or as a key sequence. When using the form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_n_a_m_e is the name of a key spelled out in English. For example: Control-u: universal-argument Meta-Rubout: backward-kill-word Control-o: "> output" In the above example, _C_-_u is bound to the function uunniivveerrssaall--aarrgguummeenntt, _M_-_D_E_L is bound to the function bbaacckkwwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to run the macro expressed on the right hand side (that is, to insert the text ``> output'' into the line). In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyysseeqq differs from kkeeyynnaammee above in that strings denoting an entire key sequence may be specified by placing the sequence within double quotes. Some GNU Emacs style key escapes can be used, as in the following example, but the symbolic character names are not recognized. "\C-u": universal-argument "\C-x\C-r": re-read-init-file "\e[11~": "Function Key 1" In this example, _C_-_u is again bound to the function uunniivveerrssaall--aarrgguummeenntt. _C_-_x _C_-_r is bound to the function rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the text ``Function Key 1''. The full set of GNU Emacs style escape sequences available when speci- fying key sequences is \\CC-- control prefix \\MM-- meta prefix \\ee an escape character \\\\ backslash \\"" literal ", a double quote \\'' literal ', a single quote In addition to the GNU Emacs style escape sequences, a second set of backslash escapes is available: \\aa alert (bell) \\bb backspace \\dd delete \\ff form feed \\nn newline \\rr carriage return \\tt horizontal tab \\vv vertical tab \\_n_n_n the eight-bit character whose value is the octal value _n_n_n (one to three digits) \\xx_H_H the eight-bit character whose value is the hexadecimal value _H_H (one or two hex digits) When entering the text of a macro, single or double quotes should be used to indicate a macro definition. Unquoted text is assumed to be a function name. In the macro body, the backslash escapes described above are expanded. Backslash will quote any other character in the macro text, including " and '. BBaasshh allows the current readline key bindings to be displayed or modi- fied with the bbiinndd builtin command. The editing mode may be switched during interactive use by using the --oo option to the sseett builtin com- mand. Other programs using this library provide similar mechanisms. The _i_n_p_u_t_r_c file may be edited and re-read if a program does not pro- vide any other means to incorporate new bindings. VVaarriiaabblleess Readline has variables that can be used to further customize its behav- ior. A variable may be set in the _i_n_p_u_t_r_c file with a statement of the form sseett _v_a_r_i_a_b_l_e_-_n_a_m_e _v_a_l_u_e Except where noted, readline variables can take the values OOnn or OOffff (without regard to case). The variables and their default values are: bbeellll--ssttyyllee ((aauuddiibbllee)) Controls what happens when readline wants to ring the terminal bell. If set to nnoonnee, readline never rings the bell. If set to vviissiibbllee, readline uses a visible bell if one is available. If set to aauuddiibbllee, readline attempts to ring the terminal's bell. ccoommmmeenntt--bbeeggiinn ((````##'''')) The string that is inserted in vvii mode when the iinnsseerrtt--ccoommmmeenntt command is executed. This command is bound to MM--## in emacs mode and to ## in vi command mode. ccoommpplleettiioonn--iiggnnoorree--ccaassee ((OOffff)) If set to OOnn, readline performs filename matching and completion in a case-insensitive fashion. ccoommpplleettiioonn--qquueerryy--iitteemmss ((110000)) This determines when the user is queried about viewing the num- ber of possible completions generated by the ppoossssiibbllee--ccoommppllee-- ttiioonnss command. It may be set to any integer value greater than or equal to zero. If the number of possible completions is greater than or equal to the value of this variable, the user is asked whether or not he wishes to view them; otherwise they are simply listed on the terminal. ccoonnvveerrtt--mmeettaa ((OOnn)) If set to OOnn, readline will convert characters with the eighth bit set to an ASCII key sequence by stripping the eighth bit and prefixing it with an escape character (in effect, using escape as the _m_e_t_a _p_r_e_f_i_x). ddiissaabbllee--ccoommpplleettiioonn ((OOffff)) If set to OOnn, readline will inhibit word completion. Completion characters will be inserted into the line as if they had been mapped to sseellff--iinnsseerrtt. eeddiittiinngg--mmooddee ((eemmaaccss)) Controls whether readline begins with a set of key bindings sim- ilar to emacs or vi. eeddiittiinngg--mmooddee can be set to either eemmaaccss or vvii. eennaabbllee--kkeeyyppaadd ((OOffff)) When set to OOnn, readline will try to enable the application key- pad when it is called. Some systems need this to enable the arrow keys. eexxppaanndd--ttiillddee ((OOffff)) If set to oonn, tilde expansion is performed when readline attempts word completion. hhiissttoorryy--pprreesseerrvvee--ppooiinntt If set to oonn, the history code attempts to place point at the same location on each history line retrived with pprreevviioouuss--hhiiss-- ttoorryy or nneexxtt--hhiissttoorryy. hhoorriizzoonnttaall--ssccrroollll--mmooddee ((OOffff)) When set to OOnn, makes readline use a single line for display, scrolling the input horizontally on a single screen line when it becomes longer than the screen width rather than wrapping to a new line. iinnppuutt--mmeettaa ((OOffff)) If set to OOnn, readline will enable eight-bit input (that is, it will not clear the eighth bit in the characters it reads), regardless of what the terminal claims it can support. The name mmeettaa--ffllaagg is a synonym for this variable. iisseeaarrcchh--tteerrmmiinnaattoorrss ((````CC--[[ CC--JJ'''')) The string of characters that should terminate an incremental search without subsequently executing the character as a com- mand. If this variable has not been given a value, the charac-
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -