Autocomplete doesn't work for me for some reason, despite following all the install instructions.
krompus opened this issue · 3 comments
(yes, I put the stuff in my .bashrc)
Example: If I try to autocomplete $ vman ma
:
[krompus@creator ~]$ vman mabash: completion: function `_man' not found
[krompus@creator ~]$ vman mail/
It seems it's trying (and succeeding) to autocomplete from the pwd
, and not the man pages. Any ideas?
(This is a beautiful program by the way! Finally, I can have :set scrolloff=5
in man pages!)
For me the bash version only works if the complete ...
command comes after the declaration of vman()
.
However, it looks like you might have a separate issue. If _man
isn't found that means that you either don't have completion support for the normal man
command right now, or it's called something else. you can run type _man
to check if the function really is defined.
If it's not actually there, I'd imagine that you'll have to install the bash-completion
package. For example, this can be done on OS X through Homebrew:
brew install bash-completion
and make sure that you read the instructions in the caveats after installation.
None of that applies (complete ...
comes after vman()
, _man
exists, bash-completion
is already installed), I'm not sure what else I'd try. I don't use bash (in favor of zsh) personally anymore, so I've gotten a bit rusty.
Regardless of all this, the completion results in bash don't look like they cover everything (for example, vman ma
doesn't include man). I might have to look into why this is.
Hahaha, that's exactly the problem. I have bash-completion
installed, everything off that list is a-okay.
The problem was that I was trying to autocomplete man
, lol. Other autocompletions work.
I'll do some testing. Maybe it's something unique to certain letter strings, like ma
? Weird.
Thanks for your help and rapid response!
EDIT: wait, whaaaa? Now it autocompletes just fine. I didn't change anything.
....???
I'm switching to zsh soon anyways. :)
EDIT: wait, whaaaa? Now it autocompletes just fine. I didn't change anything.
As some completion functions are dynamically loaded in bash, _man is defined only if you first try to tab complete with man command. (https://stackoverflow.com/questions/15858271/bash-completion-completion-function-defined-the-first-time-a-command-is-invoke).
The obvious workaround could be to add "_completion_loader man" just before "complete -o default -o nospace -F _man vman" in your bash configuration file.
My vim-superman configuration lines in bash would be something like:
# Man pages with vman with bash completion
export PATH="$PATH:$HOME/.vim/path_to_vim_superman/vim-superman/bin"
_completion_loader man
complete -o default -o nospace -F _man vman