mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Git mergetool completion (#3226)
* git completion: add mergetool The list of tools is stole from the bash completion file that comes with git. * git completion: complete files with merget conflict for mergetool
This commit is contained in:
parent
2df263fa26
commit
6b99af05a5
1 changed files with 25 additions and 0 deletions
|
@ -448,6 +448,31 @@ complete -f -c git -n '__fish_git_using_command merge' -l abort -d 'Abort the cu
|
|||
|
||||
# TODO options
|
||||
|
||||
### mergetool
|
||||
|
||||
function __fish_git_mergetools
|
||||
set -l tools diffuse diffmerge ecmerge emerge kdiff3 meld opendiff tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc codecompare
|
||||
for tool in $tools
|
||||
if command --search $tool >/dev/null
|
||||
echo "$tool"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# returns list of files with status:
|
||||
# "UU"=unmerged "\?\?"=untracked "M "=staged " M"=changed, not staged "MM"=staged and changed locally
|
||||
function __fish_git_status --argument-names "statusmarker"
|
||||
for line in (git status -s)
|
||||
set -l filename (string replace -r "^$statusmarker\s+" "" $line)
|
||||
and echo $filename
|
||||
end
|
||||
end
|
||||
|
||||
complete -f -c git -n '__fish_git_needs_command' -a mergetool -d 'Run merge conflict resolution tools to resolve merge conflicts'
|
||||
complete -f -c git -n '__fish_git_using_command mergetool' -s t -l tool -d "Use specific merge resolution program" -a "(__fish_git_mergetools)"
|
||||
complete -f -c git -n '__fish_git_using_command mergetool' -a "(__fish_git_status 'UU')" -d "File"
|
||||
|
||||
|
||||
### mv
|
||||
complete -c git -n '__fish_git_needs_command' -a mv -d 'Move or rename a file, a directory, or a symlink'
|
||||
# TODO options
|
||||
|
|
Loading…
Reference in a new issue