Search code examples
vimcommon-lisphome-directorypathnameslimv

Why am I getting a file not found error in Slimv?


I've set up slimv with the following command in vim:

let g:slimv_swank_cmd = '!gnome-terminal -e "sbcl --load ~/.vim/bundle/slimv/slime/start-swank.lisp &"'

When opening .lisp files and starting slimv, I recieve the following error message in the newly opened terminal window:

debugger invoked on a SB-INT:SIMPLE-FILE-ERROR in thread
#<THREAD "main thread" RUNNING {1002A8B203}>:
  Couldn't load #P"~/.vim/bundle/slimv/slime/start-swank.lisp": file does not exist.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Ignore runtime option --load "~/.vim/bundle/slimv/slime/start-swank.lisp".
  1: [ABORT   ] Skip rest of --eval and --load options.
  2:            Skip to toplevel READ/EVAL/PRINT loop.
  3: [EXIT    ] Exit SBCL (calling #'EXIT, killing the process).

(LOAD #P"~/.vim/bundle/slimv/slime/start-swank.lisp" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DEFAULT)

However, running the sbcl command from the terminal works properly because the file does exist on the path specified. How can I fix this issue?


Solution

  • You need to make sure that the tilde gets expanded. Expansion is provided by the shell.

    You can also compute the pathname in Common Lisp using:

    (merge-pathnames ".vim/bundle/slimv/slime/start-swank.lisp"
                     (user-homedir-pathname))
    
    -> #P"/home/foobar/.vim/bundle/slimv/slime/start-swank.lisp"
    

    Merging a relative pathname with an absolute pathname, adds the directory like above.

    Both functions (merge-pathnames and user-homedir-pathname) are in the ANSI CL standard.