LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Vim help,editing multiple files (https://www.linuxquestions.org/questions/linux-newbie-8/vim-help-editing-multiple-files-798353/)

cola 03-27-2010 10:37 PM

Vim help,editing multiple files
 
If i do vim file1.txt and file2.txt,only the file1.txt is displayed.
Then how can i switch from one file to another in vim?

sycamorex 03-27-2010 10:54 PM

you could use:
Quote:

:bnext
:bprevious
I don't know the shortcuts though.

cola 03-27-2010 11:30 PM

Quote:

Originally Posted by sycamorex (Post 3915004)
you could use:


I don't know the shortcuts though.

So one is hidden buffer,right?

sycamorex 03-27-2010 11:34 PM

Quote:

Originally Posted by cola (Post 3915040)
So one is hidden buffer,right?

Yes, if you open it with:
Code:

vim file1 file2

catkin 03-27-2010 11:58 PM

:n takes you to the next file
:e# toggles between two files
:rew rewinds you to the first file

Those are traditional vi commands; there are probably several other ways of doing it but those are the only ones I know and use.

vi/vim are like that -- they have so many commands we tend to explore only as far as necessary to do the things we want to do, and miss out on many other goodies.

cola 03-28-2010 12:01 AM

Quote:

Originally Posted by catkin (Post 3915061)
:n takes you to the next file
:e# toggles between two files
:rew rewinds you to the first file

Those are traditional vi commands; there are probably several other ways of doing it but those are the only ones I know and use.

vi/vim are like that -- they have so many commands we tend to explore only as far as necessary to do the things we want to do, and miss out on many other goodies.

Code:

vi/vim are like that -- they have so many commands we tend to explore only as far as necessary to do the things we want to do, and miss out on many other goodies.
Right.


All times are GMT -5. The time now is 05:18 AM.