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

Support for hidden files #90

Closed
robdimsdale opened this issue May 29, 2022 · 4 comments
Closed

Support for hidden files #90

robdimsdale opened this issue May 29, 2022 · 4 comments

Comments

@robdimsdale
Copy link

I often find myself working with hidden files and directories, and I would like to be able to see them in lir and search in them via fzf.

To do this is fairly simple:

LIR config:

require('lir').setup {
  show_hidden_files = true,
}

FZF config:

vim.env.FZF_DEFAULT_COMMAND = 'fd --hidden --exclude={.git,.idea,.vscode,.sass-cache,node_modules,build} --type f'

However, when i set these in after.lua neither setting is respected. I have to manually edit the lir.lua and fzf.lua files to get these settings to stick.

First question: is there a way I can configure this behavior today? Am I missing something?

Second question: assuming this is not configurable, would you be open to adding support for it? I think the default behavior should still be to ignore hidden files but I'd like a way to enable these settings. I'd expect some sort of global setting in before.lua called include_hidden_files or similar.

Thoughts?

@luan
Copy link
Owner

luan commented May 29, 2022

I'm not entirely sure why this is yet, but I might go and do some research about it and try to make it so it's not necessary.

But the plugin configs are invoked lazily, which ends up happening after after.lua at runtime. If you put these configs in a vim.schedule block they will happen after configs.

vim.schedule(function()
  vim.env.FZF_DEFAULT_COMMAND = 'fd --hidden --exclude={.git,.idea,.vscode,.sass-cache,node_modules,build} --type f'
  require('lir').setup {
    show_hidden_files = true,
  }
end)

I'll investigate a bit later and depending on what I find I'll make it so after.lua is lodaded like this, but in general I'll try to make it load objectively after the plugin configs, as is the expectation for a script called "after" 📦
But the above should unblock you.


By the way, for LIR you can hit . while LIR is up, and it'll toggle hidden files on the fly. FZF we have no such luxury that I know of.

@robdimsdale
Copy link
Author

Thanks for the quick reply. I'd appreciate a way of making after.lua work in this situation, as I agree it is more intuitive.

The suggestion of vim.schedule(function() ... ) works for fzf but unfortunately does not work for lir. It renders it unusable. Specifically, it causes nvim to stop responding to keystops once lir is loaded via - and the . key is pressed. And opening the current working directory with nvim . does not show hidden files, and then entering . once breaks the coloring (and doesn't show hidden files), and entering it twice results in a lua error:

E5108: Error executing lua ...vim/site/pack/packer/start/lir.nvim/lua/lir/mappings.lua:59: attempt to index a nil value
stack traceback:
        ...vim/site/pack/packer/start/lir.nvim/lua/lir/mappings.lua:59: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk
Press ENTER or type command to continue

By the way, for LIR you can hit . while LIR is up, and it'll toggle hidden files on the fly. FZF we have no such luxury that I know of.

Nice. I didn't see that before. Now I see the config for this setting.

So, given that, I can use your vim.schedule suggestion for fzf and rely on the default config of . for lir. If you don't get round to fixing this, I'm still unblocked.

@luan
Copy link
Owner

luan commented Aug 4, 2022

FYI I made the execute decision to show hidden files by default :P

@robdimsdale
Copy link
Author

Great, thanks. I'll close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants