Giter Site home page Giter Site logo

Comments (7)

sobolevn avatar sobolevn commented on July 28, 2024 1

I will have to figure this out :) Will do quite soon.

from dotfiles.

sobolevn avatar sobolevn commented on July 28, 2024

Hi! Thanks a lot, I'm really pleased that you like it!

zoxide completion is done here:

# complete `zoxide`
_z () {
# I have a custom completion, because I like `z NAME<TAB>`
# and not `z NAME<SPACE><TAB>`
local args
args="$(zoxide query -a -l)"
_arguments "1:paths:($args)"
}
compdef _z z
zstyle ':fzf-tab:complete:(\\|*/|)z:*' fzf-preview \
'_fzf_complete_realpath "$word"'

It is quite complex. First of all, take a look here, this is how z is defined:

dotfiles/shell/.external

Lines 59 to 71 in ed0b29c

# === z ===
# https://github.com/ajeetdsouza/zoxide
# `zoxide` has an option to use `fzf` to provide completions natively,
# but it works only for `z NAME<SPACE><TAB>`,
# it does not work for `z NAME<TAB>`.
# So, I have this usecase as a custom completion defined in `.completions`.
eval "$(zoxide init zsh --no-cmd)"
z () {
# I need this function to setup custom code completion for `zoxide`.
\__zoxide_z "$@"
}

Then, redefine it to cd (or use both). It should work.

from dotfiles.

adriangalilea avatar adriangalilea commented on July 28, 2024

Found the cause albeit a bit weird I think:

~  master ✔                                                                                                                                                                                           130 ⚠️
» z --version
zoxide: no match found
                                                                                                                                                                                                            
~  master ✔                                                                                                                                                                                             1 ⚠️
» zoxide --version
zoxide 0.9.4

Once I aliased z to zoxide then aliasing cd to z worked, I find weird that nothing was complaining when I did cd, and it even seemed to be triggering zoxide actually, but without it the completions didn't work.

Thanks!

P.S.: I tried cd tab the window displays, I select one directory, enter then I try tab and it doesn't trigger the window, so how do I select further down the tree?

could you clarify how this work?

from dotfiles.

adriangalilea avatar adriangalilea commented on July 28, 2024

P.S.: I tried cd tab the window displays, I select one directory, enter then I try tab and it doesn't trigger the window, so how do I select further down the tree?

could you clarify how this work?

Wait nvm, this now somehow works, but I lost the window pane on the right
image
Any idea?

Sorry to be bothering you with this.

EDIT: if I remove the

# alias z="zoxide"
# alas cd="z"

The window pane now appears again, but if I add them it doesn't work.

from dotfiles.

adriangalilea avatar adriangalilea commented on July 28, 2024

Just to recap for your ease whenever you look at this:

In dotfiles-rpi/.shell/.completions Line 13

alias cd="z"

If I keep the alias cd="z" alias:

image The right window pane disappears.

It also seems that:

cd .shell

error: unrecognized subcommand '.shell'

Usage: zoxide <COMMAND>

For more information, try '--help'.

cd command no longer works.

If I remove the alias cd="z" alias:

image The right window pane reappears but I don't have zoxide as `cd` which is the way I like to have `cd`

Also if I try directly with z tab
image

It also shows that z completions are not working.

The rest of the commands preserve the right pane in both cases

image

from dotfiles.

adriangalilea avatar adriangalilea commented on July 28, 2024

@sobolevn found it, first, I think you use z and cd separately hence the 2 different flows, second, bat was always failing inside them causing further problems due the fact that in some systems, bat doesn't exists as is named batcat and when .zshenv loads it doesn't have the alias set, so I just aliased first line in .zshenv and is working fine :)

Is there any reason why you use both z and cd separately? isn't the point of zoxide that it learns your most visited directories when actually using it?

from dotfiles.

sobolevn avatar sobolevn commented on July 28, 2024

Yes, I use them separatelly. Because I am used to older z-jump or something, which didn't have the same features as cd does. So, my workflow is different for cd and z.

from dotfiles.

Related Issues (20)

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.