This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-22
Channels
- # announcements (6)
- # babashka (8)
- # beginners (136)
- # cider (5)
- # cljs-dev (1)
- # cljsrn (1)
- # clojure (198)
- # clojure-argentina (4)
- # clojure-australia (1)
- # clojure-europe (25)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-poland (1)
- # clojure-spec (4)
- # clojure-uk (4)
- # clojuredesign-podcast (4)
- # clojurescript (36)
- # conjure (11)
- # data-science (1)
- # datomic (6)
- # defnpodcast (1)
- # deps-new (5)
- # emacs (7)
- # events (1)
- # fulcro (10)
- # graalvm (9)
- # graalvm-mobile (10)
- # helix (9)
- # introduce-yourself (1)
- # jackdaw (1)
- # jobs-discuss (5)
- # kaocha (6)
- # lsp (10)
- # malli (11)
- # missionary (28)
- # off-topic (2)
- # pathom (24)
- # pedestal (7)
- # portal (1)
- # re-frame (12)
- # reagent (2)
- # reitit (1)
- # remote-jobs (1)
- # sci (7)
- # shadow-cljs (6)
- # sql (6)
- # tools-deps (10)
- # vim (9)
- # xtdb (19)
Hello, I am having trouble getting syntax highlighting for function calls in Neovim. Any functions I defined myself, or imported (like string/split), do not get highlighted, even though they are the first item after an open parens.
First I tried everything according to this article: https://oli.me.uk/getting-started-with-clojure-neovim-and-conjure-in-minutes/ and still didn't get full highlighting, so then I tried fireplace + vim-clojure-highlight, but still the same problem persists. My current init.vim is here: https://gist.github.com/APB9785/32b7d28cfbe2272dd425d714a0ffdaec
inline function calls are missing from the current vim-clojure-highlight, and i haven’t tried to upstream my changes:
syntax keyword clojureSpecial clojure.core/fn fn nextgroup=clojureFunction skipwhite
syntax keyword clojureDefine clojure.core/defn clojure.core/defn- defn defn- nextgroup=clojureFunction skipwhite
syntax match clojureFunction "\%(\%(defn\|defn-\|fn\)\s*\)\@<=\h\k\+" contained
syntax match clojureInlineFunction "\v\(@<=%([a-zA-Z!$&*_+=|<.>?-]|[^\x00-\x7F])+%(:?%([a-zA-Z0-9!#$%&*_+=|'<.>/?-]|[^\x00-\x7F]))*[#:]@1<!"
syntax cluster clojureTop remove=clojureDefine,clojureFunction,clojureSpecial
syntax cluster clojureTop add=clojureDefine,clojureFunction,clojureInlineFunction,clojureSpecial
highlight default link clojureFunction Function
highlight default link clojureInlineFunction Function
highlight default link clojureFunc Type
i put that in ~/.vim/after/syntax/clojure.vim
, so regardless of what other plugins i have set up, it’ll do that last
now, that changes the color of built-in/standard library functions to something else, so if you don’t want that, remove the last line lol
Also since youre on Neovim 0.5+, might be worth to look into treesitter and lua based config and highlighting. Here is my lua based config using conjure, treesitter and LSP: https://github.com/lispyclouds/dotfiles These give you much nicer, more semantic highlights. Also the LSP would give you the IDE like abilities too
Just in case you weren't ware, you can also turn on treesitter support for Conjure evals. It's experimental and I'm looking for testers! Have a search through :h conjure
for treesitter
, it should select the right code (with a LOT LOT LOT less CPU cycles) and eval it as you'd expect when enabled.