I'm using MacVim (kind of gvim for OSX) and try to get the slimv plugin running. Sadly it's not working out of the box. In fact, it does not start up at all.
My setup:
ftplugin/slimv.vim
while plugin/paredit.vim
is listedfiletype=lisp
for .lisp filesfiletype detection:ON plugin:ON indent:ON
1
E121: Undefined variable: g:slimv_loaded \ E15: Invalid expression: g:slimv_loaded
SBCL and slime are installed - works flawless with emacs.
I tried it with and without let g:slimv_swank_cmd = ...
in .vimrc and changed the line recommended on the plugin page from
let g:slimv_swank_cmd = '!osascript -e "tell application \"Terminal\" to do script \"sbcl --load ~/.vim/slime/start-swank.lisp\""'
to
let g:slimv_swank_cmd = '!sh -c "sbcl --load /Applications/MacVim.app/Contents/Resources/vim/runtime/slime/start-swank.lisp" &'
since the osascript was not working and I don't know how to fix it. But a similar call to xterm is sufficient for Linux so my sh call should be fine. Well, I got no idea what to try next. :/
The problem got solved by installing slimv to ~/.vim instead of the vim ebedded in MacVim. Maybe some kind of bug? However, Common Lisp + vim - I just love it.
Because moving the slimv plugin to ~/.vim
fixed it, I suspect the problem is that MacVim's default /Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin/lisp.vim
is being sourced before the ftplugin/lisp/slimv-lisp.vim
file provided with slimv.
Both of those files (lisp.vim
and slimv-lisp.vim
) start with code like this:
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
and so whichever file gets sourced first will prevent the other file from running since vim does finish
(exits the script) if it detects that another *lisp*.vim script was run previously and therefore set the b:did_ftplugin
buffer-local variable.
You can tell this is happening by running MacVim from the command line with the arguments:
-V20macvim-log.txt hello.lisp
Then quit the MacVim session that starts up, and look at the macvim-log.txt file it created.
Search for b:did_ftplugin
and you'll see it referenced each time lisp.vim
or slimv-lisp.vim
runs, and you can see that lisp.vim
runs first, which prevents slimv-lisp.vim
from working.
Moving your slimv install from the /Applications/MacVim.app/
dir to your ~/.vim
dir will change the order so that slimv-lisp.vim
is sourced before lisp.vim
, and then slimv will work.