Created
February 23, 2022 17:57
-
-
Save dbernheisel/761269f6e1c7a1dc1626105f840e0202 to your computer and use it in GitHub Desktop.
Use fzf.vim to fuzzy-find available mix commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! g:MixRun(selection) abort | |
if !empty(a:selection) | |
execute "!mix ".a:selection | |
endif | |
endfunction | |
function! g:MixFzf(selection = '') abort | |
if empty(a:selection) | |
call fzf#run(fzf#wrap({ | |
\ 'source': 'mix help --names', | |
\ 'sink': function('g:MixRun'), | |
\ 'layout' : { | |
\ 'window': { | |
\ 'width': 0.95, | |
\ 'height': 0.9, | |
\ 'relative': v:true, | |
\ 'yoffset': 1.0 } }, | |
\ 'options': "--preview 'mix help {}'"})) | |
else | |
call MixRun(a:selection) | |
endif | |
endfunction | |
command! -nargs=* Mix call MixFzf(<q-args>) | |
" Use FZF: :Mix<cr> | |
" Direct: :Mix compile<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment