The bash shell provides the RANDOM environment variable that gives a random integer from 0 to 32767 inclusive, on many Linux systems. Since 0G jumps to the last line, this variable provides line numbers effectively from 1 to 32768 inclusive, and if the number of lines in the buffer is 32768 or less, the following can be used to define a command such that :RandomLine will jump to a random line in the buffer: :command! RandomLine execute 'normal! '.(system('/bin/bash -c "echo -n $RANDOM"') % line('$')).'G'
Attributes | Values |
---|---|
rdfs:label |
|
rdfs:comment |
|
Version |
|
dbkwik:vim/property/wikiPageUsesTemplate | |
Previous |
|
Author |
|
Subpage |
|
Complexity |
|
Created |
|
ID |
|
NEXT |
|
abstract |
|