.config/nvim/plugin/gpg-encrypted.lua

Mon, 26 Aug 2024 14:23:43 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 26 Aug 2024 14:23:43 -0500
changeset 1177
93b5d2db30bc
parent 1166
34bf03fa07e4
permissions
-rw-r--r--

more gopls config. add inlay hint toggle

1085
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 local util = require("config.util")
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 local safe_filter_file = util.safe_filter_file
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 local g = vim.api.nvim_create_augroup("encrypted", { clear = true })
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 local filepattern = { "*.gpg", "*.gpg.*" }
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 local function autocmd(event, opts)
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 util.autocmd(g, event, filepattern, opts)
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 end
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11
1166
34bf03fa07e4 normalize config.util.autocmd
Meredith Howard <mhoward@roomag.org>
parents: 1160
diff changeset
12 autocmd({ "BufReadPre", "FileReadPre" }, [[ setl noswapfile noundofile nobackup shada= ]])
1085
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 autocmd("BufReadPost", function(_)
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 safe_filter_file("gpg -d")
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 end)
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 autocmd("BufWritePre", function(_)
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19 safe_filter_file("gpg -se -a --default-recipient-self")
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 end)
c2d11f022cf0 Port encrypted file edit to lua
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21
1166
34bf03fa07e4 normalize config.util.autocmd
Meredith Howard <mhoward@roomag.org>
parents: 1160
diff changeset
22 autocmd("BufWritePost", [[ silent undo ]])

mercurial