I know I can open multiple files with vim by doing something like vim 2011-12*.log, but how can I switch between files and close the files one at a time? Also, how can I tell the file name of the current file that I'm editing?
|
|
|||
|
|
First of all, in vim you can enter : and then help A good place for you to start would be the topic
Ok, on to your answer. After starting vim with a list of files, you can move to the next file by entering There's also an analogous To see where you are in the file list enter
[foo.txt] bar.txt |
|||||||||
|
|
you can open another file while vim is open with The keyboard shortcuts gT and gt can also be used to switch tabs when you are not in editing mode (i.e. not in insert, replace etc modes). On some systems Ctrl+Alt+PgUp and Ctrl+Alt+PgDown also allow tab-switching, but this does not always work (for example, it won't work in the OS X terminal 'out of the box'). And you can see the filename at the top of the vim app. |
|||||
|
|
Another option apart from the answers given, is to split the window with:
|
|||||
|
|
Commands to switch between buffers:
To know filename use Ctrl+G or |
|||
|
|
|
I asked a similar question at superuser, "How to copy and paste between different bash windows and files opened with VI?" The answer to my question was you can't, but you can open two files in one bash window using VIM's
My bash is black and white, so the file name of each screen is styled as a reversed 'selected' line with the file name cited there. Woot! |
||||
|
|
