One of the reasons that people go for IDEs is that the moment you open one, you have everything exactly how you want it. With a file browser on the left hand side, coding window on the right and an attached terminal below. But whenever you open vim, you have to open the file browser and terminal from scratch.
Well there is a quick way around it. You can actually store sessions in vim. You can then open that particular session to see exactly what you want to see.
Open vim. Now open the programs that you want to see in your session. Let us open the Lex file browser:
Now let us open any file, and the open a terminal below by running the following command:
To save a session, you can use the
mks[ession] command. Note that all sessions have a
.vim extension. Vim sessions also store the split sizes, so feel free to resize your terminal without worrying about ever doing it again after opening vim
You can now safely exit out of vim without worrying about loosing your layout. You will be able to see a
session.vim file in your current directory. To open it use the -S flag in vim:
vim -S session.vim
- If you add a ! symbol after
mks, it overwrites the file you specify.
- If no file name is supplied then the default file is Session.vim
- Want to store multiple files open on multiple tabs? Go ahead!
- Want to use additional UI details while opening a session? Go ahead and create a x.vim file in the same directory and go ahead.