emoji_picker_demo.mp4
There are already many other emoji/icon picker plugins such as telescope-emoji.nvim, icon-picker.nvim or even cmp-emoji which offers way more features like fuzzy searching. However, I just wanted a quick and dirty way to have the emojis displayed in a grid and select one, similar to phone keyboards.
Using packer
use({
"WilsonOh/emoji_picker-nvim",
config = function()
require("emoji_picker").setup()
end,
})
This plugin does not set any keymaps. The plugin can be called using the EmojiPicker
ex-command or require("emoji_picker").open_win()
in lua.
Within the emoji picker window, press q
or esc
to close out of the window. Use the usual navigation keys to move around in the window (Tab
and Shift-Tab
are set to move right and left in the window) and press Enter
to select an emoji.
vim.keymap.set("i", "<M-e>", "<cmd>EmojiPicker<cr>")
local config = {
window = {
relative = "cursor",
row = 1,
col = 1,
width = 20,
height = 6,
anchor = "SW",
style = "minimal",
border = "rounded",
},
emoji_list = require("emoji_picker.emojis"),
}
The default list of emojis is very limited as I didn't want to add too many, but a custom list of emojis can be passed into the setup function. All the arguments required for vim.api.open_win
can also be modified through the window
key in the setup function.
e.g.
require("emoji_picker").setup({
window = {
width = 25,
height = 10,
},
emoji_list = {
"*my custom*",
"*lines of emojis*",
},
})