This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-25
Channels
- # admin-announcements (3)
- # beginners (165)
- # boot (123)
- # cider (106)
- # clara (1)
- # cljsrn (20)
- # clojure (199)
- # clojure-canada (2)
- # clojure-dev (3)
- # clojure-poland (29)
- # clojure-russia (7)
- # clojure-taiwan (2)
- # clojurescript (487)
- # cursive (25)
- # datavis (89)
- # datomic (26)
- # gorilla (2)
- # hoplon (15)
- # ldnclj (12)
- # lein-figwheel (9)
- # leiningen (2)
- # liberator (1)
- # off-topic (25)
- # om (380)
- # onyx (26)
- # parinfer (52)
- # portland-or (12)
- # re-frame (28)
- # reagent (132)
@snoe @dominicm I think I’m going to forgo that responsibility to individual plugins
at least until Parinfer returns cursor information, which it doesn’t currently
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
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
@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
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?
@eraserhd: yeah sorry, just updated the docstrings to specify that
I'm still thinking about pasting forms into existing forms - I think you almost certainly want to be in paren-mode so it autoaligns
that’s something I’ve been meaning to add a section to the website to explore
hey @shaunlebron what are we supposed to do if :valid?
is false?
I think you’re right about paren mode for auto-aligning
pasting code with unbalanced parens is something I have to think about though
not sure what you mean by tab stops
if :valid?
is false, the :text
will just be what you passed to it, to reflect the fact that there was no processing done
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
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
because there’s no point in state caching if the processor messed up along the way, corrupting the state...
sorry, brb
invalid state is expected in Indent Mode when strings are unclosed
and expected in Paren Mode when strings are unclosed or parens imbalanced
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
not sure how we would mix the two
it seems like pressing enter has to follow one rule or the other
yeah, i agree about pressing enter, but having 1 or 2 space tabs stops after aligning is the important part there
oh okay, so autoindent
when pressing enter, but vim-clojure-static
for aligning selections
following either of these for alignment would be fine too https://github.com/bbatsov/clojure-style-guide or https://github.com/weavejester/cljfmt
@snoe: tracking this here: https://github.com/shaunlebron/parinfer/issues/59
I have to head out now. thanks for bringing this issue up, it’s something we definitely need to address!
@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
?)
@snoe to clarify, I mean this:
autocmd Filetype clojure set indentexpr=
autocmd Filetype clojure set autoindent
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.
the website has most use cases recorded, those that i could think of anyway
indent mode is most used. paren mode is mainly just for fixing indentation of files
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
@chrisoakman: want to record yourself working in atom?
not particularly 😉
but I remember having a few situations when I was first learning it that seemed counter-intutive
you remember when I kept telling you there were bugs?
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
yeah - I've never used Paredit
so I never had to "relearn" anything
I do tend to just type out the expressions I want and then fix indentation after if it's not correct
I have a pretty strong association in my mind between expression intent and indentation
I only have indent-mode in the vim plugin right now and I think I only really miss paren-mode when pasting