Blog: 2023-07-12

From razwiki
Revision as of 16:51, 12 July 2023 by Razzi (talk | contribs)
Jump to navigation Jump to search

Still hacking on vim as a terminal window manager. Think it'll work well enough to open a new file in a new tab, rather than in the same window as the terminal. Then when the file is closed it'll go back to the terminal.

This is a little different than the tmux flow I had before, where running vim would just open it fullscreen under tmux. Perhaps it's worth exploring whether when I have a single vim terminal open if it'd make sense just to open the file in the current window, potentially even exiting the terminal?

So there's a bit of a trickiness to the terminal->vim messaging - here's an example:

function vim-client --argument file
  if string-empty $VIM_TERMINAL
    echo not in vim terminal
    return 1
  end
  echo -e "\033]51;[\"drop\", \"$file\"]\007"
end

The arguments have to be passed as a list and can't call arbitrary functions, since that'd be a security hole. Makes sense. So I'll have to bind my own terminal handler to open the file argument in a new tab.