Giter VIP home page Giter VIP logo

telescope-gitmoji.nvim's Introduction

telescope-gitmoji.nvim

A Telescope integration of gitmoji.

Installation

-- lazy
{
  "olacin/telescope-gitmoji.nvim",
  config = function()
      require("telescope").load_extension("gitmoji")
  end,
  dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }
}

-- vim-plug
Plug 'olacin/telescope-gitmoji.nvim'

-- packer
use 'olacin/telescope-gitmoji.nvim'

Usage

# As a command
:Telescope gitmoji

# As a lua function
require('telescope').extensions.gitmoji.gitmoji()

Configuration

You can customize action on selection within Telescope setup() function.

telescope.setup({
    ...
    extensions = {
        gitmoji = {
            action = function(entry)
                -- entry = {
                --   display = "๐Ÿ› Fix a bug.",
                --   index = 4,
                --   ordinal = "Fix a bug.",
                --   value = {
                --     description = "Fix a bug.",
                --     text = ":bug:",
                --     value = "๐Ÿ›"
                --   }
                -- }
                local emoji = entry.value.value
                vim.ui.input({ prompt = "Enter commit message: " .. emoji .. " "}, function(msg)
                    if not msg then
                        return
                    end
                    -- Insert text instead of emoji in message
                    local emoji_text = entry.value.text
                    vim.cmd(':G commit -m "' .. emoji_text .. ' ' .. msg .. '"')
                end)
            end,
        },
    },
})

telescope.load_extension("gitmoji")

Default action

-- Default action (here with tpope vim-fugitive)
gm_actions.commit = function(entry)
    local emoji = entry.value.value
    vim.ui.input({ prompt = "Enter commit message: " .. emoji .. " " }, function(msg)
        if not msg then
            return
        end

        local git_tool = ":!git"
        if vim.g.loaded_fugitive then
            git_tool = ":G"
        end

        vim.cmd(string.format('%s commit -m "%s %s"', git_tool, emoji, msg))
    end)
end

telescope-gitmoji.nvim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

telescope-gitmoji.nvim's Issues

Add ability to use text version of emoji, instead of unicode

I think it would be a pretty good idea to add the ability to insert the text version of the gitmoji (like :poop: instead of ๐Ÿ’ฉ) this way it isn't rendered locally in the terminal, if the user wants. So just store the text version alongside the unicode versions, and have a config option to decide which one to insert when the Telescope gitmoji command is called.

How to use with lazy.nvim

Hi ๐Ÿฅฐ I just don't know how to use your plugin with Lazy.nvim
It said that fail to load the plugin

image

Here is my Lazy.nvim plugin field to setup gitmoji plugin.

return {
  "olacin/telescope-gitmoji.nvim",
  dependencies = {
    "nvim-telescope/telescope.nvim",
  },
  keys = {
    "<leader>gm",
    require("telescope").extensions.gitmoji.gitmoji,
    mode = "n",
    desc = "telescope gitmoji",
  },
}

Thank you.

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.