Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I start vim from the directory of the project that particular MacVim window will be working on. From there I use NerdTree and Command-T to open buffers/tabs in the same window.


I do this too. How do you manage switching between open buffers, or closing one without closing the others? I don't have a good solution for the first, and for the latter I find I have to close nerdtree for :bw to work as expected.


Just to throw in another $0.02...

I use bufexplorer[1]. There's something about minbufexpl's list that seems unappealing to me when it spans multiple lines. I also have CTRL-j/CTRL-k mapped to :bnext/:bprev. As for closing a buffer, my main window generally has a single vertical split, so I have the following kludge:

    map <C-Q> :vert split<CR>:bnext<CR>:wincmd l<CR>:bdelete<CR>
This creates another vertical window temporarily, advances to the next buffer in that window, activates the window to the right (which still shows the buffer I'm trying to kill), and then deletes that buffer leaving me with two windows again. Amusingly, my older machines were slow enough to catch a glimpse of the third window, but it disappears too quickly to see on my new machine.

[1] http://vim.sourceforge.net/scripts/script.php?script_id=42

edit: described kludge a bit better


You realize that commandT also comes with a 'commandB' command that allows you to navigate open buffers?


hmm, just tried <cmd>B, :commandB, and :CommandB and none worked :/

I am using Janus, so maybe it overwrites this.

https://github.com/carlhuda/janus


I think the parent is mistaken.

I have been looking for the equivalent of CommandT for buffers for a while, and the closest I've found is this: http://www.vim.org/scripts/script.php?script_id=1890

Unfortunately it's fuzzy file matcher is nowhere near as useful as CommandT's, so you'll have to use them in conjunction.


  :help CommandT

  ...
                                                   *:CommandTBuffer*
  |:CommandTBuffer|Brings up the Command-T buffer window.
  This works exactly like the standard file window,
  except that the selection is limited to files that
  you already have open in buffers.
and then later...

  MAPPINGS                             *command-t-mappings*

  By default Command-T comes with only two mappings:

    <Leader>t     bring up the Command-T file window
    <Leader>b     bring up the Command-T buffer window

Note that this is only available since 1.1b which was released in March.


This one is great for both files and buffers: http://www.vim.org/scripts/script.php?script_id=1984 FuzzyFinder


I use minibufexpl[1] to list the open buffers at the top, and have the up/down arrows mapped to :bp/:bn

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


use :ls to list the open buffers. Then use :b<number> to switch between buffers.


cool, this is close to what I'd been doing but much faster -- I was typing out :buffer




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: