Fork me on GitHub
#vim
<
2022-08-22
>
sheluchin15:08:37

Does anyone know how to get Cider/Emacs eval-in-context functionality in vim? It's a binding that allows you to set some values before evaluating a form, and re-using them later. Can't find any docs for it, but there's a bit of info https://clojurians.slack.com/archives/C053AK3F9/p1661180273024399?thread_ts=1661168165.432639&amp;cid=C053AK3F9. I'm using vim-iced, and I don't think it has this feature, but I'm curious if it exists at all in the vim landscape.

nate15:08:54

I don't see anything for this in #conjure and I don't remember it from my fireplace days. Looks like emacs special sauce

walterl19:08:37

I just bound a https://github.com/walterl/dotfiles/blob/49bc0bdf76458e85a3491bb9942faf5630b3fad1/_config/nvim/ftplugin/clojure.vim#L53 that inserts (comment (def foo :foo)) (substitute foo for the element under the cursor) for me to eval. Not as smooth an experience as I'm sure emacs's is, but sufficient.

sheluchin19:08:09

Ah, I'm just annoyed with littering up my undo history by shimming comments in and out all the time and hoping for a better way. The Emacs thing looks sweet, but this is #vim 😅

walterl20:08:00

vim-fireplace also has something close to that with its cqqhttps://github.com/tpope/vim-fireplace/blob/master/doc/fireplace.txt#L216. But those things have shown me that I rather prefer something less ephemeral, because it's not often I only want to eval a form once while REPL'ing.

walterl20:08:27

I.e. There's only so many times that I can type out the values for "fish" and "food" before I want to def it 🙂

sheluchin20:08:32

Yes, I can see how that would get mighty tedious, but the Cider/Emacs thing remembers history so you can repeat the binding to run it again with the same thing.

walterl20:08:29

Ah, that's nice!

walterl20:08:20

The hardest part would be determining which symbols in the current form need values; the rest should be fairly easily scriptable. Especially with neovim's inputs.

uochan22:08:04

@UPWHQK562 Oh, I missed the feature. Looks cool. I would like to try it and if it looks good, I'll incorporate it to vim-iced.

❤️ 2
sheluchin22:08:14

@UBL24PLE6 You do an incredible job running your open source projects and being open to feedback. Thanks for checking in here, whether you decide to keep the feature or not 🙂