background preloader

Vim: Seven habits of effective text editin

Vim: Seven habits of effective text editin
Bram Moolenaar November 2000 If you spend a lot of time typing plain text, writing programs or HTML, you can save much of that time by using a good editor and using it effectively. Part 1: edit a file 1. Most time is spent reading, checking for errors and looking for the right place to work on, rather than inserting new text or changing it. Quite often you will want to search for some text you know is there. If you see a specific word and want to search for other occurrences of the same word, use the * command. In structured text there are even more possibilities to move around quickly. Use % to jump from an open brace to its matching closing brace. There are many more, of course. There are three basic steps: While you are editing, keep an eye out for actions you repeat and/or spend quite a bit of time on. Let's use an example to show how it works: You find that when you are editing C program files, you often spend time looking for where a function is defined. 2. 3. 4. 5. 6. 7. Epilogue

Best of VIM Tips, gVIMs Key Feature Tips Home Vim Tips Blog (NEW) Cygwin VimTools Buy Vim Book Support VIM Submit to Social Websites Vim Cookbook by Steve Oualline This is the Vim cookbook page. It contains short recipes for doing many simple and not so simple things in Vim. You should already know the basics of Vim, however each command is explained in detail. Each set of instructions is a complete package. Contents Character twiddling If you type fast your fingers can easily get ahead of your mind. To swap two characters, for example "e" with "h", put the cursor on the cursor on the "e" and type xp. The "x" command deletes a character (the "e") and the "p" pastes it after the cursor (which is now placed over the "h".) Interactively replacing one word with another (n. method) Suppose you want to replace every occurrence of the word "idiot" with the word "manager". Here's what you do: Repeat steps 4 and 5 until you have replaced all occurred. The Virgin What!? Interactively replacing one word with another (command line method) Execute the command: :%s/\<idiot\>/manager/gc The parts of this command are: Use the command: :%s/\<idiot\>/manager/g

Vim Introduction and Tutorial - IMHO I often tried to learn the great Emacs editor/IDE/operating system. The last time I tried it, I spent some time getting comfortable with it until I wanted to customize my .emacs file. That was the point when I entered vi .emacs. As soon as I realized what I’ve done, I knew that Vim has won me over a long time ago. So, here I am – using Vim as my editor of choice. Another big motivational boost came after I discovered that my preferred shell (ZSH) has an awesome vi-mode including the command mode (yes, you can switch between command and insert mode!). Vim has a great deal of features, and learning them takes some time. I took the approach to start using some tutorial and let the help-system guide (type :help <command> to get help for the command) me through the rest. Another reason I like to use Vim is because it’s much more healthy than Emacs (using the default-keymappings). Just remember: Vim’s basics are really very simple, but in combination the simple commands become very powerful.

Power Vim Usage: Tips &amp; Tricks for Everyday Editing Tips & Tricks for Everyday Editing Smylers UKUUG Linux 2004 Conference • 2004 August This view lists all the slides from the talk in a continuous format. The slides are also designed to be viewed as a slideshow from this file with Mozilla or a compatible browser. 1 Intro text editing: crops up all over Linux once good at it, find many uses for it Vim: powerful — potential for great efficiency Emacs and other VI variants also good this talk: tips — features & customizations fast, random, dull to encourage reading the notes work in progress 2 Learning Vim Vim is far too big to learn quickly probably too big to learn slowly learning it as an extension of VI is often not helpful The only way to get the hang of Vim is a bit at a time — learning some things you can make use of, getting comfortable with them, then learning some more. Some of the most useful Vim features don’t require any VI knowledge. 3 Moving About Capital F is similar to f but moves left instead of right. 4 Visual Mode

YvoSchaap.com - Easy AJAX inline text edit 2.0 As everybody knows, refreshing pages is so 1999. AJAX, DOM, whatever you call it makes it possible to let people edit a piece of text inline without having to use a submit button. You say: but that ain’t new at all! I say: But all of this has been made easy to use and implement: 2.0! Example page: inline edit (no JS knowledge needed) [source ] | Inline example: Please edit me! How you can make it work (5 easy steps for integration) Download this javascript file: InstantEdit 2.0 JSCreate a update file that handles the input. You’re done! How it works A small piece of javascript reads all SPAN tags, checks if it has class=“editText” and a id=. Compatibility This script works in Internet Explorer, Firefox, Chrome, Opera and Safari. Update hack If you want to force a textarea over a textfield (for example to edit a piece of HTML) use class=“editText” offsetHeight=“10”. If you want to PUSH an ID to your script I use: id=“edit_userID_$userID”.

Related: