Open nowaylifer opened 5 days ago
Will do! I'll try and have this done by my end of day today
I just pushed a commit to main (776c970bed5539207bbee0880b7ca4df7b826d06) that implements this feature. Please try it out and let me know what you think!
Works good! But getting this error when either filetypes
or buftypes
is omitted in config, has to manually put empty table to solve it:
Failed to run `config` for visual-whitespace.nvim
...im/lazy/visual-whitespace.nvim/lua/visual-whitespace.lua:204: attempt to get length of field 'buftypes' (a nil value)
# stacktrace:
- /visual-whitespace.nvim/lua/visual-whitespace.lua:204 _in_ **setup**
- lua/plugins/extras/ui/visual-whitespace.lua:13 _in_ **config**
- vim/_editor.lua:0 _in_ **cmd**
- /persistence.nvim/lua/persistence/init.lua:88 _in_ **load**
- lua/:1
- vim/_editor.lua:0 _in_ **cmd**
- /dashboard-nvim/lua/dashboard/theme/doom.lua:24
excluded = {
filetypes = {},
buftypes = { "quickfix", "terminal", "nofile" },
},
Also it seems that excluded "nofile" buftype breaks file buffer as well
Works good! But getting this error when either
filetypes
orbuftypes
is omitted in config, has to manually put empty table to solve it:
Tbh I don't really know why this is happening. I'm not experiencing this error. I don't provided the excluded
table in my config. Can you provide the version of nvim you're using?
I can confirm nofile
breaks the plugin. I will work on that.
Tbh I don't really know why this is happening. I'm not experiencing this error. I don't provided the
excluded
table in my config. Can you provide the version of nvim you're using?
I use v0.10.2. It's reproducible with this config. Try nvim --clean -u repro.lua
, there'll be error. Then uncomment filetypes = {}
, error is gone.
-- repro.lua
local install_path = "tmp/nvim/site/visual-whitespace"
vim.fn.system({
"git",
"clone",
"--depth=1",
"https://github.com/mcauley-penney/visual-whitespace.nvim.git",
install_path,
})
vim.o.runtimepath = install_path .. "," .. vim.o.runtimepath
require("visual-whitespace").setup({
excluded = {
buftypes = { "terminal" },
-- filetypes = {},
},
})
Okay, so, the likely reason that the nofile
issue is happening is because some buffer, perhaps a dashboard or another automatically opening plugin, is setting nofile
and visual-whitespace is not checking again in the right way. I can get this with opening aerial automatically.
I have to find the right group of autocommands, or some other means of checking the file and buf types.
It's reproducible with this config. Try nvim --clean -u repro.lua, there'll be error. Then uncomment filetypes = {}, error is gone.
Yes, this reproduces it for me. I think its just a nil check that I'm missing.
@nowaylifer Okay, I think I've solved the config issue and I may have solved the nofile issue. Please try it out and let me know what you think.
Yes, both issues are solved on my side. But it seems other buftypes exclusions apart from nofile stopped to work (at least quickfix, terminal and help that I checked)
No, actually "nofile" also doesn't work
Yeah, this is nasty and I don't know why. I figured it would be easy to implement this via autocommands but it's really not. I feel like I'm missing something super obvious.
Anyway, I'm still working on it.
@nowaylifer I've moved the work on this feature over to branch exclude
and reverted them on main
. In my personal projects, I have a bad habit of just pushing to main instead of working off of feature branches. So, I will be working on this when I can over there.
@nowaylifer Please check out the exclude
branch. With some help, I think I found at least a starting place for solving this neatly.
I'd like to disable the plugin in certain buffers depending on filetype or buftype: