Coder Social home page Coder Social logo

yacp.nvim's Introduction

๐ŸŽจ yacp.nvim

An extension for neovim that allows you to run arbitrary commands via a command palette.

Useful for repetitive but map unworthy actions you frequently perform.

yacp

Setup

Install

use {
  "muchzill4/yacp.nvim",
  -- when using provider other than "native":
  -- requires = {
  --   "nvim-telescope/telescope.nvim", -- provider = "telescope"
  --   "ibhagwan/fzf-lua" -- provider = "fzf"
  -- },
}

Configure

require("yacp").setup {
  provider = "native", -- native (default, uses vim.ui.select) | telescope | fzf
  palette = {
    { name = "echo in term", cmd = "term echo SUCCESS" },
    { name = "help", cmd = "Telescope help_tags" },
    { name = "hi", cmd = function() print("HI!") end },
    {
      name = "do stuff only in go files",
      cmd = "...",
      show = function()
        return vim.bo.filetype == "go"
      end
    },
  },
}

Usage

:lua require("yacp").yacp()

Re-run last command executed via command palette:

:lua require("yacp").replay()

Extending command palette

This can be useful in a project specific setup. Instead of polluting your global command palette via setup(), you can use exrc or windwp/nvim-projectconfig to run palette.extend() when running vim in a specific directory.

local palette = require "yacp.palette"

palette.extend({
  { name = "build", cmd = "make build" },
  ...
})

Focus

Focus is an optional feature, which allows you to set a temporary palette entry named "focus run".

  • "Focus run" becomes visible, once focus command is set
  • You can set the focus command by using either:
    • "focus set" palette entry
    • :lua require("yacp.focus").set()

To use focus, you need to first enable it in your setup:

require("yacp").setup {
  ...
  enable_focus = true,
}
focus-demo.mp4

Workflow hint

  1. Run a command you'd like to focus on using vim command line mode
  2. Execute "focus set" entry from command palette
  3. Paste the command you've run in step 1. using ": vim register: <C-r>:

Similar plugins

yacp.nvim's People

Contributors

alidav01 avatar muchzill4 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

alidav01

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.