hello Ingo,

> Heck, piping to sort, or wc + undo   are two of the most common used
> commands.

no need to pipe and undo: just write to a pipe

    :%w !wc

> Under vi, !}fmt  is also a favorite
> though vim does have better integrated commands...

AFAIK, ! work exactly the same between vim and vi. even !!
to recall the last filter works so

    !!!^M

apply the last used filter on the current line. vim makes !
even more enjoyable because it combines with extra features
in a so convenient way. an example is gF:

let's say you're reading a mail in where the sender refers to
this function_with_a_very_long_name() you never read of
before ... and you want to see some code.

in vi you can

    :cd ~/src/myproject
    :!ctags -R
    :tag function_with_a_very_long_name

the most borring part were to write the :tag line (or you
had to use the mouse).

in vim, you will edit the command line (:h q:) in a buffer
and use completion (:h i_CTRL-N)

    q:tag fun^N

cool ... but now you want navigate through the calls of this
function?  use gF (:h gF):

# <cr> means "carriage return" in the vim macro notation
# <c-x> is for CTRL+x

    :new<cr>  # or <c-w>n to split
    q:r !grep -RFwn fun<c-n><cr>

now you have a new buffer with lines like

main.c:45:    function_with_a_very_long_name("/etc/hostname",3);

put your cursor in on the filename, type gF (or <c-F> if you want to
split) and here you are: in file main.c line 45.

the use and abuse of the quickfix (:make, :set aw, ...) boosted my
productivity too. piping and forking aside: i already mentionned the
text objects (:h text-objects) in another thread but once you have this,
you can't consider vi as a decent replacement of vim. no matter how
bloated vim is. it an editor with a better balance between simplicity
and functionality existed, i'll use it for sure.

marc

PS: i'll run a workshop on vim/vi during the next slcon (not announced
yet) so it will be a good opportunity to make this thread goes on.

Reply via email to