Fork me on GitHub
#vim
<
2019-06-06
>
dharrigan07:06:55

Does anyone use ctags with clojure?

Olical08:06:15

Haven't ever tried but looks like some people have worked some stuff out already https://gist.github.com/vladh/1e1e7bc5eb274235e0b9 I would imagine it wouldn't play well with things like macros.

dharrigan09:06:33

actually, got it to work, universal ctags (the successor to ctags) has clojure built-in

dharrigan09:06:41

and vim tagbar understands clojure tags

dharrigan09:06:44

so together they work

dharrigan09:06:00

unfortunate vim tagbar doesn't support kotlin yet....

Olical09:06:13

Oh sweet! I have a friend that swore by it for Python. I'm just trying to get "go to definition" so robust that I wouldn't need to rely on anything static.

💯 4
dave11:06:34

I've been using ctags for Clojure for a couple years or so. It's been my go-to way to jump to definition, in the absence of tools that can do that via static analysis (although now there is clojure-lsp and maybe others)

dave11:06:59

Tagbar is also awesome, although I've had trouble getting it to work with universal ctags

dave11:06:39

I found https://github.com/liuchengxu/vista.vim which is a replacement for tagbar that integrates with LSP and does things async. It's a little rough around the edges, but overall quite nice

dave11:06:14

@dharrigan I recently configured ctags to support Kotlin. I have ctags config for Clojure and Kotlin here, feel free to steal it! https://github.com/daveyarwood/dotfiles/tree/master/ctags

dharrigan11:06:31

I think ctags supports clojure ootb now (at least universal ctags does)

dharrigan11:06:34

% ctags --list-languages
Ada
AnsiblePlaybook
Ant
Asciidoc
Asm
Asp
Autoconf
AutoIt
Automake
Awk
Basic
BETA
C
C#
C++
Clojure
..

dharrigan11:06:47

howver, let me add in your little kotlin goodness to see how that works 🙂

dave11:06:11

It does, but I added some additional definitions like Boot deftask and Hoplon defelem

dharrigan11:06:18

ahhh, gotcha 🙂

dharrigan11:06:06

Do you get this warning?

dharrigan11:06:09

% ctags --list-languages
ctags: Warning: Don't reuse the kind letter `c' in a language kotlin (old: "classes", new: "data classes")
ctags: Warning: Don't reuse the kind letter `r' in a language kotlin (old: "co", new: "va")
ctags: Warning: Don't reuse the kind letter `p' in a language kotlin (old: "packages", new: "imports")

dharrigan11:06:14

(with your kotlin stuff added in)

dave11:06:52

I haven't seen that, although I never run ctags manually so maybe I would see it if I did

dharrigan11:06:16

btw, this line can be condensed to

dharrigan11:06:25

--langmap=kotlin:.kt.kts

dharrigan11:06:37

no need for two langmaps 🙂

dave11:06:59

Ah, nice. Thanks!

dharrigan11:06:07

took me ages to work that out

dharrigan11:06:12

it says in the docs, that it's a list

dharrigan11:06:18

so naturally I tried "," first then " "

dharrigan11:06:25

how else would you write a list?

dharrigan11:06:36

noooo, no separator, jujst put them all together....

dave11:06:40

Yeah, "" being the separator is not at all intuitive! Lol

dharrigan11:06:57

I'm spoilt by clojure 🙂

dave11:06:20

Hopefully we never need to define a langmap for e.g. .cljs.hl