r/vim

wrote a bash + vim workflow that pulls youtube video transcripts into buffers and searches them with fzf
▲ 61 r/vim+2 crossposts

wrote a bash + vim workflow that pulls youtube video transcripts into buffers and searches them with fzf

i work at a devops consultancy and we have about 180 youtube videos. recorded architecture reviews, internal tech talks, client postmortems, vendor integration demos, conference presentations people bookmarked. they're all shared in a markdown file in our wiki which is basically a list of youtube links with dates. useless for finding anything unless you remember exactly when the video was recorded.

i wanted a way to search these videos by what was actually said in them without leaving the terminal. so i built a workflow around vim, bash, and fzf.

the first piece is a bash script that takes a youtube url and pulls the full transcript using transcript api. it saves the transcript as a plain text file named after the video title with the date prepended. one file per video. all the transcripts live in a directory called ~/transcripts.

the second piece is an fzf wrapper script. it runs fzf with --preview against the transcript directory. as you type, fzf fuzzy matches across all transcript files and the preview window shows the matching file with the match highlighted. select a result and it opens the transcript in vim with the cursor on the first match. i bound this to a key in my shell so i can hit ctrl-t and start searching immediately.

the vim side is where it gets useful. each transcript file has a yaml front matter block at the top with the video title, date, speaker, tags, and the youtube url. i wrote a small vim function that reads the url from the front matter and opens it in the browser. so the workflow is: fzf to find the video, vim to read the transcript, one keypress to open the actual youtube video if i need to watch it.

the ingestion script is about 30 lines of bash. curl to call the api, jq to parse the json and extract the transcript text, a few lines to generate the yaml front matter, and tee to write the file. i have a text file with all 180 urls and a for loop that processes them. the whole batch ran in about 4 minutes.

the fzf wrapper is maybe 15 lines. the vim function is 8 lines. the keybinding is one line in my vimrc.

about 180 videos indexed as plain text files. the consultants on my team use it before client calls to search for whether we've discussed a similar architecture before. i use it almost daily to find specific things from recorded tech talks. the nice thing about plain text files is that grep works, ripgrep works, fzf works, vim's built in search works. no special tooling needed beyond what's already on my machine.

the whole thing took an afternoon and i haven't changed anything since.

u/straightedge23 — 1 day ago
▲ 25 r/vim+1 crossposts

VimKata: a browser game that punishes you for every unnecessary keystroke

Been using Vim for about a year and kept thinking "the only real practice is doing it live." So I built something.

VimKata each level shows you a code snippet and a target state. Transform it using Vim commands in the browser. You get scored.

The formula:

score = floor(1000 × efficiency × time_factor × undo_penalty)

efficiency   = min(1.0, optimal_keystrokes / your_keystrokes)
time_factor  = max(0.5, 1.0 - elapsed_seconds / (par_seconds × 2))
undo_penalty = max(0.8, 1.0 - undo_count × 0.05)

Keystroke count is the dominant factor. You can brute force your way to a correct answer with 40 keys and get 3/10 efficiency, or learn ciw and walk away with 960 points.

30 levels. Basics (x, dw, dd) through text objects (ci", di[, cit), visual block, dot repeat, and count prefixes. Wrong answers show a character-level diff. Correct answers reveal the optimal solution and a replay of every key you pressed.

Daily challenge + leaderboard for signed-in users. Anonymous play always works, no account needed.

Stack: CodeMirror + the vim plugin, SvelteKit, Go + Echo, DynamoDB, Lambda.

https://vimkata.academy

Disclaimer: I built this. If you have feedback, feel free to reach out. Always looking to improve it.

reddit.com
u/Sebasllr — 5 days ago
▲ 19 r/vim

Why does my terminal Vim look like this?

I'm tired of putting up with this. I made some computer changes earlier in the year, or late last (graphics card, drive, etc.), and when I got back up and running—Linux, Ubuntu 24.04, bash, Apprentice colorscheme—it started always doing this. I can select all text, and deselect, and it fixes it, but can leave a stray line at the bottom.

I've scoured Google a few times over the last year, conversed with ChatGPT, searched forums, mucked around a bit with settings, plugins, etc... I've tried a handful of suggested term and Vim fixes. I can't get anything to work. The background is supposed to be that dark gray, not black.

The terminal itself is fine; it's just Vim. Starting with -u NONE means standard black background (w/ green text), so the issue either doesn't exist, or isn't visible.

UPDATE: Ctrl+L/:redraw don't fix the issue, like selecting all does.

https://preview.redd.it/4a7gucquaf1h1.png?width=1010&format=png&auto=webp&s=3357d728700166aae6e0ba03332825d063f562dd

reddit.com
u/gfixler — 6 days ago
▲ 15 r/vim+1 crossposts

ssh vimflyer.app - A Terminal Arcade Game to practice hjkl

https://preview.redd.it/v44btbgesd1h1.png?width=2867&format=png&auto=webp&s=c3933df5287f5517ef87d468ea471d789f785ee8

I made a terminal arcade game to help with vim commands. No install needed, just ssh. Built in Go with persistent leaderboards.

Travel through a side-scrolling world, collecting candy and coins, while avoiding ghosts and walls -- and practice hjkl while playing!

https://preview.redd.it/ii8qibujsd1h1.png?width=1080&format=png&auto=webp&s=c45727d3859fe9304b173d4d76f1600771b3a21f

reddit.com
u/awriterabroad — 5 days ago
▲ 6 r/vim

Help with 1.5.2 in vimtutor

Hello, recently just got a new MacBook after my old "work" station died. Since it came with Vim preinstalled, I felt adamant to learn it but I'm getting confused by 1.5.2.

I guess the only way I can describe my confusion is that;

I can't tell what the final product of the lesson is supposed to look like

or

If there exists a niche Mac rewriting of the commands it's asking me to use for writing files (:!dir and :!1s and :w [NEW FILE NAME]).

I'm so inexperienced with Vim that I'm not even sure whether this is a stupid question to ask or not, but any help would be appreciated! Thanks!

reddit.com
u/Upset-Taro-4202 — 5 days ago
▲ 19 r/vim

You can now highlight put text via the hlyank plugin

Just add g:hlput_enable = 1 to your vimrc

reddit.com
u/64bitman — 9 days ago
▲ 4 r/vim

Vim9.0: Commenting Inside A Dictionary

How do I safely insert comments inside a dictionary definition?

let s:groups = {
\ '0': {                         " group 0
\   '':  ['#000000', '#ffffff'], " black/white
\   '0': ['#000000', '#f5f5f5'], " ...
\   '1': ['#000000', '#dcdcdc'], " ...
\   '2': ['#000000', '#d3d3d3'], " ...
\ },
...
\}
reddit.com
u/CRTejaswi — 9 days ago
▲ 0 r/vim

Opening an HTML tag in Vim

In VS Code, when I type an HTML tag and press Enter, the editor automatically expands it like this:

<tag>|</tag>

After pressing Enter:

<tag>
  |
</tag>

Is there a way to achieve the same behavior in Vim? Also, why isn’t this enabled by default?

reddit.com
u/InevitableFootball71 — 13 days ago
▲ 23 r/vim

vim overlays letters when holding navigational keys in normal mode

Wondering if anyone's encountered this issue before, where letters are overlayed onto text when navigating. Only occurs when holding keys, not tapping.

Additionally, lines go back to normal when switching lines (on key press. issue occurs when holding j or k) which I'm assuming is because vim is updating the line or something.

Could it be plausible that it's some issue where my key repeat rate is too high?

u/BirdWithCigar — 11 days ago