saveviquit

Difference between wq and x in vi


I always using :wq to save a file. Today, I came to know that :x can be used to do that. But I didn't notice it in any vi-tutorial or vi-quick-reference. Is there any difference between these two commands?


Solution

  • From

    help :x
    
        *:x* *:xit*
    :[range]x[it][!] [++opt] [file]
                Like ":wq", but write only when changes have been
                made.
                When 'hidden' is set and there are more windows, the
                current buffer becomes hidden, after writing the file.