SlideShare a Scribd company logo
1 of 22
Download to read offline
The Joy of Vim
Johan Jansson / Oy Raisoft Ltd
devTalk Kokkola 3.12.2019
Raisoft intro
• Founded year 2000 in Kokkola
• 50+ employees – offices in Kokkola and Jyväskylä + remote contractors
• Revenue in the 7 figures range
Products
• RAIsoft.net (web based SaaS & On Premise solution)
A comprehensive software solution for measuring functional performance
and health status, as well as quality and effectiveness of care.
– Market: Finland, Switzerland, Spain, Singapore, Australia, …
• Smart Break: 3 minute workplace wellness solution
Personal background
Early editing
• First editor experience: edlin (late -80s)
Advanced editing
• Emacs (late -90s)
• “Vi is standardized in POSIX, so it’s available on almost all platforms”
• Easy to achieve hero status at the university
• Vi < Vim
Today
• CTO at Raisoft & part-time researcher
• Use Vim daily for code, config files, commit messages, log viewing, documents, email, data munging,
etc.
The Joy of Vim
Part I
The Joy of Vi
Bill Joy, the creator of the Vi editor
Vi was released in 1976
Joy was influential in other projects as well
• BSD UNIX
• NFS
• Java
The Joy of Vim
Bram Moolenaar, the creator of Vim
Released Vim in 1991
Fun fact:
Initially a vi-clone based on
another vi-clone ported to the Amiga.
The Joy of Vim
Part II
Vim intro
• Highly configurable text editor
• Available as GUI and in the console
• Rock stable, actively maintained
• Extensive plugin system
• Support for hundreds of programming languages and file formats
• Powerful macros, and search/replace
• Integrates well with many tools
• It’s a modal editor.
• It has a very powerful command system.
• There are other editors. I’m happy for you if you’ve found a good one.
Vim intro - modes
Normal Visual
Cmdline
Insert
We choose to learn Vim.
Not because it’s easy, but because it’s hard.
https://lucasfcosta.com/2016/09/25/How-I-Learned-to-Stop-Worrying-and-Love-vIM.html
We choose to learn Vim.
Not because it’s easy, but because it’s hard efficient.
https://lucasfcosta.com/2016/09/25/How-I-Learned-to-Stop-Worrying-and-Love-vIM.html
COMPOSITION
n. com·po·si·tion
The combining of distinct
parts or elements to form a whole.
COMPOSITION
Composing edit commands
Vim command: ACTION x TEXT OBJECT
ACTIONs:
• cut, delete, copy, paste
• autoformat/indent
• change case: upper/lower/invert
• search/replace
• increment/decrement
• select (=> visual mode)
• etc.
TEXT OBJECTs:
• text: char, word, line, sentence, paragraph
• blocks: ”...”, (...), [...], {...}, <...>
• code: xml/html tags
• range of lines
• cursor motion from current position:
– to start/end of text objects
– to next/previous search match
– to next/previous occurrence of character
Composing edit commands - examples
Vim command: ACTION x TEXT OBJECT
diw delete inside word
yi) copy inside ( ) parens
=a} auto-indent around { } braces
CHALLENGE:
Learn 10 actions, and 10 text objects:
you’ll be able to compose 100 commands.
Composing macros
Vim macro: recorded keyboard input.
=> Compose macros of multiple commands.
1. Start recording: q{name}
– qa records macro a
2. Edit, using re-usable commands (avoid using mouse input, use motion commands to move)
3. End macro: q
4. Replay macro:@a
You can record many different macros: registers a-z
DEMO: macros
DEMO 1:
convert for (var property in object) {…}
into object.forEach((property) => {…});
wwwwwdwNPa.<ESC>elsEach<ESC>wwdwi(<ESC>elct{) => <ESC>l%A);<ESC>
• 22 commands in total.
• Composed of a set of 7 actions x 6 text objects:
– Actions: d, P, a, s, i, c, A
– Text objects/motions: w, N, e, l, t, %
Macros & The Multiplication Principle of Combinatorics
So, you learnt 10 actions & 10 text objects.
you are able to compose 100 distinct commands.
How many 22-command macros can you create?
10022 = 100 000 000 000 000 000 000 000 000 000 000 000 000 000 000
(100 tredecillions)
Your imagination is the limit.
Other useful features
• Screen layout – split screen windows & tabs
• Spell check
• Auto-completion (text from files, dictionary, code
identifiers, file names, etc.)
• Edit files over scp
• Regex (search/replace)
• Vimdiff
• Auto-commands
• Shell integration
• Vimscript
• Registers
• Extensive plugin system
• Customizable key mappings
• Auto-formatting/highlighting
• Filters (process text with external program)
• Dot command . repeats last command in normal
mode
• Built-in-grep
• Compiler integration
• Comprehensive help system
• Built-in terminal
• File browser
DEMO composing features:
edit your file system with shell integration and vimdiff
DEMO 2: Clean up build server
• 3-way diff of directories on Jenkins build server
• Shell integration :r !<command> will read command output into vim buffer
• Split screen into multiple windows
• Diff windows with :windo diffthis
DEMO 3: Remove extra artifact directories
• Macros may execute shell commands
• Shell integration :!<command> will execute a shell command
CONCLUSION
• Composition is a powerful concept.
• Learn your editor well.
• Practice makes perfect.
• Learning curve = compound interest efficiency!
• My vim config: https://github.com/jupj/vimconfig
• Take the challenge!
• Start with 5 x 5.
Thank you!
Q & A?

