Advertisement
Guest User

Untitled

a guest
Dec 4th, 2008
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. Simple Addresses:
  2. 0 Head of file.
  3. $ End of file.
  4. #n Jump to character n.
  5. n Jump to line n.
  6. /regexp/ First forward occurence of rexexp.
  7. ?regexp? First backward occurence of regexp.
  8. . Dot.
  9. , The mark in the file (see k command).
  10. "regexp" Preceding simple address is in the file
  11. referred to by regexp.
  12.  
  13. Compound Addresses:
  14. a1+a2 a2 relative to the end of a1.
  15. a1-a2 a2 backwards from start of a2.
  16. a1,a2 The substring from start of a1 to end of
  17. a2.
  18. a1;a2 Like a1,a2, but a2 relative to a1.
  19.  
  20. + and - bind more tightly than , or ;.
  21. Useful idioms: a1+- select line containing a1;
  22. 0/regexp/ find first match;
  23. ./regexp/// second occurrence;
  24. .,/regexp/ extends dot.
  25.  
  26. Commands:
  27. a/text/ Insert text after range.
  28. c As a, but replace text.
  29. i Insert before range.
  30. d Delete range.
  31. s/regexp/text/ Substitute text for first match.
  32. & stands for the string that matched.
  33. \d where d is a number offsets within &.
  34. s2/x/y/ replaces second match.
  35. s/x/y/g replaces all matches.
  36.  
  37. p Print text in range.
  38. = Print line and char of range.
  39. =# Print char of range.
  40.  
  41.  
  42. b file-list Set current file to first listed file
  43. already open. List may be <command.
  44. B file-list As b, but open unopened files in list.
  45. n Print menu of files.
  46. ' or blank : modified or clean.
  47. - or + or * : unread or read or
  48. multiple windows
  49. viewing.
  50. . or blank : current file.
  51. D file-list Close files. D alone closes current.
  52.  
  53.  
  54. e filename Replace file with contents of
  55. filename.
  56. r filename Replace range with contents of
  57. filename.
  58. w filename Write the range (def. 0,$) to
  59. filename.
  60. f filename Set the file name and print its new
  61. menu entry.
  62.  
  63.  
  64. < command Replace range with stdout of command.
  65. > command Replace range with stdin of command.
  66. | command Pipe range to stdin, stdio to range.
  67. ! command Run command.
  68. When command is omitted, the last shell command will
  69. be substituted.
  70.  
  71. Loops and Conditionals:
  72. x/regexp/ command Run command on each match in range.
  73. y/regexp/ command As X but on all non-matches.
  74. X/regexp/ command For each file matching, command.
  75. Y/regexp/ command As X on non-matches.
  76. g/regexp/ command If range contains match, run.
  77. v/regexp/ command Inverted g.
  78.  
  79. Misc:
  80. k Set mark to range.
  81. q Quit.
  82. u n Undo last n top-level commands in current file.
  83. -n is redo.
  84.  
  85. Commands may be grouped within {}. They must appear
  86. on seperate lines. Changes by one command are not
  87. visible to others.
  88.  
  89. Graphical mode:
  90. Esc selects text typed since last mouse button press.
  91. Button 3 opens the window ops. menu.
  92. Button 1 changes the selection.
  93. Button 2 opens the editing menu.
  94. <rio> Exchange snarf buffer with rio.
  95. /regexp Search for next occurrence of last regexp
  96. typed in a command.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement