At the moment, I use Astronvim as my NeoVim configuration.
By default, key mappings for it are configured in ~/.config/nvim/lua/user/mappings.lua
file.
The following snippet adds key mappings for inplace encoding and decoding base64 strings:
1
2
3
4
5
6
7
8
9
| return {
...
v = { -- Visual mode mappings
...
["<leader>64e"] = { "c<c-r>=system('base64 --wrap=0', @\")<cr><esc>", desc = "Base64 encode" },
["<leader>64d"] = { "c<c-r>=system('base64 --wrap=0 --decode', @\")<cr><esc>", desc = "Base64 decode" },
},
...
}
|
In the past I was using vanilla NeoVim and Vim, so I had the following lines in my ~/.config/nvim/init.vim
:
1
2
| vnoremap <leader>64e c<c-r>=system('base64 --wrap=0', @")<cr><esc>
vnoremap <leader>64d c<c-r>=system('base64 --wrap=0 --decode', @")<cr><esc>
|