Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 38

Warning: include(http://www.linux-faqs.com/HOWTO/header.inc) [function.include]: failed to open stream: no suitable wrapper could be found in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 38

Warning: include() [function.include]: Failed opening 'http://www.linux-faqs.com/HOWTO/header.inc' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 38

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 39

Warning: include(http://www.linux-faqs.com/HOWTO/header.bottom.inc) [function.include]: failed to open stream: no suitable wrapper could be found in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 39

Warning: include() [function.include]: Failed opening 'http://www.linux-faqs.com/HOWTO/header.bottom.inc' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 39
 
FAQS
» Advanced Routing & Traffic Control
» General FAQ
» Squid Proxy Server
» Sendmail
» Fetchmail
» Postfix
» Connecting Mobile Phone
» Paging from Linux
» Standard Commands
» Some common terms
HOW-TOs
» ADSL Bandwidth Management
» Compile Apache
» Make a Bootdis
» Linux-Windows9x-Grub
» Linux-Windows
» Linux Crash Recovery
» Optimise Squid
» Block websites in Squid
» broadcast webcam in linux
» Compile RedHat Linux kernel
» Implement Firewall Security
» Increase Harddrive Performance
» Mount NTFS filesystem
» Patch / rebuild SRPM
» Secure Linux
» Set up a DHCP Server
» Set up an FTP server
» Set up Linux as a Router
» Use Cron
Miscellaneous
» All Ports
» Hardware Guides
» Hardware Review Guides
» Fav Troubleshooting forums
» Spammers fetch email addresses
» Mounting NTFS in linux


 

6. Multi-file editing

One often needs to edit more than one file at a time. For example one maybe editing a header file and a source file at the same time. To edit more than one file at a time, invoke VIM using the following command

	 
$ 

vim file1 file2 ...

      

Now you can edit the first file and move onto the next file using the command

	 
:n

      

You can jump back using the command

	 
:e#

      

It may be useful while coding if you could see both the files at the same time and switch between the two. In other words, it would be useful if the screen was split and you could see the header file at the top and the source file at the bottom. VIM has such a command to split the screen. To invoke i, simply say :split

The same file will be displayed in both the windows. Whatever command is invoked, will affect only the window in focus. So one can edit another file in another window by using the command :e file2

After executing that command, you'll find that there are two files visible. One window shows the first file and the other shows the second file. To switch between the files one has to use the keystroke CTRL-W CTRL-W . To learn more about split windows, just run help on it.


 
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 246

Warning: include(http://www.linux-faqs.com/HOWTO/body.right.inc) [function.include]: failed to open stream: no suitable wrapper could be found in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 246

Warning: include() [function.include]: Failed opening 'http://www.linux-faqs.com/HOWTO/body.right.inc' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 246


 

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 251

Warning: include(http://www.linux-faqs.com/HOWTO/footer.inc) [function.include]: failed to open stream: no suitable wrapper could be found in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 251

Warning: include() [function.include]: Failed opening 'http://www.linux-faqs.com/HOWTO/footer.inc' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.showoff/linuxfaqs/linux-faqs.com/HOWTO/C-editing-with-VIM-HOWTO/multi.php on line 251