Skip to content

Can't change tabs when in terminal #1045

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

Closed
barreyra opened this issue Apr 29, 2020 · 8 comments · Fixed by #1072
Closed

Can't change tabs when in terminal #1045

barreyra opened this issue Apr 29, 2020 · 8 comments · Fixed by #1072
Milestone

Comments

@barreyra
Copy link

When entering a terminal, I can no longer change tabs using Cmd-{}, not create a new one using Cmd-T, presumably because these keys get passed on to the terminal.

@eirnym
Copy link
Contributor

eirnym commented May 6, 2020

@barreyra, Thank you for an issue,

If you're talking about Apple's Terminal.app, it doesn't support passing Cmd key to apps. Some other terminal apps has limited support for this feature

@barreyra
Copy link
Author

barreyra commented May 6, 2020

I'm talking about the MacVim GUI. I can use those keys normally to switch between tabs in other buffers, but if the current selected buffer is a :terminal, it doesn't work.

@eirnym
Copy link
Contributor

eirnym commented May 6, 2020

As far as I understand, Vim captures the input and then sends it to the terminal, which is not the same as you process a key directly. Also Vim's terminal emulator is not perfect enough to be compared to Xterm, for example.

@barreyra
Copy link
Author

barreyra commented May 8, 2020

Aha, I figured out my own issue. The terminal has its own set of key-bindings. The following adds the basic tab navigation commands:

tmap <D-t> <C-W>:tabnew<CR>
tmap <D-}> <C-W>:tabn<CR>
tmap <D-{> <C-W>:tabp<CR>

It seems the problem is that the :macmenu command doesn't map things in the terminal.

@ychin
Copy link
Member

ychin commented Aug 12, 2020

I think the issue is that the menu entries are not properly mapped. This will be fixed next release to have the tab menu items properly mapped in terminal mode. (They need to use tlmenu instead of the generic amenu since terminal menus work well enough that the generic amenu doesn't work with it)

ychin added a commit to ychin/macvim that referenced this issue Aug 12, 2020
Vim terminals use tlmenu to specify menu items and the normal `amenu`
doesn't work. This causes functionality such as toggling full screen and
going to next/prev tab to not work in terminal mode. Fix that by adding
the proper tlmenu mapping to the appropriate items.

Fix macvim-dev#1045
@ychin ychin added this to the snapshot-164 milestone Aug 12, 2020
@ychin
Copy link
Member

ychin commented Aug 12, 2020

This is now fixed. @barreyra feel free to remove your own mappings once the new version (164) is out soon. MacVim will do the right thing.

ychin added a commit that referenced this issue Aug 13, 2020
Vim patch 8.2.1424

Features

- New "Appearance" option pane (accessible via Cmd-, or MacVim ->
  Preferences) to allow customizing how MacVim looks. Users can now
  select how MacVim works with Dark Mode, and configure titlebar to be
  hidden or transparent. #912 #1038 #1056
- MacVim localization support. It now uses translated Vim messages for
  the specified locale. See `:help multilang-messages` to see how to
  configure it. #991

General:

- Python is now built against 3.8, up from 3.7. #1012

Fixes:

- Fix mvim:// protocol handler behavior. Reverts behavior back to old
  behavior (before snapshot-162), but add new fallback handling to try
  to handle poorly formed URLs that don't double-encode special
  characters. See `:help macvim://`. #1055
- Can now change tabs using menu and keyboard shortcuts (Cmd-{ / Cmd-} /
  Cmd-T) when in terminal mode. #1045

Targets macOS 10.9+

Script interfaces have compatibility with these versions:
- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.8
- Ruby 2.7
ychin added a commit to ychin/macvim that referenced this issue Aug 15, 2020
Vim patch 8.2.1456

Features

- New "Appearance" option pane (accessible via Cmd-, or MacVim ->
  Preferences) to allow customizing how MacVim looks. Users can now
  select how MacVim works with Dark Mode, and configure titlebar to be
  hidden or transparent. macvim-dev#912 macvim-dev#1038 macvim-dev#1056
- MacVim localization support. It now uses translated Vim messages for
  the specified locale. See `:help multilang-messages` to see how to
  configure it. macvim-dev#991

General:

- Python is now built against 3.8, up from 3.7. macvim-dev#1012

Fixes:

- Fix mvim:// protocol handler behavior. Reverts behavior back to old
  behavior (before snapshot-162), but add new fallback handling to try
  to handle poorly formed URLs that don't double-encode special
  characters. See `:help macvim://`. macvim-dev#1055
- Can now change tabs using menu and keyboard shortcuts (Cmd-{ / Cmd-} /
  Cmd-T) when in terminal mode. macvim-dev#1045
- Fix crash during MacVim launch in Snapshot 164 (8.2.1424) due to
  dynamic library linkage. macvim-dev#1073

Targets macOS 10.9+

Script interfaces have compatibility with these versions:

- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.8
- Ruby 2.7
ychin added a commit that referenced this issue Aug 15, 2020
Vim patch 8.2.1456

Features

- New "Appearance" option pane (accessible via Cmd-, or MacVim ->
  Preferences) to allow customizing how MacVim looks. Users can now
  select how MacVim works with Dark Mode, and configure titlebar to be
  hidden or transparent. #912 #1038 #1056
- MacVim localization support. It now uses translated Vim messages for
  the specified locale. See `:help multilang-messages` to see how to
  configure it. #991

General:

- Python is now built against 3.8, up from 3.7. #1012

Fixes:

- Fix mvim:// protocol handler behavior. Reverts behavior back to old
  behavior (before snapshot-162), but add new fallback handling to try
  to handle poorly formed URLs that don't double-encode special
  characters. See `:help macvim://`. #1055
- Can now change tabs using menu and keyboard shortcuts (Cmd-{ / Cmd-} /
  Cmd-T) when in terminal mode. #1045
- Fix crash during MacVim launch in Snapshot 164 (8.2.1424) due to
  dynamic library linkage. #1073

Targets macOS 10.9+

Script interfaces have compatibility with these versions:

- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.8
- Ruby 2.7
@barreyra
Copy link
Author

Thank you, it works great. Cmd-w and Cmd-b are still missing, I'll post a patch if no one else does.

@ychin
Copy link
Member

ychin commented Aug 16, 2020

I'm not sure if Cmd-W would work. It's mapped to :conf q which I don't think works inside terminal mode. I could see Cmd-B though.

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 a pull request may close this issue.

3 participants