Created
January 5, 2021 15:25
-
-
Save towolf/d6bb04da55302ad2c452e47ee73c1b1a to your computer and use it in GitHub Desktop.
.vim/after/plugin/unimpaired.vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Last 4 lines are due to tpope messing up: tpope/vim-unimpaired#207 (comment)