I have a large file called index.txt which has all absolute path of all files listed say,
common/mac_get.c
common/addr/addr_main_set_clear_config.c
common/addr/mac/mac_load_done.c
Need to write vimrc function to search only last word in each line of index.txt with delimiter as / (i.e search only basename ) and not match for foldername also it should accept * as a part of argument in search.
say If I pass argument mac*.c
then It should search file starting with mac & ending with .c then return results as,
common/mac_get.c
common/addr/mac/mac_load_done.c
say If I pass argument mac*done.c
then It should search file starting with mac and ending with done.c then return results as,
common/addr/mac/mac_load_done.c
say If I pass argument *main*.c
or *main*set*.c
then It should return results as,
common/addr/addr_main_set_clear_config.c
This is what I've tried so far :
function! searchFname(fname)
execute "silent! grep!" a:fname "~/index.txt"
endfunction
command! -nargs=* Fname call SearchFname('<args>')
Any help would be greatly appreciated.