MacVim: slimv does not start

1.7k views Asked by At

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:

  • MacVim (32bit cause of this) (vim 7.3)
  • :scriptnames does not list ftplugin/slimv.vim while plugin/paredit.vim is listed
  • :set ft? shows filetype=lisp for .lisp files
  • :messages shows no errors
  • :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 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.

3

There are 3 answers

0
svec On BEST ANSWER

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.

1
Tamas Kovacs On

If slimv.vim is not listed in :scriptnames and g:slimv_loaded is undefined then you don't have the plugin loaded at all. I guess you don't have filetype plugins enabled. Paredit is a general plugin but slimv.vim is a filetype plugin and filetype/indent plugins must explicitly be enabled. Try to add these lines to your .vimrc:

filetype plugin on
filetype indent on
0
Julian On

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.