diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 9afd4a575..68f755316 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -1226,7 +1226,6 @@ function! SpaceVim#end() abort endif if !g:spacevim_vimcompatible - nnoremap x cnoremap " Navigation in command line cnoremap @@ -1386,7 +1385,6 @@ function! SpaceVim#begin() abort endif call SpaceVim#default#options() call SpaceVim#default#layers() - call SpaceVim#default#keyBindings() call SpaceVim#commands#load() endfunction diff --git a/autoload/SpaceVim/default.vim b/autoload/SpaceVim/default.vim index 09ef61378..978ced8ce 100644 --- a/autoload/SpaceVim/default.vim +++ b/autoload/SpaceVim/default.vim @@ -290,8 +290,6 @@ function! SpaceVim#default#keyBindings() abort call SpaceVim#mapping#def('nnoremap ','g=',':call SpaceVim#mapping#format()','format current buffer','call SpaceVim#mapping#format()') - call SpaceVim#mapping#def('nnoremap ', '', ':call SpaceVim#util#CopyToClipboard()', - \ 'Copy buffer absolute path to X11 clipboard','call SpaceVim#util#CopyToClipboard()') endfunction fu! s:tobur(num) abort diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 9f69d3e91..921043187 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -129,6 +129,16 @@ function! SpaceVim#mapping#space#init() abort \ ] \ , 1) let s:lnum = expand('') + s:funcbeginline + call SpaceVim#mapping#space#def('nnoremap', ['w', 'x'], 'wincmd x', + \ ['window-switch-placement', + \ [ + \ '[SPC w x] is to jump to exchange current window with next one.', + \ '', + \ 'Definition: ' . s:file . ':' . s:lnum, + \ ] + \ ] + \ , 1) + let s:lnum = expand('') + s:funcbeginline call SpaceVim#mapping#space#def('nnoremap', ['w', 'k'], 'wincmd k', \ ['window-up', \ [ diff --git a/config/main.vim b/config/main.vim index c59cb4919..320a9cd60 100644 --- a/config/main.vim +++ b/config/main.vim @@ -67,5 +67,7 @@ call SpaceVim#begin() call SpaceVim#custom#load() +call SpaceVim#default#keyBindings() + call SpaceVim#end() " vim:set et sw=2 cc=80: diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 146c62e7b..b06c956b9 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -152,7 +152,10 @@ Neovim 运行在 iTerm2 上,采用 SpaceVim,配色为:_base16-solarized-da **临时快捷键菜单** -SpaceVim 根据需要定义了很多临时快捷键,这可以避免需要重复某些操作时过多按下 `SPC` 前缀键。当临时快捷键启用时,会在窗口下方打开一个快捷键介绍窗口,提示每一临时快捷键的功能。此外一些额外的辅助信息也将会显示出来。 +SpaceVim 根据需要定义了很多临时快捷键, +这可以避免需要重复某些操作时过多按下 `SPC` 前缀键。 +当临时快捷键启用时,会在窗口下方打开一个快捷键介绍窗口, +提示每一临时快捷键的功能。此外一些额外的辅助信息也将会显示出来。 文本移动临时快捷键: @@ -259,7 +262,6 @@ SpaceVim 根据需要定义了很多临时快捷键,这可以避免需要重 或者 `~/.cache/vimfiles/.cache/vimrc/`, 这依据当前使用的是 Neovim 还是 Vim。 - 除了 `on_cmd` 以外,还有一些其它的选项,可以通过 `:h dein-options` 查阅。 @@ -666,7 +668,7 @@ endfunction 标签栏上也支持鼠标操作,左键可以快速切换至该标签,中键删除该标签。该特性只支持 Neovim,并且需要 `has('tablineat')` 特性。 -**注意:** 这一特性仅限于Neovim并且 `has('tablineat')` 返回 `true`。 +**注意:** 这一特性仅限于 Neovim 并且 `has('tablineat')` 返回 `true`。 | 快捷键 | 功能描述 | | ---------------- | ------------ | @@ -777,8 +779,6 @@ SpaceVim 的文件树提供了版本控制信息的接口,但是这一特性 | `Ctrl-b` | 向上翻页 (`C-b` / `C-u`) | | `Ctrl-e` | 向下滚屏 (`3 Ctrl-e/j`) | | `Ctrl-y` | 向上滚屏 (`3Ctrl-y/k`) | -| `Ctrl-c` | 复制当前文件绝对路径 | -| `Ctrl-x` | 切换窗口文件 | | `Ctrl-Shift-Up` | 向上移动当前行 | | `Ctrl-Shift-Down` | 向下移动当前行 | @@ -824,7 +824,10 @@ SpaceVim 的文件树提供了版本控制信息的接口,但是这一特性 ### 快捷键导航 -当 Normal 模式下按下前缀键后出现输入延迟,则会在屏幕下方打开一个快捷键导航窗口,提示当前可用的快捷键及其功能描述,目前支持的前缀键有:`[SPC]`、`[Window]`、``、`g`、`z`。 +当 Normal 模式下按下前缀键后出现输入延迟, +则会在屏幕下方打开一个快捷键导航窗口, +提示当前可用的快捷键及其功能描述, +目前支持的前缀键有:`[SPC]`、`[Window]`、``、`g`、`z`。 这些前缀的按键为: @@ -834,6 +837,21 @@ SpaceVim 的文件树提供了版本控制信息的接口,但是这一特性 | `[Window]` | `windows_leader` / `s` | SpaceVim 默认窗口前缀键 | | `` | 默认的 Vim leader 键 | Vim/Neovim 默认前缀键 | + +默认的 `` 键是 `\`, 如果需要修改 `` +键则需要使用启动函数修改 `g:mapleader` 的值, +比如使用逗号 `,` 作为 `` 按键。 + +```vim +function! myspacevim#before() abort + let g:mapleader = ',' +endfunction +``` + +**注意:** 在函数中修改 `g:mapleader` 的值,不可以省略前缀 `g:`, +因为函数中的变量默认作用域是 `l:`,这与 Vim 的帮助 `:h mapleader` +有些许不一样。 + 默认情况下,快捷键导航将在输入延迟超过 1000ms 后打开,你可以通过修改 Vim 的 `'timeoutlen'` 选项来修改成适合自己的延迟时间长度。 例如,Normal 模式下按下空格键,你将会看到: @@ -1100,6 +1118,7 @@ SpaceVim 选项 `window_leader` 的值来设为其它按键: | `SPC w V` | 垂直分离窗口,并切换至新窗口 | | `SPC w w` | 切换至前一窗口 | | `SPC w W` | 选择一个窗口 | +| `SPC w x` | 切换窗口文件 | ### 缓冲区管理 @@ -1689,7 +1708,6 @@ Denite/Unite 是一个强大的信息筛选浏览器,这类似于 Emacs 中的 ### 工程管理 - 当打开一个文件时,SpaceVim 会自动切换当前目录至包含该文件的项目根目录, 项目根目录的检测依据 `project_rooter_patterns` 这一选项,其默认值为: diff --git a/docs/documentation.md b/docs/documentation.md index f16a0a255..52d52667d 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -267,7 +267,7 @@ to the `custom_plugins` section: `on_cmd` option means this plugin will be loaded only when the following commands are called. `merged` option is used for merging plugins directory. When `merged` is `trye`, all files in -this custom plugin will be merged into `~/.cache/vimfiles/.cache/init.vim/` for neovim or +this custom plugin will be merged into `~/.cache/vimfiles/.cache/init.vim/` for neovim or `~/.cache/vimfiles/.cache/vimrc/` for vim. For more options see `:h dein-options`. @@ -812,24 +812,23 @@ If only one file buffer is opened, a file is opened in the active window, otherw The following key bindings are the general key bindings for moving cursor. -| Key Bindings | Descriptions | -| ---------------- | ------------------------------------------------- | -| `h` | move cursor left | -| `j` | move cursor down | -| `k` | move cursor up | -| `l` | move cursor right | -| ``, `` | Smart up and down | -| `H` | move cursor to the top of the screen | -| `L` | move cursor to the bottom of the screen | -| `<` | Indent to left and re-select | -| `>` | Indent to right and re-select | -| `}` | paragraphs forward | -| `{` | paragraphs backward | -| `Ctrl-f` | Smart page forward (`Ctrl-f` / `Ctrl-d`) | -| `Ctrl-b` | Smart page backward (`C-b` / `C-u`) | -| `Ctrl-e` | Smart scroll down (`3 Ctrl-e/j`) | -| `Ctrl-y` | Smart scroll up (`3Ctrl-y/k`) | -| `Ctrl-c` | Copy full path of current buffer to X11 clipboard | +| Key Bindings | Descriptions | +| ---------------- | ---------------------------------------- | +| `h` | move cursor left | +| `j` | move cursor down | +| `k` | move cursor up | +| `l` | move cursor right | +| ``, `` | Smart up and down | +| `H` | move cursor to the top of the screen | +| `L` | move cursor to the bottom of the screen | +| `<` | Indent to left and re-select | +| `>` | Indent to right and re-select | +| `}` | paragraphs forward | +| `{` | paragraphs backward | +| `Ctrl-f` | Smart page forward (`Ctrl-f` / `Ctrl-d`) | +| `Ctrl-b` | Smart page backward (`C-b` / `C-u`) | +| `Ctrl-e` | Smart scroll down (`3 Ctrl-e/j`) | +| `Ctrl-y` | Smart scroll up (`3Ctrl-y/k`) | ### Native functions @@ -851,7 +850,6 @@ The following key bindings are the general key bindings for moving cursor. | `` | Indent to right and re-select | | `Shift-` | Indent to left and re-select | | `Ctrl-q` | `Ctrl-w` | -| `Ctrl-x` | Switch buffer and placement | | `Ctrl-Shift-Up` | move lines up | | `Ctrl-Shift-Down` | move lines down | @@ -885,6 +883,20 @@ The default keys of these prefixs are: | `[WIN]` | `windows_leader` / `s` | window mapping prefix of SpaceVim | | `` | default vim leader | default leader prefix of vim/Neovim | +The default value of `` is `\`, if you want to change this key, +you need to use bootstrap function. For example, use `,` as the `` key: + +```vim +function! myspacevim#before() abort + let g:mapleader = ',' +endfunction +``` + +**NOTE:** When changing valuable `g:mapleader` in a function. +you can not omit the valuable scope. Because the default scope +of a valuable in function is `l:`. It seems different from what you +seee in vim help `:h mapleader`. + By default the guide buffer will be displayed 1000ms after the keys being pressed. You can change the delay by adding vim option `'timeoutlen'` to your bootstrap function. @@ -1160,6 +1172,7 @@ Windows manipulation commands (start with `w`): | `SPC w V` | vertical split and focus new window | | `SPC w w` | cycle and focus between windows | | `SPC w W` | select window using vim-choosewin | +| `SPC w x` | exchange current window with next one | ### Buffers and Files @@ -1733,7 +1746,7 @@ which will tell you the functional of all mappings starting with `z`. When open a file, SpaceVim will change current directory to the project root directory which contains this file. The project root directory detection -is based on on `project_rooter_patterns` option, and the default value is: +is based on on `project_rooter_patterns` option, and the default value is: ```toml [options]