diff options
| author | kongjun <kongjun18@outlook.com> | 2025-04-29 06:51:01 +0000 |
|---|---|---|
| committer | kongjun <kongjun18@outlook.com> | 2025-04-29 06:59:38 +0000 |
| commit | 872632670c31f682f3db01707468dbc12f154ab4 (patch) | |
| tree | f8e75de6fa3dddc291a0a3c239e2dc616d256a8f /lua/encrypt/helpers.lua | |
| parent | e6057b3c13f004477f4963f3cdf054e5ca1bf2f4 (diff) | |
| download | encrypt.nvim-872632670c31f682f3db01707468dbc12f154ab4.tar.gz | |
feat: :X decrypts or encrypts files
Diffstat (limited to 'lua/encrypt/helpers.lua')
| -rw-r--r-- | lua/encrypt/helpers.lua | 14 |
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, +} |
