From 84c9121f1090ce216616340610dc7dce9fdc819d Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Sun, 6 Jun 2021 23:35:59 +0530 Subject: [PATCH] Link to ranger-zoxide plugin --- README.md | 34 +++++++++++++++++++++++----------- contrib/ranger.py | 47 ----------------------------------------------- shell.nix | 4 ++-- 3 files changed, 25 insertions(+), 60 deletions(-) delete mode 100644 contrib/ranger.py diff --git a/README.md b/README.md index 1c09b89..5c6019b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/contrib/ranger.py b/contrib/ranger.py deleted file mode 100644 index e091b30..0000000 --- a/contrib/ranger.py +++ /dev/null @@ -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) diff --git a/shell.nix b/shell.nix index d03c000..917974f 100644 --- a/shell.nix +++ b/shell.nix @@ -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 ];