vim

For discussion on all things (neo)vim.
martinklepsch 2019-11-20T00:30:36.434200Z

@dominicm Agree that tree-sitter is super interesting! And also all the Lua stuff is super cool, Lua is a really fun (and weird). I think for the tree-sitter grammer stuff you wouldn’t need Lua though since it just takes some JSON as input for the parser? Could totally be missing the point here πŸ˜…

2019-11-20T00:35:18.434700Z

fennel looks fun too

martinklepsch 2019-11-20T00:38:05.436300Z

Yeah, sooo much! I’ve used it to write a toy-ish CLI time tracker, getting back that REPL really unblocked my Lua learning at that point πŸ˜„

martinklepsch 2019-11-20T00:39:41.437300Z

With all the Neovim Lua support it could be really cool, seems @olical is even playing around with Fennel/Lua in Conjure https://github.com/Olical/conjure/commits/master

2019-11-20T00:51:48.439200Z

cool! yeah, i have my fingers crossed that Olical's fennel / conjure efforts work out.

Olical 2019-11-20T09:28:49.472800Z

Cc @martinklepsch My Fennel project that I'll use to rewrite my Neovim config as well as Conjure's Lua and VimL is coming along nicely. I've got a lovely train ride up from London to Edinburgh this Friday to get that sorted and write a post up. Focusing on "replace all viml and lua with a Lisp" for now, then it'll grow into conjure. The plugin / library I'm building is called aniseed. It makes compiling directories of fennel to Lua ahead of time when they change (for your dotfiles) easy, as well as providing mappings for evaluating ranges / selections / motions / files. Conjure plugins will then be a nice mix of Clojure that hooks into Conjure's JVM as well as fennel that gets compiled for you. Fun times ahead! I think this side track or language experimentation will pay off massively in future changes to conjure. I've been shying away from fancier UI features because I don't feel comfortable solving things in viml or Lua.

2019-11-20T14:44:19.476800Z

thanks for the update! hope you have a productive ride πŸ™‚

dominicm 2019-11-20T00:52:04.439500Z

I'm just thinking about getting something now, rather than later

dominicm 2019-11-20T00:52:12.439900Z

lpeg can parse clojure/core.clj in 20ms

dominicm 2019-11-20T00:52:20.440200Z

just checking that in luajit

2019-11-20T00:53:19.441200Z

wow, that's pretty nice -- i test with clojure/core.clj as my "biggest" clojure file for a program that uses rewrite-clj, and i can definitely feel its weight there.

dominicm 2019-11-20T00:54:11.441400Z

yeah, exactly

dominicm 2019-11-20T00:54:23.441600Z

I'd prefer it to be closer to 5ms

2019-11-20T00:55:18.442300Z

i haven't found much that comes close to the size of clojure.core -- do you come across that much that's similar in size?

dominicm 2019-11-20T00:56:31.442800Z

sometimes πŸ™‚

2019-11-20T00:57:00.443400Z

i guess i'd better go searching for more data

dominicm 2019-11-20T01:00:39.444500Z

luajit is 12ms

dominicm 2019-11-20T01:00:52.444800Z

@sogaiu depends on your tool's purpose.

dominicm 2019-11-20T01:01:12.445600Z

I was thinking of using this for highlighting, so it needs to be fast.

2019-11-20T01:01:34.446100Z

my current use case is invocation from an editor -- doing things like detecting the expression around or to the left of the cursor

2019-11-20T01:02:22.446600Z

if you have to do the whole buffer, i guess it would have to be fast

dominicm 2019-11-20T01:02:22.446700Z

oh, same thing then πŸ˜„

2019-11-20T01:02:26.446900Z

lol

dominicm 2019-11-20T01:02:28.447100Z

oh, maybe not.

dominicm 2019-11-20T01:02:39.447400Z

what do you do with the detected expression?

2019-11-20T01:02:57.447800Z

the idea is to allow editors to not have to reimplement all of this type of functionality

2019-11-20T01:03:21.448300Z