More Related Content

Similar to The Joy of Vim

One Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp LondonOne Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp London
hernanibf
 

Similar to The Joy of Vim (20)

AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
 
XPages Blast - Lotusphere 2012
XPages Blast - Lotusphere 2012XPages Blast - Lotusphere 2012
XPages Blast - Lotusphere 2012
 
Tips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS ApplicationsTips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS Applications
 
Wintellect - Windows 8 for the Silverlight and WPF Developer
Wintellect   - Windows 8 for the Silverlight and WPF DeveloperWintellect   - Windows 8 for the Silverlight and WPF Developer
Wintellect - Windows 8 for the Silverlight and WPF Developer
 
XPages on Bluemix - the Do's and Dont's
XPages on Bluemix - the Do's and Dont'sXPages on Bluemix - the Do's and Dont's
XPages on Bluemix - the Do's and Dont's
 
Import Tools for InduSoft Web Studio - PanelMate, PanelView, and FactoryTalk
Import Tools for InduSoft Web Studio - PanelMate, PanelView, and FactoryTalkImport Tools for InduSoft Web Studio - PanelMate, PanelView, and FactoryTalk
Import Tools for InduSoft Web Studio - PanelMate, PanelView, and FactoryTalk
 
Fsoss 2010 en
Fsoss 2010 enFsoss 2010 en
Fsoss 2010 en
 
IconUS 2016 conference - Connections Administration Skills
IconUS 2016 conference - Connections Administration SkillsIconUS 2016 conference - Connections Administration Skills
IconUS 2016 conference - Connections Administration Skills
 
Migration Approaches for FDMEE
Migration Approaches for FDMEEMigration Approaches for FDMEE
Migration Approaches for FDMEE
 
Accelerating time to delivery: Modernizing Application Development
Accelerating time to delivery: Modernizing Application DevelopmentAccelerating time to delivery: Modernizing Application Development
Accelerating time to delivery: Modernizing Application Development
 
Building Rich Internet Applications with Ext JS
Building Rich Internet Applications  with Ext JSBuilding Rich Internet Applications  with Ext JS
Building Rich Internet Applications with Ext JS
 
Developing a World Class Web 2.0 Application with XPages
Developing a World Class Web 2.0 Application with XPagesDeveloping a World Class Web 2.0 Application with XPages
Developing a World Class Web 2.0 Application with XPages
 
Owd multi repo-v2
Owd multi repo-v2Owd multi repo-v2
Owd multi repo-v2
 
ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...
ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...
ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...
 
The lazy administrator, how to make your life easier by using tdi to automate...
The lazy administrator, how to make your life easier by using tdi to automate...The lazy administrator, how to make your life easier by using tdi to automate...
The lazy administrator, how to make your life easier by using tdi to automate...
 
XPages Blast - Lotusphere 2011
XPages Blast - Lotusphere 2011XPages Blast - Lotusphere 2011
XPages Blast - Lotusphere 2011
 
How to become a Rational Developer for IBM i Power User
How to become a Rational Developer for IBM i Power UserHow to become a Rational Developer for IBM i Power User
How to become a Rational Developer for IBM i Power User
 
resume_new
resume_newresume_new
resume_new
 
SDWest2005Goetsch
SDWest2005GoetschSDWest2005Goetsch
SDWest2005Goetsch
 
One Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp LondonOne Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp London
 

Recently uploaded

CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
Wonjun Hwang
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 

Recently uploaded (20)

CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistan
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 

