Add ALT-ENTER to paste selected items into the buffer

- New fzf#vim#paste inserts selections instead of opening them
  - First item after cursor (space-padded), rest on following lines
  - Leading whitespace stripped only when pasting after text
- Commands opt in via `_paste`; key configurable with g:fzf_vim.paste_key
- Skip the key when buffer is not &modifiable
- Per command, paste:
  - path: Files, GFiles, GFiles?, Buffers, History, Locate
  - line text: Lines, BLines, Marks, Changes
  - matched text: Rg, Ag, Grep
  - tag name: Tags, BTags
  - commit hash: Commits, BCommits
This commit is contained in:
Junegunn Choi
2026-05-31 23:26:55 +09:00
parent e5b53de3d3
commit c2b97c62b9
3 changed files with 183 additions and 5 deletions
+18 -1
View File
@@ -1,4 +1,4 @@
fzf-vim.txt fzf-vim Last change: June 8 2025
fzf-vim.txt fzf-vim Last change: May 31 2026
FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc*
==============================================================================
@@ -150,6 +150,11 @@ COMMANDS *fzf-vim-commands*
- Most commands support CTRL-T / CTRL-X / CTRL-V key bindings to open in a new
tab, a new split, or in a new vertical split
- Most commands support ALT-ENTER to insert the selected items into the
current buffer instead of opening them. The inserted text depends on the
command: file path (Files, GFiles, Buffers, History, Locate), line content
(Lines, BLines, Marks, Changes), matched text (Rg, Ag, Grep), tag name
(Tags, BTags), or commit hash (Commits, BCommits)
- Bang-versions of the commands (e.g. `Ag!`) will open fzf in fullscreen
- You can set `g:fzf_vim.command_prefix` to give the same prefix to the commands
- e.g. `let g:fzf_vim.command_prefix = 'Fzf'` and you have `FzfFiles`, etc.
@@ -224,6 +229,18 @@ behavior with `g:fzf_vim.preview_window`. Here are some examples:
" let g:fzf_vim.preview_bash = 'C:\Git\bin\bash.exe'
<
Paste key~
*fzf-vim-paste-key*
*g:fzf_vim.paste_key*
Most commands support a key to insert the selected items into the current
buffer instead of opening them. Customize it with `g:fzf_vim.paste_key`.
>
" Key to insert the selected items into the current buffer
" (default: 'alt-enter')
let g:fzf_vim.paste_key = 'alt-enter'
<
Command-level options~
*fzf-vim-command-level-options*