0
Effective Text Editing
for Perl Developers
Ynon Perek
ynon@ynonperek.com
Agenda
What’s Wrong with my editor?
Can you fix it?
Should I Switch Editors?
! text editors slow you down
Keynote Template
Reasons to be angry
• A text editor always slows you down
• Some are worse than others
type less,
Keynote Template
more"
Some annoyances with “naive”
text editors
• Writing code
• Navigating in code
• Testing code
• Running code
1 while(<>) {!
2 !
3 }!
4 !
5 sub doStuff {!
6 !
7 }!
8 !
9 for ( my $i=0; $i < 10; $i++ ) {!
10 !
11 }
Code is written in...
Code uses boilerplates
1 package BlogPost;!
2 use Moose;!
3 use v5.18;!
4 !
5 !
6 1;
1 <!DOCTYPE html>!
2 <html>!
3 <head>...
Code has context
1 use strict;!
2 use warnings;!
3 use List::MoreUtils qw/pairwise/;!
4 use v5.18;!
5 !
6 my @foo, @bar;!
...
Code can be repetitive
1 my $mail = {!
2 john => 'john@gmail.com',!
3 bob => 'bob@walla.co.il',!
4 barbara => 'bar@gmail.c...
The more you type…
• you’ll waste more time
• you’ll make more mistakes
• you’ll be less happy
A text editor can be a friend
• In writing:
• Code snippets
• File templates
• Context aware auto complete
• Verify syntax...
A text editor can be a friend
• While working on a project:
• File navigation
• Documentation
• Quickly find what you need
A text editor can be a friend
• While running and testing:
• Reminds you to run unit tests
• Helps you run complex flows
Agenda
What’s Wrong with my editor?
Can you fix it?
Should I Switch Editors?
Fixing a text editor
• File templates
• Code snippets
• Omni complete
• Easy project navigation + documentation
• Running ...
We’ll use …
#janus
A fully customisable
text editor
A collection of plugins
and settings for vim to
get started
+
Getting Started (Ubuntu)
sudo apt-get install vim-gnome
Install vim
curl -Lo- https://bit.ly/janus-bootstrap | bash
Instal...
What We Got
• Line and column numbers
• Nicer colours and better defaults
What We Got
• Find in files - ack
• Fuzzy file finder
• Easy code comments
• Project drawer
• Tab completion
• Basic snippets
Now let’s get to work
Demos - Editing
• Adding new snippets with snipMate
• File templates with vim-template
• Align perl hashes
• Perl omni-com...
Plugins Installed
• Viewdoc:

http://www.vim.org/scripts/script.php?
script_id=3893
• Vim template:

https://github.com/ap...
Q & A
Thanks For Listening
• Ynon Perek
• http://ynonperek.com/
• ynon@ynonperek.com
Upcoming SlideShare
Loading in...5
×

Vimperl

252

Published on

My talk at telaviv.pm meetup on May 28

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
252
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Vimperl"

  1. 1. Effective Text Editing for Perl Developers Ynon Perek ynon@ynonperek.com
  2. 2. Agenda What’s Wrong with my editor? Can you fix it? Should I Switch Editors?
  3. 3. ! text editors slow you down Keynote Template
  4. 4. Reasons to be angry • A text editor always slows you down • Some are worse than others
  5. 5. type less, Keynote Template more"
  6. 6. Some annoyances with “naive” text editors • Writing code • Navigating in code • Testing code • Running code
  7. 7. 1 while(<>) {! 2 ! 3 }! 4 ! 5 sub doStuff {! 6 ! 7 }! 8 ! 9 for ( my $i=0; $i < 10; $i++ ) {! 10 ! 11 } Code is written in sentences, 
 not characters
  8. 8. Code uses boilerplates 1 package BlogPost;! 2 use Moose;! 3 use v5.18;! 4 ! 5 ! 6 1; 1 <!DOCTYPE html>! 2 <html>! 3 <head>! 4 <meta charset="utf-8" />! 5 <title>test</title>! 6 </head>! 7 <body>! 8 ! 9 </body>! 10 </html>
  9. 9. Code has context 1 use strict;! 2 use warnings;! 3 use List::MoreUtils qw/pairwise/;! 4 use v5.18;! 5 ! 6 my @foo, @bar;! 7 my %h = pairwise(@foo, @bar); you’ll probably want @foo or @bar here
  10. 10. Code can be repetitive 1 my $mail = {! 2 john => 'john@gmail.com',! 3 bob => 'bob@walla.co.il',! 4 barbara => 'bar@gmail.com',! 5 george => 'g@george.com',! 6 };! 7 ! 1 my $mail = {! 2 john => 'john@gmail.com',! 3 bob => 'bob@walla.co.il',! 4 barbara => 'bar@gmail.com',! 5 george => 'g@george.com',! 6 };! 7 !
  11. 11. The more you type… • you’ll waste more time • you’ll make more mistakes • you’ll be less happy
  12. 12. A text editor can be a friend • In writing: • Code snippets • File templates • Context aware auto complete • Verify syntax and find errors early
  13. 13. A text editor can be a friend • While working on a project: • File navigation • Documentation • Quickly find what you need
  14. 14. A text editor can be a friend • While running and testing: • Reminds you to run unit tests • Helps you run complex flows
  15. 15. Agenda What’s Wrong with my editor? Can you fix it? Should I Switch Editors?
  16. 16. Fixing a text editor • File templates • Code snippets • Omni complete • Easy project navigation + documentation • Running + testing
  17. 17. We’ll use … #janus A fully customisable text editor A collection of plugins and settings for vim to get started +
  18. 18. Getting Started (Ubuntu) sudo apt-get install vim-gnome Install vim curl -Lo- https://bit.ly/janus-bootstrap | bash Install janus
  19. 19. What We Got • Line and column numbers • Nicer colours and better defaults
  20. 20. What We Got • Find in files - ack • Fuzzy file finder • Easy code comments • Project drawer • Tab completion • Basic snippets
  21. 21. Now let’s get to work
  22. 22. Demos - Editing • Adding new snippets with snipMate • File templates with vim-template • Align perl hashes • Perl omni-complete • Auto-close parens
  23. 23. Plugins Installed • Viewdoc:
 http://www.vim.org/scripts/script.php? script_id=3893 • Vim template:
 https://github.com/aperezdc/vim-template/ • Auto pairs:
 https://github.com/ynonp/auto-pairs
  24. 24. Q & A
  25. 25. Thanks For Listening • Ynon Perek • http://ynonperek.com/ • ynon@ynonperek.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×