Wednesday, December 1, 2010

Re: Opening files in new buffers

On 12/01/2010 03:51 PM, Ven Tadipatri wrote:
> I like the way vim allows you to view the files in a directory, then
> directly go to them. But then to go back after editing the file I
> chose, I repeatedly hit ctrl-O until I get back to the file listing.
> It would be nice if I can maybe open the file in a new buffer, and
> when I'm done, just close the new buffer I opened. Is there an easy
> way to do this? Ctrl+w, followed by enter didn't seem to work, and
> neither did gF.

It sounds like you want "o" (lowercase-oh), used to open the file
under the cursor in a new window.

:help netrw-o

Though I agree that your Ctrl+W and gF are reasonable
expectations...I myself used them diminishingly for the 2-3
months it took me to finally wire my brain to use "o". :)

> Also, on a somewhat related note, is there a way to quickly save a
> buffer and then close it. :wq allows you to save and quit, but I'm a
> bit annoyed by having to do :w<enter>, :bd<enter>.

I don't know of any built-in single-command to do it. However,
you can either map a command to do it:

:nnoremap <f4> :w<cr>:bd<cr>

or you can fiddle with the 'bufhidden' option:

:set bufhidden=delete

and then just use ":wq" as normal.

-tim

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment