9
submitted 11 months ago* (last edited 11 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,
      },
....
you are viewing a single comment's thread
view the rest of the comments
[-] lautan@lemmy.ca 1 points 10 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

2157 readers
1 users here now

founded 1 year ago
MODERATORS