Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3784728
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:25:15+00:00 2026-05-19T11:25:15+00:00

Suppose I want to write a report on what I see from my window

  • 0

Suppose I want to write a report on what I see from my window : the bus departs, Mrs Smith goes to the grocer’s, etc…
An example : http://withhiddennoise.net/2010/08/12/georges-perec-an-attempt-at-exhausting-a-place-in-paris/

Of course, abbreviations are ideal for that type of shorthand. We could have :

:iabbr bd The bus departs
:iabbr sg Mrs Smith goes to the grocer's

But it is evident that these events will keep on repeating, and we are supposed not to re-use the same words (at least, not too often).

Is it possible then to have something which would look like this :

:iabbr bd RANDOM(The bus departs, The bus drives away, The bus takes off)

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T11:25:16+00:00Added an answer on May 19, 2026 at 11:25 am

    You could define a function like the following one

    function! BD() 
    
      let l:t = localtime()
    
      if     l:t % 3 == 0
             normal aThe bus departs
    
      elseif l:t % 3 == 1
             normal aThe bus drives away
    
      else   
             normal aThe bus takes off
      endif
    
    endfunction
    

    and then declare the following imap:

    :imap bd <ESC>:call BD()<CR>a
    

    From now on, entering bd in insert mode should insert one of the three random strings.

    Edit: As for the question if there can be multiple patterns: if I understood the question right, this is possible with something like:

    let g:abbreviations  = [
    \      ['The bus departs', 'The bus drives away', 'The bus takes off'],
    \      ['foo'            , 'bar'                , 'baz'              ],
    \      ['That''s ok'     , 'That''s fine'       , 'That''s good'     ],
    \      ['more'           , 'less'               , 'the same'         ],
    \   ]
    
    function! ExpandAbbr(abbr_no) 
    
      let l:t = localtime()
    
      return g:abbreviations[a:abbr_no][l:t % 3]
    
    endfunction
    
    iabbr <expr> bd ExpandAbbr(0)
    iabbr <expr> pg ExpandAbbr(1)
    iabbr <expr> ok ExpandAbbr(2)
    iabbr <expr> mo ExpandAbbr(3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As an example, suppose I want to write a monadic and non-monadic map over
Suppose I want to write a program to read movie info from IMDb, or
Suppose I want to write an app for Android OS that is not going
Suppose, you want to write unittest s for functions like this one: def test_me(instream):
Suppose I want to execute code, for example value += 5 inside a namespace
suppose we have two numbers i want write program which print common bits subsequent
Suppose you want to write into a database that something is 30 meters long,
Suppose I want to write a function in R which is a function of
I think my question is best explained via an example: Suppose I want to
Suppose I would want to write this on my big-endian machine an_ostream_impl my_output_on_BE; my_output_on_BE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.