Closed siuoly closed 2 years ago
Hi @siuoly
An interesting case I hadn't considered 🤔
It's true that vimterminal
doesn't use WritePasteFile, so it wouldn't be subject to this problem. But I'm surprised that $HOME/.slime_paste
is considered to be on the remote file context…
Can you confirm that? Do you see a .slime_paste
file on the remote directory? (and do you see your latest paste in it?)
Thanks for response !!
Hmm..., I noticed the pasted file in local directory $HOME/.slime_paste
, and actually the latest pasted content in it (local).
So this problem is nothing to do with $HOME/.slime_paste
.
But I wonder is there any i/o operation on the file?
Like :!cat
, :!ls
... would cause delay because it access the remote filesystem potentially.
I traced source code (autoload/slime.vim) but got nothing.
You could try to inline:
echom strftime("%F %T %s") "some message"
(check echoes in :messages
) in the code to get an idea of what code ran when (and which part is taking time)
Let me know what you find 👍
echom strftime("%F %T %s") "some message"
is a Good method!
The following is the log message !
2022-07-18 13:07:10 0 before slime getconfig
2022-07-18 13:07:10 1 after slime getconfig
2022-07-18 13:07:10 2 before slime pieces
2022-07-18 13:07:10 3 after slime pieces
2022-07-18 13:07:10 6 before dispatch
2022-07-18 13:07:10 1 slime dispatch start
2022-07-18 13:07:10 4 slime get target start
2022-07-18 13:07:10 5 slime get target end
s:TmuxSend
[{'target_pane': ':', 'socket_name': 'default'}, '# send trival message^M']
2022-07-18 13:07:10 0 bracketed_pasted start
2022-07-18 13:07:10 1 bracketed_pasted end
2022-07-18 13:07:10 2 if bracketed_paste start
2022-07-18 13:07:10 3 if bracketed_paste end
2022-07-18 13:07:10 .698302 4 writepastefile start
2022-07-18 13:07:10 5 writepastefile end
2022-07-18 13:07:10 6 load buffer start <--------------------------------------------
TmuxCommand: {'target_pane': ':', 'socket_name': 'default'} load-buffer /home/siuoly/.slime_paste
TmuxCommand system command: tmux -L 'default' load-buffer /home/siuoly/.slime_paste
2022-07-18 13:07:11 7 load buffer end <--------------------------------------------
2022-07-18 13:07:11 8 paste-buffer start
2022-07-18 13:07:11 8-4 paste buffer -d-t start <--------------------------------------
TmuxCommand: {'target_pane': ':', 'socket_name': 'default'} paste-buffer -d -t ':'
TmuxCommand system command: tmux -L 'default' paste-buffer -d -t ':'
2022-07-18 13:07:12 8-4 paste buffer -d-t end <---------------------------------------
2022-07-18 13:07:12 8 paste-buffer end
2022-07-18 13:07:12 7 after dispatch
2022-07-18 13:07:12 8 slimesend end
The delay keypoint is this system command
function! s:TmuxCommand(config, args)
...
return system("tmux " . l:socket_option . " " . shellescape(l:socket) . " " . a:args) <----
endfunction
it actually doing
tmux -L 'default' load-buffer ~/.slime_paste # load content of file to tmux session buffer
tmux -L 'default' paste-buffer -d -t ':' # paste tmux itself session buffer
I found if the two command run on a mount directory it delay but not delay on local directory. I don't know the reason.... , So now I just get out and in the mounted directory before and after the system command.
function! s:TmuxSend(config, text)
...
cd " get out the mounted directory
call s:WritePasteFile(text_to_paste) " this behaviour is also blocked a few on mounted directory.
call s:TmuxCommand(a:config, "load-buffer " . g:slime_paste_file)
if bracketed_paste
call s:TmuxCommand(a:config, "paste-buffer -d -p -t " . shellescape(a:config["target_pane"]))
if has_crlf
call s:TmuxCommand(a:config, "send-keys -t " . shellescape(a:config["target_pane"]) . " Enter")
end
else
call s:TmuxCommand(a:config, "paste-buffer -d -t " . shellescape(a:config["target_pane"]))
end
cd - " get in the previous mounted directory
endfunction
I consider this case is caused by tmux ..., so the it is a temporary solution. I will reponse it to tmux repository. 👍
feel free to loop back if it's not fixable on the tmux side 👍
When I use
sshfs <remote_ip>:<remote_dir> local_dir -p <port>
to mount a remote directory, edit file on the local_dir, and then use SlimeSend command to tmux target , the editor is blocked about 2 second.If I using
vimterminal
as target, SlimeSend is not blocked.I guess that the reason is that vim load remote file context, or the paste file like
"$HOME/.slime_paste"
.Is there any recommend solution ?
Now I use
vimterminal
as target and open a tmux session in thevimterminal
, but I am looking for a better way.