1

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.

Quasímodo
  • 18,865
  • 4
  • 36
  • 73
I J
  • 13
  • Is the "view" pane always on, or do you want to toggle it? Should it be only for files or for directories too? I don't think there is any simple way to make Vifm act differently if the focus is on a directory or in a file. – Quasímodo Nov 03 '20 at 12:59
  • Well if this is not possible then maybe something like -o in nnn: -o open files only on Enter (from nnn -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

1 Answers1

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