I am trying to keep the selection after file open. I always want to open only the file under cursor (not the selected files/folders) and I want to just keep the selection.
First I though maybe I can modify all filextype
to retrieve selection after opening:
filextype *.pdf zathura %c %i & | normal gs
But, this doesn't seem to work. Do you have any hints? Is something like this even possible with filextype
?
Then, I tried changing the enter command:
nnoremap <cr> :file &<cr>lgs
This keeps the selection, but it only opens the first selected file regardless of location of the cursor. It also makes enter useless when cursor is at the dot (very first item on top). Adding %c
like this:
nnoremap <cr> :file %c &<cr>lgs
will make enter to open the item under cursor regardless of the selection (which is what I want), but does not retrieve the selection.
I also tried these:
nnoremap <cr> :file %c &<cr>l | normal gs
nnoremap <cr> :file %c &<cr>l | :execute "norm gs"
which also do not keep the selection and also switch the pane.
Can you think of any workaround for me to keep the selection with file open? I never open all selected files and only want to open the item under cursor.
Thank you.