vim

For discussion on all things (neo)vim.
dharrigan 2020-12-03T15:20:18.230600Z

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

dharrigan 2020-12-03T15:20:44.231100Z

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

dharrigan 2020-12-03T15:21:32.232Z

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?

dharrigan 2020-12-03T15:25:38.232400Z

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

2020-12-03T15:26:44.233Z

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

dharrigan 2020-12-03T15:27:13.233400Z

You would think 🙂 I use parinfer

dharrigan 2020-12-03T15:27:23.233800Z

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

2020-12-03T15:27:23.233900Z

ah! then it should do it

2020-12-03T15:27:26.234100Z

I guess

dharrigan 2020-12-03T15:27:48.234400Z

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

dharrigan 2020-12-03T15:28:03.234800Z

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

2020-12-03T15:29:07.235800Z

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.

dharrigan 2020-12-03T15:29:09.236Z

It should, according to Paren Mode

dharrigan 2020-12-03T15:29:15.236200Z

letmeresearch

dharrigan 2020-12-03T15:32:59.236500Z

ah-ha!

dharrigan 2020-12-03T15:33:16.236900Z

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

nate 2020-12-03T15:36:01.238100Z

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

👍 1
dave 2020-12-03T16:02:50.238700Z

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

dave 2020-12-03T16:02:55.238900Z

or =%

dave 2020-12-03T16:03:10.239200Z

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

dave 2020-12-03T16:05:35.239400Z

...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

nate 2020-12-03T16:09:48.240900Z

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

nate 2020-12-03T16:09:59.241200Z

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

dave 2020-12-03T16:11:20.241400Z

oh, cool!

dave 2020-12-03T16:11:26.241800Z

that's super useful

nate 2020-12-03T16:12:36.242800Z

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

dave 2020-12-03T16:33:57.243100Z

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

dharrigan 2020-12-03T17:25:39.243600Z

thanks all 🙂