Friday, November 15, 2019

Re: Is there a command comparison cheat sheet between nvi and vim?

On 2019-11-15 11:33, 'Ottavio Caruso' via vim_use wrote:
> apart from the excellent "vi_diff" in the docs, is anybody aware of
> a basic cheat sheet of commands comparison between vim and *BSD nvi?

While I'm not aware of any succinct cheat-sheet, I've picked up on a
few notable differences:

For the most part, neovim is a superset of vim which is a superset of
vi.

However, (excluding neovim/vim diffs for this discussion) here are a
few hiccups I've encountered:

^A: in vim, increments the number under the cursor; in nvi, searches
for the word under the cursor (similar to "*" in vim, except it
starts at the cursor, not searching for the whole word, so if your
cursor is on the "h" of "the" it will search for the next instance of
"he" not "the")

To increment/decrement by {count} in nvi, use the #+ and #- commands

^X in vim's insert mode enters a sub-mode for completion while in nvi
it adds the character whose hex-value you specify (akin to `:help
i_CTRL-V_digit` in vim)

In nvi, ^D/0^D/^T do the same thing in insert-mode, but only at the
beginning of the line; in vim they operate anywhere within the line

Undo in nvi is traditional vi undo with only one level of undo(*)
whereas using "u" in vim keeps undoing. (*)Nvi does have multiple
undo levels, but you undo once with "u", then use the "." repeat
operator to continue undoing. Otherwise, a second "u" undoes the undo.

Windows work differently, nvi opens them with ":N fileswitches between
them with ^W where vim uses ^W as a prefix for other window-related
commands; nvi uses ":bg" and ":fg" to push screens/windows to the
background or pull them to the foreground; and uses ":resize
[+|-]size" to resize them.

While nvi can playback macros stored in registers, you have to
populate those registers manually/explicitly since there's no
record-macro functionality. I.e., write your macro into a file and
then yank/delete into a register that you can then play back.

Hope this gives you some starting points to work with.

-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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20191115101709.205adf5d%40bigbox.attlocal.net.

No comments:

Post a Comment