This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-30
Channels
- # announcements (3)
- # asami (20)
- # babashka (15)
- # beginners (47)
- # biff (25)
- # calva (11)
- # cider (11)
- # clojure (24)
- # clojure-brasil (3)
- # clojure-europe (21)
- # clojure-norway (34)
- # clojure-uk (2)
- # clojurescript (9)
- # clr (2)
- # datomic (10)
- # fulcro (14)
- # hyperfiddle (58)
- # introduce-yourself (1)
- # jobs (3)
- # life (2)
- # malli (5)
- # meander (6)
- # missionary (4)
- # nbb (30)
- # off-topic (6)
- # podcasts-discuss (1)
- # shadow-cljs (13)
- # slack-help (5)
- # tools-build (4)
- # vim (20)
- # xtdb (20)
I want to see just the defined vars in a namespace in a list, I think counterclockwise had this long time ago. How do I do this? using macvim and vim-fireplace
clojure.core has a function for this, ns-publics
Example usage:
;; list of vars in current namespace
(ns-publics *ns*)
;; list of vars in another namespace
(ns-publics 'clojure.string)
I'm not sure if fireplace has anything built-in for this, but you could eval a form like that in your REPL sessionHey, I know about this function. I want to have listview like vim nerdtree plugin which lists all vars with jump too
Ah, I see. LSP provides functionality like that. I use Neovim, so I don't know specifically how to set it up in regular Vim, but there ought to be a way!
Language Server Protocol. It's a feature built into a lot of editors nowadays. The idea is that you have language servers for specific languages (Clojure has one called clojure-lsp) and they work in any editor that supports LSP. On the other side, you have LSP clients that are built into a bunch of different editors, and they support any language that has a language server.
I just remembered a plugin that I used to use that I enjoyed - it might help you here: https://github.com/liuchengxu/vista.vim
Back when I used it, it didn't support LSP, it was based on ctags instead. Looks like nowadays, it supports LSP, which is great
An advantage of doing this via LSP is that it will always work, even if you don't have a REPL running.
Clojure LSP client suggestions for Vim (don't forget to install clojure-lsp server) https://clojure-lsp.io/clients/#vim Note that not all LSP clients will support all LSP features
Fair warning: I've not been satisfied with any of the LSP clients for Vim. They're slow and flaky. If I have to use the LSP then I run Neovim; its built-in client is pretty sound.
> I want to have listview like vim nerdtree plugin which lists all vars with jump too
@U0ALH6R89 Sounds like you want to populate a quickfix list. It might be possible for vim-fireplace to pipe its eval output to other commands. The :Last
command will output the result of the last eval to a preview buffer. Perhaps that can be converted to a quickfix list?
If you use tags
there may be a way to show a window with current file tags
and get def
ined variables :thinking_face: