aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/auditory.vim8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugin/auditory.vim b/plugin/auditory.vim
index 5d694af..f8b1bac 100644
--- a/plugin/auditory.vim
+++ b/plugin/auditory.vim
@@ -27,6 +27,8 @@ function! s:PlayInsertLeave()
endfunction
function! s:PlayScale()
+ let play_scale_previous_note = -1
+ let note = -1
let scale = [
\ '1_C#.wav',
\ '2_D#.wav',
@@ -37,7 +39,11 @@ function! s:PlayScale()
\ '7_B#.wav'
\ ]
- let note = system("echo $RANDOM % " . len(scale) . " | bc")
+ while play_scale_previous_note ==# note
+ let note = system("echo $RANDOM % " . len(scale) . " | bc")
+ endwhile
+
+ let play_scale_previous_note = note
call auditory#Play('./Resources/Scale_C#/' . scale[note])
endfunction