/poop.nvim

A neovim plugin to help embrace the code smell (lua version)

Primary LanguageLuaMIT LicenseMIT

DISCLAIMER

This is a lua implementation of https://github.com/ddl004/poop.nvim I created because I couldn't figure out how to use pynvim 🤦.

All credit goes to ddl004.

I'm not going to maintain this and the repo only servers as a way for testing ddl004/poop.nvim without having to set up pynvim if you are having trouble doing that.

💩 poop.nvim

A neovim plugin to help embrace the code smell.

Peek 2024-01-02 20-46

Features

  • Call eject to eject from the current cursor position!
    • Takes two arguments, left and right. e.g. :lua require('poop').setup().eject(💩,💀)
  • Option for customizing the projectile ejected and animation properties.
  • Optional configuration provided to eject emojis randomly while in insert mode.

Installation

With lazy.nvim:

simple setup (ejects poop all the time)
return {
  "mblarsen/poop.nvim",
  config = function()
    local poop = require('my-plugins.poop').setup()

    vim.on_key(function()
      if vim.api.nvim_get_mode().mode ~= 'i' then
        return
      end

      vim.schedule_wrap(function()
        poop.eject()
      end)()
    end, nil)

  end
}
ejects poop occasionally
return {
  "mblarsen/poop.nvim",
  config = function()
    local poop = require('my-plugins.poop').setup()

    local period = 10

    vim.on_key(function()
      if vim.api.nvim_get_mode().mode ~= 'i' then
        return
      end

      vim.schedule_wrap(function()
        local should_eject = math.random(1, period) == 1
        if should_eject then
          poop.eject()
        end
      end)()
    end, nil)

  end
}
ejects multiple emojis
return {
  "mblarsen/poop.nvim",
  config = function()
    local poop = require('my-plugins.poop').setup()
    local emojis = { '💩', '🌈', '👻' }

    local period = 10

    vim.on_key(function()
      if vim.api.nvim_get_mode().mode ~= 'i' then
        return
      end

      vim.schedule_wrap(function()
        local left = emojis[math.random(1, #emojis)]
        local right = emojis[math.random(1, #emojis)]
        local should_eject = math.random(1, period) == 1
        if should_eject then
          poop.eject(left, right)
        end
      end)()
    end, nil)

  end
}

License

This project is licensed under the MIT License.

Related

This project was inspired by duck.nvim