Scretch.nvim is a plugin to easily create and manage scratch files ๐.
scretch_new.mov
scretch_new_named.mov
scretch_search_grep_explore.mov
This plugin requires Telescope or fzf-lua and ripgrep to function.
If you don't have ripgrep installed, I recommend you go check the installation procedure here.
If you don't want to install it, it should fall back to find
.
You can paste the following code using Packer, or adapt to your favorite package manager:
use {
"Sonicfury/scretch.nvim",
requires = 'nvim-telescope/telescope.nvim',
-- or
-- requires = 'ibhagwan/fzf-lua' ,
config = function()
require("scretch").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end
}
Here are the default settings used in Scretch:
local config = {
scretch_dir = vim.fn.stdpath('config') .. '/scretch/', -- will be created if it doesn't exist
default_name = "scretch_",
default_type = "txt", -- default unnamed Scretches are named "scretch_*.txt"
split_cmd = "vsplit", -- vim split command used when creating a new Scretch
backend = "telescope.builtin" -- also accpets "fzf-lua"
}
You can copy those settings, update them with your preferences and put them into the setup function to load them.
local scretch = require("scretch")
vim.keymap.set('n', '<leader>sn', scretch.new)
vim.keymap.set('n', '<leader>snn', scretch.new_named)
vim.keymap.set('n', '<leader>sl', scretch.last)
vim.keymap.set('n', '<leader>ss', scretch.search)
vim.keymap.set('n', '<leader>sg', scretch.grep)
vim.keymap.set('n', '<leader>sv', scretch.explore)
Feel free to open issues if you have a suggestion or encounter a bug. Be kind !
AGPL-3.0, see license file
Feel free to open up PRs, they should respect the contribution guidelines. Be kind !