Closed flamendless closed 2 years ago
Do you happen to have vim polyglot installed?
No, i only have these additional plugins:
{"gpanders/editorconfig.nvim"},
{"f-person/git-blame.nvim"},
{"simnalamburt/vim-mundo"},
{"bkad/CamelCaseMotion"},
{"dewyze/vim-tada"},
Are you using nightly still? Or have you moved to using stable AstroNvim/Neovim? Also can you provide a link/paste your user config and I can try to take a look. I can't replicate on a base AstroNvim installation or my own configuration.
Are you using nightly still? Or have you moved to using stable AstroNvim/Neovim? Also can you provide a link/paste your user config and I can try to take a look. I can't replicate on a base AstroNvim installation or my own configuration.
Didn't work for stable and nightly. Now im using nightly. Here's the link to my config https://github.com/flamendless/AstroVim/tree/main/lua/user the init_backup.lua
is the previous config that works before me updating
According to :help vim.filetype.add()
it looks like a function should return the string that it should set as the filetype. So I think it should be something like this:
--also in polish
vim.filetype.add {
extensions = {
lua = function()
require("user.love").SetLove()
return "lua"
end,
lua2p = function()
require("user.love").SetLua2p()
return "lua"
end
}
}
Have you checked the docs and tried something like this to follow what they describe?
The filetype can be either a string (in which case it is used as the filetype directly) or a function. If a function, it takes the full path and buffer number of the file as arguments (along with captures from the matched pattern, if any) and should return a string that will be used as the buffer's filetype.
I've tried that, didn't work. whats confusing is that the previous config (even if not in polish function) worked.
i think the code is not ran, after opening a lua2p file and doing :set filetype?
i get filetype=
only
It should go in the polish
function since neovim 0.7 has moved filetype.lua
to core Neovim. So this is no longer a plugin. I also just noticed your blunder in your polish
function. Give this a try:
--also in polish
vim.filetype.add {
extensions = {
lua = function()
require("user.love").SetLove()
return "lua"
end,
lua2p = function()
require("user.love").SetLua2p()
return "lua"
end
}
}
Ahhh i missed that function call instead of assignment in vim.filetype.add
, Ive tried that (ive pushed my config) but it still didnt work :/
I also just noticed in the :help vim.filetype.add
that it is extension
not extensions
. After that your config works for me.
--also in polish
vim.filetype.add {
extension = {
lua = function()
require("user.love").SetLove()
return "lua"
end,
lua2p = function()
require("user.love").SetLua2p()
return "lua"
end
}
}
Awesome. works now. now i need to turn off lua lsp for lua2p files
do you just want to not change the filetype to lua
like you had before? Just return lua2p
or something instead of lua
if i do that i dont get any syntax highlighting anymore. basically what im aiming for is lua syntax highlight but no lsp since it has custom tokens so the lsp will complain alot
Interesting, good luck haha I'm not sure of a good way to do that.
Finally figured it out by accident, i removed the return "lua"
and return "lua2p"
and it works
Hi, previous I have this in my config:
which adds syntax highlighting to my custom extension, but after updating to the latest astrovim config it does not work anymore, I also tried moving that to the
polish
function and: