Code Monkey home page Code Monkey logo

Comments (11)

goedel-gang avatar goedel-gang commented on June 16, 2024

Hi Afonso,

Thank you : )

It seems that this is a product of relying more on the Bash completion mechanism with compgen. Particularly it seems that compgen -W ... -- doesn't understand how to complete on infixes (possibly I need to have a closer look at man bash). Does this mean you were using the completion from shell-examples? I'd not noticed it myself as I'm using zsh, where the native completion mechanism does understand infixes.

Anyway, I have a tentative fix at
goedel-gang@79f08ec

Does this fix what you were talking about? It's not a particularly neat way to do it though, maybe we should just move away from compgen entirely..

from bash-utils.

afonsoguerra avatar afonsoguerra commented on June 16, 2024

Perfect! That does the trick quite nicely. Thanks for the ultra-fast reply time :)

from bash-utils.

goedel-gang avatar goedel-gang commented on June 16, 2024

You're very welcome, I've not got anything better to do : )

Thinking about it, the way it now works is that say you have bookmarks otters and another, and type to ot<Tab> it will complete to another first. Personally I'd expect it to go to otters first, but I'd be interested to hear your thoughts on it.

from bash-utils.

afonsoguerra avatar afonsoguerra commented on June 16, 2024

I will have a play and let you know!

Somehow here it doesn't seem to complete to anything in particular, just gives me all the options that match upon the second tab press.

To elaborate on my use-case for the record: I have numbers at the start of directory names. I have these numbered directories inside a portal. The complete file names within each directory/project often have people's names. I frequently forget the numbers, but with the tab completion like this can easily find them!
How much this use-case is generalisable, I don't know.

from bash-utils.

micans avatar micans commented on June 16, 2024

Thanks Izaak! Hey Afonso, initially I was confused about your usage, but now I remember the numbering convention that you use. Makes sense!
When you write gives me all the options that match upon the second tab press. I assume that you don't use cyclic tab completion, correct?

from bash-utils.

goedel-gang avatar goedel-gang commented on June 16, 2024

°_° uh oh. Not completing to anything in particular sounds like a bug. Can you elaborate at all?
I have a minimal setup at https://gist.github.com/goedel-gang/fe51f674e36523fe2a0351e366c6da0e that seems to work.

Meanwhile I added the feature I was talking about in
goedel-gang@6bbff21#diff-d331283e0b634559df5fbea310f9510b.

ahhh stijn beat me to it

from bash-utils.

afonsoguerra avatar afonsoguerra commented on June 16, 2024

Hi Stijn!
No, clearly I don't! I never thought about it, but now it is becoming clear what the problems are in that scenario. I seem to have a vague recollection of discussing this with you some years ago... but I don't fully remember the details of the outcome. My apparix functions have been moved unchanged for the past decade or so :)

from bash-utils.

micans avatar micans commented on June 16, 2024

I am confused now. Izaak's initial fix did not quite work for me. If I apply this:

@@ -487,6 +485,7 @@ if [[ -n "$BASH_VERSION" ]]; then
         local IFS=$'\n'
         COMPREPLY=()
         if [[ "$COMP_CWORD" == 1 ]]; then
+            # read_array <(cut -f2 -d, "$APPARIXRC" "$APPARIXEXPAND" | grep -F "$tag")
             read_array <(cut -f2 -d, "$APPARIXRC" "$APPARIXEXPAND")
             local tags=( "${izaak_array[@]}" )
             read_array <(compgen -W "${tags[*]}" -- "$tag")

and use the outcommented line rather than the one following it, then I can do infix-completion on apparix bookmarks. I am also confused as I am not clear on how I beat Izaak ... :-)

from bash-utils.

goedel-gang avatar goedel-gang commented on June 16, 2024

euhhh I'm not sure what's happening now

I'm another couple of commits ahead. A couple of my intermediate commits quite badly broke some bits of apparix. Probably portal-expand is currently broken in upstream master, unless you happen to have nullglob set, and I also had another commit that made portal-expand clobber apparixrc.

My completion code looks quite different now to make it complete on prefixes first, and not duplicate completions on empty words.

from bash-utils.

micans avatar micans commented on June 16, 2024

Allright. How about we just have an outcommented line that allows infix completion. Do you have things in a working state? Then I'd be happy with a PR. No rush though, other things may be more important.

from bash-utils.

afonsoguerra avatar afonsoguerra commented on June 16, 2024

Ah, I miss breaking Stijn's code... the nostalgia...

from bash-utils.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.