Fork me on GitHub
#vim
<
2020-12-03
>
dharrigan15:12:18

You know in vim, let's say I have this...

dharrigan15:12:44

poi {:uuid id            
             :name name
             :label label
             :location location
             :active active}]))

dharrigan15:12:32

and I want to delete poi, but have the {} block shift over to the left as I delete each character of POI (or delete the entire word POI)....how do?

dharrigan15:12:38

I guess the delete has to be aware that it has to shift the entire map left

mamapitufo15:12:44

isn't that a job for an auto-formatter instead?

dharrigan15:12:13

You would think 🙂 I use parinfer

dharrigan15:12:23

but if I delete the poi, it ends up like this

mamapitufo15:12:23

ah! then it should do it

dharrigan15:12:48

{:uuid id
             :name name
             :label label
             :location location
             :active active}]))

dharrigan15:12:03

it dosn't shift over the rest of the contents of the map

mamapitufo15:12:07

I had a similar problem when raising forms using vim-sexp, the indentation would not be updated. But I'd expect that to work with parinfer, yes.

dharrigan15:12:09

It should, according to Paren Mode

dharrigan15:12:15

letmeresearch

dharrigan15:12:16

switching to let g:parinfer_mode = 'smart' or let g:parinfer_mode = 'indent' solves the problem

nate15:12:01

Interesting. I've just burned =- into my muscle memory to reformat after such an operation.

👍 3
dave16:12:50

@dharrigan i also use parinfer. in a situation like that, i usually put my cursor on the { and press ==

dave16:12:35

...ah yes, and i actually don't have this problem because when i delete poi, the entire map shifts to the left :echo g:parinfer_mode does display smart, so that makes sense

dave16:12:10

@nate what is =-? i'm intrigued!

nate16:12:48

@dave =- is a mapping provided by vim-sexp that reindents from the top form

nate16:12:59

just like == indents the form you're cursor is in

dave16:12:20

oh, cool!

dave16:12:26

that's super useful

nate16:12:36

does parinfer provide the == mapping or do you also have vim-sexp installed?

dave16:12:57

i have vim-sexp installed. looks like it's being provided by vim-sexp

dharrigan17:12:39

thanks all 🙂