refactor: Move should refresh logic to utils

This commit is contained in:
simrat39
2021-08-22 17:29:29 -07:00
parent fae3393873
commit 6f376ef4ce
2 changed files with 11 additions and 3 deletions

View File

@@ -8,7 +8,16 @@ function M.is_buf_attached_to_lsp(bufnr)
end
function M.is_buf_markdown(bufnr)
return vim.api.nvim_buf_get_option(bufnr, 'ft') == 'markdown'
return vim.api.nvim_buf_get_option(bufnr, 'ft') == 'markdown'
end
---@param bufnr number
---@return boolean
function M.should_not_refresh(bufnr)
if (not M.is_buf_markdown(bufnr)) and (not M.is_buf_attached_to_lsp(bufnr)) then
return true
end
return false
end
return M