Skip to content

A toolbox for neovim to put your custom neovim functions, all invokable from vim.ui.select!

Notifications You must be signed in to change notification settings

DanWlker/toolbox.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

toolbox.nvim

A toolbox for neovim to put your custom neovim functions, all invokable from vim.ui.select!

demo

Installation

Lazy.nvim

return {
  'DanWlker/toolbox.nvim',
  config = function()
    require('toolbox').setup {
      commands = {
        --replace the bottom few with your own custom functions
        {
          name = 'Format Json',
          execute = "%!jq '.'",
          require_input = true,
        },
        {
          name = 'Try in visual mode!', --this works in visual mode as well!
          execute = 's/leader/thing',
        },
        {
          name = 'Inspect Vim Table',
          execute = function(v)
            print(vim.inspect(v))
          end,
        },
        {
          name = 'Copy Vim Table To Clipboard',
          execute = function(v)
            vim.fn.setreg('+', vim.inspect(v))
          end,
        },
        {
          name = 'Reload plugin',
          execute = function(name)
            package.loaded[name] = nil
            require(name).setup()
          end,
        },
      },
    }

    vim.keymap.set({ 'n', 'v' }, '<leader>st', require('toolbox').show_picker, { desc = '[S]earch [T]oolbox' })
  end,
}

Config

{
  commands = {
    --Note this is the identifier for the command as well
    --@type string
    name = ""
    --if it is a function and it requires no params, it will be immediately invoked
    --if it requires params, it will be shown in the command line
    --if it is a string, it will be invoked via vim.cmd, similar to `:`
    --@type string|function
    execute = "" | function() end
    --if set for string commands, it will populate the `:` command
    --@type bool
    require_input = false,
  }
}

TODOs

  1. Make it work in visual mode (Done)

About

A toolbox for neovim to put your custom neovim functions, all invokable from vim.ui.select!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages