SlideShare a Scribd company logo
Payton Chou 2008/11/18 How to trace code like source insight through vim?
Vim hierarchy /etc/vim |-- colors  # theme |   `-- ir_black.vim |-- doc  # related intro . |   |-- SuperTabContinue.txt |   `-- Trinity.txt |-- gvimrc  # configure for gvim (vim-gnome) |-- oldvimrc |-- plugin  # vim plugin |   |-- NERD_tree.vim |   |-- cscope_maps.vim |   |-- srcexpl.vim |   |-- supertab.vim |   |-- taglist.vim |   `-- trinity.vim |-- vimrc  # configure for vim `-- vimrc.tiny  # configure for vi EeePC SWRD Chi-Heng Chou
How to equip vim Install it apt-get install vim vim-gnome exuberant-ctags cscope Modify your vimrc The vimrc also effect the configure of gvim Go to official site and put the vim plugin in /etc/vim/plugin Enjoy vimming EeePC SWRD Chi-Heng Chou
Basic setting of vim set showmatch        " Show matching brackets. set ignorecase        " Do case insensitive matching set incsearch        " Incremental search set mouse=a        " Enable mouse usage (all modes) in terminals syntax on set autoindent set tabstop=4 set shiftwidth=4 set expandtab set softtabstop=4 … EeePC SWRD Chi-Heng Chou
The killer of trace code tools Trinity (trinity.vim) NERD_tree.vim  file browser srcexpl.vim  source browser taglist.vim  class browser Enhance of ctag cscope_maps.vim  symbol search tools Enhance Auto complete supertab.vim  EeePC SWRD Chi-Heng Chou
Advance setting of vim – font, theme, key mapping Font set gfn=Consolas\ 12 Theme colorscheme ir_black Key mapping Toggle taglist nnoremap <silent> <F12> :TlistToggle<CR> Trinity: Open and close all the three plugins on the same time nmap <F8>   :TrinityToggleAll<CR> Trinity: Open and close the srcexpl.vim separately nmap <F9>   :TrinityToggleSourceExplorer<CR> Trinity: Open and close the taglist.vim separately nmap <F10>  :TrinityToggleTagList<CR> Trinity: Open and close the NERD_tree.vim separately nmap <F11>  :TrinityToggleNERDTree<CR>  EeePC SWRD Chi-Heng Chou
Advance setting of vim - devhelp &quot; vim macro to jump to devhelp topics. &quot; -------------------------------------------- function! DevHelpCurrentWord()          let word = expand(&quot;<cword>&quot;)          exe &quot;!devhelp -s &quot; . word          redraw! endfunction &quot; Example: bind <ESC>h to start devhelp and search for the word under the &quot; cursor nmap <ESC>h :call DevHelpCurrentWord()<CR> EeePC SWRD Chi-Heng Chou
Advance setting of vim – Search on line &quot; online doc search &quot; -------------------------------------------- function! OnlineDoc()      let s:browser = &quot;firefox&quot;      let s:wordUnderCursor = expand(&quot;<cword>&quot;)      if &ft == &quot;cpp&quot; || &ft == &quot;c&quot; || &ft == &quot;ruby&quot; || &ft == &quot;php&quot; || &ft == &quot;python&quot;      let s:url = &quot; http://www.google.com/codesearch?q=&quot;.s:wordUnderCursor.&quot;+lang:&quot;.&ft      elseif &ft == &quot;vim&quot;      let s:url = &quot; http://www.google.com/codesearch?q=&quot;.s:wordUnderCursor      else      return      endif      let s:cmd = &quot;silent !&quot; . s:browser . &quot; &quot; . s:url      execute  s:cmd      redraw! endfunction map <ESC>k :call OnlineDoc()<CR> EeePC SWRD Chi-Heng Chou How to use cscope?
Demo trace code through vim Supertab Trinity Online help devhelp ctag and cscope ctags * & cscope -R EeePC SWRD Chi-Heng Chou
Reference (1/3) My vim package http://vip-file.com/download/8dd841907924/vim.tar.bz2.html vim 的老家 http://vim.sf.net   或者  www.vim.org ,  这里有很多 vim 的 tips 和 scripts vim 的中文文档 http://vimcdoc.sourceforge.net/ ,  这里有 pdf 格式下载 , 可以下载了慢慢看 . Best of Vim Tips http://www.rayninfo.co.uk/vimtips.html 在你询问某个技巧之前 , 先看看这篇 Best of Vim Tips, 很有可能你就找到答案了 . 作者搜集整理了大量的 vim 技巧 , 15 Years of Vi + 3 years of Vim and still learning , 作者这么说 . 那我们呢 ?vim 的学习是无止境的 , 学的越多 , 你的效率就越高 VIM Quick Reference Card 这个对于新手很有用 , 也许刚开始你记不住那么多 vim 的快捷键 , 没关系 , 打印一张卡片放在手边 , 忘记了可以看看 . http://tnerual.eriogerg.free.fr/vim.html ,  这里有 pdf, dvi  和 tex 格式的供下载 vim  新手指南 vimtutor: vim 内置的快速指南 , 强烈建议新手先看看这个交互式的入门教程 执行方法 : vimtutor,  如果是 windows, 在 vim 的安装目录下也有一个 vimtutor.bat 文件 http://www.vi-improved.org/ 这里有给新手的一些建议 , 还有 vimrc 和 gvimrc 的实例 , 稍作修改就可以为己所用 . Vim Cookbook http://www.oualline.com/vim-cook.html EeePC SWRD Chi-Heng Chou
Reference (2/3) VIM Reference Card http://www.linux.ie/articles/tutorials/vim-3.0.refcard.html http://www.pinkjuice.com/howto/vimxml/index.xml 如果需要用 vim 编辑 XML, 看看这里的文章  Vim as XML Editor 如果需要用 vim 编辑 LaTex, 看看这里 http://vim-latex.sourceforge.net/ 如果你需要 vim 也能像 source insight 一样的代码自动完成 , 可是试试这个 : Vim Intellisense http://insenvim.sourceforge.net/ 它支持 c++,c#,java,JSP,xml,html  和 SQL 种语言 , 依赖 perl . 缺点是仅仅支持 windows 平台 Vim  的杯子 http://www.cafepress.com/vimrefmug.25635024 你没有看错 , 是 vim 的杯子 ! 上面印着 Vim Reference , 不过一个需要 $10.99, 看清楚 , 是美元 color scheme a) for JAVA http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-java.html b) for HTML http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-html.html c) for PERL http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-pl.html d) for LaTex http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-tex.html EeePC SWRD Chi-Heng Chou
Reference (3/3) 最后强烈推荐水木社区 bbs 的 vim 版面 :  http://bbs.newsmth.net ,那里面高手如云,是国内最好的有关 vim 的专业版面。 http://yurinfore.blogspot.com/2008/11/vim-google-code-search.html http://blog.roodo.com/thinkingmore/archives/7515251.html http://bhoadmin.blog.sohu.com/99498576.html EeePC SWRD Chi-Heng Chou
Thanks for your kind attention EeePC SWRD Chi-Heng Chou

More Related Content

Featured (20)

PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
 
PDF
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
 
PDF
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
PDF
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
 
PDF
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
PDF
Everything You Need To Know About ChatGPT
Expeed Software
 
PDF
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
PDF
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
PDF
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
PDF
Skeleton Culture Code
Skeleton Technologies
 
PDF
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
PDF
Content Methodology: A Best Practices Report (Webinar)
contently
 
PPTX
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
PDF
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
PDF
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
PDF
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
PDF
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
PDF
Getting into the tech field. what next
Tessa Mero
 
PDF
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
PDF
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
 
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
 
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
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
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 

[20081118] How To Trace Code Like Source Insight Through Vim

  • 1. Payton Chou 2008/11/18 How to trace code like source insight through vim?
  • 2. Vim hierarchy /etc/vim |-- colors # theme |   `-- ir_black.vim |-- doc # related intro . |   |-- SuperTabContinue.txt |   `-- Trinity.txt |-- gvimrc # configure for gvim (vim-gnome) |-- oldvimrc |-- plugin # vim plugin |   |-- NERD_tree.vim |   |-- cscope_maps.vim |   |-- srcexpl.vim |   |-- supertab.vim |   |-- taglist.vim |   `-- trinity.vim |-- vimrc # configure for vim `-- vimrc.tiny # configure for vi EeePC SWRD Chi-Heng Chou
  • 3. How to equip vim Install it apt-get install vim vim-gnome exuberant-ctags cscope Modify your vimrc The vimrc also effect the configure of gvim Go to official site and put the vim plugin in /etc/vim/plugin Enjoy vimming EeePC SWRD Chi-Heng Chou
  • 4. Basic setting of vim set showmatch        &quot; Show matching brackets. set ignorecase        &quot; Do case insensitive matching set incsearch        &quot; Incremental search set mouse=a        &quot; Enable mouse usage (all modes) in terminals syntax on set autoindent set tabstop=4 set shiftwidth=4 set expandtab set softtabstop=4 … EeePC SWRD Chi-Heng Chou
  • 5. The killer of trace code tools Trinity (trinity.vim) NERD_tree.vim file browser srcexpl.vim source browser taglist.vim class browser Enhance of ctag cscope_maps.vim symbol search tools Enhance Auto complete supertab.vim EeePC SWRD Chi-Heng Chou
  • 6. Advance setting of vim – font, theme, key mapping Font set gfn=Consolas\ 12 Theme colorscheme ir_black Key mapping Toggle taglist nnoremap <silent> <F12> :TlistToggle<CR> Trinity: Open and close all the three plugins on the same time nmap <F8>   :TrinityToggleAll<CR> Trinity: Open and close the srcexpl.vim separately nmap <F9>   :TrinityToggleSourceExplorer<CR> Trinity: Open and close the taglist.vim separately nmap <F10>  :TrinityToggleTagList<CR> Trinity: Open and close the NERD_tree.vim separately nmap <F11>  :TrinityToggleNERDTree<CR>  EeePC SWRD Chi-Heng Chou
  • 7. Advance setting of vim - devhelp &quot; vim macro to jump to devhelp topics. &quot; -------------------------------------------- function! DevHelpCurrentWord()         let word = expand(&quot;<cword>&quot;)         exe &quot;!devhelp -s &quot; . word         redraw! endfunction &quot; Example: bind <ESC>h to start devhelp and search for the word under the &quot; cursor nmap <ESC>h :call DevHelpCurrentWord()<CR> EeePC SWRD Chi-Heng Chou
  • 8. Advance setting of vim – Search on line &quot; online doc search &quot; -------------------------------------------- function! OnlineDoc()     let s:browser = &quot;firefox&quot;     let s:wordUnderCursor = expand(&quot;<cword>&quot;)     if &ft == &quot;cpp&quot; || &ft == &quot;c&quot; || &ft == &quot;ruby&quot; || &ft == &quot;php&quot; || &ft == &quot;python&quot;     let s:url = &quot; http://www.google.com/codesearch?q=&quot;.s:wordUnderCursor.&quot;+lang:&quot;.&ft     elseif &ft == &quot;vim&quot;     let s:url = &quot; http://www.google.com/codesearch?q=&quot;.s:wordUnderCursor     else     return     endif     let s:cmd = &quot;silent !&quot; . s:browser . &quot; &quot; . s:url     execute  s:cmd     redraw! endfunction map <ESC>k :call OnlineDoc()<CR> EeePC SWRD Chi-Heng Chou How to use cscope?
  • 9. Demo trace code through vim Supertab Trinity Online help devhelp ctag and cscope ctags * & cscope -R EeePC SWRD Chi-Heng Chou
  • 10. Reference (1/3) My vim package http://vip-file.com/download/8dd841907924/vim.tar.bz2.html vim 的老家 http://vim.sf.net 或者 www.vim.org , 这里有很多 vim 的 tips 和 scripts vim 的中文文档 http://vimcdoc.sourceforge.net/ , 这里有 pdf 格式下载 , 可以下载了慢慢看 . Best of Vim Tips http://www.rayninfo.co.uk/vimtips.html 在你询问某个技巧之前 , 先看看这篇 Best of Vim Tips, 很有可能你就找到答案了 . 作者搜集整理了大量的 vim 技巧 , 15 Years of Vi + 3 years of Vim and still learning , 作者这么说 . 那我们呢 ?vim 的学习是无止境的 , 学的越多 , 你的效率就越高 VIM Quick Reference Card 这个对于新手很有用 , 也许刚开始你记不住那么多 vim 的快捷键 , 没关系 , 打印一张卡片放在手边 , 忘记了可以看看 . http://tnerual.eriogerg.free.fr/vim.html , 这里有 pdf, dvi 和 tex 格式的供下载 vim 新手指南 vimtutor: vim 内置的快速指南 , 强烈建议新手先看看这个交互式的入门教程 执行方法 : vimtutor, 如果是 windows, 在 vim 的安装目录下也有一个 vimtutor.bat 文件 http://www.vi-improved.org/ 这里有给新手的一些建议 , 还有 vimrc 和 gvimrc 的实例 , 稍作修改就可以为己所用 . Vim Cookbook http://www.oualline.com/vim-cook.html EeePC SWRD Chi-Heng Chou
  • 11. Reference (2/3) VIM Reference Card http://www.linux.ie/articles/tutorials/vim-3.0.refcard.html http://www.pinkjuice.com/howto/vimxml/index.xml 如果需要用 vim 编辑 XML, 看看这里的文章 Vim as XML Editor 如果需要用 vim 编辑 LaTex, 看看这里 http://vim-latex.sourceforge.net/ 如果你需要 vim 也能像 source insight 一样的代码自动完成 , 可是试试这个 : Vim Intellisense http://insenvim.sourceforge.net/ 它支持 c++,c#,java,JSP,xml,html 和 SQL 种语言 , 依赖 perl . 缺点是仅仅支持 windows 平台 Vim 的杯子 http://www.cafepress.com/vimrefmug.25635024 你没有看错 , 是 vim 的杯子 ! 上面印着 Vim Reference , 不过一个需要 $10.99, 看清楚 , 是美元 color scheme a) for JAVA http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-java.html b) for HTML http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-html.html c) for PERL http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-pl.html d) for LaTex http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-tex.html EeePC SWRD Chi-Heng Chou
  • 12. Reference (3/3) 最后强烈推荐水木社区 bbs 的 vim 版面 : http://bbs.newsmth.net ,那里面高手如云,是国内最好的有关 vim 的专业版面。 http://yurinfore.blogspot.com/2008/11/vim-google-code-search.html http://blog.roodo.com/thinkingmore/archives/7515251.html http://bhoadmin.blog.sohu.com/99498576.html EeePC SWRD Chi-Heng Chou
  • 13. Thanks for your kind attention EeePC SWRD Chi-Heng Chou