Created
July 12, 2011 17:13
-
-
Save akitsukada/1078448 to your computer and use it in GitHub Desktop.
2011/7/12 GenesisLightningTalksで発表したLT資料
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let s:Presentation = { 'slides' : [], 'current' : 0, 'max' : 0 } | |
function! s:Presentation.load() | |
let self.slides = [ | |
\ { | |
\ 'title' : 'Apurenthisu', | |
\ 'contents' : [ | |
\ '* いつまで見習ってるつもりですか', | |
\ '* 2011/07/10', | |
\ '* @akitsukada', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : ' 提供', | |
\ 'contents' : [ | |
\ 'ネットでつながる', | |
\ 'エンターテイメントでつながる', | |
\ ' Dwango', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : 'このプレゼンツールは', | |
\ 'contents' : [ | |
\ 'こちらからお借りしています', | |
\ 'http://d.hatena.ne.jp/maedana/20080523/1211549638', | |
\ 'ありがとうございます', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : 'about me', | |
\ 'contents' : [ | |
\ '* つかだあきひろ', | |
\ '* @akitsukada', | |
\ '* SetucoCMSとかコマンドなんでも読書会とか', | |
\ '* PHP/Ruby/C', | |
\ '* 3月に結婚 → 4月に無職', | |
\ '* 7/1からD社にはいりました', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : 'hope', | |
\ 'contents' : [ | |
\ '* やせたい', | |
\ ' やせてGLTに参加したい', | |
\ '* ー', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : '何度トテイになったろう', | |
\ 'contents' : [ | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : '何度トテイになったろう', | |
\ 'contents' : [ | |
\ '* クラシック音楽やってました', | |
\ '* バンドやってました', | |
\ ' → 東京きました', | |
\ ' → その間コールセンター勤めました', | |
\ '* もういっかい学生やりました', | |
\ '* SEになりました', | |
\ '* Webプログラマになりました', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : '先日某karaage系vim勉強会で', | |
\ 'contents' : [ | |
\ '* ある全裸系プログラマ(@sugyan)と語りました', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : '先日某karaage系vim勉強会で', | |
\ 'contents' : [ | |
\ ' 「僕らどこにむかって何になるんだろう」', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : '先日某karaage系vim勉強会で', | |
\ 'contents' : [ | |
\ '* ある銀河系サーバエンジニア(@kuwa_tw)は言いました', | |
\ ' 「◯ ◯ しかできないはイクナイ、何でも知るべき」', | |
\ ' 「その中で自分はサーバが好き、サーバ専門家」', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : 'あと、', | |
\ 'contents' : [ | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : '自信をもつって難しいすよね', | |
\ 'contents' : [ | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : 'カーソルが自由に移動できないと', | |
\ 'contents' : [ | |
\ '* 「うわっ...私のキータッチ、多すぎ...?」', | |
\ ' 27歳aさんの場合', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : '尊敬する@amachangが', | |
\ 'contents' : [ | |
\ '「自分のプログラムに自信を持つって難しい><」', | |
\ '「でもすっごい大事」', | |
\ '「怖いけど全部ブログでさらしてみる」', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : 'カーソルが自由に移動できないと', | |
\ 'contents' : [ | |
\ '* 「うわっ...私のキータッチ、多すぎ...?」', | |
\ ' 27歳aさんの場合', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : '☆ 師匠紹介のコーナー☆', | |
\ 'contents' : [ | |
\ '* ', | |
\ '* ', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : '☆ 師匠紹介のコーナー☆', | |
\ 'contents' : [ | |
\ '* @kogee さん', | |
\ '* ', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : '☆ 師匠紹介のコーナー☆', | |
\ 'contents' : [ | |
\ '* @kogee さん', | |
\ '* @kwappa さん', | |
\ ] | |
\ }, | |
\ { | |
\ 'title' : 'あー', | |
\ 'contents' : [ | |
\ '以上', | |
\ 'ご清聴ありがとうございました', | |
\ ] | |
\ },] | |
let self.current = 0 | |
let self.max = len(self.slides) | |
endfunction | |
function! s:Presentation.showPage() | |
call self.showPageTitle() | |
call self.showPageContents() | |
endfunction | |
function! s:Presentation.showPageTitle() | |
execute 'normal o ' | |
call setpos('.', [0, winline(), 1, winwidth(0)/5]) | |
execute 'normal i ' . self.currentSlide()['title'] | |
execute 'normal o ' | |
endfunction | |
function! s:Presentation.showPageContents() | |
for content in self.currentSlide()['contents'] | |
execute 'normal o ' | |
call setpos('.', [0, winline(), 1, winwidth(0)/6]) | |
execute 'normal i ' . content | |
endfor | |
endfunction | |
function! s:Presentation.currentSlide() | |
return self.slides[self.current] | |
endfunction | |
function! s:Presentation.clearPage() | |
execute 'normal ggdG' | |
endfunction | |
function! s:Presentation.showNextPage() | |
let nextIndex = self.current + 1 | |
if nextIndex == self.max | |
echo '最後のページです' | |
return | |
endif | |
call self.clearPage() | |
let self.current = nextIndex | |
call self.showPage() | |
endfunction | |
function! s:Presentation.showPrevPage() | |
let prevIndex = self.current - 1 | |
if prevIndex < 0 | |
echo '最初のページです' | |
return | |
endif | |
call self.clearPage() | |
let self.current = prevIndex | |
call self.showPage() | |
endfunction | |
" 次ページを表示 | |
function! s:ShowNextPage() | |
call s:Presentation.showNextPage() | |
endfunction | |
" 前ページを表示 | |
function! s:ShowPrevPage() | |
call s:Presentation.showPrevPage() | |
endfunction | |
" プレゼンテーションを有効化する | |
function! s:Enable() | |
call s:Presentation.load() | |
set paste | |
set ve=all | |
set laststatus=0 | |
" map <buffer> j :call s:Presentation.nextLine()<CR> | |
" map <buffer> k :call s:Presentation.prevLine()<CR> | |
map <buffer> h :call <SID>ShowPrevPage()<CR> | |
map <buffer> l :call <SID>ShowNextPage()<CR> | |
call s:Presentation.showPage() | |
endfunction | |
" プレゼンテーションを無効化する | |
function! s:Disable() | |
set nopaste | |
set ve= | |
set laststatus=2 | |
endfunction | |
command! -bar -narg=0 PresentationEnable call s:Enable() | |
command! -bar -narg=0 PresentationDisable call s:Disable() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment