Skip to content

Commit

Permalink
Script to present slides
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed May 1, 2017
1 parent 378e471 commit 08c9838
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
69 changes: 69 additions & 0 deletions JBug/clojure/_.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
" Slideshow tool v1.1
" Pavel Tisnovsky 2012, 2013, 2014

let g:slides=readfile("list.txt")
let g:index=0

function! GotoFirstSlide()
let g:index = 0
endfunction

function! GotoLastSlide()
let g:index = len(g:slides) - 1
endfunction

function! BeforeFirstSlide()
return g:index < 0
endfunction

function! AfterLastSlide()
return g:index >= len(g:slides)
endfunction

function! ShowNextSlide()
let g:index += 1
if AfterLastSlide()
call GotoFirstSlide()
endif
call ShowActualSlide()
endfunction

function! ShowPrevSlide()
let g:index -= 1
if BeforeFirstSlide()
call GotoLastSlide()
endif
call ShowActualSlide()
endfunction

function! ShowFirstSlide()
call GotoFirstSlide()
call ShowActualSlide()
endfunction

function! ShowLastSlide()
call GotoLastSlide()
call ShowActualSlide()
endfunction

function! ShowActualSlide()
execute "edit" g:slides[g:index]
endfunction

function! StatusLine()
return "Slide " . (1+g:index) . "/" . len(g:slides) . " : " . g:slides[g:index]
endfunction

" Hot keys
map <PageUp> :call ShowPrevSlide()<cr>
map <PageDown> :call ShowNextSlide()<cr>
map <Home> :call ShowFirstSlide()<cr>
map <End> :call ShowLastSlide()<cr>
" Setup
set statusline=%!StatusLine()

" Would be better to show status line even if only one window is displayed
set laststatus=2
:call ShowFirstSlide()

2 changes: 2 additions & 0 deletions JBug/clojure/make_slides.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
csplit $1 -f "slide" -b "%02d.txt" "/^$/" {*}

0 comments on commit 08c9838

Please sign in to comment.