vim / vim

The official Vim repository
https://www.vim.org
Vim License
36.06k stars 5.38k forks source link

Netrw hang when opened from a Tapi function #10671

Open user202729 opened 2 years ago

user202729 commented 2 years ago

Steps to reproduce

  1. Run a function like this in vim

    function! Tapi_edit_files(bufn, args)
    tabe ~/
    endfunction
  2. Open vim, run :term, then call that function from the terminal printf '\e]51;["call", "Tapi_edit_files", []]\x07'

  3. vim hangs and use 100% CPU

Expected behaviour

The folder is opened in new window.

Version of Vim

8.2.5046

Environment

Arch Linux, xterm

Logs and stack traces

No response

brammool commented 2 years ago

Not sure why you would use a shell command to call a function to open netrw. I don't think that is supposed to work. For me I can use CTRL-C to get Vim back in a working state.

user202729 commented 2 years ago

I use vim as a terminal multiplexer, and it's convenient if vim <something> on the inner terminal doesn't open a nested vim..

Any better idea?

(Alright, I change it to starting a server (remote_startserver) on the outer vim, set a environment variable to tell the inner terminal, read that from the inner terminal, and use --remote-expr to run something on the outer one. That way does work)

brammool commented 2 years ago

I use vim as a terminal multiplexer, and it's convenient if `vim

` on the inner terminal doesn't open a nested vim..

I do not encourage using Vim as a terminal multiplexer. There are better programs for that.

Any better idea?

(Alright, I change it to starting a server (remote_startserver) on the outer vim, set a environment variable to tell the inner terminal, read that from the inner terminal, and use --remote-expr to run something on the outer one. That way does work)

Or your command can fir open a new window or tab. The problem is trying to do something in the window that is running the terminal.

-- hundred-and-one symptoms of being an internet addict:

  1. Books in your bookcase bear the names Bongo, WinSock and Inside OLE

    /// Bram Moolenaar -- @.*** -- http://www.Moolenaar.net \\ /// \\ \\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\ help me help AIDS victims -- http://ICCF-Holland.org ///

user202729 commented 2 years ago

Alright, since you can reproduce it I guess it's either "low-priority" or "won't-fix" then.

Or your command can fir open a new window or tab.

Using :tabe <some file> instead of :tabe <some directory> in the Tapi function does work normally. Only opening netrw causes the trouble.

I do not encourage using Vim as a terminal multiplexer. There are better programs for that.

Alright (I'll stick with vim, for now, although there's an issue that it can delete long line when the terminal window is resized, I think there's another open PR for that, either way not the scope of this issue. I used to use tmux but then I have to keep track of two layers of tabbing, more complex)