๐Ÿ’ YAML toolkit for Neovim users

Add function for getting just the yaml key into the winbar

get_yaml_key_and_value can be distracting with large yaml values, so
this is another option for those that might want it

+20
+9
README.md
··· 72 72 ### Showing the YAML patch and value in Neovim's winbar 73 73 74 74 ```lua 75 + -- Get yaml key 76 + vim.api.nvim_create_autocmd({ "FileType" }, { 77 + pattern = { "yaml" }, 78 + callback = function() 79 + vim.opt_local.winbar = [[%{%v:lua.require("yaml_nvim").get_yaml_key()%}]] 80 + end, 81 + }) 82 + 83 + -- Get yaml key and value 75 84 vim.api.nvim_create_autocmd({ "FileType" }, { 76 85 pattern = { "yaml" }, 77 86 callback = function()
+11
lua/yaml_nvim/init.lua
··· 71 71 return parsed.human 72 72 end 73 73 74 + M.get_yaml_key = function() 75 + local restore_to = set_yaml_as_filetype() 76 + local node = document.get_key_relevant_to_cursor() 77 + if node == nil then 78 + return 79 + end 80 + local parsed = pair.parse(node) 81 + restore_filetype(restore_to) 82 + return parsed.key 83 + end 84 + 74 85 M.yank = function(register) 75 86 assure_yaml_filetype(yank, true, true, register) 76 87 end