Dec 17, 2012

vim edit multiple files


How to open multiple files in different tabs in Vim

]# vim -p file1.txt file2.txt file3.txt



How to access multiple files from the same window 

]# vim  test_1.txt        #Which opens test_1.txt

After editing this file, without closing or coming out of this file, do you know how to reopen a file.

:e test_2.txt       #Which opens test_2.txt

Now you want to reopen the previous file test_1.txt

:e#                 #Now you have already opened test_2.txt, but this reopens test_1.txt

after this, if you try to give the command again, it reopens previous file test_2.txt

:e#                 #Now you have already opened test_1.txt, but this reopens test_2.txt



Suppose if you want to open some other file, just give the file name and access
:e  test_3.txt


This trick helps you a lot when you have to work switching back to back two files and this way you can easily reopen the previous file without much typing effort


Want to learn more about Vim/Vi Commands, please refer to the following:
http://perlexamples.blogspot.mx/2012/11/vim-commands.html



No comments:

Post a Comment