SlideShare a Scribd company logo
1 of 39
How to move cursor
 more effectively
  (for Beginner)
  2012/11/3 ujihisa.vim#3


       @deris0126
目次
• はじめに
• カーソル移動
 • 横移動
 • 縦移動
• カーソル移動系plugin
• まとめ
はじめに
• 自己紹介
 • Twitter:deris0126
 • vim歴:2年半
 • yokohama.vim ujihisa.vim vimrc読書
 • どこにでもいるただのVimmerです
はじめに
• 今日お話すること
 • normal modeでのカーソル移動の話
目次
• はじめに
• カーソル移動
 • 横移動
 • 縦移動
• カーソル移動系plugin
• まとめ
カーソル移動
• カーソル移動のコマンド
 • h,j,k,l,w,b,e,ge,H,M,L,¦,0,^,
    $,f,F,t,T,gg,G,%,]],[[,{,},
    (,),/,*,#,m, ,`,etc

 • :help motion.txt
 • :help pattern.txt
カーソル移動
• 数あるコマンドいつ、どれを使う?
• おそらく誰もが通る道
 • h j k l連打(jjjjjjjjjjjjjjjjjllllllllllllllllllll)
 • w連打(wwwwwwwwwww)
 • / とりあえず検索
カーソル移動
• 私がよく使うコマンド
 • 横移動: f F ; ^ $ w b h l
 • 縦移動: gg G { } <C-f> <C-b> j k
 • 検索 : * /
• わからないコマンドは
 • :help f とか :help CTRL-f
カーソル移動
• どうすれば効率的に移動できる?
• 以下に分けてお話
 • 横移動
 • 縦移動(検索)
カーソル移動
• 以降、個人的見解でお話します
 • bestではないと思います
 • next stepのきっかけに
 • よりbetterな方法、考え方(求む)
目次
• はじめに
• カーソル移動
 • 横移動
 • 縦移動
• カーソル移動系plugin
• まとめ
横移動
• 特定の位置に移動したい
 • 編集のため
 • *での検索のため(後述)
• どのコマンドを選択するか?
• どう考えるのが効率的か?
横移動
• 私の思考プロセス
 • ステップ1:行頭(末)に近いか?(^ $)
 • ステップ2:f(F)で近づけないか?
 • ステップ3:十分近いか?(w b h l)
横移動
• ステップ1:行頭(末)に近いか?(^ $)
 • 行頭(行末)から数単語くらいの位置
横移動
• ステップ2:f(F)で近づけないか?
 • 行内で1つだけの文字を探す
   • 記号
   • 数字
   • 大文字
   • 小文字
横移動
• ステップ3:十分近いか?(w b h l)
 • 数単語以内
   • w b(後述:vim-smartword)
 • 同単語 or 数文字内
   • h l と f(F)
横移動
• ステップ1∼ステップ3のそれぞれを
 一瞬で判断できるように鍛錬が必要

• fより5wとか打つ思考の人もいるはず
• 自分に合うか&慣れ
目次
• はじめに
• カーソル移動
 • 横移動
 • 縦移動
• カーソル移動系plugin
• まとめ
縦移動
• 縦移動(ファイル内移動)はカーソル移動
 以外にも方法があるので軽めに
•   まとめられなかったとか、発表時間足りないとかそんな理由じゃ
    ないです><
縦移動
• 移動箇所が明確
• 眺めたいだけ
縦移動
• 移動箇所が明確
 • ファイルの先頭:gg
 • ファイルの末尾:G
縦移動
• 移動箇所が明確
 • 目的の単語知ってる
   • *で検索(後述:vim-visualstar)
    • 近くに目的の単語があれば、/より速い
  • /で検索
縦移動
• 移動箇所が明確
 • 同画面内にある
   • { } 5j 5k j kでアプローチ
    • 後は横移動
縦移動
• 眺めたいだけ
 • ざっくり:<C-f> <C-b>
 • 細かく :{ } 5j 5k
縦移動
• おまけ:悪魔と取引をする
 • OSのkey repeat間隔を短くして禁断
     のj,k長押しを使う。。。

 • まっとうなVim Lifeを送りたい人に
     はおすすめはしない。
 •   MacならKeyRemap4Macbook、Windowsならレジストリいじくったり(完全に自己責任)




 • 昨年の某vim○akuさんから伝授
目次
• はじめに
• カーソル移動
 • 横移動
 • 縦移動
• カーソル移動系plugin
• まとめ
カーソル移動系plugin
• vim-smartword
• vim-visualstar
• vim-easymotion
• columnjump
• vim-submode
カーソル移動系plugin
• vim-smartword
 • 単語移動がスマートに
 • 横移動時(いつでも)
 • NeoBundle 'kana/vim-smartword'
 • 作者様:kana氏
カーソル移動系plugin
• vim-visualstar
 • 選択したテキストを検索
 • *で事足りない場合
 • NeoBundle 'thinca/vim-visualstar'
 • 作者様:thinca氏
カーソル移動系plugin
• vim-easymotion
 •   EasyMotion provides a much simpler way to use some motions in vim.


 • 画面内移動だったら万能?
 • NeoBundle 'Lokaltog/vim-easymotion'
 • 作者様: Lokaltog氏
カーソル移動系plugin
• columnjump
 • 縦方向のw bのようなもの
 • 階層構造になっている文章など
• NeoBundle 'deris/columnjump'
• 作者:deris
カーソル移動系plugin
• columnjump
 • vimrcの設定
nmap <c-k> <Plug>(columnjump-backward)
nmap <c-j> <Plug>(columnjump-forward)
カーソル移動系plugin
• vim-submode
 • サブmodeを作れる(not 移動特化)
 • 移動専用modeも作れる
 • NeoBundle   kana/submode

 • 作者様:kana氏
カーソル移動系plugin
• vim-submode
 • vimrcの設定
call   submode#enter_with('ex-move', 'n', '', '<Space><Space>', '<Nop>')
call   submode#enter_with('ex-move', 'n', '', '<Space>j', '<C-f>')
call   submode#enter_with('ex-move', 'n', '', '<Space>k', '<C-b>')
call   submode#leave_with('ex-move', 'n', '', '<Space>')
call   submode#map('ex-move', 'n', '', 'j', '<C-f>')
call   submode#map('ex-move', 'n', '', 'k', '<C-b>')
call   submode#map('ex-move', 'n', '', 'n', '5j')
call   submode#map('ex-move', 'n', '', 'm', '5k')
call   submode#map('ex-move', 'n', '', 'l', '}')
call   submode#map('ex-move', 'n', '', 'h', '{')
カーソル移動系plugin
• 縦移動はカーソル移動だけでは役不足
• ファイル内移動に(も)使えるplugin
 • taglist
 • unite-outline
 • vimgrep
 • unite-grep
目次
• はじめに
• カーソル移動
 • 横移動
 • 縦移動
• カーソル移動系plugin
• まとめ
まとめ
• betterな方法を考えるのが上達の近道
 • :help
 • vim plugin試してみる
 • 著名Vimmerをフォローする
 • [hot]vimrc読書会に参加する(土曜夜)
まとめ
• とにかくvimに触れる
• 日々の鍛錬で自分に合うコマンド、思
 考プロセスを考えること
Happy Vim Life!

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

deris's tech talk ujihisa.vim3

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n