876ef6176302

Moar lisp
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 30 Aug 2015 15:53:49 +0000
parents 48fa93b0dc64
children d9910af7d3ee
branches/tags (none)
files vim/custom-dictionary.utf-8.add vim/vimrc

Changes

--- a/vim/custom-dictionary.utf-8.add	Fri Aug 28 21:22:08 2015 +0000
+++ b/vim/custom-dictionary.utf-8.add	Sun Aug 30 15:53:49 2015 +0000
@@ -172,3 +172,4 @@
 carabiner
 monopod
 gmail
+inline
--- a/vim/vimrc	Fri Aug 28 21:22:08 2015 +0000
+++ b/vim/vimrc	Sun Aug 30 15:53:49 2015 +0000
@@ -826,7 +826,7 @@
 " }}}
 " Common Lisp {{{
 
-function! OpenLispRepl()
+function! OpenLispRepl() "{{{
     NeoRepl lisp
     set syntax=lisp
     syn match replPrompt /\v^\*/
@@ -834,10 +834,8 @@
 
     syn match replResult /\v^#\<[^>]+\>$/
     hi def link replResult Debug
-
-endfunction
-
-function! SetLispWords()
+endfunction "}}}
+function! SetLispWords() "{{{
     if exists("g:did_set_lisp_words")
         return
     endif
@@ -847,18 +845,16 @@
     set lispwords+=switch
     set lispwords+=cswitch
     set lispwords+=eswitch
-endfunction
-
-function! SendLispForm()
+endfunction "}}}
+function! SendLispForm() "{{{
     let view = winsaveview()
 
     execute "normal! vab\<esc>"
     call NeoReplSendSelection()
 
     call winrestview(view)
-endfunction
-
-function! SendToplevelLispForm()
+endfunction "}}}
+function! SendToplevelLispForm() "{{{
     let view = winsaveview()
 
     " If we're on the first char of the form, calling PareditFindDefunBck will
@@ -871,16 +867,26 @@
     call NeoReplSendSelection()
 
     call winrestview(view)
-endfunction
-
-function! SendLispBuffer()
+endfunction "}}}
+function! SendLispBuffer() "{{{
     let view = winsaveview()
 
     execute "normal! ggVG\<esc>"
     call NeoReplSendSelection()
 
     call winrestview(view)
-endfunction
+endfunction "}}}
+function! DescribeLispSymbol() "{{{
+    let old_z = @z
+
+    normal! "zyiw
+    call NeoReplSendRaw("(describe '" . @z . ")\n")
+
+    let @z = old_z
+endfunction "}}}
+function! DescribeLispPrompt() "{{{
+    call NeoReplSendRaw("(describe '" . input("? ") . ")\n")
+endfunction "}}}
 
 augroup ft_commonlisp
     au!
@@ -893,13 +899,15 @@
     " swank/neovim yak.
     "
     " key  desc                   mnemonic
-    " \l - connect neorepl        [l]isp
+    " \o - connect neorepl        [o]pen lisp
     " \f - send current form      [f]orm
     " \e - send top-level form    [e]val
     " \r - send entire file       [r]eload file
     " \c - send ctrl-l            [c]lear
-
-    au FileType lisp nnoremap <buffer> <silent> <localleader>l :call OpenLispRepl()<cr>
+    " \d - describe symbol        [d]escribe
+    " \D - describe prompt        [d]escribe
+
+    au FileType lisp nnoremap <buffer> <silent> <localleader>o :call OpenLispRepl()<cr>
 
     " Send the current form to the REPL
     au FileType lisp nnoremap <buffer> <silent> <localleader>f :call SendLispForm()<cr>
@@ -913,6 +921,12 @@
     " Clear the REPL
     au FileType lisp nnoremap <buffer> <silent> <localleader>c :call NeoReplSendRaw("")<cr>
 
+    " Describe symbol under the cursor
+    au FileType lisp nnoremap <buffer> <silent> <localleader>d :call DescribeLispSymbol()<cr>
+
+    " Describe prompt
+    au FileType lisp nnoremap <buffer> <silent> <localleader>D :call DescribeLispPrompt()<cr>
+
     au FileType lisp RainbowParenthesesActivate
     au syntax lisp RainbowParenthesesLoadRound
     au syntax lisp RainbowParenthesesLoadSquare
@@ -1330,8 +1344,9 @@
     " Set up some basic neorepl mappings.
     "
     " key  desc                   mnemonic
-    " \p - connect neorepl        [o]pen repl
+    " \o - connect neorepl        [o]pen repl
     " \l - send current line      [l]ine
+    " \p - send current paragraph [p]aragraph
     " \e - send top-level hunk    [e]val
     " \e - send selected hunk     [e]val
     " \r - send entire file       [r]eload file