Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e41e63192b | ||
|
f86d778356 | ||
|
ec0d59b061 | ||
|
5fe5f596ae | ||
|
0e4a3eb843 | ||
|
a27c208959 |
34
PLUGINS.md
34
PLUGINS.md
@@ -42,9 +42,9 @@
|
|||||||
- [TeX](#tex)
|
- [TeX](#tex)
|
||||||
- [VimL](#viml)
|
- [VimL](#viml)
|
||||||
|
|
||||||
## Colorschemes
|
## 颜色主题
|
||||||
|
|
||||||
Here's a list of commonly used colorschemes:
|
以下为一些比较流行的颜色主题:
|
||||||
|
|
||||||
- [acme-colors](https://github.com/plan9-for-vimspace/acme-colors)
|
- [acme-colors](https://github.com/plan9-for-vimspace/acme-colors)
|
||||||
- [apprentice](https://github.com/romainl/Apprentice)
|
- [apprentice](https://github.com/romainl/Apprentice)
|
||||||
@@ -69,21 +69,21 @@ Here's a list of commonly used colorschemes:
|
|||||||
Alternatively, generate your own colorscheme using [themer](https://github.com/mjswensen/themer)
|
Alternatively, generate your own colorscheme using [themer](https://github.com/mjswensen/themer)
|
||||||
or [Colortemplate](https://github.com/lifepillar/vim-colortemplate).
|
or [Colortemplate](https://github.com/lifepillar/vim-colortemplate).
|
||||||
|
|
||||||
## By topic
|
## 按功能分类
|
||||||
|
|
||||||
#### Alignment
|
#### 文本对齐
|
||||||
|
|
||||||
- [tabular](https://github.com/godlygeek/tabular)
|
- [tabular](https://github.com/godlygeek/tabular)
|
||||||
- [vim-easy-align](https://github.com/junegunn/vim-easy-align)
|
- [vim-easy-align](https://github.com/junegunn/vim-easy-align)
|
||||||
- [vim-lion](https://github.com/tommcdo/vim-lion)
|
- [vim-lion](https://github.com/tommcdo/vim-lion)
|
||||||
|
|
||||||
#### Building and linting
|
#### 语法检查
|
||||||
|
|
||||||
- [ale](https://github.com/w0rp/ale)
|
- [ale](https://github.com/w0rp/ale)
|
||||||
- [neomake](https://github.com/neomake/neomake)
|
- [neomake](https://github.com/neomake/neomake)
|
||||||
- [syntastic](https://github.com/vim-syntastic/syntastic)
|
- [syntastic](https://github.com/vim-syntastic/syntastic)
|
||||||
|
|
||||||
#### Code completion
|
#### 代码补全
|
||||||
|
|
||||||
- [asyncomplete.vim](https://github.com/prabirshrestha/asyncomplete.vim)
|
- [asyncomplete.vim](https://github.com/prabirshrestha/asyncomplete.vim)
|
||||||
- [completor.vim](https://github.com/maralla/completor.vim)
|
- [completor.vim](https://github.com/maralla/completor.vim)
|
||||||
@@ -100,19 +100,19 @@ or [Colortemplate](https://github.com/lifepillar/vim-colortemplate).
|
|||||||
- [switch.vim](https://github.com/AndrewRadev/switch.vim)
|
- [switch.vim](https://github.com/AndrewRadev/switch.vim)
|
||||||
- [vim-speeddating](https://github.com/tpope/vim-speeddating)
|
- [vim-speeddating](https://github.com/tpope/vim-speeddating)
|
||||||
|
|
||||||
#### Commenters
|
#### 代码注释
|
||||||
|
|
||||||
- [nerdcommenter](https://github.com/scrooloose/nerdcommenter)
|
- [nerdcommenter](https://github.com/scrooloose/nerdcommenter)
|
||||||
- [tcomment_vim](https://github.com/tomtom/tcomment_vim)
|
- [tcomment_vim](https://github.com/tomtom/tcomment_vim)
|
||||||
- [vim-commentary](https://github.com/tpope/vim-commentary)
|
- [vim-commentary](https://github.com/tpope/vim-commentary)
|
||||||
|
|
||||||
#### Delimiter
|
#### 自动补全括号
|
||||||
|
|
||||||
- [auto-pairs](https://github.com/jiangmiao/auto-pairs)
|
- [auto-pairs](https://github.com/jiangmiao/auto-pairs)
|
||||||
- [delimitMate](https://github.com/Raimondi/delimitMate)
|
- [delimitMate](https://github.com/Raimondi/delimitMate)
|
||||||
- [vim-endwise](https://github.com/tpope/vim-endwise)
|
- [vim-endwise](https://github.com/tpope/vim-endwise)
|
||||||
|
|
||||||
#### Fuzzy finders
|
#### 模糊搜索
|
||||||
|
|
||||||
- [Command-T](https://github.com/wincent/Command-T) (_requires +ruby_)
|
- [Command-T](https://github.com/wincent/Command-T) (_requires +ruby_)
|
||||||
- [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim)
|
- [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim)
|
||||||
@@ -121,13 +121,13 @@ or [Colortemplate](https://github.com/lifepillar/vim-colortemplate).
|
|||||||
- [unite.vim](https://github.com/Shougo/unite.vim)
|
- [unite.vim](https://github.com/Shougo/unite.vim)
|
||||||
- [vim-fz](https://github.com/mattn/vim-fz)
|
- [vim-fz](https://github.com/mattn/vim-fz)
|
||||||
|
|
||||||
#### Grep tools
|
#### 文本搜索
|
||||||
|
|
||||||
- [ctrlsf.vim](https://github.com/dyng/ctrlsf.vim)
|
- [ctrlsf.vim](https://github.com/dyng/ctrlsf.vim)
|
||||||
- [ferret](https://github.com/wincent/ferret)
|
- [ferret](https://github.com/wincent/ferret)
|
||||||
- [vim-grepper](https://github.com/mhinz/vim-grepper)
|
- [vim-grepper](https://github.com/mhinz/vim-grepper)
|
||||||
|
|
||||||
#### Indent
|
#### 代码对齐线
|
||||||
|
|
||||||
- [indentLine](https://github.com/Yggdroot/indentLine)
|
- [indentLine](https://github.com/Yggdroot/indentLine)
|
||||||
- [vim-indent-guides](https://github.com/nathanaelkane/vim-indent-guides)
|
- [vim-indent-guides](https://github.com/nathanaelkane/vim-indent-guides)
|
||||||
@@ -144,7 +144,7 @@ or [Colortemplate](https://github.com/lifepillar/vim-colortemplate).
|
|||||||
|
|
||||||
Also see [fuzzy finders](#fuzzy-finders).
|
Also see [fuzzy finders](#fuzzy-finders).
|
||||||
|
|
||||||
#### Plugin managers
|
#### 插件管理
|
||||||
|
|
||||||
- [apt-vim](https://github.com/egalpin/apt-vim)
|
- [apt-vim](https://github.com/egalpin/apt-vim)
|
||||||
- [dein.vim](https://github.com/Shougo/dein.vim)
|
- [dein.vim](https://github.com/Shougo/dein.vim)
|
||||||
@@ -154,14 +154,14 @@ Also see [fuzzy finders](#fuzzy-finders).
|
|||||||
- [vim-plug](https://github.com/junegunn/vim-plug)
|
- [vim-plug](https://github.com/junegunn/vim-plug)
|
||||||
- [vundle.vim](https://github.com/VundleVim/Vundle.vim)
|
- [vundle.vim](https://github.com/VundleVim/Vundle.vim)
|
||||||
|
|
||||||
#### Snippets
|
#### 代码片段
|
||||||
|
|
||||||
- [neosnippet.vim](https://github.com/Shougo/neosnippet.vim) (_depends on other plugins_)
|
- [neosnippet.vim](https://github.com/Shougo/neosnippet.vim) (_depends on other plugins_)
|
||||||
- [ultisnips](https://github.com/SirVer/ultisnips)
|
- [ultisnips](https://github.com/SirVer/ultisnips)
|
||||||
- [vim-snipmate](https://github.com/garbas/vim-snipmate) (_depends on other plugins_)
|
- [vim-snipmate](https://github.com/garbas/vim-snipmate) (_depends on other plugins_)
|
||||||
- [xptemplate](https://github.com/drmingdrmer/xptemplate)
|
- [xptemplate](https://github.com/drmingdrmer/xptemplate)
|
||||||
|
|
||||||
#### Statusline
|
#### 状态栏
|
||||||
|
|
||||||
- [lightline.vim](https://github.com/itchyny/lightline.vim)
|
- [lightline.vim](https://github.com/itchyny/lightline.vim)
|
||||||
- [powerline](https://github.com/powerline/powerline)
|
- [powerline](https://github.com/powerline/powerline)
|
||||||
@@ -187,7 +187,7 @@ Also see [fuzzy finders](#fuzzy-finders).
|
|||||||
|
|
||||||
- [vim-test](https://github.com/janko-m/vim-test)
|
- [vim-test](https://github.com/janko-m/vim-test)
|
||||||
|
|
||||||
#### Text objects
|
#### 文本对象
|
||||||
|
|
||||||
- [targets.vim](https://github.com/wellle/targets.vim)
|
- [targets.vim](https://github.com/wellle/targets.vim)
|
||||||
- [vim-exchange](https://github.com/tommcdo/vim-exchange)
|
- [vim-exchange](https://github.com/tommcdo/vim-exchange)
|
||||||
@@ -258,9 +258,9 @@ Also see [fuzzy finders](#fuzzy-finders).
|
|||||||
- [vim-startify](https://github.com/mhinz/vim-startify)
|
- [vim-startify](https://github.com/mhinz/vim-startify)
|
||||||
- [vim-unimpaired](https://github.com/tpope/vim-unimpaired)
|
- [vim-unimpaired](https://github.com/tpope/vim-unimpaired)
|
||||||
|
|
||||||
## By filetype
|
## 编程语言
|
||||||
|
|
||||||
#### C and C++
|
#### C、C++
|
||||||
|
|
||||||
- [a.vim](https://github.com/vim-scripts/a.vim)
|
- [a.vim](https://github.com/vim-scripts/a.vim)
|
||||||
- [clang_complete](https://github.com/Rip-Rip/clang_complete)
|
- [clang_complete](https://github.com/Rip-Rip/clang_complete)
|
||||||
|
61
README.md
61
README.md
@@ -74,6 +74,9 @@
|
|||||||
- [禁用错误报警声音和图标](#禁用错误报警声音和图标)
|
- [禁用错误报警声音和图标](#禁用错误报警声音和图标)
|
||||||
- [快速移动当前行](#快速移动当前行)
|
- [快速移动当前行](#快速移动当前行)
|
||||||
- [快速添加空行](#快速添加空行)
|
- [快速添加空行](#快速添加空行)
|
||||||
|
- [运行时检测](#运行时检测)
|
||||||
|
- [查看启动时间](#查看启动时间)
|
||||||
|
- [NUL 符用新行表示](#nul-符用新行表示)
|
||||||
- [快速编辑自定义宏](#快速编辑自定义宏)
|
- [快速编辑自定义宏](#快速编辑自定义宏)
|
||||||
- [快速跳转到源(头)文件](#快速跳转到源头文件)
|
- [快速跳转到源(头)文件](#快速跳转到源头文件)
|
||||||
- [在 GUI 中快速改变字体大小](#在-gui-中快速改变字体大小)
|
- [在 GUI 中快速改变字体大小](#在-gui-中快速改变字体大小)
|
||||||
@@ -107,7 +110,6 @@
|
|||||||
- [持续粘贴(为什么我每次都要设置 'paste' 模式)](#持续粘贴为什么我每次都要设置-paste-模式)
|
- [持续粘贴(为什么我每次都要设置 'paste' 模式)](#持续粘贴为什么我每次都要设置-paste-模式)
|
||||||
- [在终端中按 ESC 后有延时](#在终端中按-esc-后有延时)
|
- [在终端中按 ESC 后有延时](#在终端中按-esc-后有延时)
|
||||||
- [无法重复函数中执行的搜索](#无法重复函数中执行的搜索)
|
- [无法重复函数中执行的搜索](#无法重复函数中执行的搜索)
|
||||||
- [插件列表](#插件列表)
|
|
||||||
- [进阶阅读](#进阶阅读)
|
- [进阶阅读](#进阶阅读)
|
||||||
- [加入我们](#加入我们)
|
- [加入我们](#加入我们)
|
||||||
|
|
||||||
@@ -141,8 +143,10 @@ Vim 采用模式编辑的理念,即它提供了多种模式,按键在不同
|
|||||||
但是这有一个很大的优点:不需要通过同时按住多个键来完成操作,
|
但是这有一个很大的优点:不需要通过同时按住多个键来完成操作,
|
||||||
大多数时候你只需要依次按下这些按键即可。越常用的操作,所需要的按键数量越少。
|
大多数时候你只需要依次按下这些按键即可。越常用的操作,所需要的按键数量越少。
|
||||||
|
|
||||||
和模式编辑紧密相连的概念是“操作符”和“动作”。_操作符_ 开始一些行为,例如:修改,删除,或者选择文本。之后你要用一个 _动作_ 来指定需要操作的文本区域。比如,要改变括号内的文本,需要执行 `ci(` (读做 _change inner parentheses_);删除整个段落的内容,需要执行 `dap` (读做:_delete
|
和模式编辑紧密相连的概念是 **操作符** 和 **动作**。**操作符** 指的是开始某个行为,
|
||||||
around paragraph_)。
|
例如:修改、删除或者选择文本,之后你要用一个 **动作** 来指定需要操作的文本区域。
|
||||||
|
比如,要改变括号内的文本,需要执行 `ci(` (读做 `change inner parentheses`);
|
||||||
|
删除整个段落的内容,需要执行 `dap` (读做:`delete around paragraph`)。
|
||||||
|
|
||||||
如果你能看见 Vim 老司机操作,你会发现他们使用 Vim 脚本语言就如同钢琴师弹钢琴一样。复杂的操作只需要几个按键就能完成。他们甚至不用刻意去想,因为这已经成为[肌肉记忆](https://en.wikipedia.org/wiki/Muscle_memory)了。这减少[认识负荷](https://en.wikipedia.org/wiki/Cognitive_load)并帮助人们专注于实际任务。
|
如果你能看见 Vim 老司机操作,你会发现他们使用 Vim 脚本语言就如同钢琴师弹钢琴一样。复杂的操作只需要几个按键就能完成。他们甚至不用刻意去想,因为这已经成为[肌肉记忆](https://en.wikipedia.org/wiki/Muscle_memory)了。这减少[认识负荷](https://en.wikipedia.org/wiki/Cognitive_load)并帮助人们专注于实际任务。
|
||||||
|
|
||||||
@@ -1491,6 +1495,47 @@ nnoremap ]<space> :<c-u>put =repeat(nr2char(10), v:count1)<cr>
|
|||||||
|
|
||||||
设置之后,连续按下 <kbd>5</kbd> <kbd>\[</kbd> <kbd>空格</kbd> 在当前行上方插入 5 个空行。
|
设置之后,连续按下 <kbd>5</kbd> <kbd>\[</kbd> <kbd>空格</kbd> 在当前行上方插入 5 个空行。
|
||||||
|
|
||||||
|
### 运行时检测
|
||||||
|
|
||||||
|
需要的特性:+profile
|
||||||
|
|
||||||
|
Vim 提供了一个内置的运行时检查功能,能够找出运行慢的代码。
|
||||||
|
|
||||||
|
`:profile` 命令后面跟着子命令来确定要查看什么。
|
||||||
|
|
||||||
|
如果你想查看所有的:
|
||||||
|
|
||||||
|
```Vim
|
||||||
|
:profile start /tmp/profile.log
|
||||||
|
:profile file *
|
||||||
|
:profile func *
|
||||||
|
<do something in Vim>
|
||||||
|
<quit Vim>
|
||||||
|
```
|
||||||
|
|
||||||
|
Vim 不断地在内存中检查信息,只在退出的时候输出出来。(Neovim 已经解决了这个问题用 `:profile dump` 命令)
|
||||||
|
|
||||||
|
看一下 `/tmp/profile.log` 文件,检查时运行的所有代码都会被显示出来,包括每一行代码运行的频率和时间。
|
||||||
|
|
||||||
|
大多数代码都是用户不熟悉的插件代码,如果你是在解决一个确切的问题,
|
||||||
|
直接跳到这个日志文件的末尾,那里有 `FUNCTIONS SORTED ON TOTAL TIME` 和 `FUNCTIONS SORTED ON SELF TIME` 两个部分,如果某个function运行时间过长一眼就可以看到。
|
||||||
|
|
||||||
|
### 查看启动时间
|
||||||
|
|
||||||
|
感觉Vim启动的慢?到了研究几个数字的时候了:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
vim --startuptime /tmp/startup.log +q && vim /tmp/startup.log
|
||||||
|
```
|
||||||
|
|
||||||
|
第一栏是最重要的因为它显示了**绝对运行时间**,如果在前后两行之间时间差有很大的跳跃,那么是第二个文件太大或者含有需要检查的错误的VimL代码。
|
||||||
|
|
||||||
|
## NUL 符用新行表示
|
||||||
|
|
||||||
|
文件中的 NUL 符 (`\0`),在内存中被以新行(`\n`)保存,在缓存空间中显示为 `^@`。
|
||||||
|
|
||||||
|
更多信息请参看 `man 7 ascii` 和 `:h NL-used-for-Nul` 。
|
||||||
|
|
||||||
## 快速编辑自定义宏
|
## 快速编辑自定义宏
|
||||||
|
|
||||||
这个功能真的很实用!下面的映射,就是在一个新的命令行窗口中读取某一个寄存器(默认为 `*`)。当你设置完成后,只需要按下 <kbd>回车</kbd> 即可让它生效。
|
这个功能真的很实用!下面的映射,就是在一个新的命令行窗口中读取某一个寄存器(默认为 `*`)。当你设置完成后,只需要按下 <kbd>回车</kbd> 即可让它生效。
|
||||||
@@ -1803,6 +1848,14 @@ Vim 现在正在使用的另一个比较有用的方法是增加 debug 信息输
|
|||||||
|
|
||||||
## Vim 配置集合
|
## Vim 配置集合
|
||||||
|
|
||||||
|
目前,网上有很多流行 Vim 配置集合,对于 Vim 配置集合,个人认为有利有弊。
|
||||||
|
对于维护的比较好的配置,比如 [SpaceVim](http://spacevim.org/cn/) 还是值得尝试的,可以节省很多自行配置的时间。
|
||||||
|
当然,网上还有很多其他很流行的配置,比如:
|
||||||
|
|
||||||
|
- [k-vim](https://github.com/wklken/k-vim)
|
||||||
|
- [amix's vimrc](https://github.com/amix/vimrc)
|
||||||
|
- [janus](https://github.com/carlhuda/janus)
|
||||||
|
|
||||||
## 内置插件
|
## 内置插件
|
||||||
|
|
||||||
## 将 Control 映射到 CapsLock
|
## 将 Control 映射到 CapsLock
|
||||||
@@ -1922,8 +1975,6 @@ set ttimeoutlen=10 " unnoticeable small value
|
|||||||
|
|
||||||
帮助文档:`:h function-search-undo`。
|
帮助文档:`:h function-search-undo`。
|
||||||
|
|
||||||
## [插件列表](PLUGINS.md)
|
|
||||||
|
|
||||||
## 进阶阅读
|
## 进阶阅读
|
||||||
|
|
||||||
- [Vim 插件开发指南](https://github.com/wsdjeg/vim-plugin-dev-guide)
|
- [Vim 插件开发指南](https://github.com/wsdjeg/vim-plugin-dev-guide)
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
### 运行时检测
|
|
||||||
|
|
||||||
需要的特性:+profile
|
|
||||||
|
|
||||||
Vim 提供了一个内置的运行时检查功能,能够找出运行慢的代码。
|
|
||||||
|
|
||||||
```:profile``` 命令后面跟着子命令来确定要查看什么。
|
|
||||||
|
|
||||||
如果你想查看所有的:
|
|
||||||
|
|
||||||
```Vim
|
|
||||||
:profile start /tmp/profile.log
|
|
||||||
:profile file *
|
|
||||||
:profile func *
|
|
||||||
<do something in Vim>
|
|
||||||
<quit Vim>
|
|
||||||
```
|
|
||||||
|
|
||||||
Vim 不断地在内存中检查信息,只在退出的时候输出出来。(Neovim 已经解决了这个问题用 ```:profile dump``` 命令)
|
|
||||||
|
|
||||||
看一下 ```/tmp/profile.log``` 文件,检查时运行的所有代码都会被显示出来,包括每一行代码运行的频率和时间。
|
|
||||||
|
|
||||||
大多数代码都是用户不熟悉的插件代码,如果你是在解决一个确切的问题,直接跳到这个日志文件的末尾,那里有 ```FUNCTIONS SORTED ON TOTAL TIME``` 和 ```FUNCTIONS SORTED ON SELF TIME``` 两个部分,如果某个function运行时间过长一眼就可以看到。
|
|
@@ -1,10 +0,0 @@
|
|||||||
### 查看启动时间
|
|
||||||
|
|
||||||
感觉Vim启动的慢?到了研究几个数字的时候了:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
vim --startuptime /tmp/startup.log +q && vim /tmp/startup.log
|
|
||||||
```
|
|
||||||
|
|
||||||
第一栏是最重要的因为它显示了**绝对运行时间**,如果在前后两行之间时间差有很大的跳跃,那么是第二个文件太大或者含有需要检查的错误的VimL代码。
|
|
||||||
|
|
@@ -1,5 +0,0 @@
|
|||||||
## NUL 符用新行表示
|
|
||||||
|
|
||||||
文件中的 NUL 符 (`\0`),在内存中被以新行(`\n`)保存,在缓存空间中显示为 `^@`。
|
|
||||||
|
|
||||||
更多信息请参看 `man 7 ascii` 和 `:h NL-used-for-Nul` 。
|
|
Reference in New Issue
Block a user