Skip to content

Commit 602363e

Browse files
author
Stefan Gehr
committed
Correct (neo)vim settings
The previous recommended vim settings still allowed data to leak into the .viminfo file For Linux even the matching path was wrong which means that the (insufficient) rules were not even used. RELEASE_NOTES=[DOCUMENTATION] fix in recommended vim setting Signed-off-by: Stefan Gehr <[email protected]>
1 parent 4ff8832 commit 602363e

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

docs/setup.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -271,18 +271,20 @@ If `$GOPATH/bin` is in your `$PATH`, you can now run `gopass` from anywhere on y
271271

272272
### Securing Your Editor
273273

274-
Various editors may store temporary files outside of the secure working directory when editing secrets. We advise you to check and disable this behavior for your editor of choice.
275-
276-
For `vim` on Linux, the following setting may be helpful:
277-
278-
```
279-
au BufNewFile,BufRead /dev/shm/gopass.* setlocal noswapfile nobackup noundofile
280-
```
281-
282-
For MacOS consider this setting:
283-
284-
```
285-
au BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile
274+
Various editors may store temporary files outside of the secure working directory when editing secrets.
275+
We advise you to check and disable this behavior for your editor of choice.
276+
277+
Here are a few useuful example settings:
278+
279+
```vim
280+
" neovim on Linux
281+
autocmd BufNewFile,BufRead /dev/shm/gopass* setlocal noswapfile nobackup noundofile shada=""
282+
" neovim on MacOS
283+
autocmd BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile shada=""
284+
" vim on Linux
285+
autocmd BufNewFile,BufRead /dev/shm/gopass* setlocal noswapfile nobackup noundofile viminfo=""
286+
" vim on MacOS
287+
autocmd BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile viminfo=""
286288
```
287289

288290
### Migrating from pass to gopass

internal/editor/editor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var (
2828
Stdout io.Writer = os.Stdout
2929
// Stderr is exported for tests.
3030
Stderr io.Writer = os.Stderr
31-
vimOptsRe = regexp.MustCompile(`au\s+BufNewFile,BufRead\s+.*gopass.*setlocal\s+noswapfile\s+nobackup\s+noundofile`)
31+
vimOptsRe = regexp.MustCompile(`au(tocmd)?\s+BufNewFile,BufRead\s+.*gopass.*setlocal\s+noswapfile\s+nobackup\s+noundofile\s+viminfo=`)
3232
)
3333

3434
// Check will validate the editor config.

0 commit comments

Comments
 (0)