-
-
Notifications
You must be signed in to change notification settings - Fork 380
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
vim.opt_local in ftplugin is not set correctly when opening files using harpoon #626
Comments
This happens with any code that you write that is specific to filetypes. Even when I use autocmds for filetypes, navigating to a file using harpoon (either with the gui or |
I see, Is there any way arround this, such as specify a callback function when switching files using Harpoon? |
I couldn't find a way around it. I went back to old harpoon since it doesn't have this issue. |
If you don't mind a band-aid job, you can have an autocmd source your ftplugin files without much pain. vim.api.nvim_create_autocmd({ "BufEnter" }, {
desc = "Source ftplugin/$1.lua to override Issue #626",
group = vim.api.nvim_create_augroup("Harpoon_Optlocal", { clear = true }),
callback = function()
local ft = vim.bo.filetype
vim.cmd("silent! source $XDG_CONFIG_HOME/nvim/after/ftplugin/" .. ft .. ".lua")
end,
}) |
I tried using it, unfortunately this does not work for me. I will make a minimal repro config with harpoon only to make sure it's some weirdness with my hacky config. |
One possible issue, which I came across is that $XDG_CONFIG_HOME is not defined for my specific environment on macos. Once I explicitly wrote the config path into the code snippet, it works as expected. Have you tried to check that the path of the file is correct? Here's the snippet of my config with the fixed path: vim.api.nvim_create_autocmd({ "BufEnter" }, {
desc = "Source ftplugin/$1.lua to override Issue #626",
group = vim.api.nvim_create_augroup("Harpoon_Optlocal", { clear = true }),
callback = function()
local ft = vim.bo.filetype
vim.cmd("silent! source ~/.config/nvim/after/ftplugin/" .. ft .. ".lua")
end,
}) |
I use
ftpluign/markdown.md
to set text wrap to true when opening a markdown file. It works as expected. However, when openning markdown file for the first time on startup using harpoon, text wrap is not set to true.here is my config
The text was updated successfully, but these errors were encountered: