From 99243d2ae157629ffb4cbc82cd29fe95916fdd68 Mon Sep 17 00:00:00 2001 From: Joshua Cold Date: Tue, 31 Oct 2023 09:57:26 -0600 Subject: [PATCH] Set the assure_yaml_filetype back to default get_yaml_key_and_value does the assure_yaml_filetype functions manually --- lua/yaml_nvim/init.lua | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lua/yaml_nvim/init.lua b/lua/yaml_nvim/init.lua index 60bb774..ef28a0e 100644 --- a/lua/yaml_nvim/init.lua +++ b/lua/yaml_nvim/init.lua @@ -24,10 +24,9 @@ end local assure_yaml_filetype = function(func, ...) local restore_to = set_yaml_as_filetype() - local out = func(...) + func(...) restore_filetype(restore_to) - return out end local yank = function(key, value, register) @@ -62,16 +61,14 @@ M.view = function() end M.get_yaml_key_and_value = function() - local out = assure_yaml_filetype(function() - local node = document.get_key_relevant_to_cursor() - if node == nil then - return - end - - local parsed = pair.parse(node) - return parsed.human - end) - return out + local restore_to = set_yaml_as_filetype() + local node = document.get_key_relevant_to_cursor() + if node == nil then + return + end + local parsed = pair.parse(node) + restore_filetype(restore_to) + return parsed.human end M.yank = function(register)