2

How do I set up a buffer switch like Alt-Tab on Windows:? It cycles through a list sorted by last access first? So if I pressed Alt+Tab, I'd get the last accessed buffer. If I pressed it again, I would go back to the first file. If I pressed Alt+(Tab,Tab) I would go the second to last access buffer. Unlike the existing Ctrl+6 in Vim, I wouldn't want unopened buffers to be a part of the list.

Any suggestions?

Matt Alexander
  • 767
  • 1
  • 13
  • 37

2 Answers2

1

LustyJuggler works almost exactly as you describe.

Hit <leader>b to open a list of buffers with the most recent first, type a couple of letters to narrow the list down to the one you want and finally <CR> to open it.

I personnaly use its sibling LustyExplorer which offers the same feature plus a similar one for the filesystem and a similarly designed "search in buffers" as well.

romainl
  • 22,554
  • 2
  • 49
  • 59
  • 1
    I ended up using LustyJuggler so I could recreate my familiar kaystrokes using [some mappings](https://github.com/mattalexx/dotfiles/commit/7c8514606b81d633ef8aad9819cee1b85e377e3e). It's not ``, ``, and ``, which is what I'm used to, but that's okay. This will soon become a part of my fingers. Thanks! – Matt Alexander Jun 02 '11 at 18:30
  • Vim is a world of its own. You'll find it's sometimes quite hard to apply your ancient habits and workflow. It'll pay if you do things the Vim way. – romainl Jun 02 '11 at 19:21
  • Yes, that's what I've found. – Matt Alexander Jun 03 '11 at 18:24
  • 1
    By the way, I've found an even better solution: [LustyJugglerAltTabMode](https://github.com/sjbach/lusty/blob/master/plugin/lusty-juggler.vim#L59). – Matt Alexander Jun 03 '11 at 18:27
  • @MattAlexander I almost missed this comment! By the way, here's a permalink: https://github.com/sjbach/lusty/blob/a9b501e76c458c0cc91cf59f6e2fab0e1abc06a3/plugin/lusty-juggler.vim#L107 – Andrew Keeton Aug 09 '19 at 17:20
0

I like the minibufexplorer plugin. It gives you a small list of open buffers at the top of a windows, that sort of looks like the tabbar in Firefox, and it allows you to close buffers (or at least remove them from the list).

It allows you to use ctrl-tab and shift-ctrl-tab to navigate backwards and forward through the list of tabs, if you want to. Not alt, though, but I guess you could make a map to do that yourself.

http://www.vim.org/scripts/script.php?script_id=159

AHM
  • 101
  • 1