Skip to content

coldpatch/scratch.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

scratch.nvim

A simple and flexible temporary, daily, weekly, and monthly scratchpad for Neovim that can be workspace-specific or global. Supports both floating windows and traditional split modes.

Installation

Using neovim's built-in package manager

vim.pack.add({
  "https://github.com/coldpatch/scratch.nvim",
})

require("scratch").setup()

Using lazy.nvim

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

Requirements

  • Neovim >= 0.7.0

Configuration

You can configure the plugin by passing a table to the setup function. Here are the default settings:

require("scratch").setup({  
    -- How to open the scratchpad. Can be 'float' or a command like
    -- 'edit', 'split', 'vsplit', 'tabnew'.
    open_mode = "float",

    -- Configuration for the floating window (only used if open_mode is 'float').
    float = {
        relative = 'editor',
        border = 'rounded',
        width = 0.8,
        height = 0.8,
    },

    -- The file extension for your notes.  
    file_extension = "md",

    storage = {  
        -- If true, notes are stored in a subdirectory of the current workspace.  
        -- If false, all notes are stored in a single global directory.  
        use_workspace = true,

        -- The name of the subdirectory for workspace-specific notes.  
        -- This is created in your current working directory.  
        workspace_subdir = ".scratchpad",

        -- The global path for notes when 'use_workspace' is false.  
        global_path = vim.fn.stdpath("data") .. "/scratchpad",  
    }  
})

Usage

Commands

  • :Scratch - Opens a temporary (ephemeral) scratchpad that is not saved to disk.
  • :ScratchDaily - Opens the scratchpad for the current day.
  • :ScratchWeekly - Opens the scratchpad for the current week.
  • :ScratchMonthly - Opens the scratchpad for the current month.

Key Mappings

You can create your own key mappings for convenience:

-- Open temporary scratchpad  
vim.keymap.set("n", "<leader>st", "<cmd>Scratch<cr>", { desc = "Open temporary scratchpad" })

-- Open daily scratchpad  
vim.keymap.set("n", "<leader>sd", "<cmd>ScratchDaily<cr>", { desc = "Open daily scratchpad" })

-- Open weekly scratchpad  
vim.keymap.set("n", "<leader>sw", "<cmd>ScratchWeekly<cr>", { desc = "Open weekly scratchpad" })

-- Open monthly scratchpad  
vim.keymap.set("n", "<leader>sm", "<cmd>ScratchMonthly<cr>", { desc = "Open monthly scratchpad" })  

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages