Monday, December 1, 2025

Re: What do you use for (fuzzy) file search?

On 30.11.25 22:01, Roberto Tonino wrote:
> Search in buffers only. Sometimes avoids using Tab when I have only a
> bunch of files opened, e.g. let's suppose to have Avatar.tsx,
> Avatar.test.tsx and more files in the project. I open only Avatar.tsx
> and other files and <leader><leader>Avat<Enter> brings me directly to
> the file without having to Tab through. Works even better when there are
> many files with the same prefix in the project.

Not quite understanding the need for other than inbuilt Vim fuzziness in this case. In the src directory just:
$ vim *.S *.c obj/*.lst [Mm]akefile
giving twenty or forty buffers. Then if in Vim:
:ls
  1 %a   "adc.S"                        line 1
  2      "init.S"                       line 0
  3      "os.S"                         line 0
  4      "serial.S"                     line 0
  5      "timer.S"                      line 0
  6      "include/events.h"             line 0
  7      "include/os.h"                 line 0
  8      "include/sc.h"                 line 0
  9      "include/service.h"            line 0
10      "include/sys.h"                line 0
11      "obj/app.dump"                 line 0
12      "makefile"                     line 0
13      "ld.lnk"                       line 0
14      "obj/map"                      line 0
15      "obj/adc.o.lst"                line 0
16      "obj/init.o.lst"               line 0
17      "obj/os.o.lst"                 line 0
18      "obj/serial.o.lst"             line 0
19      "obj/timer.o.lst"              line 0

:bu ini <Tab>
gives
init.S
and on a second <Tab>
obj/init.o.lst
then cycling - choose as suits. To save keystrokes, and speed buffer switches:
noremap <A-b> :bu
That does all useful fuzziness on the full set of legitimate match
targets, I find.

For a variety of projects, a simple selector serves:
$ vpr
1) ~/Embedded/avr/projects/fence_monitor           4) ~/Embedded/avr/projects/arduino_hobber
2) ~/Embedded/avr/projects/OGPD                    5) ~/cnc/emc2/hr2gc/
3) /usr/local/src/binutils-2.23_mydev/obj-avr      6) ~/Embedded/avr/experiments/bigmem
#? 1
given, in .bashrc :
vpr () {
   select project in $PROJECTS ; do
      eval cd $project/src
      uxterm -fg yellow -bg darkslategrey -cr red -geometry 70x38+1000+10 \
             -e vim obj/*.dump &
         vim `find . -type f -name '*.[chSsld]*'` [Mm]akefile
      break       # To exit from the "select" have-another-go loop.
   done
}
where $PROJECTS is a list of project paths, defined in .bashrc.

The uxterm opens a second window on the right, to display a disassembly of the ROM-resident post-compilation microcontroller code, as it will be laid out in memory. That's nifty for checking the interrupt vector table, initialisation code, and other good stuff - all while flicking between the source code files in the left hand window, using Alt-B and a couple of letters from the filename. Make an edit, "make", then :e! in the right hand window to refresh the code dump. Voila.
That's more than enough IDE, I find, especially with exuberant ctags added.
Erik

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/366ffa75-307e-4b23-ab23-218a68dfaee6%40localhost.

No comments: