Skip to content

Add support for highlighting non-aliased public namespace members. #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions autoload/vim_clojure_highlight.clj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@
(ns-publics alias-ns)))
(ns-aliases ns)))

(defn all-ns-refers []
(mapcat
(fn [current-ns]
(mapv
#(vector (symbol (str current-ns \/ (first %))) (peek %))
(ns-publics current-ns)))
(map #(symbol (str %)) (all-ns))))

(defn var-type [v]
(let [f @v m (meta v)]
(cond (clojure-core? v) (core-symbol->syntax-group (:name m))
Expand All @@ -87,6 +95,7 @@
(defn ns-syntax-command [ns & opts]
(let [{:keys [local-vars] :or {local-vars true}} (apply hash-map opts)
dict (syntax-keyword-dictionary (concat (ns-refers ns)
(all-ns-refers)
(aliased-refers ns)
(when local-vars (ns-publics ns))))]
(str "let b:clojure_syntax_without_core_keywords = 1 | let b:clojure_syntax_keywords = {" dict "}")))
9 changes: 7 additions & 2 deletions autoload/vim_clojure_highlight.vim
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
" vim-clojure-highlight

function! s:session_exists()
return exists('g:fireplace_nrepl_sessions') && len(g:fireplace_nrepl_sessions)
try
return fireplace#op_available('eval')
catch /./
endtry
return 0
endfunction

function! s:require()
if fireplace#evalparse("(find-ns 'vim-clojure-highlight)") ==# ''
"echo(fireplace#evalparse("(find-ns 'vim-clojure-highlight)") != 'vim-clojure-highlight')
if fireplace#evalparse("(find-ns 'vim-clojure-highlight)") != 'vim-clojure-highlight'
let buf = join(readfile(globpath(&runtimepath, 'autoload/vim_clojure_highlight.clj')), "\n")
call fireplace#session_eval('(do ' . buf . ')')
endif
Expand Down