Vim + racer produce "Error "E117: Unknown function: racer#RacerComplete" - vim

I want to have vim auto-completion for rust. So I installed racer globally and I got the source of rust by running rustup component add rust-src.
I have the plugin in .vim/bundle/rust_racer/plugin/rust_racer.vim, downloaded from the ftplugin folder from the vim-racer plugin repo.
And finally - in .vimrc I have:
set runtimepath^=~/.vim/bundle/rust_racer
" Set rust autocompletion tool "racer" ..
set hidden
let g:racer_cmd = "/home/petar/.cargo/bin/racer"
let $RUST_SRC_PATH="/home/petar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src"
But when I open a rs file and try Ctrl+x + Ctrl+o to get the auto-completion - I get this error:
Error "E117: Unknown function: racer#RacerComplete
Any ideas?

Apparently I had to download the vim file from the autoload folder of the repo into an autoload folder inside the plugin folder (in my case - .vim/bundle/rust_racer/autoload) - and now it it works.
(Don't know why they didn't write this in the readme ...)

Related

How standalone installation of vim plugin can be done in Unix

At my work I want to use vim plugins but I cannot install plugins via git hub command which are mentioned in forums. I need to install plugins manually by copying required files but it does not work. Can someone let me know how to install vim plugins manually in Linux environment .
Here are the steps i have done:
Downloaded github.com/VundleVim/Vundle.vim
Created ~/.vim/bundle, ~/.vim/plugin directories
Copied vundle.vim into ~/.vim/bundle/vundle.vim
I have copied below message in .vimrc file
set rtp+=~/.vim/bundle/vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'file:/nfs/iind/home/bvedula/.vim/plugin'
call vundle#end() " required
filetype plugin indent on " required
When i run vim in my xterm i get following error:
Error detected while processing ~/.vimrc,
E117: Unknown function: vundle#begin,
E492: Not an editor command: Plugin 'VundleVim/Vundle.vim',
E492: Not an editor command: Plugin 'file:~/.vim/plugin
The error says, that vundle#begin is unknown, means that Vundle.vim was not even loaded. Looks like you have vundle.vim instead of Vundle.vim (with uppercase first letter) in the set rtp+=~/.vim/bundle/vundle.vim.
But anyway Vundle is not a good choice if you don't have access to the Internet.
Instead you can use pathogen which doesn't try to download plugins and only loads them:
any plugins you wish to install can be extracted to a subdirectory
under ~/.vim/bundle, and they will be added to the 'runtimepath'

Install vim-go in linux?

I would best be described as a dabbler at this point in linux/vim. I'm trying to get started with go. Trying to install the vim-go plugin and i'm having issues. Following the following post.
I added the following to the end of my ~/.bashrc file:
export GOPATH=~/gocode
export PATH=$PATH:$GOPATH/bin
and created the following directory ~/gocode
So i created my ~/.vim/bundle & ~/.vim/autoload directories. I downloaded pathogen.vim to the autoload directory. I cloned the github repository for vim-go into the bundle directory which created a vim-go directory.
I created my ~/.vimrc file and added the following:
call pathogen#infect()
syntax enable
filetype plugin on
set number
let g:go_disable_autoinstall = 0
I executed the following from the vim console (which worked after installing Hg):
:GoInstallBinaries
FYI, i don't use vundle and to be honest don't even know what it is :).
So far the plugin doesn't seem to be working. When i type :help vim-go i get the following error: E149: Sorry, no help for vim-go
What am i do
Using the manual install method (copying vim-go/ to ~/.vim) I was able to get it working but only once I had the following ~/.vimrc file, and of course the Go binaries installed as per the instructions.
set nocompatible
set shell=/bin/sh
syntax on
filetype plugin on
let g:go_disable_autoinstall = 0
This was done on an Ubuntu 14.04 desktop with no other vim plugins or prior ~/.vim directory or ~/.vimrc. Frankly the official install instructions and many of the tutorials out there assume to much to be useful on a fresh install of Ubuntu.
However "help vim-go" was still not working for me. Tried the following command from within the ~/.vim directory and got that working: Vim helptag generation
solution put that in you .vimrc :
set nocompatible
execute pathogen#infect()
syntax on
filetype on
filetype plugin on
filetype plugin indent on
go in your .zshrc ou .bashrc and put :
export GOPATH="$HOME/gocode/"
export PATH=$PATH:~/gocode/bin
and in terminal do :
source .zshrc
or
source .bashrc
and now go to
cd ~/.vim/bundle
and do if youuse pathogen :
git clone https://github.com/fatih/vim-go.git
in vim do :
:GoInstallBinaries
test one of this commands :
:GoFmt
:GoLint

