Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tmux shell integration #233526

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hehaoqian
Copy link

issue: #233074

shell integration support for tmux.

Currently, only bash inside tmux is supported.
zsh and fish will take more time because I don't usually use those shell

Usage of tmux shell integration:

  1. tmux must be started directly from the terminal of tmux. Click the "+" button in the top right of terminal pane, click "tmux".
    It should NOT be started indirectly from a bash shell
  2. Shell integration needs to manually enabled in tmux. Similar to what described in https://code.visualstudio.com/docs/terminal/shell-integration#_manual-installation,
    but environment variable TERM_PROGRAM will be set to tmux by tmux, instead of vscode,
    therefore, in ~/.bashrc I uses environment variable VSCODE_IPC_HOOK_CLI to determine if the terminal is vscode
# Add the following lines to ~/.bashrc
if [[ -n "VSCODE_IPC_HOOK_CLI" ]]; then
  . "$(code --locate-shell-integration-path bash)"
fi

Supported features:

Run recent command
Go to recent directory
Current working directory detection

Unsupported features (HELP NEEDED):

Command decorations and the overview ruler
Command navigation
Sticky scroll
Quick fixes

My current implementation does not work for "Command decorations",
so I have to discard the output of __vsc_prompt_start/__vsc_prompt_end,
otherwise the prompt render will be broken.
Help needed how to solve this issue

@hehaoqian
Copy link
Author

@microsoft-github-policy-service agree

@hehaoqian
Copy link
Author

hehaoqian commented Nov 10, 2024

@Tyriar Can you have a look on my code, and give me some hint the way to support command decoration?
that is, remove the temporary workaround I added in __vsc_update_prompt

You can have a try with tmux terminal and see what happens if all added code in __vsc_update_prompt are removed.

My OS is WSL (ubuntu 22.04.4) with tmux 3.2a
VSCode is 1.95.2

I do not understand how the script works in order to support this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants