neovim tmux in msys2 in windows
Yousuf28 opened this issue · 4 comments
Hi @Yousuf28
looking at the write_paste_file
code
function! slime#common#write_paste_file(text)
let paste_dir = fnamemodify(slime#config#resolve("paste_file"), ":p:h")
if !isdirectory(paste_dir)
call mkdir(paste_dir, "p")
endif
let output = slime#common#system("cat > %s", [slime#config#resolve("paste_file")], a:text)
if v:shell_error
echoerr output
endif
endfunction
I can imagine that the paste_file
, which defaults to $HOME/.slime_paste
might not work in Windows. (especially the forward slash, now that I've looking at it…)
A few ideas:
- try overriding
paste_file
(let g:slime_paste_file = "..."
), to a known and valid path for your machine - if that fails, try adding echom to the slime code to get a better idea of what's happening
Let me know how that works out, one way or another
Thanks for reply. With same setup( tmux msys2 in windows) vim-slime work with vim. It does not work with Neovim.
I think the problem is with Neovim.
in neovim, If I command :!echo $SHELL
(with !) I get same error usr/bin/bash not such file or directory
.
in neovim, If I command :echo $SHELL
(no ! ) I get C:\msys64\usr\bin\bash.exe
in vim, If I command :!echo $SHELL
I get C:/msys64/usr/bin/bash.exe
and it is same for the :echo $SHELL
Any idea why it is different for neovim, but same for vim?
I think
- the second one
:echo $SHELL
is an echo done by vim … with the$SHELL
expanded in vim - the first one, is shelling out (and failing), to run
echo
in bash
I figured it out. Set shellslash
, shellcmdflag
, shellquote
, shellxquote
, and hardcode the g:slime_paste_file
to be some path in the msys2 scheme.
Added this to my $MYVIMRC
to get it to work:
if executable("tmux")
if has('win32')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
"let &shell = "C:/Users/bhw/scoop/apps/msys2/current/usr/bin/bash"
set shellslash
set shellcmdflag=-c
set shellquote=
set shellxquote=
let g:slime_paste_file = "/c/Users/bhw/.slime_paste"
let g:slime_default_config = {"socket_name": "default", "target_pane": ":.0"}
else
let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": ":.0"}
let g:slime_paste_file = expand(".slime_paste")
endif
let g:slime_target = "tmux"
else
let g:slime_target = "conemu"
endif
Should fix your issue. It fixed mine under the same setup.