SpaceVim
SpaceVim 中文手册
项 目 主 页: https://spacevim
Github 地址 : https://github/SpaceVim/SpaceVim
SpaceVim 是一个社区驱动的模块化 vim/neovim 配置集合,其中包含了多种功能模块,并且针对 neovim 做了功能优化。spacevim 有多种功能模块可供用户选择,针对不同语言选择特定的模块,就可以配置出一个适合特定语言开发的环境。
使用过程中遇到问题或者有什么功能需求可以在 github 提交 issue,这将更容易被关注和修复。我们也欢迎喜欢 vim/neovim 的用户加入我们的 QQ 群,一起讨论 vim 相关的技巧,点击加入Vim/SpaceVim用户群。
以下是近几周的开发汇总:
以下为SpaceVim中文手册,部分内容还未完成翻译,为了方便大家查询相关信息,已提前发布官网上,后面会逐渐更新完成,感谢大家一直以来的支持!
安装Linux 或 Mac 下 SpaceVim的安装非常简单,只需要执行以下命令即可:
curl -sLf https://spacevim/install.sh | bash想要获取更多的自定义的安装方式,请参考:
curl -sLf https://spacevim/install.sh | bash -s -- -hSpaceVim是一种模块化配置,可以运行在vim或者neovim上,关于vim以及neovim的安装,请参考以下链接:
安装neovim
从源码编译vim
windows系统下的安装步骤:
Windows 下 vim 用户只需要将本仓库克隆成用户 HOME 目录下的 vimfiles 即可,打开 CMD 默认的目录默认即为 HOME 目录,只需要执行如下命令即可:
git clone https://github/SpaceVim/SpaceVim.git vimfilesWindows 下 neovim 用户 需要将本仓库克隆成用户 HOME 目录下的 AppData\Local\nvim,想要获取跟多关于 neovim 安装相关的知识,可以访问 neovim 的 wiki, wiki 写的非常详细。打开 CMD 初始目录默认一般即为 HOME 目录,只需要执行如下命令即可:
git clone https://github/SpaceVim/SpaceVim.git AppData\Local\nvim字体
SpaceVim 默认启用了Powerline 字体,默认的的字体文件是:DejaVu Sans Mono, Windows 用户直接下载下来右键安装即可。
vimproc.dll
Windows 下用户如果不方便编译,可以在qq群文件里面下载相应的dll文件放到vimproc 的lib目录,默认是 ~/.cache/vimfiles/repos/github/Shougo/vimproc.vim/lib/
更新可以通过 :SPUpdate 命令来更新spacevim 以及包含的插件,如果需要更新指定的插件,如:startuptime.vim,只需要执行 :SPUpdate startuptime.vim,也可以通过 :SPUpdate SpaceVim 来更新 SpaceVim.
文档 核心思想四大核心思想: 记忆辅助, 可视化交互, 一致性,社区驱动.
如果违背了以上四大核心思想,我们将会尽力修复。
记忆辅助所有快捷键,根据其功能的不同分为不同的组,以相应的按键作为前缀,例如 b 为 buffer 相关快捷键前缀,p 为 project 相关快捷键前缀, s 为 search 相关快捷键前缀,h 为 help 相关快捷键前缀。
可视化交互创新的实时快捷键辅助系统,以及查询系统,方便快捷查询到可用的模块、插件以及其他更多信息。
一致性相似的功能使用同样的快捷键,这在 SpaceVim 中随处可见。这得益于明确的约定。其他模块的文档都以此为基础。
社区驱动社区驱动,保证了 bug 修复的速度,以及新特性更新的速度。
显著特性 详细的文档: 在 SpaceVim 通过 :h SpaceVim 来访问 SpaceVim 帮助文档。优雅简洁的界面: 你将会喜欢这样的优雅而实用的界面。确保手指不离开主键盘区域: 使用 Space 作为前缀键,合理组织快捷键,确保手指不离开主键盘区域。快捷键辅助系统: SpaceVim 所有快捷键无需记忆,当输入出现停顿,会实时提示可用按键及其功能。更快的启动时间: 得益于 dein.vim, SpaceVim 中90% 的插件都是按需载入的。更少的肌肉损伤: 频繁使用空格键,取代 ctrl,shift 等按键,大大减少了手指的肌肉损伤。更易扩展: 依照一些约定,很容易将现有的插件集成到 SpaceVim 中来。完美支持Neovim: 依赖于 Neovim 的 romote 插件以及 异步 API,SpaceVim 运行在 Neovim 下将有更加完美的体验。 快捷键导航SpaceVim 所有的快捷键都不需要去记忆,有强大的快捷键导航系统来提示每一个按键的具体功能,比如 Normal 模式下按下空格键,将出现如下提示:
这一导航提示将所有以空格为前缀的快捷键分组展示,比如 b 是所以 buffer 相关的快捷键, p 是所有工程管理相关的快捷键。在导航模式下按下 <C-h> 你将在状态栏上看见相应的帮助信息,按键介绍如下:
按键描述u撤销前一按键n导航系统下一页p导航系统前一页 运行截图 欢迎页面 工作界面Neovim 运行在 iTerm2 上,采用 SpaceVim,配色为:base16-solarized-dark
展示了一个通用的前端开发界面,用于开发: JavaScript (jQuery), SASS, and PHP buffers.
图中包含了一个 Neovim 的终端, 一个语法树窗口,一个文件树窗口以及一个 TernJS 定义窗口
想要查阅更多截图,清阅读 issue #415
谁将从 SpaceVim 中获益? 初级 Vim 用户.追求优雅界面的 Vim 用户追求更少肌肉损伤的 Vim 用户想要学习一种不一样的编辑文件方式的 Vim 用户追求简单但是可高度配置系统的 Vim 用户 更新和回滚 SpaceVim 自身更新可通过很多种方式来更新 SpaceVim 的核心文件。建议在更新 SpaceVim 之前,更新一下所有的插件。具体内容如下:
自动更新
注意:默认,这一特性是禁用的,因为自动更新将会增加 SpaceVim 的启动时间,影响用户体验。如果你需要这一特性,可以将如下加入到用户配置文件中:let g:spacevim_automatic_update = 1。
启用这一特性后,SpaceVim 将会在每次启动时候检测是否有新版本。更新后需重启 SpaceVim。
通过插件管理器更新
使用 :SPUpdate SpaceVim 这一命令,将会打开 SpaceVim 的插件管理器,更新 SpaceVim, 具体进度会在插件管理器 buffer 中展示。
通过 git 进行更新
可通过在 SpaceVim 目录中手动执行 git pull, SpaceVim 在 windows 下默认目录为 ~/vimfilers, 但在 Linux 下则可使用如下命令:git -C ~/.SpaceVim pull.
更新插件使用 :SPUpdate 这一命令将会更新所有插件,包括 SpaceVim 自身。当然这一命令也支持参数,参数为插件名称,可同时添加多个插件名称作为参数,同时可以使用 Tab 键来补全插件名称。
配置模块这里仅仅是大致罗列了下常用的模块,若要了解关于配置模块更加详细的信息,可阅读 SpaceVim's layers page,(强烈建议阅读!)
用户配置用户配置保存在 ~/.SpaceVim.d/ 文件夹。
自动生成用户配置初次启动 SpaceVim 时,他将提供选择目录,用户需要选择合适自己的配置模板。此时,SpaceVim 将自动在 HOME 目录生成 ~/.SpaceVim.d/init.vim。
用户配置目录~/.SpaceVim.d/ 将被加入 Vim 的运行时路径 &runtimepath。详情清阅读 :h rtp.
当然,你也可以通过 SPACEVIMDIR 这一环境变量,执定用户配置目录。当然也可以通过软连接连改变目录位置,以便配置备份。
SpaceVim 同时还支持项目本地配置,配置出世文件为,当前目录下的 .SpaceVim.d/init.vim 文件。同时当前目录下的 .SpaceVim.d/ 也将被加入到 Vim 运行时路径。
这是一个用户配置文件示例:
" Here are some basic customizations, please refer to the ~/.SpaceVim.d/init.vim" file for all possible options:let g:spacevim_default_indent = 3let g:spacevim_max_column = 80" Change the default directory where all miscellaneous persistent files go." By default it is ~/.cache/vimfiles.let g:spacevim_plugin_bundle_dir = '~/.cache/vimfiles'" set SpaceVim colorschemelet g:spacevim_colorscheme = 'jellybeans'" Set plugin manager, you want to use, default is dein.vimlet g:spacevim_plugin_manager = 'dein' " neobundle or dein or vim-plug" use space as `<Leader>`let mapleader = "\<space>"" Set windows shortcut leader [Window], default is `s`let g:spacevim_windows_leader = 's'" Set unite work flow shortcut leader [Unite], default is `f`let g:spacevim_unite_leader = 'f'" By default, language specific plugins are not loaded. This can be changed" with the following, then the plugins for go development will be loaded.call SpaceVim#layers#load('lang#go')" loaded ui layercall SpaceVim#layers#load('ui')" If there is a particular plugin you don't like, you can define this" variable to disable them entirely:let g:spacevim_disabled_plugins=[\ ['junegunn/fzf.vim'],\ ]" If you want to add some custom plugins, use these options:let g:spacevim_custom_plugins = [\ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}],\ ['wsdjeg/GitHub.vim'],\ ]" set the guifontlet g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11'更加详细的 SpaceVim 选项可以查阅 :h SpaceVim.
概念 临时快捷键SpaceVim 根据需要定义了很多临时快捷键,这将避免需要重复某些操作时,过多按下 SPC 前置键。当临时快捷键启用时,会在窗口下方打开一个快捷键介绍窗口,提示每一临时快捷键的功能。此外一些格外的辅助信息也将会体现出来。
文本移动临时快捷键:
优雅的界面SpaceVim 集成了多种使用UI插件,如常用的文件树、语法树等插件,配色主题默认采用的是 gruvbox。
主题SpaceVim 默认的颜色主题采用的是 gruvbox。这一主题有深色和浅色两种。关于这一主题一些详细的配置可以阅读 :h gruvbox.
如果需要修改 SpaceVim 的主题,可以在 ~/.SpaceVim.d/init.vim 中修改 g:g:spacevim_colorscheme。例如,使用 vim-one with dark colorscheme
let g:spacevim_colorscheme = 'one'let g:spacevim_colorscheme_bg = 'dark' 快捷键描述SPC T n切换至下一个随机主题SPC T s通过 Unite 选择主题可以在主题模块中查看 SpaceVim 支持的所有主题。
注意:
SpaceVim 在终端下默认使用了真色,因此使用之前需要确认下你的终端是否支持真色,可以阅读 Colours in terminal 了解根多关于真色的信息。
字体在 SpaceVim 中默认的字体是 DejaVu Sans Mono for Powerline. 如果你也喜欢这一字体,建议将这一字体安装到系统中。如果需要修改 SpaceVim 的字体,可以在用户配置文件中修改 g:spacevim_guifont,默认值为:
let g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11'如果指定的字体不存在,将会使用系统默认的字体,此外,这一选项在终端下是无效的,终端下修改字体,需要修改终端自身配置。
界面元素切换大多数界面元素可以通过快捷键来隐藏或者显示(这一组快捷键以 t 和 T 开头):
快捷键描述SPC t 8高亮所有超过80列的字符SPC t f高亮临界列,默认是第80列SPC t h h高亮当前行SPC t h i高亮代码对齐线SPC t h c高亮光标所在列SPC t h s启用/禁用语法高亮SPC t i切换显示当前对齐(TODO)SPC t n显示/隐藏行号SPC t b切换背景色SPC t t打开 Tab 管理器SPC T ~显示/隐藏 buffer 结尾空行行首的 ~SPC T F切换全屏(TODO)SPC T f显示/隐藏 Vim 边框(GUI)SPC T m显示/隐藏菜单栏SPC T t显示/隐藏工具栏 状态栏 & 标签栏状态栏和工具栏是高度定制的模块,提供了如下特性:
展示 buffer 或者 Tab 的序列号展示当前模式展示 git 相关信息展示语法检查信息展示 trailing line 的行号展示当前 SpaceVim 已启用的功能展示文件信息展示搜索结果序号 快捷键描述SPC [1-9]跳至制定序号的窗口状态栏
core#statusline 模块提供了一个高度定制的状态栏,提供如下特性,这一模块的灵感来自于 spacemacs 的状态栏。
展示窗口序列号通过不同颜色展示当前模式展示搜索结果序列号显示/隐藏语法检查信息显示/隐藏电池信息显示/隐藏 SpaceVim 功能启用状态默认主题 gruvbox 的状态栏颜色和模式对照表:
模式颜色Normal灰色Insert蓝色Visual橙色Replace浅绿色以上的这几种模式所对应的颜色取决于不同的主题模式。
一些状态栏元素可以进行动态的切换:
快捷键描述SPC t m b显示/隐藏电池状态 (需要安装 acpi)SPC t m ctoggle the org task clock (available in org layer)(TODO)SPC t m m显示/隐藏 SpaceVim 已启用功能SPC t m M显示/隐藏文件类型SPC t m ntoggle the cat! (if colors layer is declared in your dotfile)(TODO)SPC t m p显示/隐藏鼠标位置信息SPC t m t显示/隐藏时间SPC t m T显示/隐藏状态栏SPC t m v显示/隐藏版本控制信息Powerline 字体安装:
SpaceVim 默认使用 DejaVu Sans Mono for Powerline, 为了使状态栏得以正常显示,你需要安装这一字体。如果需要在状态栏中展示其他类型的分割符,则需要安装 powerline extra symbols.
语法检查信息:
状态栏中语法检查信息元素如果被启用了,当语法检查结束后,会在状态栏中展示当前语法错误和警告的数量。
TODO: add a picture
语法检查信息
搜索结果信息:
当使用 / 或 ? 进行搜索时,或当按下 n 或 N 后,搜索结果序号将被展示在状态栏中,类似于 20/22 显示搜索结果总数以及当前结果的序号。具体的效果图如下:
search index in statusline
电池状态信息:
acpi 可展示电池电量剩余百分比.
使用不同颜色展示不同的电池状态:
电池状态颜色75% - 100%绿色30% - 75%黄色0 - 30%红色所有的颜色都取决于不同的主题。
状态栏分割符:
可通过使用 g:spacevim_statusline_separator 来定制状态栏分割符,例如使用非常常用的方向箭头作为状态栏分割符:
let g:spacevim_statusline_separator = 'arrow'SpaceVim 所支持的分割符以及截图如下:
分割符截图arrowcurveslantnilfireSpaceVim 功能模块:
功能模块可以通过 SPC t m m 快捷键显示或者隐藏。默认使用 Unicode 字符,可通过设置 let g:spacevim_statusline_unicode_symbols = 0 来启用 ASCII 字符。(或许在终端中无法设置合适的字体时,可使用这一选项)。
状态栏中功能模块内的字符显示与否,同如下快捷键功能保持一致:
快捷键UnicodeASCII功能SPC t 8⑧8高亮80列之后信息SPC t fⓕf高亮第80列SPC t sⓢs语法检查SPC t SⓈS拼写检查SPC t wⓦw行尾空格检查标签栏
如果只有一个Tab, Buffers 将被罗列在标签栏上,每一个包含:序号、文件类型图标、文件名。如果有不止一个 Tab, 那么所有 Tab 将被罗列在标签栏上。标签栏上每一个 Tab 或者 Baffer 可通过快捷键 <Leader> number 进行快速访问,默认的 <Leader> 是 \。
快捷键描述<Leader> 1跳至标签栏序号 1<Leader> 2跳至标签栏序号 2<Leader> 3跳至标签栏序号 3<Leader> 4跳至标签栏序号 4<Leader> 5跳至标签栏序号 5<Leader> 6跳至标签栏序号 6<Leader> 7跳至标签栏序号 7<Leader> 8跳至标签栏序号 8<Leader> 9跳至标签栏序号 9 手册 自动补全Unite/Denite
请阅读 unite 和 denite 文档: :h unite 和 :h denite。
Unite/Denite buffer 中的快捷键
快捷键模式功能描述Ctrl+h/k/l/rNormal无效Ctrl+lNormal刷新界面TabInsert下一结果TabNormal选择操作Shift + TabInsert上一结果SpaceNormal标记当前结果EnterNormal执行默认操作Ctrl+vNormal在分割窗口中打开Ctrl+sNormal在垂直分割窗口打开Ctrl+tNormal在新 Tab 中打开Ctrl + gNormal推出 Unite/DenitejkInsert离开 Insert 模式rNormal重命名或者替换搜索内容Ctrl+zNormal/insert切换窗口布局Ctrl+wInsert删除前一单词 交互快捷键
快捷键导航
当 Normal 模式下按下前缀键后出现输入延迟,则会在屏幕下方打开一个快捷键导航窗口,提示当前可用的快捷键及其功能描述,目前支持的前缀键有:[SPC]、[Window]、[Denite]、[Unite]、<Leader>、g、z。
这些前缀的按键为:
前缀名称用户选项以及默认值描述[SPC]空格键SpaceVim 默认前缀键[Window]g:spacevim_windows_leader / sSpaceVim 默认窗口前缀键[denite]g:spacevim_denite_leader / FSpaceVim 默认 Denite 前缀键[unite]g:spacevim_unite_leader / fSpaceVim 默认 Unite 前缀键<leader>mapleader / \\Vim/neovim 默认前缀键默认情况下,快捷键导航将在输入延迟超过 1000ms 后打开,你可以通过修改 vim 的 'timeoutlen' 选项来修改成适合自己的延迟时间长度。
例如,Normal 模式下按下空格键,你将会看到:
这一导航窗口将提示所有以空格键为前缀的快捷键,并且根据功能将这些快捷键进行了分组,例如 buffer 相关的快捷键都是 b,工程相关的快捷键都是 p。在代码导航窗口内,按下 <C-h> 键,可以获取一些帮助信息,这些信息将被显示在状态栏上,提示的是一些翻页和撤销按键的快捷键。
按键描述u撤销按键n向下翻页p向上翻页如果要自定义以 [SPC] 为前缀的快捷键,可以使用 SpaceVim#custom#SPC(),示例如下:
call SpaceVim#custom#SPC('nnoremap', ['f', 't'], 'echom "hello world"', 'test custom SPC', 1)通过 Unite/Denite 浏览快捷键
可以通过 SPC ? 使用 Unite 将当前快捷键罗列出来。然后可以输入快捷键按键字母或者描述,Unite 可以通过模糊匹配,并展示结果。
使用 <Tab> 键或者上下方向键选择你需要的快捷键,回车将执行这一快捷键。
获取帮助信息
Denite/Unite 是一个强大的信息筛选浏览器,这类似于 emacs 中的 Helm。以下这些快捷键将帮助你快速获取需要的帮助信息:
快捷键描述SPC h SPC使用 Unite 展示 SpaceVim 帮助文档章节目录SPC h i获取光标下单词的帮助信息SPC h k使用快捷键导航,展示 SpaceVim 所支持的前缀键SPC h m使用 Unite 浏览所有 man 文档报告一个问题:
快捷键描述SPC h I根据模板展示 Issue 所必须的信息可用模块
所有可用模块可以通过命令 SPLayer -l 或者快捷键 SPC h l 来展示。
可用的插件
可通过快捷键 <leader> l p 列出所有已安装的插件,支持模糊搜索,回车将使用浏览器打开该插件的官网。
添加用户自定义插件
如果添加来自于 github 的插件,可以 用户名/仓库名 这一格式,将该插件添加到 g:spacevim_custom_plugins,示例如下:
let g:spacevim_custom_plugins = [ \ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}], \ ['wsdjeg/GitHub.vim'], \ ]界面元素显示切换
所有的界面元素切换快捷键都是已 [SPC] t 或者 [SPC] T 开头的,你可以在快捷键导航中查阅所有快捷键。
常规操作光标移动
光标的移动默认采用 vi 的默认形式:hjkl。
快捷键描述h向左移动光标(Vim 原生功能,无映射)j向下移动光标(Vim 原生功能,无映射)k向上移动光标(Vim 原生功能,无映射)l向右移动光标(Vim 原生功能,无映射)H光标移至屏幕最上方(Vim 原生功能,无映射)L光标移至屏幕最下方(Vim 原生功能,无映射)SPC j 0跳至行首(并且标记原始位置)SPC j $跳至行尾(并且标记原始位置)SPC t -锁定光标在屏幕中间(TODO)快速跳转
快速跳到网址 (TODO)
类似于 Firefox 的 vimperator 的 f 键的功能。
快捷键描述SPC j u/(o for help buffer)快速跳到/打开url常用的成对快捷键
快捷键描述[ SPC在当前行或已选区域上方添加空行] SPC在当前行或已选区域下方添加空行[ b跳至前一 buffer] b跳至下一 buffer[ f跳至文件夹中的前一个文件] f跳至文件夹中的下一个文件[ l跳至前一个错误处] l跳至下一个错误处[ c跳至前一个 vcs hunk] c跳至下一个 vcs hunk[ q跳至前一个错误] q跳至下一个错误[ t跳至前一个标签页] t跳至下一个标签页[ w跳至前一个窗口] w跳至下一个窗口[ e向上移动当前行或者已选择行] e向下移动当前行或者已选择行[ p粘贴至当前行上方] p粘贴至当前行下方g p选择粘贴的区域跳转,合并,拆分
以 SPC j 为前缀的快捷键主要用作:跳转(jumping),合并(joining),拆分(splitting)。
跳转
快捷键描述SPC j 0跳至行首,并且在原始位置留下标签,以便跳回SPC j $跳至行尾,并且在原始位置留下标签,以便跳回SPC j b向后回跳SPC j f向前跳SPC j d跳至当前目录某个文件夹SPC j D跳至当前目录某个文件夹(在另外窗口展示文件列表)SPC j i跳至当前文件的某个函数,使用 Denite 打开语法树SPC j I跳至所有 Buffer 的语法树(TODO)SPC j j跳至当前窗口的某个字符 (easymotion)SPC j J跳至当前窗口的某两个字符的组合 (easymotion)SPC j k跳至下一行,并且对齐下一行SPC j l跳至某一行 (easymotion)SPC j qshow the dumb-jump quick look tooltip (TODO)SPC j u跳至窗口某个 url (TODO)SPC j v跳至某个 vim 函数的定义处 (TODO)SPC j w跳至 Buffer 中某个单词 (easymotion)合并,拆分
快捷键描述J合并当前行和下一行SPC j k跳至下一行,并且对齐该行SPC j n从光标处断开当前行,并且插入空行以及进行对齐SPC j o从光标处拆分该行,光标留在当前行SPC j s从光标处进行拆分 StringSPC j S从光标处进行拆分 String,并插入对齐的空行窗口操作
窗口操作常用快捷键
每一个窗口,都有一个编号,该编号显示在状态栏的最前端,可通过 SPC 编号 进行快速窗口跳转。
快捷键描述SPC 1跳至窗口 1SPC 2跳至窗口 2SPC 3跳至窗口 3SPC 4跳至窗口 4SPC 5跳至窗口 5SPC 6跳至窗口 6SPC 7跳至窗口 7SPC 8跳至窗口 8SPC 9跳至窗口 9窗口操作相关快捷键(以 SPC w 为前缀):
快捷键描述SPC w TAB/<Tab>在统一标签内进行窗口切换SPC w =对齐分离的窗口SPC w bforce the focus back to the minibuffer (TODO)SPC w c进入阅读模式,浏览当前窗口SPC w C选择某一个窗口,并且进入阅读模式SPC w d删除一个窗口SPC u SPC w ddelete a window and its current buffer (does not delete the file) (TODO)SPC w D选择一个窗口,并且关闭SPC u SPC w Ddelete another window and its current buffer using vim-choosewin (TODO)SPC w ttoggle window dedication (dedicated window cannot be reused by a mode) (TODO)SPC w ftoggle follow mode (TODO)SPC w F新建一个新的标签页SPC w h移至左边窗口SPC w H将窗口向左移动SPC w j移至下方窗口SPC w J将窗口移至下方SPC w k移至上方窗口SPC w K将窗口移至上方SPC w l移至右方窗口SPC w L将窗口移至右方SPC w m最大化/最小化窗口(最大化相当于关闭其他窗口)(TODO, now only support maximize)SPC w M选择窗口进行替换SPC w o按序切换标签页SPC w p mopen messages buffer in a popup window (TODO)SPC w p pclose the current sticky popup window (TODO)SPC w r按序切换窗口SPC w R逆序切换窗口SPC w s or SPC w -水平分割窗口SPC w S水平分割窗口,并切换至新窗口SPC w uundo window layout (used to effectively undo a closed window) (TODO)SPC w Uredo window layout (TODO)SPC w v or SPC w /垂直分离窗口SPC w V垂直分离窗口,并切换至新窗口SPC w w切换至前一窗口SPC w W选择一个窗口文件和 Buffer 操作
Buffer 操作相关快捷键
Buffer 操作相关快捷键都是已 SPC b 为前缀的:
快捷键描述SPC TAB切换至前一buffer,可用于两个 buffer 来回切换SPC b .启用 buffer 临时快捷键SPC b b切换至某一 buffer,通过 Unite/Denite 进行筛选SPC b d删除当前 buffer,但保留 Vim 窗口SPC u SPC b dkill the current buffer and window (does not delete the visited file) (TODO)SPC b D选择一个窗口,并删除其 bufferSPC u SPC b Dkill a visible buffer and its window using ace-window(TODO)SPC b C-d删除其他 bufferSPC b C-Dkill buffers using a regular expression(TODO)SPC b e清除当前 buffer 内容,需要手动确认SPC b h打开 SpaceVim 欢迎界面SPC b n切换至下一个 buffer,排除特殊插件的 bufferSPC b m打开 Messages bufferSPC u SPC b mkill all buffers and windows except the current one(TODO)SPC b p切换至前一个 buffer,排除特殊插件的 bufferSPC b P使用剪切板内容替换当前 bufferSPC b R从磁盘重新读取当前 buffer 所对应的文件SPC b sswitch to the scratch buffer (create it if needed) (TODO)SPC b w切换只读权限SPC b Y将整个 buffer 复制到剪切板z fMake current function or comments visible in buffer as much as possible (TODO)新建空白 buffer
快捷键描述SPC b N h在左侧新建一个窗口,并在其中新建空白 bufferSPC b N j在下方新建一个窗口,并在其中新建空白 bufferSPC b N k在上方新建一个窗口,并在其中新建空白 bufferSPC b N l在右侧新建一个窗口,并在其中新建空白 bufferSPC b N n在当前窗口新建一个空白 buffer特殊 buffer
在 SpaceVim 中,有很多特殊的 buffer,这些 buffer 是由插件或者 SpaceVim 自身新建的,并不会被列出。
文件操作相关快捷键
文件操作相关的快捷键都是以 SPC f 为前缀的:
快捷键描述SPC f b跳至文件书签SPC f ccopy current file to a different location(TODO)SPC f C d修改文件编码 unix -> dosSPC f C u修改文件编码 dos -> unixSPC f D删除文件以及 buffer,需要手动确认SPC f Eopen a file with elevated privileges (sudo edit)(TODO)SPC f f打开文件SPC f F打开光标下的文件SPC f oopen a file using the default external program(TODO)SPC f Rrename the current file(TODO)SPC f s保存文件SPC f S保存所有文件SPC f r打开文件历史SPC f t切换侧栏文件树SPC f T打开文件树侧栏SPC f y复制当前文件,并且显示当前文件路径Vim 和 SpaceVim 相关文件
SpaceVim 相关的快捷键均以 SPC f v 为前缀,这便于快速访问 SpaceVim 的配置文件:
快捷键描述SPC f v v复制并显示当前 SpaceVim 的版本SPC f v d打开 SpaceVim 的用户配置文件文件树
SpaceVim 使用 vimfiler 作为默认的文件树插件,默认的快捷键是 F3, SpaceVim 也提供了另外一组快捷键 SPC f t 和 SPC f T 来打开文件树,如果需要使用 nerdtree 作为默认文件树,需要设置:
" the default value is vimfilerlet g:spacevim_filemanager = 'nerdtree'SpaceVim 的文件树提供了版本控制信息的借口,但是这一特性需要分析文件夹内容,会使得文件树插件比较慢,因此默认没有打开,如果需要使用这一特性,可向配置文件中加入 let g:spacevim_enable_vimfiler_gitstatus = 1,启用后的截图如下:
文件树中的常用操作
文件树中主要以 hjkl 为核心,这类似于 vifm 中常用的快捷键:
快捷键描述<F3> or SPC f t切换文件树文件树内的快捷键 <Left> or h移至父目录,并关闭文件夹<Down> or j向下移动光标<Up> or k向上移动光标<Right> or l展开目录,或打开文件Ctrl+j未使用Ctrl+l未使用E未使用.切换显示隐藏文件sv分屏编辑该文件sg垂直分屏编辑该文件p预览文件i切换至文件夹历史v快速查看gx使用相关程序执行该文件(TODO)'切换标签V标记该文件Ctrl+r刷新页面文件树中打开文件
如果只有一个可编辑窗口,则在该窗口中打开选择的文件,否则则需要制定窗口来打开文件:
快捷键描述l or Enter打开文件sg分屏打开文件sv垂直分屏打开文件 Commands starting with gafter pressing prefix g in normal mode, if you do not remember the mappings, you will see the guide which will tell you the functional of all mappings starting with g.
Key BindingDescriptiong#search under cursor backwardg$go to rightmost characterg&repeat last ":s" on all linesg'jump to markg*search under cursor forwardg+newer text stateg,newer position in change listg-older text stateg/stay incsearchg0go to leftmost characterg;older position in change listg<last page of previous command outputg<Home>go to leftmost charactergEend of previous wordgFedit file under cursor(jump to line after name)gHselect line modegIinsert text in column 1gJjoin lines without spacegNvisually select previous matchgQswitch to Ex modegRenter VREPLACE modegTprevious tag pagegUmake motion text uppercaseg]tselect cursor tagg^go to leftmost no-white characterg_go to last charg`jump to markgaprint ascii value of cursor charactergdgoto definitiongego to end of previous wordgfedit file under cursorgggo to line Nghselect modegiinsert text after '^ markgjmove cursor down screen linegkmove cursor up screen linegmgo to middle of screenlinegnvisually select next matchgogoto byte N in the buffergssleep N secondsgtnext tag pagegumake motion text lowercaseg~swap case for Nmove textg<End>go to rightmost characterg<C-G>show cursor info Commands starting with zafter pressing prefix z in normal mode, if you do not remember the mappings, you will see the guide which will tell you the functional of all mappings starting with z.
Key BindingDescriptionz<Right>scroll screen N characters to leftz+cursor to screen top line Nz-cursor to screen bottom line Nz.cursor line to centerz<CR>cursor line to topz=spelling suggestionszAtoggle folds recursivelyzCclose folds recursivelyzDdelete folds recursivelyzEeliminate all foldszFcreate a fold for N lineszGmark good spelled(update internal-wordlist)zHscroll half a screenwidth to the rightzLscroll half a screenwidth to the leftzMset foldlevel to zerozNset foldenablezOopen folds recursivelyzRset foldlevel to deepest foldzWmark wrong spelledzXre-apply foldlevez^cursor to screen bottom line Nzatoggle a foldzbredraw, cursor line at bottomzcclose a foldzddelete a foldzeright scroll horizontally to cursor positionzfcreate a fold for motionzgmark good spelledzhscroll screen N characters to rightzitoggle foldenablezjmode to start of next foldzkmode to end of previous foldzlscroll screen N characters to leftzmsubtract one from foldlevelznreset foldenablezoopen foldzradd one to foldlevelzsleft scroll horizontally to cursor positionztcursor line at top of windowzvopen enough folds to view cursor linezxre-apply foldlevel and do "zV"zzsmart scrollz<Left>scroll screen N characters to right Auto-saving Searching With an external toolSpaceVim can be interfaced with different searching tools like:
rg - ripgrepag - the silver searcherpt - the platinum searcherackgrepThe search commands in SpaceVim are organized under the SPC s prefix with the next key is the tool to use and the last key is the scope. For instance SPC s a b will search in all opened buffers using ag.
If the last key (determining the scope) is uppercase then the current word under the cursor is used as default input for the search. For instance SPC s a B will search with word under cursor.
If the tool key is omitted then a default tool will be automatically selected for the search. This tool corresponds to the first tool found on the system of the list g:spacevim_search_tools, the default order is rg, ag, pt, ack then grep. For instance SPC s b will search in the opened buffers using pt if rg and ag have not been found on the system.
The tool keys are:
ToolKeyagagrepgackkrgrpttThe available scopes and corresponding keys are:
ScopeKeyopened buffersbfiles in a given directoryfcurrent projectpIt is possible to search in the current file by double pressing the second key of the sequence, for instance SPC s a a will search in the current file with ag.
Notes:
rg, ag and pt are optimized to be used in a source control repository but they can be used in an arbitrary directory as well.It is also possible to search in several directories at once by marking them in the unite buffer.Beware if you use pt, TCL parser tools also install a command line tool called pt.
Useful key bindings
Key BindingDescriptionSPC r lresume the last completion bufferSPC s `go back to the previous place before jumpPrefix argumentwill ask for file extensionsSearching in current file
Key BindingDescriptionSPC s ssearch with the first found toolSPC s Ssearch with the first found tool with default inputSPC s a aagSPC s a Aag with default inputSPC s g ggrepSPC s g Ggrep with default inputSPC s r rrgSPC s r Rrg with default inputSearching in all loaded buffers
Key BindingDescriptionSPC s bsearch with the first found toolSPC s Bsearch with the first found tool with default inputSPC s a bagSPC s a Bag with default inputSPC s g bgrepSPC s g Bgrep with default inputSPC s k backSPC s k Back with default inputSPC s r brgSPC s r Brg with default inputSPC s t bptSPC s t Bpt with default inputSearching in an arbitrary directory
Key BindingDescriptionSPC s fsearch with the first found toolSPC s Fsearch with the first found tool with default inputSPC s a fagSPC s a Fag with default textSPC s g fgrepSPC s g Fgrep with default textSPC s k fackSPC s k Fack with default textSPC s r frgSPC s r Frg with default textSPC s t fptSPC s t Fpt with default textSearching in a project
Key BindingDescriptionSPC / or SPC s psearch with the first found toolSPC * or SPC s Psearch with the first found tool with default inputSPC s a pagSPC s a Pag with default textSPC s g pgrepSPC s g pgrep with default textSPC s k packSPC s k Pack with default textSPC s t pptSPC s t Ppt with default textSPC s r prgSPC s r Prg with default textHint: It is also possible to search in a project without needing to open a file beforehand. To do so use SPC p p and then C-s on a given project to directly search into it like with SPC s p. (TODO)
Background searching in a project
Background search keyword in a project, when searching done, the count will be shown on the statusline.
Key BindingDescriptionSPC s jsearching input expr background with the first found toolSPC s Jsearching cursor word background with the first found toolSPC s lList all searching result in quickfix bufferSPC s a jagSPC s a Jag with default textSPC s g jgrepSPC s g Jgrep with default textSPC s k jackSPC s k Jack with default textSPC s t jptSPC s t Jpt with default textSPC s r jrgSPC s r Jrg with default textSearching the web
Key BindingDescriptionSPC s w gGet Google suggestions in vim. Opens Google results in Browser.SPC s w wGet Wikipedia suggestions in vim. Opens Wikipedia page in Browser.(TODO)Note: to enable google suggestions in vim, you need to add let g:spacevim_enable_googlesuggest = 1 to your custom Configuration file.
Searching on the fly Key BindingDescriptionSPC s g GSearching in project on the fly with default toolskey binding in FlyGrep buffer:
Key Binding Description -----------| -----------<Esc> | close FlyGrep buffer<Enter> | open file at the cursor line<Tab> | move cursor line down<S-Tab> | move cursor line up<Bs> | remove last character<C-w> | remove the Word before the cursor<C-u> | remove the Line before the cursor<C-k> | remove the Line after the cursor<C-a>/<Home> | Go to the beginning of the line<C-e>/<End> | Go to the end of the line
Persistent highlightingSpaceVim uses g:spacevim_search_highlight_persist to keep the searched expression highlighted until the next search. It is also possible to clear the highlighting by pressing SPC s c or executing the ex command :noh.
Editing Paste textAuto-indent pasted text
Text manipulation commandsText related commands (start with x):
Key BindingDescriptionSPC x a &align region at &SPC x a (align region at (SPC x a )align region at )SPC x a [align region at [SPC x a ]align region at ]SPC x a {align region at {SPC x a }align region at }SPC x a ,align region at ,SPC x a .align region at . (for numeric tables)SPC x a :align region at :SPC x a ;align region at ;SPC x a =align region at =SPC x a ¦align region at ¦SPC x a aalign region (or guessed section) using default rules (TODO)SPC x a calign current indentation region using default rules (TODO)SPC x a lleft-align with evil-lion (TODO)SPC x a Lright-align with evil-lion (TODO)SPC x a ralign region using user-specified regexp (TODO)SPC x a malign region at arithmetic operators (+-*/) (TODO)SPC x ccount the number of chars/words/lines in the selection regionSPC x d wdelete trailing whitespacesSPC x d SPCDelete all spaces and tabs around point, leaving one spaceSPC x g lset lanuages used by translate commands (TODO)SPC x g ttranslate current word using Google TranslateSPC x g Treverse source and target languages (TODO)SPC x i cchange symbol style to lowerCamelCaseSPC x i Cchange symbol style to UpperCamelCaseSPC x i icycle symbol naming styles (i to keep cycling)SPC x i -change symbol style to kebab-caseSPC x i kchange symbol style to kebab-caseSPC x i _change symbol style to under_scoreSPC x i uchange symbol style to under_scoreSPC x i Uchange symbol style to UP_CASESPC x j cset the justification to center (TODO)SPC x j fset the justification to full (TODO)SPC x j lset the justification to left (TODO)SPC x j nset the justification to none (TODO)SPC x j rset the justification to right (TODO)SPC x Jmove down a line of text (enter transient state)SPC x Kmove up a line of text (enter transient state)SPC x l dduplicate line or region (TODO)SPC x l ssort lines (TODO)SPC x l uuniquify lines (TODO)SPC x ouse avy to select a link in the frame and open it (TODO)SPC x Ouse avy to select multiple links in the frame and open them (TODO)SPC x t cswap (transpose) the current character with the previous oneSPC x t wswap (transpose) the current word with the previous oneSPC x t lswap (transpose) the current line with the previous oneSPC x uset the selected text to lower case (TODO)SPC x Uset the selected text to upper case (TODO)SPC x w ccount the number of occurrences per word in the select region (TODO)SPC x w dshow dictionary entry of word from wordnik (TODO)SPC x TABindent or dedent a region rigidly (TODO) Text insertion commandsText insertion commands (start with i):
Key bindingDescriptionSPC i l linsert lorem-ipsum listSPC i l pinsert lorem-ipsum paragraphSPC i l sinsert lorem-ipsum sentenceSPC i p 1insert simple passwordSPC i p 2insert stronger passwordSPC i p 3insert password for paranoidsSPC i p pinsert a phonetically easy passwordSPC i p ninsert a numerical passwordSPC i uSearch for Unicode characters and insert them into the active buffer.SPC i U 1insert UUIDv1 (use universal argument to insert with CID format)SPC i U 4insert UUIDv4 (use universal argument to insert with CID format)SPC i U Uinsert UUIDv4 (use universal argument to insert with CID format) CommentingComments are handled by nerdcommenter, it’s bound to the following keys.
Key BindingDescriptionSPC ;comment operatorSPC c hhide/show commentsSPC c lcomment linesSPC c Linvert comment linesSPC c pcomment paragraphsSPC c Pinvert comment paragraphsSPC c tcomment to lineSPC c Tinvert comment to lineSPC c ycomment and yankSPC c Yinvert comment and yankTips: To comment efficiently a block of line use the combo SPC ; SPC j l
dev
Multi-EncodingsSpaceVim use utf-8 as default encoding. there are four options for these case:
fileencodings (fencs): ucs-bom,utf-8,default,latin1fileencoding (fenc): utf-8encoding (enc): utf-8termencoding (tenc): utf-8 (only supported in vim)to fix messy display: SPC e a is the mapping for auto detect the file encoding. after detecting file encoding, you can run the command below to fix the encoding:
set enc=utf-8write Errors handlingSpaceVim uses neomake to gives error feedback on the fly. The checks are only performed at save time by default.
Errors management mappings (start with e):
MappingsDescriptionSPC t stoggle syntax checkerSPC e cclear all errorsSPC e hdescribe a syntax checkerSPC e ltoggle the display of the list of errors/warningsSPC e ngo to the next errorSPC e pgo to the previous errorSPC e vverify syntax checker setup (useful to debug 3rd party tools configuration)SPC e .error transient stateThe next/previous error mappings and the error transient state can be used to browse errors from syntax checkers as well as errors from location list buffers, and indeed anything that supports vim's location list. This includes for example search results that have been saved to a location list buffer.
Custom sign symbol:
SymbolDescriptionCustom option✖Errorg:spacevim_error_symbol➤warningg:spacevim_warning_symbol Managing projectsProjects in SpaceVim are managed by vim-projectionist and vim-rooter, vim-rooter will find the root of the project when a .git directory or a .projections.json file is encountered in the file tree.
project manager commands start with p:
Key BindingDescriptionSPC p 'open a shell in project’s root (with the shell layer) Achievements issues AchievementsAccount100th issue(issue)BenBergman Stars, forks and watchers AchievementsAccountFirst stargazersmonkeydterry100th stargazersnaraj1000th stargazersicecity962000th stargazersfrowhy3000th stargazerspurkylin Features Awesome ui outline + filemanager + checker Mnemonic key bindingsKey bindings are organized using mnemonic prefixes like b for buffer, p for project, s for search, h for help, etc…
SPC mapping root : SPC means <Space> on the keyboard.
KeyDescriptionSPC !shell cmdSPC a+applicationsSPC b+buffersSPC 1...9windows 1...9 Language specific mode Key Mapping c/c++ support code completion: autocompletion and fuzzy match.syntax check: Asynchronous linting and make framework. go support code completion:syntax check: python support code completion:syntax check: Neovim centric - Dark powered mode of SpaceVim.By default, SpaceVim use these dark powered plugins:
deoplete.nvim - Dark powered asynchronous completion framework for neovimdein.vim - Dark powered Vim/Neovim plugin managerTODO:
defx.nvim - Dark powered file explorerdeoppet.nvim - Dark powered snippet plugindenite.nvim - Dark powered asynchronous unite all interfaces for Neovim/Vim8 Modular configuration Multiple leader mode Global origin vim leaderVim's origin global leader can be used in all modes.
Local origin vim leaderVim's origin local leader can be used in all the mode.
Windows function leaderWindows function leader can only be used in normal mode. For the list of mappings see the link
Unite work flow leaderUnite work flow leader can only be used in normal mode. Unite leader need unite groups.
Unite centric work-flowList all the plugins has been installed, fuzzy find what you want, default action is open the github website of current plugin. default key is <leader>lp
List all the mappings and description: f<space>
List all the starred repos in github, fuzzy find and open the website of the repo. default key is <leader>ls
Plugin Highlights Package management with caching enabled and lazy loadingProject-aware tabs and labelVimfiler as file-manager + SSH connectionsGo completion via vim-go and gocodeJavascript completion via TernPHP completion, indent, folds, syntaxPython jedi completion, pep8 conventionLanguages: Ansible, css3, csv, json, less, markdown, mustacheHelpers: Undo tree, bookmarks, git, tmux navigation, hex editor, sessions, and much more.
Note that 90% of the plugins are [lazy-loaded].
[lazy-loaded]: ./config/plugins.vim
Non Lazy-Loaded Plugins NameDescriptiondein.vimDark powered Vim/Neovim plugin managervimprocInteractive command executioncolorschemesAwesome color-schemesfile-lineAllow opening a file in a given lineneomruMRU source for UnitecursorwordUnderlines word under cursorgitbranchLightweight git branch detectiongitgutterShows git diffs in the guttertinylineTiny great looking statuslinetagabanaCentral location for all tagsbookmarksBookmarks, works independently from vim markstmux-navigatorSeamless navigation between tmux panes and vim splits Lazy-Loaded Plugins Language NameDescriptionhtml5HTML5 omnicomplete and syntaxmustacheMustache and handlebars syntaxmarkdownMarkdown syntax highlightingansible-yamlAdditional support for AnsiblejinjaJinja support in vimlessSyntax for LESScss3-syntaxCSS3 syntax support to vim's built-in syntax/css.vimcsvHandling column separated datapep8-indentNicer Python indentationlogstashHighlights logstash configuration filestmuxvim plugin for tmux.confjsonBetter JSON supporttomlSyntax for TOMLi3i3 window manager config syntaxDockerfilesyntax and snippets for DockerfilegoGo developmentjedi-vimPython jedi autocompletion libraryrubyRuby configuration filesportfileMacports portfile configuration filesjavascriptEnhanced Javascript syntaxjavascript-indentJavascript indent scriptternProvides Tern-based JavaScript editing supportphpUp-to-date PHP syntax filephpfoldPHP foldingphpcompleteImproved PHP omnicompletionphpindentPHP official indentingphpspecPhpSpec integrationCommands
NameDescriptionvimfilerPowerful file explorer[NERD Commenter]Comment tool - no comment necessaryvinariseHex editorsyntasticSyntax checking hacksgitaAn awesome git handling plugingistaManipulate gists in VimundotreeUltimate undo history visualizerincsearchImproved incremental searchingexpand-regionVisually select increasingly larger regions of textopen-browserOpen URI with your favorite browserprettyprintPretty-print vim variablesquickrunRun commands quicklyrefIntegrated reference viewerdictionaryDictionary.app interfacevimwikiPersonal Wiki for VimthesaurusLook up words in an online thesaurusCommands
NameDescriptiongoyoDistraction-free writinglimelightHyperfocus-writingmatchitIntelligent pair matchingindentlineDisplay vertical indention lineschoosewinChoose window to use, like tmux's 'display-pane'Completion
NameDescriptiondelimitmateInsert mode auto-completion for quotes, parenthesis, bracketsechodocPrint objects' documentation in echo areadeopleteNeovim: Dark powered asynchronous completion frameworkneocompleteNext generation completion frameworkneosnippetContains neocomplete snippets sourceUnite
NameDescriptionuniteUnite and create user interfacesunite-colorschemeBrowse colorschemesunite-filetypeSelect file typeunite-historyBrowse history of command/searchunite-buildBuild with Unite interfaceunite-outlineFile "outline" source for uniteunite-tagTags source for Uniteunite-quickfixQuickfix source for UniteneosshSSH interface for pluginsunite-pull-requestGitHub pull-request source for UnitejunkfileCreate temporary files for memo and testingunite-issueIssue manager for JIRA and GitHubOperators & Text Objects
NameDescriptionoperator-userDefine your own operator easilyoperator-replaceOperator to replace text with register contentoperator-surroundOperator to enclose text objectstextobj-userCreate your own text objectstextobj-multiblockHandle multiple brackets objects Custom Key bindings KeyModeAction<leader>+yvisualCopy selection to X11 clipboard ("+y)Ctrl+cNormalCopy full path of current buffer to X11 clipboard<leader>+Ctrl+cNormalCopy github url of current buffer to X11 clipboard(if it is a github repo)<leader>+Ctrl+lNormal/visualCopy github url of current lines to X11 clipboard(if it is a github repo)<leader>+pNormal/visualPaste selection from X11 clipboard ("+p)Ctrl+fNormalSmart page forward (C-f/C-d)Ctrl+bNormalSmart page backwards (C-b/C-u)Ctrl+eNormalSmart scroll down (3C-e/j)Ctrl+yNormalSmart scroll up (3C-y/k)Ctrl+qNormalCtrl+wCtrl+xNormalSwitch buffer and placementUp,DownNormalSmart up and down}NormalAfter paragraph motion go to first non-blank char (}^)<Visual/NormalIndent to left and re-select>Visual/NormalIndent to right and re-selectTabVisualIndent to right and re-selectShift+TabVisualIndent to left and re-selectgpNormalSelect last pasteQ/gQNormalDisable EX-mode (Ctrl+aCommandNavigation in command lineCtrl+bCommandMove cursor backward in command lineCtrl+fCommandMove cursor forward in command lineFile Operations
KeyModeAction<leader>+cdNormalSwitch to the directory of the open buffer<leader>+wNormal/visualWrite (:w)Ctrl+sNormal/visual/CommandWrite (:w):w!!CommandWrite as root (%!sudo tee > /dev/null %)Editor UI
KeyModeActionF2AllToggle tagbarF3AllToggle Vimfiler<leader> + numNormalJump to the buffer whit the num index<Alt> + numNormalJump to the buffer whit the num index, this only works in neovim<Alt> + h/<Left>NormalJump to left buffer in the tabline, this only works in neovim<Alt> + l/<Right>NormalJump to Right buffer in the tabline, this only works in neovim<leader>+tsNormalToggle spell-checker (:setlocal spell!)<leader>+tnNormalToggle line numbers (:setlocal nonumber!)<leader>+tlNormalToggle hidden characters (:setlocal nolist!)<leader>+thNormalToggle highlighted search (:set hlsearch!)<leader>+twNormalToggle wrap (:setlocal wrap! breakindent!)g0NormalGo to first tab (:tabfirst)g$NormalGo to last tab (:tablast)grNormalGo to previous tab (:tabprevious)Ctrl+<Dow>NormalMove to split below (Ctrl+<Up>NormalMove to upper split (Ctrl+<Left>NormalMove to left split (Ctrl+<Right>NormalMove to right split (*VisualSearch selection forwards#VisualSearch selection backwards,+SpaceNormalRemove all spaces at EOLCtrl+rVisualReplace selection<leader>+ljNormalNext on location list<leader>+lkNormalPrevious on location list<leader>+SNormal/visualSource selectionWindow Management
KeyModeActionqNormalSmart buffer closes+pNormalSplit nicelys+vNormal:splits+gNormal:vsplits+tNormalOpen new tab (:tabnew)s+oNormalClose other windows (:only)s+xNormalRemove buffer, leave blank windows+qNormalCloses current buffer (:close)s+QNormalRemoves current buffer, left buffer in the tabline will be displayed, if there is no buffer on the left, the right buffer will be displayed, if this is the last buffer in the tabline, then an empty buffer will be displayed.TabNormalNext window or tabShift+TabNormalPrevious window or tab<leader>+svNormalSplit with previous buffer<leader>+sgNormalVertical split with previous bufferSpaceVim has mapped normal q as smart buffer close, the normal func of q can be get by <leader> q r
Native functions
KeyModeAction<leader> + qrNormalSame as native q<leader> + qr/NormalSame as native q/, open cmdwin<leader> + qr?NormalSame as native q?, open cmdwin<leader> + qr:NormalSame as native q:, open cmdwinPlugin: Unite
KeyModeAction[unite]Normalunite leader, default is f, :h g:spacevim_unite_leader[unite]+rNormalResumes Unite window[unite]+fNormalOpens Unite file recursive search[unite]+iNormalOpens Unite git file search[unite]+gNormalOpens Unite grep with ag (the_silver_searcher)[unite]+uNormalOpens Unite source[unite]+tNormalOpens Unite tag[unite]+TNormalOpens Unite tag/include[unite]+lNormalOpens Unite location list[unite]+qNormalOpens Unite quick fix[unite]+eNormalOpens Unite register[unite]+jNormalOpens Unite jump, change[unite]+hNormalOpens Unite history/yank[unite]+sNormalOpens Unite session[unite]+nNormalOpens Unite session/new[unite]+oNormalOpens Unite outline[unite]+cNormalOpens Unite buffer bookmark file in current directory[unite]+bNormalOpens Unite buffer bookmark file in buffer directory[unite]+maNormalOpens Unite mapping[unite]+<space>NormalOpens Unite menu:CustomKeyMaps[unite]+meNormalOpens Unite output messages<leader>+blNormalOpens Unite buffers, mru, bookmark<leader>+taNormalOpens Unite tab<leader>+ugfNormalOpens Unite file with word at cursor<leader>+ugtNormal/visualOpens Unite tag with word at cursorPlugin: neocomplete
KeyModeActionEnterInsertSmart snippet expansionCtrl+spaceInsertAutocomplete with UniteTabInsert/selectSmart tab movement or completionCtrl+j/k/f/bInsertMovement in popupCtrl+gInsertUndo completionCtrl+lInsertComplete common stringCtrl+oInsertExpand snippetCtrl+yInsertClose pop-upCtrl+eInsertClose pop-upCtrl+lInsertComplete common stringCtrl+dInsertScroll downCtrl+uInsertScroll upPlugin: NERD Commenter
KeyModeAction<leader>+ccNormal/visualComment out the current line or text selected in visual mode.<leader>+cnNormal/visualSame as cc but forces nesting.<leader>+cuNormal/visualUncomments the selected line(s).<leader>+csNormal/visualComments out the selected lines with a pretty block formatted layout.<leader>+cyNormal/visualSame as cc except that the commented line(s) are yanked first.Plugin: Goyo and Limelight
KeyModeAction<leader>+GNormalToggle distraction-free writingPlugin: ChooseWin
KeyModeAction-NormalChoose a window to edit<leader>+-NormalSwitch editing window with selectedPlugin: Bookmarks
KeyModeActionm+aNormalShow list of all bookmarksm+mNormalToggle bookmark in current linem+nNormalJump to next bookmarkm+pNormalJump to previous bookmarkm+iNormalAnnotate bookmarkAs SpaceVim use above bookmarks mappings, so you can not use a, m, n, p or i registers to mark current position, but other registers should works will. if you really need to use these registers, you can add nnoremap <leader>m m to your custom configuration, then you use use a registers via \ma
Plugin: Gina/Gita
KeyModeAction<leader>+gsNormalGit status<leader>+gdNormalGit diff<leader>+gcNormalGit commit<leader>+gbNormalGit blame<leader>+gpNormalGit push<leader>+gaNormalGit add current buffer<leader>+gANormalGit add all filesPlugin: vim-signify
KeyModeAction<leader>+hj / ]cNormalJump to next hunk<leader>+hk / [cNormalJump to previous hunk<leader>+hJ / ]CNormalJump to last hunk<leader>+hK / [CNormalJump to first hunkMisc Plugins
KeyModeAction<leader>+guNormalOpen undo tree<leader>+iNormalToggle indentation lines<leader>+jNormalStart smalls<leader>+rNormalQuickrun<leader>+?NormalDictionary<leader>+WNormalWiki<leader>+KNormalThesaurus 模块化配置SpaceVim 是由多个独立模块组成的配置集合,针对不同的功能需求,设计了多个模块,用户在使用的时候只需要载入相应的模块即可。比如对于 Java 开发者,载入 lang#java、autocomplete、checker、tags模块即可配置出一个适合 Java 开发的 Vim 环境。
SpaceVim 支持的模:http://spacevim/layers/
Denite/Unite为主的工作平台Unite 的快捷键前缀是f, 可以通过 g:spacevim_unite_leader 来设定,快捷键无需记忆,SpaceVim 有很好的快捷键辅助机制,如下是 Unite 的快捷键键图:
Denite 是新一代的插件,相比 Unite 速度更加快,安装也更加方便。 的快捷键前缀是F, 可以通过 g:spacevim_denite_leader 来设定。
自动补全SpaceVim 采用最快补全引擎 deoplete, 该引擎不同与YouCompleteMe的主要一点是支持多源补全,而不单单是语义补全。 而且补全来源拓展非常方便。
细致的tags管理 快速SpaceVim 将从 ~/.SpaceVim.d/init.vim 和当前目录的 ./SpaceVim.d/init.vim 载入配置,并且更新 rtp,用户可以在 ~/.SpaceVim.d/ 和 .SpaceVim.d/ 这两个文件夹下编辑自己的脚本,和 SpaceVim 的配置文件。
示例:
" Here are some basic customizations," please refer to the ~/.SpaceVim.d/init.vim" file for all possible options:let g:spacevim_default_indent = 3let g:spacevim_max_column = 80" Change the default directory where all miscellaneous persistent files go." By default it is ~/.cache/vimfiles/.let g:spacevim_plugin_bundle_dir = '~/.cache/vimfiles/'" set SpaceVim colorschemelet g:spacevim_colorscheme = 'jellybeans'" Set plugin manager, you want to use, default is dein.vimlet g:spacevim_plugin_manager = 'dein' " neobundle or dein or vim-plug" use space as `<Leader>`let mapleader = "\<space>"" Set windows shortcut leader [Window], default is `s`let g:spacevim_windows_leader = 's'" Set unite work flow shortcut leader [Unite], default is `f`let g:spacevim_unite_leader = 'f'" By default, language specific plugins are not loaded. This can be changed" with the following, then the plugins for go development will be loaded.call SpaceVim#layers#load('lang#go')" loaded ui layercall SpaceVim#layers#load('ui')" If there is a particular plugin you don't like, you can define this" variable to disable them entirely:let g:spacevim_disabled_plugins=[ \ ['junegunn/fzf.vim'], \ ]" If you want to add some custom plugins, use these options:let g:spacevim_custom_plugins = [ \ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}], \ ['wsdjeg/GitHub.vim'], \ ]" set the guifontlet g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11' SpaceVim选项 选项名称默认值描述g:spacevim_default_indent2对齐空格g:spacevim_enable_guicolors1启用/禁用终端使用真色彩g:spacevim_windows_leaders窗口管理快捷键前缀g:spacevim_unite_leaderfUnite快捷键前缀g:spacevim_plugin_bundle_dir~/.cache/vimfiles默认插件缓存位置g:spacevim_realtime_leader_guide0启用/禁用实时快捷键提示g:spacevim_guifont''设置SpaceVim字体g:spacevim_sidebar_width30设置边栏宽度,文件树以及语法树g:spacevim_custom_plugins[]设置自定义插件转载于:/spacevim/blog/1615934
SpaceVim - 让你的vim变得更加高效和强大