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

does vim-slime support changing target from same buffer after vim started?

Open pinggit opened this issue 2 years ago • 3 comments

sometime I want to use vimterminal as target, but some other time I prefer to use tmux. in my setup I set:

"when target is tmux
let g:slime_target = "tmux"
    let g:slime_default_config = {"socket_name": "default", "target_pane": "{down-of}"}

"when target is vimterminal
let g:slime_target = "vimterminal"
    let g:slime_vimterminal_cmd = "bash"
    let g:slime_python_ipython = 1
    let g:slime_vimterminal_config = {"term_finish": "close", "vertical": 1}
    let g:slime_vimterminal_config = {"vertical": 1}

so by default the vimterminal is used. which works fine.

however if I changed my mind, I thought I can just do:

let g:slime_target = "tmux"
:let g:slime_default_config = {"socket_name": "default", "target_pane": "{down-of}"}
:SlimeConfig

and expect the target moved to tmux, but I got a bunch of errors:

Error detected while processing function slime#config[2]..<SNR>188_SlimeDispatch[6]..<SNR>188_TmuxConfig:
line    4:
E716: Key not present in Dictionary: socket_name
E116: Invalid arguments for function input("tmux socket name or absolute path: ", b:slime_config["socket_name"])

the problem seems to happen only when I tried to change target from same buffer/tab. I tested in other buffer/tab it works fine.

pinggit avatar Jul 06 '22 16:07 pinggit

Hi @pinggit

The g:slime* variables bootstrap the config when first invoked. Afterward, the config is copied to b: variables and cached.

Try :unlet b:slime_config and check if that helps matters

jpalardy avatar Jul 06 '22 21:07 jpalardy

it work! thank you. I'll test it more and close this one soon.

pinggit avatar Jul 11 '22 18:07 pinggit

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 13 '22 02:11 stale[bot]