telescope-file-browser.nvim icon indicating copy to clipboard operation
telescope-file-browser.nvim copied to clipboard

*.mov and *.mp4 not listed even when toggling hidden

Open benfrain opened this issue 2 years ago • 14 comments

Description

When I invoke telescope file browser and enter a folder with *.mov and/or *mp4 files, telescope file browser does not display them.

It sees them here: image

But when I go into that folder, no dice: image

Neovim version

NVIM v0.6.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@BigSur

Features: +acl +iconv +tui
See ":help feature-compile"

Operating system and version

macOS 11.6.2

Steps to reproduce

invoke Telescope File Browser browse to folder containing mov or mp4 files (maybe other media formats too?) note the list on the right but no proper list on the left toggling hidden makes no difference

Expected behavior

the files would be listed

Actual behavior

no files listed in main view

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          'nvim-telescope/telescope-file-browser.nvim',
        },
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup()
  require('telescope').load_extension('file_browser')
  -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]

benfrain avatar Mar 10 '22 17:03 benfrain

I've tried with both minimal_init.lua and my configuration and cannot reproduce as mp4 files are consistently shown (unfortunately I have no mov files).

Is there anything special to the files (symlinks?) or have you tried with minimal configuration?

fdschmidt93 avatar Mar 11 '22 13:03 fdschmidt93

Same problem with minimal:

image And then when I go into that folder: image

Tried this on two different systems (both running Big Sur if that makes any difference) and same result.

However, it does work on some other folders:

image

So must be something to do with those files but I'm not sure what yet!

image

benfrain avatar Mar 14 '22 09:03 benfrain

Do you have file_ignore_patterns set?

Conni2461 avatar Mar 14 '22 09:03 Conni2461

Do you have file_ignore_patterns set?

no, not to my knowledge. Would that be on a project by project basis, as some folders are showing them

benfrain avatar Mar 14 '22 13:03 benfrain

forget what i said about file_ignore_patterns doesnt even make sense. But i have another idea what might be the issue (as someone with 0 knowledge about the inner workings of this extension).

Do you have fd installed? If yes respect_gitignore is set to true: https://github.com/nvim-telescope/telescope-file-browser.nvim/blob/84efd93ec772696c1cce2aada4d39f2756953964/doc/telescope-file-browser.txt#L99-L101 and if mov files are part of the gitignore then they will not show up.

Conni2461 avatar Mar 14 '22 20:03 Conni2461

@Conni2461 yes! Not even tested yet but 99.9% sure that’s the answer!

benfrain avatar Mar 14 '22 21:03 benfrain

So what @Conni2461 suggested is the culprit. I'm not sure if the current behaviour is optimal as it shows them on one side of the viewer when a layer higher in the file browser (which is what confused me from a UI perspective) but at least I know why the existing behaviour is occuring.

Would it be preferable/possible to expose files hidden by fd respecting gitignore when toggling hidden?

Happy to close though if that is your preference.

benfrain avatar Mar 18 '22 16:03 benfrain

it shows them on one side of the viewer when a layer higher in the file browser

To make sure, do you mean the folder previewer? If so, I guess ls doesn't respect gitignore, so that's to some degree an orthogonal issue.

Would it be preferable/possible to expose files hidden by fd respecting gitignore when toggling hidden?

I guess it would make more sense to have a toggle for gitignore, no? hidden files don't need to be ignored.

There's many levels to keep in mind here as to what should be the default.

  • I'd say gitignore should ideally be respected by default, though plenary.scandir takes a strong performance hit if we do and IIRC doesn't respect global gitignore, for instance, which is why we opt-out here by default. fd on the other hand solves that well OOTB
  • plenary should also be an option as a non-dependency alternative I suppose
  • fd currently only does async finding, which is why we fall back to plenary for some of the flags (e.g. grouped) that require post-processing of found entries

I at some point had in mind to generalize some of these aspects into good interfaces

  • toggling
  • harmonization of plenary.scandir and fd flags

which would solve this and other surrounding issues I guess most elegantly.

Good PRs to tackle some of these issues would be very welcome :)

fdschmidt93 avatar Mar 18 '22 17:03 fdschmidt93

it shows them on one side of the viewer when a layer higher in the file browser

To make sure, do you mean the folder previewer? If so, I guess ls doesn't respect gitignore, so that's to some degree an orthogonal issue.

Yes, first image shows the previewer 'finding' the files but they aren't there when you go into the folder itself

benfrain avatar Mar 18 '22 17:03 benfrain

Hello everyone,

is there an option to turn off the respect_gitignore option somehow? In one of my projects I have autogenerated files being gitignored, but I sometimes want to open them. So it would be really helpful to somehow show all files regardless of the gitignore file.

nagua avatar May 16 '22 09:05 nagua

Hello everyone,

is there an option to turn off the respect_gitignore option somehow? In one of my projects I have autogenerated files being gitignored, but I sometimes want to open them. So it would be really helpful to somehow show all files regardless of the gitignore file.

Yes, you can either set respect_gitignore = false in your defaults or call file_browser with { respect_gitignore = false } as an argument.

see more

jamestrew avatar May 16 '22 21:05 jamestrew

I would like to be able to set the option in the defaults. Searching through the code I cannot find a connection from the setup config values to the respect_gitignore value. Also the documentation also only mentions the option to pass it to the file_browser function. Am I blind, or is that really the only possible way?

nagua avatar May 24 '22 10:05 nagua

Yes, you can either set respect_gitignore = false in your defaults or call file_browser with { respect_gitignore = false } as an argument.

As @jamestrew sufficiently stated, you can do this

require "telescope".setup {
  extensions = {
    file_browser = {
      respect_gitignore = false
    }
  }
}

No need to look through the code or anything. Just make sure you have appropriately understood how telescope pickers/extensions are set up. The above follows from Setup and Configuration as per below. This is in line with how telescope.nvim builtins are set up.

You can configure the telescope-file-browser like any other telescope.nvim picker. Please see :h telescope-file-browser.picker for the full set of options dedicated to the picker.

I hopefully have this now unambiguously clarified on the README with https://github.com/nvim-telescope/telescope-file-browser.nvim/commit/2ef2b05053ff0b6c2ed55d75567386f9ff507e80

fdschmidt93 avatar May 24 '22 10:05 fdschmidt93

Thank you very much! This is working very well for me. I didn't know about telescope propagating the settings into the function calls. Also the documentation looks much better now. I had hoped to find something like this before. So: I really have to thank you for your good work!

nagua avatar Jun 02 '22 08:06 nagua

Yes, you can either set respect_gitignore = false in your defaults or call file_browser with { respect_gitignore = false } as an argument.

As @jamestrew sufficiently stated, you can do this

require "telescope".setup {
  extensions = {
    file_browser = {
      respect_gitignore = false
    }
  }
}

No need to look through the code or anything. Just make sure you have appropriately understood how telescope pickers/extensions are set up. The above follows from Setup and Configuration as per below. This is in line with how telescope.nvim builtins are set up.

You can configure the telescope-file-browser like any other telescope.nvim picker. Please see :h telescope-file-browser.picker for the full set of options dedicated to the picker.

I hopefully have this now unambiguously clarified on the README with 2ef2b05

It doesn't work for me - doesn't show ignored .toml files

alloc33 avatar Feb 22 '23 02:02 alloc33

It doesn't work for me - doesn't show ignored .toml files

@xbladesub please create a new issue bug report with a minimal config and steps to reproduce if you want support with this. I can't do much to help with such little info.

jamestrew avatar Feb 22 '23 03:02 jamestrew