Ⅰ. 插件描述
Precise Code Tracking (Vim)Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'd0c-s4vage/pct-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'd0c-s4vage/pct-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'd0c-s4vage/pct-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/d0c-s4vage/pct-vim
Ⅳ. 文档说明
pct-vim
PCT-VIM - Precise Code Tracking Vim plugin
by @d0c_s4vage
Intro
This plugin is the vim implementation of the PCT method developed
by @tmanning. It is intended to assist in code auditing by enabling one to
annotate read-only source code from a text editor. This plugin
is the vim implementation. See @tmanning for the textmate implementation.
PCT uses an sqlite3 database to store and query audited ranges of code
and notes that were taken/added for line ranges.
Getting started
Follow the steps below to initialize the database:
- Install dependencies
- Source pct.vim
- Open a file in a project that you wish to audit
Run the command below to initialize the database:
`:PctInit`- Begin auditing!
Be aware that the plugin treats the root dirname of the database path as
the root of the project. Any files in subfolders of the root project path
will be included in reports and are considered "part of the project".
Dependencies
- Vim
- Python
peeweepython module (pip install peewee)
Key mappings
Review
[r- mark the current/selected line(s) as having been reviewed
Generic Comments (Annotations)
[a- annotate the current/selected line(s) with a single-line generic comment[A- annotate the current/selected line(s) with a multi-line generic comment
Findings
[f- annotate the current/selected line(s) with a single-line finding[F- annotate the current/selected line(s) with a multi-line finding
Todos
[t- annotate the current/selected line(s) with a single-line todo[T- annotate the current/selected line(s) with a multi-line todo
Annotation Modification
[d- delete an annotation on the current line
Reports/Listings
[R- toggle the report of the current project[h- show a recent history of notes/reviewed source files
Other
[o- open the file under the cursor in a new readonly tab (useful for reports)
Annotation Navigation
[n- jump to the next annotation in the current file[N- jump to the previous annotation in the current file[?- display the current annotation(s) in a vertically-split window
Notes
Note that the only differentiation between annotations/findings/todos is the
existence of certain keywords in the annotation. Todos contain the word
"TODO" in the text, findings contain the word "FINDING" in the text, and
generic annotations don't contain either.
Known Issues
- sometimes there are issues when viewing existing notes while scrolling through a split file
Future
- ability to mark files as out-of-scope
- ability to edit annotations
Screenshots
Lines marked as reviewed

A simple note/annotation

A todo

A finding

Report and History
