In Vim (7.3 on Debian Wheezy) I am trying to open Perl modules in vim using the following command...
:e `perldoc -lm Test::More`
But I get...
E79: Cannot expand wildcards
One word module names work fine, eg
:e `perldoc -lm DateTime`
It appears the colon is being considered a wildcard somehow, I've tried escaping with backslashes which makes no difference.
So, is there some way to either disable wildcard expansion for a command? or is it possible to escape characters in this context? and if so how?
I've searched as best as I can and the Vim documentation is surprisingly vague around wildcards in a backtick command such as this.
Note: I know there are other ways to get vim to open a Perl module by name but it's the wildcard backtick semantics I'm interested in.
Full vim version info
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb 10 2013 02:28:47)
Included patches: 1-547
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by jamessan@debian.org
Huge version without GUI. Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
+find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent
+listcmds +localmap +lua +menu +mksession +modify_fname +mouse -mouseshape
+mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse
+mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg
+path_extra +perl +persistent_undo +postscript +printer +profile +python
-python3 +quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/include/tcl8.5 -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_LARGEFILE64_SOURCE=1
Linking: gcc -L. -Wl,-z,relro -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-z,relro -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -L/usr/lib -llua5.1 -Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.14/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib -ltcl8.5 -ldl -lpthread -lieee -lm -lruby-1.9.1 -lpthread -lrt -ldl -lcrypt -lm -L/usr/lib
This works for me with Vim 7.4 on Ubuntu 14.04, so upgrading to a newer Vim version might help.
Alternatively, you can work around the problem replacing the backticks with this:
:execute 'e' system('perldoc -lm Test::More')
To handle special filespecs, you'd have to wrap the system()
in fnameescape()
, but then you have to drop the trailing newline from the captured output.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.