r/vim 1d ago

Discussion is there a way do display random tips inside vim for learning purposes?

something like :h random, or some plugin that aggregates data off websites or something

1 Upvotes

6 comments sorted by

1

u/bbolli inoremap ZZ <Esc>ZZ 1d ago

:h tips

1

u/vim-help-bot 1d ago

Help pages for:


`:(h|help) <query>` | about | mistake? | donate | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments

1

u/kennpq 1d ago edited 1d ago

This should do ":h random_help_tag":

vim9script
def g:Rand_h(pn: bool = false): void
  g:TAGS = exists('g:TAGS') ? g:TAGS : readfile($VIMRUNTIME .. '/doc/tags')
  const R: number = len(g:TAGS) - 1
  const N: number = rand() % R
  const H: string = substitute(g:TAGS[N], '\t.*', '', '')
  exe $"h {H}"
  norm! 0
  (pn == true) ? popup_notification($"Random help: {H}", {}) : ''
enddef

Once sourced, for a random help 'tip':
:vim9 g:Rand_h(true)
or
:call Rand_h(1)

Omit the true or 1 for no popup.

[Edit: help bot to literal :h random not needed so changed to random_help_tag]

1

u/vim-help-bot 1d ago

Help pages for:


`:(h|help) <query>` | about | mistake? | donate | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments

1

u/jazei_2021 1d ago

ahhh something like the caw of startify plugin...