Oni: ctrl-6 does not switch to alternate file

Created on 31 Mar 2018  路  8Comments  路  Source: onivim/oni

http://vimdoc.sourceforge.net/htmldoc/editing.html#CTRL-^

In vim proper (and I also tested in neovim) when you have multiple buffers open you can switch to the last one you had open with ctrl-6. This does not seem to work in ONI. I've even tried setting:

    "tabs.mode": "native"

How are people switching buffers without the use of the mouse in ONI?

Most helpful comment

ctrl-6 only works by accident in some terminals. The actual builtin mapping is <C-^>.

All 8 comments

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

Hi, there is some discussion about this going on in #1194.

Perhaps you could add some extra context on that issue?
I've attempted to repro this as follows:

  • :e file1
  • :e file2
  • <ctrl-6> to try swap back to file1.

Does that seem sane? It doesn't work for me on Oni/Neovim/Neovim-Qt, so I'm thinking its either a keyboard thing or a Windows thing.

That said, using <Ctrl+Shift+6> does work for me, so I'm a little confused.

ctrl-6 only works by accident in some terminals. The actual builtin mapping is <C-^>.

I've attempted to repro this as follows:

:e file1
:e file2
to try swap back to file1.
Does that seem sane?

Yes, exactly.

It doesn't work for me on Oni/Neovim/Neovim-Qt, so I'm thinking its either a keyboard thing or a Windows thing.

It works for me with both vim and neovim, just not oni. I do not use windows, I use OS X and Arch Linux.

That said, using does work for me, so I'm a little confused.

Yes, that seems to work for me as well.

ctrl-6 only works by accident in some terminals. The actual builtin mapping is

That's not true. According to the VIM documentation both are valid:

http://vimdoc.sourceforge.net/htmldoc/editing.html#CTRL-^

*CTRL-^* *CTRL-6* Edit the alternate file.

This has worked for me for well over a decade everywhere I've ever used vim. Heck it even works in emacs with evil-mode everywhere I've used emacs.

That's not true. According to the VIM documentation both are valid

That doesn't contradict what I said. ctrl-6 happens to send ctrl-^ on some terminals. You may ask why ctrl-5 (or any other number besides 6) doesn't work (if you map it to something).

In Terminal.app on macOS 10.13, ctrl-6 produces nothing (at least on my machine).

Anyways, the point of my previous comment is that this is something Oni (and other implementations, such as evil-mode) would need to map explicitly (due to user expectation).

In fact, even Vim itself does not actually support ctrl-6 as a builtin mapping. You can try it:

vim -N -u NONE foo bar
:call feedkeys("\<c-6>")

That does nothing. Whereas ctrl-^ does switch the buffer:

:call feedkeys("\<c-^>")

The command is ctrl-^. However that reaches Vim (e.g., by a terminal sending ctrl-^ when you press ctrl-6 on your keyboard) does not matter to Vim.

In fact, even Vim itself does not actually support ctrl-6 as a builtin mapping.

I don't know, maybe I have special machines but on both OS X and and Arch Linux when I run vim proper without any configuration (vim -u NONE) ctrl-6 will switch back to previous buffer.

However I will concede. I have found that the following configuration makes ONI work when I set it in my neovim config (~/.config/nvim/init.vim) which I have enabled in the oni config with "oni.loadInitVim": true.

noremap <C-6> <C-^>

@socketwiz Take a look at the referenced issue by @CrossR, I was confused as surprised too.

Was this page helpful?
0 / 5 - 0 ratings