9
submitted 9 months ago* (last edited 9 months ago) by lautan@lemmy.ca to c/neovim@programming.dev

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,
      },
....
top 2 comments
sorted by: hot top controversial new old
[-] armin@feddit.de 2 points 9 months ago

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

[-] lautan@lemmy.ca 1 points 9 months ago

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

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

Neovim

2106 readers
4 users here now

founded 1 year ago
MODERATORS