Skip to content

alwaystrueio/audit.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

audit.nvim

A Neovim plugin that enables code auditors to take notes about the code they're reviewing without modifying the source code. Everything is saved in the notes.md file at the project's root.

Features

  • Highlight code and add notes without changing the source
  • Store all notes in a separate "notes.md" file
  • Link notes to specific lines of code
  • Display visual indicators on lines with notes
  • Show relevant notes in a side panel when cursor is on a line with notes
  • Edit notes directly in the panel and save changes to the notes file automatically
  • Delete notes from the source code
  • Use different icons for different type of notes
    • Add a "question" note when starting with ?
    • Add a "possible finding" note when starting with !
    • Add an "info" note when starting with any other symbol
  • Mark/unmark "reviewed" code
  • Generate structured joint notes
  • Generate Typst code from notes
  • Deal with sourcecode changes

Installation

Using packer.nvim:

use {
  'alwaystrueio/audit.nvim',
  config = function()
    require('audit').setup()
  end
}

Using vim-plug:

Plug 'alwaystrueio/audit.nvim'

Usage

  1. Select text in visual mode
  2. Run :AuditAddNote
  3. Enter your note
  4. Notes will be saved to notes.md in your working directory

Commands

  • :AuditAddNote - Add a note for the selected text (visual mode only)
  • :AuditAddProjectNote - Add a project-wide note not tied to specific code
  • :AuditTogglePanel - Toggle the notes panel on/off and enable/disable automatic panel display
  • :AuditSyncNotes - Manually sync edited notes from the panel to the notes.md file

Keybindings

The plugin doesn't set any default keybindings. Here are examples of how to set up your own keybindings:

-- In your init.lua or other configuration file
-- Add a note from visual mode
vim.keymap.set('v', '<Leader>an', ':AuditAddNote<CR>', { noremap = true, silent = true })

-- Toggle the notes panel
vim.keymap.set('n', '<Leader>at', ':AuditTogglePanel<CR>', { noremap = true, silent = true })

-- Save changes from the panel (when the panel has focus)
vim.keymap.set('n', '<Leader>as', ':AuditSyncNotes<CR>', { noremap = true, silent = true })

Editing Notes

You can edit notes directly in the notes panel:

  1. When a note is displayed in the panel, you can modify its content.
  2. When you leave the panel, the note is automatically updated. You can also explicitly save your changes using the :AuditSyncNotes command.

Note that only the content of notes can be edited; the code snippets remain unchanged to preserve the original references.

Configuration

The plugin works with default settings that can't be configured at the moment.

Notes Format

Notes are stored in a Markdown file with the following structure:

# Audit Notes

## path/to/file.ext

### Note 1 (Lines 10-15)

This is a note about the code.

<The actual code snippet>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published