Summary: | app-editors/vim-7.1.123 - wildmode/wildchar broken/changed | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Mike Gant <lister-bugs> |
Component: | Current packages | Assignee: | Vim Maintainers <vim> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Mike Gant
2007-11-27 05:57:54 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. (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 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 (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. [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 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 This is an old bug, can you confirm that this bug is still present in app-editors/vim-7.2.442 Closing since the version isn't in the tree anymore. Please reopen the bug if you can reproduce it with a newer version. |