Fork me on GitHub
#vim
<
2019-05-22
>
dharrigan09:05:44

@defndaines btw, for vim, you can enter :ALEInfo to see what Ale has configured for the clj file (and to see which linter is being used, and how it is invoked)

defndaines15:05:22

Nice. thanks.

Current Filetype: clojure                                                                                              
Available Linters: ['clj-kondo', 'joker']                                                                               
  Enabled Linters: ['clj-kondo', 'joker']
… so confirms that no need to specifically enable it.

dharrigan09:05:35

What's the view on aligning map values, i.e., this

dharrigan09:05:39

(def my-map {:a "A value"
             :blarg :another-value
             :foo {:test "A nested map"
                   :c :d}})

dharrigan09:05:50

(def my-map {:a     "A value"
             :blarg :another-value
             :foo   {:test "A nested map"
                     :c    :d}})

Olical09:05:36

I've never really seen it done. (personally)

dharrigan09:05:56

(in cursive, the later is the default)

dharrigan09:05:14

I can sorta see it make sense, if you have, for example, a large edn file with lots of sub maps

dharrigan09:05:24

aligning, makes it easier to read imho

dharrigan09:05:06

Perhaps I'll ask in another channel... πŸ™‚

dominicm09:05:51

the latter is very annoying and I hate it

πŸ‘† 8
mynomoto11:05:57

I used to really dislike the latter because of diffs but I think it is easier to read an zprint can do that for you on vim. So now I use it all the time :man-shrugging::skin-tone-2:

dharrigan11:05:31

@mynomoto which formatter are you using in vim to do that?

dharrigan11:05:43

(I too, am leaning towards the latter)

mynomoto11:05:08

zprint with some configuration. I use it as a filter.

Olical15:05:59

Think you mentioned that you use Conjure or did at some point? I'm planning on adding zprint formatting to Conjure either on a mapping or on file write soon, does it work well for you? (as in, does zprint give you nice output or do you think something else would be better)

mynomoto17:05:37

So zprint has lots of corner cases that we solve using configuration or skipping some forms. I don't think it can be used without lots of specific configuration. I will try to compile clj-fmt with graalvm (which people have done in the past) and see if it works better out of the box. Formatting macros is a problem in general, so schema.core/defn, clojure.test/are, everything that needs tripplets in a single line cannot be formatted with zprint. Also there are some performance issues for forms with lots of nesting, we had a namespace that was taking more than 5 minutes to be formatted and in the end I just put directives to skip most of the forms there.

dave15:05:35

i align obsessively

dave15:05:44

i've noticed some of my coworkers do, some don't

dave15:05:26

i will concede that aligning is particularly annoying if there is one key that is way longer than the others

dave15:05:09

i.e.

{:foo 1
 :bar 2
 :baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz 3
 :quux 4}
vs.
{:foo                                      1
 :bar                                      2
 :baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz 3
 :quux                                     4}

βž• 4
dave15:05:24

i usually feel bad about doing the latter thing there

dominicm15:05:29

Clearly the problem is assuming hard rules :)

dave15:05:49

you're right. i'm trying to teach myself to be more flexible about alignment

dominicm15:05:55

I'm sure you could come up with some rules of variance that are aesthetically pleasing.

dominicm15:05:04

Then write davefmt

dave15:05:31

ha! πŸ™‚

dave15:05:47

the world isn't ready for davefmt. i'm pretty sure no one likes it but me

dave15:05:32

one of my rules is that lines should be no longer than 80 characters, always, unless there is a technical reason why that isn't possible (which is rare)

dave15:05:41

while we're talking about this: i started using Go recently for a hobby project, and i've found myself pleasantly surprised by it in a number of ways

dave15:05:50

one of which is that i actually really like not having to worry about formatting

dave15:05:07

gofmt doesn't format code at all like i would, but the fact of the matter is that i don't have a choice, and that fact is liberating

dominicm15:05:55

I've seen a project use str to join long strings because 80 char limit

dave15:05:11

lol, i do that all the time πŸ˜…

dave15:05:35

i realize it's inefficient, but clojure doesn't give you any other way to break up long strings across multiple lines

Olical15:05:54

Elm format is also fantastic!

defndaines15:05:19

My rule for formatting is that it has to be automatic and automatic across the team … so if someone wants a particular format, they have to provide everyone (vim, emacs, Cursive, etc.) with the tools that don’t force anyone to have to think about it.

dave15:05:33

i like that, that's a good rule

snoe15:05:56

right, and some editors are less customizable than others so formatting for a team, I think, should fall to whatever is easiest across editors.

Olical16:05:40

Or have an editor agnostic approach, like running zprint (or whatever you want) on the files involved in git diffs.

dharrigan16:05:47

We have a 256 char limit per line

dave17:05:02

lol, does everyone have a widescreen monitor to go along with the limit? trollface

dharrigan18:05:51

well, normal

dharrigan18:05:07

I think the min res is 2560

dharrigan18:05:26

It's been a long, long long time when I had to contend with an 80 char limit on a screen

dominicm18:05:11

Try diff view

dharrigan18:05:28

Seems to work well - use vim diff a lot

dave18:05:37

80 characters is about half the width of my laptop screen

dominicm18:05:36

My eyes aren't so good, so I have to bump the font size, eats into how much real estate I get on 13"

truestory 4
πŸ‘ 4