Vimperl
-
Upload
ynon-perek -
Category
Technology
-
view
161 -
download
0
description
Transcript of Vimperl
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 sentences, not characters
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>
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
Code can be repetitive
1 my $mail = {!2 john => '[email protected]',!3 bob => '[email protected]',!4 barbara => '[email protected]',!5 george => '[email protected]',!6 };!7 !
1 my $mail = {!2 john => '[email protected]',!3 bob => '[email protected]',!4 barbara => '[email protected]',!5 george => '[email protected]',!6 };!7 !
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 and find errors early
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 + testing
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
Install janus
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-complete
• Auto-close parens
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
Q & A
Thanks For Listening
• Ynon Perek
• http://ynonperek.com/