garybernhardt / selecta

A fuzzy text selector for files and anything else you need to select. Use it from vim, from the command line, or anywhere you can run a shell command.
MIT License
1.34k stars 81 forks source link

Add open vim buffer example #60

Closed michaelavila closed 9 years ago

michaelavila commented 9 years ago

There's probably a better way to do this, but I at least wanted to start the conversation. Here's what I have so far. The code is pretty self-explanatory and leverages the existing SelectaCommand. It works well so far.

Until you have a vim plugin I can use, I've started collecting these in my own: https://github.com/michaelavila/selecta.vim

I don't know if anyone else will find this valuable, but I use buffers and selecta heavily. I'm happy to have selecta to make the experience better.

garybernhardt commented 9 years ago

Do you find that buffers are still useful with Selecta? I never use any buffer management commands any more; I just use Selecta (on files) for everything.

For this PR specifically: I'm not sure that adding this example to the README clarifies anything extra beyond the existing examples.

michaelavila commented 9 years ago

The primary benefit is that selecting files restricts selecta to choose things that are under our current directory. I often have files or other documentation open in vim from other parts of my machine, which I can access through the buffer system. You can't do that with the basic file selecta. The other benefit is that when you're working on a project with a lot of files, the buffer list is easier to selecta from since it's what you've been recently working on.

Buffers are invaluable for these two reasons (IMHO)

michaelavila commented 9 years ago

The other benefit of this particular example (IMHO) is that it shows you how to selecta VIM objects instead of things available from the command line, but maybe that's not interesting (I had to figure it out myself).

Once I was able to selecta vim objects, I quickly added history for instance: https://github.com/michaelavila/selecta.vim/blob/master/plugin/selecta.vim#L34-L37

tybenz commented 9 years ago

The primary benefit is that selecting files restricts selecta to choose things that are under our current directory.

+1 on this. And I'm loving the plugin @michaelavila. Anytime I can get something into VIM with my plugin manager rather than copy+pasting from a README into my .vimrc is a win.

garybernhardt commented 9 years ago

OK, let's add it. I made a couple comments. Your selecta.vim should probably be moved into the repo at some point, too.

garybernhardt commented 9 years ago

Rebased and merged, thanks!