P O R Q U E V I M ?
A U G U S T O PA S C U T T I
Sebastião Salgado
V O C Ê D E V E R I A U S A R
V I M ?
V O C Ê D E V E R I A U S A R
V I M ?
N Ã O
B O M S O F T WA R E
N O S S O O B J E T I V O É S E M P R E P R O D U Z I R :
Edward Weston
O Q U E É U M
B O M
S O F T WA R E ?
O Q U E FA Z U M S O F T WA R E R U I M ?
• Bugs
• Difícil de usar
• Código difícil:
• De entender
• De estender
• De mudar
C O M O C R I A R
B O M
S O F T WA R E ?
“ C O M O
C O Z I N H A R
B E M ? ”
“ C O M A
B O A
C O M I D A ”
L I N U X
E X I S T E M B O N S E X E M P L O S D E S O F T WA R E ?
Sebastião Salgado
– R O B P I K E
“The heart of Unix philosophy is the idea that the
power of a system comes more from the
relationships amo...
I M P O N D O L I M I T E S
• Passar o máximo de tempo possível na shell.
• Evitar root. Customizar pouco.
• Otimizar semp...
E X E M P L O S
A N A LY T I C S
#!/bin/bash
[~/Apache] $ cat /var/log/apache2/access.log
220.181.108.101 - - [20/Jun/2012:19:31:01 +0200] "GET / HTTP/1.1" 200 912 "-" "Mozilla/5.0 (compatible;
Baiduspider/2.0; +...
#!/bin/bash
[~/Apache] $ wc -l access.log
65063 access.log
#!/bin/bash
[~/Apache] $ grep "HTTP/1.1" access.log | wc -l
52129
#!/bin/bash
[~/Apache] $ tail -n 1 access.log
192.210.213.91 - - [08/Jun/2014:19:42:34 -0700] "GET /logs/
access.log HTTP/...
#!/bin/bash
[~/Apache]$ head -n 1 access.log
1.202.218.8 - - [20/Jun/2012:19:05:12 +0200] "GET /
robots.txt HTTP/1.0" 404 ...
#!/bin/bash
[~/Apache]$ head -n 1 access.log
1.202.218.8 - - [20/Jun/2012:19:05:12 +0200] "GET /
robots.txt HTTP/1.0" 404 ...
#!/bin/bash
[~/Apache]$ head -n 1 access.log
1.202.218.8 - - [20/Jun/2012:19:05:12 +0200] "GET /
robots.txt HTTP/1.0" 404 ...
#!/bin/bash
[~/Apache]$ head -n 1 access.log
1.202.218.8 - - [20/Jun/2012:19:05:12 +0200] "GET /
robots.txt HTTP/1.0" 404 ...
#!/bin/bash
[~/Apache] $ awk '/access.log/' access.log | 
awk '{print $1}' | 
sort | 
uniq -c | 
sort -r
#!/bin/bash
[~/Apache] $ awk '/access.log/' access.log | 
awk '{print $1}' | 
sort | 
uniq -c | 
sort -r
41 31.184.238.164...
B R O W S E R U S E D
IE
1%
Chrome
39%
Firefox
60%
G I T
G I T T O W E R
M E U R E P O S I T Ó R I O
B R A N C H E S
L O G
C O M M I T
H A H A H A
[~/symfony] $ git branch
* 2.7
[~/symfony] $ git branch
* 2.7
[~/symfony] $ git log | wc -l
299 348
[~/symfony] $ git branch
* 2.7
[~/symfony] $ git log | wc -l
299 348
[~/symfony] $ alias rank="sort | uniq -c | sort -nr |...
[~/symfony] $ git branch
* 2.7
[~/symfony] $ git log | wc -l
299 348
[~/symfony] $ alias rank="sort | uniq -c | sort -nr |...
[~/symfony] $ git branch
* 2.7
[~/symfony] $ git log | wc -l
299 348
[~/symfony] $ alias rank="sort | uniq -c | sort -nr |...
[~/symfony] $ git branch
* 2.7
[~/symfony] $ git log | wc -l
299 348
[~/symfony] $ alias rank="sort | uniq -c | sort -nr |...
[~/symfony] $ git branch
* 2.7
[~/symfony] $ git log | wc -l
299 348
[~/symfony] $ alias rank="sort | uniq -c | sort -nr |...
[~/symfony] $ git branch
* 2.7
[~/symfony] $ git log | wc -l
299 348
[~/symfony] $ alias rank="sort | uniq -c | sort -nr |...
[~/symfony] $ git config alias.author "log --format=%an"
[~/symfony] $ git config alias.author "log --format=%an"
[~/symfony] $ git author —since 2014-01-01 | rank
2444 Fabien Pot...
[~/symfony] $ cd ../zf2
[~/symfony] $ cd ../zf2
[~/zf2] $
[~/symfony] $ cd ../zf2
[~/zf2] $ git author | rank
7963 Matthew Weier O'Phinney
1647 Marco Pivetta
782 Maks3w
[~/zf2] $ git author --since 2014-01-01 | rank
1507 Marco Pivetta
1048 Matthew Weier O'Phinney
215 Abdul Malik Ikhsan
1 #!/usr/bin/env php
2 <?php
3 /**
4 * hdate (Human Date)
5 *
6 * Converts a human (relative) date to an specific date.
7 ...
[~/zf2] $ git author --since `hdate -1year` | rank
1358 Marco Pivetta
564 Matthew Weier O'Phinney
132 Abdul Malik Ikhsan
E D I T O R
V O LTA N D O A O
T R A B A L H O
[~/zf2] $ git diff --name-only HEAD^
library/Zend/Db/Sql/AbstractSql.php
tests/ZendTest/Db/Sql/AbstractSqlTest.php
tests/Z...
[~/zf2] $ git diff --name-only HEAD^
library/Zend/Db/Sql/AbstractSql.php
tests/ZendTest/Db/Sql/AbstractSqlTest.php
tests/Z...
L I N T ?
< E S C > : ! P H P - L %
< E S C > : ! P H P - L %
N O R M A L M O D E
< E S C > : ! P H P - L %
C O M A N D O E X T E R N O
< E S C > : ! P H P - L %
O P Ç Ã O “ L I N T ” D O P H P
< E S C > : ! P H P - L %
C A M I N H O C O M P L E T O D O A R Q U I V O A T U A L
R O D A R U M T E S T E ?
C H E C A R E S T I L O ?
V E R Ú LT I M O S A U T O R E S ?
A D I C I O N A R N O G I T ?
T U D O I S S O C O M A L G U N S
P O U C O S P R I N C Í P I O S D E D E S I G N
P R I N C Í P I O S
• Tudo é um arquivo
• Tipo de Informação? Texto.
• Escopos diferentes? Quebra de linha.
• Cache? Nah.
...
L I M I T E S S Ã O B O N S ?
C O N C L U S Ã O
Cartier Bresson
P E R G U N TA S ?
W Eugene Smith
H T T P : / / B I T. LY / G U G U - L I N D O
F O I B O M P R A V O C Ê ?
Porque VIM?
Porque VIM?
Porque VIM?
Porque VIM?
Próximos SlideShares
Carregando em…5
×

Porque VIM?

7.323 visualizações

Publicada em

Por que deixei de usar IDEs e comecei a usar um editor no terminal.
Apresentação feita na #PHPExperince 2015.
Blog post: http://bit.ly/gugu-lindo

Publicada em: Software
1 comentário
11 gostaram
Estatísticas
Notas
Sem downloads
Visualizações
Visualizações totais
7.323
No SlideShare
0
A partir de incorporações
0
Número de incorporações
682
Ações
Compartilhamentos
0
Downloads
15
Comentários
1
Gostaram
11
Incorporações 0
Nenhuma incorporação

Nenhuma nota no slide

Porque VIM?

  1. 1. P O R Q U E V I M ? A U G U S T O PA S C U T T I Sebastião Salgado
  2. 2. V O C Ê D E V E R I A U S A R V I M ?
  3. 3. V O C Ê D E V E R I A U S A R V I M ? N Ã O
  4. 4. B O M S O F T WA R E N O S S O O B J E T I V O É S E M P R E P R O D U Z I R : Edward Weston
  5. 5. O Q U E É U M B O M S O F T WA R E ?
  6. 6. O Q U E FA Z U M S O F T WA R E R U I M ? • Bugs • Difícil de usar • Código difícil: • De entender • De estender • De mudar
  7. 7. C O M O C R I A R B O M S O F T WA R E ?
  8. 8. “ C O M O C O Z I N H A R B E M ? ”
  9. 9. “ C O M A B O A C O M I D A ”
  10. 10. L I N U X E X I S T E M B O N S E X E M P L O S D E S O F T WA R E ? Sebastião Salgado
  11. 11. – R O B P I K E “The heart of Unix philosophy is the idea that the power of a system comes more from the relationships among programs than from the programs themselves.”
  12. 12. I M P O N D O L I M I T E S • Passar o máximo de tempo possível na shell. • Evitar root. Customizar pouco. • Otimizar sempre.
  13. 13. E X E M P L O S
  14. 14. A N A LY T I C S
  15. 15. #!/bin/bash [~/Apache] $ cat /var/log/apache2/access.log
  16. 16. 220.181.108.101 - - [20/Jun/2012:19:31:01 +0200] "GET / HTTP/1.1" 200 912 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" 123.125.68.79 - - [20/Jun/2012:19:53:24 +0200] "GET / HTTP/1.1" 200 625 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" 178.154.210.252 - - [20/Jun/2012:19:54:10 +0200] "GET /?C=S;O=A HTTP/1.1" 200 663 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" 74.125.126.102 - - [20/Jun/2012:20:15:28 +0200] "GET / HTTP/1.1" 200 606 "http://www.google.com/url? sa=t&rct=j&q=error&source=web&cd=1&ved=0CFAQFjAG&url=http%3A%2F%2Fwww.isrolab.com %2F&ei=GxPiT5PsL4e04AHPtgE&usg=AFQjCNHnmjmdkUV584ORIpOXz7zAPX0UHQ" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)" 74.125.126.103 - - [20/Jun/2012:20:15:29 +0200] "GET /icons/blank.gif HTTP/1.1" 200 383 "http:// www.isrolab.com/" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)" 74.125.126.93 - - [20/Jun/2012:20:15:29 +0200] "GET /icons/folder.gif HTTP/1.1" 200 460 "http:// www.isrolab.com/" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)" 74.125.126.82 - - [20/Jun/2012:20:15:30 +0200] "GET /favicon.ico HTTP/1.1" 404 449 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)" 184.82.92.239 - - [20/Jun/2012:21:03:44 +0200] "GET /logs/access.log HTTP/1.1" 200 2519 "http://isrolab.com/" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 3.5.30729)" 173.236.21.106 - - [20/Jun/2012:21:16:22 +0200] "GET /robots.txt HTTP/1.0" 404 488 "-" "Mozilla/5.0 (compatible; MJ12bot/v1.4.3; http://www.majestic12.co.uk/bot.php?+)" 173.236.21.106 - - [20/Jun/2012:21:16:23 +0200] "GET / HTTP/1.0" 200 621 "-" "Mozilla/5.0 (compatible; MJ12bot/v1.4.3; http://www.majestic12.co.uk/bot.php?+)" 213.186.122.2 - - [20/Jun/2012:21:27:53 +0200] "GET /logs/?C=D;O=D HTTP/1.1" 200 658 "-" "Mozilla/5.0 (compatible; AhrefsBot/3.0; +http://ahrefs.com/robot/)" 66.249.72.65 - - [20/Jun/2012:21:28:00 +0200] "GET /robots.txt HTTP/1.1" 404 508 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" 66.249.72.65 - - [20/Jun/2012:21:28:00 +0200] "GET /logs/ HTTP/1.1" 200 723 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" 123.125.71.44 - - [20/Jun/2012:21:38:57 +0200] "GET / HTTP/1.1" 200 913 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" 220.181.108.88 - - [20/Jun/2012:21:39:48 +0200] "GET / HTTP/1.1" 200 913 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" 178.154.210.252 - - [20/Jun/2012:21:45:12 +0200] "GET /logs/ HTTP/1.1" 200 728 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" 139.18.2.209 - - [20/Jun/2012:22:31:43 +0200] "GET / HTTP/1.1" 200 912 "-" "findlinks/2.6 (+http:// wortschatz.uni-leipzig.de/findlinks/)"
  17. 17. #!/bin/bash [~/Apache] $ wc -l access.log 65063 access.log
  18. 18. #!/bin/bash [~/Apache] $ grep "HTTP/1.1" access.log | wc -l 52129
  19. 19. #!/bin/bash [~/Apache] $ tail -n 1 access.log 192.210.213.91 - - [08/Jun/2014:19:42:34 -0700] "GET /logs/ access.log HTTP/1.1" 200 4663 "http://redlug.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1" "redlug.com"
  20. 20. #!/bin/bash [~/Apache]$ head -n 1 access.log 1.202.218.8 - - [20/Jun/2012:19:05:12 +0200] "GET / robots.txt HTTP/1.0" 404 492 "-" ""Mozilla/5.0"
  21. 21. #!/bin/bash [~/Apache]$ head -n 1 access.log 1.202.218.8 - - [20/Jun/2012:19:05:12 +0200] "GET / robots.txt HTTP/1.0" 404 492 "-" “"Mozilla/5.0"
  22. 22. #!/bin/bash [~/Apache]$ head -n 1 access.log 1.202.218.8 - - [20/Jun/2012:19:05:12 +0200] "GET / robots.txt HTTP/1.0" 404 492 "-" “"Mozilla/5.0" [~/Apache]$ head -n 1 access.log | awk '{print $1}' 1.202.218.8
  23. 23. #!/bin/bash [~/Apache]$ head -n 1 access.log 1.202.218.8 - - [20/Jun/2012:19:05:12 +0200] "GET / robots.txt HTTP/1.0" 404 492 "-" “"Mozilla/5.0" [~/Apache]$ head -n 1 access.log | awk '{print $1}' 1.202.218.8 [~/Apache]$ awk '/access.log/' access.log | awk '{print $1}' 31.184.238.164 31.184.238.164 77.27.18.67 31.184.238.164 31.184.238.164 31.184.238.164 31.184.238.164 31.184.238.164
  24. 24. #!/bin/bash [~/Apache] $ awk '/access.log/' access.log | awk '{print $1}' | sort | uniq -c | sort -r
  25. 25. #!/bin/bash [~/Apache] $ awk '/access.log/' access.log | awk '{print $1}' | sort | uniq -c | sort -r 41 31.184.238.164 2 192.210.213.91 1 77.27.18.67 1 192.227.243.66 1 189.120.185.4
  26. 26. B R O W S E R U S E D IE 1% Chrome 39% Firefox 60%
  27. 27. G I T
  28. 28. G I T T O W E R
  29. 29. M E U R E P O S I T Ó R I O
  30. 30. B R A N C H E S
  31. 31. L O G
  32. 32. C O M M I T
  33. 33. H A H A H A
  34. 34. [~/symfony] $ git branch * 2.7
  35. 35. [~/symfony] $ git branch * 2.7 [~/symfony] $ git log | wc -l 299 348
  36. 36. [~/symfony] $ git branch * 2.7 [~/symfony] $ git log | wc -l 299 348 [~/symfony] $ alias rank="sort | uniq -c | sort -nr | head -n 3“
  37. 37. [~/symfony] $ git branch * 2.7 [~/symfony] $ git log | wc -l 299 348 [~/symfony] $ alias rank="sort | uniq -c | sort -nr | head -n 3“
  38. 38. [~/symfony] $ git branch * 2.7 [~/symfony] $ git log | wc -l 299 348 [~/symfony] $ alias rank="sort | uniq -c | sort -nr | head -n 3“
  39. 39. [~/symfony] $ git branch * 2.7 [~/symfony] $ git log | wc -l 299 348 [~/symfony] $ alias rank="sort | uniq -c | sort -nr | head -n 3“
  40. 40. [~/symfony] $ git branch * 2.7 [~/symfony] $ git log | wc -l 299 348 [~/symfony] $ alias rank="sort | uniq -c | sort -nr | head -n 3“
  41. 41. [~/symfony] $ git branch * 2.7 [~/symfony] $ git log | wc -l 299 348 [~/symfony] $ alias rank="sort | uniq -c | sort -nr | head -n 3“ [~/symfony] $ git log --format=%an | rank 10725 Fabien Potencier 1211 Bernhard Schussek 371 Tobias Schultze
  42. 42. [~/symfony] $ git config alias.author "log --format=%an"
  43. 43. [~/symfony] $ git config alias.author "log --format=%an" [~/symfony] $ git author —since 2014-01-01 | rank 2444 Fabien Potencier 357 Nicolas Grekas 262 Bernhard Schussek
  44. 44. [~/symfony] $ cd ../zf2
  45. 45. [~/symfony] $ cd ../zf2 [~/zf2] $
  46. 46. [~/symfony] $ cd ../zf2 [~/zf2] $ git author | rank 7963 Matthew Weier O'Phinney 1647 Marco Pivetta 782 Maks3w
  47. 47. [~/zf2] $ git author --since 2014-01-01 | rank 1507 Marco Pivetta 1048 Matthew Weier O'Phinney 215 Abdul Malik Ikhsan
  48. 48. 1 #!/usr/bin/env php 2 <?php 3 /** 4 * hdate (Human Date) 5 * 6 * Converts a human (relative) date to an specific date. 7 * Usage: hdate "+10 day" 11 */ 12 13 $relativeDate = $argv[1]; 14 $date = new DateTime($relativeDate); 15 16 echo $date->format('Y-m-d');
  49. 49. [~/zf2] $ git author --since `hdate -1year` | rank 1358 Marco Pivetta 564 Matthew Weier O'Phinney 132 Abdul Malik Ikhsan
  50. 50. E D I T O R
  51. 51. V O LTA N D O A O T R A B A L H O
  52. 52. [~/zf2] $ git diff --name-only HEAD^ library/Zend/Db/Sql/AbstractSql.php tests/ZendTest/Db/Sql/AbstractSqlTest.php tests/ZendTest/Db/Sql/ExpressionTest.php
  53. 53. [~/zf2] $ git diff --name-only HEAD^ library/Zend/Db/Sql/AbstractSql.php tests/ZendTest/Db/Sql/AbstractSqlTest.php tests/ZendTest/Db/Sql/ExpressionTest.php [~/zf2] $ vim `git diff --name-only HEAD^`
  54. 54. L I N T ?
  55. 55. < E S C > : ! P H P - L %
  56. 56. < E S C > : ! P H P - L % N O R M A L M O D E
  57. 57. < E S C > : ! P H P - L % C O M A N D O E X T E R N O
  58. 58. < E S C > : ! P H P - L % O P Ç Ã O “ L I N T ” D O P H P
  59. 59. < E S C > : ! P H P - L % C A M I N H O C O M P L E T O D O A R Q U I V O A T U A L
  60. 60. R O D A R U M T E S T E ?
  61. 61. C H E C A R E S T I L O ?
  62. 62. V E R Ú LT I M O S A U T O R E S ?
  63. 63. A D I C I O N A R N O G I T ?
  64. 64. T U D O I S S O C O M A L G U N S P O U C O S P R I N C Í P I O S D E D E S I G N
  65. 65. P R I N C Í P I O S • Tudo é um arquivo • Tipo de Informação? Texto. • Escopos diferentes? Quebra de linha. • Cache? Nah. • Erros? Yeah!
  66. 66. L I M I T E S S Ã O B O N S ? C O N C L U S Ã O Cartier Bresson
  67. 67. P E R G U N TA S ? W Eugene Smith
  68. 68. H T T P : / / B I T. LY / G U G U - L I N D O F O I B O M P R A V O C Ê ?

×