vim-fireplace icon indicating copy to clipboard operation
vim-fireplace copied to clipboard

Pasting result of cpp into buffer

Open nenadalm opened this issue 8 years ago • 4 comments

Hi. What I thought about doing is to write some function (e.g. "do-something"), do some implementation, write test:

(deftest do-something-test
  (is (= (do-something arg1 arg2)

evaluate call using cpp and if the result is ok, then paste it into the test so after paste it would look like:

(deftest do-something-test
  (is (= (do-something arg1 arg2)
         result

I am not very expirienced with vim, but I come up with this so far:

:nmap <leader>w :redir @b <bar> :exec "norm cpp" <bar> :redir END <bar> :exec 'let @b = substitute(@b, ".*No matching autocommands\n", "", "g")'<cr>
:nmap <leader>e :put b<cr>

so now I can evaluate form with \w and paste the result with \e. Is there a way to overwrite cpp so it would paste the result into some registry or something?

maybe this could even be in the plugin? (or doc as tip?)

nenadalm avatar Nov 16 '16 21:11 nenadalm

Not sure if this helps, but there is already c!! which replaces a form with it's evaluated result.

styts avatar Nov 17 '16 10:11 styts

@styts thanks, but I would like to copy that result and paste it (without replacing).

nenadalm avatar Nov 17 '16 11:11 nenadalm

This is something I'd love to have as well.

jeaye avatar Dec 05 '16 01:12 jeaye

Is copying the result out of the :Last buffer good enough?

tpope avatar Jul 23 '19 19:07 tpope