Skip to main content

Emoji searcher for use with fzf

Project description

GitHub Workflow Status PyPI version PyPI pyversions License: MIT

emoji-fzf

Small utility for manipulating emojis via fzf's --preview hook!

Installation

  1. Install fzf if you don't have it already to use its preview browser:

    https://github.com/junegunn/fzf#installation

  2. Install the latest release of emoji-fzf from pypi:

    pip install emoji-fzf
    

See emoji-fzf --help for supported commands.

This project allows you to install the tool in an isolated environment: https://github.com/pipxproject/pipx

zsh plugin

There's an excellent zsh plugin available, see here (thanks @pschmitt !): https://github.com/pschmitt/emoji-fzf.zsh

Manually

Shell alias

You could add a shell alias like the following to your shell init script:

# if you aren't installing to a virtual env, you may need to add this to path
# (if it wasn't already) to access the tool from a pip installation
export PATH=$PATH:~/.local/bin

# add me to your ~/.bashrc or ~/.zshrc or whatnot
alias emoj="emoji-fzf preview | fzf -m --preview "emoji-fzf get --name {1}" | cut -d " " -f 1 | emoji-fzf get"
# to copy to xclip system keyboard (on mac use pbcopy) after selecting
emoj | xclip -selection c

vim

You can also add the following to a ~/.vimrc file (apologies for the kludgy vimscript, I'm not great at it), to enable C-e to open the emoji picker and insert the selected emoji:

" Use emoji-fzf and fzf to fuzzy-search for emoji, and insert the result
function! InsertEmoji(emoji)
    let @a = system('cut -d " " -f 1 | emoji-fzf get', a:emoji)
    normal! "agP
endfunction

command! -bang Emoj
  \ call fzf#run({
      \ 'source': 'emoji-fzf preview',
      \ 'options': '--preview ''emoji-fzf get --name {1}''',
      \ 'sink': function('InsertEmoji')
      \ })
" Ctrl-e in normal and insert mode will open the emoji picker.
" Unfortunately doesn't bring you back to insert mode 😕
map <C-e> :Emoj<CR>
imap <C-e> <C-o><C-e>

Alternative setup

If you prefer not to use fzf's preview feature and have the emojis appear before their aliases you can use the following alias instead:

alias emoj="emoji-fzf preview --prepend | fzf | awk '{ print \$1 }'"

Custom emoji aliases

emoji-fzf uses a pre-defined set of aliases for every emoji. If you want to define your own, ie add custom aliases for some emojis you can do this via the --custom-aliases flag.

Please note that these aliases will be appended to the list of pre-defined aliases and not replace them.

  1. First you need to create a JSON file with the following structure:

    [
      {
        "👍": ["my-custom-alias", "good-boy"]
      },
      {
        "💯": ["epic-victory-royale"]
      }
    ]
    
  2. Now you can call emoji-fzf like so:

    emoji-fzf --custom-aliases /path/to/your-custom-aliases.json preview
    

Development/testing

This uses a Dockerfile to keep the test build environment relatively clean and locked. The full test infrastructure is:

  • Docker container
  • tox to run the tests + build checks
  • pre-commit to run isort, black, etc.
  • check-wheel-contents for built wheel sanity

To run the test suite in docker just as CI does:

./test.sh

Publishing

This just uses old timey setuptools:

python setup.py sdist bdist_wheel

Use twine to upload to pypi.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emoji_fzf-0.11.0.tar.gz (281.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emoji_fzf-0.11.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file emoji_fzf-0.11.0.tar.gz.

File metadata

  • Download URL: emoji_fzf-0.11.0.tar.gz
  • Upload date:
  • Size: 281.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for emoji_fzf-0.11.0.tar.gz
Algorithm Hash digest
SHA256 14b3bf31721d5f7f81ca320626a9048b0879144e3b2618cc145d88c4111a851e
MD5 ede05582e05eb8ce1c458895b7788b60
BLAKE2b-256 6e956098d9cabccfa75839091d98a7a552eed928ea86f86fad5514f7887841c9

See more details on using hashes here.

File details

Details for the file emoji_fzf-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: emoji_fzf-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for emoji_fzf-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9964ff7551434b2ee1a2e79ba9bff1382cad055dfcdf0ccd8335778f872aa210
MD5 f0791d242225388de1ecd9b4003552cb
BLAKE2b-256 12c700040642322ff983438361f4a15890f339d4f44cfbe9f54ca323aef51679

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page