Closed nyngwang closed 1 year ago
Hi @nyngwang
A few ideas:
The simplest way, for now, would be to delete b:slime_config
before calling whatever vim-slime function or binding. For example:
nmap <c-c><c-c> :if exists("b:slime_config") \| unlet b:slime_config \| endif<cr><Plug>SlimeParagraphSend
Another way is to take over configuration -- like this
Let me know how that goes for you.
Well, I somehow made it work, but it's a little bit tricky on the Lua side. Fortunately, this problem just reminded me of a syntax I thought I would never use when I was maintaining one of my plugins. (my <C-c>
has been used for other things so I prefer :
and type the command manually, but I got what you mean)
Still, it will be great if you can create an option for it natively.
vim.api.nvim_del_user_command('SlimeSend')
vim.api.nvim_create_user_command('SlimeSend', function (opts)
local backup = vim.b.slime_config
vim.b.slime_config = nil
vim.fn['slime#send_range'](opts.line1, opts.line2)
vim.b.slime_config = backup
end, { range = true })
(in fact, it's not precise to just unset b:slime_config
as the other commands might want to remember the config. So instead, I created a backup
to accept a one-shot state only when this new command is called.)
Hi @nyngwang
Glad you have a workaround for now š
I realized a while ago that it's hard to support everything that vim-slime users want to do only with flags. That's why I opted for that "override" option.
I've also been experimenting with making vim-slime itself a "framework" of components you can snap together: https://github.com/jpalardy/vim-slime-ext-plugins ā it's not ready, but it's something I've been thinking about.
I realized a while ago that it's hard to support everything that vim-slime users want to do only with flags.
Good point. I should not ignore this aspect. Then feel free to close this issue as my original requirement was resolved.
I've also been experimenting with making vim-slime itself a "framework" [...]
Nice idea! I will take it into consideration when making plugins. Thanks for the reference!
Moved from comments started here of #268:
,
,