Fork me on GitHub
#vim
<
2020-11-03
>
Gleb Posobin22:11:48

Is there a way to expand / contract current selection by the levels with vim-sexp? So if I do "vi(", the innermost form surrounded by () is selected, is there a way to expand the selection to the next one form containing that one?

walterl22:11:51

vibibibib...

Gleb Posobin22:11:37

Cool! Is there a way to contract after that?

walterl00:11:18

Not that I'm aware of. Probably because it's stateless and therefore non-deterministic: if you went from some form f to include it's parent, it would include f's siblings too. Then it won't know how which sibling to select "down" into. Just guessing, though 🤷

Gleb Posobin22:11:01

Also, is there a way to preserve the parenthesis on deleting? So if I delete the second line in

(defn f []
  2)
the output will be (defn f [])?

dave00:11:56

A long time ago, I switched from paredit to parinfer and I've never looked back. It is quite different, and it's not for everyone, but it makes a lot of sense for the way I think about editing code

dave00:11:12

The overall idea is that you almost never have to add or remove parentheses directly. Rather, you align/indent your code according to common Lisp/Clojure conventions and parinfer places your parentheses for you based on your indentation.

Gleb Posobin04:11:32

Interesting! What about slurping and barfing when items are on the same line?

dave13:11:52

vim-sexp is compatible with parinfer and provides that functionality. i have both vim-sexp and parinfer installed and they make a great team 🙂

Gleb Posobin14:11:18

Great, I am trying it out!

rwstauner22:11:19

i haven't really used vim-sexp but i get the latter effect from kovisoft/paredit

noisesmith22:11:11

I think vim-sexp is primarily oriented to using text objects (eg. f for form, F for top level form, which combine with d/y and then i/a etc.)

Gleb Posobin22:11:59

Great, thank you!

Gleb Posobin23:11:07

Is anyone using vim-cljfmt? When I try to format the file, it deletes the its content...

jeremyvdw15:11:28

dunno if you already worked around this, but if you don’t, here is a clue https://github.com/venantius/vim-cljfmt/issues/48

rwstauner23:11:58

venantius/vim-cljfmt ? i use it in some projects and haven't had that problem