ctrlsf.vim icon indicating copy to clipboard operation
ctrlsf.vim copied to clipboard

查找时提示winlayout未定义

Open pidansolo opened this issue 4 years ago • 5 comments
trafficstars

image

pidansolo avatar Jun 23 '21 09:06 pidansolo

使用的vim版本太老,没有winlayout。更新使用8.2版本后解决。 VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 13 2020 16:04:38)

pidansolo avatar Aug 03 '21 03:08 pidansolo

@pidansolo 这是个问题。按照设计sync模式需要支持Vim 7.4。

dyng avatar Sep 03 '21 10:09 dyng

  • 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

image

ukos-git avatar Oct 21 '21 09:10 ukos-git

Try to install ctrlsf v2.1.2. It's worked for me.

a-zvg avatar Dec 03 '21 17:12 a-zvg

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:

  1. Just update your Vim Version
  2. Use an older version of CtrlSF
  3. 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 = 1 into your vimrc

Nealium avatar Sep 29 '22 20:09 Nealium