Open Bhupesh-V opened 3 years ago
At the bottom of the readme it gives a good example of how to do this: %s/:\([^:]\+\):/\=emoji#for(submatch(1), submatch(0))/g
I ended up adding the following to my vimrc:
nnoremap <silent> <Leader><Bslash> :s/:\([^:]\+\):/\=emoji#for(submatch(1), submatch(0))/g<CR>:noh<CR>
At the bottom of the readme it gives a good example of how to do this:
%s/:\([^:]\+\):/\=emoji#for(submatch(1), submatch(0))/g
I ended up adding the following to my vimrc:
nnoremap <silent> <Leader><Bslash> :s/:\([^:]\+\):/\=emoji#for(submatch(1), submatch(0))/g<CR>:noh<CR>
Yep, it's indeed good but I am trying to reduce the need for that one keystroke.
Wouldn't it be great if there were a global setting for this?
For example: let g:insert_emoji = 1
which will insert the emoji instead of the string?
I written this quick script that does the trick! It will substitute your emojis as soon as the autocomplete finishes. You won't need a mapping then.
fun! <SID>Sub_movend(lineno)
if (match(getline(a:lineno), ':\([^:]\+\):') != -1) " There is a match
exe a:lineno . 'su /:\([^:]\+\):/\=emoji#for(submatch(1), submatch(0))/g'
star!
endif
endfun
autocmd! CompleteDone * call <SID>Sub_movend(line('.'))
Then ofc, source the script in your .vimrc with line:
runtime /path/to/scrip.vim
The :emoji_string: sometimes are not rendered by default in HTML pages except GitHub ofc. It would be nice to have a switch to add the actual emoji instead of the string.
I have tried to automate this, but was unsuccessful.