54df794e9d59

More vimrc stuff
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 08 Sep 2015 16:39:20 +0000
parents 54484a3a4dfd
children 21a0c7224791
branches/tags (none)
files vim/vimrc

Changes

--- a/vim/vimrc	Mon Aug 31 13:19:45 2015 +0000
+++ b/vim/vimrc	Tue Sep 08 16:39:20 2015 +0000
@@ -407,6 +407,9 @@
 " The normal use of S is covered by cc, so don't worry about shadowing it.
 nnoremap S i<cr><esc>^mwgk:silent! s/\v +$//<cr>:noh<cr>`w
 
+" Substitute
+nnoremap <c-s> :%s/
+
 " HTML tag closing
 inoremap <C-_> <space><bs><esc>:call InsertCloseTag()<cr>a
 
@@ -869,12 +872,7 @@
     call winrestview(view)
 endfunction "}}}
 function! SendLispBuffer() "{{{
-    let view = winsaveview()
-
-    execute "normal! ggVG\<esc>"
-    call NeoReplSendSelection()
-
-    call winrestview(view)
+    call NeoReplSendRaw('(load "'. expand("%:p") . '")' . "\n")
 endfunction "}}}
 function! DescribeLispSymbol() "{{{
     let old_z = @z
@@ -887,6 +885,19 @@
 function! DescribeLispPrompt() "{{{
     call NeoReplSendRaw("(describe '" . input("? ") . ")\n")
 endfunction "}}}
+function! MacroexpandLispForm() "{{{
+    let view = winsaveview()
+    let old_z = @z
+
+    normal! "zyab
+    call NeoReplSendRaw("(macroexpand-1 '" . @z . ")\n")
+
+    let @z = old_z
+    call winrestview(view)
+endfunction "}}}
+function! MacroexpandLispPrompt() "{{{
+    call NeoReplSendRaw("(macroexpand-1 '" . input("? ") . ")\n")
+endfunction "}}}
 
 augroup ft_commonlisp
     au!
@@ -906,6 +917,8 @@
     " \c - send ctrl-l            [c]lear
     " \d - describe symbol        [d]escribe
     " \D - describe prompt        [d]escribe
+    " \m - macroexpand form       [m]acroexpand
+    " \M - macroexpand prompt     [m]acroexpand
 
     au FileType lisp nnoremap <buffer> <silent> <localleader>o :call OpenLispRepl()<cr>
 
@@ -927,6 +940,12 @@
     " Describe prompt
     au FileType lisp nnoremap <buffer> <silent> <localleader>D :call DescribeLispPrompt()<cr>
 
+    " Macroexpand form
+    au FileType lisp nnoremap <buffer> <silent> <localleader>m :call MacroexpandLispForm()<cr>
+
+    " Macroexpand prompt
+    au FileType lisp nnoremap <buffer> <silent> <localleader>M :call MacroexpandLispPrompt()<cr>
+
     au FileType lisp RainbowParenthesesActivate
     au syntax lisp RainbowParenthesesLoadRound
     au syntax lisp RainbowParenthesesLoadSquare