Skip to content

Instantly share code, notes, and snippets.

@andlrc
Created May 2, 2023 17:23
Show Gist options
  • Save andlrc/77813853c771ebcd5d1e05e664b58487 to your computer and use it in GitHub Desktop.
Save andlrc/77813853c771ebcd5d1e05e664b58487 to your computer and use it in GitHub Desktop.
vim9script
# jump.vim - Calls git-jump and hydrate a qflist
# Maintainer: Andreas Louv <andreas@louv.dk>
# Last Change: Apr 19, 2023
def Jump(...args: list<string>): string
var strargs: string = args->map((key, val) => expand(val))->join(' ')
var cmd = 'git jump --stdout ' .. strargs
return system(cmd)
enddef
command! -nargs=+ -complete=file_in_path Jump cexpr Jump(<f-args>)
command! -nargs=+ -complete=file_in_path LJump lexpr Jump(<f-args>)
cnoreabbrev <expr> jump (getcmdtype() ==# ':' && getcmdline() ==# 'jump') ? 'Jump' : 'jump'
cnoreabbrev <expr> ljump (getcmdtype() ==# ':' && getcmdline() ==# 'ljump') ? 'LJump' : 'ljump'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment