Skip to content

Instantly share code, notes, and snippets.

@towolf
Created January 5, 2021 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save towolf/d6bb04da55302ad2c452e47ee73c1b1a to your computer and use it in GitHub Desktop.
Save towolf/d6bb04da55302ad2c452e47ee73c1b1a to your computer and use it in GitHub Desktop.
.vim/after/plugin/unimpaired.vim
" Put into .vim/after/plugin/unimpaired.vim
function! B64_encode(str) abort
return substitute(system('base64', a:str),'\n','','g')
endfunction
function! B64_decode(str) abort
return system('base64 --decode', a:str)
endfunction
call UnimpairedMapTransform('B64_encode','[b')
call UnimpairedMapTransform('B64_decode',']b')
nmap [b <Plug>unimpaired_B64_encode
xmap [b <Plug>unimpaired_B64_encode
nmap ]b <Plug>unimpaired_B64_decode
xmap ]b <Plug>unimpaired_B64_decode
@towolf
Copy link
Author

towolf commented Jan 5, 2021

Last 4 lines are due to tpope messing up: tpope/vim-unimpaired#207 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment