apple / pkl-neovim

Pkl language support for Neovim
https://pkl-lang.org/neovim/current/index.html
Apache License 2.0
144 stars 14 forks source link

Add option to disable setting foldmethod in ftplugin/pkl.vim #4

Closed endoze closed 8 months ago

endoze commented 9 months ago

Currently when I open a pkl file, nearly the entire contents are code folded and invisible. This is not a great user experience and not what I expect to occur when loading up a file.

Screenshot 2024-02-09 at 7 18 25 PM

This particular line overwrites my global foldmethod=manual. While I could use an autocmd like the following to undo this, I'd much prefer this to not be the default or at least customizable so I can ensure it respects my preferred foldmethod.

vim.api.nvim_create_autocmd("FileType", {
  pattern = "pkl",
  callback = function()
    vim.opt.foldmethod = "manual"
  end,
})

Most ftplugin scripts use some sort of boolean flag to determine if they've already been run on the current buffer. It would be nice if this plugin did not change my defaults (even if only for pkl files), I think that's the best solution. If it's absolutely necessary to default to code folding like this for the plugin, then allowing this to be configurable would be the next best option.

bioball commented 8 months ago

This was addressed by getting rid of the foldmethod=expr setting in #7

People can still set this in their own vim config, but yeah; it wasn't great that it was causing folding zones to be automatically collapsed when opening a new file.

endoze commented 8 months ago

@bioball Thank you very much for this change! I know it's fairly trivial to fix it on my end, but when every plugin I install decides to tweak things for me I end up with a crazy amount of workarounds to undo it all 😄.