ctrlsf.vim
ctrlsf.vim copied to clipboard
查找时提示winlayout未定义
trafficstars

使用的vim版本太老,没有winlayout。更新使用8.2版本后解决。 VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 13 2020 16:04:38)
@pidansolo 这是个问题。按照设计sync模式需要支持Vim 7.4。
- First install of plugin on
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct 13 2020 15:49:09) - command entered:
:CtrlSF test - Same Error
- After Hitting [Enter], search results open as expected in left split
Searching...
Error detected while processing function ctrlsf#Search[15]..<SNR>72_ExecSearch[18]..<SNR>72_DoSearchAsync[4]..<SNR>72_Open[1].
.ctrlsf#win#OpenMainWindow[14]..ctrlsf#win#BackupAllWinSize:
line 4:
E117: Unknown function: winlayout
E116: Invalid arguments for function s:BuildResizeCmd(winlayout(), 0, 0), '|'))
E116: Invalid arguments for function join(s:BuildResizeCmd(winlayout(), 0, 0), '|'))
E116: Invalid arguments for function add
Press ENTER or type command to continue

Try to install ctrlsf v2.1.2. It's worked for me.
I've ran into this error when I was using Vim 8.1, winlayout is a newer function
Here's a couple of potential solutions:
- Just update your Vim Version
- Use an older version of CtrlSF
- Edit Code in
autoload/ctrlsf/win.vim
autoload/ctrlsf/win.vim
- Find
func! ctrlsf#win#BackupAllWinSize() - Replace with:
func! ctrlsf#win#BackupAllWinSize()
if !(exists('g:ctrlsf_win_compatibility'))
" New Way
if !exists("t:ctrlsf_winrestcmd")
let t:ctrlsf_winrestcmd = []
endif
call add(t:ctrlsf_winrestcmd, join(s:BuildResizeCmd(winlayout(), 0, 0), '|'))
else
" Old Way
let nr = 1
while winbufnr(nr) != -1
if getwinvar(nr, '&winfixwidth') || getwinvar(nr, '&winfixheight')
if type(getwinvar(nr, 'ctrlsf_winwidth_bak')) != 3
call setwinvar(nr, 'ctrlsf_winwidth_bak', [])
endif
call add(getwinvar(nr, 'ctrlsf_winwidth_bak'), winwidth(nr))
if type(getwinvar(nr, 'ctrlsf_winheight_bak')) != 3
call setwinvar(nr, 'ctrlsf_winheight_bak', [])
endif
call add(getwinvar(nr, 'ctrlsf_winheight_bak'), winheight(nr))
endif
let nr += 1
endwh
endif
endf
- add
let g:ctrlsf_win_compatibility = 1into your vimrc