-
-
Notifications
You must be signed in to change notification settings - Fork 15
no-name buffer winbar #33
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
Conversation
Nice, I love that! Let me just share a bit of my thoughts on the docs in the My point is: I try to keep the examples in the docs as simple as possible. Beginners feel oh, that simple? nice!, while more experienced users probably would know how to use those building blocks to take that to another level. And I am not saying I get that all the time, this is just my mindset, what I try to do. So, reading your PR I feel like this This way we could have a simpler |
oh yeah, whoops - yep, makes sense to me. |
Thnk you so much : ) |
hey @cuducos since I'm back at work, I actually used this in my workflow for a bit and noticed it's a little goofy and not as robust as it needs to be. Only on So given this goofy side-effect, maybe you want to revert this PR. Here's the more involved config to make it truly work as I intended: vim.api.nvim_create_autocmd({ "BufEnter", "FileType" }, {
group = vim.api.nvim_create_augroup("bufent_winbar", { clear = true }),
callback = function(opts)
-- https://github.com/cuducos/yaml.nvim
if vim.bo[opts.buf].filetype == "yaml" then
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
group = vim.api.nvim_create_augroup("curs_winbar", { clear = true }),
callback = function()
vim.opt_local.winbar = "." .. (require("yaml_nvim").get_yaml_key() or "")
end,
})
-- https://github.com/phelipetls/jsonpath.nvim
elseif vim.bo[opts.buf].filetype == "json" then
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
group = vim.api.nvim_create_augroup("curs_winbar", { clear = true }),
callback = function()
vim.opt_local.winbar = "." .. (require("jsonpath").get():sub(2) or "")
end,
})
else
vim.opt_local.winbar = ""
vim.api.nvim_create_augroup("curs_winbar", { clear = true })
end
end,
}) On every Happy to open another PR w/ something like below, if you'd like. vim.api.nvim_create_autocmd({ "BufEnter", "FileType" }, {
group = vim.api.nvim_create_augroup("bufent_winbar", { clear = true }),
callback = function(opts)
if vim.bo[opts.buf].filetype == "yaml" then
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
group = vim.api.nvim_create_augroup("curs_winbar", { clear = true }),
callback = function()
vim.opt_local.winbar = require("yaml_nvim").get_yaml_key_and_value()
end,
})
else
vim.opt_local.winbar = ""
vim.api.nvim_create_augroup("curs_winbar", { clear = true })
end
end,
}) |
Ah, got it! I'll sort that out, but feel free to edit later to enhance it! |
Thanks @treatmesubj : ) Also, see #33
It's nice to have a winbar for no-name buffers, such as when you pipe stdout to nvim like
kubectl get pod worker-0 -o yaml | nvim -c "set ft=yaml"