background preloader

Why, oh WHY, do those #?@! nutheads use vi?

Why, oh WHY, do those #?@! nutheads use vi?
The VI Gang Sign by Jon Beltran de Heredia, May 16th, 2007 Yes, even if you can't believe it, there are a lot fans of the 30-years-old vi editor (or its more recent, just-15-years-old, best clone & great improvement, vim). No, they are not dinosaurs who don't want to catch up with the times - the community of vi users just keeps growing: myself, I only got started 2 years ago (after over 10 years of being a professional programmer). Yes, there are definite reasons why the vi/vim editing model is just superior to any other out there. Misconception #1: modal editing The first time you stumble into vi or vim, you are shocked and disgusted that you have to use 'i' to start typing text. Turns out, this is just a completely wrong way to use vi or vim. Let me explain the philosophy behind this. One good benefit of this is that the '.' command repeats the last complete, combined editing command (not movement commands). And now we come to insert commands. Example #1: the wonderful dot command

Vim anti-patterns | Arabesque The benefits of getting to grips with Vim are immense in terms of editing speed and maintaining your “flow” when you’re on a roll, whether writing code, poetry, or prose, but because the learning curve is so steep for a text editor, it’s very easy to retain habits from your time learning the editor that stick with you well into mastery. Because Vim makes you so fast and fluent, it’s especially hard to root these out because you might not even notice them, but it’s worth it. Here I’ll list some of the more common ones. Moving one line at a time If you have to move more than a couple of lines, moving one line at a time by holding down j or k is inefficient. { — Move to start of previous paragraph or code block.} — Move to end of next paragraph or code block.Ctrl+F — Move forward one screenful.Ctrl+B — Move backward one screenful. If you happen to know precisely where you want to go, navigating by searching is the way to go, searching forward with / and backward with ?. y/search<Enter> y? d2wi

Faster PHP Apps—Profile Your Code with Xdebug Object-oriented programming is well and truly in fashion, and PHP is no exception. So you’ve adopted the proper design patterns, built your site on the latest PHP framework, and have your database access abstracted so far that you’ve forgotten SQL. What’s Going On? When you first move towards object-oriented programming, the first thing you might notice is that you can give yourself a headache trying to follow the execution path through your code and the framework it’s built on. The next thing you might notice is that your site isn’t any faster – in fact perhaps it’s slower than it was. So we’ve got potentially slower code, and we can no longer just open up our simple PHP script and follow its execution from the top of the file to the bottom. Xdebug Xdebug 2 (currently beta – I’m running 2.0.0RC3) is an indispensable PHP extension which provides various ways of debugging and analysing your code on your development server. WinCacheGrind KCachegrind Less Grinding, More Caching More Xdebug

Vim: revisited I’ve had an off/on relationship with Vim for the past many years. Before, I never felt like we understood each other properly. I felt that the kind of programming I’m doing is not easily done without plugins and some essential settings in .vimrc, but fiddling with all the knobs and installing all the plugins that I thought I needed was a process that in the end stretched out from few hours to weeks, months even; and it the end it just caused frustration instead of making me a happier coder. Recently, I decided to give Vim another shot. Start with a basic setup – but not zero I learned this the hard way: you shouldn’t start with a huge .vimrc file that you copied from someone else nor should you install every single plugin that seems useful at that moment. This is a good starting point for your .vimrc: Everything mentioned in this article is valid in vim running in a terminal as well as graphical (GUI) vim such as gvim or MacVim. Guidelines for expanding your vim settings later on: ctags Ack

DeepaMehta -- Homepage How I boosted my Vim » nvie.com - Vimperator A few weeks ago, I felt inspired by articles from Jeff Kreeftmeijer and Armin Ronacher. I took some time to configure and fine-tune my Vim environment. A lot of new stuff made it into my .vimrc file and my .vim directory. This blog post is a summary describing what I’ve added and how I use it in my daily work. Before doing anything else, make sure you have the following line in your .vimrc file: " This must be first, because it changes other options as side effectset nocompatible Step 0: make the customization process easier ¶ Before starting configuring, it’s useful to install pathogen. So, download pathogen.vim, move it into the .vim/autoload directory (create it if necessary) and add the following lines to your .vimrc, to activate it: " Use pathogen to easily modify the runtime path to include all" plugins under the ~/.vim/bundle directorycall pathogen#helptags()call pathogen#runtime_append_all_bundles() " change the mapleader from \ to ,let mapleader="," Change Vim behaviour ¶ fun!

