I've been trying to setup my Clojure dev environment with Vim, note that I'm still very new to vim but I've managed to know the basics. I've installed pathogen which has helped me get a bunch of plugins to work right off the bat. However I can't make vim-clojure-highlight to work, I've followed the README on the its repo, vim-clojure-static comes with vim as far as i know and fireplace is already installed as well.

I've made sure a repl session (boot repl) is running before opening a .clj file, I've also tried running :ClojureHighlightReferences manually within a buffer with a .clj file but still no success, this is how it looks like including clojure.core.async aliased as "async"

vim buffer with clojure file

Vim color pallete is solarized dark and I've also installed luochen1990/rainbow for parenthesis coloring. I noticed that the vim-clojure-highlight repo hasn't been updated in 6 years, is this still even usable? Currently I'm using vim version 8.1.2269 within Konsole on Kubuntu 20.04. Any help/advice is appreciated, thank you!

EDIT: this is the output for 'scriptnames':

  1: /usr/share/vim/vimrc
  2: /usr/share/vim/vim81/debian.vim
  3: /usr/share/vim/vim81/syntax/syntax.vim
  4: /usr/share/vim/vim81/syntax/synload.vim
  5: /usr/share/vim/vim81/syntax/syncolor.vim
  6: /usr/share/vim/vim81/filetype.vim
  7: ~/.vimrc
  8: ~/.vim/autoload/pathogen.vim
  9: /usr/share/vim/vim81/ftoff.vim
 10: ~/.vim/bundle/vial-http/ftdetect/vial-http.vim
 11: /usr/share/vim/vim81/syntax/nosyntax.vim
 12: /usr/share/vim/vim81/ftplugin.vim
 13: /usr/share/vim/vim81/indent.vim
 14: ~/.vim/bundle/vim-colors-solarized/colors/solarized.vim
 15: ~/.vim/bundle/lightline.vim/plugin/lightline.vim
 16: ~/.vim/bundle/nerdtree/plugin/NERD_tree.vim
 17: ~/.vim/bundle/nerdtree/autoload/nerdtree.vim
 18: ~/.vim/bundle/nerdtree/lib/nerdtree/path.vim
 19: ~/.vim/bundle/nerdtree/lib/nerdtree/menu_controller.vim
 20: ~/.vim/bundle/nerdtree/lib/nerdtree/menu_item.vim
 21: ~/.vim/bundle/nerdtree/lib/nerdtree/key_map.vim
 22: ~/.vim/bundle/nerdtree/lib/nerdtree/bookmark.vim
 23: ~/.vim/bundle/nerdtree/lib/nerdtree/tree_file_node.vim
 24: ~/.vim/bundle/nerdtree/lib/nerdtree/tree_dir_node.vim
 25: ~/.vim/bundle/nerdtree/lib/nerdtree/opener.vim
 26: ~/.vim/bundle/nerdtree/lib/nerdtree/creator.vim
 27: ~/.vim/bundle/nerdtree/lib/nerdtree/flag_set.vim
 28: ~/.vim/bundle/nerdtree/lib/nerdtree/nerdtree.vim
 29: ~/.vim/bundle/nerdtree/lib/nerdtree/ui.vim
 30: ~/.vim/bundle/nerdtree/lib/nerdtree/event.vim
 31: ~/.vim/bundle/nerdtree/lib/nerdtree/notifier.vim
 32: ~/.vim/bundle/nerdtree/autoload/nerdtree/ui_glue.vim
 33: ~/.vim/bundle/nerdtree/nerdtree_plugin/exec_menuitem.vim
 34: ~/.vim/bundle/nerdtree/nerdtree_plugin/fs_menu.vim
 35: ~/.vim/bundle/nerdtree/nerdtree_plugin/vcs.vim
 36: ~/.vim/bundle/paredit.vim/plugin/paredit.vim
 37: ~/.vim/bundle/rainbow/plugin/rainbow_main.vim
 38: ~/.vim/bundle/vial/plugin/vial.vim
 39: ~/.vim/bundle/vial-http/plugin/vial-http.vim
 40: ~/.vim/bundle/vim-clojure-highlight/plugin/vim_clojure_highlight.vim
 41: ~/.vim/bundle/vim-dispatch/plugin/dispatch.vim
 42: ~/.vim/bundle/vim-fireplace/plugin/fireplace.vim
 43: ~/.vim/bundle/vim-projectionist/plugin/projectionist.vim
 44: ~/.vim/bundle/vim-salve/plugin/salve.vim
 45: /usr/share/vim/vim81/plugin/getscriptPlugin.vim
 46: /usr/share/vim/vim81/plugin/gzip.vim
 47: /usr/share/vim/vim81/plugin/logiPat.vim
 48: /usr/share/vim/vim81/plugin/manpager.vim
 49: /usr/share/vim/vim81/plugin/matchparen.vim
 50: /usr/share/vim/vim81/plugin/netrwPlugin.vim
 51: /usr/share/vim/vim81/plugin/rrhelper.vim
 52: /usr/share/vim/vim81/plugin/spellfile.vim
 53: /usr/share/vim/vim81/plugin/tarPlugin.vim
 54: /usr/share/vim/vim81/plugin/tohtml.vim
 55: /usr/share/vim/vim81/plugin/vimballPlugin.vim
 56: /usr/share/vim/vim81/plugin/zipPlugin.vim
 57: ~/.vim/pack/tpope/start/fireplace/plugin/fireplace.vim
 58: /usr/share/vim/vim81/syntax/clojure.vim
 59: ~/.vim/bundle/rainbow/autoload/rainbow_main.vim
 60: ~/.vim/bundle/rainbow/autoload/rainbow.vim
 61: /usr/share/vim/vim81/ftplugin/clojure.vim
 62: /usr/share/vim/vim81/indent/clojure.vim
 63: ~/.vim/pack/tpope/start/fireplace/autoload/fireplace.vim
 64: ~/.vim/bundle/vim-projectionist/autoload/projectionist.vim
 65: ~/.vim/bundle/vim-salve/compiler/boot.vim
 66: ~/.vim/bundle/vim-clojure-highlight/autoload/vim_clojure_highlight.vim
 67: ~/.vim/bundle/lightline.vim/autoload/lightline.vim
 68: ~/.vim/bundle/lightline.vim/autoload/lightline/tab.vim
 69: ~/.vim/bundle/lightline.vim/autoload/lightline/colorscheme/default.vim
 70: ~/.vim/bundle/lightline.vim/autoload/lightline/colorscheme/powerline.vim
 71: ~/.vim/bundle/lightline.vim/autoload/lightline/colorscheme.vim
 72: /usr/share/vim/vim81/syntax/help.vim

