Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Vimconf2015

3,281 views

Published on

私はどのようにVim scriptを書くか?~Vim script解説~
http://vimconf.vim-jp.org/2015/

  • Hey guys! Who wants to chat with me? More photos with me here 👉 http://www.bit.ly/katekoxx
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Vimconf2015

  1. 1. I 80) J: '7 IC. Vim s_Cript72$< ~'V 1m sC1"1}3‘tfi: "p"a’FE~ B (1/99)
  2. 2. o Id: @rbtnn (Github, Twitter, Eflflfl Lingr, Hatena, Qiita, .. .) - fifififivbfifiwfifi - mm: _ . s o Vim script &o333n w# Vim'6‘$I: b"—L a i)>I’|3o'C ° ’’‘? ‘”‘’’’S‘‘‘*‘_‘ I! ) 6 Sler o Vlsual Bas1c 6.0 o ViInJ: "G‘%§L"Cc7>V~7": ’7’-L»: puyo. vim mario. vim pipe. vim
  3. 3. A Z " 2.. Vim script0))‘CI”&Efi%fi L E To 7§t0)"C‘ . ViInrc"C“L7b>§iI>7§CI: > Z c‘: Iifi i I) 331, iii’/ vo 5I‘iI‘§Ii‘ ViII1I§OTIz> 5 I3’ 2'. " Vim SCI‘iptIi§( 93] 5» 72I: >/IF'7.II7‘’5‘ ii.
  4. 4. Ranking the popularity of programming languages Paula DeCl: v‘ICcI9t" 2D‘O Aumo: -crc. .<o~«. I, rum undnv'oII'Ic'5 ng. Lugmgcv. pt(); I.I‘V‘I“A'VQ 3- ow‘ ea Co~rvcr". Programmnng Language Populanly Slackovcrflow Oucshons Tagged vs Pm. ucIs on Gllhub Cm: I 0 / ‘H Pom aw Rank on Slackovervoo. my I oIIagsI . , .0 vopuI. u.Iy Rank on Cumub my I 0' ptomclsy
  5. 5. Vim script0)I? f£ 2’ %E . vimrc0)fi§
  6. 6. Vim script0)I§ :2’ %@ Vim7""i 931’ ‘/0)I’FJ5JE - kana/ vim-textobj-user - thinca/ vim-quickrun - Shougo/ unite. vim - tpope/ vim-fugitive
  7. 7. Vim script0)I? f£ 2’ %E Vim0):1v‘/ I~“"i»f‘/
  8. 8. Vim script0)1§ 2’ EE Ruby‘@’Python0)7b>«‘b D 0:2 7 ‘J 7 I‘ §% 2: Lffilfi “‘ Viz" “H _ , ,. ., ‘«. u 91". ’-iv-= “4vVr1“’ . c,~ J§: “" 7-""1_‘«: /,r"_ff, ~“ "'~‘_/ ‘._r‘ ’i f/ _J'“_J‘L/ ',fH_"‘ 1:? ’; I‘, _‘*', //J'‘' ‘:1 T ; J'_, ';. -‘: _/, ,‘, /:_. ‘ v_-‘/ ‘ J/ )'. _/,9" ‘7 /
  9. 9. Vim script&§fi3_“ é
  10. 10. Vim scriptififijj § Vim script0): l~— l~“2'. “‘5*? ’o’C%fi“3‘Eo0) ?
  11. 11. Vim scriptfififii § Vim script0):1— l~“&“5'? 'o'C%fi"§'Z»0) ? : new |
  12. 12. Vim scriptfififii 5 Vim script0): I- 132?’) '? ’o"C%fi"§'60) ? : setfiletype vim|
  13. 13. function! s: sum(| ist) abort let sum - 0 for x in a: list let sum +- x endfor retum sum endfunction echo s: sum([1,2,3,4]) Vim scriptfiifii 5 Vim script0):1— l~“c‘; “5'? 'o'C%fi"§'60) ?
  14. 14. function! s: sum(| ist) abort let sum - 0 for x in a: list let sum +- x endfor retum sum endfunction echo s: sum([1,2,3,4]) 9 9 Vim scriptfififii 5 Vim script0): l~— l~“&“5*? ’o‘C%fi"3'50) ? : write a. vim
  15. 15. function! s: sum(| ist) abort let sum - 0 for x in a: list let sum +- x endfor retum sum endfunction echo s: sum([1,2,3,4]) Vim scriptififii 5 Vim script0):1~— l~“&“5'? 'o‘f%fi"§'50) ? : source a. vim
  16. 16. function! s: sum(| ist) abort let sum - 0 for x in a: list let sum +- x endfor retum sum endfunction echo s: sum([1,2,3,4]) Vim scriptfififii 5 Vim script0): l~— 13.13’) '? ’o‘f¥fi"§‘50) ?
  17. 17. Vim scriptififiji 5 Vim script0): l~— l~“&'. “’)*? ’o’C%fi"§‘50) ?
  18. 18. Vim script&§j_: ["1“ 5 Vim script0):1— F .33’) '? ’o'C%fi“3‘50) ? $! |E r2I1eWJ 'Cv*~7 7 7 >2f’l3l32 rzsetfiletype vim; "G7 '74’ 21/574’ Vfifli = —F§< rzwrite a. vimJ 'C*fi¥J'5 Vzsource a. vimJ 'C*%fi' S": “S°! °:"
  19. 19. ,_. Vim scri t Vim script0):1— F H5 '? ’o'C§"'%fi“§‘50) ? $! |E(QuickRunfi) 1. Fznewi “(WV 7 7 >2f’l3l3Y. 2. rzsetfiletype vim; ‘G7 '7 4’ 21x74’ 7&3}? 3. :1 —— l~“§< 4. 1:QuickRunJ 'C~‘%fi' (19/99)
  20. 20. Vim script0): l— 1~“E"’)'? ’o‘f%fi“§‘? o0) ? Wandbox lmp: //melpon. org/ wamll1ox/ fiI[r€1'I1': vY. VlI'. ulOl| ')I| 1!! 101'. ’-I -| !Fr'JI_('1vl! l:'. u-. '|9-MFEI <1 ml“ (20/99)
  21. 21. Vim script0); Z3$‘
  22. 22. Hello, World (22/99)
  23. 23. Hello, World : echo:1 '? V P (23/99)
  24. 24. Hello, World : echo:1 ‘? ‘/ F : echo ‘Hello, World‘ I (24/$19)
  25. 25. Hello, World : echo:1 ‘? ‘/ F Hello, World (25/$19)
  26. 26. Hello, World(2) : echomsg:1 7 V F : ech%_: l?‘/ 1“‘cE@{7': :17V Po H317JLf: P§§§: %Z>E§I’5§§L"C< iii 0 (26/99)
  27. 27. Hello, World(2) : echomsg: '7 V F : echo:7'? V Fl'. fl}{7": Z1'? ‘/ F. i'fl7:IL7‘: l79§%aF)Z>EE%i$L'C< “E? -O : echomsg ‘Hello, World‘ (27/$19)
  28. 28. Hello, World(2) : echomsg:1 7 V F : echo:1*</ V l~“.1.: @{f: :z7V F0 H173 L7‘: l7Sl§’<1”: bZ>EEl%? ?-L'C ( i’Li’§‘. Hello, World
  29. 29. Hello, World(2) zechomsga 7 V F : echo:1*<*V l~“.1:. lB{7‘: :1vV F0 1'fI7JL7‘r. |7Sl%”3:215Z>EEl%§l¥L'C < i’Li’§‘. : messages :1 7 V F : echomsg:2vV I372: c‘; “'C*. 'fl7J L7‘: l7§§’<1”: §ZT<L"C < hi? ) : messages |
  30. 30. Hello, World(2) : echomsg: 7 V F : echo: *7V F&1'I}{7‘: :1vV F. Hi7JLf: l7§lfi>é’: aF)Z>E§%l—? L'C( 1/LE‘; -0 : messages :1 ‘V V F : echomsg:1vV F73: E"C‘Hi7'JL7‘: l7§§’a”: §/7?L"C < hid} Messages maintainer: Bram Moolenaar "a. vim" [converted][unix] 1 1 54L, 31755C written Hello, World : messages | (:10/99)
  31. 31. fifi (31/99)
  32. 32. fifi : let:1 ? V F (32/99)
  33. 33. v 0' I, | Q’ . . ‘l ; *-’r’1 ' ‘x-41¢ A , p 1 “Ir '9 _. ,Z<'§; f.', —[— ‘/1; "Ti I . if: -F‘ Z J) 7.12:‘ r. ‘ p[, . 1, F ' 1 I " " , ,- J"
  34. 34. fifi : let:1?V F :1et:1 *7 V Fli, §§(0)‘E'§‘1l8 J: U‘fU’E:1"3"/ > E 3'0 Efifiu fifilalé l: l: 721/7 7&7 l‘'a-zA-Z', %I$'O-9', 7?/5"‘-I*‘—'_'1,z'2>l§ F31‘? ifi‘/ vo 7‘:7‘£‘L. l§C$Bl: :fi$’5:fiH§'§‘5 C. t liflfiléi-1:3:/ V. (34/99)
  35. 35. 322% £13145 ll counter _aap3 very_long_variable_name_with_underscores FuncLength LENGTH ll 2nd_group (35/99)
  36. 36. Q? : let:1?V F :1et:1 7 V Fli, §§(0)’E§‘$$ J: Z)“f§7’a”: f’i‘1:> i 3'0 fififié §fi4‘§. l;t7’21/7 7&7 l~'a-zA-Z‘, fi$'O—9', ‘7V5"~—1%‘—'_'l,7b>lE€ 143?‘? ifi’/ uo 7‘:7‘£‘L. l§C? Bl: :fi$&lE€Fl3*9‘5 C 1; lztlflfilfii-bf/ vo : let X = 10 (:11;/ $19)
  37. 37. 2&1 : let:17V F :1et:1 "? V F ii: EQODEER J: U‘f§A? f’3‘1/> E ‘§‘o Efifi £wsIi721/7 7~*~y l~'a-zA-Z‘, aim-9', 7V5”—2“~—'_'I,2b>l: € mosiek. 7‘:7‘r2‘L. 1)'C¥ElCfi$>&fifiT5 C & lilfl§lEi-1i‘/ uo : echo x|
  38. 38. 10 Q? : let:1?V F :1et:1 7 V Fli: §§(0)’E§‘E$ J: U‘f§7’a”:1"i‘1z> E E0 fififié §fi4‘§. l;t7’21/7 7&7 l~'a-zA-Z‘, fi$'O—9', ‘7V5"~—1%‘—'_'l,7b>lE€ 143?‘? Efi’/ uo 7‘:7‘£‘L. l§C? El: :fi$&lE€Fl3*J‘5 C 1; l: tlfl3l€E-ti/ vo (38/99)
  39. 39. i . _ _ r- J) . . ‘gs __, . é‘, —_‘, ‘_ , ,. -11» - fltfl? ‘ 4. , .. . _l= I1 -1 1 1 r‘ 13:. Z4-J_"’*, «;a!1-’”.1-", =1 '§= ,' z. .., .1. 1 wrc, 1 ’/ _ / L r 1.1.1 E? '21,.
  40. 40. §&®x: —7 fifi : let:1?V F : let:1?V Fli. §fi0)fi§‘Il'$ J: ?.')1‘f§l’5:1"i"1/3E3‘. ‘II (40/99)
  41. 41. "‘. ‘»'j1 4 _ . -1 * V _ 1' 1 1. 1")-I ’ 1:1 r *1 1 “awe: -_. ' 1 ‘V on .51: we §-‘ 1 )1 v -~‘ ’ ~“. . . “ “.1 . ‘ § §= '3 v . W1 Vu‘ ‘= | of 4 L .0 5" 1 ~‘ . - bl, “ :5 . ,1 V‘ W‘ ' .31“ y'h 'lT<v4-§; f;)3:. ~_~, . . ‘ .1 ‘I W; ‘if I . |
  42. 42. §fi®x: —f da: VVPKT§fi%E§T%&. 7“tJ -2121/X :1 —7°'g: ' 2: 141 '3 X :1 ~—7‘°l: :l%j%é1?Lifl‘. , fifi : let:1 V V F : let:1 V V Fli. 2"éfi0)E%“#$ J: IFRAEHVI E 3‘. : echo g: X| (42/99) IJLQ
  43. 43. §fl®x: —7 fla: vVFKT%fi%E§T6&. 7“t1 —z*;1«x :1~—-7’°'g: '.1:. In '3 X :1——7"0:fij%é! mi To 2% : let:1 73/ F : let: I V ‘/ 13932‘ §§I0)E§‘3=$ J: ?. ')“RA>21*’§r1«> i ‘To l-. |. . . 'll 10
  44. 44. §fi®x: —7 : let:1 ‘x’ ‘/ P&: :'C%§c%“a’%"TZ» 2: ‘ VD -AWX = —7“g: 'tw’2 x= —7°c:4s%fi=2r: rLara‘. let x - 10 echo g: x II echo x ll
  45. 45. §fi®xn—7 >2:0)“C zletnvv l~“0:'C§#(’5:E§‘T? o 2: 3 03:. X7U7bx: —fw&m5x: —7K%#T5&mm@L;5° xaU7+x: —fwu774w$mmx: —72%g§¢° nvVP54V#BX7U7Fx: —7W0%fi%@m? a:an 'C‘2?i-1:3:/ vo let s: x = 10 echo s: x ll
  46. 46. §fi®x: —7 >tc0)'C : let:1'? V F‘c: *c§fi>5': E%. “Tz> 2: mi‘ X7 ')7"I~x:1—7"'s: '&uv’; x: :~—7"c:4%#fi‘% amrm, ; 5° X7U7bx: —Twu774w$mKx: —7§fig§t° 37VP54V#BX7U7FX3—7W@%fi%WfiT6:Eu 'C‘%i-1:3:/ vo let s: x = 10 echo s: x ll : echo s: x|
  47. 47. §fi®xn—7 >2:0)“C zletnvv l~“l: ’C§§(’5:E§‘T? o 2: 3 03:. X7U7}x: —Tw&w5x: —7K%#¢%&mm@L;5° X7U7bx: —Twu774W$&Kxn—7&fiBi? o nvVP54VbBX7U7lx: —7W@%fi%Wfi?6Cbu 'C‘2?i-1:3:/ vo let s: x = 10 echo s: x ll E121: Undefined variable: s: x |
  48. 48. afivlkfiflfi (48/99)
  49. 49. axvbkfififi :1)“/ I‘ V7w7z—l“#6*%i finxvbkbfflwiio fififi fi®%EKNV7x? vv a. ''EE< C. c‘; 'C‘E'fi? I0)f’: TE $fiT6C&fiT3iTo " o. ‘_0J? "Il1:| } ‘/ |~'C"§'. let g: x = { '| nterva| s' : [ 0, 1,2,4,8, 16 1. } " fififi|1=0J: l;‘ ‘/ |~l1NG letg: x={ '| nterva| s': [ " 0,1,2,4,8,16 0,1,3,9,27,81 1
  50. 50. (50/99)
  51. 51. E Vim sc1'iptl: l:! :6fifi0)fli)3‘#ZT: L i ‘ii, 1 2 c>91.J>oo . §(ffi(Number) . flfl/ J§U%‘fl(F10at) . )‘C? §U(String) . E§fi$; fl%i(Funcref) '1 Z l~ (List) . fi¥§(Dictionary) (51/99)
  52. 52. ‘l £LI; m;u_I var‘ : .
  53. 53. fiffi(Number) Vim script0)§(1'fil3:32bit(or 64bit)m9%h‘ 3 ¥fi7lfi‘fiz2. 1 3: echo 2147483647 " OEKIEHU6 C t‘C‘8£&§IE'bEI " 2147483647 echo 0777 "511 echo -2147+ 13 "-2134 " Oxéfilfé C <‘: '(‘16£§! lilB'bfiI echo Oxff " 255 echo Oxfffff + 1 " 1048576 : he1p limits
  54. 54. ¥¥EIJfiJ. ‘4‘. fi(Float) (54/99)
  55. 55. fifl/ J’; 'i‘5'£}. '9“’t5?5I(Float) Vim scI'ipt0>? -:‘. ’=%/ J&; §a&1atL: LTa) 2 ’)0)%: ‘cfi'C‘§%%‘E. "C‘$‘ i 19“. [-+]{N}-{M} [-+]{N}-{M}[eE][-+]{eXP} ll ll 123.456 .201528 +0.0001 1. 55.0 -0.123 1.234e03 1.0E-6 -3.1416e+88 : he1p floating-point-format (55/99)
  56. 56. "": ?”%’? ‘%-'7Jl{é;1 1:; -119;: 1'
  57. 57. 3'C? ?'J(String) Vim script0)§C? FJl;1:5”7’)1/7 1- l 5 L(l;1:~‘/2/751/7 71- l~'6‘ Eenrfifienii. vyfw7z—1vEenki$fluxx ’7'—7°: ‘/—’7“/ }<i)5‘§‘li1ifli€‘i}’Li'l:3.‘/ uo sg'g; "ab°" 1ean<J>: c:nxIr—7*-/ —Irv echo"abcndeF' J‘ I 3:? .. 2115031 6iE&= i= (91 "x1f") h I bnv Y7}l«07l'—| ‘ 5°ab‘? ca ° 1=11ae(/ <‘yaz5~y~>; ) echo 'abcndef' " abcndef : he1p string]
  58. 58. E§fi55§H€(Funcret') (58/99)
  59. 59. B§fi%! Ifi(Funcref) Vim script0)E§§C%fili'function'E§§t%{§ ") C 3; T“1’Ffi2?‘ 5 C 2: £23‘ '63 i ii, i 7: 'function'B§fi'C‘i’l3fiJE L fcifié 2&1: 15%? ‘ Z» 5&6. fififi. E 7<3C’—f'T5'6‘!1é16?)>Zcl7‘? Lli‘72c 0 $14:/ 'u. . ll let F = function('add') echo F([1,2,3], 2) " [1. 2. 3. 2] ll let 9 = function('append')
  60. 60. 1) 2 ]~(List) (60/99)
  61. 61. ‘J K 1‘ (List) Vim script0) ‘J K l~ 117? '7’ “/ 1* '[]"C‘ilEB#Lf: §§0)$i D '69‘. ‘J X l Wfifilzt. ?"“’C| fiI)‘fl'C‘3f> ? oIJZ~§l: l:i) U i-14:/ uo " $575113 ‘/ ?'C‘£~= bo'C'b0K. Ctbilfi. U 1 #0353115. letns-[1,2, 3,4, 5,] let ns = [1, [2, 0.1], {}, function('substitute'), 5] let ns = []
  62. 62. .. r.. _a. ..1 . ._. .. _. _= _. 4» El -II.
  63. 63. #? %(Dictionary) Vim script0)fi¥§1i. Db - ‘J '-7*‘? '7’ “/ l~ '[}"C‘iF3‘5>fL7‘: 36- MEG) fie D “M. fi§®#—ui$WKL&UhH&Bf. fi%®#~Kfl$ubD $4»: /V. let e = {} " 3lE!7.')‘1:I ‘/ ?‘C‘£1b-. >'C'b0K. let d = { ‘four’ : 4, 'two' : 2, ‘one’ : 1 , ‘three’ : 3, } echo keys(d) " ['four', ‘one’, 'two', 'three'] echo va| ues(d) " [41 11 2!
  64. 64. fl0)i2:<)? ) Vim scriptwfllzli. 6fifi0)«7>tT“§‘o 1 2 c>91.1>oo . &ffi(Number) . flfl/ J¥I).5.‘§C(F10at) . )‘C? §‘J(String) . B§§£%*Hfi(Funcret) ‘J X 1‘ (List) . f¥§(Dictionary) ((34/99)
  65. 65. flflikbf) Vim scriptl: li, Boo1eanflv? ~>Charfll: .‘#1€E L E ‘li-/ V0 Ol; {5’l~0)§I(fii)3‘true 2: Bib 31. Oififalse & fibhi 3‘. >§c0)'C if)'C72c l: “0)Boo1ean§J. i)5‘§5Rf-S it? '7 7§cEFJfl: l:. fiffioaifi 13?‘? i 3‘. if 0 echo "true" else echo "false" endif " false
  66. 66. E02 2:81) -—E. 121551 liChar§'a!0) 1) x 1 l: E.i. i1‘i)5 U x l Uciilllié <®w%c? . . ‘?‘i, “° "a" ""' '°"“‘ echo ran 'b', 'c'1[-11 echo "abc"[1] C " b " §J‘C= F§‘l#iE: »‘C< 6. echo [‘a‘, 'b', ‘c'][1:2] echo "abc"[-1] ll [lbl’ lcl] | | echo "abc"[1:2] ll
  67. 67. %7+'$F§)’C e for$C -Vflhflejt (67/99)
  68. 68. if {expr} endif if {expr} else endif if {expr} elseif {expr} endif if 1 echo ‘true’ else echo 'false‘ endif " true
  69. 69. for {var} in {list} endfor for s: x in [1 ,2,3] echo s: x endfor ll 1 ll 2 ll 3
  70. 70. while {expr} endwhile let s: |num = 1 while s: |num <= |ine("$") echo get| ine(s: |num) let s: |num = szlnum + 1 endwhile
  71. 71. FF! ‘in; '. _‘__u
  72. 72. Bfifi Efifiméfi Vim sci1pt0)B§fi1i‘ l; H~‘a) I 5 7Z¢§: ‘cK‘. '6‘§B3$ L 3 in function! fififilfi) abort " E U iléifi l/7:l. i! ‘é’: ‘. 'retum"C‘iE L31‘. " E U fiI§5H7:= fl‘J l: iE$7'; t1.ii'%. -Ewlflfilioéifi l»§'! '. retum x endfunction
  73. 73. EEK Bfifiwfifi function! F(x, y, z) abort " ! !I*l'C“'i| §!t’é‘: #fl'§'6l: l2t'a: '&1*fU"C#E L531‘. retum a: x * a: y + a: z endfunction echo F(2, 3, 4) ll
  74. 74. aw Effififilfi (74/99)
  75. 75. Bfifi Efifiglfi fi. [§E'3'| §{0)’3|353‘0i'a: O0O"6“) X l~ I/ Céflfifié? ii} function! F(. ..) abort echo a:000 endfunction call F(1,2,3) " [1 .23] call F(1,2,3,4,5,6) " !2l3!4l5!6]
  76. 76. Baa n—fiwx: —7 (76/99)
  77. 77. Bfifi u—fiwx: —7 fi&W? E§3nk%fiuu—wwx: —7%&w5x: —7t% fiénifo function! F(n) abort echo F(3) let m = 10 " 13 let m += a: n return m echo F(-2) endfunction " 8
  78. 78. Bfifi n—flwxa—7 %&W? E§3nkEfiuu—wwx: —7w&w5x: —7m% fiénifo function! F(n) abort echo F(3) let m = 10 " 13 let m += a: n return m echo F(-2) endfunction " 8 : echo gzm
  79. 79. Bfifi u—fiwx: —7 fifiW? E§3nk§&uu—wwx: —7wam5x: —7m% fi3hiTo function! F(n) abort echo F(3) let m = 10 " 13 let m += a: n return m echo F(-2) endfunction " 8 E121: Undefined variable: gzm
  80. 80. Bfiifi 0 -x7U7+%& (80/99)
  81. 81. Bfifi -xavflfifi 7'13‘-1*‘I1/B§§I0)B§fi»%li7 11x7 7N“? l~'a-zA-Z‘, fl $09‘7VV-N—Qfifi 113?‘? iii, fcfil/ l5C? El: UC5C? ‘7 11/7 TN‘? l~ éfimbtlih lit 0 iii: /vo function! G| oba| Func() abort endfunction
  82. 82. x7U7+fifi®fifi% W§&EKfiH‘7w77& ‘7 l~ ‘a-zA-Z" fi? '0-9" 7’ 2/ 57“—2*—'_'7b§fE€)% var i to §2liH4Jl: :‘; E§ Lfcx 7 ‘J 7' l‘ 774wWoL#W0$? : l: i)5"G‘§’i-t3:/ uo function! s: script_func() abort endfunction
  83. 83. 4| — «my . .44, .2. D. 3 “.1.
  84. 84. flfiffifi if)'C%>E§¥l: J: 9 ’C§C? §1J-? °fi1'Eifi‘H’éa‘%E’~Jl: fl’2°§&$ hi 3?, (84/99)
  85. 85. flfifi )'C¥F'J -> filfi $C$§| J:b§/ "d+/ ll‘? ‘7 ‘I-'§‘Z>1%1‘= ‘ux ‘x’ ‘Y 5- L fcfiflfiréfilfi & fit: I/ %0)&lEl: fl%&3niT° V77-L7:cu>%€u*t OUXCEEE: é<1*Li'§‘. , n I1 I _’-I n ltruel _’ 0 if '1 ' if ‘true’ echo ‘true’ echo ‘true’ else else echo 'false‘ echo 'false‘ endif endif " true " false
  86. 86. flfifi 155571] —> filfi " '4abc' -> 4 if "4abc" echo 'true' else echo 'false‘ endif " true " 'ab3c' -9 0 if 'ab3c' echo 'true' else echo 'false‘ endif " false
  87. 87. flfifi >'c*-M —> fllifi i$fl&flE¢&fi&t%%W&fl§&ufibiuho " '4.1 2' —> 4 if '4.1 2' echo 'true' else echo 'false‘ endif " true
  88. 88. flfiififi VmWflmm£§%tEK#ET6#vxlfi§¥u#EL$%ho fifibL<gfi§¥%fifiLrfl%&2fimi? ° To 1%? l#E¢&fi# xem wage uxl lee ) From (0.0 + x 1float2nr(x)l - Mstr2nr()_() lstr2float()t) we leamaemxsmlwaem 1) X l~ WE? (stringy) x 1 x x lstring(x)} x 1 x 1 x ( function(x)| eval(x)‘ eval(1t)( lStrin_g(_x)l- 1x 1x (st1'in§(x)( x 1 x lstring(x) x x (88/99)
  89. 89. fififi‘ (89/ 99)
  90. 90. . V-__-U4" ta‘ -,2 -. _l <1; . “F ~« . _ , , '1 r‘ 6:c: ,o: Is= :r-1 ; §~ ",1" _. :11 1‘ ' ‘:1 ~15 ':1‘__ ‘P ‘I A " ‘ £449’?
  91. 91. ~21 A’ 91 . as 9' A _’ 1" 3;-'i, ._1.' C), ~{, ’~ —‘ Cg’l', .€-’ 1 v 7177 71 . -J: L (1, ,1, 3131 — ‘, r‘«_l 91 , 1J_a‘ F or -‘ I A"! . -1.~‘: ‘¢. .u » 9: ,1
  92. 92. 5%? - E3 '1' . '1=' . I6—»0 17.I=17—>0 . Io—>1 0.7.I=7—>1 . -= - [J ! =[]-*0 17==17->1 [1J! =[]->1 0.7==1—>0 [J= =[J->1 r17== r7—»o (92/99)
  93. 93. 5%? . '<' . '>' 1<6—>1 1>6—>0 1<0—»0 1>0—>1 . '<= ' . '>= ' 17<=17—>7 17>=17—>1 7.7<=1—>0 7.7>=1—>7 (93/99)
  94. 94. .‘rn= ’ -3: T-*“_1.'?1' #1:‘ 3151.0-' —‘ ~‘i£. '?1' _1.'7*~’»“' 4:1 , -‘*4-'3 ~‘ _3!9"1i~'*' 7 #4:‘ CL-'1' ——‘ Z/ ' .71’ 1'/ ' 4:‘ 4‘! —~‘ -41
  95. 95. §; ]_»‘I; L-""24 "Pf — ,1 9/516‘ : « "51'; " —v C’ 21:1:-*’a~ hm" —~ cr 1215:; -at ~xsr1—~ :1 1+a1:l. ',1.: .:: +n+: ,~rlc; -fa-1 1111-: ,-we 4 : / 1e; ;a1:: /:. =e: g1w: -—1 —~ 1&1
  96. 96. fifi¥ -'&&' -'n' 7&&1->1 1//1->1 7&&0->0 7IIO->1 0&&7-»0 0/I7->1 0&&0->0 0IIO->0 (96/99)
  97. 97. fifi¥0)i 2: 81) Vim scriptl: li'+= '*t5'-= 'li3b U E 375*, '*= '~15'/ ='li#1§lE L $123:/ u., ifs 4' V7'))‘ V l~'++', '7’? ‘J 2? V l-'--'fiE? r“¥. >#? §EL i*t¢. “lu. , : help expression-syntax|
  98. 98. Vim scriQt0); Z3£‘ Eb Q Vim script0)§§’)5lCEo7‘c 6 3: 1) a5:? .1“LX1~‘a) 2 9 ®«w7&fi&iL;5o Vim Z7‘)7’l~%3£ : help usr_41 B§fi~E : help function-list
  99. 99. Z’. °‘? l§H7E1‘IZl7’> 1) 753% 5 3;“é<“1/>i Lfco (99/99)

×