All Projects → jvgrootveld → telescope-zoxide

jvgrootveld / telescope-zoxide

Licence: MIT license
An extension for telescope.nvim that allows you operate zoxide within Neovim.

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to telescope-zoxide

cutlass.nvim
Plugin that adds a 'cut' operation separate from 'delete'
Stars: ✭ 78 (-38.1%)
Mutual labels:  nvim, nvim-plugin
nvim-highlite
A colorscheme template that is "lite" on logic for the developer.
Stars: ✭ 163 (+29.37%)
Mutual labels:  nvim, nvim-plugin
aerial.nvim
Neovim plugin for a code outline window
Stars: ✭ 485 (+284.92%)
Mutual labels:  nvim, nvim-plugin
vim-lamp
💡Language Server Protocol client for Vim.
Stars: ✭ 34 (-73.02%)
Mutual labels:  nvim, nvim-plugin
nvim-ghost.nvim
👻 GhostText plugin for Neovim with zero dependencies 🎉 Supports neovim running inside WSL too! 🥳 Windows/Linux/macOS supported out-of-the-box! 😄 (Other OSes need python3.6+ installed)
Stars: ✭ 32 (-74.6%)
Mutual labels:  nvim, nvim-plugin
virtual-types.nvim
Neovim plugin that shows type annotations as virtual text
Stars: ✭ 171 (+35.71%)
Mutual labels:  nvim, nvim-plugin
nvim-toggle-terminal
NeoVim plugin that toggles a terminal buffer in the current window maintaining the same shell instance
Stars: ✭ 54 (-57.14%)
Mutual labels:  nvim, nvim-plugin
lspcontainers.nvim
Neovim plugin for lspcontainers.
Stars: ✭ 157 (+24.6%)
Mutual labels:  nvim, nvim-plugin
better-escape.nvim
Escape from insert mode without delay when typing
Stars: ✭ 166 (+31.75%)
Mutual labels:  nvim, nvim-plugin
substitute.nvim
Neovim plugin introducing a new operators motions to quickly replace and exchange text.
Stars: ✭ 82 (-34.92%)
Mutual labels:  nvim, nvim-plugin
code runner.nvim
Neovim plugin.The best code runner you could have, it is like the one in vscode but with super powers, it manages projects like in intellij but without being slow
Stars: ✭ 234 (+85.71%)
Mutual labels:  nvim, nvim-plugin
qf helper.nvim
A collection of improvements for the quickfix buffer
Stars: ✭ 70 (-44.44%)
Mutual labels:  nvim, nvim-plugin
Neovim-from-scratch
📚 A Neovim config designed from scratch to be understandable
Stars: ✭ 3,825 (+2935.71%)
Mutual labels:  nvim, nvim-plugin
deoplete-elm
Deoplete plugin for elm-oracle.
Stars: ✭ 23 (-81.75%)
Mutual labels:  nvim
firvish.nvim
WIP
Stars: ✭ 31 (-75.4%)
Mutual labels:  nvim
nvim-hclipboard
Hijack your clipboard in Neovim
Stars: ✭ 19 (-84.92%)
Mutual labels:  nvim
nrepl.nvim
Neovim REPL for lua and vim script
Stars: ✭ 41 (-67.46%)
Mutual labels:  nvim
nvim
❤️ A neovim config repo.
Stars: ✭ 33 (-73.81%)
Mutual labels:  nvim
tabby.nvim
A declarative, highly configurable, and neovim style tabline plugin. Use your nvim tabs as a workspace multiplexer!
Stars: ✭ 232 (+84.13%)
Mutual labels:  nvim
dotfiles
Salonia Matteo's dotfiles (GNU/Linux configuration)
Stars: ✭ 19 (-84.92%)
Mutual labels:  nvim

Telescope Zoxide

An extension for telescope.nvim that allows you operate zoxide within Neovim.

Requirements

zoxide is required to use this plugin.

Installation

Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'jvgrootveld/telescope-zoxide'

