Inspired by a nice solution on a Stack Overflow, the following was put in my
command! Bro :vnew +setl\ buftype=nofile | 0put =v:oldfiles \| nnoremap <buffer> <CR> :e <C-r>=getline('.')<CR><CR>
There are two problems with it I'd like to fix:
- I want to view the list from the top (most recent) rather than the bottom, as is currently the case. I've tried adding
1Gto the script, but to no avail.
- I would rather the list be open in the current window, so I don't have to come back to close it later. Using
vnewproduces an E488 error, and
eputs the list of files in current file.
Update. Since the purpose of this exercise is to make the file list searchable, it's probably a good idea to append
:noh<CR> to the
nnoremap so that once you've searched, found your file, and opened it by pressing Enter, search terms are not highlighted in the file.