unable to use cscope multi key stroke via vim editor

I am using VIM 7.0 on RHEL release 5.4, and downloaded cscope plugin from: http://cscope.sourceforge.net/cscope_maps.vim
and copied it to path(one instance at a time): ~/.vim/plugin/cscope_maps.vim & /usr/share/vim/vim70/autoload
and generated cscope -qbR from root dir of source files, & opening *.C files from same dir.
According to this(point 5) & cscope_maps.vim, I should be able to do keyword search by multiple keystroke: CTRL-\ <option> or CTRL-# <option> by placing the cursor under the keyword as we do for ctags. But I am able to access the cscope keyword search only through the vim's command line argument (ie., :cs f d or :cs f c) and not with multiple key stroke shortcut.
I've also tried pasting all the contents of cscope_maps.vim to ~/.vimrc, but it didn't help
Is there something I am doing wrong/ any other way to make it work?
As described in the plugin's documentation, copy the plugin to
~/.vim/plugin/cscope_maps.vim
The autoload directory you've chosen is wrong, this is for plugins' on-demand functionality.
Also, /usr/share/vim/vim70/ is owned by the default Vim package, don't touch anything there (in general), or you'll run into problems when reinstalling / upgrading packages! If you do need to have a system-wide plugin, check :help runtimepath and find / add a proper location that you own on the system.
Probably your code base is other then .c files. I was facing same issue as my code base includes c and c++ both. I was trying with c++ functions and was facing same issue you mentioned.
Hint- Build cscope data base with all required files.
Probably, you are missing the CSCOPE_DB environment variable - i.e, it should point to the valid cscope.out file
To check, once you are in vim, run :echo $CSCOPE_DB, mine shows:
/home/me/views/myrepo/cscope.out
I had the same problem with cscope and Vim 7.4. I could solve it in Arch uncommenting in cscope_maps.vim the bellow lines:
set timeoutlen=4000
set ttimeout
BTW I followed this tutorial to install cscope vim plugin on Arch:
https://wiki.archlinux.org/index.php/vim#cscope

Can't search plugin in local but on the net when install Plugin with Vundle (configure Vim)

I have successfully installed the Vundle for vim
With the help-docs, i know that using command "PluginInstall **" can install this plugin
i have already download some plugins, but when i type :PluginInstall **
to install ** , it's not install ** from local but again search on the net.
So, how can i specify the path should this command ":PluginInstall" install plugin from where i want.
=======================for example:
:PluginSearch taglist
it shows
Plugin 'taglist-plus'
Plugin 'taglist.vim'
my local file is taglist_46 which download from www.vim.org/script.php?script_id=273‎
but it doesn't show up in result
First, you should add the follow settings in your vimrc:
Bundle 'taglist.vim'
And then, run :BundleInstall, Vundle will download the plugin automatically. (automatic is the important reason to using it)
By the way, Vundle using git download the plugin, it should be installed.
If you don't have git (In windows for example), you can download by manually of cause. Just move the taglist folder to the right path. It was set by rpt+=<the right path>. For example, my setting is:
if has('win32') || has('win64')
set rtp+=$VIM/bundle/vundle
call vundle#rc('$VIM/bundle')
else
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
endif
Means the right path in Windows should be $VIM/bundle/vundle, and ~/.vim/bundle/vundle in Linux

Pathogen not generating help tags Vim Windows

I if you have already tried solutions like this one Vim + Pathogen not loading help docs where you only add filetype off before calling pathogen infect and you still CANNOT generate the help tags, this hint might help you.
Pathogen is searching for the bundle folder under ~/.vim/bundle, and generates the helptags for every doc folder, where ~ is your runtime path. On Windows the default runtime path for vim is ~/Vim/vim73 which somehow confuses Pathogen, if you change the runtime path to the previous folder ~/Vim everything is fixed!
The runtime path variable in Vim is changed using the command:
:let $VIMRUNTIME = "puth_path_here/Vim"
Type :h $VIMRUNTIME in Vim for a more detailed explanation.

Resources