Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.
0 votes
in vifm by

Im using vifm-w64-se-0.9.1-binary (windows), and try :select %date% (files with current date, for exemple "01.01.2018") all files fas name with current date in format "01.01.2018"
How can i do that on windows for nnremap binding?

For now i use this keybind

nnoremap <f1> :normal Scgg3jv6j <cr>

Sc - sort created time reverse (nnoremap Sc :set sort=-ctime,+iname )
gg - go top line
3j - down to files (nor dir)
v6j - select 6 archives, that was created today

sry for my eng =(


Пытаюсь в виндовс версии vifm выбрать файлы, созданные сегодня. Пока придумал костыль с сортировкой и выбором семи последних созданных файлов. Но хочется понять как сделать :select именно используя %date% или date/t

2 Answers

0 votes

I have created some bat file, that show current date in format exmpl *21.02.2018*

@echo off set dt=%date% echo %dt%

Pls, tell me, how can i use with :select command? =)


Sorry, just noticed this answer. If %date% is expanded to 21.02.2018 for you, then you can use it to define a command that selects files like this:

command! seltodays :execute 'select! *'.system('echo %%date%%').'*'
0 votes

all files fas name with current date in format "01.01.2018"

This information wasn't in the GitHub issue. In this case simple form of :select should do:

:select! *01.01.2018*

Here's a version that uses %date%:

command! seltodays :execute 'select! *'.system('FOR /F "eol=; usebackq tokens=2,3* delims=/ " %%i in (`echo %%date%%`) do @echo %%j-%%i-%%k').'*'

You might need to change separators or order of variables in echo part as format is not fixed and depends on locale. The example is for "wrong" mm/dd/yyyy format, if you have normal "dd.mm.yyyy", the following should work (didn't test this one):

command! seltodays :execute 'select! *'.system('FOR /F "eol=; usebackq tokens=2,3* delims=. " %%i in (`echo %%date%%`) do @echo %%i-%%j-%%k').'*'

Thank you for advices and examples!
This one work great for me!

command! seltodays :execute 'select! *'.system('echo %%date%%').'*'
nnoremap <f1> :seltodays <cr>

I just add keybind for them!
Other two examples i tested too, buthe just select all files.
Thank you very much for your help with awesome powerfull vifm!