mirror of
https://gitlab.com/wsdjeg/vim-galore-zh_cn.git
synced 2025-01-31 19:59:29 +08:00
start to translate chapters requested.
This commit is contained in:
parent
8e934bc623
commit
5929098c20
19
chapter/Debugging-Syntax-Files.md
Executable file
19
chapter/Debugging-Syntax-Files.md
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
## Debugging syntax files
|
||||||
|
|
||||||
|
Syntax files are often the cause for slowdowns due to wrong and/or complex
|
||||||
|
regular expressions. If the `+profile` [feature](#what-kind-of-vim-am-i-running)
|
||||||
|
is compiled in, Vim provides the super useful `:syntime` command.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
:syntime on
|
||||||
|
" hit <c-l> a few times to redraw the window which causes the syntax rules to get applied again
|
||||||
|
:syntime off
|
||||||
|
:syntime report
|
||||||
|
```
|
||||||
|
|
||||||
|
The output contains important metrics. E.g. you can see which regexp takes too
|
||||||
|
long and should be optimized or which regexps are used all the time but never
|
||||||
|
even match.
|
||||||
|
|
||||||
|
See `:h :syntime`.
|
||||||
|
|
40
chapter/Debugging-Vim-Scripts.md
Executable file
40
chapter/Debugging-Vim-Scripts.md
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
## 调试Vim脚本
|
||||||
|
|
||||||
|
如果你以前使用过命令行调试器的话,对于`:debug`命令你很快就会感到熟悉。
|
||||||
|
|
||||||
|
只需要在任何其他命令之前加上`:debug`就会让你进入调试模式。也就是,被调试的Vim脚本会在第一行停止运行,同时该行会被显示出来。
|
||||||
|
|
||||||
|
想了解可用的6个调试命令,可以查阅`:h >cont`和阅读下面内容。需要指出的是,类似gdb和其他相似调试器,调试命令可以使用它们的简短形式:`c`、 `q`、`n`、`s`、 `i`和 `f`。
|
||||||
|
|
||||||
|
除了上面的之外,你还可以自由地使用任何Vim的命令。比如,`:echo myvar`,该命令会在当前的脚本代码位置和上下文上被执行。
|
||||||
|
|
||||||
|
只需要简单使用`:debug 1`,你就获得了[REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop)调试特性。
|
||||||
|
|
||||||
|
当然,调试模式下是可以定义断点的,不然的话每一行都去单步调试就会十分痛苦。(断点之所以被叫做断点,是因为运行到它们的时候,运行就会停止下来。因此,你可以利用断点跳过自己不感兴趣的代码区域)。请查阅`:h :breakadd`、 `:h :breakdel`和 `:h :breaklist`获取更多细节。
|
||||||
|
|
||||||
|
假设你需要知道你每次在保存一个文件的时候有哪些代码在运行:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
:au BufWritePost
|
||||||
|
" signify BufWritePost
|
||||||
|
" * call sy#start()
|
||||||
|
:breakadd func *start
|
||||||
|
:w
|
||||||
|
" Breakpoint in "sy#start" line 1
|
||||||
|
" Entering Debug mode. Type "cont" to continue.
|
||||||
|
" function sy#start
|
||||||
|
" line 1: if g:signify_locked
|
||||||
|
>s
|
||||||
|
" function sy#start
|
||||||
|
" line 3: endif
|
||||||
|
>
|
||||||
|
" function sy#start
|
||||||
|
" line 5: let sy_path = resolve(expand('%:p'))
|
||||||
|
>q
|
||||||
|
:breakdel *
|
||||||
|
```
|
||||||
|
|
||||||
|
正如你所见,使用`<cr>`命令会重复之前的调试命令,也就是在该例子中的`s`命令。
|
||||||
|
|
||||||
|
`:debug`命令可以和[verbose](#verbosity)选项一起使用。
|
||||||
|
|
20
chapter/List-Of-Colorschemes.md
Executable file
20
chapter/List-Of-Colorschemes.md
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
# List of colorschemes
|
||||||
|
|
||||||
|
Here's a list of commonly used colorschemes:
|
||||||
|
|
||||||
|
- [acme-colors](https://github.com/plan9-for-vimspace/acme-colors)
|
||||||
|
- [base16](https://github.com/chriskempson/base16-vim)
|
||||||
|
- [gotham](https://github.com/whatyouhide/vim-gotham)
|
||||||
|
- [gruvbox](https://github.com/morhetz/gruvbox)
|
||||||
|
- [janah](https://github.com/mhinz/vim-janah)
|
||||||
|
- [jellybeans](https://github.com/nanotech/jellybeans.vim)
|
||||||
|
- [lucius](https://github.com/jonathanfilip/vim-lucius)
|
||||||
|
- [molokai](https://github.com/tomasr/molokai)
|
||||||
|
- [railscasts](https://github.com/jpo/vim-railscasts-theme)
|
||||||
|
- [seoul256](https://github.com/junegunn/seoul256.vim)
|
||||||
|
- [solarized](https://github.com/altercation/vim-colors-solarized) (or a lighter variant: [flattened](https://github.com/romainl/flattened))
|
||||||
|
- [tomorrow](https://github.com/chriskempson/vim-tomorrow-theme)
|
||||||
|
- [vividchalk](https://github.com/tpope/vim-vividchalk)
|
||||||
|
- [yowish](https://github.com/kabbamine/yowish.vim)
|
||||||
|
- [zenburn](https://github.com/jnurmine/Zenburn)
|
||||||
|
|
0
chapter/List-Of-Plugins.md
Executable file
0
chapter/List-Of-Plugins.md
Executable file
7
chapter/Newline-Used-For-NUL.md
Executable file
7
chapter/Newline-Used-For-NUL.md
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
## Newline used for NUL
|
||||||
|
|
||||||
|
NUL characters (`\0`) in a file, are stored as newline (`\n`) in memory and
|
||||||
|
displayed in a buffer as `^@`.
|
||||||
|
|
||||||
|
See `man 7 ascii` and `:h NL-used-for-Nul` for more information.
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user