3eb02b69551b

what have i done
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 20 Feb 2016 12:41:00 +0000
parents 5c97265b7ffc
children 29f29d72303a
branches/tags (none)
files vim/vimrc

Changes

--- a/vim/vimrc	Sat Feb 20 12:40:36 2016 +0000
+++ b/vim/vimrc	Sat Feb 20 12:41:00 2016 +0000
@@ -830,19 +830,26 @@
 
     " Friendlier Paredit mappings.
     au FileType clojure noremap <buffer> () :<c-u>call PareditWrap("(", ")")<cr>
+    au FileType clojure noremap <buffer> (( :<c-u>call PareditMoveLeft()<cr>
     au FileType clojure noremap <buffer> )( :<c-u>call PareditSplice()<cr>
-    au FileType clojure noremap <buffer> (( :<c-u>call PareditMoveLeft()<cr>
     au FileType clojure noremap <buffer> )) :<c-u>call PareditMoveRight()<cr>
     au FileType clojure noremap <buffer> (j :<c-u>call PareditJoin()<cr>
     au FileType clojure noremap <buffer> (s :<c-u>call PareditSplit()<cr>
     au FileType clojure noremap <buffer> [ :<c-u>call PareditSmartJumpOpening(0)<cr>
     au FileType clojure noremap <buffer> ] :<c-u>call PareditSmartJumpClosing(0)<cr>
-    " )))
+    " ))
+
+    au FileType clojure noremap <buffer> <left> :<c-u>call SexpBack()<cr>
+    au FileType clojure noremap <buffer> <right> :<c-u>call SexpForward()<cr>
+    au FileType clojure noremap <buffer> <up> :<c-u>call SexpUp()<cr>
+    au FileType clojure noremap <buffer> <down> :<c-u>call SexpDown()<cr>
 
     " Indent top-level form.
-    au FileType clojure nmap <buffer> <localleader>= mz99[(v%='z
+    " au FileType clojure nmap <buffer> <localleader>= mz99[(v%='z
     " ])
 
+    au FileType clojure call s:vim_sexp_mappings()
+
     " Not sure about this but we'll give it a try.
     au FileType clojure nmap <buffer> gi mz99[(v%='z
     " ])
@@ -2200,6 +2207,144 @@
             \ ]
 
 " }}}
+" Sexp {{{
+
+function! s:vim_sexp_mappings() " {{{
+    xmap <silent><buffer> af              <Plug>(sexp_outer_list)
+    omap <silent><buffer> af              <Plug>(sexp_outer_list)
+    xmap <silent><buffer> if              <Plug>(sexp_inner_list)
+    omap <silent><buffer> if              <Plug>(sexp_inner_list)
+    xmap <silent><buffer> aF              <Plug>(sexp_outer_top_list)
+    omap <silent><buffer> aF              <Plug>(sexp_outer_top_list)
+    xmap <silent><buffer> iF              <Plug>(sexp_inner_top_list)
+    omap <silent><buffer> iF              <Plug>(sexp_inner_top_list)
+    xmap <silent><buffer> as              <Plug>(sexp_outer_string)
+    omap <silent><buffer> as              <Plug>(sexp_outer_string)
+    xmap <silent><buffer> is              <Plug>(sexp_inner_string)
+    omap <silent><buffer> is              <Plug>(sexp_inner_string)
+    xmap <silent><buffer> ae              <Plug>(sexp_outer_element)
+    omap <silent><buffer> ae              <Plug>(sexp_outer_element)
+    xmap <silent><buffer> ie              <Plug>(sexp_inner_element)
+    omap <silent><buffer> ie              <Plug>(sexp_inner_element)
+    " nmap <silent><buffer> (               <Plug>(sexp_move_to_prev_bracket)
+    " xmap <silent><buffer> (               <Plug>(sexp_move_to_prev_bracket)
+    " omap <silent><buffer> (               <Plug>(sexp_move_to_prev_bracket)
+    " nmap <silent><buffer> )               <Plug>(sexp_move_to_next_bracket)
+    " xmap <silent><buffer> )               <Plug>(sexp_move_to_next_bracket)
+    " omap <silent><buffer> )               <Plug>(sexp_move_to_next_bracket)
+    " nmap <silent><buffer> <M-b>           <Plug>(sexp_move_to_prev_element_head)
+    " xmap <silent><buffer> <M-b>           <Plug>(sexp_move_to_prev_element_head)
+    " omap <silent><buffer> <M-b>           <Plug>(sexp_move_to_prev_element_head)
+    " nmap <silent><buffer> <M-w>           <Plug>(sexp_move_to_next_element_head)
+    " xmap <silent><buffer> <M-w>           <Plug>(sexp_move_to_next_element_head)
+    " omap <silent><buffer> <M-w>           <Plug>(sexp_move_to_next_element_head)
+    " nmap <silent><buffer> g<M-e>          <Plug>(sexp_move_to_prev_element_tail)
+    " xmap <silent><buffer> g<M-e>          <Plug>(sexp_move_to_prev_element_tail)
+    " omap <silent><buffer> g<M-e>          <Plug>(sexp_move_to_prev_element_tail)
+    " nmap <silent><buffer> <M-e>           <Plug>(sexp_move_to_next_element_tail)
+    " xmap <silent><buffer> <M-e>           <Plug>(sexp_move_to_next_element_tail)
+    " omap <silent><buffer> <M-e>           <Plug>(sexp_move_to_next_element_tail)
+    " nmap <silent><buffer> [[              <Plug>(sexp_move_to_prev_top_element)
+    " xmap <silent><buffer> [[              <Plug>(sexp_move_to_prev_top_element)
+    " omap <silent><buffer> [[              <Plug>(sexp_move_to_prev_top_element)
+    " nmap <silent><buffer> ]]              <Plug>(sexp_move_to_next_top_element)
+    " xmap <silent><buffer> ]]              <Plug>(sexp_move_to_next_top_element)
+    " omap <silent><buffer> ]]              <Plug>(sexp_move_to_next_top_element)
+    " nmap <silent><buffer> [e              <Plug>(sexp_select_prev_element)
+    " xmap <silent><buffer> [e              <Plug>(sexp_select_prev_element)
+    " omap <silent><buffer> [e              <Plug>(sexp_select_prev_element)
+    " nmap <silent><buffer> ]e              <Plug>(sexp_select_next_element)
+    " xmap <silent><buffer> ]e              <Plug>(sexp_select_next_element)
+    " omap <silent><buffer> ]e              <Plug>(sexp_select_next_element)
+    " nmap <silent><buffer> ==              <Plug>(sexp_indent)
+    " nmap <silent><buffer> =-              <Plug>(sexp_indent_top)
+    " nmap <silent><buffer> <LocalLeader>i  <Plug>(sexp_round_head_wrap_list)
+    " xmap <silent><buffer> <LocalLeader>i  <Plug>(sexp_round_head_wrap_list)
+    " nmap <silent><buffer> <LocalLeader>I  <Plug>(sexp_round_tail_wrap_list)
+    " xmap <silent><buffer> <LocalLeader>I  <Plug>(sexp_round_tail_wrap_list)
+    " nmap <silent><buffer> <LocalLeader>[  <Plug>(sexp_square_head_wrap_list)
+    " xmap <silent><buffer> <LocalLeader>[  <Plug>(sexp_square_head_wrap_list)
+    " nmap <silent><buffer> <LocalLeader>]  <Plug>(sexp_square_tail_wrap_list)
+    " xmap <silent><buffer> <LocalLeader>]  <Plug>(sexp_square_tail_wrap_list)
+    " nmap <silent><buffer> <LocalLeader>{  <Plug>(sexp_curly_head_wrap_list)
+    " xmap <silent><buffer> <LocalLeader>{  <Plug>(sexp_curly_head_wrap_list)
+    " nmap <silent><buffer> <LocalLeader>}  <Plug>(sexp_curly_tail_wrap_list)
+    " xmap <silent><buffer> <LocalLeader>}  <Plug>(sexp_curly_tail_wrap_list)
+    " nmap <silent><buffer> <LocalLeader>w  <Plug>(sexp_round_head_wrap_element)
+    " xmap <silent><buffer> <LocalLeader>w  <Plug>(sexp_round_head_wrap_element)
+    " nmap <silent><buffer> <LocalLeader>W  <Plug>(sexp_round_tail_wrap_element)
+    " xmap <silent><buffer> <LocalLeader>W  <Plug>(sexp_round_tail_wrap_element)
+    " nmap <silent><buffer> <LocalLeader>e[ <Plug>(sexp_square_head_wrap_element)
+    " xmap <silent><buffer> <LocalLeader>e[ <Plug>(sexp_square_head_wrap_element)
+    " nmap <silent><buffer> <LocalLeader>e] <Plug>(sexp_square_tail_wrap_element)
+    " xmap <silent><buffer> <LocalLeader>e] <Plug>(sexp_square_tail_wrap_element)
+    " nmap <silent><buffer> <LocalLeader>e{ <Plug>(sexp_curly_head_wrap_element)
+    " xmap <silent><buffer> <LocalLeader>e{ <Plug>(sexp_curly_head_wrap_element)
+    " nmap <silent><buffer> <LocalLeader>e} <Plug>(sexp_curly_tail_wrap_element)
+    " xmap <silent><buffer> <LocalLeader>e} <Plug>(sexp_curly_tail_wrap_element)
+    " nmap <silent><buffer> <LocalLeader>h  <Plug>(sexp_insert_at_list_head)
+    " nmap <silent><buffer> <LocalLeader>l  <Plug>(sexp_insert_at_list_tail)
+    " nmap <silent><buffer> <LocalLeader>@  <Plug>(sexp_splice_list)
+    " nmap <silent><buffer> <LocalLeader>o  <Plug>(sexp_raise_list)
+    " xmap <silent><buffer> <LocalLeader>o  <Plug>(sexp_raise_list)
+    " nmap <silent><buffer> <LocalLeader>O  <Plug>(sexp_raise_element)
+    " xmap <silent><buffer> <LocalLeader>O  <Plug>(sexp_raise_element)
+    " nmap <silent><buffer> <M-k>           <Plug>(sexp_swap_list_backward)
+    " xmap <silent><buffer> <M-k>           <Plug>(sexp_swap_list_backward)
+    " nmap <silent><buffer> <M-j>           <Plug>(sexp_swap_list_forward)
+    " xmap <silent><buffer> <M-j>           <Plug>(sexp_swap_list_forward)
+    " nmap <silent><buffer> <M-h>           <Plug>(sexp_swap_element_backward)
+    " xmap <silent><buffer> <M-h>           <Plug>(sexp_swap_element_backward)
+    " nmap <silent><buffer> <M-l>           <Plug>(sexp_swap_element_forward)
+    " xmap <silent><buffer> <M-l>           <Plug>(sexp_swap_element_forward)
+    " nmap <silent><buffer> <M-S-j>         <Plug>(sexp_emit_head_element)
+    " xmap <silent><buffer> <M-S-j>         <Plug>(sexp_emit_head_element)
+    " nmap <silent><buffer> <M-S-k>         <Plug>(sexp_emit_tail_element)
+    " xmap <silent><buffer> <M-S-k>         <Plug>(sexp_emit_tail_element)
+    " nmap <silent><buffer> <M-S-h>         <Plug>(sexp_capture_prev_element)
+    " xmap <silent><buffer> <M-S-h>         <Plug>(sexp_capture_prev_element)
+    " nmap <silent><buffer> <M-S-l>         <Plug>(sexp_capture_next_element)
+    " xmap <silent><buffer> <M-S-l>         <Plug>(sexp_capture_next_element)
+    " imap <silent><buffer> <BS>            <Plug>(sexp_insert_backspace)
+    " imap <silent><buffer> "               <Plug>(sexp_insert_double_quote)
+    " imap <silent><buffer> (               <Plug>(sexp_insert_opening_round)
+    " imap <silent><buffer> )               <Plug>(sexp_insert_closing_round)
+    " imap <silent><buffer> [               <Plug>(sexp_insert_opening_square)
+    " imap <silent><buffer> ]               <Plug>(sexp_insert_closing_square)
+    " imap <silent><buffer> {               <Plug>(sexp_insert_opening_curly)
+    " imap <silent><buffer> }               <Plug>(sexp_insert_closing_curly)
+endfunction " }}}
+
+let g:sexp_filetypes = ''
+let g:sexp_mappings = {}
+let g:sexp_insert_after_wrap = 0
+let g:sexp_enable_insert_mode_mappings = 0
+
+" wew lads
+function! SexpUp()
+    execute "normal \<Plug>(sexp_move_to_prev_bracket)"
+    execute "normal! v"
+    execute "normal \<Plug>(sexp_inner_element)"
+    execute "normal! o\<esc>"
+endfunction
+
+function! SexpDown()
+    execute "normal! v"
+    execute "normal \<Plug>(sexp_inner_element)"
+    execute "normal! \<esc>v"
+    execute "normal \<Plug>(sexp_inner_list)"
+    execute "normal! o\<esc>"
+endfunction
+
+function! SexpForward()
+    execute "normal \<Plug>(sexp_move_to_next_element_head)"
+endfunction
+
+function! SexpBack()
+    execute "normal \<Plug>(sexp_move_to_prev_element_head)"
+endfunction
+
+" }}}
 " Sparkup {{{
 
 let g:sparkupNextMapping = '<c-s>'