provide pieces that can be built upon so behaviors can be consistent

dominicm 2019-11-20T01:03:36.448500Z

what type of functionality πŸ™‚

2019-11-20T01:03:56.448900Z

find an appropriate ns, detect expression, find close top-levels, etc.

2019-11-20T01:04:09.449400Z

these things vary across editors

dominicm 2019-11-20T01:04:24.450100Z

so, to find the close top-level you need the whole buffer right?

2019-11-20T01:04:32.450400Z

almost

2019-11-20T01:04:46.450800Z

i have a hack that may make it a bit less -- though i have no proof that it works in general

2019-11-20T01:05:04.451200Z

ah actually, that's for detecting the expression -- not the top-level

2019-11-20T01:05:11.451500Z

you're right, you need the whole darn thing

2019-11-20T01:05:42.451700Z

so it does need to be fast

2019-11-20T01:06:20.452200Z

but typical clojure source files don't seem to be that large

2019-11-20T01:06:29.452600Z

at least for what i've tested on, it doesn't seem too bad

dominicm 2019-11-20T01:06:34.452700Z

now I'm curious to find the largest file I have

2019-11-20T01:07:34.453800Z

didn't someone recently fetch some significant portion of clojars (or was it metadata of clojars)?

dominicm 2019-11-20T01:08:06.454Z

42415

dominicm 2019-11-20T01:08:16.454500Z

I may have figured out how that is done, yeah

dominicm 2019-11-20T01:08:23.454800Z

rsync usage is unmetered on clojars, so go crazy

dominicm 2019-11-20T01:08:32.455Z

that is, 42415 loc

2019-11-20T01:08:42.455400Z

oooh

dominicm 2019-11-20T01:08:54.455800Z

http://github.com/clojure/clojurescript/src/main/cljs/cljs/core.cljs is the second biggest file though

2019-11-20T01:09:06.456100Z

clojure/core.clj is a measly 7892 loc

dominicm 2019-11-20T01:09:26.456300Z

11720 in core.cljs

2019-11-20T01:09:46.456500Z

he he -- you are up-to-date πŸ™‚

2019-11-20T01:09:49.456700Z

i had to pull

2019-11-20T01:10:05.457200Z

thing is, how typical is that?

dominicm 2019-11-20T01:10:23.457500Z

I jump to source into these files

dominicm 2019-11-20T01:10:43.458200Z

the 42k is pretty extreme tbh, I was surprised to find that

2019-11-20T01:11:01.458800Z

yes, i do jump-to-source in my deps too -- but i rarely eval expressions

dominicm 2019-11-20T01:11:15.459Z

woah, vis, an editor which uses lpeg for higlighting. Makes mince meat out of that 42k loc file

dominicm 2019-11-20T01:11:30.459300Z

ha, but it's highlighting does not handle unicode properly

dominicm 2019-11-20T01:12:04.460200Z

~/src                                                                 0.94s 01:09:11
❯ tokei **/*.clj{,s,c}               
-------------------------------------------------------------------------------
 Language            Files        Lines         Code     Comments       Blanks
-------------------------------------------------------------------------------
 Clojure              5882       743420       619406        37019        86995
 ClojureC             1505       517672       421894        33381        62397
 ClojureScript        4552      1487768      1233528        50189       204051
 Dockerfile              1            5            4            0            1
 Edn                     2           31           25            6            0
-------------------------------------------------------------------------------
 Total               11942      2748896      2274857       120595       353444
-------------------------------------------------------------------------------
That took a while to run

2019-11-20T01:12:04.460300Z

i've given up for the moment on highlighting of large files -- try opening a clj-kondo analysis file for a project and its deps some time πŸ™‚

dominicm 2019-11-20T01:12:36.460700Z

I think this 42k loc file might be generated. It's a list of place names in the UK.

2019-11-20T01:12:43.460900Z

ahhhh

2019-11-20T01:14:29.461500Z

nice, didn't know about tokei

2019-11-20T01:18:16.462700Z

(that's an odd name -- the characters and pronunciation used at the repository readme are for "clock" (at least in japanese), but if you change the name slightly it would have been "statistics"...strange)

2019-11-20T01:20:02.463300Z

i don't have even a tenth -- though i don't think it's counting correctly:

$ tokei **/*.clj{,s,c}
-------------------------------------------------------------------------------
 Language            Files        Lines         Code     Comments       Blanks
