light weight code audit (code review) tool based on VIM.
which contains:
- A shell script wrapper
- A vim plugin
python3 -m pip install -U rich
make install
Required plugins:
- vim-scripts/taglist.vim - left side taglist
- skywind3000/asyncrun.vim - run shell command async in vim
Useful plugins:
- junegunn/fzf - for the
:FZF
to search and jump across files - junegunn/fzf.vim - for the
:RG
,:Files
,:Buffers
and other commands - MattesGroeger/vim-bookmarks - bookmark with comments
External command-line tools:
- ctags - Universal Ctags;
- cscope - search for symbol, definition, etc.
- ripgrep - rg tool to perform fast search
- fzf - used for fuzzy search
brew install universal-ctags cscope
sudo apt install -y universal-ctags cscope
index a project:
$ avim.py make -h
usage: avim.py make [-h] [-t] [-c] [-f] [-e EXCLUDES [EXCLUDES ...]] [src]
positional arguments:
src project root direcotry to make
options:
-h, --help show this help message and exit
-t create tag
-c create cscope
-f force overrite
-e EXCLUDES [EXCLUDES ...]
exclude pathes
for example:
$ avim.py make -tc /path/to/linux-1.11
list indexed projects:
$ avim.py info
┏━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┓
┃ location ┃ files ┃ ctags ┃ cscope ┃ bookmark ┃
┡━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━┩
│ /src/foo │ 46 │ 257.8KB │ 134.9KB │ 0 │
│ /src/bar │ 852 │ 9.0MB │ 1.9MB │ 2 │
│ /src/barz │ 10395 │ - │ - │ 5 │
└───────────┴───────┴─────────┴─────────┴──────────┘
remove an index:
$ avim.py rm /path/to/linux-1.11
open vim/gvim of with indexed tags/cscopes:
$ avim.py open .
# or start with GUI(gvim)
$ avim.py open -g /src/project
Shortcuts defined in audit.vim:
<leader>fs - find symbol
<leader>fg - find global
<leader>ft - find tag (based on ctags)
<leader>fc - find what calling this function
<leader>fd - find what called by this function
<leader>fe - find expr
<leader>ff - find file (based on fzf)
<leader>o - toggle taglist (left)
<leader>q - toggle quickfix list (bottom)
F2 - search current word or selected word with ripgrep
i/o - move up/down
u/d - page up/down
a/s - go to previous/next buffer
J/K - move up/down for quickfix matching
Note: the
<leader>
is config by user, which is,
for me.
m{a-zA-Z} Set mark {a-zA-Z} at cursor position.
'{a-z} `{a-z} Jump to the mark {a-z} in the current buffer.
:marks List all current marks.
:Marks List marks with fzf search.
You can also use vim-bookmarks plugin for better bookmarks support.
Action | Shortcut | Command |
---|---|---|
Add/remove bookmark at current line | mm |
:BookmarkToggle |
Add/edit/remove annotation at current line | mi |
:BookmarkAnnotate <TEXT> |
Show all bookmarks (toggle) | ma |
:BookmarkShowAll |
Clear bookmarks in current buffer only | mc |
:BookmarkClear |
Clear bookmarks in all buffers | mx |
:BookmarkClearAll |
Save all bookmarks to a file | :BookmarkSave <FILE_PATH> |
|
Load bookmarks from a file | :BookmarkLoad <FILE_PATH> |
za toggle open/close fold
zd delete fold
zf create fold
zfi} create fold inside `{}` (excluding)
zfa} create fold inside `{}` (including)