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) fzf-lua integration with
require("fzf-lua").register_ui_select()
(register fzf-lua as the UI interface for vim.ui.select) - (Optional) telescope.nvim integration (emojis only).
- (Optional) nvim-cmp integration (emojis only).
emojis via vim.ui
Please note that I use dressing.nvim in this picture so your UI might look different!
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",
-- optional for fzf-lua integration via vim.ui.select
"ibhagwan/fzf-lua",
},
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")
:Emoji
and:Emoji insert
respectivelua require("emoji").insert()
or:Emoji by-group
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 and the extension loaded).- While in insert mode typing
:
triggers the auto-completion of nvim-cmp. (if nvim-cmp integration is enabled and configured).
:Emoji kaomoji
respectivelua require("emoji").insert_kaomoji()
:Emoji kaomoji-by-group
respectivelua require("emoji").insert_kaomoji_by_group()
You can also create key bindings to your liking.
Auto-completion in command mode is supported.
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