执行“的base64 --de code'在VIM选择 [英] Executing 'base64 --decode' on a selection in vim
问题描述
我想在视觉模式中选择一段文字执行'的base64 --de code',但以base64命令似乎要传递整条生产线,不只是我的选择。
I'm trying to execute 'base64 --decode' on a piece of text selected in visual mode, but the base64 command seems to be passed the entire line, not just the selection I made.
我选择在可视模式文本,然后进入正常模式,这样我的命令行看起来是这样的:
I'm selecting the text in visual mode, then entering normal mode so that my command line looks like this:
:'<,'>!base64 --decode
我应该如何通过只对选定的一块线路为base64 --de code的?
How should I pass only the selected piece of the line to base64 --decode?
在此先感谢
推荐答案
如果文本传递给shell命令猛拉到寄存器(例如,
到无名寄存器),可以使用下面的命令。
If the text to pass to the shell command is yanked to a register (for example, to the unnamed register), one can use the following command.
:echo system('base64 --decode', @")
有可能选中的文本复制合并和运行命令
在使用可视模式映射的一个步骤。
It is possible to combine copying of the selected text and running the command in one step using a Visual mode mapping.
:vnoremap <leader>64 y:echo system('base64 --decode', @")<cr>
映射可修饰的输出来替代选定的文本
使用前pression寄存器shell命令。
The mapping can be modified to replace selected text with the output of the shell command using expression register.
:vnoremap <leader>64 c<c-r>=system('base64 --decode', @")<cr><esc>
这篇关于执行“的base64 --de code'在VIM选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!