home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20110502.etc.tar.gz / bradford.20110502.etc.tar / etc / profile.d / bindkey.tcsh < prev    next >
Text File  |  2006-06-27  |  6KB  |  244 lines

  1. #
  2. # bindkey.tcsh        Bind keys on escape sequences of xterm
  3. #            and linux console
  4. #
  5. # Copyright: 1993-2002 Werner Fink, 1996-2002 SuSE Linux AG, Germany
  6. #
  7. # Author:  Werner Fink <feedback@suse.de>
  8.  
  9. #
  10. # Default values
  11. #
  12. if ( ! ${?TERM} ) setenv TERM linux
  13. if ( ! ${?CSHEDIT} ) setenv CSHEDIT emacs
  14.  
  15. #
  16. # VI line editing
  17. #
  18. if ( "$CSHEDIT" == "vi" ) then
  19.     bindkey    -v
  20. else
  21.     bindkey    "^[ "    magic-space
  22.     bindkey    "^[!"    expand-history
  23. endif
  24. #
  25. # Common standard keypad and cursor
  26. #
  27. bindkey    "^[[2~"        yank
  28. bindkey    "^[[3~"        delete-char
  29. bindkey    "^[[5~"        history-search-backward
  30. bindkey    "^[[6~"        history-search-forward
  31. if ( "$TERM" == "xterm" ) then
  32.     bindkey    "\e[2;2~"    yank
  33.     bindkey    "\e[3;2~"    delete-char
  34.     bindkey    "\e[5;2~"    history-search-backward
  35.     bindkey    "\e[6;2~"    history-search-forward
  36.     bindkey    "\e[2;5~"    yank
  37.     bindkey    "\e[3;5~"    delete-char
  38.     bindkey    "\e[5;5~"    history-search-backward
  39.     bindkey    "\e[6;5~"    history-search-forward
  40. endif
  41. bindkey    "^[[C"        forward-char
  42. bindkey    "^[[D"        backward-char
  43. bindkey    "^[[A"        up-history
  44. bindkey    "^[[B"        down-history
  45. if ( "$TERM" == "xterm" ) then
  46.     bindkey -c "^[[E"    "source /etc/csh.cshrc"
  47.     bindkey    "^[[2C"    forward-word
  48.     bindkey    "^[[2D"    backward-word
  49.     bindkey    "^[[2A"    history-search-backward
  50.     bindkey    "^[[2B"    history-search-forward
  51.     bindkey    "^[[5C"    forward-word
  52.     bindkey    "^[[5D"    backward-word
  53.     bindkey    "^[[5A"    history-search-backward
  54.     bindkey    "^[[5B"    history-search-forward
  55. else
  56.     bindkey -c "^[[G"    "source /etc/csh.cshrc"
  57. endif
  58. #
  59. # Avoid network problems
  60. #   ... \177 (ASCII-DEL) and \010 (ASCII-BS)
  61. #       do `backward-delete-char'
  62. # Note: `delete-char' is maped to \033[3~
  63. #       Therefore xterm's responce on pressing
  64. #       key Delete or KP-Delete should be
  65. #       \033[3~ ... NOT \177
  66. #
  67. bindkey    "^?"        backward-delete-char
  68. bindkey    "^H"        backward-delete-char
  69. #
  70. # Home and End
  71. #
  72. if ( "$TERM" == "xterm" ) then
  73.     #
  74.     # Normal keypad and cursor of xterm
  75.     #
  76.     bindkey    "^[[1~"    history-search-backward
  77.     bindkey    "^[[4~"    set-mark-command
  78.     bindkey    "^[[H"    beginning-of-line
  79.     bindkey    "^[[F"    end-of-line
  80.     bindkey    "^[[2H"    beginning-of-line
  81.     bindkey    "^[[2F"    end-of-line
  82.     bindkey    "^[[5H"    beginning-of-line
  83.     bindkey    "^[[5F"    end-of-line
  84.     # Home and End of application keypad and cursor of xterm
  85.     bindkey    "^[OH"    beginning-of-line
  86.     bindkey    "^[OF"    end-of-line
  87.     bindkey    "^[O2H"    beginning-of-line
  88.     bindkey    "^[O2F"    end-of-line
  89.     bindkey    "^[O5H"    beginning-of-line
  90.     bindkey    "^[O5F"    end-of-line
  91. else
  92. if ( "$TERM" == "kvt" ) then
  93.     bindkey    "^[[1~"    history-search-backward
  94.     bindkey    "^[[4~"    set-mark-command
  95.     bindkey    "^[OH"    beginning-of-line
  96.     bindkey    "^[OF"    end-of-line
  97. endif
  98.     #
  99.     # TERM=linux or console
  100.     #
  101.     bindkey    "^[[1~"    beginning-of-line
  102.     bindkey    "^[[4~"    end-of-line
  103. endif
  104. #
  105. # Application keypad and cursor of xterm
  106. #
  107. if ( "$TERM" == "xterm" ) then
  108.     bindkey    "^[OD"    backward-char
  109.     bindkey    "^[OC"    forward-char
  110.     bindkey    "^[OA"    up-history
  111.     bindkey    "^[OB"    down-history
  112.     bindkey    "^[O2D"    backward-word
  113.     bindkey    "^[O2C"    forward-word
  114.     bindkey    "^[O2A"    history-search-backward
  115.     bindkey    "^[O2B"    history-search-forward
  116.     bindkey    "^[O5D"    backward-word
  117.     bindkey    "^[O5C"    forward-word
  118.     bindkey    "^[O5A"    history-search-backward
  119.     bindkey    "^[O5B"    history-search-forward
  120.     bindkey -c "^[OE"    "source /etc/csh.cshrc"
  121.     # DEC keyboard KP_F1 - KP_F4 or
  122.     # XTerm of XFree86 in VT220 mode F1 - F4
  123.     bindkey -s "^[OP"    "^["
  124.     bindkey    "^[OQ"    vi-undo
  125.     bindkey    "^[OR"    undefined-key
  126.     bindkey    "^[OS"    kill-line
  127. endif
  128. if ( "$TERM" == "gnome" ) then
  129.     # or gnome terminal F1 - F4
  130.     bindkey -s "^[OP"    "^["
  131.     bindkey    "^[OQ"    vi-undo
  132.     bindkey    "^[OR"    undefined-key
  133.     bindkey    "^[OS"    kill-line
  134. endif
  135. #
  136. # Function keys F1 - F12
  137. #
  138. if ( "$TERM" == "linux" ) then
  139.     #
  140.     # On console the first five function keys
  141.     #
  142.     bindkey -s "^[[[A"    "^["
  143.     bindkey    "^[[[B"    vi-undo
  144.     bindkey    "^[[[C"    undefined-key
  145.     bindkey    "^[[[D"    kill-line
  146.     bindkey    "^[[[E"    undefined-key
  147. else
  148.     #
  149.     # The first five standard function keys
  150.     #
  151.     bindkey -s "^[[11~"    "^["
  152.     bindkey    "^[[12~"    vi-undo
  153.     bindkey    "^[[13~"    undefined-key
  154.     bindkey    "^[[14~"    kill-line
  155.     bindkey    "^[[15~"    undefined-key
  156. endif
  157. bindkey    "^[[17~"        undefined-key
  158. bindkey    "^[[18~"        undefined-key
  159. bindkey    "^[[19~"        undefined-key
  160. bindkey    "^[[20~"        undefined-key
  161. bindkey    "^[[21~"        undefined-key
  162. # Note: F11, F12 are identical with Shift_F1 and Shift_F2
  163. bindkey    "^[[23~"        undefined-key
  164. bindkey    "^[[24~"        undefined-key
  165. #
  166. # Shift Function keys F1  - F12
  167. #      identical with F11 - F22
  168. #
  169. # bindkey   "^[[23~"    undefined-key
  170. # bindkey   "^[[24~"    undefined-key
  171. bindkey    "^[[25~"        undefined-key
  172. bindkey    "^[[26~"        undefined-key
  173. # DEC keyboard: F15=^[[28~ is Help
  174. bindkey    "^[[28~"        undefined-key
  175. # DEC keyboard: F16=^[[29~ is Menu
  176. bindkey    "^[[29~"        undefined-key
  177. bindkey    "^[[31~"        undefined-key
  178. bindkey    "^[[32~"        undefined-key
  179. bindkey    "^[[33~"        undefined-key
  180. bindkey    "^[[34~"        undefined-key
  181. if ( "$TERM" == "xterm" ) then
  182.     # Not common
  183.     bindkey    "^[[35~"    undefined-key
  184.     bindkey    "^[[36~"    undefined-key
  185. endif
  186. #
  187. if ( "$TERM" == "xterm" ) then
  188.     #
  189.     # Application keypad and cursor of xterm
  190.     # with NumLock ON
  191.     #
  192.     # Operators
  193.     bindkey -s "^[Oo"    "/"
  194.     bindkey -s "^[Oj"    "*"
  195.     bindkey -s "^[Om"    "-"
  196.     bindkey -s "^[Ok"    "+"
  197.     bindkey -s "^[Ol"    ","
  198.     bindkey    "^[OM"    newline
  199.     bindkey -s "^[On"    "."
  200.     # Numbers
  201.     bindkey -s "^[Op"    "0"
  202.     bindkey -s "^[Oq"    "1"
  203.     bindkey -s "^[Or"    "2"
  204.     bindkey -s "^[Os"    "3"
  205.     bindkey -s "^[Ot"    "4"
  206.     bindkey -s "^[Ou"    "5"
  207.     bindkey -s "^[Ov"    "6"
  208.     bindkey -s "^[Ow"    "7"
  209.     bindkey -s "^[Ox"    "8"
  210.     bindkey -s "^[Oy"    "9"
  211. endif
  212. #
  213. #  EMACS line editing
  214. #
  215. if ( "$CSHEDIT" == "emacs" ) then 
  216.     #
  217.     # ... xterm application cursor
  218.     #
  219.         if ( "$TERM" == "xterm" ) then
  220.          bindkey    "^[^[OD"    backward-word
  221.          bindkey    "^[^[OC"    forward-word
  222.          bindkey    "^[^[OA"    up-history
  223.          bindkey    "^[^[OB"    down-history
  224.          bindkey    "^^[OD"        backward-char
  225.          bindkey    "^^[OC"        forward-char
  226.          bindkey    "^^[OA"        up-history
  227.          bindkey    "^^[OB"        down-history
  228.         endif
  229.     #
  230.     # Standard cursor
  231.     #
  232.     bindkey    "^[^[[D"    backward-word
  233.     bindkey    "^[^[[C"    forward-word
  234.     bindkey    "^[^[[A"    up-history
  235.     bindkey    "^[^[[B"    down-history
  236.     bindkey    "^^[[D"    backward-char
  237.     bindkey    "^^[[C"    forward-char
  238.     bindkey    "^^[[A"    up-history
  239.     bindkey    "^^[[B"    down-history
  240. endif
  241. #
  242. # end bindkey.tcsh
  243. #
  244.