I use macvim with YouCompleteMe (YCM), which I recently updated and recompiled. I followed the YCM instructions for OSX. I'm also using iterm2, tmux and zsh, all of which are installed with brew and updated.
YCM autocompletion of variable names and shell functions that are defined in the shell script itself work as intended.
However, with my current setup, YCM will not autocomplete variable names and shell functions from files sourced with source
in this shell script.
I have verified that files were sourced correctly, because the script functions properly.
All files sourced are in the same directory as the sourcing script, and are sourced with relative pathnames with slashes. One file, init.sh
, has no #!
and contains only variables. The second, functions.sh
has a #!
(which isn't really necessary for my use case) and function definitions. No variables are used in specifying the sourced files. So:
source "./init.sh"
source "./functions.sh"
I've made sure to source ~/.vimrc
and restart the YCM server after any changes, and verify that YCM logs in my vim session contain no errors, after any change to my files.
How can I get YCM to autocomplete these items?
ctags
program and usectags -R .
at the top level of your project, it will find all source files in it and create a pretty large file namedtags
that serves as index to where things are defined. Note that Vim has native support for tag files, for example you can use<C-]>
(Ctrl + ] -- the close bracket) to jump to definition of the term under the cursor.ctags
program and vim plugin like you mentioned. I look forward to asking more questions, I'm pretty set on making vim into my IDE. thanks again!