-------------------------------------------------------------------------------
 Clojure               299        20633        16013         1744         2876
 ClojureC                8          772          532           50          190
 ClojureScript           1            2            2            0            0
-------------------------------------------------------------------------------
 Total                 308        21407        16547         1794         3066
-------------------------------------------------------------------------------

2019-11-20T01:20:54.463600Z

$ find | grep \\.cljs$ | wc -l
13183

dominicm 2019-11-20T01:21:16.464Z

I have a lot of code. Mine includes a lot of stuff in target folders.

dominicm 2019-11-20T01:21:35.464200Z

oh, lpeg is included with neovim now

2019-11-20T01:21:56.464500Z

hurray for built-in goodies πŸ™‚

2019-11-20T01:22:26.464700Z

$ find | grep \\.cljc$ | wc -l
2733

2019-11-20T01:22:35.465Z

may be i'm not invoking tokei correctly?

2019-11-20T01:22:45.465200Z

$ find | grep \\.clj$ | wc -l
15712

dominicm 2019-11-20T01:24:30.465500Z

might be to do with shell settings not expanding the same way mine does

dominicm 2019-11-20T01:24:40.466Z

it's possible I have something turned on especially

2019-11-20T01:25:00.466300Z

may be so -- will try the default invocation

2019-11-20T01:25:53.466700Z

-------------------------------------------------------------------------------
 Language            Files        Lines         Code     Comments       Blanks
-------------------------------------------------------------------------------
 Clojure              6835      1275323      1019262        92211       163850
 ClojureC             1692       308692       250172        17327        41193
 ClojureScript        8471      2162893      1864853        70179       227861
-------------------------------------------------------------------------------

2019-11-20T01:26:10.467Z

totals are off -- because i just kept 3 rows

2019-11-20T01:26:47.467600Z

this includes duplicates though -- so unless tokei prunes, the numbers are inflated

dominicm 2019-11-20T01:33:03.467800Z

yeah, same as mine, inflated πŸ™‚

dominicm 2019-11-20T01:33:20.468Z

it's just fun really πŸ™‚

2019-11-20T01:37:32.468200Z

indeed!

dominicm 2019-11-20T01:41:52.468500Z

@martinklepsch https://neovim.io/doc/user/lua.html looks like treesitter uses .so files, so a C api?

dominicm 2019-11-20T01:42:19.468800Z

the treesitter nvim api, is exposed via the built-in lua engine

dominicm 2019-11-20T01:47:00.469100Z

https://github.com/neovim/neovim/pull/11113 I didn't notice the "and highlighting"

heefoo 2019-11-20T05:21:11.469300Z

heh. That was mine, it was like 2 years ago or something

martinklepsch 2019-11-20T08:56:57.472Z

Yeah I guess it’s both in the end. What I was thinking is that you can write grammars in any language as the canonical format they are described in is JSON. How you then interact with tree sitter is probably a different thing, C or Lua as you said.

dominicm 2019-11-20T10:09:17.474600Z

I'm not sure if it is json or not. The above seems to imply that a .so is produced to represent the parser. I'm guessing that atom is just using some API to create the parser from json.

dominicm 2019-11-20T10:20:48.474900Z

https://tree-sitter.github.io/tree-sitter/creating-parsers maybe they're doing on the fly compilation? nodejs is a dependency for developing a new parser. tree-sitter converts javascript into a C parser, and then compiles that.

sheluchin 2019-11-20T12:14:15.476200Z

I'm finding vim-fireplace is constantly timing out and requiring me to restart the server and reconnect to cljs. I'm using it with Fulcro 3. Anyone else getting this behaviour?