Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autocmd event for mp4 files on the cursor #894

Open
sazam0 opened this issue Apr 10, 2023 · 1 comment
Open

autocmd event for mp4 files on the cursor #894

sazam0 opened this issue Apr 10, 2023 · 1 comment

Comments

@sazam0
Copy link

sazam0 commented Apr 10, 2023

I have a command which shows the duration of media (mp4) files in the status bar (macro %S). It works ok with executing manually. I want to add it to the autocmd to show the information (duration) when the cursor is on the mp4 files. I only found DirEnter event, I am not sure how to use that, since the files can be in any directory.

here I attach the code: command! statf vstat singlef %d %c %S 2> /dev/null (vstat is the script file name)

singlef(){
	lpath="$1"/"$2"
	duration="mediainfo --Inform=\"General;%Duration/String3%\" ${lpath}"
	tmp=$(eval "$duration")
	echo "duration : " ${tmp} | sed 's/.\{4\}$//'
}
@xaizek
Copy link
Member

xaizek commented Apr 10, 2023

The use case like this was never considered. The closest thing is to use extcached() function in status line format and filter out non-mp4 files in the script to return an empty line and take no extra space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants