Hi Hari:
I tried the new plugin. Excellent! Exactly what I want. There are
several missing features I think could make lookupfile even more
effecient & useful. Can you evaluate these features also ?
- include opened buffer as matching target (ido feature)
- order matching files by mru first, file already visible in the frame
at end (ido feature)
- one enter keystroke will open the first matching file in the matching
list (this scenario happens frequently, ido feature)
- backspace will delete the directory path back to previous path
delimiter (filename is still deleted char-by-char, ido feature)
- default searching directory is based on file most recently used
- open the lookup window and pressing tab (no keyword is entered
yet) will display files in the current directory (and buffers
currrently opened)
- double ESC could close the lookup window
- prefix filename with ">" (or something else) will searching file
recursively in the current directory
- provide option to filter out some of the files when matching
(eg. *.o, *.so ... )
- using "[]" instead of "**" to enclose pattern in the matched filename
Thanks for looking into this
Eddy
2006/8/11, Hari Krishna Dara <[EMAIL PROTECTED]>:
I had some trouble but I was able to try ido.el. At first, emacs that
came with cygwin didn't start at all, even when I had X running, so I
downloaded it separately from gnu.org. I installed ido.el directly under
lisp directory, as I don't know how to put it in a user directory. Next
I had trouble understanding how to invoke it. Once I figured out that I
need to use M-x, I was able to try it. See below for my response.
On Thu, 10 Aug 2006 at 10:38pm, Eddy Zhao wrote:
> Hi Hari:
>
> I detailed compared ido.el and lookupfile.vim today, below are some
> of the ido features that I personally think more convenient than the
> current
> lookupfile plugin:
>
> - Ido don't need user to generate & update tagfile (and don't have things
> like LookupFile_MinPatLength and performance balance)
As I explained before, the basic lookup mode is designed to be a lookup
in a full index. However, the plugin comes with a few other means to
lookup, and a generic extension mechanism to add more means. The version
I attached with my previous email includes a new mode which works
similar to ido.el.
> - Ido can locate file by keyword (not regexp). For Example user only need
> to input keyword "c" to locate file "my_cccc" from file "my_aaaa",
> "my_bbbb", "my_cccc" in the current directory. User don't need to locate
> file by regexp everytime (though ido DO support regexp based locating, I
> find myself almost never used that feature. User's file locating pattern
is
> more keyword based, NOT regexp based !!).
This is totally in the control of the new function that I added (see
below for an improved version), and I think it already behaves this way.
It may interpret some characters as filename-wildcards, as recognized by
glob(), so we might need to protect them (but there are not many of
them).
> - Ido will automatically complete the filename under the current input
> focus while user is inputing keyword, and at the same time it will show
> other candidate filename list that match the keyword. These two features
> have a lot of advantages:
>
> * User can more quickly detect that the target file is already located
> using the current keyword subset
>
> * User can more quickly detect that no file will be located using the
> current keyword subset (and further-keyword-based-on-that-subset)
>
> * User don't need to press TAB to check the matched filenames, all
> happened automatically
I think all this is covered.
>
> - Ido can locate file in any directory (not only file in the current
> directory,
> user only need to prefix directory path, and directory patch could be
> completed by TAB)
Covered as well.
>
> - Ido can highlight the keyword in the matched filenames
This can't be done, as I am using the Vim7 completion popup, and it
doesn't support highlighting. However, I worked around by wrapping the
pattern with asterisks (in the new function below), so it kind of works,
though not that easy to read.
>
> The above features make ido very effecient, could lookupfile be
> modified to achieve the same effect? I think lookupfile is a very
> important plugin that could affect the whole vim community's editing
> effeciency. If you want to know anything more about ido's feature, pls
> let me know, I'll investigate and feedback. And I strongly recommend
> you to try ido once.
>
>
> Thanks for look into that
> Eddy
Replace the s:LookupWalk function in the plugin/lookupfile.vim with
the one below and try it out. Let me know if this meets your needs. If
you read a bit about Vim scripting basics, you can start playing around
with this function to make the matches look better (e.g, if '/' should
be separate or as part of 'abbr'). See help on |complete-items| on how
the map works.
function! s:LookupWalk(pattern)
" Determine the parent dir.
let parent = matchstr(a:pattern, '^.*/')
let pattern = strpart(a:pattern, len(parent))
let files = glob(parent.((pattern != '') ? '*'.pattern.'*' : '*'))
let fl = split(files, "\<NL>")
let entries = []
for f in fl
let word = isdirectory(f)?f."/":f
let fname = matchstr(f, '[^/]*$')
call add(entries, {
\ 'word': word,
\ 'abbr': fname,
\ 'menu': substitute(fname, '\V'.pattern, '*&*', ''),
\ 'kind': (isdirectory(f)?'/':' '),
\ })
endfor
return entries
endfunction
--
Thanks,
Hari
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com