Fork me on GitHub
#parinfer
<
2015-11-25
>
shaunlebron03:11:37

@snoe @dominicm I think I’m going to forgo that responsibility to individual plugins

shaunlebron03:11:46

at least until Parinfer returns cursor information, which it doesn’t currently

shaunlebron03:11:58

seems trivial to implement though. vim has autoindent mode which does exactly what you’re asking, see here: http://vim.wikia.com/wiki/Indenting_source_code

snoe04:11:12

heh I'm playing around with this now, I think a vim mapping like nmap o yypDa would work well enough if we want this behavior

snoe04:11:17

@dominicm let me know if that's the kind of behavior you're looking for. @shaunlebron I agree it's up to the plugins unless parinfer can tell us a new cursor pos

eraserhd04:11:40

Are :cursor-line and :cursor-x zero-based or ones-based? Also, is there a way to get "useful tab positions" for indenting existing code?

snoe04:11:09

@eraserhd: they are zero based

shaunlebron04:11:29

@eraserhd: yeah sorry, just updated the docstrings to specify that

snoe04:11:10

I'm still thinking about pasting forms into existing forms - I think you almost certainly want to be in paren-mode so it autoaligns

shaunlebron04:11:38

that’s something I’ve been meaning to add a section to the website to explore

snoe04:11:00

but i've thought the same thing about tab stops

snoe04:11:26

hey @shaunlebron what are we supposed to do if :valid? is false?

shaunlebron04:11:45

I think you’re right about paren mode for auto-aligning

shaunlebron04:11:12

pasting code with unbalanced parens is something I have to think about though

shaunlebron04:11:26

not sure what you mean by tab stops

shaunlebron04:11:15

if :valid? is false, the :text will just be what you passed to it, to reflect the fact that there was no processing done

shaunlebron04:11:41

I haven’t thought about this enough for state caching, but I’m currently not passing invalid states to format-text-change if :valid? is false

snoe04:11:35

thanks, I've been meaning to ask - I've been saving the state and printing a log message but I think that an invalid state is actually ok

snoe04:11:45

as in, it's expected

shaunlebron04:11:00

because there’s no point in state caching if the processor messed up along the way, corrupting the state...

shaunlebron04:11:45

invalid state is expected in Indent Mode when strings are unclosed

shaunlebron04:11:03

and expected in Paren Mode when strings are unclosed or parens imbalanced

snoe04:11:41

in vim autoindent actually would work but I need to use the indentations rules from vim-clojure-static so my code matches teammates' emacs indents. I'm not sure if plugins or parinfer should be able to define these kind of options for indentation https://github.com/guns/vim-clojure-static#indent-options

shaunlebron04:11:47

not sure how we would mix the two

shaunlebron04:11:39

it seems like pressing enter has to follow one rule or the other

snoe05:11:26

yeah, i agree about pressing enter, but having 1 or 2 space tabs stops after aligning is the important part there

shaunlebron05:11:46

oh okay, so autoindent when pressing enter, but vim-clojure-static for aligning selections

shaunlebron05:11:34

I have to head out now. thanks for bringing this issue up, it’s something we definitely need to address!

dominicm09:11:16

@snoe yypDa seems to work, I just discovered that I can turn off syntax indentation for clojure, and then enable autoindent (seems to be disabled, perhaps by setting indentexpr?)

dominicm10:11:50

@snoe to clarify, I mean this:

autocmd Filetype clojure set indentexpr=
autocmd Filetype clojure set autoindent

onetom18:11:17

does anyone have an example screen recording of how are you using parinfer? the indentation doesn't work as my gut feeling dictates and i found myself thinking about whether should i switch between paren and indent modes, so i feel if i could observe someone using it, i would understand this whole concept better.

shaunlebron18:11:59

the website has most use cases recorded, those that i could think of anyway

shaunlebron18:11:46

indent mode is most used. paren mode is mainly just for fixing indentation of files

shaunlebron18:11:21

i am away from my computer, but if you record yourself working through it and coming across unintuitive cases, that would be a big help

shaunlebron18:11:47

@chrisoakman: want to record yourself working in atom?

chrisoakman19:11:54

not particularly 😉

chrisoakman19:11:18

but I remember having a few situations when I was first learning it that seemed counter-intutive

chrisoakman19:11:35

you remember when I kept telling you there were bugs?

snoe19:11:41

I'm probably not going to do a recording, but the biggest approach I needed to change from paredit is to type first without worrying about slurping or barfing and then align afterwards. typing (let [foo bar is kind of great

chrisoakman19:11:27

yeah - I've never used Paredit

chrisoakman19:11:46

so I never had to "relearn" anything

chrisoakman19:11:13

I do tend to just type out the expressions I want and then fix indentation after if it's not correct

chrisoakman19:11:30

I have a pretty strong association in my mind between expression intent and indentation

snoe19:11:11

I only have indent-mode in the vim plugin right now and I think I only really miss paren-mode when pasting

snoe19:11:46

if i want to wrap a form i start a new line above it type out the wrap and then select the form and indent it to slurp.

snoe19:11:03

@onetom: any other places where your gut objects?

dominicm19:11:25

@snoe I've not had any problem when pasting yet. I just have to match the indent (Using >) and it all just works.