I can't create folders/files with "telescope_file_browser" - E486: Pattern not found:

820 views Asked by At

I'm new to the world of nvim and I've been trying to solve my problem for several days...

To make it simple, I can't activate a create method of the "telescope_file_browser" plugin... That is to say, in my configuration file, I've mapped an "N" key that should activate the "create" method. The problem is that I simply get back "E486: Pattern not found:" followed by the test I was able to do with the pattern redefinition...

(Forgive my clumsiness, I'm brand new to stack and this is my first post) I am of course at your disposal to answer or send the resources required to solve my problem.

Thank you for your understanding.

Here is the code of my telescope configuration:

local status, telescope = pcall(require, 'telescope')
if (not status) then return end
local actions = require('telescope.actions')
local builtin = require("telescope.builtin")

local function telescope_buffer_dir()
    return vim.fn.expand('%:p:h')
end

local fb_actions = require 'telescope'.extensions.file_browser.actions;

local status, telescope = pcall(require, 'telescope')
if (not status) then return end
actions = require('telescope.actions')
builtin = require("telescope.builtin")

function telescope_buffer_dir()
    return vim.fn.expand('%:p:h')
end

telescope.setup = {
    defaults = {
        mappings = {
            n = {
                ['q'] = actions.close
            }
        }
    },
    extensions = {
        file_browser = {
            theme = 'dropdown',
            -- disables netrw add use telescope-file-browser in its place
            hijack_netrw = true,
            mappings = {
                -- your custom insert mode mappings
                ["i"] = {
                    ['<C-w>'] = function() vim.cmd('normal vbd') end,
                },
                ["n"] = {
                    ["N"] = fb_actions.create,
                    ['h'] = fb_actions.goto_parent_dir,
                    ['/'] = function()
                        vim.cmd('startinsert')
                    end
                }
            }
        }
    }
}

telescope.load_extension('file_browser')

local opts = { noremap = true, silent = true }
vim.keymap.set('n', ';f', '<cmd>lua require("telescope.builtin").find_files({no_ignore = false, hidden = true})<cr>',
    opts)
vim.keymap.set('n', ';r', function()
    builtin.live_grep()
end)
vim.keymap.set('n', '\\\\', function()
    builtin.buffers()
end)
vim.keymap.set('n', ';t', function()
    builtin.help_tags()
end)
vim.keymap.set('n', ';;', function()
    builtin.resume()
end)
vim.keymap.set('n', ';e', function()
    builtin.diagnostics()
end)
vim.keymap.set("n", "sf", function()
    telescope.extensions.file_browser.file_browser({
        path = "%:p:h",
        cwd = telescope_buffer_dir(),
        respect_gitignore = false,
        hidden = true,
        grouped = true,
        previewer = false,
        initial_mode = "normal",
        layout_config = { height = 40 }
    })
end)

Screen Error

I've changed the map in case there was a conflict between several key combinations. I've tried to find an answer to the question why "N" is considered as a search command. I tried to change or reset the pattern with no effect...

(Once again, forgive me if I've missed anything. )

1

There are 1 answers

0
Husni Ramdani On

by reading your keymap set, i think you need to do "sf" first to go to file browser mode and then "N" to create a new file/folder.