Fork me on GitHub
#vim
<
2019-02-04
>
zyxmn09:02:16

Woop , lots of Color options to try :D

Noah Bogart18:02:08

i have something of an interesting question for y'all: i currently use the vim-clojure-static syntax file, but I've modified it to highlight all function calls and function definitions as functions. To do so, I had to remove the Sexp understanding and the superfluous parens/bracket/braces checking

Noah Bogart18:02:32

Looking back over it, I feel like there's gotta be a way to combine these. It's really helpful to me to highlight function calls (that is, any string immediately after an open parenthesis), but I don't want to lose out on the other features

Noah Bogart18:02:04

I've written it like this:

" Inline functions must defined first, so all other matches overwrite
syn region Paren transparent start='(' end=')'
syn match clojureInlineFunction "(\@<=\K\k\+" contains=Paren
syn match clojureParen "[()\[\]{}]"

Noah Bogart18:02:24

Any syntax highlighting wizards in here?

dominicm19:02:46

I don't really understand what you're doing, hi link is what you want I think

Noah Bogart19:02:47

sure, hi link is what I want to do at the end, but I have to match on a sequence of character to highlight those first

Noah Bogart19:02:10

the goal is to match against \K\k+ immediately after a parenthesis without overwriting the match against clojureParen

dominicm19:02:24

Does \zs help?

Noah Bogart19:02:48

not quite, but I think I solved it. Here we find the issue of doing something early last year and only now thinking "Why did I do that?" and then stumbling on the easy answer, lol

Noah Bogart19:02:21

For some reason, last year when I tried this I struggled with matching against the function name after the parenthesis without matching against the parenthesis. I solved this by removing the clojureSexp and clojureSymbol matching

Noah Bogart19:02:53

Turns out what I'm looking for is as "easy" as: syntax match clojureInlineFunction "(\@<=\v%([a-zA-Z!$&*_+=|<.>?-]|[^\x00-\x7F])+%(:?%([a-zA-Z0-9!#$%&*_+=|'<.>/?-]|[^\x00-\x7F]))*[#:]@<!" immediately after the clojureSymbol definition

Noah Bogart19:02:40

it sadly reuses the expensive regex, so if anyone knows how to embed the clojureSymbol match into a match against open parens, I'm all ears