7. Before We Start.. Current directory is king %PATH% matters Command line tools are your friend
8. There are these things called modes… Lots of different modes Insert Visual Normal And More! You will spend most of your time in Normal mode. You cannot enter text in this mode
9.
10. Basic Editing :help operator :help scrolling Everything has a count 5dw == delete the next 5 words Rinse and repeat . Repeats the last command
11. Stuff to Get Into if We Have Time :help buffers Syntax highlighting Creating functions and macros Refactoring Spell checking
12. Ultimate Power Fully scriptable On the fly via commands Plugin architecture Built in Regex engine Reassign key commands Interact with the command line Macros No COM required to create extensions!
13. Navigating Code :help various-motions Currently “broken” for C# if you have a namespace It’s all just regex, so we can extend this to work with
14. Interacting With The Command Line :! <command> == execute a command (opens a new window) :r ! <command> == read the output of the console operation into the current buffer Have a custom function in my _vimrc to print output in a new window
15. QuickFix QuickFix == list of search results with file navigation :copen or :cw " Open the quickfix window :ccl " Close it :cn " Go to the next error in the window :cnf " Go to the first error in the next file :colder " Look at older results :cnewer" Look at newer results Global to all windows
16. QuickFix Example: Find In Files :vimgrep (or :grep if you have the actual program) Fills the QuickFix list :vimgrep /[pattern]/[g][j] {file} E.g. :vimgrep /public/j ./**/*.cs [g] == Include ALL results as separate lines [j] == Don’t jump to first result Can also use :lvimgrep (or :lgrepif you have the actual program) Fills “location list” which is local to current window Use :lw or :lopen to see this :lolder and :lnewer to navigate search result history
17. Building a Project :make Uses makeprg to tell what to execute MSBuild in my case Uses errorformat to parse build output for errors Redirects errors to QuickFix window Equivalent of Visual Studio’s build error list
18. Source Control Integration Didn’t we already cover this with command line integration???? I’m using git RunShellCommand to the rescue again!
20. Tags Build them using Exuberant Tags (ctags.exe) :tag <tagName> Jumps to a tag :tags Gives a list of all tags CTRL-g == navigate g] == list Sets a mark upon navigation Allows you to return to the same spot
21. Code Completion Sort of works Can’t get it working like Intellisense with C# Works fine in C/C++/Java/Pretty much anything else Several types of completion Omni Completion In File completion Many more..
22. Extensions Huge plugin community Some samples :NERDTree Basically Solution Explorer :TlistToggle Class view using Tags
23. Folding Code Yes, you can do it No, I haven’t looked at it Think of this as an equivalent to #region Regions are evil Useful when building plugins NERDTree and TagList both use it
24. Next Steps Get “intellisense” working properly Or just learn the BCL… Generate tags from BCL source code Try to get command line debugging working via Shell calls and the Quickfix list Start creating refactoring and code generation functions E.g. extract method, create controller Take a look at http://vim.wikia.com/wiki/Vim_as_a_refactoring_tool_and_some_examples_in_C_sharp