Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. Join them; it only takes a minute:

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

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
share|improve this question
up vote 6 down vote accepted

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

share|improve this answer
    
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 – the_velour_fog Jan 5 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. – Peter Rincker Jan 5 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 – the_velour_fog Jan 5 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 at 8:34

Your Answer

 
discard

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.