@@ -253,106 +253,106 @@ fun! DrawIt#DrawItStart(...)
253
253
else
254
254
let usermaplead = " \\ "
255
255
endif
256
- call SaveUserMaps (" bn" ," " ," ><^v" ," DrawIt" )
257
- call SaveUserMaps (" bv" ,usermaplead," abceflsy" ," DrawIt" )
258
- call SaveUserMaps (" bn" ," " ," <c-v>" ," DrawIt" )
259
- call SaveUserMaps (" bn" ,usermaplead," cgh><v^" ," DrawIt" )
260
- call SaveUserMaps (" bn" ," " ," <left>" ," DrawIt" )
261
- call SaveUserMaps (" bn" ," " ," <right>" ," DrawIt" )
262
- call SaveUserMaps (" bn" ," " ," <up>" ," DrawIt" )
263
- call SaveUserMaps (" bn" ," " ," <down>" ," DrawIt" )
264
- call SaveUserMaps (" bn" ," " ," <left>" ," DrawIt" )
265
- call SaveUserMaps (" bn" ," " ," <s-right>" ," DrawIt" )
266
- call SaveUserMaps (" bn" ," " ," <s-up>" ," DrawIt" )
267
- call SaveUserMaps (" bn" ," " ," <s-down>" ," DrawIt" )
268
- call SaveUserMaps (" bn" ," " ," <space>" ," DrawIt" )
269
- call SaveUserMaps (" bn" ," " ," <home>" ," DrawIt" )
270
- call SaveUserMaps (" bn" ," " ," <end>" ," DrawIt" )
271
- call SaveUserMaps (" bn" ," " ," <pageup>" ," DrawIt" )
272
- call SaveUserMaps (" bn" ," " ," <pagedown>" ," DrawIt" )
273
- call SaveUserMaps (" bn" ," " ," <c-leftdrag>" ," DrawIt" )
274
- call SaveUserMaps (" bn" ," " ," <c-leftmouse>" ," DrawIt" )
275
- call SaveUserMaps (" bn" ," " ," <c-leftrelease>" ," DrawIt" )
276
- call SaveUserMaps (" bn" ," " ," <leftdrag>" ," DrawIt" )
277
- call SaveUserMaps (" bn" ," " ," <leftmouse>" ," DrawIt" )
278
- call SaveUserMaps (" bn" ," " ," <middlemouse>" ," DrawIt" )
279
- call SaveUserMaps (" bn" ," " ," <rightmouse>" ," DrawIt" )
280
- call SaveUserMaps (" bn" ," " ," <s-leftdrag>" ," DrawIt" )
281
- call SaveUserMaps (" bn" ," " ," <s-leftmouse>" ," DrawIt" )
282
- call SaveUserMaps (" bn" ," " ," <s-leftrelease>" ," DrawIt" )
283
- call SaveUserMaps (" bv" ," " ," <c-leftmouse>" ," DrawIt" )
284
- call SaveUserMaps (" bv" ," " ," <leftmouse>" ," DrawIt" )
285
- call SaveUserMaps (" bv" ," " ," <middlemouse>" ," DrawIt" )
286
- call SaveUserMaps (" bv" ," " ," <rightmouse>" ," DrawIt" )
287
- call SaveUserMaps (" bv" ," " ," <s-leftmouse>" ," DrawIt" )
288
- call SaveUserMaps (" bn" ,usermaplead," :pa" ," DrawIt" )
289
- call SaveUserMaps (" bn" ,usermaplead," :pb" ," DrawIt" )
290
- call SaveUserMaps (" bn" ,usermaplead," :pc" ," DrawIt" )
291
- call SaveUserMaps (" bn" ,usermaplead," :pd" ," DrawIt" )
292
- call SaveUserMaps (" bn" ,usermaplead," :pe" ," DrawIt" )
293
- call SaveUserMaps (" bn" ,usermaplead," :pf" ," DrawIt" )
294
- call SaveUserMaps (" bn" ,usermaplead," :pg" ," DrawIt" )
295
- call SaveUserMaps (" bn" ,usermaplead," :ph" ," DrawIt" )
296
- call SaveUserMaps (" bn" ,usermaplead," :pi" ," DrawIt" )
297
- call SaveUserMaps (" bn" ,usermaplead," :pj" ," DrawIt" )
298
- call SaveUserMaps (" bn" ,usermaplead," :pk" ," DrawIt" )
299
- call SaveUserMaps (" bn" ,usermaplead," :pl" ," DrawIt" )
300
- call SaveUserMaps (" bn" ,usermaplead," :pm" ," DrawIt" )
301
- call SaveUserMaps (" bn" ,usermaplead," :pn" ," DrawIt" )
302
- call SaveUserMaps (" bn" ,usermaplead," :po" ," DrawIt" )
303
- call SaveUserMaps (" bn" ,usermaplead," :pp" ," DrawIt" )
304
- call SaveUserMaps (" bn" ,usermaplead," :pq" ," DrawIt" )
305
- call SaveUserMaps (" bn" ,usermaplead," :pr" ," DrawIt" )
306
- call SaveUserMaps (" bn" ,usermaplead," :ps" ," DrawIt" )
307
- call SaveUserMaps (" bn" ,usermaplead," :pt" ," DrawIt" )
308
- call SaveUserMaps (" bn" ,usermaplead," :pu" ," DrawIt" )
309
- call SaveUserMaps (" bn" ,usermaplead," :pv" ," DrawIt" )
310
- call SaveUserMaps (" bn" ,usermaplead," :pw" ," DrawIt" )
311
- call SaveUserMaps (" bn" ,usermaplead," :px" ," DrawIt" )
312
- call SaveUserMaps (" bn" ,usermaplead," :py" ," DrawIt" )
313
- call SaveUserMaps (" bn" ,usermaplead," :pz" ," DrawIt" )
314
- call SaveUserMaps (" bn" ,usermaplead," :ra" ," DrawIt" )
315
- call SaveUserMaps (" bn" ,usermaplead," :rb" ," DrawIt" )
316
- call SaveUserMaps (" bn" ,usermaplead," :rc" ," DrawIt" )
317
- call SaveUserMaps (" bn" ,usermaplead," :rd" ," DrawIt" )
318
- call SaveUserMaps (" bn" ,usermaplead," :re" ," DrawIt" )
319
- call SaveUserMaps (" bn" ,usermaplead," :rf" ," DrawIt" )
320
- call SaveUserMaps (" bn" ,usermaplead," :rg" ," DrawIt" )
321
- call SaveUserMaps (" bn" ,usermaplead," :rh" ," DrawIt" )
322
- call SaveUserMaps (" bn" ,usermaplead," :ri" ," DrawIt" )
323
- call SaveUserMaps (" bn" ,usermaplead," :rj" ," DrawIt" )
324
- call SaveUserMaps (" bn" ,usermaplead," :rk" ," DrawIt" )
325
- call SaveUserMaps (" bn" ,usermaplead," :rl" ," DrawIt" )
326
- call SaveUserMaps (" bn" ,usermaplead," :rm" ," DrawIt" )
327
- call SaveUserMaps (" bn" ,usermaplead," :rn" ," DrawIt" )
328
- call SaveUserMaps (" bn" ,usermaplead," :ro" ," DrawIt" )
329
- call SaveUserMaps (" bn" ,usermaplead," :rp" ," DrawIt" )
330
- call SaveUserMaps (" bn" ,usermaplead," :rq" ," DrawIt" )
331
- call SaveUserMaps (" bn" ,usermaplead," :rr" ," DrawIt" )
332
- call SaveUserMaps (" bn" ,usermaplead," :rs" ," DrawIt" )
333
- call SaveUserMaps (" bn" ,usermaplead," :rt" ," DrawIt" )
334
- call SaveUserMaps (" bn" ,usermaplead," :ru" ," DrawIt" )
335
- call SaveUserMaps (" bn" ,usermaplead," :rv" ," DrawIt" )
336
- call SaveUserMaps (" bn" ,usermaplead," :rw" ," DrawIt" )
337
- call SaveUserMaps (" bn" ,usermaplead," :rx" ," DrawIt" )
338
- call SaveUserMaps (" bn" ,usermaplead," :ry" ," DrawIt" )
339
- call SaveUserMaps (" bn" ,usermaplead," :rz" ," DrawIt" )
256
+ call DrawIt# SaveUserMaps (" bn" ," " ," ><^v" ," DrawIt" )
257
+ call DrawIt# SaveUserMaps (" bv" ,usermaplead," abceflsy" ," DrawIt" )
258
+ call DrawIt# SaveUserMaps (" bn" ," " ," <c-v>" ," DrawIt" )
259
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," cgh><v^" ," DrawIt" )
260
+ call DrawIt# SaveUserMaps (" bn" ," " ," <left>" ," DrawIt" )
261
+ call DrawIt# SaveUserMaps (" bn" ," " ," <right>" ," DrawIt" )
262
+ call DrawIt# SaveUserMaps (" bn" ," " ," <up>" ," DrawIt" )
263
+ call DrawIt# SaveUserMaps (" bn" ," " ," <down>" ," DrawIt" )
264
+ call DrawIt# SaveUserMaps (" bn" ," " ," <left>" ," DrawIt" )
265
+ call DrawIt# SaveUserMaps (" bn" ," " ," <s-right>" ," DrawIt" )
266
+ call DrawIt# SaveUserMaps (" bn" ," " ," <s-up>" ," DrawIt" )
267
+ call DrawIt# SaveUserMaps (" bn" ," " ," <s-down>" ," DrawIt" )
268
+ call DrawIt# SaveUserMaps (" bn" ," " ," <space>" ," DrawIt" )
269
+ call DrawIt# SaveUserMaps (" bn" ," " ," <home>" ," DrawIt" )
270
+ call DrawIt# SaveUserMaps (" bn" ," " ," <end>" ," DrawIt" )
271
+ call DrawIt# SaveUserMaps (" bn" ," " ," <pageup>" ," DrawIt" )
272
+ call DrawIt# SaveUserMaps (" bn" ," " ," <pagedown>" ," DrawIt" )
273
+ call DrawIt# SaveUserMaps (" bn" ," " ," <c-leftdrag>" ," DrawIt" )
274
+ call DrawIt# SaveUserMaps (" bn" ," " ," <c-leftmouse>" ," DrawIt" )
275
+ call DrawIt# SaveUserMaps (" bn" ," " ," <c-leftrelease>" ," DrawIt" )
276
+ call DrawIt# SaveUserMaps (" bn" ," " ," <leftdrag>" ," DrawIt" )
277
+ call DrawIt# SaveUserMaps (" bn" ," " ," <leftmouse>" ," DrawIt" )
278
+ call DrawIt# SaveUserMaps (" bn" ," " ," <middlemouse>" ," DrawIt" )
279
+ call DrawIt# SaveUserMaps (" bn" ," " ," <rightmouse>" ," DrawIt" )
280
+ call DrawIt# SaveUserMaps (" bn" ," " ," <s-leftdrag>" ," DrawIt" )
281
+ call DrawIt# SaveUserMaps (" bn" ," " ," <s-leftmouse>" ," DrawIt" )
282
+ call DrawIt# SaveUserMaps (" bn" ," " ," <s-leftrelease>" ," DrawIt" )
283
+ call DrawIt# SaveUserMaps (" bv" ," " ," <c-leftmouse>" ," DrawIt" )
284
+ call DrawIt# SaveUserMaps (" bv" ," " ," <leftmouse>" ," DrawIt" )
285
+ call DrawIt# SaveUserMaps (" bv" ," " ," <middlemouse>" ," DrawIt" )
286
+ call DrawIt# SaveUserMaps (" bv" ," " ," <rightmouse>" ," DrawIt" )
287
+ call DrawIt# SaveUserMaps (" bv" ," " ," <s-leftmouse>" ," DrawIt" )
288
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pa" ," DrawIt" )
289
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pb" ," DrawIt" )
290
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pc" ," DrawIt" )
291
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pd" ," DrawIt" )
292
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pe" ," DrawIt" )
293
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pf" ," DrawIt" )
294
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pg" ," DrawIt" )
295
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :ph" ," DrawIt" )
296
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pi" ," DrawIt" )
297
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pj" ," DrawIt" )
298
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pk" ," DrawIt" )
299
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pl" ," DrawIt" )
300
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pm" ," DrawIt" )
301
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pn" ," DrawIt" )
302
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :po" ," DrawIt" )
303
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pp" ," DrawIt" )
304
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pq" ," DrawIt" )
305
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pr" ," DrawIt" )
306
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :ps" ," DrawIt" )
307
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pt" ," DrawIt" )
308
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pu" ," DrawIt" )
309
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pv" ," DrawIt" )
310
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pw" ," DrawIt" )
311
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :px" ," DrawIt" )
312
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :py" ," DrawIt" )
313
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :pz" ," DrawIt" )
314
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :ra" ," DrawIt" )
315
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rb" ," DrawIt" )
316
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rc" ," DrawIt" )
317
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rd" ," DrawIt" )
318
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :re" ," DrawIt" )
319
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rf" ," DrawIt" )
320
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rg" ," DrawIt" )
321
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rh" ," DrawIt" )
322
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :ri" ," DrawIt" )
323
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rj" ," DrawIt" )
324
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rk" ," DrawIt" )
325
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rl" ," DrawIt" )
326
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rm" ," DrawIt" )
327
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rn" ," DrawIt" )
328
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :ro" ," DrawIt" )
329
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rp" ," DrawIt" )
330
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rq" ," DrawIt" )
331
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rr" ," DrawIt" )
332
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rs" ," DrawIt" )
333
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rt" ," DrawIt" )
334
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :ru" ," DrawIt" )
335
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rv" ," DrawIt" )
336
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rw" ," DrawIt" )
337
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rx" ," DrawIt" )
338
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :ry" ," DrawIt" )
339
+ call DrawIt# SaveUserMaps (" bn" ,usermaplead," :rz" ," DrawIt" )
340
340
if exists (" g:drawit_insertmode" ) && g: drawit_insertmode
341
- call SaveUserMaps (" bi" ," " ," <left>" ," DrawIt" )
342
- call SaveUserMaps (" bi" ," " ," <right>" ," DrawIt" )
343
- call SaveUserMaps (" bi" ," " ," <up>" ," DrawIt" )
344
- call SaveUserMaps (" bi" ," " ," <down>" ," DrawIt" )
345
- call SaveUserMaps (" bi" ," " ," <left>" ," DrawIt" )
346
- call SaveUserMaps (" bi" ," " ," <s-right>" ," DrawIt" )
347
- call SaveUserMaps (" bi" ," " ," <s-up>" ," DrawIt" )
348
- call SaveUserMaps (" bi" ," " ," <s-down>" ," DrawIt" )
349
- call SaveUserMaps (" bi" ," " ," <home>" ," DrawIt" )
350
- call SaveUserMaps (" bi" ," " ," <end>" ," DrawIt" )
351
- call SaveUserMaps (" bi" ," " ," <pageup>" ," DrawIt" )
352
- call SaveUserMaps (" bi" ," " ," <pagedown>" ," DrawIt" )
353
- call SaveUserMaps (" bi" ," " ," <leftmouse>" ," DrawIt" )
354
- endif
355
- call SaveUserMaps (" bn" ," " ," :\<c-v> " ," DrawIt" )
341
+ call DrawIt# SaveUserMaps (" bi" ," " ," <left>" ," DrawIt" )
342
+ call DrawIt# SaveUserMaps (" bi" ," " ," <right>" ," DrawIt" )
343
+ call DrawIt# SaveUserMaps (" bi" ," " ," <up>" ," DrawIt" )
344
+ call DrawIt# SaveUserMaps (" bi" ," " ," <down>" ," DrawIt" )
345
+ call DrawIt# SaveUserMaps (" bi" ," " ," <left>" ," DrawIt" )
346
+ call DrawIt# SaveUserMaps (" bi" ," " ," <s-right>" ," DrawIt" )
347
+ call DrawIt# SaveUserMaps (" bi" ," " ," <s-up>" ," DrawIt" )
348
+ call DrawIt# SaveUserMaps (" bi" ," " ," <s-down>" ," DrawIt" )
349
+ call DrawIt# SaveUserMaps (" bi" ," " ," <home>" ," DrawIt" )
350
+ call DrawIt# SaveUserMaps (" bi" ," " ," <end>" ," DrawIt" )
351
+ call DrawIt# SaveUserMaps (" bi" ," " ," <pageup>" ," DrawIt" )
352
+ call DrawIt# SaveUserMaps (" bi" ," " ," <pagedown>" ," DrawIt" )
353
+ call DrawIt# SaveUserMaps (" bi" ," " ," <leftmouse>" ," DrawIt" )
354
+ endif
355
+ call DrawIt# SaveUserMaps (" bn" ," " ," :\<c-v> " ," DrawIt" )
356
356
357
357
" DrawItStart: DrawIt maps (Charles Campbell) {{{3
358
358
nmap <silent> <buffer> <script> <nowait> <left> :set lz<CR> :silent! call <SID> DrawLeft()<CR> :set nolz<CR>
@@ -497,7 +497,7 @@ fun! DrawIt#DrawItStop()
497
497
endif
498
498
499
499
" DrawItStop: restore user map(s), if any {{{3
500
- call RestoreUserMaps (" DrawIt" )
500
+ call DrawIt# RestoreUserMaps (" DrawIt" )
501
501
502
502
call s: DrawItRestoreUserSettings ()
503
503
@@ -3053,6 +3053,134 @@ fun! DrawIt#SetBrush(brush) range
3053
3053
" call Dret("DrawIt#SetBrush : b:drawit_brush=".b:drawit_brush)
3054
3054
endfun
3055
3055
3056
+ " ===============
3057
+ " Functions From cecutil: {{{1
3058
+ " ===============
3059
+ " SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{2
3060
+ " which can be used to restore user maps later with
3061
+ " call RestoreUserMaps()
3062
+ "
3063
+ " mapmode - see :help maparg for details (n v o i c l "")
3064
+ " ex. "n" = Normal
3065
+ " The letters "b" and "u" are optional prefixes;
3066
+ " The "u" means that the map will also be unmapped
3067
+ " The "b" means that the map has a <buffer> qualifier
3068
+ " ex. "un" = Normal + unmapping
3069
+ " ex. "bn" = Normal + <buffer>
3070
+ " ex. "bun" = Normal + <buffer> + unmapping
3071
+ " ex. "ubn" = Normal + <buffer> + unmapping
3072
+ " maplead - see mapchx
3073
+ " mapchx - "<something>" handled as a single map item.
3074
+ " ex. "<left>"
3075
+ " - "string" a string of single letters which are actually
3076
+ " multiple two-letter maps (using the maplead:
3077
+ " maplead . each_character_in_string)
3078
+ " ex. maplead="\" and mapchx="abc" saves user mappings for
3079
+ " \a, \b, and \c
3080
+ " Of course, if maplead is "", then for mapchx="abc",
3081
+ " mappings for a, b, and c are saved.
3082
+ " - :something handled as a single map item, w/o the ":"
3083
+ " ex. mapchx= ":abc" will save a mapping for "abc"
3084
+ " suffix - a string unique to your plugin
3085
+ " ex. suffix= "DrawIt"
3086
+ fun ! DrawIt#SaveUserMaps (mapmode ,maplead,mapchx,suffix)
3087
+ " call Dfunc("SaveUserMaps(mapmode<".a:mapmode."> maplead<".a:maplead."> mapchx<".a:mapchx."> suffix<".a:suffix.">)")
3088
+
3089
+ if ! exists (" s:restoremap_{a:suffix}" )
3090
+ " initialize restoremap_suffix to null string
3091
+ let s: restoremap_ {a: suffix }= " "
3092
+ endif
3093
+
3094
+ " set up dounmap: if 1, then save and unmap (a:mapmode leads with a "u")
3095
+ " if 0, save only
3096
+ let mapmode = a: mapmode
3097
+ let dounmap = 0
3098
+ let dobuffer = " "
3099
+ while mapmode = ~# ' ^[bu]'
3100
+ if mapmode = ~# ' ^u'
3101
+ let dounmap = 1
3102
+ let mapmode = strpart (a: mapmode ,1 )
3103
+ elseif mapmode = ~# ' ^b'
3104
+ let dobuffer = " <buffer> "
3105
+ let mapmode = strpart (a: mapmode ,1 )
3106
+ endif
3107
+ endwhile
3108
+ " call Decho("dounmap=".dounmap." dobuffer<".dobuffer.">")
3109
+
3110
+ " save single map :...something...
3111
+ if strpart (a: mapchx ,0 ,1 ) == ' :'
3112
+ " call Decho("save single map :...something...")
3113
+ let amap= strpart (a: mapchx ,1 )
3114
+ if amap == " |" || amap == " \<c-v> "
3115
+ let amap= " \<c-v> " .amap
3116
+ endif
3117
+ let amap = a: maplead .amap
3118
+ let s: restoremap_ {a: suffix } = s: restoremap_ {a: suffix }." |:sil! " .mapmode ." unmap " .dobuffer.amap
3119
+ if maparg (amap,mapmode ) != " "
3120
+ let maprhs = substitute (maparg (amap,mapmode ),' |' ,' <bar>' ,' ge' )
3121
+ let s: restoremap_ {a: suffix } = s: restoremap_ {a: suffix }." |:" .mapmode ." map " .dobuffer.amap." " .maprhs
3122
+ endif
3123
+ if dounmap
3124
+ exe " sil! " .mapmode ." unmap " .dobuffer.amap
3125
+ endif
3126
+
3127
+ " save single map <something>
3128
+ elseif strpart (a: mapchx ,0 ,1 ) == ' <'
3129
+ " call Decho("save single map <something>")
3130
+ let amap = a: mapchx
3131
+ if amap == " |" || amap == " \<c-v> "
3132
+ let amap= " \<c-v> " .amap
3133
+ " call Decho("amap[[".amap."]]")
3134
+ endif
3135
+ let s: restoremap_ {a: suffix } = s: restoremap_ {a: suffix }." |sil! " .mapmode ." unmap " .dobuffer.amap
3136
+ if maparg (a: mapchx ,mapmode ) != " "
3137
+ let maprhs = substitute (maparg (amap,mapmode ),' |' ,' <bar>' ,' ge' )
3138
+ let s: restoremap_ {a: suffix } = s: restoremap_ {a: suffix }." |" .mapmode ." map " .dobuffer.amap." " .maprhs
3139
+ endif
3140
+ if dounmap
3141
+ exe " sil! " .mapmode ." unmap " .dobuffer.amap
3142
+ endif
3143
+
3144
+ " save multiple maps
3145
+ else
3146
+ " call Decho("save multiple maps")
3147
+ let i = 1
3148
+ while i <= strlen (a: mapchx )
3149
+ let amap= a: maplead .strpart (a: mapchx ,i - 1 ,1 )
3150
+ if amap == " |" || amap == " \<c-v> "
3151
+ let amap= " \<c-v> " .amap
3152
+ endif
3153
+ let s: restoremap_ {a: suffix } = s: restoremap_ {a: suffix }." |sil! " .mapmode ." unmap " .dobuffer.amap
3154
+ if maparg (amap,mapmode ) != " "
3155
+ let maprhs = substitute (maparg (amap,mapmode ),' |' ,' <bar>' ,' ge' )
3156
+ let s: restoremap_ {a: suffix } = s: restoremap_ {a: suffix }." |" .mapmode ." map " .dobuffer.amap." " .maprhs
3157
+ endif
3158
+ if dounmap
3159
+ exe " sil! " .mapmode ." unmap " .dobuffer.amap
3160
+ endif
3161
+ let i = i + 1
3162
+ endwhile
3163
+ endif
3164
+ " call Dret("SaveUserMaps : s:restoremap_".a:suffix.": ".s:restoremap_{a:suffix})
3165
+ endfun
3166
+
3167
+ " ---------------------------------------------------------------------
3168
+ " RestoreUserMaps: {{{2
3169
+ " Used to restore user maps saved by SaveUserMaps()
3170
+ fun ! DrawIt#RestoreUserMaps (suffix)
3171
+ " call Dfunc("RestoreUserMaps(suffix<".a:suffix.">)")
3172
+ if exists (" s:restoremap_{a:suffix}" )
3173
+ let s: restoremap_ {a: suffix }= substitute (s: restoremap_ {a: suffix },' |\s*$' ,' ' ,' e' )
3174
+ if s: restoremap_ {a: suffix } != " "
3175
+ " call Decho("exe ".s:restoremap_{a:suffix})
3176
+ exe " sil! " .s: restoremap_ {a: suffix }
3177
+ endif
3178
+ unlet s: restoremap_ {a: suffix }
3179
+ endif
3180
+ " call Dret("RestoreUserMaps")
3181
+ endfun
3182
+
3183
+
3056
3184
" ------------------------------------------------------------------------
3057
3185
" Modelines: {{{1
3058
3186
" vim: fdm = marker
0 commit comments