A user defined command to open files recursively in a directory.
After weeks trying to get this to work, I got to the following code after trying to understand this answer:
function! DumbnoteOpenNote(...) let Note = a:1 execute "e " Note endfunction function! DumbnotePathsCompletion(...) return split(globpath(g:dumbnoteDefaultCollection, '**/*'), '\n') endfunction command! -bang -complete=customlist,DumbnotePathsCompletion -nargs=* DumbnoteOpenNote call DumbnoteOpenNote(<f-args>)
Given the following directory structure:
|--ADirectory |--BDirectory | |--Afile | |--Bfile | |--Cdirectory | |--Afile | |--Bfile | |--Afile |--Bfile |--Cfile
will expand to the path specified in the
customlist and the completion works just fine with both
tab and the arrows.
Here is my first question:
Does it really need to expand to the whole path (in this case
/home/user/path/)? When I use the command, I already know that I am looking for completion only in that path, and I don't need to see the whole path.
Is it possible to get completion from that path on?
Despite of that, if I type:
Hoping to get the completion to the
Bfile, the completion will just come back to the first alphabetical item. The same happens if typing:
Assuming that the idea is to get completion to the
CDirectory. After that
..CD<tab> the completion will - again - jump back to the first alphabetical item, in both cases it means
Why would the
-complete=customlist be alphabetically ordered? And is it possible to configure that?
This behavior happens both on Vim
Is it possible to get completion from that path on Vim 8 and Neovim 0.2 both installed from the official Archlinux repositories.
Any help on how to improve this question (and the ascii repository structure) is appreciated.
Thanks in advance!