home.social

#justvimthings — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #justvimthings, aggregated by home.social.

fetched live
  1. #JustVimThings : repeatedly mashing the ESC button to give your brain a couple of extra milliseconds to plan out your next move and to be extra sure your are back in command mode.

    #linux #vim

  2. CW: re: emacs :(

    @cadadr @ljwrites Said hack, since there may be interest:

    " Transparent editing of gpg encrypted files.
    " By Wouter Hanegraaff <[email protected]>
    augroup encrypted
    au!

    " First make sure nothing is written to ~/.viminfo while editing
    " an encrypted file.
    autocmd BufReadPre,FileReadPre *.asc set viminfo=
    " We don't want a swap file, as it writes unencrypted data to disk
    autocmd BufReadPre,FileReadPre *.asc set noswapfile
    " Switch to binary mode to read the encrypted file
    autocmd BufReadPre,FileReadPre *.asc set bin
    autocmd BufReadPre,FileReadPre *.asc let ch_save = &ch|set ch=2
    autocmd BufReadPost,FileReadPost *.asc '[,']!gpg --decrypt 2> /dev/null
    " Switch to normal mode for editing
    autocmd BufReadPost,FileReadPost *.asc set nobin
    autocmd BufReadPost,FileReadPost *.asc let &ch = ch_save|unlet ch_save
    autocmd BufReadPost,FileReadPost *.asc execute ":doautocmd BufReadPost " . expand("%:r")

    " Convert all text to encrypted text before writing
    autocmd BufWritePre,FileWritePre *.asc '[,']!gpg --default-recipient-self -ae 2>/dev/null
    " Undo the encryption so we are back in the normal text, directly
    " after the file has been written.
    autocmd BufWritePost,FileWritePost *.asc u
    augroup END

    #vim #vi #JustVimThings #gpg #pgp #vimrc #WouterHanegraaff