Link to ranger-zoxide plugin

This commit is contained in:
Ajeet D'Souza 2021-06-06 23:35:59 +05:30
parent cf59aa1c0f
commit 84c9121f10
3 changed files with 25 additions and 60 deletions

View File

@ -2,7 +2,7 @@
> A smarter cd command for your terminal
[![crates.io][crates.io-badge]][crates.io]
[![crates.io][crates-io-badge]][crates-io]
[![releases][releases-badge]][Releases]
`zoxide` is a blazing fast replacement for your `cd` command, inspired by
@ -232,11 +232,18 @@ Be sure to set these before calling `zoxide init`.
## Third-party integrations
- [nnn], via [autojump plugin][nnn-autojump]
- [telescope-zoxide]
- [xxh], via [xxh-plugin-prerun-zoxide]
- [zoxide.vim]
- [zsh-autocomplete]
- [`nnn`][nnn] is a terminal file manager. You can use `zoxide` for navigation
with the official [`autojump`][nnn-autojump] plugin.
- [`ranger`][ranger] is a terminal file manager. You can use `zoxide` for
navigation with the [`ranger-zoxide`][ranger-zoxide] plugin.
- [`telescope.nvim`][telescope-nvim] is a fuzzy finder for `neovim`. You can
use it with `zoxide` via the [`telescope-zoxide`][telescope-zoxide] plugin.
- [`vim`][vim] / [`neovim`][neovim]. You can use `zoxide` for navigation with
the [`zoxide.vim`][zoxide-vim] plugin.
- [`xxh`][xxh] transports your shell configuration over SSH. You can use
`zoxide` over SSH via the [`xxh-plugin-prerun-zoxide`][xxh-zoxide] plugin.
- [`zsh-autocomplete`][zsh-autocomplete] adds realtime completions to `zsh`. It
supports `zoxide` out of the box.
[algorithm-aging]: https://github.com/ajeetdsouza/zoxide/wiki/Algorithm#aging
[algorithm-matching]: https://github.com/ajeetdsouza/zoxide/wiki/Algorithm#matching
@ -244,8 +251,8 @@ Be sure to set these before calling `zoxide init`.
[aur]: https://aur.archlinux.org/packages/zoxide-bin
[chocolatey]: https://community.chocolatey.org/packages/zoxide
[copr]: https://copr.fedorainfracloud.org/coprs/atim/zoxide/
[crates.io-badge]: https://img.shields.io/crates/v/zoxide
[crates.io]: https://crates.io/crates/zoxide
[crates-io-badge]: https://img.shields.io/crates/v/zoxide
[crates-io]: https://crates.io/crates/zoxide
[debian packages]: https://packages.debian.org/testing/admin/zoxide
[devuan packages]: https://pkginfo.devuan.org/cgi-bin/package-query.html?c=package&q=zoxide
[dm9pzcaq overlay]: https://github.com/gentoo-mirror/dm9pZCAq
@ -258,19 +265,24 @@ Be sure to set these before calling `zoxide init`.
[homebrew]: https://formulae.brew.sh/formula/zoxide
[linuxbrew]: https://formulae.brew.sh/formula-linux/zoxide
[macports]: https://ports.macports.org/port/zoxide/summary
[neovim]: https://github.com/neovim/neovim
[nixpkgs]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/zoxide/default.nix
[nnn-autojump]: https://github.com/jarun/nnn/blob/master/plugins/autojump
[nnn]: https://github.com/jarun/nnn
[pkgsrc]: https://pkgsrc.se/sysutils/zoxide
[releases]: https://github.com/ajeetdsouza/zoxide/releases
[ranger-zoxide]: https://github.com/jchook/ranger-zoxide
[ranger]: https://github.com/ranger/ranger
[releases-badge]: https://img.shields.io/github/v/release/ajeetdsouza/zoxide
[releases]: https://github.com/ajeetdsouza/zoxide/releases
[scoop]: https://github.com/ScoopInstaller/Main/tree/master/bucket/zoxide.json
[telescope-nvim]: https://github.com/nvim-telescope/telescope.nvim
[telescope-zoxide]: https://github.com/jvgrootveld/telescope-zoxide
[termux]: https://github.com/termux/termux-packages/tree/master/packages/zoxide
[tutorial]: contrib/tutorial.webp
[ubuntu packages]: https://packages.ubuntu.com/hirsute/zoxide
[vim]: https://github.com/vim/vim
[void linux packages]: https://github.com/void-linux/void-packages/tree/master/srcpkgs/zoxide
[xxh-plugin-prerun-zoxide]: https://github.com/xxh/xxh-plugin-prerun-zoxide
[xxh-zoxide]: https://github.com/xxh/xxh-plugin-prerun-zoxide
[xxh]: https://github.com/xxh/xxh
[zoxide.vim]: https://github.com/nanotee/zoxide.vim
[zoxide-vim]: https://github.com/nanotee/zoxide.vim
[zsh-autocomplete]: https://github.com/marlonrichert/zsh-autocomplete

View File

@ -1,47 +0,0 @@
import os.path
import subprocess
import ranger.api
import ranger.core.fm
import ranger.ext.signals
hook_init_old = ranger.api.hook_init
def hook_init(fm: ranger.core.fm.FM):
def zoxide_add(signal: ranger.ext.signals.Signal):
path = signal.new.path
process = subprocess.Popen(["zoxide", "add", path])
process.wait()
fm.signal_bind("cd", zoxide_add)
return hook_init_old(fm)
ranger.api.hook_init = hook_init
class z(ranger.api.commands.Command):
def execute(self):
try:
zoxide = subprocess.Popen(
["zoxide", "query"] + self.args[1:],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
stdout, stderr = zoxide.communicate()
if zoxide.returncode == 0:
output = stdout.decode("utf-8").strip()
if output:
self.fm.notify(output)
if os.path.isdir(output):
self.fm.cd(output)
else:
self.fm.notify("zoxide: unexpected exit", bad=True)
else:
output = stderr.decode("utf-8").strip() or "zoxide: unknown error"
self.fm.notify(output, bad=True)
except Exception as e:
self.fm.notify(e, bad=True)

View File

@ -8,6 +8,8 @@ pkgs.mkShell {
pkgs-master.cargo-audit
pkgs-master.elvish
pkgs-master.nushell
pkgs-master.shellcheck
pkgs-master.shfmt
pkgs-python
pkgs.bash
pkgs.cargo
@ -19,8 +21,6 @@ pkgs.mkShell {
pkgs.powershell
pkgs.rustc
pkgs.rustfmt
pkgs.shellcheck
pkgs.shfmt
pkgs.xonsh
pkgs.zsh
];