![]() ![]() For example to open three files, file1.txt, file2.txt and file3.txt we write: vim -o file1.txt file2.txt file3.txt We can also split vim screens by opening multiple files using the -o option. On the other hand, to split vim horizontally, we use the same method, except in this case instead of pressing v after CTRL+w we press s. Now we will have a screen that is vertically split between two files, file1.txt and file2.txt. For example, to open a file, file2.txt into a new window we write: :vsplit file2.txt The above command splits the currently open window into two, We can close one by using the :q command to quit.įurthermore, we can open a file into a newly split window by passing the file name as an argument. ![]() In this example, we open three files in three different vim windows.Īnother way to split vim windows vertically is to execute the command while in an open file in VIM: :vsplit This moves the cursor to the left or right side depending on what we want.Īnother way to split multiple files between multiple windows is to execute the following command: vim -O file1.txt file2.txt file3.txt To switch between screens we use CTRL+w followed by either r or l for right or left respectively. We activate this mode by pressing the escape key. ![]() For this to work we must be in normal mode. To split the screen into two sides vertically, we press CTRL+w + v. In this article at OpenGenus, we discuss how to split VIM into multiple windows both vertically and horizontally, switch between them, change their sizes according to our needs and close open windows. With VIM's shortcuts and capabilities we can handle everything from the keyboard. It is highly configurable and programmable, that is, we can configure it to suit our own specific needs.Įfficiency is a very important part of development and switching between mouse and keyboard every time we want to open files, edit them, switch between them, move cursors, etc becomes a time-consuming task. We can use it to edit simple files or even manage multiple files at once very easily using built-in commands. VIM is a powerful lightweight text editor that comes pre-installed in Linux systems. In this article, we learn how to split VIM screens, switch between them, change sizes and close them. VIM is a powerful, lightweight open-source text editor. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |