diff --git a/lua/hurl/split.lua b/lua/hurl/split.lua index 3b912e1..8f08e36 100644 --- a/lua/hurl/split.lua +++ b/lua/hurl/split.lua @@ -5,9 +5,6 @@ local split = Split({ relative = 'editor', position = _HURL_GLOBAL_CONFIG.split_position, size = _HURL_GLOBAL_CONFIG.split_size, - -- Create a custom filetype so that we can use https://github.com/folke/edgy.nvim to manage the window - -- E.g: { title = "Hurl Nvim", ft = "hurl-nvim" }, - buf_options = { filetype = 'hurl-nvim' }, }) local utils = require('hurl.utils') @@ -22,6 +19,15 @@ local M = {} M.show = function(data, type) -- mount/open the component split:mount() + -- If have edgy.nvim + if pcall(require, 'edgy') then + -- Create a custom filetype so that we can use https://github.com/folke/edgy.nvim to manage the window + -- E.g: { title = "Hurl Nvim", ft = "hurl-nvim" }, + vim.api.nvim_buf_set_option(split.bufnr, 'filetype', 'hurl-nvim') + end + + -- Set content to highlight, refer https://github.com/MunifTanjim/nui.nvim/issues/76#issuecomment-1001358770 + vim.api.nvim_buf_set_option(split.bufnr, 'filetype', type) if _HURL_GLOBAL_CONFIG.auto_close then -- unmount component when buffer is closed @@ -57,9 +63,6 @@ M.show = function(data, type) split:map('n', 'q', function() quit() end) - - -- Set content to highlight, refer https://github.com/MunifTanjim/nui.nvim/issues/76#issuecomment-1001358770 - vim.api.nvim_buf_set_option(split.bufnr, 'filetype', type) end M.clear = function()