├── Makefile ├── README ├── Replay.vmb ├── autoload ├── Replay.vim └── screencapture.sh ├── doc └── Replay.txt ├── plugin └── ReplayPlugin.vim └── post.pl /Makefile: -------------------------------------------------------------------------------- 1 | SCRIPT = $(wildcard plugin/*.vim) 2 | AUTOL = $(wildcard autoload/*.vim) 3 | DOC = $(wildcard doc/*.txt) 4 | PLUGIN = $(shell basename "$$PWD") 5 | VERSION = $(shell sed -n '/Version:/{s/^.*\(\S\.\S\+\)$$/\1/;p}' $(SCRIPT)) 6 | COMMENT = $(shell sed -n "/^$(VERSION)/,/^$$/{/$(VERSION)/b;/^$$/b;p}" ${DOC}) 7 | SH = autoload/screencapture.sh 8 | 9 | .PHONY: $(PLUGIN).vmb README 10 | 11 | all: uninstall vimball install README 12 | 13 | vimball: $(PLUGIN).vmb 14 | 15 | clean: 16 | rm -f *.vmb */*.orig *.~* .VimballRecord 17 | 18 | dist-clean: clean 19 | 20 | install: 21 | vim -N -c':so %' -c':q!' $(PLUGIN)-$(VERSION).vmb 22 | 23 | uninstall: 24 | vim -N -c':RmVimball' -c':q!' $(PLUGIN)-$(VERSION).vmb 25 | 26 | undo: 27 | for i in */*.orig; do mv -f "$$i" "$${i%.*}"; done 28 | 29 | README: 30 | cp -f $(DOC) README 31 | 32 | $(PLUGIN).vmb: 33 | rm -f $(PLUGIN)-$(VERSION).vmb 34 | vim -N -c 'ru! vimballPlugin.vim' -c ':call append("0", [ "$(SCRIPT)", "$(AUTOL)", "$(DOC)", "$(SH)"])' -c '$$d' -c ":%MkVimball $(PLUGIN)-$(VERSION) ." -c':q!' 35 | ln -f $(PLUGIN)-$(VERSION).vmb $(PLUGIN).vmb 36 | 37 | release: version all 38 | 39 | version: 40 | perl -i.orig -pne 'if (/Version:/) {s/\.(\d*)/sprintf(".%d", 1+$$1)/e}' ${SCRIPT} ${AUTOL} 41 | perl -i -pne 'if (/GetLatestVimScripts:/) {s/(\d+)\s+:AutoInstall:/sprintf("%d :AutoInstall:", 1+$$1)/e}' ${SCRIPT} ${AUTOL} 42 | #perl -i -pne 'if (/Last Change:/) {s/\d+\.\d+\.\d\+$$/sprintf("%s", `date -R`)/e}' ${SCRIPT} 43 | perl -i -pne 'if (/Last Change:/) {s/(:\s+).*\n/sprintf(": %s", `date -R`)/e}' ${SCRIPT} ${AUTOL} 44 | perl -i.orig -pne 'if (/Version:/) {s/\.(\d+).*\n/sprintf(".%d %s", 1+$$1, `date -R`)/e}' ${DOC} 45 | VERSION=$(shell sed -n '/Version:/{s/^.*\(\S\.\S\+\)$$/\1/;p}' $(SCRIPT)) 46 | 47 | upload: 48 | perl post.pl "$(PLUGIN)-$(VERSION).vmb" "$(VERSION)" "$(COMMENT)" 49 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | *Replay.txt* A plugin to record and replay your editing sessions 2 | 3 | Author: Christian Brabandt 4 | Version: 0.5 Wed, 14 Aug 2013 22:26:12 +0200 5 | 6 | Copyright: (c) 2009, 2010, 2011, 2012, 2013 by Christian Brabandt 7 | The VIM LICENSE applies to Replay.vim (see |copyright|) 8 | except use Replay.vim instead of "Vim". 9 | NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK. 10 | 11 | 12 | ============================================================================== 13 | 1. Contents *ReplayPlugin* 14 | 15 | 1. Contents.....................................: |ReplayPlugin| 16 | 2. Replay Manual................................: |Replay-manual| 17 | 3. Replay Configuration.........................: |Replay-config| 18 | 3.1 Replay Speed...............................: |Replay-speed| 19 | 3.2 Replay Recording...........................: |Replay-record| 20 | 4. Replay Feedback..............................: |Replay-feedback| 21 | 5. Replay History...............................: |Replay-history| 22 | 23 | ============================================================================== 24 | 2. Replay Manual *Replay-manual* 25 | 26 | Functionality 27 | 28 | This plugin allows you to record and replay your changes that have been done 29 | to a buffer. 30 | 31 | 32 | *:StartRecord* 33 | :StartRecord[!] [Tag] This will start a new record session, that will be 34 | called Tag. If [Tag] is not given, use the 35 | "Default" tag name. If the tag already exists, an 36 | error is given and it will be aborted. Use ! to 37 | overwrite an existing tag name. 38 | You can use to complete the available Tag 39 | names 40 | 41 | *:StopRecord* 42 | :StopRecord[!] [Tag] Recording Session for the Tag will stop at this 43 | change. 44 | If you don't enter a Tag name, the last started 45 | recording session will stop. 46 | You can use to complete the available Tag 47 | names 48 | 49 | *:Replay* 50 | :Replay [Tag] Start Replaying your Session, that is identified 51 | by the tag Tag. If Tag is not given, use the 52 | default tag "Default" 53 | You can use to complete the available Tag 54 | names 55 | 56 | *:ScreenCapture* 57 | :ScreenCapture[!] [-shell] [filename] 58 | 59 | If you have enabled screen capturing to video, 60 | this command will start a screen capturing session 61 | to video or stop it (if :ScreenCapture!) is used. 62 | If you used the -shell argument, a new shell will 63 | be started, else the current Vim session will be 64 | recorded. 65 | [filename] can optionally be given and 66 | will be the name of the recorded session with the 67 | date appended to it. See also |Replay-record| for 68 | how to enable it. 69 | 70 | *:ListRecords* 71 | :ListRecords Show which tags are available. This presents a 72 | little table that looks like this: 73 | 74 | Tag Starttime Start Stoptime Stop~ 75 | ===================================================================== 76 | abcd 27.08.2010 14:12:01 164 27.08.2010 14:12:11 168 77 | Default 27.08.2010 14:09:26 0 ------------------- 78 | 79 | That means one Recording called "abcd" was started in the undo-tree with the 80 | change number 164. (You can jump back to that change using :undo 164, see also 81 | |:undo|.) Recording time for that tag started on August, 27, 2010 at 14:12:01 82 | o'clock and recording will stop at change number 168 which was at 14:12:11 83 | o'clock. Please bear in mind, that the starting time for the Default-Tag can't 84 | exactly be given, but is the first time, any of the above commands was called. 85 | 86 | ============================================================================== 87 | 3 Replay Configuration *Replay-config* 88 | 89 | 3.1 Replay Speed *Replay-speed* 90 | 91 | You can configure the speed, with which to replay the changes, that have been 92 | done. By default, Replay.vim pauses for 200ms after every change. If you want 93 | to change this, set the variable g:replay_speed to a value in milliseconds in 94 | your |.vimrc| > 95 | 96 | let g:replay_speed = 300 97 | < 98 | will replay your editing session with slower and pauses for 300ms after every 99 | change. 100 | 101 | 3.2 Replay Recording *Replay-record* 102 | 103 | It is possible to record the replay using avconv/ffmeg. For this to work, you 104 | need ffmpeg/avconv installed and vim needs to be run on an X11-Server. To 105 | enable this, set the variable g:replay_record to 1 in your |.vimrc| like this: > 106 | 107 | 108 | let g:replay_record = 1 109 | < 110 | When the replay is started, it will be recorded using ffmpeg/avconv for 111 | screencapturing and the result will be saved as Vim_Recording_YYYYMMDD.mkv (in 112 | case you haven't specified an optional filename else it will be saved as 113 | filename_YYYYMMDD.mkv) in either the current working directory (|:pwd|) if it 114 | is writable or your $HOME directory. If you have used the optional -shell 115 | argument, a new |:sh| will be started. 116 | 117 | (Note, this currently works only on Unix/Linux and you need ffmpeg or avconv 118 | in your $PATH for this to work) 119 | 120 | ============================================================================== 121 | 4. Replay Feedback *Replay-feedback* 122 | 123 | Feedback is always welcome. If you like the plugin, please rate it at the 124 | vim-page: 125 | http://www.vim.org/scripts/script.php?script_id=3216 126 | 127 | You can also follow the development of the plugin at github: 128 | http://github.com/chrisbra/Replay 129 | 130 | Please don't hesitate to report any bugs to the maintainer, mentioned in the 131 | third line of this document. 132 | 133 | ============================================================================== 134 | 5. Replay History *Replay-history* 135 | 136 | 0.5: Aug 14, 2013 {{{2 137 | 138 | - improvements for |:ScreenCapture| capture 139 | 140 | 0.4: Feb 27, 2013 {{{1 141 | 142 | - disable folding 143 | - enable to screenrecord the replay using ffmpeg/avconv 144 | (fixes https://github.com/chrisbra/Replay/issues/1, 145 | suggested by David Jacobs, thanks!) 146 | 147 | 148 | 0.3: Aug 27, 2010 {{{1 149 | 150 | - Automatically stopp Recording for latest started Recording session 151 | (suggested by Salim Halim, thanks!) 152 | - Changed recording of time to use localtime() instead of storing a string 153 | - Better documentation for :ListRecordings 154 | - ListRecordings now also displays the change number (so you can easily jump 155 | to a change using :undo) 156 | 157 | 0.2: Aug 24, 2010 {{{1 158 | 159 | - Enabled |GLVS| 160 | - small bugfixes 161 | - changed default playback rate to 200ms 162 | 163 | 0.1: Aug 23, 2010 {{{1 164 | 165 | - Initial upload 166 | - development versions are available at the github repository 167 | - put plugin on a public repository (http://github.com/chrisbra/NrrwRgn) 168 | 169 | }}} 170 | ============================================================================== 171 | Modeline: {{{1 172 | vim:tw=78:ts=8:ft=help:et:fdm=marker:fdl=0:norl 173 | -------------------------------------------------------------------------------- /Replay.vmb: -------------------------------------------------------------------------------- 1 | " Vimball Archiver by Charles E. Campbell, Jr., Ph.D. 2 | UseVimball 3 | finish 4 | plugin/ReplayPlugin.vim [[[1 5 | 39 6 | " Replay.vim - Replay your editing Session 7 | " ------------------------------------------------------------- 8 | " Version: 0.5 9 | " Maintainer: Christian Brabandt 10 | " Last Change: Wed, 14 Aug 2013 22:26:12 +0200 11 | " 12 | " Script: http://www.vim.org/scripts/script.php?script_id=3216 13 | " Copyright: (c) 2009, 2010, 2011, 2012, 2013 by Christian Brabandt 14 | " The VIM LICENSE applies to NrrwRgn.vim 15 | " (see |copyright|) except use "Replay.vim" 16 | " instead of "Vim". 17 | " No warranty, express or implied. 18 | " *** *** Use At-Your-Own-Risk! *** *** 19 | " GetLatestVimScripts: 3216 6 :AutoInstall: Replay.vim 20 | " 21 | " Init: 22 | if exists("g:loaded_replay") || &cp || &ul == -1 23 | finish 24 | endif 25 | 26 | let g:loaded_replay = 0.1 27 | let s:cpo = &cpo 28 | set cpo&vim 29 | 30 | " User_Command: 31 | com! -bang -nargs=? -complete=custom,Replay#CompleteTags StartRecord :call Replay#TagState(, !empty("")) 32 | com! -complete=custom,Replay#CompleteTags -nargs=? StopRecord :call Replay#TagStopState() 33 | com! -nargs=? -complete=custom,Replay#CompleteTags Replay :call Replay#Replay() 34 | com! ListRecords :call Replay#ListStates() 35 | com! -bang -nargs=* -complete=customlist,ScreenRecordUsage ScreenRecord :call Replay#ScreenCapture((empty("") ? "on" : "off"), ) 36 | 37 | fu! ScreenRecordUsage(A,L,P) 38 | return ['[-shell] [filename] - Start Screen Capture [as filename] [and start a shell]', '! - Stop current recording session'] 39 | endfu 40 | 41 | " Restore: 42 | let &cpo=s:cpo 43 | unlet s:cpo 44 | " vim: ts=4 sts=4 fdm=marker com+=l\:\" fdm=syntax 45 | autoload/Replay.vim [[[1 46 | 293 47 | " Replay.vim - Replay your editing Session 48 | " ------------------------------------------------------------- 49 | " Version: 0.5 50 | " Maintainer: Christian Brabandt 51 | " Last Change: Wed, 14 Aug 2013 22:26:12 +0200 52 | " 53 | " Script: http://www.vim.org/scripts/script.php?script_id=3216 54 | " Copyright: (c) 2009, 2010, 2011, 2012, 2013 by Christian Brabandt 55 | " The VIM LICENSE applies to NrrwRgn.vim 56 | " (see |copyright|) except use "Replay.vim" 57 | " instead of "Vim". 58 | " No warranty, express or implied. 59 | " *** *** Use At-Your-Own-Risk! *** *** 60 | " GetLatestVimScripts: 3216 6 :AutoInstall: Replay.vim 61 | " 62 | let s:dir=fnamemodify(expand(""), ':p:h') 63 | fun! WarningMsg(msg) "{{{1 64 | echohl WarningMsg 65 | let msg = "ReplayPlugin: " . a:msg 66 | if exists(":unsilent") == 2 67 | unsilent echomsg msg 68 | else 69 | echomsg msg 70 | endif 71 | echohl Normal 72 | let v:errmsg = msg 73 | endfun 74 | 75 | fun! Init() "{{{1 76 | if !exists("b:replay_data") 77 | let b:replay_data={} 78 | let b:replay_data.Default={} 79 | let b:replay_data.Default.start=0 80 | let b:replay_data.Default.start_time=localtime() 81 | endif 82 | " Customization 83 | let s:replay_speed = (exists("g:replay_speed") ? g:replay_speed : 200) 84 | let s:replay_save = (exists("g:replay_record") ? g:replay_record : 0 ) 85 | let s:replay_record_param = {} 86 | if s:replay_save && 87 | \ !(executable("ffmpeg") || executable("avconv")) && 88 | \ !empty(expand("$DISPLAY")) 89 | " ffmpeg/avconv not available in $PATH or not running on X11 server 90 | let s:replay_save = 0 91 | else 92 | let s:replay_record_param['format'] = 'mkv' " could be mkv, mpg, avi etc... 93 | let s:replay_record_param['exe'] = ( executable("avconv") ? 'avconv' : 'ffmpeg') 94 | let s:replay_record_param['log'] = "/tmp/replay.log" 95 | let s:replay_record_param['opts'] = "-f x11grab -s hd720 -show_region 1 -framerate 10 -y " 96 | let s:replay_record_param['file'] = "Vim_Recording" 97 | endif 98 | if s:replay_save && exists("g:replay_record_param") 99 | call extend(s:replay_record_param, g:replay_record_param, 'force') 100 | endif 101 | endfun 102 | 103 | fun! LastChange() "{{{1 104 | redir => a | silent! undolist |redir end 105 | let b=split(a, "\n")[-1] 106 | if b !~ '\d' 107 | return 0 108 | endif 109 | return split(b)[0] 110 | endfun 111 | 112 | fun! MaxTagLength() "{{{1 113 | let list=keys(b:replay_data) 114 | call map(list, 'len(v:val)') 115 | return max(list) 116 | endfun 117 | 118 | fun! LastStartedRecording() "{{{1 119 | let a=copy(b:replay_data) 120 | call filter(a, '!exists("v:val.stop")') 121 | let key='' 122 | let time=0 123 | for item in keys(a) 124 | if a[item].start_time > time 125 | let time=a[item].start_time 126 | let key = item 127 | endif 128 | endfor 129 | return key 130 | endfun 131 | 132 | fun! Is(os) "{{{1 133 | if (a:os == "win") 134 | return has("win32") || has("win16") || has("win64") 135 | elseif (a:os == "mac") 136 | return has("mac") || has("macunix") 137 | elseif (a:os == "unix") 138 | return has("unix") || has("macunix") 139 | endif 140 | endfu 141 | fun! Replay#TagState(tag, bang) "{{{1 142 | call Init() 143 | let tag=(empty(a:tag) ? 'Default' : a:tag) 144 | if exists("b:replay_data.".tag) && !a:bang 145 | call WarningMsg("Tag " . tag . " already exists!") 146 | return 147 | else 148 | let b:replay_data[tag] = {} 149 | let b:replay_data[tag].start = changenr() 150 | let b:replay_data[tag].start_time = localtime() 151 | endif 152 | endfun 153 | 154 | fun! Replay#TagStopState(tag) "{{{1 155 | call Init() 156 | "let tag=(empty(a:tag) ? 'Default' : a:tag) 157 | let tag=(empty(a:tag) ? LastStartedRecording() : a:tag) 158 | if !exists("b:replay_data.".tag) "&& tag != 'Default' 159 | call WarningMsg("Tag " . tag . " not found!") 160 | return 161 | else 162 | let change=changenr() 163 | if tag == 'Default' 164 | let b:replay_data[tag] = {} 165 | endif 166 | " If stop is before start, swap both changes 167 | if !exists("b:replay_data[tag].start") 168 | let b:replay_data[tag].start = 0 169 | let b:replay_data[tag].stop = change 170 | let b:replay_data[tag].stop_time = localtime() 171 | elseif b:replay_data[tag].start > change 172 | let b:replay_data[tag].stop = b:replay_data[tag].start 173 | let b:replay_data[tag].start = change 174 | let b:replay_data[tag].stop_time = localtime() 175 | else 176 | let b:replay_data[tag].stop = change 177 | let b:replay_data[tag].stop_time = localtime() 178 | endif 179 | endif 180 | call WarningMsg("Stopped Recording of: " . tag . " tag") 181 | endfun 182 | 183 | fun! Replay#Replay(tag) "{{{1 184 | let _fen = &fen 185 | setl nofen " disable folding, so the changes can be better viewed. 186 | call Init() 187 | if empty(a:tag) 188 | let tag='Default' 189 | else 190 | let tag=a:tag 191 | endif 192 | if !exists("b:replay_data.".tag) 193 | call WarningMsg("Tag " . tag . " does not exist!") 194 | return 195 | endif 196 | let curpos=winsaveview() 197 | let undo_change=get(b:replay_data, tag) 198 | let stop_change=LastChange() 199 | if !stop_change 200 | call WarningMsg("No undo data to replay available!") 201 | return 202 | endif 203 | 204 | if undo_change.start==0 205 | undo 1 206 | norm! g- 207 | else 208 | if exists("undo_change.stop") 209 | let stop_change=undo_change.stop 210 | endif 211 | exe "undo " undo_change.start 212 | endif 213 | let t=changenr() 214 | " Record screen? 215 | if s:replay_save 216 | call Replay#ScreenCapture('on') 217 | endif 218 | while t < stop_change 219 | silent norm! g+ 220 | norm! zz 221 | redraw! 222 | exe "sleep " .s:replay_speed . 'm' 223 | let t=changenr() 224 | endw 225 | if s:replay_save 226 | call Replay#ScreenCapture('off') 227 | endif 228 | let &l:fen = _fen 229 | call winrestview(curpos) 230 | endfun 231 | 232 | fun! Replay#ScreenCapture(on, ...) "{{{1 233 | if a:on ==? 'on' 234 | " Start Screen Recording 235 | if get(g:, 'replay_record', 0) 236 | let s:isset_replay_record=1 237 | else 238 | let s:isset_replay_record=0 239 | let g:replay_record=1 240 | endif 241 | call Init() 242 | if !s:replay_save 243 | call WarningMsg("No screen recording software available!") 244 | return 245 | endif 246 | 247 | let args = [] 248 | if exists("a:1") && !empty(a:1) 249 | let args = matchlist(a:1, '^\s*\(-shell\)\?\s*\(\f\+\)\?') 250 | if !empty(args) && !empty(args[2]) 251 | let s:replay_record_param['file'] = args[2] 252 | endif 253 | endif 254 | 255 | " Check needed pre-conditions 256 | if exists("v:windowid") && 257 | \ executable("xwininfo") && 258 | \ !empty(expand("$DISPLAY")) && 259 | \ Is('unix') 260 | 261 | let geom = {} 262 | 263 | " get window coordinates 264 | let msg = system("LC_ALL=C xwininfo -id ". v:windowid. 265 | \ '|grep "Absolute\|Width\|Height"') 266 | let geom["x"] = matchstr(msg, '\s*Absolute upper-left X:\s\+\zs\d\+\ze\s*\n') + 0 267 | let geom["y"] = matchstr(msg, '\s*Absolute upper-left Y:\s\+\zs\d\+\ze\s*\n') + 0 268 | let geom["width"] = matchstr(msg, '\s*Width:\s\+\zs\d\+\ze\s*\n') + 0 269 | let geom["height"] = matchstr(msg, '\s*Height:\s\+\zs\d\+\ze\s*\n') + 0 270 | 271 | " record screen 272 | let cmd = printf('%s %s -i %s -vf crop=%d:%d:%d:%d %s/%s_%d.%s %s', 273 | \ s:replay_record_param['exe'], 274 | \ s:replay_record_param['opts'], 275 | \ (strlen($DISPLAY) == 2 ? $DISPLAY.'.0' : $DISPLAY), 276 | \ geom.width, geom.height, geom.x, geom.y, 277 | \ (filewritable(getcwd()) == 2 ? getcwd() : '$HOME'), 278 | \ s:replay_record_param['file'], 279 | \ strftime('%Y%m%d', localtime()), 280 | \ s:replay_record_param['format'], 281 | \ exists("s:replay_record_param['log']") ? 282 | \ '2> '. s:replay_record_param['log'] : '') 283 | let cmd = 'sh '. s:dir. '/screencapture.sh '. cmd 284 | if !exists("#ScreenCaptureQuit#VimLeave") 285 | " Stop screen recording when quitting vim 286 | augroup ScreenCaptureQuit 287 | au! 288 | au VimLeavePre * :call Replay#ScreenCapture('off') 289 | augroup end 290 | endif 291 | if !empty(args) && !empty(args[1]) 292 | echom "Starting Shell, press to return to this session" 293 | " give the user a possibility to read the message 294 | exe "sleep 2" 295 | let s:pid=system(cmd) 296 | exe ":sh" 297 | else 298 | let s:pid=system(cmd) 299 | " sleep shortly 300 | exe "sleep " .s:replay_speed . 'm' 301 | endif 302 | endif 303 | else 304 | " kill an existing screen recording session 305 | if exists("s:pid") && Is('unix') 306 | call system('kill '. s:pid) 307 | endif 308 | if exists("s:isset_replay_record") && s:isset_replay_record == 0 309 | unlet! g:replay_record 310 | endif 311 | endif 312 | endfu 313 | 314 | fun! Replay#ListStates() "{{{1 315 | call Init() 316 | echohl Title 317 | let len=MaxTagLength() 318 | if len==0 319 | let len=3 320 | endif 321 | echo printf("%*.*s\t%s\t\t%s\t\t%s\t%s\n",len,len,"Tag", "Starttime", "Start", "Stoptime", "Stop") 322 | echohl Normal 323 | echo printf("%s", '===================================================================================') 324 | for key in keys(b:replay_data) 325 | echo printf("%*.*s\t%s\t%s\t%s\t%s", len,len, key, 326 | \(exists("b:replay_data[key].start_time") ? strftime("%d.%m.%Y %H:%M:%S", b:replay_data[key].start_time) : repeat('-',19)), 327 | \(exists("b:replay_data[key].start") ? b:replay_data[key].start : ' '), 328 | \(exists("b:replay_data[key].stop_time") ? strftime("%d.%m.%Y %H:%M:%S", b:replay_data[key].stop_time) : repeat('-',19)), 329 | \(exists("b:replay_data[key].stop") ? b:replay_data[key].stop : ' ')) 330 | endfor 331 | endfun 332 | 333 | fun! Replay#CompleteTags(A,L,P) "{{{1 334 | cal Init() 335 | return join(sort(keys(b:replay_data)),"\n") 336 | endfun 337 | 338 | " Modeline "{{{1 339 | " vim: ts=4 sts=4 fdm=marker com+=l\:\" fdl=0 340 | doc/Replay.txt [[[1 341 | 172 342 | *Replay.txt* A plugin to record and replay your editing sessions 343 | 344 | Author: Christian Brabandt 345 | Version: 0.5 Wed, 14 Aug 2013 22:26:12 +0200 346 | 347 | Copyright: (c) 2009, 2010, 2011, 2012, 2013 by Christian Brabandt 348 | The VIM LICENSE applies to Replay.vim (see |copyright|) 349 | except use Replay.vim instead of "Vim". 350 | NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK. 351 | 352 | 353 | ============================================================================== 354 | 1. Contents *ReplayPlugin* 355 | 356 | 1. Contents.....................................: |ReplayPlugin| 357 | 2. Replay Manual................................: |Replay-manual| 358 | 3. Replay Configuration.........................: |Replay-config| 359 | 3.1 Replay Speed...............................: |Replay-speed| 360 | 3.2 Replay Recording...........................: |Replay-record| 361 | 4. Replay Feedback..............................: |Replay-feedback| 362 | 5. Replay History...............................: |Replay-history| 363 | 364 | ============================================================================== 365 | 2. Replay Manual *Replay-manual* 366 | 367 | Functionality 368 | 369 | This plugin allows you to record and replay your changes that have been done 370 | to a buffer. 371 | 372 | 373 | *:StartRecord* 374 | :StartRecord[!] [Tag] This will start a new record session, that will be 375 | called Tag. If [Tag] is not given, use the 376 | "Default" tag name. If the tag already exists, an 377 | error is given and it will be aborted. Use ! to 378 | overwrite an existing tag name. 379 | You can use to complete the available Tag 380 | names 381 | 382 | *:StopRecord* 383 | :StopRecord[!] [Tag] Recording Session for the Tag will stop at this 384 | change. 385 | If you don't enter a Tag name, the last started 386 | recording session will stop. 387 | You can use to complete the available Tag 388 | names 389 | 390 | *:Replay* 391 | :Replay [Tag] Start Replaying your Session, that is identified 392 | by the tag Tag. If Tag is not given, use the 393 | default tag "Default" 394 | You can use to complete the available Tag 395 | names 396 | 397 | *:ScreenCapture* 398 | :ScreenCapture[!] [-shell] [filename] 399 | 400 | If you have enabled screen capturing to video, 401 | this command will start a screen capturing session 402 | to video or stop it (if :ScreenCapture!) is used. 403 | If you used the -shell argument, a new shell will 404 | be started, else the current Vim session will be 405 | recorded. 406 | [filename] can optionally be given and 407 | will be the name of the recorded session with the 408 | date appended to it. See also |Replay-record| for 409 | how to enable it. 410 | 411 | *:ListRecords* 412 | :ListRecords Show which tags are available. This presents a 413 | little table that looks like this: 414 | 415 | Tag Starttime Start Stoptime Stop~ 416 | ===================================================================== 417 | abcd 27.08.2010 14:12:01 164 27.08.2010 14:12:11 168 418 | Default 27.08.2010 14:09:26 0 ------------------- 419 | 420 | That means one Recording called "abcd" was started in the undo-tree with the 421 | change number 164. (You can jump back to that change using :undo 164, see also 422 | |:undo|.) Recording time for that tag started on August, 27, 2010 at 14:12:01 423 | o'clock and recording will stop at change number 168 which was at 14:12:11 424 | o'clock. Please bear in mind, that the starting time for the Default-Tag can't 425 | exactly be given, but is the first time, any of the above commands was called. 426 | 427 | ============================================================================== 428 | 3 Replay Configuration *Replay-config* 429 | 430 | 3.1 Replay Speed *Replay-speed* 431 | 432 | You can configure the speed, with which to replay the changes, that have been 433 | done. By default, Replay.vim pauses for 200ms after every change. If you want 434 | to change this, set the variable g:replay_speed to a value in milliseconds in 435 | your |.vimrc| > 436 | 437 | let g:replay_speed = 300 438 | < 439 | will replay your editing session with slower and pauses for 300ms after every 440 | change. 441 | 442 | 3.2 Replay Recording *Replay-record* 443 | 444 | It is possible to record the replay using avconv/ffmeg. For this to work, you 445 | need ffmpeg/avconv installed and vim needs to be run on an X11-Server. To 446 | enable this, set the variable g:replay_record to 1 in your |.vimrc| like this: > 447 | 448 | 449 | let g:replay_record = 1 450 | < 451 | When the replay is started, it will be recorded using ffmpeg/avconv for 452 | screencapturing and the result will be saved as Vim_Recording_YYYYMMDD.mkv (in 453 | case you haven't specified an optional filename else it will be saved as 454 | filename_YYYYMMDD.mkv) in either the current working directory (|:pwd|) if it 455 | is writable or your $HOME directory. If you have used the optional -shell 456 | argument, a new |:sh| will be started. 457 | 458 | (Note, this currently works only on Unix/Linux and you need ffmpeg or avconv 459 | in your $PATH for this to work) 460 | 461 | ============================================================================== 462 | 4. Replay Feedback *Replay-feedback* 463 | 464 | Feedback is always welcome. If you like the plugin, please rate it at the 465 | vim-page: 466 | http://www.vim.org/scripts/script.php?script_id=3216 467 | 468 | You can also follow the development of the plugin at github: 469 | http://github.com/chrisbra/Replay 470 | 471 | Please don't hesitate to report any bugs to the maintainer, mentioned in the 472 | third line of this document. 473 | 474 | ============================================================================== 475 | 5. Replay History *Replay-history* 476 | 477 | 0.5: Aug 14, 2013 {{{2 478 | 479 | - improvements for |:ScreenCapture| capture 480 | 481 | 0.4: Feb 27, 2013 {{{1 482 | 483 | - disable folding 484 | - enable to screenrecord the replay using ffmpeg/avconv 485 | (fixes https://github.com/chrisbra/Replay/issues/1, 486 | suggested by David Jacobs, thanks!) 487 | 488 | 489 | 0.3: Aug 27, 2010 {{{1 490 | 491 | - Automatically stopp Recording for latest started Recording session 492 | (suggested by Salim Halim, thanks!) 493 | - Changed recording of time to use localtime() instead of storing a string 494 | - Better documentation for :ListRecordings 495 | - ListRecordings now also displays the change number (so you can easily jump 496 | to a change using :undo) 497 | 498 | 0.2: Aug 24, 2010 {{{1 499 | 500 | - Enabled |GLVS| 501 | - small bugfixes 502 | - changed default playback rate to 200ms 503 | 504 | 0.1: Aug 23, 2010 {{{1 505 | 506 | - Initial upload 507 | - development versions are available at the github repository 508 | - put plugin on a public repository (http://github.com/chrisbra/NrrwRgn) 509 | 510 | }}} 511 | ============================================================================== 512 | Modeline: {{{1 513 | vim:tw=78:ts=8:ft=help:et:fdm=marker:fdl=0:norl 514 | autoload/screencapture.sh [[[1 515 | 7 516 | #!/bin/sh 517 | echo "Starting recording: `date -R`" >&2 518 | echo "Parameters: $@" >&2 519 | echo "==============================" >&2 520 | $@ & 521 | # return pid of screen capturing process so we can kill it later 522 | echo $! 523 | -------------------------------------------------------------------------------- /autoload/Replay.vim: -------------------------------------------------------------------------------- 1 | " Replay.vim - Replay your editing Session 2 | " ------------------------------------------------------------- 3 | " Version: 0.5 4 | " Maintainer: Christian Brabandt 5 | " Last Change: Wed, 14 Aug 2013 22:26:12 +0200 6 | " 7 | " Script: http://www.vim.org/scripts/script.php?script_id=3216 8 | " Copyright: (c) 2009, 2010, 2011, 2012, 2013 by Christian Brabandt 9 | " The VIM LICENSE applies to NrrwRgn.vim 10 | " (see |copyright|) except use "Replay.vim" 11 | " instead of "Vim". 12 | " No warranty, express or implied. 13 | " *** *** Use At-Your-Own-Risk! *** *** 14 | " GetLatestVimScripts: 3216 6 :AutoInstall: Replay.vim 15 | " 16 | let s:dir=fnamemodify(expand(""), ':p:h') 17 | fun! WarningMsg(msg) "{{{1 18 | echohl WarningMsg 19 | let msg = "ReplayPlugin: " . a:msg 20 | if exists(":unsilent") == 2 21 | unsilent echomsg msg 22 | else 23 | echomsg msg 24 | endif 25 | echohl Normal 26 | let v:errmsg = msg 27 | endfun 28 | 29 | fun! Init() "{{{1 30 | if !exists("b:replay_data") 31 | let b:replay_data={} 32 | let b:replay_data.Default={} 33 | let b:replay_data.Default.start=0 34 | let b:replay_data.Default.start_time=localtime() 35 | endif 36 | " Customization 37 | let s:replay_speed = (exists("g:replay_speed") ? g:replay_speed : 200) 38 | let s:replay_save = (exists("g:replay_record") ? g:replay_record : 0 ) 39 | let s:replay_record_param = {} 40 | if s:replay_save && 41 | \ !(executable("ffmpeg") || executable("avconv")) && 42 | \ !empty(expand("$DISPLAY")) 43 | " ffmpeg/avconv not available in $PATH or not running on X11 server 44 | let s:replay_save = 0 45 | else 46 | let s:replay_record_param['format'] = 'mkv' " could be mkv, mpg, avi etc... 47 | let s:replay_record_param['exe'] = ( executable("avconv") ? 'avconv' : 'ffmpeg') 48 | let s:replay_record_param['log'] = "/tmp/replay.log" 49 | let s:replay_record_param['opts'] = "-f x11grab -s hd720 -show_region 1 -framerate 10 -y " 50 | let s:replay_record_param['file'] = "Vim_Recording" 51 | endif 52 | if s:replay_save && exists("g:replay_record_param") 53 | call extend(s:replay_record_param, g:replay_record_param, 'force') 54 | endif 55 | endfun 56 | 57 | fun! LastChange() "{{{1 58 | redir => a | silent! undolist |redir end 59 | let b=split(a, "\n")[-1] 60 | if b !~ '\d' 61 | return 0 62 | endif 63 | return split(b)[0] 64 | endfun 65 | 66 | fun! MaxTagLength() "{{{1 67 | let list=keys(b:replay_data) 68 | call map(list, 'len(v:val)') 69 | return max(list) 70 | endfun 71 | 72 | fun! LastStartedRecording() "{{{1 73 | let a=copy(b:replay_data) 74 | call filter(a, '!exists("v:val.stop")') 75 | let key='' 76 | let time=0 77 | for item in keys(a) 78 | if a[item].start_time > time 79 | let time=a[item].start_time 80 | let key = item 81 | endif 82 | endfor 83 | return key 84 | endfun 85 | 86 | fun! Is(os) "{{{1 87 | if (a:os == "win") 88 | return has("win32") || has("win16") || has("win64") 89 | elseif (a:os == "mac") 90 | return has("mac") || has("macunix") 91 | elseif (a:os == "unix") 92 | return has("unix") || has("macunix") 93 | endif 94 | endfu 95 | fun! StopRecord() "{{{1 96 | " kill an existing screen recording session 97 | if exists("s:pid") 98 | if Is('unix') 99 | call system('kill '. s:pid) 100 | elseif Is('win') 101 | call system('taskkill /pid '. s:pid) 102 | endif 103 | endif 104 | if exists("s:isset_replay_record") && s:isset_replay_record == 0 105 | unlet! g:replay_record 106 | endif 107 | endfu 108 | fun! Replay#TagState(tag, bang) "{{{1 109 | call Init() 110 | let tag=(empty(a:tag) ? 'Default' : a:tag) 111 | if exists("b:replay_data.".tag) && !a:bang 112 | call WarningMsg("Tag " . tag . " already exists!") 113 | return 114 | else 115 | let b:replay_data[tag] = {} 116 | let b:replay_data[tag].start = changenr() 117 | let b:replay_data[tag].start_time = localtime() 118 | endif 119 | endfun 120 | 121 | fun! Replay#TagStopState(tag) "{{{1 122 | call Init() 123 | "let tag=(empty(a:tag) ? 'Default' : a:tag) 124 | if exists("s:pid") 125 | call StopRecord() 126 | return 127 | endif 128 | let tag=(empty(a:tag) ? LastStartedRecording() : a:tag) 129 | if !exists("b:replay_data.".tag) "&& tag != 'Default' 130 | call WarningMsg("Tag " . tag . " not found!") 131 | return 132 | else 133 | let change=changenr() 134 | if tag == 'Default' 135 | let b:replay_data[tag] = {} 136 | endif 137 | " If stop is before start, swap both changes 138 | if !exists("b:replay_data[tag].start") 139 | let b:replay_data[tag].start = 0 140 | let b:replay_data[tag].stop = change 141 | let b:replay_data[tag].stop_time = localtime() 142 | elseif b:replay_data[tag].start > change 143 | let b:replay_data[tag].stop = b:replay_data[tag].start 144 | let b:replay_data[tag].start = change 145 | let b:replay_data[tag].stop_time = localtime() 146 | else 147 | let b:replay_data[tag].stop = change 148 | let b:replay_data[tag].stop_time = localtime() 149 | endif 150 | endif 151 | call WarningMsg("Stopped Recording of: " . tag . " tag") 152 | endfun 153 | 154 | fun! Replay#Replay(tag) "{{{1 155 | let _fen = &fen 156 | setl nofen " disable folding, so the changes can be better viewed. 157 | call Init() 158 | if empty(a:tag) 159 | let tag='Default' 160 | else 161 | let tag=a:tag 162 | endif 163 | if !exists("b:replay_data.".tag) 164 | call WarningMsg("Tag " . tag . " does not exist!") 165 | return 166 | endif 167 | let curpos=winsaveview() 168 | let undo_change=get(b:replay_data, tag) 169 | let stop_change=LastChange() 170 | if !stop_change 171 | call WarningMsg("No undo data to replay available!") 172 | return 173 | endif 174 | 175 | if undo_change.start==0 176 | undo 1 177 | norm! g- 178 | else 179 | if exists("undo_change.stop") 180 | let stop_change=undo_change.stop 181 | endif 182 | exe "undo " undo_change.start 183 | endif 184 | let t=changenr() 185 | " Record screen? 186 | if s:replay_save 187 | call Replay#ScreenCapture('on') 188 | endif 189 | while t < stop_change 190 | silent norm! g+ 191 | norm! zz 192 | redraw! 193 | exe "sleep " .s:replay_speed . 'm' 194 | let t=changenr() 195 | endw 196 | if s:replay_save 197 | call Replay#ScreenCapture('off') 198 | endif 199 | let &l:fen = _fen 200 | call winrestview(curpos) 201 | endfun 202 | 203 | fun! Replay#ScreenCapture(on, ...) "{{{1 204 | if a:on ==? 'on' 205 | " Start Screen Recording 206 | if get(g:, 'replay_record', 0) 207 | let s:isset_replay_record=1 208 | else 209 | let s:isset_replay_record=0 210 | let g:replay_record=1 211 | endif 212 | call Init() 213 | if !s:replay_save 214 | call WarningMsg("No screen recording software available!") 215 | return 216 | endif 217 | 218 | let args = [] 219 | if exists("a:1") && !empty(a:1) 220 | let args = matchlist(a:1, '^\s*\(-shell\)\?\s*\(-debug\)\?\s*\(\f\+\)\?') 221 | if !empty(args) && !empty(args[3]) 222 | let s:replay_record_param['file'] = args[3] 223 | endif 224 | endif 225 | 226 | " Check needed pre-conditions 227 | if exists("v:windowid") && 228 | \ executable("xwininfo") && 229 | \ !empty(expand("$DISPLAY")) && 230 | \ Is('unix') 231 | 232 | let geom = {} 233 | 234 | " get window coordinates 235 | let msg = system("LC_ALL=C xwininfo -id ". v:windowid. 236 | \ '|grep "Absolute\|Width\|Height"') 237 | let geom["x"] = matchstr(msg, '\s*Absolute upper-left X:\s\+\zs\d\+\ze\s*\n') + 0 238 | let geom["y"] = matchstr(msg, '\s*Absolute upper-left Y:\s\+\zs\d\+\ze\s*\n') + 0 239 | let geom["width"] = matchstr(msg, '\s*Width:\s\+\zs\d\+\ze\s*\n') + 0 240 | let geom["height"] = matchstr(msg, '\s*Height:\s\+\zs\d\+\ze\s*\n') + 0 241 | 242 | " record screen 243 | if s:replay_record_param['file'] =~ '.gif$' && executable('byzanz-record') 244 | " try recording using byzanz 245 | let cmd = printf('byzanz-record --display=%s --height=%s --width=%s --x=%s --y=%s %s %s', 246 | \ (strlen($DISPLAY) == 2 ? $DISPLAY.'.0' : $DISPLAY), 247 | \ geom.height, geom.width, geom.x, geom.y, 248 | \ s:replay_record_param['file'], 249 | \ exists("s:replay_record_param['log']") ? 250 | \ '2> '. s:replay_record_param['log'] : '') 251 | else 252 | " fall back using ffmpeg/avconv 253 | let cmd = printf('%s %s -s %sx%s -i %s+%d,%d %s/%s_%d.%s %s', 254 | \ s:replay_record_param['exe'], 255 | \ s:replay_record_param['opts'], 256 | \ geom.width, geom.height, 257 | \ (strlen($DISPLAY) == 2 ? $DISPLAY.'.0' : $DISPLAY), 258 | \ geom.x, geom.y, 259 | \ (filewritable(getcwd()) == 2 ? getcwd() : '$HOME'), 260 | \ s:replay_record_param['file'], 261 | \ strftime('%Y%m%d', localtime()), 262 | \ s:replay_record_param['format'], 263 | \ exists("s:replay_record_param['log']") ? 264 | \ '2> '. s:replay_record_param['log'] : '') 265 | endif 266 | let cmd = 'sh '. s:dir. '/screencapture.sh '. cmd 267 | if !exists("#ScreenCaptureQuit#VimLeave") 268 | " Stop screen recording when quitting vim 269 | augroup ScreenCaptureQuit 270 | au! 271 | au VimLeavePre * :call Replay#ScreenCapture('off') 272 | augroup end 273 | endif 274 | if !empty(args) && !empty(args[1]) 275 | echom "Starting Shell, press to return to this session" 276 | " give the user a possibility to read the message 277 | exe "sleep 2" 278 | let s:pid=system(cmd) 279 | exe ":sh" 280 | elseif !empty(args) && !empty(args[2]) 281 | echo cmd 282 | let @+=cmd 283 | else 284 | let s:pid=system(cmd) 285 | " sleep shortly 286 | exe "sleep " .s:replay_speed . 'm' 287 | endif 288 | endif 289 | else 290 | call StopRecord() 291 | endif 292 | endfu 293 | 294 | fun! Replay#ListStates() "{{{1 295 | call Init() 296 | echohl Title 297 | let len=MaxTagLength() 298 | if len==0 299 | let len=3 300 | endif 301 | echo printf("%*.*s\t%s\t\t%s\t\t%s\t%s\n",len,len,"Tag", "Starttime", "Start", "Stoptime", "Stop") 302 | echohl Normal 303 | echo printf("%s", '===================================================================================') 304 | for key in keys(b:replay_data) 305 | echo printf("%*.*s\t%s\t%s\t%s\t%s", len,len, key, 306 | \(exists("b:replay_data[key].start_time") ? strftime("%d.%m.%Y %H:%M:%S", b:replay_data[key].start_time) : repeat('-',19)), 307 | \(exists("b:replay_data[key].start") ? b:replay_data[key].start : ' '), 308 | \(exists("b:replay_data[key].stop_time") ? strftime("%d.%m.%Y %H:%M:%S", b:replay_data[key].stop_time) : repeat('-',19)), 309 | \(exists("b:replay_data[key].stop") ? b:replay_data[key].stop : ' ')) 310 | endfor 311 | endfun 312 | 313 | fun! Replay#CompleteTags(A,L,P) "{{{1 314 | cal Init() 315 | return join(sort(keys(b:replay_data)),"\n") 316 | endfun 317 | 318 | " Modeline "{{{1 319 | " vim: ts=4 sts=4 fdm=marker com+=l\:\" fdl=0 320 | -------------------------------------------------------------------------------- /autoload/screencapture.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "Starting recording: `date -R`" >&2 3 | echo "Parameters: $@" >&2 4 | echo "==============================" >&2 5 | $@ & 6 | # return pid of screen capturing process so we can kill it later 7 | echo $! 8 | -------------------------------------------------------------------------------- /doc/Replay.txt: -------------------------------------------------------------------------------- 1 | *Replay.txt* A plugin to record and replay your editing sessions 2 | 3 | Author: Christian Brabandt 4 | Version: 0.5 Wed, 14 Aug 2013 22:26:12 +0200 5 | 6 | Copyright: (c) 2009-2013 by Christian Brabandt 7 | The VIM LICENSE applies to Replay.vim (see |copyright|) 8 | except use Replay.vim instead of "Vim". 9 | NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK. 10 | 11 | 12 | ============================================================================== 13 | 1. Contents *ReplayPlugin* 14 | 15 | 1. Contents.....................................: |ReplayPlugin| 16 | 2. Replay Manual................................: |Replay-manual| 17 | 3. Replay Configuration.........................: |Replay-config| 18 | 3.1 Replay Speed...............................: |Replay-speed| 19 | 3.2 Replay Recording...........................: |Replay-record| 20 | 4. Replay Feedback..............................: |Replay-feedback| 21 | 5. Replay History...............................: |Replay-history| 22 | 23 | ============================================================================== 24 | 2. Replay Manual *Replay-manual* 25 | 26 | Functionality 27 | 28 | This plugin allows you to record and replay your changes that have been done 29 | to a buffer. 30 | 31 | 32 | *:StartRecord* 33 | :StartRecord[!] [Tag] This will start a new record session, that will be 34 | called Tag. If [Tag] is not given, use the 35 | "Default" tag name. If the tag already exists, an 36 | error is given and it will be aborted. Use ! to 37 | overwrite an existing tag name. 38 | You can use to complete the available Tag 39 | names 40 | 41 | *:StopRecord* 42 | :StopRecord[!] [Tag] Recording Session for the Tag will stop at this 43 | change. 44 | If you don't enter a Tag name, the last started 45 | recording session will stop. 46 | You can use to complete the available Tag 47 | names 48 | If a |:ScreenCapture| session is active, kills it. 49 | 50 | *:Replay* 51 | :Replay [Tag] Start Replaying your Session, that is identified 52 | by the tag Tag. If Tag is not given, use the 53 | default tag "Default" 54 | You can use to complete the available Tag 55 | names 56 | 57 | *:ScreenCapture* 58 | :ScreenCapture[!] [-shell] [-debug] [filename] 59 | 60 | If you have enabled screen capturing to video, 61 | this command will start a screen capturing session 62 | to video or stop it (if :ScreenCapture!) is used. 63 | If you used the -shell argument, a new shell will 64 | be started, else the current Vim session will be 65 | recorded. 66 | If -debug is used, it will only echo the command 67 | to execute (and copy it to the clipboard) 68 | [filename] can optionally be given and 69 | will be the name of the recorded session with the 70 | date appended to it. If the filename ends with 71 | ".gif" and byzanz-record is installed, it will be 72 | used for recording (but it will only record 10 73 | seconds). 74 | See also |Replay-record| for how to enable it. 75 | 76 | *:ListRecords* 77 | :ListRecords Show which tags are available. This presents a 78 | little table that looks like this: 79 | 80 | Tag Starttime Start Stoptime Stop~ 81 | ===================================================================== 82 | abcd 27.08.2010 14:12:01 164 27.08.2010 14:12:11 168 83 | Default 27.08.2010 14:09:26 0 ------------------- 84 | 85 | That means one Recording called "abcd" was started in the undo-tree with the 86 | change number 164. (You can jump back to that change using :undo 164, see also 87 | |:undo|.) Recording time for that tag started on August, 27, 2010 at 14:12:01 88 | o'clock and recording will stop at change number 168 which was at 14:12:11 89 | o'clock. Please bear in mind, that the starting time for the Default-Tag can't 90 | exactly be given, but is the first time, any of the above commands was called. 91 | 92 | ============================================================================== 93 | 3 Replay Configuration *Replay-config* 94 | 95 | 3.1 Replay Speed *Replay-speed* 96 | 97 | You can configure the speed, with which to replay the changes, that have been 98 | done. By default, Replay.vim pauses for 200ms after every change. If you want 99 | to change this, set the variable g:replay_speed to a value in milliseconds in 100 | your |.vimrc| > 101 | 102 | let g:replay_speed = 300 103 | < 104 | will replay your editing session with slower and pauses for 300ms after every 105 | change. 106 | 107 | 3.2 Replay Recording *Replay-record* 108 | 109 | It is possible to record the replay using avconv/ffmeg. For this to work, you 110 | need ffmpeg/avconv installed and vim needs to be run on an X11-Server. To 111 | enable this, set the variable g:replay_record to 1 in your |.vimrc| like this: > 112 | 113 | 114 | let g:replay_record = 1 115 | < 116 | When the replay is started, it will be recorded using ffmpeg/avconv for 117 | screencapturing and the result will be saved as Vim_Recording_YYYYMMDD.mkv (in 118 | case you haven't specified an optional filename else it will be saved as 119 | filename_YYYYMMDD.mkv) in either the current working directory (|:pwd|) if it 120 | is writable or your $HOME directory. If you have used the optional -shell 121 | argument, a new |:sh| will be started. 122 | 123 | (Note, this currently works only on Unix/Linux and you need ffmpeg or avconv 124 | in your $PATH for this to work) 125 | 126 | ============================================================================== 127 | 4. Replay Feedback *Replay-feedback* 128 | 129 | Feedback is always welcome. If you like the plugin, please rate it at the 130 | vim-page: 131 | http://www.vim.org/scripts/script.php?script_id=3216 132 | 133 | You can also follow the development of the plugin at github: 134 | http://github.com/chrisbra/Replay 135 | 136 | Please don't hesitate to report any bugs to the maintainer, mentioned in the 137 | third line of this document. 138 | 139 | ============================================================================== 140 | 5. Replay History *Replay-history* 141 | 142 | 0.6 (unreleased): 143 | - -debug argument for |:ScreenCapture| 144 | - |:StopRecord| also kills an active |:ScreenCapture| 145 | 146 | 0.5: Aug 14, 2013 {{{2 147 | 148 | - improvements for |:ScreenCapture| capture 149 | 150 | 0.4: Feb 27, 2013 {{{1 151 | 152 | - disable folding 153 | - enable to screenrecord the replay using ffmpeg/avconv 154 | (fixes https://github.com/chrisbra/Replay/issues/1, 155 | suggested by David Jacobs, thanks!) 156 | 157 | 158 | 0.3: Aug 27, 2010 {{{1 159 | 160 | - Automatically stopp Recording for latest started Recording session 161 | (suggested by Salim Halim, thanks!) 162 | - Changed recording of time to use localtime() instead of storing a string 163 | - Better documentation for :ListRecordings 164 | - ListRecordings now also displays the change number (so you can easily jump 165 | to a change using :undo) 166 | 167 | 0.2: Aug 24, 2010 {{{1 168 | 169 | - Enabled |GLVS| 170 | - small bugfixes 171 | - changed default playback rate to 200ms 172 | 173 | 0.1: Aug 23, 2010 {{{1 174 | 175 | - Initial upload 176 | - development versions are available at the github repository 177 | - put plugin on a public repository (http://github.com/chrisbra/NrrwRgn) 178 | 179 | }}} 180 | ============================================================================== 181 | Modeline: {{{1 182 | vim:tw=78:ts=8:ft=help:et:fdm=marker:fdl=0:norl 183 | -------------------------------------------------------------------------------- /plugin/ReplayPlugin.vim: -------------------------------------------------------------------------------- 1 | " Replay.vim - Replay your editing Session 2 | " ------------------------------------------------------------- 3 | " Version: 0.5 4 | " Maintainer: Christian Brabandt 5 | " Last Change: Wed, 14 Aug 2013 22:26:12 +0200 6 | " 7 | " Script: http://www.vim.org/scripts/script.php?script_id=3216 8 | " Copyright: (c) 2009, 2010, 2011, 2012, 2013 by Christian Brabandt 9 | " The VIM LICENSE applies to NrrwRgn.vim 10 | " (see |copyright|) except use "Replay.vim" 11 | " instead of "Vim". 12 | " No warranty, express or implied. 13 | " *** *** Use At-Your-Own-Risk! *** *** 14 | " GetLatestVimScripts: 3216 6 :AutoInstall: Replay.vim 15 | " 16 | " Init: 17 | if exists("g:loaded_replay") || &cp || &ul == -1 18 | finish 19 | endif 20 | 21 | let g:loaded_replay = "0.1" 22 | let s:cpo = &cpo 23 | set cpo&vim 24 | 25 | " User_Command: 26 | com! -bang -nargs=? -complete=custom,Replay#CompleteTags StartRecord :call Replay#TagState(, !empty("")) 27 | com! -complete=custom,Replay#CompleteTags -nargs=? StopRecord :call Replay#TagStopState() 28 | com! -nargs=? -complete=custom,Replay#CompleteTags Replay :call Replay#Replay() 29 | com! ListRecords :call Replay#ListStates() 30 | com! -bang -nargs=* -complete=customlist,ScreenRecordUsage ScreenRecord :call Replay#ScreenCapture((empty("") ? "on" : "off"), ) 31 | 32 | fu! ScreenRecordUsage(A,L,P) 33 | return ['[-shell] [filename] - Start Screen Capture [as filename] [and start a shell]', '! - Stop current recording session'] 34 | endfu 35 | 36 | " Restore: 37 | let &cpo=s:cpo 38 | unlet s:cpo 39 | " vim: ts=4 sts=4 fdm=marker com+=l\:\" fdm=syntax 40 | -------------------------------------------------------------------------------- /post.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | 5 | use WWW::Mechanize; 6 | 7 | sub GetPassword() { 8 | my $i=0; 9 | my @pass; 10 | my $passfile="./vim_passfile"; # line1: username, line2: password 11 | open(PASS, '<',$passfile) or die "Can't open passwordfile: $passfile\n"; 12 | while(){ 13 | chomp; 14 | $pass[$i++] = $_; 15 | } 16 | close(PASS); 17 | return @pass; 18 | } 19 | 20 | my $sid=3216; 21 | my $file; 22 | my @files=glob('*.vmb'); 23 | #my $scriptversion=shift @ARGV; 24 | my $scriptversion = 0; 25 | my $versioncomment=shift @ARGV; 26 | unless ($versioncomment){ 27 | print "Please enter comment!\n"; 28 | exit; 29 | } 30 | $versioncomment.="\n(automatically uploaded)"; 31 | 32 | 33 | my @userpasswordpair = GetPassword(); 34 | for (@files) { 35 | my $f = $_ if [ -f $_ ] && $_ =~ /\w+-[^.]+\.(\d+)\.vmb/; 36 | if ($1 > $scriptversion) { 37 | $scriptversion=$1; 38 | $file = $f; 39 | } 40 | } 41 | 42 | my $mech=WWW::Mechanize->new(autocheck => 1); 43 | $mech->get("http://www.vim.org/login.php"); 44 | $mech->submit_form( 45 | form_name => "login", 46 | with_fields => { 47 | userName => $userpasswordpair[0], 48 | password => $userpasswordpair[1], 49 | }, 50 | ); 51 | $mech->get("http://www.vim.org/scripts/script.php?script_id=$sid"); 52 | $mech->follow_link(text => 'upload new version'); 53 | $mech->form_name("script"); 54 | $mech->field(script_file => $file); 55 | $mech->field(vim_version => 7.3); 56 | $mech->field(script_version => $scriptversion); 57 | $mech->field(version_comment => $versioncomment); 58 | $mech->click_button(value => "upload"); 59 | --------------------------------------------------------------------------------