VIM Cheatsheet 2 - Working with multiple files

 Working with multiple files

When working with multiple files in Vim, we have several options to manage and navigate between them. Here are some common techniques:


 

Shortcut                                         

 

Function

:w

Save the current file

:w!

Save forcefully(Used to save a Read Only file)

:wq

Saves the current file and exit

:w newname

Saves the copy of the current working file as ‘newname’ and can continue editing the original file.

:sav newname

Saves the copy of the current working file as ‘newname’ and can continue editing the new file with newname.

:q!

Forced quit.Exit from file without saving

:q

It just quits. If there are any changes that are unsaved it gives the warning “No write since last change(add ! to override)

:e filename

Opens file in the current buffer

:sp filename

Opens a file and splits the window horizontally in a new buffer

:vsp filename

Opens a file and splits the window vertically in a new buffer

:ls

Lists all the open buffers

Ctrl+ws

Splits windows horizontal

Ctrl+wv

Splits windows vertical

Ctrl+ww

To switch between windows

Ctrl+wq

To quit a window







Post a Comment

Previous Post Next Post

Contact Form