Vim newbie here. I use :find command to open a file and make some changes. Suppose I want to open another file without saving the current changes, then how should I do it. What is the best way to list all open files and quickly open them again for editing. Thanks in advance.
Asked
Active
Viewed 1,399 times
0
-
4Add the lines `set hidden` (load files without saving current file) and `set wildmenu` (useful command line tab-completion) to your `.vimrc`. Then to start editing a file in a new buffer you can do `:edit yourFile.txt`. Unlike `:find
` command, `:edit – builder-7000 Apr 19 '18 at 15:28` (or :`e ` for short) will only display files in current directory. Alternatively you can download a plugin like [`CtrlP`](https://github.com/kien/ctrlp.vim) dedicated to find/load files quickly. -
Possible duplicate of [How to effectively work with multiple files in Vim?](https://stackoverflow.com/questions/53664/how-to-effectively-work-with-multiple-files-in-vim) – dlmeetei Apr 20 '18 at 05:51
1 Answers
1
:e! filename
will allow you to open a named file in a new buffer (note the exclamation mark overrides the warning re. an unsaved file).
CTRL-W + cursor
will move between visible buffers and does not enforce the saving of your file as you navigate.
:buffers
will list your open buffers and allow you to navigate to each one (albeit with some cryptic flags indicating which buffers are visible/hidden/amended etc.)
:help buffers
will tell you about all the buffer-related features.
:help :wincmd
will tell you all about windows navigations
See also the VIM buffer FAQ

Brian Agnew
- 268,207
- 37
- 334
- 440
-
:e! command only search in the cwd for files while :find recursively search in the cwd for files. is there a way to open file in buffer using find command. also CTRL-W + cursor command doesn't seems to work. Thanks. – Nikhil Pujari Apr 20 '18 at 06:20