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

PPTX
Cscope and ctags
PPTX
CSCOPE Tutorial
ODP
Vim+cscope+ctags+taglist
KEY
How to become a practical Vim user
DOC
手把手教你把Vim改装成一个IDE编程环境(图文)
PDF
一小時學不會的 Vim
PDF
Vim hacks
PDF
[Modern Web 2016] 讓你的 PHP 開發流程再次潮起來
Cscope and ctags
CSCOPE Tutorial
Vim+cscope+ctags+taglist
How to become a practical Vim user
手把手教你把Vim改装成一个IDE编程环境(图文)
一小時學不會的 Vim
Vim hacks
[Modern Web 2016] 讓你的 PHP 開發流程再次潮起來

Similar to [20081118] How To Trace Code Like Source Insight Through Vim (20)

DOC
设置用vim编辑python
PDF
Ipaq with linux
PDF
Continuous Delivery Workshop with Ansible x GitLab CI (5th)
PDF
現代 IT 人一定要知道的 Ansible 自動化組態技巧
PDF
Automate with Ansible basic (3/e)
PPTX
TBAD F2E 2010 review
PDF
Ruby on Rails 開發環境建置 for Ubuntu
PDF
利用Cent Os快速构建自己的发行版
PDF
My Emacs Configs
PPT
Mysql mmm演讲--冯浩
PPT
Mysql mmm演讲-冯浩
PPT
Mysql mmm演讲-冯浩
PDF
Linux network monitoring hands-on pratice
PDF
Bypat博客出品-利用cent os快速构建自己的发行版
PDF
Sery lvs+keepalived
DOC
Nagios的安装部署和与cacti的整合(linuxtone)
PDF
現代 IT 人一定要知道的 Ansible 自動化組態技巧 Ⅱ - Roles & Windows
PDF
Openshift by mtchang
KEY
Linuxguide4f2e
KEY
LinuxGuide4F2E
设置用vim编辑python
Ipaq with linux
Continuous Delivery Workshop with Ansible x GitLab CI (5th)
現代 IT 人一定要知道的 Ansible 自動化組態技巧
Automate with Ansible basic (3/e)
TBAD F2E 2010 review
Ruby on Rails 開發環境建置 for Ubuntu
利用Cent Os快速构建自己的发行版
My Emacs Configs
Mysql mmm演讲--冯浩
Mysql mmm演讲-冯浩
Mysql mmm演讲-冯浩
Linux network monitoring hands-on pratice
Bypat博客出品-利用cent os快速构建自己的发行版
Sery lvs+keepalived
Nagios的安装部署和与cacti的整合(linuxtone)
現代 IT 人一定要知道的 Ansible 自動化組態技巧 Ⅱ - Roles & Windows
Openshift by mtchang
Linuxguide4f2e
LinuxGuide4F2E
Ad

[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