Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Be advised, this is for macOS.

There are two wrapper scripts, for Terminal (`ritt`) and for iTerm (`riitt`), in addition to the `swank-lisp` script. Choose one of the wrapper scripts for your use case.

The relevant lines in ~/.vimrc, adjust your `sbcl` path:

  let g:slimv_swank_cmd = '!ritt swank-lisp -d "' . getcwd() . '"'                                                                                                            
  let g:slimv_lisp = '/usr/local/bin/sbcl'
  let g:slimv_impl = 'sbcl'
  let g:slimv_ctags = 'ctags'

`ritt` (“run in Terminal tab”) for use with Terminal.app:

  #!/usr/bin/env osascript                                                                                                                                                   

  on run arglist
      if (count of arglist) > 0 then
          -- The command to run is built from blank-separated script arguments.
          set text item delimiters to {" "}
          set theCommand to arglist as string
          tell application "Terminal"
              activate
              -- Make a new Terminal tab just like the current one.
              tell application "System Events" to keystroke "t" using {command down}
              set newTab to the last tab of front window
              -- Run the command in the new tab.
              do script theCommand in newTab
          end tell
      end if
      -- Try to cause a minimum of disturbance in the calling environment instead of outputting random AppleScript values.
      return ""
  end

This is `riitt` (“run in iTerm tab”) for use with iTerm.app:

  #!/usr/bin/env osascript                                                                                                                                                   

  on run arglist
      if (count of arglist) > 0 then
          -- The command to run is built from blank-separated script arguments.
          set text item delimiters to {" "}
          set theCommand to arglist as string
          tell application "iTerm"
              activate
              -- Make a new Terminal tab just like the current one.
              tell application "System Events" to keystroke "t" using {command down}
              set newTab to the last tab of front window
              -- Run the command in the new tab.
              write (current session in newTab) text theCommand
          end tell
      end if
      -- Try to cause a minimum of disturbance in the calling environment instead of outputting random AppleScript values.
      return ""
  end

And here the `swank-lisp` script (adjust the `swankdir` to your install location):

  #!/bin/bash

  swankdir="${HOME}/.vim/bundle/slimv.git/slime"
  self=$(basename "$0")
  umask 022
  set -u

  Usage()
  {
      cat <<EOD >&2
  Usage:  $self [-d <working-dir>]
  EOD

      exit 1
  }

  # Argument Scanning
  if [ "$*" = "--help" ]
  then
      Usage
  fi

  devDir="${HOME}/Develop/Lisp"
  while getopts "d:X" opt
  do
      case "$opt" in
      (d)
          if [ -n "$OPTARG" ]
          then
              devDir="$OPTARG"
          fi
          ;;
      (X)
          set -x
          ;;
      (?) # Unknown option
          Usage
          ;;
      esac
  done

  # Shift away parsed option flags
  shift $((OPTIND - 1))

  # Change to user's development directory, so files are easier to locate.
  cd "$devDir" || exit $?

  sbcl --dynamic-space-size 16384 --load "${swankdir}/start-swank.lisp"
  echo    # Newline before next shell prompt.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: