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
in vifm by

In VIFMRC I put some comments at the end of the nnoremap commands, e.g:

nnoremap bb :!bleachbit --clean firefox.*<cr> :!sleep 2<cr>  " bleachbit cleaning firefox and wait two second to see the output

When I run :nmap to see all the commands, the comment helps me remember the function of a command

I wonder why it generates some errors in this case:

nnoremap <silent> <f9> :move <c-r>=system('date +%Y%m%d')<cr>_<c-x>c<cr> " put date while moving - PICTURE_DIRECTORY will be 20250304_PICTURE_DIRECTORY

Thank you so much for this beautiful file manager that makes my life so much easier!

2 Answers

0 votes
by
edited by

Similar to Vim in Vifm mapping commands can't include comments in them. Mappings can pretty much do anything a user can (like changing modes or providing input for a prompt), so there is no way to know whether " comment is intended to be a comment or part of a key sequence. I should document this better.

Descriptions for user mappings have been asked for several times, but weren't implemented as of now. (edit: implemented in this commit for future v0.15 release).

+1 vote
by

When I run :nmap to see all the commands, the comment helps me remember the function of a command

As a workaround to help you remember its function, you could first create a custom command and then assign a key binding to that command. For example:

command! Touch :execute 'touch ' . input('Create file(s): ')
nnoremap <Space>t :Touch<CR>

If you hit <Space> or run :nmap, only :Touch<CR> will show up, not the entire command.

...