How can I debug a Vim plugin not being loaded? - vim

I'm trying to use the Vim snipMate plugin, and I've installed it as it directs, but when I press tab nothing happens.
How can I debug this? Are there log files Vim makes when it tries to load stuff?
How can I see what plugins its loaded correctly?
I've tried :sni<tab> to see if there's anything called snipsomething installed but nothing completes.
In the installation tutorial it doesn't mention adding anything into my vimrc but I guess it finds the /plugin/ dir automatically?
I'm running on Windows and Unix and I have the same profile with the same problem.
Other plugins like NerdTree are loading OK.
Update: Following another question, I've tried :inoremap and :snoremap and the <Tab> entry mentioning TriggerSnippet() is there:
e.g.
s <Tab> * <Esc>i <Right><C-R>=TriggerSnippet()<CR>
Does this mean it's enabled?

:verbose imap <tab>
will tell you what is bound to <tab>
:scriptnames will tell you what scripts were loaded.

You can insert echo "Loaded so far" and the like inside the plugin code - the text will be displayed in the bottom line if the echo is executed. Debugging by printf :) Crude, but simple and works.
Also: plugin is loaded automagically. plugins is not.

It looks like I had something dodgy in C:\Program Files\Vim\vimfiles\ directory which was superceding my user preferences. I just blew away that directory and it works now.

Related

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!

Vim + Pathogen not loading help docs

Currently I use Pathogen to organize my vim plugins. It seems to do this fine and without a hitch but for some reason the helptags are not generated. I don't think my file structure is at fault (although it could be) because as far as I can tell I've set it up correctly, e.g: pathogen.vim is in ~/.vim/autoload and all my plugins are in ~/.vim/bundle
My .vimrc is aliased to the HOME directory so I can quickly find it and open it and the pathogen related part looks like this:
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
I feel like I've tried every iteration of this I've found on the internet as well and nothing has been successful. The plugins seem to work just fine every time but I can never get the help docs using the helptags. I'm using Mac OSX 10.6 if that helps.
Any advice is appreciated. Thanks.
I had the same problem of not finding the help when updating pathogen - I just had to run the following command to generate the helptags:
:Helptags
If you simply add the line to start pathogen to:
call pathogen#infect()
Helptags
It will generate them on startup and you will have the help as always.
To quote tpope from the vim-pathogen README:
Normally to generate documentation, Vim expects you to run :helptags on each directory with documentation (e.g., :helptags ~/.vim/doc). Provided with pathogen.vim is a :Helptags command that does this on every directory in your 'runtimepath'. If you really want to get crazy, you could even invoke Helptags in your vimrc. I don't like to get crazy.
On 4/13/2011 a :Helptags command was added, which generates help tags along the 'runtimepath'
The preferred way of initializing the plugin is now:
call pathogen#infect()
syntax on
filetype plugin indent on
All this and more in the docs
Take a look at my reply to "Pathogen does not load plugins". I think it might address your problem. Once you follow what I mentioned there, you should get the documentation for your plugins as wanted.

Missing NERDTree Commands

I am relatively new to vim and have an issue with NERDTree that I can't seem to figure out.
I seem to be missing a whole bunch of commands so when I map them to keys, I get the message (for example)
Not an editor command: NERDTreeMapToggleBookmarks
If I run :command I can see all the NERDTree global commands in there (those in section 2.1 of the docs) and these all seem to work but that's it.
I am using NERDTree 4.1.0 which I downloaded fresh from the github repo.
I suspect I may have either missed a step when setting up the plugin or am missing something in my .vimrc but I am at a bit of a loss.
Anyone have any pointers? Like I say, I am new to vim so it could be something really stupid or obvious!! ;)
Many thanks
I had the same issue after updating Vundle to the new interface.
Make sure you have
call vundle#begin()
and
call vundle#end()
wrapping your Plugin calls.
I recently ran into errors like Not an editor command: NERDTree*. What broke it for me was changing the line call vundle#rc() in my vimrc to call vundle#begin() because that's what I saw being used in the Vundle README. Switching back fixed the issue.
I am using this plugin for a long time. I have checked it and there is only one file in my ./plugins directory and 2 lines in my .vimrc configuration.
put NERD_tree.vim into .vim/plugins/ directory
add settings to your .vimrc config file:
" NERDTree configuration
let NERDTreeWinSize=35
" map to toggle NERDTree window
nmap :NERDTreeToggle
And that is all.

Vim: Recommendations for vimball plugins in pathogen

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.

Resources