This plugin allows you to easily search and insert emojis and kaomojis in your current buffer.
Though there are a couple of plugins (see Similar plugins and inspiration), I decided to make a 15th plugin. π
Jokes aside, I could not find a plugin that fulfills my wish for both telescope and cmp integration, so why not write a plugin myself?
- Automatic updates of available emojis via GitHub actions (emojis-api.com as source).
- No dependencies (relies on
vim.ui.select
). - (Optional) telescope.nvim integration (emojis only).
- (Optional) nvim-cmp integration (emojis only).
With Lazy.nvim:
{
"allaman/emoji.nvim",
version = "1.0.0", -- optionally pin to a tag
ft = "markdown", -- adjust to your needs
dependencies = {
-- util for handling paths
"nvim-lua/plenary.nvim",
-- optional for nvim-cmp integration
"hrsh7th/nvim-cmp",
-- optional for telescope integration
"nvim-telescope/telescope.nvim",
},
opts = {
-- default is false
enable_cmp_integration = true,
-- optional if your plugin installation directory
-- is not vim.fn.stdpath("data") .. "/lazy/
plugin_path = vim.fn.expand("$HOME/plugins/"),
},
config = function(_, opts)
require("emoji").setup(opts)
-- optional for telescope integration
local ts = require('telescope').load_extension 'emoji'
vim.keymap.set('n', '<leader>se', ts.emoji, { desc = '[S]earch [E]moji' })
end,
}
For nvim-cmp integration add emoji
to your list of sources:
local sources = {
{ name = "nvim_lsp" },
{ name = "buffer", keyword_length = 5 },
{ name = "luasnip" },
{ name = "emoji" },
}
For telescope integration load the extension via:
require("telescope").load_extension("emoji")
:EmojiInsert
respectivelua require("emoji").insert()
or:EmojiInsertByGroup
respectivelua require("emoji").insert_by_group()
allows you to select an emoji that is inserted at your cursor's current position.:Telescope emoji
does the same but invokes Telescope instead ofvim.ui.select
. (if telescope.nvim is installed).- While in insert mode typing
:
triggers the auto-completion of nvim-cmp. (if nvim-cmp integration is enabled and configured).
:KaomojiInsert
respectivelua require("emoji").insert_kaomoji()
:KaomojiInsertByGroup
respectivelua require("emoji").insert_kaomoji_by_group()
You can also create key bindings to your liking.
Thanks to (emojis-api.com for providing its emoji API that is used in GitHub Actions to automatically update emojis.
Thanks to hines-r for providing kaomojis.json