On 01/17/12 20:04, Chris Jones wrote:
At the bash prompt, I often use the [Alt+.]¹ keyboard action to retrieve
the argument of a prior command from the bash history list.

To illustrate:

| $ mkdir -p long/directory/name/I/would/rather/not/type/again
| $ cd [Alt+.]

Bash expands the [Alt+.] giving me:

| $ cd long/directory/name/I/would/rather/not/type/again

So I just have to hit enter.

Naturally, this is not limited to the last command: I can hit [Alt+.]
twice to retrieve the argument of the last-but-one command.. etc.

I'm used to doing this in bash and I find it a lot more effective than
retrieving entire commands and editing them (in this case, retrieving
the mkdir command&  replacing ‘mkdir -p’ by ‘cd’).

Is there any way I could do this in Vim's ex-mode?

While there's no immediate way to do what you ask, there are some options to simplify typing that text again.

1) You can use the command-line register to enter the previously-entered Ex command at the cursor. To do this, while you're typing a command, use control+R followed by a colon.

2) use the command-window. You can access it either via "q:" or, if you've started a command, press control+F (default, but changeable: see help on 'cedit'). This allows you to edit the previous command and issue it as a new command (it doesn't replace the previous history item, so you can reedit the same command multiple times).

  :help q:
  :help c_<C-R>

And thanks for the bash alt+period keychord...I've been using "!:$" to insert the last parameter in my command, and your way is far faster.

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to