The Joy of Vim

  • 1. The Joy of Vim Johan Jansson / Oy Raisoft Ltd devTalk Kokkola 3.12.2019
  • 2. Raisoft intro • Founded year 2000 in Kokkola • 50+ employees – offices in Kokkola and Jyväskylä + remote contractors • Revenue in the 7 figures range Products • RAIsoft.net (web based SaaS & On Premise solution) A comprehensive software solution for measuring functional performance and health status, as well as quality and effectiveness of care. – Market: Finland, Switzerland, Spain, Singapore, Australia, … • Smart Break: 3 minute workplace wellness solution
  • 3. Personal background Early editing • First editor experience: edlin (late -80s) Advanced editing • Emacs (late -90s) • “Vi is standardized in POSIX, so it’s available on almost all platforms” • Easy to achieve hero status at the university • Vi < Vim Today • CTO at Raisoft & part-time researcher • Use Vim daily for code, config files, commit messages, log viewing, documents, email, data munging, etc.
  • 4. The Joy of Vim Part I
  • 5. The Joy of Vi Bill Joy, the creator of the Vi editor Vi was released in 1976 Joy was influential in other projects as well • BSD UNIX • NFS • Java
  • 6. The Joy of Vim Bram Moolenaar, the creator of Vim Released Vim in 1991 Fun fact: Initially a vi-clone based on another vi-clone ported to the Amiga.
  • 7. The Joy of Vim Part II
  • 8. Vim intro • Highly configurable text editor • Available as GUI and in the console • Rock stable, actively maintained • Extensive plugin system • Support for hundreds of programming languages and file formats • Powerful macros, and search/replace • Integrates well with many tools • It’s a modal editor. • It has a very powerful command system. • There are other editors. I’m happy for you if you’ve found a good one.
  • 9. Vim intro - modes Normal Visual Cmdline Insert
  • 10. We choose to learn Vim. Not because it’s easy, but because it’s hard. https://lucasfcosta.com/2016/09/25/How-I-Learned-to-Stop-Worrying-and-Love-vIM.html
  • 11. We choose to learn Vim. Not because it’s easy, but because it’s hard efficient. https://lucasfcosta.com/2016/09/25/How-I-Learned-to-Stop-Worrying-and-Love-vIM.html
  • 12. COMPOSITION n. com·po·si·tion The combining of distinct parts or elements to form a whole.
  • 14. Composing edit commands Vim command: ACTION x TEXT OBJECT ACTIONs: • cut, delete, copy, paste • autoformat/indent • change case: upper/lower/invert • search/replace • increment/decrement • select (=> visual mode) • etc. TEXT OBJECTs: • text: char, word, line, sentence, paragraph • blocks: ”...”, (...), [...], {...}, <...> • code: xml/html tags • range of lines • cursor motion from current position: – to start/end of text objects – to next/previous search match – to next/previous occurrence of character
  • 15. Composing edit commands - examples Vim command: ACTION x TEXT OBJECT diw delete inside word yi) copy inside ( ) parens =a} auto-indent around { } braces CHALLENGE: Learn 10 actions, and 10 text objects: you’ll be able to compose 100 commands.
  • 16. Composing macros Vim macro: recorded keyboard input. => Compose macros of multiple commands. 1. Start recording: q{name} – qa records macro a 2. Edit, using re-usable commands (avoid using mouse input, use motion commands to move) 3. End macro: q 4. Replay macro:@a You can record many different macros: registers a-z
  • 17. DEMO: macros DEMO 1: convert for (var property in object) {…} into object.forEach((property) => {…}); wwwwwdwNPa.<ESC>elsEach<ESC>wwdwi(<ESC>elct{) => <ESC>l%A);<ESC> • 22 commands in total. • Composed of a set of 7 actions x 6 text objects: – Actions: d, P, a, s, i, c, A – Text objects/motions: w, N, e, l, t, %
  • 18. Macros & The Multiplication Principle of Combinatorics So, you learnt 10 actions & 10 text objects. you are able to compose 100 distinct commands. How many 22-command macros can you create? 10022 = 100 000 000 000 000 000 000 000 000 000 000 000 000 000 000 (100 tredecillions) Your imagination is the limit.
  • 19. Other useful features • Screen layout – split screen windows & tabs • Spell check • Auto-completion (text from files, dictionary, code identifiers, file names, etc.) • Edit files over scp • Regex (search/replace) • Vimdiff • Auto-commands • Shell integration • Vimscript • Registers • Extensive plugin system • Customizable key mappings • Auto-formatting/highlighting • Filters (process text with external program) • Dot command . repeats last command in normal mode • Built-in-grep • Compiler integration • Comprehensive help system • Built-in terminal • File browser
  • 20. DEMO composing features: edit your file system with shell integration and vimdiff DEMO 2: Clean up build server • 3-way diff of directories on Jenkins build server • Shell integration :r !<command> will read command output into vim buffer • Split screen into multiple windows • Diff windows with :windo diffthis DEMO 3: Remove extra artifact directories • Macros may execute shell commands • Shell integration :!<command> will execute a shell command
  • 21. CONCLUSION • Composition is a powerful concept. • Learn your editor well. • Practice makes perfect. • Learning curve = compound interest efficiency! • My vim config: https://github.com/jupj/vimconfig • Take the challenge! • Start with 5 x 5.