Yggdroot / LeaderF

An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc. on the fly for both vim and neovim.
Apache License 2.0
2.14k stars 180 forks source link

保存或再打开文件报错 #1060

Closed CHANTXU64 closed 5 months ago

CHANTXU64 commented 5 months ago

let g:Lf_NormalMap = { \ "*": [["", ""], ["", ""]], \ "File": [["", ':exec g:Lf_py "fileExplManager.quit()"']], \ "Buffer": [["", ':exec g:Lf_py "bufExplManager.quit()"']], \ "Mru": [["", ':exec g:Lf_py "mruExplManager.quit()"']], \ "Tag": [["", ':exec g:Lf_py "tagExplManager.quit()"']], \ "BufTag": [["", ':exec g:Lf_py "bufTagExplManager.quit()"']], \ "Rg": [["", ':exec g:Lf_py "rgExplManager.quit()"']], \ "Gtags": [["", ':exec g:Lf_py "gtagsExplManager.quit()"']], \ "Function":[["", ':exec g:Lf_py "functionExplManager.quit()"']], \ "History": [["", ':exec g:Lf_py "historyExplManager.quit()"']], \ "Command": [["", ':exec g:Lf_py "commandExplManager.quit()"']] }

let g:Lf_CommandMap = { \ '': '', \ '': '' }

let g:Lf_CursorBlink = 0 let g:Lf_WindowHeight = 0.30 let g:Lf_FollowLinks = 1

" buffers nnoremap :LeaderfBuffer " files let g:Lf_ShortcutF = ']a' " Mru nnoremap :LeaderfMru " bufTag nnoremap ]t :LeaderfBufTagCword xnoremap ]t :=printf('Leaderf bufTag --input %s', get_visual_selection()) noremap ]T :LeaderfBufTag nnoremap ] :LeaderfBufTagAllCword xnoremap ] :=printf('Leaderf bufTag --all --input %s', get_visual_selection()) noremap ]st :LeaderfBufTagAll " function nnoremap ]f :LeaderfFunctionCword xnoremap ]f :=printf('Leaderf function --input %s', get_visual_selection()) noremap ]F :LeaderfFunction nnoremap ] :LeaderfFunctionAllCword xnoremap ] :=printf('Leaderf function --all --input %s', get_visualselection()) noremap ]sf :LeaderfFunctionAll " command noremap ]x :LeaderfCommand " history nnoremap q :LeaderfHistoryCmd xnoremap q_ :LeaderfHistoryCmd nnoremap q: :LeaderfHistoryCmd xnoremap q: :LeaderfHistoryCmd nnoremap q/ :LeaderfHistorySearch xnoremap q/ :LeaderfHistorySearch " rg noremap / :Leaderf rg --all-buffers noremap ? :Leaderf rg nnoremap # :=printf('Leaderf! rg --current-buffer -e %s ', expand('')) xnoremap # :=printf('Leaderf! rg --current-buffer -e %s ', leaderf#Rg#visual()) noremap ] :=printf('Leaderf! rg --all-buffers -e %s ', expand('')) noremap :=printf('Leaderf! rg -e %s ', expand('')) xnoremap ]# :=printf('Leaderf! rg -F -e %s ', leaderf#Rg#visual()) " gtags let g:Lf_GtagsAutoGenerate = 1 let g:Lf_Gtagslabel = 'native-pygments' noremap gr :=printf('Leaderf! gtags -r %s --auto-jump', expand('')) noremap gd :=printf('Leaderf! gtags -d %s --auto-jump', expand('')) " recall noremap ]rt :Leaderf! bufTag --recall noremap ]rf :Leaderf! function --recall noremap ]rr :Leaderf! rg --recall noremap ]rg :Leaderf! gtags --recall

let g:Lf_WildIgnore = { \ 'dir': ['.svn','.git','.hg','plugged','vendor','node_modules'], \ 'file': ['.sw?','~$','.bak','.exe','.o','.so','*.py[co]', \ '.DS_Store'] }

function! get_visual_selection() " Why is this not a built-in Vim script function?! let [line_start, column_start] = getpos("'<")[1:2] let [line_end, column_end] = getpos("'>")[1:2] let lines = getline(line_start, line_end) if len(lines) == 0 return '' endif let lines[-1] = lines[-1][: column_end - (&selection == 'inclusive' ? 1 : 2)] let lines[0] = lines[0][column_start - 1:] return join(lines, "\n") endfunction


### Describe your question, feature request, or bug.
在我打开任一文件后保存或再打开一个文件后报错,但仅仅是报错,不会影响保存或打开文件:
```text
处理 BufReadPost 自动命令 "*"..script /Users/chantxu/.vim/plugged/LeaderF/autoload/leaderf/Gtags.vim[10]../Users/chantxu/.vim/plugged/LeaderF/autoload/leaderf.vim[337]..function <SNR>87_InitCommandMap 时发生错误:
第   16 行:
E896: map() 的参数必须是列表、字典或 Blob
第   13 行:
E896: filter() 的参数必须是列表、字典或 Blob
E896: filter() 的参数必须是列表、字典或 Blob
E896: filter() 的参数必须是列表、字典或 Blob
E896: filter() 的参数必须是列表、字典或 Blob
E896: filter() 的参数必须是列表、字典或 Blob
第   16 行:
E896: map() 的参数必须是列表、字典或 Blob

Steps to reproduce

  1. nvim ~/.vim/base.vim
  2. :w<CR>
  3. error

  1. nvim ~/.vim/base.vim
  2. e ~/.vim/plugin_config.vim<CR>
  3. error

但是

  1. nvim ~/.vim/base.vim
  2. :w<CR>
  3. error
  4. e ~/.vim/plugin_config.vim<CR>
  5. 正常打开文件

Actual behaviour

报错

Expected behaviour

没有报错

备注

  1. 使用9.0的vim并不会报错
  2. 这个问题好像是从我要装某个版本的emacs,把ctags和gtags卸载后出现的问题,但现在重新装上ctags、gtags也没用,还是报错
    
    gtags --version

gtags (GNU Global) 6.6.12 Powered by Berkeley DB 1.85 and SQLite3 3.45.1. Copyright (c) 1996-2024 Tama Communications Corporation License GPLv3+: GNU GPL version 3 or later http://www.gnu.org/licenses/gpl.html This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

ctags --version

Universal Ctags 6.1.0, Copyright (C) 2015-2023 Universal Ctags Team Universal Ctags is derived from Exuberant Ctags. Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert Compiled: Mar 9 2024, 01:15:16 URL: https://ctags.io/ Output version: 0.0 Optional compiled features: +wildcards, +regex, +gnulib_fnmatch, +gnulib_regex, +iconv, +option-directory, +xpath, +json, +interactive, +yaml, +case-insensitive-filenames, +packcc, +optscript, +pcre2

Yggdroot commented 5 months ago
let g:Lf_CommandMap = {
   \ '<Up>': '<C-K>',
   \ '<Down>': '<C-J>'
   \}

=>

let g:Lf_CommandMap = {
   \ '<Up>': ['<C-K>'],
   \ '<Down>': ['<C-J>']
   \}
CHANTXU64 commented 5 months ago

好了😅