running fzf in cmdline mode got E565 error
- Dominant language
- Vim Script
- Stars
- 10.3k
- Forks
- 608
- Avg merge
- 5d 8h
- Merged PRs (30d)
- 2
Description
- [x] I have fzf 0.30.0 or above
- [x] I have read through https://github.com/junegunn/fzf.vim/blob/master/README.md
- [x] I have read through https://github.com/junegunn/fzf/blob/master/README-VIM.md
- [x] I have read through the manual page of fzf (`man fzf`)
- [x] I have searched through the existing issues
## What I want to do
I want to insert a path of my bookmark list in cmdline mode.
My bookmark list is like bellow. This is csv. First column is name and second is path.
```
$ cat ~/bookmarks
WIP,$HOME/Desktop/WIP
Projects,$HOME/Documents/projects
MEDIA,/Volumes/MEDIA
temp with space,$HOME/Downloads/temp with space
```
In case opening or saving a file, I want to run fzf to choose one of my bookmark path with `b`.
For example, I type bellow
```
:e b proj
```
for completing bellow.
```
:e $HOME/Documents/projects
```
## Problem
I wrote a function and a map in my vimscript.
Then I got a E565 error when typing `:e b`.
Error messages are bellow.
```
Error detected while processing function 1_FzfBookmark[9]..fzf#run[80]..function 1_FzfBookmark[9]..fzf#run[63]..9_execute_term[3]..9_split:
line 31:
E565: Not allowed to change text or change window: botright 13new
Error detected while processing function 1_FzfBookmark:
line 9:
E171: Missing :endif
```
How can I resolve this?
## Vim script for reproduction
For reproduction, start vim with command bellow.
```
$ vim -Nu reproduction.vim
```
`reproduction.vim` is
```
set nocompatible hidden laststatus=2
if !filereadable('/tmp/plug.vim')
silent !curl --insecure -fLo /tmp/plug.vim
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
source /tmp/plug.vim
call plug#begin('/tmp/plugged')
Plug 'junegunn/fzf', { 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
call plug#end()
autocmd VimEnter * PlugClean! | PlugUpdate --sync
function! s:FzfBookmark()
let l:BS = "\u08" "
let l:cmdtype = getcmdtype()
let l:args = {
\ 'source': 'cat $HOME/bookmarks',
\ 'sink': { lines -> lines },
\ 'down': '50%',
\ } " sink does nothing
if l:cmdtype == ':'
let l:list = fzf#run(fzf#wrap(l:args))
if len(list)
return escape(substitute(list[0], '^.\{-,},', '', ''), ' ')
else
return 'a' . l:BS " workaround for redraw problem
endif
else
let l:list = fzf#run(fzf#wrap(l:args))
endif
endfunction
cnoremap b FzfBookmark()
```
## Environments
### vim
```
$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 24 2021 14:13:28)
macOS version - x86_64
Included patches: 1-3455
Compiled by GitHub Actions
Huge version with MacVim GUI. Features included (+) or not (-):
+acl +file_in_path -mouse_sysmouse +tag_binary
+arabic +find_in_path +mouse_urxvt -tag_old_static
+autocmd +float +mouse_xterm -tag_any_white
+autochdir +folding +multi_byte -tcl
-autoservername -footer +multi_lang +termguicolors
+balloon_eval +fork() -mzscheme +terminal
+balloon_eval_term +fullscreen +netbeans_intg +terminfo
+browse +gettext +num64 +termresponse
++builtin_terms -hangul_input +odbeditor +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 +perl/dyn +title
+clientserver +job +persistent_undo +toolbar
+clipboard +jumplist +popupwin +transparency
+cmdline_compl +keymap +postscript +user_commands
+cmdline_hist +lambda +printer +vartabs
+cmdline_info +langmap +profile +vertsplit
+comments +libcall +python/dyn +virtualedit
+conceal +linebreak +python3/dyn +visual
+cryptv +lispindent +quickfix +visualextra
+cscope +listcmds +reltime +viminfo
+cursorbind +localmap +rightleft +vreplace
+cursorshape +lua/dyn +ruby/dyn +wildignore
+dialog_con_gui +menu +scrollbind +wildmenu
+diff +mksession +signs +windows
+digraphs +modify_fname +smartindent +writebackup
+dnd +mouse -sodium -X11
-ebcdic +mouseshape -sound -xfontset
+emacs_tags +mouse_dec +spell +xim
+eval -mouse_gpm +startuptime -xpm
+ex_extra -mouse_jsbterm +statusline -xsmp
+extra_search +mouse_netterm -sun_workshop -xterm_clipboard
-farsi +mouse_sgr +syntax -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -arch x86_64 -arch arm64 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Wall -Wextra -Wshadow -Werror -Wno-error=missing-field-initializers -Wno-error=deprecated-declarations -Wno-error=unused-function
Linking: clang -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -arch x86_64 -arch arm64 -L/usr/local/lib -o Vim -lm -lncurses -liconv /usr/local/lib/libintl.a -framework AppKit -fstack-protector -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE
```
### fzf
```
$ fzf --version
0.30.0 (brew)
```
### fzf.vim
```
$ git rev-parse HEAD
d5f1f8641b24c0fd5b10a299824362a2a1b20ae0
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.