I recently went over the Readline editing section of the bash man page, and 
collected a set of commands that I found useful and did not of them yet. I 
hereby present you my notes (mostly copy-and-pasted text sections) of 
commands that I found there and believed could be of use for me (and others) 
in the future.

Note I omitted the command line editing commands that I've already learned. 
Some of the latter (of the top of my head) are:

1. Arrow keys for history.

2. Tab for filename completion.

3. Ctrl+W to delete a word.

4. Ctrl+K to delete till the end of the line.

5. I binded the search history from cursor forwards and backwards to Ctrl+P 
and Ctrl+N and use it a lot.

6. Ctrl+X ; Ctrl+E to edit the current command using an editor.

So without further ado here's the notes I collected. (A completely different 
approach would be to run "set -o vi" and then to use vi-like commands to edit 
the command line instead of Emacs-like ones.)

Best regards,

        Shlomi Fish

<<<<<<<<<<<<<<<<<<
* Check for incremental search.

* C-M-y to insert argument from the last command:

<<< yank-nth-arg (M-C-y) Insert the first argument to the previous command
(usually the second word on the previous line) at point. With an argument n,
insert the nth word from the previous command (the words in the previous
command begin with word 0). A negative argument inserts the nth word from the
end of the previous command. 

yank-last-arg (M-. , M-_ ) Insert the last argument to the previous command
(the last word of the previous history entry). With an argument, behave 
exactly
like yank-nth-arg. Successive calls to yank-last-arg move back through the
history list, inserting the last argument of each line in turn.
>>>

* Argument:
    - digit-argument (M-0, M-1, ..., M--) Add this digit to the argument
      already accumulating, or start a new argument. M-- starts a negative
      argument.

* M-. - insert the last argument:

    $ echo one two three four $ ls [M-.] gives you: $ ls four

* operate-and-get-next (C-o) 
Accept the current line for execution and fetch the next line relative to the
current line from the history for editing. Any argument is ignored.

    - Allows cycling between commands.

* quoted-insert (C-q, C-v) 
Add the next character typed to the line verbatim. This is how to insert
characters like C-q, for example. 

* transpose-words (M-t) 
Drag the word before point past the word after point, moving point over that
word as well. If point is at the end of the line, this transposes the last two
words on the line.

* backward-kill-line (C-x Rubout) 
Kill backward to the beginning of the line. 

* unix-line-discard (C-u) 
Kill backward from point to the beginning of the line. The killed text is 
saved
on the kill-ring. 

* kill-word (M-d) 
Kill from point to the end of the current word, or if between words, to the 
end
of the next word. Word boundaries are the same as those used by forward-word.
                                                  
* backward-kill-word (M-Rubout) 
Kill the word behind point. Word boundaries are the same as those used by
backward-word.                                                  

yank (C-y) Yank the top of the kill ring into the buffer at point. 

yank-pop (M-y) Rotate the kill ring, and yank the new top. Only works 
following
yank or yank-pop.

* start-kbd-macro (C-x ( ) 
Begin saving the characters typed into the current keyboard macro. 
* end-kbd-macro (C-x ) ) 
Stop saving the characters typed into the current keyboard macro and store the
definition. 
* call-last-kbd-macro (C-x e) 
Re-execute the last keyboard macro defined, by making the characters in the
macro appear as if typed at the keyboard.

* undo (C-_, C-x C-u) 
Incremental undo, separately remembered for each line. 

* glob-complete-word (M-g) 
The word before point is treated as a pattern for pathname expansion, with an
asterisk implicitly appended. This pattern is used to generate a list of
matching file names for possible completions. 

* glob-expand-word (C-x *) 
The word before point is treated as a pattern for pathname expansion, and the
list of matching file names is inserted, replacing the word. If a numeric
argument is supplied, an asterisk is appended before pathname expansion. 

* glob-list-expansions (C-x g) 
The list of expansions that would have been generated by glob-expand-word is
displayed, and the line is redrawn. If a numeric argument is supplied, an
asterisk is appended before pathname expansion. 
>>>>>>>>>>>>>>>>>>


-- 

---------------------------------------------------------------------
Shlomi Fish      [EMAIL PROTECTED]
Homepage:        http://www.shlomifish.org/

95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to