:e-like completion while typing @cd command #346

Closed
OliverUv opened this Issue Jan 13, 2013 · 5 comments

Comments

Projects
None yet
2 participants

Huge thanks for an awesome plugin!

I use @cd when I want to reference code from some other project. After submitting the @cd command things work perfectly, but writing the @cd command is cumbersome because there is no completion at all.

I would be very grateful there was an option to turn on :e-like completion (or actually preferably fuzzy completion of just the items directly under the currently typed directory) while the @cd command is being typed.

Another option would be to enable the possibility to activate completions, as completion plugins like CtrlP have very effective filename completion. This would work if I could do something like this:

let g:ctrlp_prompt_mappings = {
    'neocomplcache#manual_filename_complete()': ['<expr><c-i>'],
    ... }
Owner

kien commented Jan 13, 2013

You can use <tab> to autocomplete the directory names under the cwd. Try it and see if it's what you're looking for.

For example, type @cd subd<tab> where subd is from subdirectory.

Thanks for the quick response! It isn't what I'm looking for though. The point is that I want quick access to non-subdirectories. I'm looking to do things like @cd ~/projects/web/some_other_project/<cr> (using some form of autocompletion), and then continue on as normal, even if I'm originally working from ~/scripts/docs/ or some other totally unrelated directory.

Owner

kien commented Jan 13, 2013

Actually, ctrlp isn't a word-completion plugin, it's a finder. I'll have to recreate the e-like or cd-like completion inside the prompt in some way. The basic completion with <tab> is meant for directories under the cwd, which is ctrlp's main concern.

With that said, I'll still look into implementing this and will add it if it's simple enough. But if it turns out to be more trouble than it's worth, then I'll probably drop it.

For the time being, you can do a @cd ~, @cd $HOME, or @cd / before doing the @cd subd<tab>.

@cd ~ takes forever :) And though it isn't a word completion plugin, finding files sometimes gets easier with completion! So I really appreciate you taking the time to do this. 👍

If you decide to drop it, look into letting people use insert-mode functionality while typing commands - if I can activate other completion plugins after @cd, I can easily use one of those to complete paths for me. I'm sure this would enable all sorts of other extensibility to CtrlP - though implementation could be troublesome. Again, it is enough if I could do something like

let g:ctrlp_prompt_mappings = {
    'neocomplcache#manual_filename_complete()': ['<expr><c-i>'],
    ... }

which would essentially be the same as imap <expr><c-i> :call neocomplcache#manual_filename_complete()<cr> for normal vim. The keybindings seem to support that in the way they are written already, but it didn't work for me.

Owner

kien commented Jan 14, 2013

Well, the difficult part here is ctrlp operates in Normal mode. The prompt isn't actually the command line nor it's in Insert mode where word-completion is readily available.

@kien kien added a commit that referenced this issue Mar 28, 2013

@kien kien Non-subdir completion for in-prompt cd
Refs #346
76f4f42

kien closed this Mar 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment