Enviar búsqueda
Cargar
Rails.vim 導航指令
•
8 recomendaciones
•
2,703 vistas
喬 莊
Seguir
使用 tpope/vim-rails plugin 尋找 Rails 專案中的檔案
Leer menos
Leer más
Desarrollo personal
Tecnología
Vista de diapositivas
Denunciar
Compartir
Vista de diapositivas
Denunciar
Compartir
1 de 15
Recomendados
Git超入門
Git超入門
Sherlock Chiang
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Recomendados
Git超入門
Git超入門
Sherlock Chiang
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
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 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
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
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 Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
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
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
Más contenido relacionado
Destacado
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 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
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
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 Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
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
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
Destacado
(20)
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 2024
Social 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 2024
5 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
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 Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The 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...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
ChatGPT webinar slides
ChatGPT webinar slides
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Rails.vim 導航指令
1.
Rails.vim 導航指令 使用 plugin:
tpope/vim-rails
2.
目次:認識以下 jump 功能 1.
gf (goto file) 2. Alternate 和 related 檔案 3. :Emodel、:Eview 系列指令
3.
1. gf (goto
file) 在游標上打 gf 就會跳到 source code 所寫的檔案。 gf 是 Vim 的內建指令,不需要 plugin; Rails.vim 強化了 gf 的功能,可以認得一些 Rails 特有寫法 (續下頁)
4.
在 * 的位置按
gf, 就會打開相應的檔案。
5.
補充:Vim jump 技巧 1.
到前一個 jump 點:<Ctrl-O>(Older,類似回上一頁) 2. 到後一個 jump 點:<Ctrl-I> 3. 在最後的 jump 點間往返:'' 或 ``(略有差異) 4.<Ctrl-W>gf 同 gf,但開在新視窗 5.:tab wincmd gf 同 gf,但開在新分頁 故可以用這個設定 nnoremap <Leader>gf :tab wincmd f<CR> 按下 <Leader>gf 就把 gf 開到新分頁。
6.
2. Alternate /
Related files 並非 Rails 慣例(Rails 沒有所謂 alternate file 的東 西),純粹是 rails.vim 用來協助導覽的概念。 在檔案中,使用 :A 會前往 alternate 檔案,使用 :R 會前往 related 檔案。 例如 controller 的 related file 是 view,所以(續下頁)
7.
Alternate / Related
files 例子 游標在 app/controllers/about_controller.rb 的 index action 中,使用 :R 指令會開啟 app/views/about/index.html.haml 也有一些變型可用 :RS(開在 split window) :RV(開在 vertical split window) :RT(開在新 tab)
8.
怎麼知道 xxx 檔案的
A / R 是對應到什麼? 1. 查文件 :help rails-alternate 但是每次都查,也太不直覺了 2. 按自己的意思設定 參考 :help rails-projections(續下頁) 或 Extending Rails.vim with Custom Commands 註:rails_projections 需要 rails.vim 5.0 以上
9.
我自己的 g:rails_projections model 和
controller 之間,互相用 :A 壓縮檔(*.js 和 *.css)用 :A 可以 回原始檔(*-src.js 和 *.scss) 以下後面再解釋……
10.
我自己的 g:rails_projections(文字版) let g:rails_projections
= { "app/models/*.rb": { "alternate": ["app/controllers/%s_controller.rb", "app/controllers/%p_controller.rb"] }, "app/controllers/*_controller.rb": { "alternate": "app/models/%i.rb" }, "public/javascripts/*.js": { "alternate": ["public/javascripts/%s-src.js", "public/javascripts/%s-debug.js"] }, "public/stylesheets/*.css": { "alternate": "app/stylesheets/%s.scss" }, "app/stylesheets/*.scss": {"command": "css"}, "public/javascripts/*-src.js": {"command": "js"}, "public/javascripts/*-debug.js": {"command": "js"}, "app/components/model_extensions/*_for_grid_panel.rb": {"command": "netzkegrid"}, "app/components/model_extensions/*_for_form_panel.rb": {"command": "netzkeform"} }
11.
3. :Emodel、:Eview 系列指令 以
Rails 檔案類型為依據的 navigation,支援的「類型」例如: • controller • view • layout • initializer • environment 可以使用 :Econtroller order 開啟 order_conteroller.rb, 用 :Eenvironment development 開啟 config/environments/development.rb
12.
:Exxx 也有各種變型 例如 Emodel
可改成 • Smodel • Vmodel(開在垂直分割視窗) • Tmodel(開在新分頁) • Dmodel(讀進目前的 buffer)
13.
在 rails_projections 中 自訂新的類型 指定選項
{command: js} 就多了 js 類型的檔案,例如 可使用 :Ejs formcheck 開啟 public/javascripts/formcheck-src.js
14.
補充:Vim command mode
補全技巧 按 <Ctrl-D> 會顯示所有可補全的項目 1. set wildmenu 2. set wildmode=longest:full,full 會啟用進化的 command line 自動完成,第一次按 <Tab> 會補到「最長 的共通 match」,再按 <Tab> 會顯示 menu,再按 <Tab> 開始選擇。
15.
完