AFAICT, parinfer-jvm has not been uploaded to clojars yet. Is it nascent? Should I use cross-parinfer?
I haven’t deployed it to clojars partly out of laziness and also because you’ll probably double the number of users if you use it 🙂
It looks like org.clojars.oaks/parinfer is the most recent version.
Welp, got a super-basic thing working, though not in the right way.
Next week or so: add modes and a hook for modifying all changes to a file.
Then, get the real thing working.
Hi, @snoe . Will this be considered about?
https://github.com/clojure-vim/nvim-parinfer.js/issues/22
each >>
will change the struct of sexp, but we may want the correct indentation instead of the minimal indentation after >>
operation.
If we have:
(str "hello")
"world"
after >>
on line 2, we probably want:
(str "hello"
"world")
instead of
(str "hello"
"world")
@doglooksgood I've been thinking about this, I feel the answer is to use a formatting plugin like clojure-static or clj-fmt after indenting and add do a =-
(for instance) after indenting . However, I tried doing this, and it's difficult to do because of the way nvim-parinfer.js is mapping >>
(you can't map a map).
when doing (`>>` or >
with multiple lines), saving the begin line number
and end line number
. after >>
, use =
to format this lines. is it possible?
i'm not familiar with vim script. or you means the difficult stuff is how to map keys?
I don't think so, I believe with parinfer you pretty much always want to indent at the top level. (again, I haven't touched it for awhile)
yeah the plugin makes it difficult to map because vimrc stuff is run before plugins
and would overwrite your mapping.
luckily vim-sexp has =-
I didn't know that vim-sexp has =-
, with this shortcut i can quick indent top level manaully. it's still convenient.
Hrmm
wrt nvim-parinfer.js
, I'd like to figure out how to make it stop touching files that I open.
I guess the place to start is looking at https://github.com/clojure-vim/nvim-parinfer.js/blob/master/plugin/parinfer.vim#L22 and figure out if lines
differ from :echo getline(1,'$')
looking.
Just got familiar with the plugin code. Let me see if I can make a small test case first, though.
Hrmm, it kept happening when pairing today, but the only file it's happened on right now was literrally wrongly indented.
https://github.com/clojure-vim/nvim-parinfer.js/blob/master/src/nvim_parinfer/main.cljs#L42 I wonder if it's line endings, since vim doesn't give me those
Oh, that'd be interesting.
I don't have any CRs in any source files.
find src test dev -name '*.clj*' -type f -exec nvim -c :wq {} \;
🙂
yup that did it. Lots of stuff like this:
diff --git a/src/twou/centralpark/devcards.cljs b/src/twou/centralpark/devcards.cljs
index 0d81853..de0ec23 100644
--- a/src/twou/centralpark/devcards.cljs
+++ b/src/twou/centralpark/devcards.cljs
@@ -1,8 +1,8 @@
(ns twou.centralpark.devcards
- (:require
- [twou.centralpark.devcards.domain]
- [twou.centralpark.devcards.workflow]
- [devcards.core :as dc :include-macros true]))
+ (:require
+ [twou.centralpark.devcards.domain]
+ [twou.centralpark.devcards.workflow]
+ [devcards.core :as dc :include-macros true]))
There's a lot of changes, but it looks like the changes are all either a) legitimate fixes, or b) dedenting the second line of the file (inside the ns directive) by one.
Some nses have docstrings, some don't.
I wonder if you pass the text through https://github.com/shaunlebron/parinfer/blob/master/lib/parinfer.js#L883 you still get the dedent
I'm going to bet so. Not sure I have time tonight, but I'll try it.
well, I'll bet my code's wrong, not shaun's 😛
ha, it does it with nvim-parinfer.js's project.clj.
The debug log. https://gist.github.com/eraserhd/df006649e34178cbac45901e1392523e
Here's the simplest example: https://gist.github.com/eraserhd/4d35251bb1f64d8a05fd983363fe765d
looks like i'm passing a negative cusrorDx
> parinfer.parenMode('(ab\n :q)', {cursorX: 0, cursorDx: 0, cursorLine: 0})
{ text: '(ab\n :q)',
cursorX: 0,
success: true,
changedLines: [],
tabStops: [] }
> parinfer.parenMode('(ab\n :q)', {cursorX: 0, cursorDx: -6, cursorLine: 0})
{ text: '(ab\n :q)',
cursorX: 0,
success: true,
changedLines: [ { lineNo: 1, line: ' :q)' } ],
tabStops: [] }