wiki: Scite Macro Expander SciTE Macro expansion facility I always enjoyed the C preprocessor macro facility. To my eye, this macro makes C code more readable and less error-prone: #define FOR(i,n) for(i = 0; i < (n); i++) Unfortunately, disciplined use of statement macros fell into disfavour due to abuse, and C++ stylists are generally against them (Stroustrup as usual takes a more pragmatic line) The SciTE Lua Macro expansion facility is a simple macro preprocessor which expands macros in the current buffer, rather like abbreviations. macro.subst.1=for(i,n)=for(i = 0; i < n; i++) and type FOR(k,10) in the buffer, followed by 'Expand Macro' (Alt+Enter). Since it's a single-pass expansion which never happens automatically, there's no problem in using keywords like 'for' here. Line feeds are indicated using '\n' in the macro definition and you can always use a backslash to split the definition over several lines. macro.subst.2=if(cond)=if(cond) { \n } else { \n } macro.subst.3=date=$eval(os.date()) Setting up Examples where

Vim Cheat Sheat for Programmers by Michael Pohoreski Update: Version 2.0 is up! There are now 4 versions to chose from: (If you are wondering what the differences are between the screen and print: the screen has less color variations, and no gradients to make it easier to read.) One designed for on-screen reading: PDF (Excel 2011 source),One designed for hard-copy reading: PDF (Excel 2011 source),One designed for monochrome printing: PDF (Excel 2011 source), andOne designed for Red/Green color bindness -- a "Blue" theme PDF (Excel 2011 source). The color coded Legend / Keys helps provide guidance for your experience level. Green = Essential Yellow = Basic Orange / Blue = Advanced Red = Expert If you don't like this version (I'd love to hear why) try these, you may find them more to your liking... Thanks to all the redditors for the feedback! The on-screen 150 DPI .png version is shown... The color hard-copy 300 DPI .png version: The monochrome hard-copy 300 DPI .png version: An color blind hard-copy 150 DPI .png version: === Vim Rants ===

An App A Day : Jedi Window Dock Best of VIM Tips, gVIM's Key Features zzapper Tips Home Vim Tips Blog (NEW) Cygwin VimTools Buy Vim Book Support VIM Submit to Social Websites Coming Home to Vim I’m a programmer. I work with text files for 6-12 hours every weekday so I care about the text editor I use. If switching to a different editor can increase my efficiency by even 10% it would save a good chunk of my time and let me get back to making cool things. I don’t buy the “you’re thinking 90% of the time and only typing 10% of the time, so your editor doesn’t really matter” argument. Even if the premise is true, the conclusion is wrong. If I think for 10 minutes and then start typing, I want the typing to take the shortest time possible so I can get back to thinking. I recently started using Vim as my primary editor. Some Background About Me In 2006 I decided it was time for a change. SubEthaEdit: As cool as SubEthaEdit was, I always felt like there was a better editor out there for me. TextMate: At the time I thought TextMate was amazing (and it really was). Learning the vi and Vim Editors: Ack

Vim is hard, I just want to click around More than a year ago, I wrote about switching to Vim. I was quite happy with how it all worked, but I found myself switching back to Textmate after a while. I read through a lot of dotfiles to “steal” some configuration options from others, took some time to go through vimtutor, read some blogposts and after a while, I was quite happy with how it all worked. My new, full screen Janus-powered MacVim editor, with sexy drawer But after some time, I started switching back to Textmate. Sometimes, I just want to click around, especially when looking for and opening files. MacVim It turns out I wasn’t the only one running into problems like this. I got a new hard drive, which was a great excuse to do a clean install and set up a better work environment. The one thing I didn’t really like was the new native Lion fullscreen mode, which newer versions of MacVim use by default. Luckily, that’s pretty easy to achieve. $ defaults write org.vim.MacVim MMNativeFullScreen 0 Janus skip_vim_plugin "nerdtree"

Writing Vim Plugins A while ago I wrote a post about switching back to Vim. Since then I’ve written two plugins for Vim, one of which has been officially “released”. post: A couple of people have asked me if I’d write a guide to creating Vim plugins. Other People Who Know More Than I Do Writing two decently-sized Vim plugins has given me some experience, but there are a lot of people that know far more than I do. Tim Pope The first is Tim Pope. Tim Pope: It would be awesome to read a guide on the ins and outs of Vim scripting by him. Scrooloose The other person that comes to mind is Scrooloose, author of NERDTree, NERDCommenter and Syntastic. Be Pathogen-Compatible It’s 2011. normal! if !

Markdown Download Markdown 1.0.1 (18 KB) — 17 Dec 2004 Introduction Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML). Thus, “Markdown” is two things: (1) a plain text formatting syntax; and (2) a software tool, written in Perl, that converts the plain text formatting to HTML. The overriding design goal for Markdown’s formatting syntax is to make it as readable as possible. The best way to get a feel for Markdown’s formatting syntax is simply to look at a Markdown-formatted document. (You can use this ‘.text’ suffix trick to view the Markdown source for the content of each of the pages in this section, e.g. the Syntax and License pages.) Markdown is free software, available under a BSD-style open source license. Discussion List I’ve set up a public mailing list for discussion about Markdown. Installation and Requirements Movable Type Blosxom BBEdit

Related: