0

So it seems that vim is great for so many things. And I love it. And yet, it is the configuration that sometimes is a limitation for those of us who don't get a tight grasp on how to tinker into it. I know there's a number of programs that are useful for transcribing audio, and it is great to have many options. However it seems they need some amount of steps to get them installed and configured, in order to get them compatible with controlling from inside of vim.

I am looking for the following main features to be controled inside vim, ability mainly to:

  • pause/play system wide, so that doing so from the vim editor is possible. Perhaps it would be nice that after each pause there is slight backwards, so that one can hear a little before, which is needed when hearing repeatidly.

How can I control an average audio program from inside vim?

These other features two are additional but highly valuable:

  • make audio slower and with proper pitch to stop as little as possible.
  • fast forward and back system wide, to move along through broad sections.
  • make a clean catch of timing to insert into the transcription.

Can I run a transcription program from vim in a old operative system?

I am running debian 6, stable (actually it is a bunsen labs distro on top of debian), and am having a hard time searching for a program that will work directly. Up to now my best solution is doing this online but the fix I found is not vim like, which is not the best possible solution: online transcribe. It pauses/plays with ctrl+esc, controls time pace slower/quicker with F2/F3 (auto regulates pitch), inserts time stamp with ctrl+j.

Any vim-like solution, be it online or instalable?

  • I'm not sure I fully understand your question but it seems that you are looking for an external program which is not related to Vim. So I think your question might be off topic for this site. Maybe have a look at software recommendations, superuser or Unix & Linux. – statox Feb 12 at 14:40
  • @statox if the question were “how do I control an external program from vim” would it be on-topic? I could probably write an answer for that. – D. Ben Knoble Feb 13 at 14:54
  • @D.BenKnoble sure if you have something relevant to answer that you can post it :) @ nilon I think you don't have answer because the question is border line off topic and because that sounds (to me) like a pretty niche problem so we might not have a lot of user with this kind of knowledge but yes we should let time decide :) – statox Feb 13 at 15:14
1

Controlling an external program from vim is just like controlling an external program from many other unix utilities: we lean on the mechanisms provided to us in the shell, who specializes in external programs.

Each of the following methods requires that we could, should we want, manipulate our program from the command line (shell). Most well-behaved unix utilities exhibit this feature, and many are scriptable (I used to have an itunes control script lying around, before I realized I didn't use it in favor of my Mac's keyboard).

The first step is, therefore, to ensure there is some external command (be it a script you write or the executable utility from the program) that can control your audio program. Make sure it is in your $PATH, and that you can run it from a shell. You'll probably want to consult its documentation and get quite familiar with it.

Method 1: Bang

The :! command is a handy "shell-out" to run an external program. It uses the shell (typically in non-interactive mode, though one can adjust 'shell' and 'shellcmdflag') to execute the following command.

This command has its peculiarities; a glance at the docs comes highly recommended. For simple usage, it tends to work as expected.

If your command has no output, you can even :silent !cmd to avoid the hit-enter prompt.

Method 2: Background

Vim plays well with job-control in the shell, meaning standard signals like Ctrl-Z and fg work. Vim also provides the :suspend command, though I prefer my mapping <Leader>z for the same effect. The idea here is to get back to a terminal, run some commands, and come back to vim when ready.

Method 3: New Shell

Vim has a command called :shell which spawns a shell as a subprocess of vim; one can easily run commands here as well.

3a: Terminal

Vim, as of version 8.1, ships with the :terminal command, opening a terminal inside your vim instance for minimal distraction. Combined with tmux or similar, this can be a powerful multi-tasking tool.

Results

Because vim provides so many different ways to execute external commands, I recommend you experiment with the ones that work best for you in a given situation. I like :terminal for running interpreters/quick processes, tmux for shells, and ! for when I know I'm not going to need to run more than one command. My <Leader>z map also sees heavy usage.

The best part, though, is that you can create mappings for these! If your command (possibly a script) is called audio-control, you could:

nnoremap <Leader>a :!audio-control<CR>

Or, if it has subcommands:

nnoremap <Leader>aa :!audio-control
nnoremap <Leader>ap :!audio-control play-toggle<CR>

&c. The list goes on and on...

  • This seems a very complete answer with the explanation of the structural dependence between vim, shell, and audio. And yet I am quite behind on my knowledge on how to apply it directly. Could you give a practical example with a specific program? I could use mocp, or any other for sound. I don't quite understand where to begin with my current programs and vimrc. Have you been able to use this? Could you please show how more in detail? – nilon Apr 25 at 19:16
  • @nilon in all honesty it depends on details of the program. If it has a reasonable CLI interface, it’s not much different from scripting. – D. Ben Knoble Apr 25 at 21:14
  • I can't script. Yet at least – nilon Apr 26 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.