๐Ÿ’ YAML toolkit for Neovim users

Merge pull request #25 from joshzcold/main

Add function to return the path, to be added to the winbar. Like jsonpath.nvim

authored by

Eduardo Cuducos and committed by
GitHub
b642efd9 400b2edb

+24 -8
+13
README.md
··· 67 67 Plug 'cuducos/yaml.nvim' 68 68 ``` 69 69 70 + ## Configuration 71 + 72 + ### Showing the YAML patch and value in Neovim's winbar 73 + 74 + ```lua 75 + vim.api.nvim_create_autocmd({ "FileType" }, { 76 + pattern = { "yaml" }, 77 + callback = function() 78 + vim.opt_local.winbar = [[%{%v:lua.require("yaml_nvim").get_yaml_key_and_value()%}]] 79 + end, 80 + }) 81 + ``` 82 + 70 83 ## Reporting bugs and contributing 71 84 72 85 There is a mini toolchain to help you test the plugin in isolation using a container. It requires:
+11 -8
lua/yaml_nvim/init.lua
··· 57 57 end 58 58 59 59 M.view = function() 60 - assure_yaml_filetype(function() 61 - local node = document.get_key_relevant_to_cursor() 62 - if node == nil then 63 - return 64 - end 60 + vim.notify(M.get_yaml_key_and_value()) 61 + end 65 62 66 - local parsed = pair.parse(node) 67 - vim.notify(parsed.human) 68 - end) 63 + M.get_yaml_key_and_value = function() 64 + local restore_to = set_yaml_as_filetype() 65 + local node = document.get_key_relevant_to_cursor() 66 + if node == nil then 67 + return 68 + end 69 + local parsed = pair.parse(node) 70 + restore_filetype(restore_to) 71 + return parsed.human 69 72 end 70 73 71 74 M.yank = function(register)