Closed weizheheng closed 3 years ago
Are you sure it loses filetype? It might be that you have treesitter enabled but not activated for the language of the file? Unsure.
@marcushwz can you try again now?
@camspiers , Hi, thanks for the reply. I can confirm it's working now.
This is still an issue for me pretty frequently. Unfortunately I haven't managed to consistently reproduce it. It seems like neither the filetype
or syntax
options are set.
I've tried tweaking the commands used to open the file, but I'm still running into the issue.
diff --git a/lua/snap/select/file.lua b/lua/snap/select/file.lua
index 9ada17d..c0ef93d 100644
--- a/lua/snap/select/file.lua
+++ b/lua/snap/select/file.lua
@@ -51,17 +51,21 @@ do
local _3_ = type
if (_3_ == nil) then
if (winnr ~= false) then
- return vim.api.nvim_win_set_buf(winnr, buffer)
+ vim.api.nvim_command("buffer" .. buffer)
end
elseif (_3_ == "vsplit") then
- vim.api.nvim_command("vsplit")
- return vim.api.nvim_win_set_buf(0, buffer)
+ vim.api.nvim_command("vert sbuffer" .. buffer)
elseif (_3_ == "split") then
- vim.api.nvim_command("split")
- return vim.api.nvim_win_set_buf(0, buffer)
+ vim.api.nvim_command("sbuffer" .. buffer)
elseif (_3_ == "tab") then
- vim.api.nvim_command("tabnew")
- return vim.api.nvim_win_set_buf(0, buffer)
+ vim.api.nvim_command("tab sbuffer" .. buffer)
end
end
v_0_0 = select0
Hi, thank you for this plugin, I tried to play around with it, managed to install it through
vim-plug
. However, I am facing this issue where the file loses the filetype hence the syntax highlighting when I open the file through snap. I have this in my config: