Fork me on GitHub
#vim
<
2020-09-14
>
Freddy16:09:51

anyone has the * search working well while editing clojure files ? when I do * on a namespace name from the require list (aliased or not, let's pretend async), I'm always expecting my search to find every use of the name in the file, but I always get caught by the fact that it doesn't match things like async/go

nbardiuk16:09:10

I don't know if it helps but g* matches partial strings. This way it will match async/go but also any string that contains async

Freddy16:09:56

how do you guys do ?

nate16:09:48

when looking for symbols, I usually search for async\/

Freddy16:09:14

I end up doing that as well but... you know... 😕

Freddy16:09:57

like when you're cleaning up a bit your requires, you'd like to know if a namespace is used at all, a * won't do it for me which makes me sad

nate16:09:04

yeah, it's a bit annoying

nate16:09:25

ah, I started using clj-kondo via the ALE plugin and that helps me clean up my unused namespaces

Freddy16:09:49

oh yes, that could be a good workaround for me as well, thanks I'll give it a go

Freddy16:09:21

still I'll be happy to find a solution for the star search one day

dave16:09:49

clojure-lsp also provides warnings about unused namespaces. both solid options

borkdude16:09:36

@tedefump If you'd like to see where core.async is being used in your code base, you can use analysis output: https://github.com/borkdude/clj-kondo/tree/master/analysis There are some tools based on this for visualizing namespace/var dependencies: https://github.com/SevereOverfl0w/vizns https://github.com/benedekfazekas/morpheus

borkdude16:09:20

Another tool is https://github.com/borkdude/carve for discovering unused vars

borkdude16:09:16

Additionally vim-iced, a vim plugin also can use clj-kondo for discovering dependencies: https://twitter.com/uochan/status/1304916698827382784

Freddy16:09:29

there's no shortage of analysis tools 😄

Freddy16:09:56

my issue is more with editing/navigating, I navigate a lot by * in vim

Freddy16:09:08

but all these tools are still very useful, thanks for the tips

borkdude16:09:26

oh sorry, I might have misunderstood your issue then 😊

Freddy16:09:59

it's fine, I gave the example on unsused namespace but that wasn't the best example tbh

Freddy16:09:28

I think I'll still install clj-kondo

Freddy16:09:37

perfect, thanks a lot

dominicm16:09:59

Fyi, fireplace has fixed the error problem that's been on master for a while. Also :Stacktrace has been massively improved.

💪 3
noisesmith17:09:52

@tedefump just brainstorming for a moment: what about a key that took the last symbol searched for via * / # but then searched for only the part before the / if any?

noisesmith17:09:39

or expanded the search to include things that start with <sym>/if you were originally searching for <sym>

orestis17:09:54

I meant to figure that out to exclude colon and slash

noisesmith17:09:03

in a clojure mode, / should not be a word boundary

noisesmith17:09:41

commands built on "w" etc would be annoying otherwise

noisesmith17:09:06

but the intentional split on "/" in particular seems useful as an additional feature

orestis17:09:39

I wouldn’t mind making / a word boundary. But in any case you could write a command that temporarily changes the iskeyword setting when you press star. I’ll try that tomorrow.

noisesmith22:09:00

if I am on foo/bar, the intuitive thing is to search for foo/bar when using * and that's what the default clojure language def does. but yeah a prefix or modification does sound cool.