我正在尝试使用fzf在 vimscript 中创建目录搜索和替换功能。我阻止的地方是尝试使用Alt-a
fzf 绑定来选择整个列表时。我什至不确定这是否可能,因为 fzf 是一个外部进程,但我可能错了。
这是我当前的功能。
function! CWDSearchAndReplace()
" Try to get word under cursor else prompt user for a word
let wordToReplace = expand("<cword>")
if wordToReplace == ""
call inputsave()
let wordToReplace = input("Replace: ")
call inputrestore()
endif
" Prompt for replacement
call inputsave()
let replacement = input("Replace \"" . wordToReplace . "\" with: ")
call inputrestore()
execute "Ag " . wordToReplace
" =====> Here I'd like to execute Alt-a followed by <CR>
execute "cdo %s//" . replacement . "/gc"
end function
谢谢你的帮助!