mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 07:00:04 +08:00
feat(tabs): add tabs key bindings
- `SPC F d`: close current tab - `SPC F D`: close other tabs - `SPC F n`: create a new tab
This commit is contained in:
parent
eacd71c784
commit
40ea34694d
@ -1768,6 +1768,7 @@ let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'}
|
||||
let g:_spacevim_mappings_space.s = {'name' : '+Searching/Symbol'}
|
||||
let g:_spacevim_mappings_space.r = {'name' : '+Registers/rings/resume'}
|
||||
let g:_spacevim_mappings_space.d = {'name' : '+Debug'}
|
||||
let g:_spacevim_mappings_space.F = {'name' : '+Tabs'}
|
||||
let g:_spacevim_mappings_space.e = {'name' : '+Errors/Encoding'}
|
||||
let g:_spacevim_mappings_space.B = {'name' : '+Global buffers'}
|
||||
let g:_spacevim_mappings_space.f.v = {'name' : '+Vim/SpaceVim'}
|
||||
|
@ -68,7 +68,7 @@ let s:filename = expand('<sfile>:~')
|
||||
let s:lnum = expand('<slnum>') + 2
|
||||
function! SpaceVim#layers#foldsearch#config()
|
||||
|
||||
let g:_spacevim_mappings_space.F = {'name' : '+Foldsearch'}
|
||||
let g:_spacevim_mappings_space.F.name = '+Foldsearch/Tabs'
|
||||
let lnum = expand('<slnum>') + s:lnum - 1
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['F', 'w'], 'call call('
|
||||
\ . string(s:_function('s:foldsearch_word')) . ', [])',
|
||||
|
@ -643,6 +643,38 @@ function! SpaceVim#mapping#space#init() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'c'], 'call SpaceVim#plugins#searcher#clear()',
|
||||
\ 'clear-search-results', 1)
|
||||
|
||||
" Tab key bindings:
|
||||
let s:lnum = expand('<slnum>') + s:funcbeginline
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['F', 'D'], 'tabonly',
|
||||
\ ['close-other-tabs',
|
||||
\ [
|
||||
\ 'SPC F D is to close all of other tabs',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . s:lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
let s:lnum = expand('<slnum>') + s:funcbeginline
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['F', 'n'], 'tabnew',
|
||||
\ ['create-new-tab',
|
||||
\ [
|
||||
\ 'SPC F D is to create a new tab',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . s:lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
let s:lnum = expand('<slnum>') + s:funcbeginline
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['F', 'd'], 'tabclose',
|
||||
\ ['close-current-tab',
|
||||
\ [
|
||||
\ 'SPC F D is to close current tab',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . s:lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
|
||||
"Symbol
|
||||
if has('nvim-0.7.0')
|
||||
nnoremap <silent> <plug>SpaceVim-plugin-iedit :lua require('spacevim.plugin.iedit').start()<cr>
|
||||
|
@ -48,10 +48,12 @@ lang: zh
|
||||
- [增删注释](#增删注释)
|
||||
- [编辑历史](#编辑历史)
|
||||
- [文本编码格式](#文本编码格式)
|
||||
- [窗口管理](#窗口管理)
|
||||
- [窗口和标签页](#窗口和标签页)
|
||||
- [窗口管理器](#窗口管理器)
|
||||
- [常用编辑器窗口](#常用编辑器窗口)
|
||||
- [窗口操作常用快捷键](#窗口操作常用快捷键)
|
||||
- [缓冲区管理](#缓冲区管理)
|
||||
- [标签页操作快捷键](#标签页操作快捷键)
|
||||
- [缓冲区与文件](#缓冲区与文件)
|
||||
- [缓冲区操作](#缓冲区操作)
|
||||
- [新建空白 buffer](#新建空白-buffer)
|
||||
- [特殊 buffer](#特殊-buffer)
|
||||
@ -1248,7 +1250,9 @@ set enc=utf-8
|
||||
write
|
||||
```
|
||||
|
||||
### 窗口管理
|
||||
### 窗口和标签页
|
||||
|
||||
#### 窗口管理器
|
||||
|
||||
常用的窗口管理快捷键有一个统一的前缀,默认的前缀 `[Window]` 是按键 `s`,可以在配置文件中通过修改
|
||||
SpaceVim 选项 `window_leader` 的值来设为其它按键:
|
||||
@ -1339,7 +1343,17 @@ SpaceVim 选项 `window_leader` 的值来设为其它按键:
|
||||
| `SPC w W` | 选择一个窗口 |
|
||||
| `SPC w x` | 切换窗口文件 |
|
||||
|
||||
### 缓冲区管理
|
||||
#### 标签页操作快捷键
|
||||
|
||||
标签页(Tab)操作相关快捷键都是以 `SPC F` 为前缀的:
|
||||
|
||||
| 快捷键 | 功能描述 |
|
||||
| --------- | ------------------ |
|
||||
| `SPC F d` | 关闭当前标签页 |
|
||||
| `SPC F D` | 关闭其他所有标签页 |
|
||||
| `SPC F n` | 新建一个新的标签页 |
|
||||
|
||||
### 缓冲区与文件
|
||||
|
||||
#### 缓冲区操作
|
||||
|
||||
|
@ -47,9 +47,11 @@ description: "General documentation about how to use SpaceVim, including the qui
|
||||
- [Commenting](#commenting)
|
||||
- [Undo tree](#undo-tree)
|
||||
- [Multi-Encodings](#multi-encodings)
|
||||
- [Window manager](#window-manager)
|
||||
- [Windows and Tabs](#windows-and-tabs)
|
||||
- [Windows Manager](#windows-manager)
|
||||
- [General Editor windows](#general-editor-windows)
|
||||
- [Window manipulation key bindings](#window-manipulation-key-bindings)
|
||||
- [Tabs manipulation key bindings](#tabs-manipulation-key-bindings)
|
||||
- [Buffers and Files](#buffers-and-files)
|
||||
- [Buffers manipulation key bindings](#buffers-manipulation-key-bindings)
|
||||
- [Create a new empty buffer](#create-a-new-empty-buffer)
|
||||
@ -1351,7 +1353,9 @@ set enc=utf-8
|
||||
write
|
||||
```
|
||||
|
||||
### Window manager
|
||||
### Windows and Tabs
|
||||
|
||||
#### Windows Manager
|
||||
|
||||
Window manager key bindings can only be used in normal mode. The default leader `[WIN]` is `s`, you
|
||||
can change it via `windows_leader` in the `[options]` section:
|
||||
@ -1446,31 +1450,41 @@ Windows manipulation commands (start with `w`):
|
||||
| `SPC w W` | select window using vim-choosewin |
|
||||
| `SPC w x` | exchange current window with next one |
|
||||
|
||||
#### Tabs manipulation key bindings
|
||||
|
||||
Tab manipulation commands (start with `F`):
|
||||
|
||||
| Key Bindings | Descriptions |
|
||||
| ------------ | ----------------- |
|
||||
| `SPC F d` | close current tab |
|
||||
| `SPC F D` | close other tabs |
|
||||
| `SPC F n` | create a new tab |
|
||||
|
||||
### Buffers and Files
|
||||
|
||||
#### Buffers manipulation key bindings
|
||||
|
||||
Buffer manipulation commands (start with `b`):
|
||||
|
||||
| Key Bindings | Descriptions |
|
||||
| -------------------- | ------------------------------------------------------------------------------ |
|
||||
| `SPC <Tab>` | switch to alternate buffer in the current window (switch back and forth) |
|
||||
| `SPC b .` | buffer transient state |
|
||||
| `SPC b b` | switch to a buffer (via denite/unite) |
|
||||
| `SPC b d` | kill the current buffer (does not delete the visited file) |
|
||||
| `SPC b D` | kill a visible buffer using vim-choosewin |
|
||||
| `SPC b Ctrl-d` | kill other buffers |
|
||||
| `SPC b Ctrl-Shift-d` | kill buffers using a regular expression |
|
||||
| `SPC b e` | erase the content of the buffer (ask for confirmation) |
|
||||
| `SPC b n` | switch to next buffer avoiding special buffers |
|
||||
| `SPC b m` | open _Messages_ buffer |
|
||||
| `SPC b o` | kill all saved buffers and windows except the current one |
|
||||
| `SPC b p` | switch to previous buffer avoiding special buffers |
|
||||
| `SPC b P` | copy clipboard and replace buffer (useful when pasting from a browser) |
|
||||
| `SPC b R` | revert the current buffer (reload from disk) |
|
||||
| `SPC b s` | switch to the _scratch_ buffer (create it if needed) |
|
||||
| `SPC b w` | toggle read-only (writable state) |
|
||||
| `SPC b Y` | copy whole buffer to clipboard (useful when copying to a browser) |
|
||||
| Key Bindings | Descriptions |
|
||||
| -------------------- | ------------------------------------------------------------------------ |
|
||||
| `SPC <Tab>` | switch to alternate buffer in the current window (switch back and forth) |
|
||||
| `SPC b .` | buffer transient state |
|
||||
| `SPC b b` | switch to a buffer (via denite/unite) |
|
||||
| `SPC b d` | kill the current buffer (does not delete the visited file) |
|
||||
| `SPC b D` | kill a visible buffer using vim-choosewin |
|
||||
| `SPC b Ctrl-d` | kill other buffers |
|
||||
| `SPC b Ctrl-Shift-d` | kill buffers using a regular expression |
|
||||
| `SPC b e` | erase the content of the buffer (ask for confirmation) |
|
||||
| `SPC b n` | switch to next buffer avoiding special buffers |
|
||||
| `SPC b m` | open _Messages_ buffer |
|
||||
| `SPC b o` | kill all saved buffers and windows except the current one |
|
||||
| `SPC b p` | switch to previous buffer avoiding special buffers |
|
||||
| `SPC b P` | copy clipboard and replace buffer (useful when pasting from a browser) |
|
||||
| `SPC b R` | revert the current buffer (reload from disk) |
|
||||
| `SPC b s` | switch to the _scratch_ buffer (create it if needed) |
|
||||
| `SPC b w` | toggle read-only (writable state) |
|
||||
| `SPC b Y` | copy whole buffer to clipboard (useful when copying to a browser) |
|
||||
|
||||
#### Create a new empty buffer
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user