[Linux常用命令]bind

 

bind
 1        bind [-m keymap] [-lpsvPSV]
 2        bind [-m keymap] [-q function] [-u function] [-r keyseq]
 3        bind [-m keymap] -f filename
 4        bind [-m keymap] -x keyseq:shell-command
 5        bind [-m keymap] keyseq:function-name
 6        bind readline-command
 7               Display  current  readline key and function bindings, bind a key
 8               sequence to a readline function or  macro,  or  set  a  readline
 9               variable.   Each  non-option  argument  is a command as it would
10               appear in .inputrc, but each binding or command must  be  passed
11               as  a  separate argument; e.g., '"\C-x\C-r": re-read-init-file'.
12               Options, if supplied, have the following meanings:
13               -m keymap
14                      Use keymap as the keymap to be affected by the subsequent
15                      bindings.     Acceptable    keymap   names   are   emacs,
16                      emacs-standard,  emacs-meta,  emacs-ctlx,  vi,   vi-move,
17                      vi-command,  and vi-insert.  vi is equivalent to vi-com‐
18                      mand; emacs is equivalent to emacs-standard.
19               -l     List the names of all readline functions.
20               -p     Display readline function names and bindings  in  such  a
21                      way that they can be re-read.
22               -P     List current readline function names and bindings.
23               -s     Display  readline  key  sequences bound to macros and the
24                      strings they output in such a way that they  can  be  re-
25                      read.
26               -S     Display  readline  key  sequences bound to macros and the
27                      strings they output.
28               -v     Display readline variable names and values in such a  way
29                      that they can be re-read.
30               -V     List current readline variable names and values.
31               -f filename
32                      Read key bindings from filename.
33               -q function
34                      Query about which keys invoke the named function.
35               -u function
36                      Unbind all keys bound to the named function.
37               -r keyseq
38                      Remove any current binding for keyseq.
39               -x keyseq:shell-command
40                      Cause  shell-command  to  be  executed whenever keyseq is
41                      entered.  When shell-command is executed, the shell  sets
42                      the  READLINE_LINE variable to the contents of the rea‐
43                      line line buffer and the READLINE_POINT variable  to  the
44                      current location of the insertion point.  If the executed
45                      command changes the  value  of  READLINE_LINE  or  REA‐
46                      LINE_POINT,  those  new  values  will be reflected in the
47                      editing state.
48 
49               The return value is 0 unless an unrecognized option is given  or
50               an error occurred.

 其中keyseq可以使用showkey -a命令来获取,如:

$ showkey -a

Press any keys - Ctrl-D will terminate this program

^[[A      27 0033 0x1b             "
      91 0133 0x5b
      65 0101 0x41
^[[B      27 0033 0x1b              "
      91 0133 0x5b
      66 0102 0x42
^[[C      27 0033 0x1b              "
      91 0133 0x5b
      67 0103 0x43
^[[D      27 0033 0x1b              "
      91 0133 0x5b
      68 0104 0x44
^[[1~      27 0033 0x1b      "Home
      91 0133 0x5b
      49 0061 0x31
     126 0176 0x7e
^[[2~      27 0033 0x1b       "Insert
      91 0133 0x5b
      50 0062 0x32
     126 0176 0x7e
^[[3~      27 0033 0x1b        "Delete
      91 0133 0x5b
      51 0063 0x33
     126 0176 0x7e
^[[4~      27 0033 0x1b       "End
      91 0133 0x5b
      52 0064 0x34
     126 0176 0x7e
^[[5~      27 0033 0x1b        "PgUp
      91 0133 0x5b
      53 0065 0x35
     126 0176 0x7e
^[[6~      27 0033 0x1b         "PgDn
      91 0133 0x5b
      54 0066 0x36
     126 0176 0x7e
^H       8 0010 0x08                  "Backspcae
^M      13 0015 0x0d                 "Enter
           9 0011 0x09          "Tab
       32 0040 0x20 "Blankspace
^[ 27 0033 0x1b "Esc ^[OP 27 0033 0x1b "F1 79 0117 0x4f 80 0120 0x50 ^[OQ 27 0033 0x1b "F2 79 0117 0x4f 81 0121 0x51 ^[OR 27 0033 0x1b "F3 79 0117 0x4f 82 0122 0x52 ^[OS 27 0033 0x1b "F4 79 0117 0x4f 83 0123 0x53 ^[[15~ 27 0033 0x1b "F5 91 0133 0x5b 49 0061 0x31 53 0065 0x35 126 0176 0x7e ^[[17~ 27 0033 0x1b "F6 91 0133 0x5b 49 0061 0x31 55 0067 0x37 126 0176 0x7e ^[[18~ 27 0033 0x1b "F7 91 0133 0x5b 49 0061 0x31 56 0070 0x38 126 0176 0x7e ^[[19~ 27 0033 0x1b "F8 91 0133 0x5b 49 0061 0x31 57 0071 0x39 126 0176 0x7e ^[[20~ 27 0033 0x1b "F9 91 0133 0x5b 50 0062 0x32 48 0060 0x30 126 0176 0x7e ^[[21~ 27 0033 0x1b "F10 91 0133 0x5b 50 0062 0x32 49 0061 0x31 126 0176 0x7e ^[[23~ 27 0033 0x1b "F11 91 0133 0x5b 50 0062 0x32 51 0063 0x33 126 0176 0x7e ^[[24~ 27 0033 0x1b "F12 91 0133 0x5b 50 0062 0x32 52 0064 0x34 126 0176 0x7e ^D 4 0004 0x04 "Ctrl+d

 

posted on 2013-01-08 11:10  Lo0ong  阅读(2279)  评论(0编辑  收藏  举报

导航