Skip to content

Commit

Permalink
Set the assure_yaml_filetype back to default
Browse files Browse the repository at this point in the history
get_yaml_key_and_value does the assure_yaml_filetype functions manually
  • Loading branch information
joshzcold committed Oct 31, 2023
1 parent b67b581 commit 99243d2
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions lua/yaml_nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 99243d2

Please sign in to comment.