Skip to content

evilpan/audit.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audit.VIM

light weight code audit (code review) tool based on VIM.

audit.vim

which contains:

  • A shell script wrapper
  • A vim plugin

Install

python3 -m pip install -U rich
make install

Required plugins:

Useful plugins:

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

macOS

brew install universal-ctags cscope

Linux

sudo apt install -y universal-ctags cscope

Run

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

VIM Tips

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.

Mark

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>

Folding

za      toggle open/close fold
zd      delete fold
zf      create fold
zfi}    create fold inside `{}` (excluding)
zfa}    create fold inside `{}` (including)

About

Code audit (code review) with VIM.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published