Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

According to "Practical Vim" and the Vim help the shortcut <C-^> is supposed to return me to the edited file. I enter netrw using :E.

As an experiment I tried remapping the default shortcut as follows:

:nnoremap <C-y> <C-^>

Once I use <C-y> I get feedback:

E23: No alternate file

... but I don't get back to the edited buffer.

How can I return to the edited buffer, or for that matter, how can I debug this issue to find out what prevents me from returning to it according to the documented procedure?

NB: I am setting the mapping on the command prompt, not in .vimrc.

share|improve this question
up vote 3 down vote accepted

The alternate file is, practically speaking, the buffer that was open previously in the same window:

:e file1
:e file2
<C-^> shows file1
<C-^> shows file2
<C-^> shows file1

<C-^> is used to toggle quickly between two buffers in the same window.

You may not have an "alternate file" to jump to (probably a netrw thing which doesn't really makes sense to me) and <C-^> is of no use here.

Instead, use :bd which deletes the current buffer (netrw) and puts you back in the previous buffer. Note that you can use :Rex to get back the latest netrw window at any time.

If you don't open files (you use netrw to look around for some kind of info), your workflow could be:

if you want to start a new exploration,
if you want to explore from where you were,

However, you should read :h netrw because it has more commands that would probably help you a lot: :Hex[plore] (opens netrw in an horizontally split window), :Vex[plore] (opens netrw in a vertically split window), :Tex[plore] (opens netrw in a new tab)… These commands will let you go on your safari while keeping some "state".

As an alternative, <C-o> and <C-i> are two handy shortcuts that let you go up and down the jumplist. In your situation, <C-o> may be the quickest way to get back to the previous buffer.

share|improve this answer
excellent answer. :bd is exactly what I was looking for in this case. The other commands are nice in a big window. Since I use tmux to split my workspace, the screen estate Vim gets is actually rather small. – 0xC0000022L Feb 16 '13 at 17:14

I don't see how the mapping has anything to do with the E23; you should get the same error with the original <C-^> command. Probably, no alternate file has been set yet; some plugins also explicitly use the :keepalt command to avoid recording the buffer change.

You can check the alternate file name via

:echo expand('#')

or, in the output of :ls, look for the line that has a # sigil.

share|improve this answer
thanks for taking the time to answer. Alas, it's not helpful. When I use :ls I see the edited file while in netrw listed with #. However, that doesn't allow me to jump back - which is the essence of my question. I tried the remapping mostly because ^ is "harder" to synthesize on an US-English keyboard that a plain letter. – 0xC0000022L Feb 16 '13 at 17:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.