Your SlideShare is downloading. ×
Text-Objects - vim's elegant function
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Text-Objects - vim's elegant function

413
views

Published on

vim の機能である Text-Objects の紹介。 …

vim の機能である Text-Objects の紹介。
kanazawa.rb meetup 18 LT 資料。

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

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

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Text-Objects vim's elegant function 2014/02/15 - Kanazawa.rb meetup 18 LT
  • 2. vim operation • [operator] [motion] • target = from cursor potion to motion result
  • 3. vim operator • c : change • d : delete • y : yank • p : paste • etc ...
  • 4. vim motion • j : next line • w : next word head • $ : line end • / : search • etc ...
  • 5. example 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 2. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 3. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  • 6. example 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 2. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 3. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. d$
  • 7. example 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. delete 2. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 3. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. d$
  • 8. example 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. delete 2. Ut enim ad 3. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. d$
  • 9. motion only? • You can use Text-Objects
  • 10. Text Objects • blocked chars • word, sentence, paragraph block • special char surround block • "xxx", (xxx), <xxx>, <p>xxx</p>
  • 11. Text Objects • blocked chars • word, sentence, paragraph block • special char surround block • "xxx", (xxx), <xxx>, <p>xxx</p> Yes, corder friendly!!
  • 12. How to use • [operator] [motion] ↓ • [operator] [text-objects specifier] • target = specified text-objects
  • 13. specifier • [a|i][wsp])}>"'`t] • aw : a word • i> : inner > • at : a tag • etc...
  • 14. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") 4. .html('<p>fancy html</p>') 5. .appendTo('.super_anchor'); 6. };
  • 15. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") 4. .html('<p>fancy html</p>') 5. .appendTo('.super_anchor'); 6. };
  • 16. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") 4. .html('<p>fancy html</p>') 5. .appendTo('.super_anchor'); 6. }; di'
  • 17. example 1. var superFunc = function() { 2. console.log (''); 3. $("<div>") 4. .html('<p>fancy html</p>') 5. .appendTo('.super_anchor'); 6. }; di'
  • 18. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") 4. .html('<p>fancy html</p>') 5. .appendTo('.super_anchor'); 6. };
  • 19. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") 4. .html('<p>fancy html</p>') 5. .appendTo('.super_anchor'); 6. }; cit
  • 20. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") 4. .html('<p>abc</p>') 5. .appendTo('.super_anchor'); 6. }; cit
  • 21. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") 4. .html('<p>fancy html</p>') 5. .appendTo('.super_anchor'); 6. }; cat
  • 22. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") include tag 4. .html('<p>fancy html</p>') 5. .appendTo('.super_anchor'); 6. }; cat
  • 23. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") 4. .html('abc') 5. .appendTo('.super_anchor'); 6. }; cat
  • 24. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") 4. .html('<p>fancy html</p>') 5. .appendTo('.super_anchor'); 6. }; yi}
  • 25. example 1. var superFunc = function() { 2. console.log ('pretty good function'); 3. $("<div>") 4. .html('<p>fancy html</p>') 5. .appendTo('.super_anchor'); 6. }; yi}
  • 26. Conclusion • Use "text objects" for elegant vim operation • :help text-objects
  • 27. Thank you Tomokazu Kiyohara http://github.com/kiyohara http://facebook.com/tomokazu.kiyohara