You are not logged in.

#1 2008-08-24 06:36:01

DaveI
Member
Registered: 2008-06-22
Posts: 7

Code snippets

To all the programmers out there, where do you keep your code snippets?

Offline

#2 2008-08-24 07:46:48

Nax
Member
Registered: 2007-11-07
Posts: 7

Re: Code snippets

I have a simple snippet directory, which is a git-repository, in my home-directory. This directory contains subdirectories for a few programming languages I'm using (e.g. ruby, python, c, c++, ...) in which the snippets are stored. I'm using only a single PC for development, so I have no real synchronization issues. But otherwise you might consider storing your snippets on GitHub or another Git-server with which you can easily synchronize the snippets.

But frankly I don't use this kind of "static" snippets very often. I'm using TextMate-like snippets very often these days, with which you can type e.g. for<Tab> and the expression will be expanded to a for-loop. For Vim I'm used to use snippetsEmu very often. It's a really great plugin and if you're using Vim you should give it a try. At the moment I'm using snip-fu, which is an experimental Vim plugin I've written, which is similar to snippetsEmu. But there is no official release yet, so you might be better off using snippetsEmu smile.

If you aren't using Vim but Gedit or SciTe, you can use a plugin as well to enable snippet support.

Offline

#3 2008-08-24 14:50:15

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Offline

#4 2008-08-24 15:31:39

rcoyner
Member
From: Washington D.C.
Registered: 2008-05-16
Posts: 30
Website

Re: Code snippets

I keep all my snippets in a ~/src/ directory which is organized by subdirectories for languages that I use. It's pretty much how Nax does it.

Offline

Board footer

Powered by FluxBB