Skip to content

How do I force a window's cursor shape from a process in command mode?  #2059

@bgribble

Description

@bgribble

Issue description

I am trying to improve Vim + Tmux cursor shape management using a monitor process in command mode (tmux -C). From this process, I would like to issue a command that will change the cursor shape in a targeted client. send and display-message with appropriate escape sequences seem like pretty likely candidates but I can't get them to work.

The usual approach to vim+tmux configures Vim to appropriately tell Tmux when it transitions between normal and insert mode. This is fine as far as it goes, but it doesn't adequately handle multiple concurrently open Vim sessions in different panes, nor does it know to revert to normal block cursor when I click into a terminal or other non-Vim pane, or to go back to the right cursor when I shift focus back to Vim.

By a combination of Vim scripting and a process listening for %window-pane-changed notifications, I am able to trigger code to run at the right time and with the right knowledge about what shape to change the cursor, but (alas) I can't figure out how to effect the change in cursor shape.

Things that might work but seem super kludgy:

  • keeping a terminal window/pane open just for the purpose of running echo -en '\033[0 q' or similar and using send to that
  • writing the escape code directly to the underlying terminal device, which maybe we save in environment or a tmpfile before starting up tmux

Required information

Please provide the following information:

  • tmux version (tmux -V): tmux 3.0a
  • Platform (uname -sp): Darwin i386
  • $TERM inside and outside of tmux (echo $TERM): inside: screen-256color, outside: xterm-256color (iterm)
  • Logs from tmux (tmux kill-server; tmux -vv new).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions