{"action":"created","issue":{"url":"https://api.github.com/repos/ryanoasis/vim-devicons/issues/106","repository_url":"https://api.github.com/repos/ryanoasis/vim-devicons","labels_url":"https://api.github.com/repos/ryanoasis/vim-devicons/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/ryanoasis/vim-devicons/issues/106/comments","events_url":"https://api.github.com/repos/ryanoasis/vim-devicons/issues/106/events","html_url":"https://github.com/ryanoasis/vim-devicons/issues/106","id":102895531,"node_id":"MDU6SXNzdWUxMDI4OTU1MzE=","number":106,"title":"FZF Support? ","user":{"login":"mhartington","id":2835826,"node_id":"MDQ6VXNlcjI4MzU4MjY=","avatar_url":"https://avatars3.githubusercontent.com/u/2835826?v=4","gravatar_id":"","url":"https://api.github.com/users/mhartington","html_url":"https://github.com/mhartington","followers_url":"https://api.github.com/users/mhartington/followers","following_url":"https://api.github.com/users/mhartington/following{/other_user}","gists_url":"https://api.github.com/users/mhartington/gists{/gist_id}","starred_url":"https://api.github.com/users/mhartington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhartington/subscriptions","organizations_url":"https://api.github.com/users/mhartington/orgs","repos_url":"https://api.github.com/users/mhartington/repos","events_url":"https://api.github.com/users/mhartington/events{/privacy}","received_events_url":"https://api.github.com/users/mhartington/received_events","type":"User","site_admin":false},"labels":[{"id":150270505,"node_id":"MDU6TGFiZWwxNTAyNzA1MDU=","url":"https://api.github.com/repos/ryanoasis/vim-devicons/labels/help%20wanted","name":"help wanted","color":"159818","default":true},{"id":596696900,"node_id":"MDU6TGFiZWw1OTY2OTY5MDA=","url":"https://api.github.com/repos/ryanoasis/vim-devicons/labels/up-for-grabs","name":"up-for-grabs","color":"0e8a16","default":false},{"id":150270504,"node_id":"MDU6TGFiZWwxNTAyNzA1MDQ=","url":"https://api.github.com/repos/ryanoasis/vim-devicons/labels/%E2%9C%A8%20enhancement","name":"✨ enhancement","color":"84b6eb","default":false},{"id":329591403,"node_id":"MDU6TGFiZWwzMjk1OTE0MDM=","url":"https://api.github.com/repos/ryanoasis/vim-devicons/labels/%E2%9E%A4%20future","name":"➤ future","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":22,"created_at":"2015-08-24T21:29:19Z","updated_at":"2018-11-18T18:29:51Z","closed_at":null,"author_association":"COLLABORATOR","body":"FZF has a vim interface for fast file searching.\n\nhttps://github.com/junegunn/fzf\n\nSimilar to ctrlp/unite.\nWould be interested in have some icons in there too :grin: \n"},"comment":{"url":"https://api.github.com/repos/ryanoasis/vim-devicons/issues/comments/439714391","html_url":"https://github.com/ryanoasis/vim-devicons/issues/106#issuecomment-439714391","issue_url":"https://api.github.com/repos/ryanoasis/vim-devicons/issues/106","id":439714391,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTcxNDM5MQ==","user":{"login":"coreyja","id":964771,"node_id":"MDQ6VXNlcjk2NDc3MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/964771?v=4","gravatar_id":"","url":"https://api.github.com/users/coreyja","html_url":"https://github.com/coreyja","followers_url":"https://api.github.com/users/coreyja/followers","following_url":"https://api.github.com/users/coreyja/following{/other_user}","gists_url":"https://api.github.com/users/coreyja/gists{/gist_id}","starred_url":"https://api.github.com/users/coreyja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreyja/subscriptions","organizations_url":"https://api.github.com/users/coreyja/orgs","repos_url":"https://api.github.com/users/coreyja/repos","events_url":"https://api.github.com/users/coreyja/events{/privacy}","received_events_url":"https://api.github.com/users/coreyja/received_events","type":"User","site_admin":false},"created_at":"2018-11-18T18:29:51Z","updated_at":"2018-11-18T18:29:51Z","author_association":"NONE","body":"Used @dkarter's [comment](https://github.com/ryanoasis/vim-devicons/issues/106#issuecomment-354629715) as a starting point, and made some performance improvements and added some git diff support as well.\r\n\r\nTLDR: Wrote a tool to do the devicon lookup in Rust (so it actually doesn't depend on this repo at all), and used `bat` for the previewing. The Rust lookup is about 10x faster than the VIM only implementation, and allows streaming before all results are populated.\r\n\r\nYou can install both with\r\n```bash\r\ncargo install bat\r\ncargo install devicon-lookup\r\n```\r\n\r\nAnd here is the VIM config (also includes support for emulating `:GFiles?`):\r\n\r\n```vim\r\n\" Files + devicons\r\nfunction! Fzf_files_with_dev_icons(command)\r\n  let l:fzf_files_options = '--preview \"bat --color always --style numbers {2..} | head -'.&lines.'\"'\r\n   function! s:edit_devicon_prepended_file(item)\r\n    let l:file_path = a:item[4:-1]\r\n    execute 'silent e' l:file_path\r\n  endfunction\r\n   call fzf#run({\r\n        \\ 'source': a:command.' | devicon-lookup',\r\n        \\ 'sink':   function('s:edit_devicon_prepended_file'),\r\n        \\ 'options': '-m ' . l:fzf_files_options,\r\n        \\ 'down':    '40%' })\r\nendfunction\r\n function! Fzf_git_diff_files_with_dev_icons()\r\n  let l:fzf_files_options = '--ansi --preview \"sh -c \\\"(git diff --color=always -- {3..} | sed 1,4d; bat --color always --style numbers {3..}) | head -'.&lines.'\\\"\"'\r\n   function! s:edit_devicon_prepended_file_diff(item)\r\n    echom a:item\r\n    let l:file_path = a:item[7:-1]\r\n    echom l:file_path\r\n    let l:first_diff_line_number = system(\"git diff -U0 \".l:file_path.\" | rg '^@@.*\\+' -o | rg '[0-9]+' -o | head -1\")\r\n     execute 'silent e' l:file_path\r\n    execute l:first_diff_line_number\r\n  endfunction\r\n   call fzf#run({\r\n        \\ 'source': 'git -c color.status=always status --short --untracked-files=all | devicon-lookup',\r\n        \\ 'sink':   function('s:edit_devicon_prepended_file_diff'),\r\n        \\ 'options': '-m ' . l:fzf_files_options,\r\n        \\ 'down':    '40%' })\r\nendfunction\r\n \" Open fzf Files\r\nmap <C-f> :call Fzf_files_with_dev_icons($FZF_DEFAULT_COMMAND)<CR> \" :Files\r\nmap <C-d> :call Fzf_git_diff_files_with_dev_icons()<CR> \" :GFiles?\r\nmap <C-g> :call Fzf_files_with_dev_icons(\"git ls-files \\| uniq\")<CR> \" :GFiles\r\n```\r\n\r\nSee my blog post for the long form write up! https://coreyja.com/blog/2018/11/17/vim-fzf-with-devicons.html"}}
{"actor":{"display_login":"coreyja"}}