this post was submitted on 09 Dec 2023
10 points (100.0% liked)

Neovim

2164 readers
3 users here now

founded 1 year ago
MODERATORS
 

I made a quick plugin to open files found on Telescope inside Neotree:

local open_in_neo_tree = function(prompt_bufnr)
    local action_state = require "telescope.actions.state"
    local Path = require "plenary.path"
    local actions = require "telescope.actions"

    local entry = action_state.get_selected_entry()[1]
    local entry_path = Path:new(entry):parent():absolute()
    actions._close(prompt_bufnr, true)
    entry_path = Path:new(entry):parent():absolute() 
    entry_path = entry_path:gsub("\\", "\\\\")

    vim.cmd("Neotree close")

    file_name = nil
    for s in string.gmatch(entry, "[^/]+") do
        file_name = s
    end

    vim.cmd("Neotree filesystem reveal reveal_file=" .. entry_path .. "/" .. file_name)
end

require("telescope").setup {
  defaults = {
    layout_strategy = "vertical",
    mappings = {
      i = {
        [""] = open_in_neo_tree,
      },
....
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 11 months ago (1 children)

Great, I'm gonna try to find a working use case with the new telescope tabs plugin https://github.com/FabianWirth/search.nvim#customizing-tabs

[–] [email protected] 1 points 11 months ago

Why put this in a tab? It’s just a hockey.