Vim script not loaded? - vim

When I work with some Python files, and run :set filetype? in Vim, I get filetype=python, so the file is recognized correctly as Python code.
I've downloaded this plugin: http://www.vim.org/scripts/script.php?script_id=1494
and put it in ftplugin folder, but its f/F keys bindings are not working, and running its :call ReFold() gives E117: Unknown Function indicating that the plugin hasn't been loaded.
Any troubleshooting tips on how to load the plugin?

Try removing this part at the top of the script:
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
And possibly moving the script to after/ftplugin directory (:help after-directory).
I think you have another python specific plugin that comes first at 'runtimepath' and defines b:did_ftplugin, which is OK, but this python script (python_editing.vim) shouldn't check for and define b:did_ftplugin since it doesn't implement the functionality of original plugin, it just extends it.
So the script is loaded, but does nothing. By running :script command without arguments one can check if some script is loaded at all.

Related

nvim finds the function but vim does not

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

Cannot load CoqIDE plugin for vim

I'm trying to use the CoqIDE for vim plugin I found on this page.
I put the coq_IDE.vim file in ~/.vim/ftplugin folder. My current .vimrc file is:
set showcmd
set number
imap hl <Esc>
filetype plugin on
But when I start vim CoqIDE doesn't load automatically (I see no change whatsoever compared to normal vim, so I don't think it did). And when I try to load it manually by the command :source coq_IDE.vim, I get the following error message:
E484: Can't open file coq_IDE.vim
What could be the source of this error?
Here are some additional information that might be relevant:
1) I am running Ubuntu 14.04.
2) I checked that :version in vim shows +perl.
2) I am running vim from terminal, not gvim.
3) I tried removing and reinstalling different versions of vim (vim, vim-gtk, vim-gnome)
4) The CoqIDE installation guide says that coqtop.opt should be accessible via the PATH variable. Since I'm not even sure what this means, this might be the problem here, but that seems unlikely. From what I understand vim is getting errors when trying to read coq_IDE.vim, so it's not even getting to the part where it's looking for coqtop.opt.
5) I have CoqIDE installed from Ubuntu Software Center.
6) With :echo &runtimepath I get: ~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
The instructions are bad.
Put the file in ~/.vim/plugin not ~/.vim/ftplugin
The file layout should look exactly like the file layout found in this mirror for the plugin. https://github.com/vim-scripts/CoqIDE. (Maybe take a look at pathogen or vundle,).
The reason the :source coq_IDE.vim fails is vim is looking for the file coq_IDE.vim in the current directory and it isn't there. Use the full path to file if you are going to source it manually. (You shouldn't need to though.)

Get ocamlmerlin autocomplete in vim

I'm trying to get autocompletion for OCaml. I like using Vim and I found this plugin:
https://github.com/the-lambda-church/merlin
I installed it using OPAM and added the required lines to load it to my .vimrc
I made sure that OPAM bin folder (which contains ocamlmerlin) is in my .profile file and
checked that I can access it from the terminal and for vim I printed the PATH variable using "Ctrl-r =$PATH" and it shows that it contains OPAM bin folder.
It still doesn't work, I have no clue what else to do to make it work. I get syntax highlighting but that exists without merlin anyway. I want autocompletion to work.
If I press Ctrl-N to show completion suggestion I get "normal" vim completion which is basically just a list of words that are mentioned in the document.
Checking the startup log file, I can see that Vim did indeed load merlin:
chdir(/home/incraved/.opam/system/share/ocamlmerlin/vim/plugin)
fchdir() to previous dir
sourcing "/home/incraved/.opam/system/share/ocamlmerlin/vim/plugin/merlin.vim"
finished sourcing /home/incraved/.opam/system/share/ocamlmerlin/vim/plugin/merlin.vim
Searching for "/home/incraved/.opam/system/share/ocamlmerlin/vimbufsync/plugin/**/*.vim"
Any ideas?
Ctrl-N is the default completion; its sources are configured by the 'complete' option, but cannot include custom sources.
The Merlin plugin uses Omni completion, which is triggered with Ctrl-X Ctrl-O; see :help compl-omni.

gVim 7.3 in fullscreen mode

I'm using the script to open gVim in fullscreen downloaded from here: http://www.vim.org/scripts/script.php?script_id=2596.
I've also added this line to the startup settings:
:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)
When running gVim with this setting, I get the following error:
Error detected while processing _virmc:
E364: Library call failed for "ToggleFullScreen()"
Is there anything else I need to do with the files from that script? If I need to compile it somehow, would like someone to guide me through that process as I'm fairly new to Vim. Thanks!
Edit: I'm running Windows 7
I guess you mean ~/.vimrc or ~/.gvimrc by "startup settings". When that is executed, the GUI isn't initialized yet. Try delaying the execution with an autocmd:
:autocmd GUIEnter * call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)
It doesn't seem to be working if you place that call line in your vimrc. It should be called after Vim has finished loading. I suggest using that mapping from the readme:
map <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
It worked for me.
I had the same problem when I was install this script through Vundle.
It's solved the problem:
Copy the DLL to the folder where GVIM.EXE is located.
An alternative to copying the gvimfullscreen.dll to the executable directory is to specify the file path, like this:
call libcallnr(expand("$VIM") . "/bundle/gvimfullscreen_win32/gvimfullscreen.dll", "ToggleFullScreen", 0)
In this example, I'm using $VIM and the bundle directory, but you can change this to a full path, or use another variable/path that works better for you.
This isn't a direct answer, but after searching for a solution for quite a while, I've decided that the prettiest way to run Vim on Windows is via Cygwin, via the (bundled) mintty terminal. It has a genuine full screen and even transparencies!

compiler plugins not loaded

i tried to use this python compiler plugin to be able to "compile" a py script and see the errors in qucikfix windows and jump directly to the linenumers.
http://www.vim.org/scripts/script.php?script_id=1439
i placed it in /compiler/python.vim
but: the script is not loaded when i open a python file. even :filetype detect doesnt help.
(according to :scriptnames)
i also tried to put the stuff into _vimrc. but it is overwritten by some other stuff thats useless. i dont know where it comes from i searched all plugin directories but there is no plugin that does set makeprg and errorformat!
im lost. plz help.
thanks!
Compiler-plugins are never loaded automatically. You'll have to load it explicitly with :compiler python.
you could add this to your filetype.vim file:
autocmd! BufRead,BufNewFile *.py compiler python

Resources