Currently, when clicking the letter l or arrow →, if I am on a directory it moves into it but if I am on a file it opens it in vim. I am wondering if there is a way to change this behaviour for files to move into the "view" pane instead of opening the file in vim.
Asked
Active
Viewed 430 times
1 Answers
2
nnoremap + <s-tab>
nnoremap l :if filetype('.') == "dir"|cd %c|else|exe 'norm +'|endif<CR>
The last map overrides l default behavior. It checks the type of
the selected file. If it is a directory, then cd
it. Otherwise,
execute the normal mode command +, that is mapped to Shift
-Tab, which causes the view pane to be focused (assuming it has already
been activated, of course).
I had to create the first map because I could not get something like exe 'norm <s-tab>'
to work.

Quasímodo
- 18,865
- 4
- 36
- 73
-o
in nnn:-o open files only on Enter
(fromnnn -h
)Because it is really annoying to me to navigate through the folder and then accidentally open a file in vim
– I J Nov 03 '20 at 15:11