GitHub - UsamaQaisrani/filenotes.nvim: Neovim plugin that opens a per-file markdown note in a floating window, scoped to the project root.

2 min read Original article ↗

A Neovim plugin that opens a per-file markdown note in a floating window, scoped to your project root.

filenotes demo

Every file gets its own note. Notes are stored in a .notes/ directory at your project root (next to .git), identified by a hash of the file path. No database, no magic — just markdown files.

Status: Early development. APIs may change.

Features

  • Per-file notes scoped to project root
  • Floating window UI
  • Auto-creates .notes/ directory at project root
  • Falls back to current directory if no .git is found
  • Configurable keymap and window size

Requirements

  • Neovim >= 0.8

Installation

Using lazy.nvim:

{
  "UsamaQaisrani/filenotes.nvim",
  config = function()
    require("filenotes").setup({})
  end
}

Using packer.nvim:

use {
  "UsamaQaisrani/filenotes.nvim",
  config = function()
    require("filenotes").setup({})
  end
}

Setup

require("filenotes").setup({
  keymap = "<leader>nn",
  window_width = 0.6,
  window_height = 0.6,
})

Configuration

Option Default Description
keymap <leader>nn Keymap to open the note for current file
window_width 0.6 Floating window width as % of editor
window_height 0.6 Floating window height as % of editor

Usage

  1. Open any file in Neovim
  2. Press <leader>nn (or your configured keymap)
  3. A floating window opens with a markdown note tied to that file
  4. Write your notes, save with :w, close with :q
  5. Next time you open the file and press the keymap, your notes are back

Note Storage

Notes are stored in a .notes/ directory at your project root:

myproject/
  .git/
  .notes/
    a3f5c2d1...md   ← note for src/main.lua
    b7e9f4a2...md   ← note for README.md
  src/
    main.lua

It is recommended to add .notes/ to your global .gitignore:

echo ".notes/" >> ~/.gitignore_global

Project Structure

filenotes.nvim/
  lua/
    filenotes/
      init.lua      -- entry point, setup(), keymap registration
      notes.lua     -- project root detection, file hashing, note path resolution
      window.lua    -- floating window creation

Contributing

Pull requests are welcome. For major changes, please open an issue first.