aboutsummaryrefslogtreecommitdiff
path: root/lua/encrypt/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/encrypt/helpers.lua')
-rw-r--r--lua/encrypt/helpers.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/lua/encrypt/helpers.lua b/lua/encrypt/helpers.lua
index a2ccc51..b740f28 100644
--- a/lua/encrypt/helpers.lua
+++ b/lua/encrypt/helpers.lua
@@ -21,4 +21,16 @@ local BUFTYPE = {
plaintext = 2,
}
-return { getPassword = getPassword, ENCRYPTED_PREFIX = ENCRYPTED_PREFIX, BUFTYPE = BUFTYPE}
+local function bufferEncrypted()
+ local first_line = vim.api.nvim_buf_get_lines(0, 0, 1, false)[1]
+ if first_line == ENCRYPTED_PREFIX then
+ return true
+ end
+end
+
+return {
+ getPassword = getPassword,
+ ENCRYPTED_PREFIX = ENCRYPTED_PREFIX,
+ BUFTYPE = BUFTYPE,
+ bufferEncrypted = bufferEncrypted,
+}