Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 200483 - app-editors/vim-7.1.123 - wildmode/wildchar broken/changed
Summary: app-editors/vim-7.1.123 - wildmode/wildchar broken/changed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-27 05:57 UTC by Mike Gant
Modified: 2011-03-14 07:44 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Gant 2007-11-27 05:57:54 UTC
Pressing the wildchar (in my case <Tab>) when opening a file using :e does not handle relative paths properly.

Reproducible: Always

Steps to Reproduce:
1. Open vim from any directory other than '/', for example /project/aaa/hardware/fpga/src
2. Type :e ../<Tab> (or what ever 'wildchar' is set to)


Actual Results:  
It displays the files/directories in / in the wildmenu.

Expected Results:  
It should have displayed the files in /project/aaa/hardware/fpga in the wildmenu.

Unfortunately this behavior doesn't occur in all directories. I thought it may be NFS mounted directories. But, I've seen it on local directories as well. I am going to try and characterize it better. I just found out it doesn't always act this way while writing this bug report.

vim --version
VIM - Vi IMproved 7.1 (2007 May 12, compiled Nov 13 2007 15:47:48)
Included patches: 1, 3, 5-123
Modified by Gentoo-7.1.123
Compiled by root@mgant
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 
+cryptv -cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic 
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path 
+folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist
 +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu 
+mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm 
-mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang -mzscheme 
-netbeans_intg -osfiletype +path_extra +perl +postscript +printer +profile 
+python +quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent 
-sniff +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: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: i686-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -march=pentium4 -pipe    -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/lib/perl5/5.8.8/i686-linux/CORE  -I/usr/include/python2.4 -pthread  -I/usr/lib/ruby/1.8/i686-linux 
Linking: i686-pc-linux-gnu-gcc   -L.  -rdynamic -Wl,-export-dynamic  -rdynamic   -o vim       -lcurses -lacl -lgpm   -rdynamic  /usr/lib/perl5/5.8.8/i686-linux/auto/DynaLoader/DynaLoader.a -L/usr/lib/perl5/5.8.8/i686-linux/CORE -lperl -lutil -lc -L/usr/lib/python2.4/config -lpython2.4 -lpthread -lutil -Xlinker -export-dynamic  -Wl,-R -Wl,/usr/lib -L/usr/lib -lruby18 -lm   


emerge --info
Portage 2.1.3.19 (default-linux/x86/2007.0, gcc-3.4.6, glibc-2.6.1-r0, 2.6.19-gentoo-r5 i686)
=================================================================
System uname: 2.6.19-gentoo-r5 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Timestamp of tree: Mon, 19 Nov 2007 11:16:01 +0000
app-shells/bash:     3.2_p17
dev-java/java-config: 1.3.7, 2.1.2-r1
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.22-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=pentium4 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://tux/gentoo-portage"
USE="3dfx 3dnow X acl acpi alsa arts bash-completion berkdb bitmap-fonts bzip2 cli cracklib crypt cups dbus dga dri emacs esd fam fbcon fortran freetds gb gcj gd gdbm gif glut gpm hal iconv imap ipv6 isdnlog java javascript jpeg jpeg2k kde ldap mad maildir mbox midi mmx mozsvg mp3 mplayer mudflap mysql ncurses nls nptl nptlonly odbc opengl openmp oss pam pcre pdf perl plotutils png ppds pppd python qt3 readline reflection ruby samba sasl sdk sdl session slang spell spl sse sse2 ssl tcltk tcpd tetex tiff truetype truetype-fonts type1 type1-fonts unicode usb vorbis win32codecs x86 xinerama xml xorg xscreensaver xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="i810 vesa fbdev mga"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Mike Gant 2007-11-28 03:23:24 UTC
I've figured out the cause of the problem.

Here's how to reproduce the problem from your home directory:

1. cd tmp
2. $ vi foo
3. (In vim) :e ../<Tab> (or whatever your wildchar is set to)
4. If wildmenu is set you should see files/directories in your home directory
5. Type <Esc> to exit ex mode.
6. Type :set isfname-=.
7. (In vim) :e ../<Tab> (or whatever your wildchar is set to)
8. If wildmenu is set you should see files/directories in your root directory

As noted these steps assume that wildmenu is enabled, if wildmenu is not enabled repeatedly pressing <Tab> (or appropriate wildchar) will scroll through the files and directories in either your home directory or the root directory depending on the isfname setting.

This behavior is definitely new in version 7.1.123.

I downgraded to 7.1.042 and removing '.' from isfname does not cause this problem.

