MacVim: slimv won't start
I am using MacVim (like gvim for OSX) and trying to run the slimv plugin . Unfortunately this doesn't work out of the box. In fact, it doesn't start at all.
My setup:
- MacVim (32bit reason for this ) (vim 7.3)
- : scriptnames is not displayed
ftplugin/slimv.vim
butplugin/paredit.vim
specified - : install ft? shows
filetype=lisp
for .lisp files - : no error messages are displayed
- : filetype
filetype detection:ON plugin:ON indent:ON
- : echo g: paredit_loaded
1
- : echo g: slimv_loaded
E121: Undefined variable: g:slimv_loaded \ E15: Invalid expression: g:slimv_loaded
- compiled with + python (2.7)
SBCL and slime installed - works flawlessly with emacs. I tried it with let g:slimv_swank_cmd = ...
and without it. Vimrc and changed the line recommended in 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 osascript didn't work and I don't know how to fix it. But a similar call to xterm is sufficient for Linux, so my call to sh should be fine. Well, I had no idea what to try next.: /
The problem was solved by installing slimv to ~ / .vim instead of vim ebedded in MacVim. Maybe some mistake? However, Common Lisp + vim - I just like it.
source to share
Since moving the slimv plugin has not been ~/.vim
fixed, I suspect the problem is that MacVim by default /Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin/lisp.vim
runs before the file ftplugin/lisp/slimv-lisp.vim
provided with slimv.
Both of these files ( lisp.vim
and slimv-lisp.vim
) begin with the code as follows:
" 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 depending on which file is sent, the other file will be prevented from starting first, as vim does finish
(exits the script) if it detects another * lisp *. The vim script was run earlier and hence set the local variable b:did_ftplugin
.
You can tell this is happening by running MacVim from the command line with arguments:
-V20macvim-log.txt hello.lisp
Then close the MacVim session that will start and look at the macvim-log.txt file it created.
Search b:did_ftplugin
and you will see that it is referenced every time you start lisp.vim
or slimv-lisp.vim
and you can see what is working lisp.vim
, what is preventing it from working slimv-lisp.vim
.
Moving your slimv installation from directory /Applications/MacVim.app/
to directory ~/.vim
will change the order to get slimv-lisp.vim
to lisp.vim
, and then slimv will work.
source to share
If slimv.vim is not listed in :scriptnames
but g:slimv_loaded
is undefined, then you have no plugin at all. You probably don't have file system plugins. Paredit is a generic plugin, but slimv.vim is a filetype plugin and the filetype / indent plugins must be explicitly enabled. Try adding these lines to yours .vimrc
:
filetype plugin on
filetype indent on
source to share