Closed matthew-ma-sudo closed 1 month ago
$ vim --version VIM - Vi IMproved 9.1 (2024 Jan 02, 编译于 Aug 16 2024 16:37:36) 包含补丁: 1-678 编译者 matthew@matthew-10-62-0-103 巨型版本 带 GTK3 图形界面。 可使用(+)与不可使用(-)的功能: +acl +file_in_path +mouse_urxvt -tag_any_white +arabic +find_in_path +mouse_xterm -tcl +autocmd +float +multi_byte +termguicolors +autochdir +folding +multi_lang +terminal -autoservername -footer -mzscheme +terminfo +balloon_eval +fork() -netbeans_intg +termresponse +balloon_eval_term +gettext +num64 +textobjects +browse -hangul_input +packages +textprop ++builtin_terms +iconv +path_extra +timers +byte_offset +insert_expand -perl +title +channel +ipv6 +persistent_undo +toolbar +cindent +job +popupwin +user_commands +clientserver +jumplist +postscript +vartabs +clipboard +keymap +printer +vertsplit +cmdline_compl +lambda +profile +vim9script +cmdline_hist +langmap -python +viminfo +cmdline_info +libcall +python3 +virtualedit +comments +linebreak +quickfix +visual +conceal +lispindent +reltime +visualextra +cryptv +listcmds +rightleft +vreplace +cscope +localmap -ruby +wildignore +cursorbind -lua +scrollbind +wildmenu +cursorshape +menu +signs +windows +dialog_con_gui +mksession +smartindent +writebackup +diff +modify_fname -sodium +X11 +digraphs +mouse -sound +xattr +dnd +mouseshape +spell -xfontset -ebcdic +mouse_dec +startuptime +xim +emacs_tags -mouse_gpm +statusline -xpm +eval -mouse_jsbterm -sun_workshop +xsmp_interact +ex_extra +mouse_netterm +syntax +xterm_clipboard +extra_search +mouse_sgr +tag_binary -xterm_save -farsi -mouse_sysmouse -tag_old_static 系统 vimrc 文件: "$VIM/vimrc" 用户 vimrc 文件: "$HOME/.vimrc" 第二用户 vimrc 文件: "~/.vim/vimrc" 第三用户 vimrc 文件: "~/.config/vim/vimrc" 用户 exrc 文件: "$HOME/.exrc" 系统 gvimrc 文件: "$VIM/gvimrc" 用户 gvimrc 文件: "$HOME/.gvimrc" 第二用户 gvimrc 文件: "~/.vim/gvimrc" 第三用户 gvimrc 文件: "~/.config/vim/gvimrc" defaults 文件: "$VIMRUNTIME/defaults.vim" 系统菜单文件: "$VIMRUNTIME/menu.vim" $VIM 预设值: "/usr/local/share/vim" 编译方式: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/uuid -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 链接方式: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lselinux -L/usr/lib/python3.10/config-3.10-x86_64-linux-gnu -lpython3.10 -lcrypt -ldl -lm -lm
You should use :Leaderf rg -w -e piot_state -g "*.{h,hpp,cpp,cc,c,S,s}"
You should use
:Leaderf rg -w -e piot_state -g "*.{h,hpp,cpp,cc,c,S,s}"
Thank you!
I am trying and get this error:
=printf("Leaderf rg -w -e %s -g "*.{h,hpp,cpp,cc,c,S,s}" ", expand("<cword>"))
E15: 无效的表达式: ".{h,hpp,cpp,cc,c,S,s}" ", expand("
and the .vimrc leaderf configuration:
noremap <Leader>w :<C-U><C-R>=printf("Leaderf rg -w -e %s -g "*.{h,hpp,cpp,cc,c,S,s}" ", expand("<cword>"))<CR>
Finally, i found configuration: noremap <Leader>w :<C-U><C-R>=printf("Leaderf rg -w -e %s -g *.h -g *.hpp -g *.cpp -g *.cc -g *.c -g *.S -g *.s} ", expand("<cword>"))<CR>
. it can work!
Thank you for your apply!
Actually this issue is weird for me.
Leaderf rg -w -e piot_state -g *.{h,hpp,cpp,cc,c,S,s}
does not throw any error on my machine. But in fact in the command line, rg -w -e piot_state -g *.{h,hpp,cpp,cc,c,S,s}
will report No such file or directory (os error 2)
.
I am trying and get this error: =printf("Leaderf rg -w -e %s -g "*.{h,hpp,cpp,cc,c,S,s}" ", expand("
"))
You should escape the double quotes, you can write as below:
:noremap <Leader>w :<C-U><C-R>=printf("Leaderf rg -w -e %s -g \"*.{h,hpp,cpp,cc,c,S,s}\" ", expand("<cword>"))<CR>
or
:noremap <Leader>w :<C-U><C-R>=printf('Leaderf rg -w -e %s -g "*.{h,hpp,cpp,cc,c,S,s}" ', expand("<cword>"))<CR>
Actually this issue is weird for me.
i try and it works. Thanks!
vim --version
ornvim --version
::echo has("python")
: yes:echo has("python3")
: yes:echo &pythondll
(only vim, not neovim)::echo &pythonthreedll
(only vim, not neovim)::py print(sys.version)
::py3 print(sys.version)
: 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]:echo g:Lf_Debug_Cmd
: E121: 未定义的变量: g:Lf_Debug_Cmd:echo g:Lf_FilesFromCache
: E121: 未定义的变量: g:Lf_FilesFromCache" search word under cursor, the pattern is treated as regex, and enter normal mode directly nnoremapa :=printf("LeaderfBufTagAll")
nnoremapr :=printf("Leaderf rg -w -e %s ", expand(""))
nnoremape :=printf("Leaderf rg -e %s ", expand(""))
noremapv :=printf("Leaderf rg -F --current-buffer -v -e %s ", expand(""))
" search word under cursor, the pattern is treated as regex,
" append the result to previous search results.
noremap g :=printf("Leaderf rg --append -e %s ", expand(""))
" search word under cursor literally only in current buffer noremapb :=printf("Leaderf rg -F --current-buffer -e %s ", expand(""))
" search word under cursor literally in all listed buffers noremapd :=printf("Leaderf rg -F --all-buffers -e %s ", expand(""))
" search visually selected text literally, don't quit LeaderF after accepting an entry xnoremap gf :=printf("Leaderf! rg -F --stayOpen -e %s ", leaderf#Rg#visual())
" recall last search. If the result window is closed, reopen it. nnoremap go :Leaderf rg --recall
" search word under cursor in .h and .cpp files. noremapf :=printf("Leaderf rg -e %s -g .h -g .hpp -g .cc -g .c -g .cpp" , expand(""))
" the same as above
noremap f :=printf("Leaderf rg -e %s -g .{h,hpp,cpp,cc,cc,S,s} ", expand(""))
noremapp :=printf("Leaderf rg -w -e %s -g *.{py,pyc} ", expand(""))
noremapw :=printf("Leaderf rg -w -e %s -g .{h,hpp,cpp,cc,c,S,s} ", expand(""))
"noremap w :=printf("Leaderf rg -w -e %s -g .{h,c} ", expand(""))
noremapb :=printf("Leaderf rg -w -e %s %s", expand(""), expand("%"))
"noremapc :=printf("Leaderf rg -w -e %s -g .{cpp,cc,c} ", expand(""))
noremap c :=printf("Leaderf rg -w -e %s -g .{c} ", expand(""))
"noremaph :=printf("Leaderf rg -w -e %s -g .{h,hpp} ", expand(""))
noremap h :=printf("Leaderf rg -w -e %s -g .{h} ", expand(""))
noremapp :=printf("Leaderf rg -w -e %s -g *.{py,pyc} ", expand(""))
noremapi :=printf("Leaderf rg -w -e %s -g *.{i} ", expand(""))
Describe your question, feature request, or bug.
:Leaderf rg -w -e piot_state -g *.{h,hpp,cpp,cc,c,S,s}
Steps to reproduce
:Leaderf rg -w -e piot_state -g *.{h,hpp,cpp,cc,c,S,s}
Actual behaviour
Expected behaviour
1 arch/x86/kernel/piot.c:41:} piot_state; 2 arch/x86/kernel/piot.c:84: for (i = 0; i < piot_state.gate_nr_pages; i++) 3 arch/x86/kernel/piot.c:86: piot->workspace[i] = &piot_state.gate_pages[i]; 4 arch/x86/kernel/piot.c:88: for (i = piot_state.gate_nr_pages; i < WORKSPACE_PAGES; i++) 5 arch/x86/kernel/piot.c:97: piot->offset = piot_state.gate_nr_pages PAGE_SIZE; 6 arch/x86/kernel/piot.c:125: for (i = piot_state.gate_nr_pages; i < WORKSPACE_PAGES; i++) 7 arch/x86/kernel/piot.c:264: // info->user_base = info->base + piot_state.gate_nr_pages PAGE_SIZE; 8 arch/x86/kernel/piot.c:353: piot_state.gate_nr_pages = gate_len >> PAGE_SHIFT; 9 arch/x86/kernel/piot.c:354: piot_state.gate_pages = alloc_pages(GFP_KERNEL, get_order(gate_len)); 10 arch/x86/kernel/piot.c:356: if (!piot_state.gate_pages) 11 arch/x86/kernel/piot.c:360: // u64 vaddr = page_address(piot_state.gate_pages); 12 arch/x86/kernel/piot.c:362: memcpy(page_address(piot_state.gate_pages), (void *) piot_gate, gate_len); 13 arch/x86/kernel/piot.c:374: piot_state.debugfs = debugfs_create_file("piot", S_IRUGO | S_IWUGO, NULL, NULL, &piot_fops); 14 arch/x86/kernel/piot.c:375: if (IS_ERR(piot_state.debugfs)) { 15 arch/x86/kernel/piot.c:376: ret = PTR_ERR(piot_state.debugfs); 16 arch/x86/kernel/piot.c:384: debugfs_remove(piot_state.debugfs);