tern_for_vim
tern_for_vim copied to clipboard
autocomplete not working out of box
I have installed vim on MacOSX, and browsed through issues here + looked at docs + watched some videos on Tern for Vim, but autocomplete will not work for me at all.
Update: having some strange behavior where C-X C-O does nothing, but C-n will open autocomplete suggestion box that is non-intelligent (aka var is the first suggestion, followed by basically anything I have defined in my app). Which is also strange because C-n is mapped to toggle nerd tree (but not in insert mode, I guess that's why it works)
I have followed http://vim.wikia.com/wiki/Omni_completion reco of setting
set omnifunc=syntaxcomplete#Complete
and added recommended vimrc settings
let g:term_map_keys=1
let g:term_show_argument_hints="on_hold"
I have also tried
set omnifunc=syntaxcomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
I don't have any remaps, that I can tell, that would break Ctrl + x, Ctrl + C bindings (my vimrc is available). I did try remapping to C-space as some suggest but still nothing.
Am I missing something, like maybe I need to install ctags or maybe there is a conflicting setting in my vimrc? The :help tern docs show that if I run into problems with autocomplete, I can try :set noshowmode but this also has not helped.
Not sure if it helps any to see my vim info, but will post here in case:
➜ dotvim git:(master) ✗ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 24 2014 19:59:09)
MacOS X (unix) version
Included patches: 1-488
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent -gettext -mzscheme +textobjects
-clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra -toolbar
+cmdline_compl +insert_expand +perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak -python +viminfo
+cscope +lispindent +python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua +rightleft +windows
+diff +menu +ruby +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
+emacs_tags -mouseshape -sniff -xsmp
+eval +mouse_dec +startuptime -xterm_clipboard
+ex_extra -mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -F/usr/local/Frameworks -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.9 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L. -L/usr/local/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -o vim -lm -lncurses -liconv -framework Cocoa -fstack-protector -L/usr/local/lib -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -L/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/config-3.4m -lpython3.4m -framework CoreFoundation -lruby.2.0.0 -lobjc
I wonder if maybe this has something to do with the fact that I have ExuberantCtags installed (via homebrew) for used with Tagbar, and I have also installed https://github.com/ramitos/jsctags - it looks like possibly I am getting "dumb" ExuberantCtags (not very good with JavaScript)
Another completion module might well be the problem. Try disabling that and see if it helps. I am, unfortunately, not very knowledgeable about Vim internals, and have no idea how the preferred completion module is determined. Load order, maybe?
@netpoetica might be late to the pic, but I have these set and working on Yosemite + Vim/MacVim.
set omnifunc=syntaxcomplete#Complete let g:tern_map_keys=1 let g:tern_show_argument_hints="on_hold"
note the difference in g:tern_.. as opposed to g:term_... you have in your example. Also make sure you have a .tern-project file in place as well. Hope it helps...
@fungl164 oiiiii! I can't believe I had written "term". It's such a silly mistake that I don't think my brain would process that I could have possibly made it :-) good catch, and thank you! I am still not having a lot of luck understanding what this plugin is actually supposed to be doing. I would love to see a video from someone showing what it is they are expecting Vim to do exactly with tern_for_vim and autocomplete. I don't think my expectations are matching what is actually provided
@netpoetica Check these out...
https://www.youtube.com/watch?v=kDdkfHWqVU0 https://www.youtube.com/watch?v=TIE9ZOqlvFo
you should be getting similar results as you would get from any other ide or code editor that uses ternjs in the background for js autocompletion...
Yea I don't seem to be having any luck either. Did you ever get it working or just give up? This is depressing lol...
No luck here, either.