When using the args list, Vim adds those arglist files to the buffer list.
Once I'm finished with the argslist, I then have many unwanted argslist files in the bufferlist.
They don't have a contiguous number sequence, so I cant just say, :11,24 bd.
Is it possible to remove these files from the bufferlist?, possibly using the same pattern I used to create the arglist? e.g.

:bd tests/unit/**/*.js

Use :argdo:

:argdo bd

:argdo {cmd} will run command, {cmd}, on every item in the argslist. In this case you use :bdelete as the command to unload the buffer and delete it from the buffer list.

For more help see: :h :argdo

  • thanks for this. I think you have a typo - argodo? This works for the question - as I phrased it so I guess I should accept but I dont know if it would help the community because I just realised deleting the entire arglist would be too indiscriminate. any files you were actually editing (as opposed to arglist operations) would also be closed by this Jan 5 '16 at 0:09
  • In general I find "cleaning up" the buffer list for the sake of tidiness to be a bit silly. It doesn't really matter how many buffers you have open (as long as they are small). Using :b with a partial name or a fuzzy finder to switch between buffers often removes the need to view the buffer list via :ls. I often have 50+ buffers open at a time without concern. Of course, your workflow may have different needs. Jan 5 '16 at 0:16
  • wow, that makes sense. It would be liberating to stop maintaining the bufferlist! the main reason I have been doing it is because when I open a buffer by :ls , :b # I can control how the placement of windows AND the files in them. my fuzzy finder - ctrlp - and project explorer - nerdtree - dont use the buffer workflow. So i needed the bufferlist because it does. but they do provide the ability e.g. ctrlp, ctrl-o, r does open a buffer in the current window. and nerdtree does have a buffer explorer Jan 5 '16 at 0:51
  • Here is a piece of advice: don't mix a plugin-based workflow with a defaults-based workflow. Plugins tend to operate within the boundaries of their design and generally don't play very well with default commands.
    – romainl
    Jan 5 '16 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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