···55| Command | Description |
66|:--|:--|
77| `:YAMLView` | Shows the full path and value of the current key/value pair |
88-| `:YAMLYank` | Yanks the full path and value of the current key/value pair |
99-| `:YAMLYankKey` | Yanks the full path of the key for the current key/value pair |
1010-| `:YAMLYankValue` | Yanks the value of the current key/value pair |
88+| `:YAMLYank [register]` | Yanks the full path and value of the current key/value pair. The default register is the unnamed one (`"`) |
99+| `:YAMLYankKey [register]` | Yanks the full path of the key for the current key/value pair. The default register is the unnamed one (`"`) |
1010+| `:YAMLYankValue [regster]` | Yanks the value of the current key/value pair. The default register is the unnamed one (`"`) |
1111| `:YAMLQuickfix` | Generates a quickfix with key/balue pairs |
1212| `:YAMLTelescope` | Full path key/value fuzzy finder via [Telescope](https://github.com/nvim-telescope/telescope.nvim) **if installed** |
1313-1414-By now, it only uses to unnamed register to yank ([**TODO** allow users to choose which register to yank to](https://github.com/cuducos/yaml.nvim/issues/6)).
15131614
1715
+15-10
doc/help.txt
···1414 `root.parent.child.key = value`). It uses Lua's `print` function to output
1515 the value to the user.
16161717-:YAMLYank *:YAMLYank*
1717+:YAMLYank [register] *:YAMLYank*
18181919 Yanks the full path and value of the key/value pair under the cursor to
2020- the unnamed register (see |:quotequote|). It collects all nested keys and
2121- outputs them as a dot-case string (e.g.: `root.parent.child.key =
2222- value`).
2020+ the selected register. The default register is the unnamed one (see
2121+ |:quotequote|).
2222+2323+ It collects all nested keys and outputs them as a dot-case string (e.g.:
2424+ `root.parent.child.key = value`).
23252424-:YAMLYankKey *:YAMLYankKey*
2626+:YAMLYankKey [register] *:YAMLYankKey*
25272628 Yanks the full path of the key of the key/value pair under the cursor to
2727- the unnamed register (see |:quotequote|). It collects all nested keys and
2828- outputs them as a dot-case string (e.g.: `root.parent.child.key`).
2929+ the selected register. The default register is the unnamed one (see
3030+ |:quotequote|).
29313030-:YAMLYankValue *:YAMLYankValue*
3232+ It collects all nested keys and outputs them as a dot-case string (e.g.:
3333+ `root.parent.child.key`).
31343232- Yanks the value of the key/value pair under the cursor to the unnamed
3333- register (see |:quotequote|).
3535+:YAMLYankValue [register] *:YAMLYankValue*
3636+3737+ Yanks the value of the key/value pair under the cursor to the selected
3838+ register. The default register is the unnamed one (see |:quotequote|).
34393540:YAMLQuickfix *YAMLQuickfix*
3641
+31-14
lua/yaml_nvim/init.lua
···1616 return lines
1717end
18181919-M.view = function()
2020- local node = document.get_key_relevant_to_cursor()
2121- if node == nil then
2222- return
2323- end
2424-2525- local parsed = pair.parse(node)
2626- print(parsed.human)
2727-end
2828-2929-M.yank = function(register, key, value)
1919+local yank = function(key, value, register)
2020+ register = register or [["]]
3021 if not key and not value then
3122 return
3223 end
···5041 vim.cmd(string.format("call setreg('%s', '%s')", register, contents))
5142end
52434444+M.view = function()
4545+ local node = document.get_key_relevant_to_cursor()
4646+ if node == nil then
4747+ return
4848+ end
4949+5050+ local parsed = pair.parse(node)
5151+ print(parsed.human)
5252+end
5353+5454+M.yank_all = function(register)
5555+ yank(true, true, register)
5656+end
5757+5858+M.yank_key = function(register)
5959+ yank(true, false, register)
6060+end
6161+6262+M.yank_value = function(register)
6363+ yank(false, true, register)
6464+end
6565+5366M.telescope = function()
5467 if not has_telescope then
5568 return
···5972end
60736174vim.cmd("command! YAMLView lua require('yaml_nvim').view()")
6262-vim.cmd("command! YAMLYank lua require('yaml_nvim').yank('\"', true, true)")
6363-vim.cmd("command! YAMLYankKey lua require('yaml_nvim').yank('\"', true, false)")
6475vim.cmd(
6565- "command! YAMLYankValue lua require('yaml_nvim').yank('\"', false, true)"
7676+ "command! -nargs=? YAMLYank lua require('yaml_nvim').yank_all(<f-args>)"
7777+)
7878+vim.cmd(
7979+ "command! -nargs=? YAMLYankKey lua require('yaml_nvim').yank_key(<f-args>)"
8080+)
8181+vim.cmd(
8282+ "command! -nargs=? YAMLYankValue lua require('yaml_nvim').yank_value(<f-args>)"
6683)
6784vim.cmd("command! YAMLQuickfix cex v:lua.create_yaml_quickfix()")
6885