worming004 / duck.nvim

A duck that waddles arbitrarily in neovim.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

duck.nvim

A duck that waddles between your codes

Peek 2021-11-18 15-43

Coding? release the duck.
bored? release the duck.
not bored? release the duck.

Install and Configure

{
    'tamton-aquib/duck.nvim',
    config = function()
        vim.keymap.set('n', '<leader>dd', function() require("duck").hatch() end, {})
        vim.keymap.set('n', '<leader>dk', function() require("duck").cook() end, {})
        vim.keymap.set('n', '<leader>da', function() require("duck").cook_all() end, {})
    end
}

To set custom character:

nnoremap <leader>dd :lua require("duck").hatch("࢞")<CR>

popular candidates: πŸ¦† ࢞ πŸ¦€ 🐈 🐎 πŸ¦– 🐀

You can also specify how fast a duck moves (measured in steps per second):

vim.keymap.set('n', '<leader>dd', function() require("duck").hatch("πŸ¦†", 10) end, {}) -- A pretty fast duck
vim.keymap.set('n', '<leader>dc', function() require("duck").hatch("🐈", 0.75) end, {}) -- Quite a mellow cat

New position strategies

hatch function support a strategy to pass to override the current one.

for example, the following strategy always push the duck to the right:

local always_right_strategy = function(positions) -- {col = <val>, row = <val>}
    return {col = positions.col + 1, row = positions.row}
end

require("duck").hatch("πŸ¦†", 5, "none", always_right_strategy)

This strategies is available at require("duck").default_strategies.always_right_strategy

Features

  • can release multiple ducks.
  • does not load on startup.
  • Light weight, <100 LOC
  • Its a duck
  • custom strategies for new position

About

A duck that waddles arbitrarily in neovim.

License:MIT License


Languages

Language:Lua 100.0%