Closed Praful closed 11 months ago
Hi @Praful
Since I use g:slime_dont_ask_default, I forgot that's how it works 😅
Having each buffer ask you is more a feature than a bug, since it's not automatic that you would want every buffer to send to the same target.
That being said:
g:slime_default_config
once and every prompt will get its default from theregslime_dont_ask_default
to skip the promptsGive that a try and let me know how it goes 👍
Hi @jpalardy
Thanks for replying.
With kitty
, the socket name changes every time it's launched (it consists of a basic stem and a port is appended). Similarly, the window id varies for each kitty
tab. I could fix which id I send to from vim but I'm not sure how to get around the varying socket name. That was the rationale for suggesting to prompt once and not thereafter.
Suggestions?!
Hi @Praful
Sorry, what I meant was: after the first prompt, try:
let g:slime_default_config = b:slime_config
and it will populate the next prompt. (combine with let g:slime_dont_ask_default = 1
to skip the prompt)
You can put it on a mapping, so you don't have to type it.
@jpalardy ah thanks - I misunderstood.
Setting the two variables manually after running :SlimConfig does the trick.
I tried to put it in a function:
function! CustomSlimConfig()
:SlimConfig
let g:slime_default_config = b:slime_config
let g:slime_dont_ask_default = 1
" Display a message (optional)
echo "SlimConfig executed"
endfunction
" Map F2 to the custom function
nnoremap <F2> :call CustomSlimConfig()<CR>
but it didn't work! My VimScript isn't good enough to find the bug. Could you help please?
it's close ^
e
on Slime?call
in function?how about:
function! CustomSlimeConfig()
call SlimeConfig()
let g:slime_default_config = b:slime_config
let g:slime_dont_ask_default = 1
" Display a message (optional)
echo "SlimeConfig executed"
endfunction
" Map F2 to the custom function
nnoremap <F2> :call CustomSlimeConfig()<CR>
Thanks again. I've changed to your corrected version, but the two global variables are still not being set and the echo
message is not appearing.
Does this work for you?!
SlimeConfig
isn't a function after all
function! CustomSlimeConfig()
SlimeConfig
let g:slime_default_config = b:slime_config
let g:slime_dont_ask_default = 1
" Display a message (optional)
echo "SlimeConfig executed"
endfunction
" Map F2 to the custom function
nnoremap <F2> :call CustomSlimeConfig()<CR>
Still no joy! Same result: the two variables are not being set. Very strange!
Sorry - user error. I had an old F2 mapping to :SlimeConfig, which was overriding the new F2. All working now.
Thank you for taking the time to resolve this.
Good times — I'm happy that worked out for you 👍
I switched to this from a Jupyter Console vim plugin, which was temperamental. So far, Slime works well (I use ptpython in ipython mode from Kitty) and has the bonus of sending text to the terminal or whatever app is open in it.
When
SlimeConfig
is called for a buffer, the settings apply only to that buffer. For other buffers you must enter the settings again. It helps that "Kitty listen on" socket is pre-filled. (For some reason, the Window ID is always 0 even if I launch gvim from Kitty whereKITTY_WINDOW_ID
is defined.)Is it possible to have Slime remember when the window id and socket have been provided and not ask again for other buffers?
I'm using gvim 9, Linux Mint 21.2, Kitty 0.21.2.