sasagawa888 / eisl

ISLisp interpreter/compiler
Other
279 stars 23 forks source link

Supporting vim using swank ? #325

Open kwccoin opened 2 days ago

kwccoin commented 2 days ago

I have used macOS for lisp and in the last few years mainly use this web site to help me to avoid using emacs, as I am a vim guy:

https://susam.net/lisp-in-vim.html

Any chance to support it?

I suspect the issue is related to how to change this file ( I marked issue 1/2) so to start swank:

   ;;; This file is intended to be loaded by an implementation to
  ;;; get a running swank server
  ;;; e.g. sbcl --load start-swank.lisp
  ;;;; or full path like ;sbcl --load ~/.vim/pack/plugins/start/slimv/slime/start-swank.lisp 
  ;;;
  ;;; Default port is 4005

  ;;; For additional swank-side configurations see
  ;;; 6.2 section of the Slime user manual.
  ;;;
  ;;; Modified for Slimv:
  ;;; - don't close connection
  ;;; - pass swank port in environment variable

  (load (merge-pathnames "swank-loader.lisp" *load-truename*))                                   ;;; <-- issue 1

  (swank-loader:init
   :delete nil         ; delete any existing SWANK packages
   :reload nil         ; reload SWANK, even if the SWANK package already exists
   :load-contribs nil  ; load all contribs
   :from-emacs nil)    ; not started from emacs

  (defun my-getenv (name &optional default)
    #+CMU
    (let ((x (assoc name ext:*environment-list*
                    :test #'string=)))
      (if x (cdr x) default))
    #-CMU
    (or
      #+Allegro (sys:getenv name)
      #+CLISP (ext:getenv name)
      #+ECL (si:getenv name)
      #+SBCL (sb-unix::posix-getenv name)
      #+LISPWORKS (lispworks:environment-variable name)
      #+CCL (ccl::getenv name) 
      #+??? ;                                                                                                                       <--- issue 2
      default))

  (swank:create-server :port (parse-integer (my-getenv "SWANK_PORT" "4005"))
                       ;; if non-nil the connection won't be closed
                       ;; after connecting
                       :dont-close t)

Just in case you want to help but do not how to run it under macOS the following is script (the linux version is under comment):

brew install sbcl  # for testing of swank 
brew install tmux git macvim
brew link macvim

# sudo apt update
# sudo apt upgrade
# not doing # sudo apt install build-essential 
# sudo  apt-get install gvim not-vim-nox sbcl tmux git # ecl

git clone https://github.com/kovisoft/slimv.git ~/.vim/pack/plugins/start/slimv

vim +'helptags ~/.vim/pack/plugins/start/slimv/doc' +q

;sbcl --load ~/.vim/pack/plugins/start/slimv/slime/start-swank.lisp 
; tmux shall work as well
; vim test.lisp
; will use the swank server
; for EISL I think it will be
eisl -l ~/.vim/pack/plugins/start/slimv/slime/start-swank.lisp 
sasagawa888 commented 1 day ago

I don’t know anything about vim. However, Mr. Poldy, who supported the development of EISL, used vim if I recall correctly. He might know something. I wonder if Mr. Poldy is seeing this?