Comment 2 Ali Polatel (RETIRED) gentoo-dev 2007-11-29 03:07:56 UTC
(In reply to comment #1)
> I've figured out the cause of the problem.
[snip]
> As noted these steps assume that wildmenu is enabled, if wildmenu is not
> enabled repeatedly pressing <Tab> (or appropriate wildchar) will scroll through
> the files and directories in either your home directory or the root directory
> depending on the isfname setting.
> 
> This behavior is definitely new in version 7.1.123.
> 
> I downgraded to 7.1.042 and removing '.' from isfname does not cause this
> problem.
> 

The behaviour of tab completion has changed in 7.1.081[1] and 7.1.083[2]. Tab
completion now uses vim_isfilec_or_wc() function which uses vim_isfilec() and
this function depends on isfname setting.
With this change tab completion will start at any character that can't be in a
filename. As an example cases like 'cat </tmp/file<Tab>' will work unless '<'
is in isfname.
Closing as invalid because this is not a bug.

[1]: ftp://ftp.vim.org/pub/vim/patches/7.1/7.1.081
[2]: ftp://ftp.vim.org/pub/vim/patches/7.1/7.1.083
Comment 3 Mike Gant 2007-11-29 04:33:09 UTC
OK, here me out on this one.

I use vi for editing vhdl files. An entity (or module) is instantiated (or
referenced) from another module by this syntax:

u1 : entity lib.module_name(architecture)

Where module_name is also the name of the file that contains the module_name entity and its architecture. If I want to open module_name for editing using the fastest method (least amount of key presses), I would position the cursor on
module_name and type 'gf'. Here's the problem, with '.' in isfname it won't
work and I get this error:

E447: Can't find file "lib.module_name" in path

So, this is why I remove '.' from isfname when I edit vhdl files. I realize I 
can type ':e module_name' to open the file but to me that isn't in the spirit 
of vim -- performing editing tasks with as few keystrokes as possible. 
Furthermore, module_name may be in a subdirectory from the current working 
directory so there may be even more typing. 

So now, with the latest release, if I remove '.' from isfname I can use 'gf' 
as described above but I can't do something like 

:e ../other_directory/<Tab>

to edit a file in another directory that I'm too lazy to type in the name or
when I can't remember the exact name.

Now, as in all things unix there may be another way to do this. If so, I'm all
ears (or eyes, as the case may be, since I will be reading responses :) ). I'm
going to re-open this bug not to be a jerk or raise the ire of anyone only so
that I can get a response with hopefully an alternate solution.

Thank you,
Mike
Comment 4 Ali Polatel (RETIRED) gentoo-dev 2007-11-29 11:14:06 UTC
(In reply to comment #3)
> OK, here me out on this one.
> 
> I use vi for editing vhdl files. An entity (or module) is instantiated (or
> referenced) from another module by this syntax:
> 
> u1 : entity lib.module_name(architecture)
> 
> Where module_name is also the name of the file that contains the module_name
> entity and its architecture. If I want to open module_name for editing using
> the fastest method (least amount of key presses), I would position the cursor
> on
> module_name and type 'gf'. Here's the problem, with '.' in isfname it won't
> work and I get this error:
> 
> E447: Can't find file "lib.module_name" in path
> 
> So, this is why I remove '.' from isfname when I edit vhdl files.

hmm, I think what you're doing is a hack which stopped to work with
this fix ;). isfname isn't used for that.
Quoting from ':he gf'

"Trailing punctuation characters ".,:;!" are ignored.
[snip]
Uses the 'suffixesadd' option to check for file names with a suffix added.  If
the file can't be found, 'includeexpr' is used to modify the name and another
attempt is done."

For example default ftplugin/python.vim has:
set suffixesadd=.py
setlocal includeexpr=substitute(v:fname,'\\.','/','g')

and with /usr/lib/python2.5/site-packages in 'path' gf works fine. i.e.:
# vim: set ft=python :
import twisted.internet.basic

doing gf on twisted will open twisted/internet/basic.py with '.' in isfname and
twisted/ without. This is expected behaviour.

Put a line like
setlocal includeexpr=substitute(v:fname,'\\.','/','g')
in ~/.vim/ftplugin/after/vhdl.vim and you should be fine.

I'll poke the maintainer of vhdl.vim to include this into the default file.
Comment 5 Mike Gant 2007-11-29 17:06:46 UTC
[snip] 
> hmm, I think what you're doing is a hack which stopped to work with
> this fix ;). isfname isn't used for that.
> Quoting from ':he gf'
> 
> "Trailing punctuation characters ".,:;!" are ignored.
> [snip]
> Uses the 'suffixesadd' option to check for file names with a suffix added.  If
> the file can't be found, 'includeexpr' is used to modify the name and another
> attempt is done."

Ah, but the help for gf also states this:

"Uses the 'isfname' option to find out which characters are supposed to be in a file name."

[snip]

> setlocal includeexpr=substitute(v:fname,'\\.','/','g')
> in ~/.vim/ftplugin/after/vhdl.vim and you should be fine.

I think I understand the reason for the change but the above doesn't work. After adding the above includeexpr to vhdl.vim and using gf with the cursor on module_name on the following line:

u1 : entity lib.module_name(architecture)

The result is,

E447: Can't find file "lib/module_name" in path

I've tried different patterns and can't get any to work. What I want it to do is strip the "lib." part from the filename. And I think the solution for this (if there is one) should go in the vhdl.vim. I'm going to continue experimenting but any help would be appreciated. 

Thanks
Comment 6 Mike Gant 2007-12-03 03:15:30 UTC
I found a setting for includeexpr that does what I want.

setlocal includeexpr=substitute(v:fname,'[A-Za-z_][0-9A-Za-z_]*.','','')

Don't know if the pattern will catch everything but should catch most for now. And  I can continue to adjust.

I do think that this part of help for gf should be looked at:

"Uses the 'isfname' option to find out which characters are supposed to be in a file name."

because it is misleading (at least for me) and led to my reporting this as a bug.

tx
Comment 7 Jim Ramsay (lack) (RETIRED) gentoo-dev 2010-07-28 15:12:10 UTC
This is an old bug, can you confirm that this bug is still present in app-editors/vim-7.2.442
Comment 8 Tim Harder gentoo-dev 2011-03-14 07:44:18 UTC
Closing since the version isn't in the tree anymore. Please reopen the bug if you can reproduce it with a newer version.