These are for the combined vim-sexp (https://github.com/guns/vim-sexp) and vim-sexp-mappings-for-regular-people (https://github.com/tpope/vim-sexp-mappings-for-regular-people) plugins. vim-sexp is neat on its own but Tim Pope makes common stuff much easier.
Note that some vim-sexp functionality depends on <LocalLeader> mappings. This is a different leader key than the global leader, and is the variable maplocalleader (instead of mapleader). To see if you have this set, use :echo maplocalleader; if it errors out you'll need to set it, otherwise it will echo the key. If you want to set your LocalLeader to <Space>, you'll need two commands in your .vimrc, since by default <Space> is bound to <Right> in normal mode:
nnoremap <Space> <Nop>
let maplocalleader=" "
- Movements
- Text objects
- Lispy actions
- Indenting
- Wrapping
- Splicing
(and)move to the nearest paired structural bracket;(will take you backwards to the nearest(,{, or[WandBmove forwards/backwards element-wise within a form, ending on element heads: that is, if you're onain the outer form of(a (b c) d), you'll jump fromato(todwhen pressingWW, versuswwwhich takes youa=>(=>bEandgEmove forwards/backwords element-wise, ending on tails:EEon(a (b c) d)takes youa=>)=>d[[and]]move forwards/backwards between top-level elements:[[on2in(1 (a b)) (d (c d) 2)will move you to the opening paren of1[eand]eselects adjacent elements fowards/backwards<Iand>Iinsert at the head/tail of a form
These are best used with the i (inside) and a (around) movements.
frefers to the form under the cursor;ifwhen the cursor is oncof(a (b c) d)selectsb cFrefers to the top-level form around the cursor;iFoncof(a (b c) d)selectsa (b c) dsrefers to stringserefers to elements; in a word this means the word, on a parenthese this means the formwrefers to words, which are non-form elements; e.x. you cannotviffrom a parenthese
==indents the current form=-indents the top level form
<LocalLeader>iand<LocalLeader>Isurround the current form with()and places the cursor at the front (i) or end (I)<LocalLeader>[and<LocalLeader>]do the same things for[]<LocalLeader>{and<LocalLeader>}do it for{}<LocalLeader>wand<LocalLeader>Wsurround the current element with()and place the cursor at the front/end<LocalLeader>e[,<LocalLeader>e],<LocalLeader>e{,<LocalLeader>e}behave as above element-wise
<LocalLeader>@splices the current form into its parent:(1 (2 3) 4)=>(1 2 3 4)<LocalLeader>oreplaces the parent form with the current form:oin the middle of(1 (2 3) 4)=>(2 3)<LocalLeader>Oreplaces the parent form with the current element:Oon2in(1 (2 3) 4)=>(1 2 4)>fand<fswap or move the current form right/left (in the direction of the arrow):>fon2of(1 (2 3) 4)=>(1 4 (2 3))>eand<emove the current element right/left>)and<(slurp right/left; think of them like arrows moving the corresponding parentheses a direction:>)in the inner form of(1 (2 3) 4)=>(1 (2 3 4))<)and>(burp right/left; again, the arrows are moving the parentheses:<)in the inner form of(1 (2 3) 4)=>(1 (2) 3 4)