《vim学习.ppt》由会员分享,可在线阅读,更多相关《vim学习.ppt(224页珍藏版)》请在金锄头文库上搜索。
1、Perl Hacks on Vim,林佑安 Lin You-An c9s / Cornelius,pause id: CORNELIUS,林佑安,Lin You-An,VIM & Perl,how can vim improve perl coding productivity,vim 如何改善 coding 生产力 ?,The worst way to edit 最糟糕的编辑方式,#!/usr/bin/env perl my $hppiness = PerlChina-join();,Oops!,lost “a”,#!/usr/bin/env perl my $hppiness = Perl
2、China-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl m
3、y $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/
4、usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,#!/usr/bin/env perl my $hppiness = PerlChina-join();,if this costs 4 sec,#!/usr/bin/env perl my $hppiness = PerlChina-join();,if x 50 times this
5、 kind of situation per day,if this costs 4 sec,#!/usr/bin/env perl my $hppiness = PerlChina-join();,if this costs 4 sec,if x 50 times this kind of situation per day,#!/usr/bin/env perl my $hppiness = PerlChina-join();,if this costs 4 sec,and you work for more than 300 day per year,= 16.6 hours,if x
6、50 times this kind of situation per day,#!/usr/bin/env perl my $hppiness = PerlChina-join();,x 50 times this kind of situation per day ?,if this costs 4 sec,and you work for more than 300 day per year,= 16.6 hours,Awful,#!/usr/bin/env perl my $hppiness = PerlChina-join();,What can you do in 16.6 hou
7、rs,讀幾本書,陪家人,陪女朋友,or more hacking,sleep.,时间就是金钱,The VIM way.,VIM:,F,h,#!/usr/bin/env perl my $hppiness = perlchina-join();,VIM:,a,a,ppend,#!/usr/bin/env perl my $hppiness = perlchina-join();,VIM:,f,P,#!/usr/bin/env perl my $hppiness = perlchina-join();,VIM:,#!/usr/bin/env perl my $hppiness = Perlchin
8、a-join();,VIM:,#!/usr/bin/env perl my $hppiness = PErlchina-join();,VIM:,#!/usr/bin/env perl my $hppiness = PERlchina-join();,VIM:,#!/usr/bin/env perl my $hppiness = PERLchina-join();,So What is VIM ?,VIM 不是 IDE,VIM is an Editor,VI Improved,Move More Efficiently. 更有效率的移动,學習曲線,Features,1. Mode,More T
9、han 4 Edit Mode,INSERT NORMAL VISUAL SELECT . et cetera,IiNSERT NORMAL VvISUAL,ESC,1.1 Normal Mode,Motion,HJKL ,h , j , k , l H , M , L w , e , b fx , tx , , % ( , ) , , ,# comments .foreach my $foo ( bar ) # do something my outs = grep /pattern/ , list; sub func1 ,Cursor,# comments .foreach my $foo
10、 ( bar ) # do something my outs = grep /pattern/ , list; sub func1 ,# comments .foreach my $foo ( bar ) # do something my outs = grep /pattern/ , list; sub func1 ,# comments .foreach my $foo ( bar ) # do something my outs = grep /pattern/ , list; sub func1 ,# comments . foreach my $foo ( bar ) # do
11、something my outs = grep /pattern/ , list; sub func1 ,# comments .foreach my $foo ( bar ) # do something my outs = grep /pattern/ , list; sub func1 ,畫面最上方,# comments .foreach my $foo ( bar ) # do something my outs = grep /pattern/ , list; sub func1 ,畫面中間行,# comments .foreach my $foo ( bar ) # do som
12、ething my outs = grep /pattern/ , list; sub func1 ,畫面最下方,# comments .foreach my $foo ( bar ) # do something my outs = grep /pattern/ , list; sub func1 ,修改至行尾,# comments .foreach my $foo ( bar ) # do something my outs = grep /pattern/ , list; sub func1 ,並進入 Insert mode,# comments .foreach my $foo ( b
13、ar ) # do something my outs = grep sub func1 ,# comments .foreach my $foo ( bar ) # do something my outs = grep /pattern/ , list; sub func1 ,# comments .foreach my $foo ( bar ) # do something my outs = grep /pattern/ , list; sub func1 ,:h motion.txt,1.2 Insert Mode,Editing text,Insert Mode,i : Inser
14、t text before the cursor,i : Insert text before the cursor I : Insert text before the first non-blank in the line,Insert Mode,i : Insert text before the cursor I : Insert text before the first non-blank in the line a : Append text after the cursor,Insert Mode,i : Insert text before the cursor I : In
15、sert text before the first non-blank in the line a : Append text after the cursor A : Append text at the end of the line,Insert Mode,1.3 Visual Mode,Select region,Visual Mode,v : start Visual mode per character.,Visual Mode,v : start Visual mode per character. V : start Visual mode linewise.,Visual Mode,v : start Visual mode per character. V : start Visual mode linewise. Ctrl-v : start Visual mode blockwise.,Visual Mode,v : start Visual mode per character. V : start Visual mode linewise. Ctrl-v : start Visual mode blockwise.,operator 如 y (yank) , d (delete) , c (change) . etc,2. Sy