I really can't go on without mentioning the power of normal mode in VIM. VIM's modes are actually quite the advantage when you get used to them, but you should keep in mind that you want to be in Normal mode. It truly is where one of VIM's strength comes out, and that is text surgery.
# Language of Text Editing # ### `vimsentence := [count]vimexpression` ### `vimexpression := vimcommand | <operator><motion>` ### `vimcommand := <action> | <motion>` ### _That is while in NORMAL mode_ # WTF? (examples) # ### Delete next 3 words: 3dw ### Paste above line: P ### Move cursor down 2 paragraphs: 2}
As you learn some of the different keys you can apply them in pretty interesting combinations to build up sort of sentences of what you want to do. It takes a little while to get efficient at this, but sort of a rhythm starts to occur as you dispatch lightning ninjas from your Zeus fingers....hmm.. anyway.
The other Zeus like feature of VIM is it's plug-in and profile abilities. It's absurd how much you can customize VIM itself, but then on top of that you get python, ruby, perl, vimscript, shell, etc scripting to enable even more. When a plug-in and a developer love each other they, the developer lets the plug-in in to play with the others. This is where profiles are born.
Now to a newbie, straight out of the box you get a confusing text editor where you'll spend the first 5 minutes wondering why you can't type in text and the next 5 figuring out how you exit without killing the process. After a couple of tutorials and some VIM'ing, you probably have a profile pieced together by snippets that sort of work and that you don't understand. Well that's where my profile is trying to come in.
Here's a snippet where I setup some stuff with folding blocks of text:
" When we fold or unfold a block of text determine the block " delimiters via syntax. You can use 'za' to toggle a fold. " There are several other commands as well. " 'zM' to close all folds " 'zR' to open all folds set foldmethod=syntax " Lets map 'za' to spacebar while in NORMAL mode nnoremap <space> za<space> " By default I like to see all the code, but the first time " you try to fold something this will get toggled and all folding " well be on. set nofoldenable
As you can see I'm trying to document and organize things. The whole idea is that someone who knows a little about VIM can use my profile to learn a hell of a lot more. The profile is also to include several plug-ins in an attempt to create a ready to go development environment for a few programming languages. Right now I have a fairly sophisticated setup for Python (refactoring, test running, error detection, auto-completion) and something very usable for Erlang (syntax, error detection, auto-completion, compile a single file). Now I also have some built-in plug-ins and a couple of other things for other languages but I just haven't spent a lot of time tracking down, configuring, and testing plug-ins for other languages besides Python and Erlang.
I'm welcome to any help or suggestions in tracking down more to flesh out a Mono/C#, Ruby, C, or just about anything else. Anyway anyone interesting in using VIM please go ahead and check out my profile.
https://github.com/copenhas/dotfiles
My presentation is also available but the slides are pretty skimpy. You also need to use showoff (ruby gem) to actually see the slides in full.
https://github.com/copenhas/presentations
No comments:
Post a Comment