diff --git a/docs/setup.md b/docs/setup.md index 9b29e8509c..54fafad385 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -271,18 +271,20 @@ If `$GOPATH/bin` is in your `$PATH`, you can now run `gopass` from anywhere on y ### Securing Your Editor -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. - -For `vim` on Linux, the following setting may be helpful: - -``` -au BufNewFile,BufRead /dev/shm/gopass.* setlocal noswapfile nobackup noundofile -``` - -For MacOS consider this setting: - -``` -au BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile +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. + +Here are a few useuful example settings: + +```vim +" neovim on Linux +autocmd BufNewFile,BufRead /dev/shm/gopass* setlocal noswapfile nobackup noundofile shada="" +" neovim on MacOS +autocmd BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile shada="" +" vim on Linux +autocmd BufNewFile,BufRead /dev/shm/gopass* setlocal noswapfile nobackup noundofile viminfo="" +" vim on MacOS +autocmd BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile viminfo="" ``` ### Migrating from pass to gopass diff --git a/internal/editor/editor.go b/internal/editor/editor.go index e20e50e8fb..3a9cb38c93 100644 --- a/internal/editor/editor.go +++ b/internal/editor/editor.go @@ -28,7 +28,7 @@ var ( Stdout io.Writer = os.Stdout // Stderr is exported for tests. Stderr io.Writer = os.Stderr - vimOptsRe = regexp.MustCompile(`au\s+BufNewFile,BufRead\s+.*gopass.*setlocal\s+noswapfile\s+nobackup\s+noundofile`) + vimOptsRe = regexp.MustCompile(`au(tocmd)?\s+BufNewFile,BufRead\s+.*gopass.*setlocal\s+noswapfile\s+nobackup\s+noundofile\s+viminfo=`) ) // Check will validate the editor config.