'scriptnames' output after disabling all plugins except for fireplace:

  1: /usr/share/vim/vimrc
  2: /usr/share/vim/vim81/debian.vim
  3: /usr/share/vim/vim81/syntax/syntax.vim
  4: /usr/share/vim/vim81/syntax/synload.vim
  5: /usr/share/vim/vim81/syntax/syncolor.vim
  6: /usr/share/vim/vim81/filetype.vim
  7: ~/.vimrc
  8: ~/.vim/autoload/pathogen.vim
  9: /usr/share/vim/vim81/ftoff.vim
 10: /usr/share/vim/vim81/syntax/nosyntax.vim
 11: /usr/share/vim/vim81/ftplugin.vim
 12: /usr/share/vim/vim81/indent.vim
 13: ~/.vim/bundle/vim-clojure-highlight/plugin/vim_clojure_highlight.vim
 14: ~/.vim/bundle/vim-fireplace/plugin/fireplace.vim
 15: /usr/share/vim/vim81/plugin/getscriptPlugin.vim
 16: /usr/share/vim/vim81/plugin/gzip.vim
 17: /usr/share/vim/vim81/plugin/logiPat.vim
 18: /usr/share/vim/vim81/plugin/manpager.vim
 19: /usr/share/vim/vim81/plugin/matchparen.vim
 20: /usr/share/vim/vim81/plugin/netrwPlugin.vim
 21: /usr/share/vim/vim81/plugin/rrhelper.vim
 22: /usr/share/vim/vim81/plugin/spellfile.vim
 23: /usr/share/vim/vim81/plugin/tarPlugin.vim
 24: /usr/share/vim/vim81/plugin/tohtml.vim
 25: /usr/share/vim/vim81/plugin/vimballPlugin.vim
 26: /usr/share/vim/vim81/plugin/zipPlugin.vim
 27: ~/.vim/pack/tpope/start/fireplace/plugin/fireplace.vim
 28: /usr/share/vim/vim81/syntax/clojure.vim
 29: /usr/share/vim/vim81/ftplugin/clojure.vim
 30: /usr/share/vim/vim81/indent/clojure.vim
 31: ~/.vim/pack/tpope/start/fireplace/autoload/fireplace.vim
 32: ~/.vim/pack/tpope/start/fireplace/autoload/fireplace/transport.vim
 33: ~/.vim/pack/tpope/start/fireplace/autoload/fireplace/session.vim
 34: ~/.vim/bundle/vim-clojure-highlight/autoload/vim_clojure_highlight.vim
  • Welcome to Vi and Vim! Can you start by checking that the plug-in is actually being loaded, by using the :scriptnames command? (Please edit the question to include its output.) When you run :ClojureHighlightReferences do you pass it any arguments? Do you receive any error messages or does it just succeed without changing anything in highlighting? – filbranden May 10 at 0:54
  • I recently started learning me some Clojure and I'm using vim-clojure-static (I was using vim-fireplace until recently...replaced with vim-iced just because of broader feature set). You shouldn't need plugin vim-clojure-static. The native syntax file is identical and differences in a couple other files minor. OTOH, it can't hurt either (FYI, I accidentally enabled the plugin version and since things are working for me never bothered disabling it.) BTW, I would suggest you use vim-plug instead of pathogen because of all the clojure repos that recommend it. It's simple to use. – B Layer May 10 at 8:31
  • Just looked a little closer at native vs plugin clojure-static. Some of the small differences I saw were due to comparing Vim 8.0 to latest plugin files. Just compared vs Vim 8.2 and see no differences between the plugin and native (the plugin code occasionally gets merged into the vim repo). – B Layer May 10 at 8:38
  • 1
    @D.BenKnoble sorry, I should've explained that I'm using boot instead of leiningen and yes I do have a repl running at the time I'm opening my .clj files, also I can get call :ClojureHighlightReferences (no parameters) and it doesn't throw any errors :( – stigma May 10 at 19:50
  • 1
    vim-clojure-highlight readme says it requires vim-clojure-static and "While Vim ships with vim-clojure-static, this plugin uses a feature from a very recent version." You're using vim81, right? You better load the vim-clojure-static plugin rather than rely on the one shipped with vim. (If you were using vim82 it would probably not be an issue.) Alternatively, to determine whether this is an issue disable vim-clojure-highlight and see if things get better. – B Layer May 10 at 23:32

This won't be solvable without updates to the plugin. This line shows that it checks for the variable g:fireplace_nrepl_sessions and refuses to proceed if it doesn't exist.

With recent versions of fireplace, it does not appear to ever get set.

In fact, there was an issue about it, which points towards this open PR on the plugin, which doesn't appear to have been resolved.

In short, it looks like the plugin is well out-of-maintenance (though a PR exists to make it work, potentially—you'd want to fork the plugin and try to merge/fix it on your own, most likely, or try the fork of the user who sent the PR).

As an aside, I discovered this by stepping through :debug ClojureHighlightReferences.

| improve this answer | |
  • Thanks for giving this one a look, Ben! – filbranden Jun 1 at 23:45
  • 1
    Np @filbranden ! It was much simpler than I originally thought – D. Ben Knoble Jun 2 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.