LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-16-2020, 05:32 PM   #1
blueray
Member
 
Registered: Feb 2020
Location: Bangladesh
Distribution: Debian, Ubuntu, Linux Mint
Posts: 136

Rep: Reputation: 2
zsh - extend zsh completion


You can see from the following screenshot that my `git ls-files -m` output is only `book-urls.txt`. I mean it is the only modified file.

Click image for larger version

Name:	BUzb2.png
Views:	24
Size:	78.9 KB
ID:	34327

Now `git diff HEAD ` suggest `Completing tree file` (which list all the files). I want to place `Completing modified files` (the output of `git ls-files -m`) at the top as suggestion.

I used:

zstyle :completion::complete:git-diff:argument-rest: group-order files
zstyle :completion::complete:git-difftool:argument-rest: group-order files

To put `Completing tree files` on the top of the suggestions.

However, I am not understanding how to append the output of `git ls-files -m` as suggestion to the existing suggestions.

I am almost positive that I have to do something like:

_git-diff 2>/dev/null
functions[_git-diff-orig]=$functions[_git-diff]

_git-diff() {
_git-diff-orig "$@"
...
}

However, I am not sure what to replace `...` with.

Just to be clear, I also tried `zstyle ':completion::complete:git-difftool:argument-rest:' command 'git ls-files -m'`. Apparently doing nothing.
 
Old 10-17-2020, 02:44 AM   #2
blueray
Member
 
Registered: Feb 2020
Location: Bangladesh
Distribution: Debian, Ubuntu, Linux Mint
Posts: 136

Original Poster
Rep: Reputation: 2
The solution I found from reddit is to apply the following pathch in _git-diff ()

Code:
-              'files::__git_tree_files ${PREFIX:-.} HEAD' && ret=0
+              'files::__git_changed_files ${PREFIX:-.} HEAD' && ret=0
 
  


Reply

Tags
zsh



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Zsh auto suggestion and tab completion bstaletic Linux - Software 2 06-02-2014 11:54 AM
Completion while typing in bash or zsh? anon109 Linux - General 2 08-25-2011 01:56 AM
zsh completion and square brackets Stigius Linux - Software 0 06-27-2010 09:39 AM
LXer: Color Completion Using Zsh Modules On Linux Or Unix LXer Syndicated Linux News 0 12-17-2008 08:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration