Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"s" mapping doesn't work properly when opening a folder using fzf. #1423

Open
3 of 8 tasks
hellwraiz opened this issue Jun 24, 2024 · 0 comments
Open
3 of 8 tasks

"s" mapping doesn't work properly when opening a folder using fzf. #1423

hellwraiz opened this issue Jun 24, 2024 · 0 comments
Labels

Comments

@hellwraiz
Copy link

hellwraiz commented Jun 24, 2024

Self-Diagnosis

Before creating an issue, take some time to search these resources for an answer. It's possible that someone else has already seen and solved your issue.

Environment

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)



-- Install plugins --------------------------------------------------------------------------------


require("lazy").setup({

    -- used to be able to use icons everywhere
    "ryanoasis/vim-devicons",

    -- nerd tree stuff
    "tiagofumo/vim-nerdtree-syntax-highlight",
    "preservim/nerdtree",
    "Xuyuanp/nerdtree-git-plugin",

    -- fuzzy!!
    { 'junegunn/fzf', run = function() vim.fn['fzf#install']() end, },
    'junegunn/fzf.vim',

}

vim.keymap.set('n', '<leader>fd', ':FZFFolders<CR>', {noremap = true, silent = true})

function FZFFolders()
    vim.fn['fzf#run']({
        source = 'find . -type d -print',
        sink = 'e',
        options = '--preview "tree -C {} | head -100"'
    })
end
vim.api.nvim_create_user_command('FZFFolders', function()
    FZFFolders()
end, {})

Steps to Reproduce the Issue

  1. Open a file using nvim
  2. type :NERDTree to open the tree on the left side of the window
  3. navigate to it using
  4. use the provided fd shortcut to look for directories. Open some directory.
  5. Now that the nerdTree shows the newly opened directory press "i" on a file to open it in a split
  6. profit

Current Behavior (Include screenshots where appropriate.)

I receive the following error in the terminal below:

Error detected while processing function nerdtree#ui_glue#invokeKeyMap[1]..76[18]..75[3]..23_openVSplit[1]..105[1]..121[3]..177[6]..178[9]..172[3]..176[16]..218[1]..228[2]..function ner
dtree#ui_glue#invokeKeyMap[1]..76[18]..75[3]..23_openVSplit[1]..105[1]..121[3]..177[6]..178[9]..172[3]..176[16]..218[1]..228:
line 2:
E605: Exception not caught: NERDTree.TreeNotOpen

and after I press enter the same window that I had opened previously opens in another split window

and if I try to use "o" instead, it just replaces the nerdtree itself instead of the file next to it

Expected Result

open the chosen file in the tree in a split above the currently opened buffer.

or when using "o", replaces the currently opened file with the chosen on in the tree

Aditional stuff

I also found issue #1374 which seemed to have a similar problem, and had a solution provided, but it didn't work for me.

@hellwraiz hellwraiz added the bug label Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant