Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

The help says that virtual replace mode commands in Vim gr & GR replace characters in screen estate and not in file.

:help Virtual-Replace-mode

I am understanding this as something like changing the characters on the display but not in the buffer itself. Is that right? It seems incorrect.

I can use an explanation and probably a scenario or an example where this feature is relevant.

share|improve this question

migrated from serverfault.com May 24 '13 at 12:19

This question came from our site for professional system and network administrators.

1 Answer 1

up vote 7 down vote accepted

In Virtual-Replace-Mode the Buffer is harder fixed to its origin position.

1. Hello World
         ^ Cursor
2. I like cheese
3. And beer

When entering normal replace mode and hitting Internet<CR>And others the new buffer will be like this:

1. Hello Internet
2. And others
3. I like cheese
4. And beer

When doing the same in Virtual-Replace the result will be

1. Hello Internet
2. And othersese
3. And beer

Another example (tabstop=2;sts=0):

1. 012345678901234567890
2. Hello beautiful World
         ^ Cursor

Pressed keys: <Tab><Tab>

Replace-Mode result:

1. 012345678901234567890
2. Hello     autiful World

Virtual-Replace-Mode result:

1. 012345678901234567890
2. Hello     tiful World

Because in Replace mode the replacement is done char by char, where Tab is one char, no matter how many chars are displayed. In Virtual-Replace-Mode visible length of the Tab (:h 'ts', :h 'sts') is used to replace the chars.

share|improve this answer
    
(Did any characters get eaten up by comment formatting, some quoted strings look like they miss text, to me). Anyway, the last paragraph helped a lot. Im pretty sure I get it now :) Thanks a ton @krissi ! –  sri May 24 '13 at 13:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.