Configuration

You can add, extend and update Telescope Zoxide config by using Telescope's default configuration mechanism for extensions. An example config:

-- Useful for easily creating commands
local z_utils = require("telescope._extensions.zoxide.utils")

require('telescope').setup{
  -- (other Telescope configuration...)
  extensions = {
    zoxide = {
      prompt_title = "[ Walking on the shoulders of TJ ]",
      mappings = {
        default = {
          after_action = function(selection)
            print("Update to (" .. selection.z_score .. ") " .. selection.path)
          end
        },
        ["<C-s>"] = {
          before_action = function(selection) print("before C-s") end,
          action = function(selection)
            vim.cmd("edit " .. selection.path)
          end
        },
        -- Opens the selected entry in a new split
        ["<C-q>"] = { action = z_utils.create_basic_command("split") },
      },
    }
  }
}

You can add new mappings and extend default mappings. (Note: The mapping with the key 'default' is the mapping invoked on pressing <cr>). Every keymapping must have an action function and supports the optional functions before_action and after_action.

Tip: If the action is a telescope picker, you should also set keepinsert = true to open it in insert mode. Else you can't directly type into the next telescope picker.

All action functions are called with the current selection object as parameter which contains the selected path and Zoxide score.

Tip: Make use of the supplied z_utils.create_basic_command helper function to easily invoke a vim command for the selected path.

Loading the extension

You can then load the extension by adding the following after your call to telescope's own setup() function:

require("telescope").load_extension('zoxide')

Loading the extension will allow you to use the following functionality:

List

With Telescope command:

:Telescope zoxide list

In Lua:

require("telescope").extensions.zoxide.list({picker_opts})

You can also bind the function to a key:

vim.keymap.set("n", "<leader>cd", require("telescope").extensions.zoxide.list)

Full example

local t = require("telescope")
local z_utils = require("telescope._extensions.zoxide.utils")

-- Configure the extension
t.setup({
  extensions = {
    zoxide = {
      prompt_title = "[ Walking on the shoulders of TJ ]",
      mappings = {
        default = {
          after_action = function(selection)
            print("Update to (" .. selection.z_score .. ") " .. selection.path)
          end
        },
        ["<C-s>"] = {
          before_action = function(selection) print("before C-s") end,
          action = function(selection)
            vim.cmd("edit " .. selection.path)
          end
        },
        ["<C-q>"] = { action = z_utils.create_basic_command("split") },
      },
    },
  },
})

-- Load the extension
t.load_extension('zoxide')

-- Add a mapping
vim.keymap.set("n", "<leader>cd", t.extensions.zoxide.list)

Default config

{
  prompt_title = "[ Zoxide List ]",

  -- Zoxide list command with score
  list_command = "zoxide query -ls",
  mappings = {
    default = {
      action = function(selection)
        vim.cmd("cd " .. selection.path)
      end,
      after_action = function(selection)
        print("Directory changed to " .. selection.path)
      end
    },
    ["<C-s>"] = { action = z_utils.create_basic_command("split") },
    ["<C-v>"] = { action = z_utils.create_basic_command("vsplit") },
    ["<C-e>"] = { action = z_utils.create_basic_command("edit") },
    ["<C-b>"] = {
      keepinsert = true,
      action = function(selection)
        builtin.file_browser({ cwd = selection.path })
      end
    },
    ["<C-f>"] = {
      keepinsert = true,
      action = function(selection)
        builtin.find_files({ cwd = selection.path })
      end
    }
  }
}

Default mappings

Action Description Command executed
<CR> Change current directory to selection cd <path>
<C-s> Open selection in a split split <path>
<C-v> Open selection in a vertical split vsplit <path>
<C-e> Open selection in current window edit <path>
<C-b> Open selection in telescope's builtin.file_browser builtin.file_browser({ cwd = selection.path })
<C-f> Open selection in telescope's builtin.find_files builtin.find_files({ cwd = selection.path })
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].