Skip to content

Instantly share code, notes, and snippets.

@jiangyinzuo
Created September 20, 2023 09:41
Show Gist options
  • Save jiangyinzuo/d9c985999f76864ac192edfdacdadcce to your computer and use it in GitHub Desktop.
Save jiangyinzuo/d9c985999f76864ac192edfdacdadcce to your computer and use it in GitHub Desktop.
FZF + Z vimscript
function Z(query, sink)
let l:cmd = "awk -f " . $VIMRC_ROOT . "/z.awk regex=" . a:query . " ~/.z "
call fzf#run(fzf#wrap({'source': l:cmd, 'sink': a:sink, 'options': ['--query', a:query, '--prompt', 'Z ' . a:sink . '>', '--color', 'hl:148,hl+:190']}))
endfunction
command! -bang -nargs=? Z call Z(<q-args>, 'cd')
command! -bang -nargs=? TZ call Z(<q-args>, 'tcd')
command! -bang -nargs=? LZ call Z(<q-args>, 'lcd')
command! -bang -nargs=? Zex call Z(<q-args>, 'Ex')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment