Git Product home page Git Product logo

scretch.nvim's Introduction

Introduction

Scretch.nvim is a plugin to easily create and manage scratch files ๐Ÿ™‚.

Features

New scretch

scretch_new.mov

New named scretch

scretch_new_named.mov

Search, grep, and explore scretches !

scretch_search_grep_explore.mov

Templates

You can save any buffer as a Scretch template. It'll be saved in the default directory if none is explicitely provided in the config. You can also search and edit templates with Telescope or Fzf-Lua, and create a new Scretch from a template. See suggested mappings.

Installation

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 {
  "0xJohnnyboy/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
}

Configuration

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
    templte_dir = vim.fn.stdpath('data') .. '/scretch/templates', -- 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.

Suggested mappings

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>sft', scretch.new_from_template)
vim.keymap.set('n', '<leader>sl', scretch.last)
vim.keymap.set('n', '<leader>ss', scretch.search)
vim.keymap.set('n', '<leader>st', scretch.edit_template)
vim.keymap.set('n', '<leader>sg', scretch.grep)
vim.keymap.set('n', '<leader>sv', scretch.explore)
vim.keymap.set('n', '<leader>sat', scretch.save_as_template)

Issues

Feel free to open issues if you have a suggestion or encounter a bug. Be kind !

License

AGPL-3.0, see license file

Contributing

Feel free to open up PRs, they should respect the contribution guidelines. Be kind !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.