text: (window.webpackJsonp=window.webpackJsonp||[]).push([[30],{"8hLB":function(e,a,n){"use strict";n("E5k/");var t=n("q1tI"),s=n.n(t),c=(n("Wbzz"),n("Bl7J"));a.a=function(e){return s.a.createElement(c.a,Object.assign({},e,{icon:"post"}))}},"j+4u":function(e,a,n){"use strict";n.r(a),n.d(a,"_frontmatter",(function(){return c})),n.d(a,"default",(function(){return p}));n("rzGZ"),n("Dq+y"),n("8npG"),n("Ggvi"),n("E5k/"),n("q1tI");var t=n("7ljp"),s=n("8hLB");var c={},o={_frontmatter:c},b=s.a;function p(e){var a=e.components,n=function(e,a){if(null==e)return{};var n,t,s={},c=Object.keys(e);for(t=0;t<c.length;t++)n=c[t],a.indexOf(n)>=0||(s[n]=e[n]);return s}(e,["components"]);return Object(t.b)(b,Object.assign({},o,n,{components:a,mdxType:"MDXLayout"}),Object(t.b)("p",null,"Fzf + emoji is fun!😆..."),Object(t.b)("h1",null,"Vim Fzf"),Object(t.b)("p",null,"A powerful tool that you should know if you use command lines. I assume you know Fzf well and have it working with Vim."),Object(t.b)("h1",null,"Vim Script"),Object(t.b)("p",null,"We need a plugin from the same author of Fzf: ",Object(t.b)("a",Object.assign({parentName:"p"},{href:"https://github.com/junegunn/vim-emoji"}),"Vim-Emoji"),". However, appreantly author didn't bother to tell the ",Object(t.b)("code",Object.assign({parentName:"p"},{className:"language-text"}),"fzf")," flavor of this plugin. So here I am:"),Object(t.b)("p",null,"You need extra scripts to load all emojis from plugin and dump it to fzf so that you can find your emoji with ",Object(t.b)("code",Object.assign({parentName:"p"},{className:"language-text"}),"fzf"),"!"),Object(t.b)("div",{className:"gatsby-highlight","data-language":"vim"},Object(t.b)("pre",Object.assign({parentName:"div"},{className:"language-vim"}),Object(t.b)("code",Object.assign({parentName:"pre"},{className:"language-vim"}),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"function"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"!")," s",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),":"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token function"}),"getemoji"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"("),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),")"),"\n    ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"let")," keys ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"=")," emoji#",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token function"}),"list"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"("),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),")"),"\n    ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"let")," retval ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"=")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"["),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"]"),"\n    ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"for")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"e")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"in")," keys\n        ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"let")," v ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"=")," emoji#",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token function"}),"for"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"("),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"e"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),")"),"\n        ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"call")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token function"}),"add"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"("),"retval",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),",")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"e")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),".")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token string"}),"'='")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),".")," v",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),")"),"\n    ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"endfor"),"\n    ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"return")," retval\n",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"endfunction"),"\n\n",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"function"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"!")," s",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),":"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token function"}),"addemoji"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"("),"line",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),")"),"\n    ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"let")," arr ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"=")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token function"}),"split"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"("),"a",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),":"),"line",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),",")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token string"}),"'='"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),")"),"\n    execute ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token string"}),'"normal! a"')," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),".")," arr",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"["),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token number"}),"1"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"]")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),".")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token string"}),'"\\<Esc>"'),"\n",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"endfunction"),"\n\ncommand",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"!")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"-"),"nargs",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"="),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"*")," FzfEmoji ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token keyword"}),"call")," fzf#",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token function"}),"run"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"("),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"{"),"\n            \\ ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token string"}),"'source'"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),":")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),"<"),"sid",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token operator"}),">"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token function"}),"getemoji"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"("),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),")"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),","),"\n            \\ ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token string"}),"'sink'"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),":")," ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token function"}),"function"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"("),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token string"}),"'<sid>addemoji'"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),")"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),","),"\n            \\ ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token string"}),"'down'"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),":"),"    ",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token string"}),"'50%'"),"\n            \\",Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),"}"),Object(t.b)("span",Object.assign({parentName:"code"},{className:"token punctuation"}),")"),"\n"))),Object(t.b)("p",null,"Now go bind ",Object(t.b)("code",Object.assign({parentName:"p"},{className:"language-text"}),"FzfEmoji")," and have fun!"),Object(t.b)("p",null,"For more fzf vim script and plugins, see my fzf ",Object(t.b)("a",Object.assign({parentName:"p"},{href:"https://github.com/daizeng1984/dotfiles/blob/master/neovim/nvim/config/functions.vimrc#L44-L117"}),"collections"),"."))}p.isMDXComponent=!0}}]);
  //# sourceMappingURL=component---src-posts-2020-04-23-emoji-fzf-trick-mdx-faff882c47af398dbf93.js.map