Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
ago in vifm by

I want to make a conditional bind for q
If tabcount is greater than or equal to 1, nnoremap <silent> q :tabclose<CR>
Else nnoremap <silent> q :qa<CR> (or quit or what have you)

1 Answer

0 votes
ago by

Yes, there is tabpagenr(). There is always at least one tab so, "greater than or equal to 1" is always true.

nnoremap <silent> q : if tabpagenr('$') > 1
                  \ |     tabclose
                  \ | else
                  \ |     quit
                  \ | endif<cr>

However, that's literally the behaviour of :quit.

...