Home

Awesome

flote.nvim

Easy, minimal, per-project and global markdown notes.

screenshot

Requirements

Neovim version >= 0.9.0 required for the window title only. Older versions can disable it, check the configuration section.

Installation

Install using your preferred package manager.

Example with packer.nvim

use {
    'JellyApple102/flote.nvim'
}

Configuration

Call setup:

-- defaults
require('flote').setup{
    q_to_quit = true,
    window_style = 'minimal',
    window_border = 'solid',
    window_title = true,
    notes_dir = vim.fn.stdpath('cache') .. '/flote',
    files = {
        global = 'flote-global.md',
        cwd = function ()
           return vim.fn.getcwd()
        end,
        file_name = function (cwd)
            local base_name = vim.fs.basename(cwd)
            local parent_base_name = vim.fs.basename(vim.fs.dirname(cwd))
            return parent_base_name .. '_' .. base_name .. '.md'
        end
    }

}
OptionDefaultDescription
q_to_quittrueRemaps q in normal mode to <cmd>wq<CR> for the note buffer.
window_styleminimalSee the config section of :h nvim_open_win(). Currently either minimal or empty string ''.
window_bordersolidSee the config section of :h nvim_open_win(). Popular options: single, double, solid.
window_titletrueShow the note file name in the title of the flote window. Requires Neovim >= 0.9.0
notes_dirvim.fn.stdpath('cache') .. '/flote'Directory where the notes will be stored.
files.globalflote-global.mdName of the global file.
files.cwdvim.fn.getcwd()Current Working Directory where we'll extract the project name.
files.file_nameParentfolder_childfolder.mdName of the project note file based on the parent folders.

Usage

The note files are created and stored in vim.fn.stdpath('cache') .. '/flote'. If this directory does not exist, setup creates it.


flote provides one user command: :Flote [opts]

:Flote opens the project notes. Project notes are named by the top two parent directories of vim.fn.getcwd().

For example, if you open Neovim in ~/projects/your-awesome-project, the generated note file is called projects_your-awesome-project.md.

:Flote global opens the global note file flote-global.md.

:Flote manage opens the flote directory in netrw for easy note management.

Notes

Currently the buffers created and opened in the float window are given the bufhidden value of wipe, meaning they are completely erased when no longer visible. This includes discarding unsaved changes without warning.

This plugin will not work in Windows environments without a touch command. Files are created by calling by calling os.execute() with the touch command.

Coming Soon

Tips

require("flote").setup {
    files = {
      cwd = function()
        local bufPath = vim.api.nvim_buf_get_name(0)
        local cwd = require("lspconfig").util.root_pattern ".git"(bufPath)

        return cwd
      end,
    },
}

Extras

I wrote this for personal use because I wanted per-project notes without having to learn or use a larger project like nvim-orgmode or vimwiki. These plugins are great and have many more features, but I wanted something smaller. As such there is no configuration, all the defaults are my preference. I think most people would use the defaults anyway.


Theme used in screenshot is kanagawa.nvim

Check out my other plugin easyread.nvim