1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-12 17:55:41 +08:00

revert(shell)!: revert key binding <Esc> in terminal mode

Problem: There is no way to send Esc to terminal
Solution: revert Esc in terminal, add ctrl-` key binding to
hide terminal from terminal mode.

merge: https://github.com/SpaceVim/SpaceVim/pull/3170
BREAKING CHANGE: revert key binding `<Esc>` in terminal mode
Co-authored-by: Clément Joly <oss@171819.xyz>
This commit is contained in:
Shidong Wang 2021-10-17 23:51:28 +08:00
parent a41fc80ee6
commit f6ac73b175
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
4 changed files with 35 additions and 29 deletions

View File

@ -12,14 +12,16 @@
" SpaceVim uses deol.nvim for shell support in neovim and uses vimshell for " SpaceVim uses deol.nvim for shell support in neovim and uses vimshell for
" vim. For more info, read |deol| and |vimshell|. " vim. For more info, read |deol| and |vimshell|.
" "
" @subsection variable " @subsection layer options
" "
" default_shell: config the default shell to be used by shell layer. " 1. `default_shell`: config the default shell to be used by shell layer.
" "
" @subsection key bindings " @subsection key bindings
" > " >
" Key bindings Description
" SPC ' Open or switch to terminal windows " SPC ' Open or switch to terminal windows
" q Hide terminal windows in normal mode " q Hide terminal windows in normal mode
" ctrl-` Hide terminal window in terminal mode
" < " <
let s:SYSTEM = SpaceVim#api#import('system') let s:SYSTEM = SpaceVim#api#import('system')
@ -63,7 +65,7 @@ function! SpaceVim#layers#shell#config() abort
exe 'tnoremap <silent><C-Down> <C-\><C-n>:<C-u>wincmd j<CR>' exe 'tnoremap <silent><C-Down> <C-\><C-n>:<C-u>wincmd j<CR>'
exe 'tnoremap <silent><M-Left> <C-\><C-n>:<C-u>bprev<CR>' exe 'tnoremap <silent><M-Left> <C-\><C-n>:<C-u>bprev<CR>'
exe 'tnoremap <silent><M-Right> <C-\><C-n>:<C-u>bnext<CR>' exe 'tnoremap <silent><M-Right> <C-\><C-n>:<C-u>bnext<CR>'
exe 'tnoremap <silent><esc> <C-\><C-n>' exe 'tnoremap <silent><C-`> <C-\><C-n>:q<Cr>'
if s:SYSTEM.isWindows if s:SYSTEM.isWindows
exe 'tnoremap <expr><silent><C-d> SpaceVim#layers#shell#terminal()' exe 'tnoremap <expr><silent><C-d> SpaceVim#layers#shell#terminal()'
exe 'tnoremap <expr><silent><C-u> SpaceVim#layers#shell#ctrl_u()' exe 'tnoremap <expr><silent><C-u> SpaceVim#layers#shell#ctrl_u()'

View File

@ -4565,15 +4565,17 @@ SHELL *SpaceVim-layers-shell*
SpaceVim uses deol.nvim for shell support in neovim and uses vimshell for vim. SpaceVim uses deol.nvim for shell support in neovim and uses vimshell for vim.
For more info, read |deol| and |vimshell|. For more info, read |deol| and |vimshell|.
VARIABLE LAYER OPTIONS
default_shell: config the default shell to be used by shell layer. 1. `default_shell`: config the default shell to be used by shell layer.
KEY BINDINGS KEY BINDINGS
> >
Key bindings Description
SPC ' Open or switch to terminal windows SPC ' Open or switch to terminal windows
q Hide terminal windows in normal mode q Hide terminal windows in normal mode
ctrl-` Hide terminal window in terminal mode
< <
============================================================================== ==============================================================================

View File

@ -58,11 +58,12 @@ The default shell is quickly accessible via a the default shortcut key `SPC '`.
## 快捷键 ## 快捷键
| 快捷键 | 功能描述 | | 快捷键 | 功能描述 |
| ------------ | ---------------------------------- | | --------------- | ---------------------------------- |
| `SPC '` | 打开或跳至已打开的终端窗口 | | `SPC '` | 打开或跳至已打开的终端窗口 |
| `Ctrl-d` | 输入模式下关闭终端窗口 | | `Ctrl-d` | 输入模式下关闭终端窗口 |
| `q` | Normal 模式下隐藏终端窗口 | | `q` | Normal 模式下隐藏终端窗口 |
| `<Esc>` | 从 Terminal 模式切换到 Normal 模式 | | `` Ctrl-` `` | Terminal 模式下隐藏终端窗口 |
| `Ctrl-\-Ctrl-n` | 从 Terminal 模式切换到 Normal 模式 |
| `Ctrl-Left` | 切换到左侧窗口 | | `Ctrl-Left` | 切换到左侧窗口 |
| `Ctrl-Up` | 切换到上方窗口 | | `Ctrl-Up` | 切换到上方窗口 |
| `Ctrl-Down` | 切换到下方窗口 | | `Ctrl-Down` | 切换到下方窗口 |

View File

@ -60,11 +60,12 @@ in percents with the variable `default_height`. Default value is 30.
## Key bindings ## Key bindings
| Key Binding | Description | | Key Binding | Description |
| ------------ | ---------------------------------------- | | --------------- | ---------------------------------------- |
| `SPC '` | Open or switch to the terminal windows | | `SPC '` | Open or switch to the terminal windows |
| `Ctrl-d` | Close terminal windows in terminal mode | | `Ctrl-d` | Close terminal windows in terminal mode |
| `q` | Hide terminal windows in Normal mode | | `q` | Hide terminal windows in Normal mode |
| `<Esc>` | Switch to Normal mode from terminal mode | | `` Ctrl-` `` | Hide terminal windows in terminal mode |
| `Ctrl-\-Ctrl-n` | Switch to Normal mode from terminal mode |
| `Ctrl-Left` | Switch to the windows on the left | | `Ctrl-Left` | Switch to the windows on the left |
| `Ctrl-Down` | Switch to the windows below | | `Ctrl-Down` | Switch to the windows below |
| `Ctrl-Up` | Switch to the windows on the top | | `Ctrl-Up` | Switch to the windows on the top |