I use the same .vimrc file on lots of systems. I'd like to bypass vundle installing some modules that I know won't work if 'if_lua' is not present.
Is there a vim script way of conditionally doing
Bundle 'Shougo/neocomplete.vim'
only if vim was compiled with lua to avoid the start up error:
$ vim myprogram.c
neocomplete does not work this version of Vim.
It requires Vim 7.3.885 or above and "if_lua" enabled Vim.
Press ENTER or type command to continue
thx
if has('lua')
Bundle 'Shougo/neocomplete.vim'
end
Related
I am using a vim/nvim plugin asyncrun that enables an API call that works fine in nvim if I implement it in ~/.config/nvim/init.vim using a line:
call asyncrun#run("", "cwd", "firefox")
Now this same line does not work for vim if I try to use it inside ~/.vimrc. I always get a warning:
Unknown finction: asyncrun#run
What needs to be changed in order for this to also work for vim?
Following the #doopNudles comment I also clarify that vim plugin is manually installed in the folder ~/.vim/pack/my-plugins/start/vim-asyncrun/asyncrun.vim/plugin/asyncrun.vim. I install all my vim plugins the same way (using the vim v8 native ability to detect plugins).
The problem was that ~/.vim/pack/my-plugins/start/vim-asyncrun/asyncrun.vim/plugin/asyncrun.vim has one extra folder!
It works if I delete the extra folder asyncrun.vim like this ~/.vim/pack/my-plugins/start/vim-asyncrun/plugin/asyncrun.vim
I recently installed vim-go using pathogen, but the autocompletion feature is not working. If I am using it only shows commands I've already used.
My .vimrc has
filetype plugin on
" Enable autocompletion
set omnifunc=syntaxcomplete#Complete
" Select keyword as you type
:set completeopt=longest,menuone
Do I need more than just this plugin? The other feature I have tested so far are working (:GoRun, syntax highlighting).
This is on a Ubuntu machine.
Are you typing C-X C-O to open the autocompletation window? This works fine for me.
On the other hand, if you want to get real-time completion (completion by type) install the following plugins YCM or neocomplete
The syntaxcomplete#Complete ships with Vim, not the Go filetype plugin, and it has very limited capabilities (basically, just offering the language's keywords). No wonder you're disappointed.
The ftplugin/go.vim file sets the correct, custom completion of the vim-go plugin:
setlocal omnifunc=go#complete#Complete
So, just ensure that the 'filetype' setting is correct (go), and that you don't have any additional configuration that overrides the plugin's.
:verbose setlocal omnifunc?
can tell you.
If none of these suggestions solves your problem, try killing gocode from a terminal:
gocode exit (or killall gocode it that fails)
gocode -s -debug
In case of startup failure due to a lingering unix socket, simply remove it and try again. Once everything is working, you can terminate the debug enabled gocode process (the plugin will autostart as needed)
This is what worked for me. default gocode pkg seems to be no longer maitained. so update it with the one below.
my go and vim versions:
VIM - Vi IMproved 8.2
go version go1.16.4
follow the steps below:
gocode exit
go get -u github.com/mdempsky/gocode
run gocode in debug mode
gocode -s -debug
try the autocomplete.(vim-go C+X C+O)
viola! you should see the list like so:
I'm using Vim/Cream on Win7 with the Vim binaries provided with Cream (v7.3.107), and have installed Vundle, and the plugins work fine after I run :BundleInstall. But after exiting and restarting, the plugins don't work until I run BundleInstall again. Is this normal? I thought BundleInstall was a one-time command (excepting when used for updates). Here's an excerpt of what I have in my vimrc (actually cream-user.vim, which is what Cream prefers):
set nocompatible
filetype off
set runtimepath+=$HOME/vimfiles/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" Your bundles go here:
"
" ORIGINAL REPOS ON GITHUB
Bundle '907th/vim-auto-save'
.
However, when I run :AutoSaveToggle (a vim-auto-save command), I get the following error:
E492: Not an editor command: AutoSaveToggle
.
The cream-user.vim file is being invoked (it's listed in scriptnames):
83: C:\Users\<MyUserName>\.cream\cream-user.vim
[...]
85: C:\Users\<MyUserName>\.vim\bundle\vundle\autoload\vundle.vim
86: C:\Users\<MyUserName>\.vim\bundle\vundle\autoload\vundle\config.vim
.
...and Vundle itself is installed, as its commands work, notably :BundleList, which lists vim-auto-save among the installed bundles:
" My Bundles
Bundle 'gmarik/vundle'
Bundle '907th/vim-auto-save'
After I re-run BundleInstall, the plugins start working, and I do notice scriptnames now includes the extra files:
125: C:\Users\<MyUserName>\.vim\bundle\vundle\autoload\vundle\installer.vim
126: C:\Users\<MyUserName>\.vim\bundle\vundle\autoload\vundle\scripts.vim
127: C:\Users\<MyUserName>\.vim\bundle\vim-auto-save\plugin\AutoSave.vim
Putting :BundleInstall in the .vimrc doesn't look like the right move either, as it opens a buffer (can be worked around, but still...). I'm a brand new to Vim so I'm not sure what's wrong, probably something simple on my end, like my not being clear on how to appropriately invoke vundle. Any ideas on how to fix this?
First: You're right, :BundleInstall is not required on every launch. I guess the behavior you're seeing has to do with the Cream customizations; it probably messes with 'runtimepath' itself, and therefore interferes with Vundle.
If you just chose Cream for an easy install of Vim (though your 7.3.107 is quite dated already), there's also a "Vim-only" installer. Also, a Vim 7.4 installer is available from http://www.vim.org/download.php.
In case you do want Cream (wouldn't recommend that; especially if you're into programming / customizing Vim with plugins), I'd open an issue with the Vundle project, asking for help / support of Cream.
I had a similar problem with MacVim. The problem for me was that I didn't follow the instructions closely enough. I just assumed that I could just put the Vundle lines in my .gvimrc. This was WRONG! The solution, as per the instructions, was to place the lines in the .vimrc file. The order of operations matters, and it's possible this matters for Cream.
I found a solution to this problem in this bug report: https://github.com/gmarik/Vundle.vim/issues/430
At the end of your cream-user.vim file, add:
call vundle#config#require(g:bundles)
This causes the plugins to be loaded without showing the Vundle\Installer buffer at startup.
Mac OSX 10.7, Vim 7.3
I have installed Vundle for Vim, and I have included these lines in my ~/.vimrc:
Bundle "gmarik/vundle"
Bundle "pangloss/vim-javascript"
Bundle "https://github.com/digitaltoad/vim-jade.git"
I then run (in Vim): :BundleInstall!, and vim gives an agreeable Done! without mentioning any errors.
Javascript files are highlighted just fine. But when I open a jade file (express/views/index.jade), I don't get any color highlighting love.
What am I missing?
For the new version of Vundle, add this to your .vimrc:
Plugin 'digitaltoad/vim-jade'
and run
:PluginInstall
that works for me.
Just use the name of the repository
Bundle 'digitaltoad/vim-jade'
Then
$vim +BundleInstall! +BundleClean +q
Reload vim. Just worked for me.
I plan to switch to vim 7.3 in the next days on my windows box - linux will soon follow. I also plan to switch my vim setup and let pathogen handle my plugins.
I've googled but not yet found a solution how to handle plugins using vimball technique for setup. Any hints?
You are looking for :UseVimball [path]
Open the vimball up with vim. Instead of sourcing it with :so % do
$ vim somthing.vba
:!mkdir ~/.vim/bundle/bundle-dir-name-here
:UseVimball ~/.vim/bundle/bundle-dir-name-here
Note you will have to make sure the path exists before you execute this command.
:h :UseVimball
You can try vim-addon-manager: it is able to put every plugin in a separate directory and correctly handles Vimball.