855cbad5f857

Makerlisp stuff
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 16 Apr 2019 21:46:51 -0400
parents ad00851f9411
children 994750f7b6dd aa1cc443308a
branches/tags (none)
files bin/makerlisp bin/makerlisp-raw bin/rlwrap-lisp vim/bundle/neorepl/plugin/neorepl.vim vim/vimrc

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/makerlisp	Tue Apr 16 21:46:51 2019 -0400
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+cd ~/src/makerlisp/src/uSDimage
+rlwrap-lisp \
+    --only-cook '^> ' \
+    ../lisp/linux/lisp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/makerlisp-raw	Tue Apr 16 21:46:51 2019 -0400
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+cd ~/src/makerlisp/src/uSDimage
+../lisp/linux/lisp "$@"
--- a/bin/rlwrap-lisp	Sat Apr 13 10:37:06 2019 -0400
+++ b/bin/rlwrap-lisp	Tue Apr 16 21:46:51 2019 -0400
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-rlwrap -m$ \
+rlwrap -m$$$$ \
        --multi-line-ext .lisp \
        -a___ \
        --only-cook '^\[[a-zA-Z ]+\] [-a-zA-Z0-9._/]+>' \
--- a/vim/bundle/neorepl/plugin/neorepl.vim	Sat Apr 13 10:37:06 2019 -0400
+++ b/vim/bundle/neorepl/plugin/neorepl.vim	Tue Apr 16 21:46:51 2019 -0400
@@ -32,6 +32,8 @@
 endfunction " }}}
 
 function! NeoReplSendSelection() " {{{
+    " Make sure you've DESELECTEDthe text before calling this, otherwise it'll
+    " run once per text line because Vim hates me.
     let old_z = @z
     normal! gv"zy
 
--- a/vim/vimrc	Sat Apr 13 10:37:06 2019 -0400
+++ b/vim/vimrc	Tue Apr 16 21:46:51 2019 -0400
@@ -923,10 +923,16 @@
     call HighlightLispRepl()
 endfunction "}}}
 
+function! OpenLispReplMakerlisp() "{{{
+    NeoRepl makerlisp
+endfunction "}}}
+function! OpenLispReplMakerlispRaw() "{{{
+    NeoRepl makerlisp-raw
+endfunction "}}}
+
 function! OpenLispReplSBCL() "{{{
     NeoRepl sbcl-vlime
 endfunction "}}}
-
 function! OpenLispReplSBCLRaw() "{{{
     NeoRepl sbcl-vlime-raw
 endfunction "}}}
@@ -1583,6 +1589,65 @@
 augroup END
 
 " }}}
+" Makerlisp {{{
+
+function! HighlightMakerlispRepl() "{{{
+    setlocal nolist
+
+    " set syntax=lisp
+    syn match replPrompt /\v^\>/
+    syn match replComment /\v^;.*/
+
+    " syn match replResult /\v^#\<[^>]+\>$/
+    hi def link replResult Debug
+    hi def link replComment Comment
+endfunction "}}}
+
+function! SendEntireFile() "{{{
+    let view = winsaveview()
+
+    execute "normal! ggVG\<esc>"
+    call NeoReplSendSelection()
+
+    call winrestview(view)
+endfunction "}}}
+
+function! OpenLispReplMakerlispRaw() "{{{
+    NeoRepl makerlisp-raw
+    call HighlightMakerlispRepl()
+endfunction "}}}
+
+augroup ft_makerlisp " {{{
+    au!
+
+    au BufNewFile,BufRead *.l set filetype=makerlisp
+    au BufNewFile,BufRead *.l setlocal syntax=lisp
+
+    au FileType makerlisp nnoremap <buffer> U :syntax sync fromstart<cr>:redraw!<cr>:call TurnOnLispFolding()<cr>
+    au FileType makerlisp call SetLispWords()
+    au FileType makerlisp call EnableParedit()
+    au FileType makerlisp silent! call TurnOnLispFolding()
+    au FileType makerlisp RainbowParenthesesActivate
+    au FileType makerlisp setlocal iskeyword+=!,?,%,-
+    au FileType makerlisp setlocal lisp
+    au FileType makerlisp setlocal equalprg=lispindent
+
+    " Open REPL
+    au FileType makerlisp nnoremap <buffer> <silent> <localleader>Om :call OpenLispReplMakerlispRaw()<cr>
+
+    " Misc mappings
+    au FileType makerlisp nnoremap <buffer> gi :call IndentToplevelLispForm()<cr>
+    au FileType makerlisp nnoremap <buffer> [] :call DuplicateLispForm()<cr>
+    au FileType makerlisp nnoremap <buffer> <localleader>( :call PareditToggle()<cr>
+
+    au FileType makerlisp nnoremap <buffer> <localleader>e :call SendToplevelLispForm()<cr>
+    au FileType makerlisp nnoremap <buffer> <localleader>f :call SendEntireFile()<cr>
+    au FileType makerlisp nnoremap <buffer> <localleader>c :call NeoReplSendRaw("(cls)")<cr>
+
+    ")
+augroup END " }}}
+
+" }}}
 " Markdown {{{
 
 augroup ft_markdown
@@ -2163,6 +2228,7 @@
     au FileType htmldjango setlocal commentstring={#\ %s\ #}
     au FileType clojurescript setlocal commentstring=;\ %s
     au FileType lisp setlocal commentstring=;;\ %s
+    au FileType makerlisp setlocal commentstring=;;\ %s
     au FileType puppet setlocal commentstring=#\ %s
     au FileType fish setlocal commentstring=#\ %s
     au FileType gnuplot setlocal commentstring=#\ %s