Monday, 28 October 2013

Snippets moved

I completed my transfer of snippets from Smipple to GitHub, so now they are available again. I guess I need to fix the embedded code in my old posts as well at some point.

But no sooner had I thought Mygists would fix the problem of finding the Gists than it's down. Hopefully not for long. The good thing is that Mygists is open-source and in any case gist.github.com has a usable API so I can always set up my own service if needed.

Now I wonder if I should move my small projects from Gitorious.org there? A gist can include more than one file so at least a couple of those projects would work well.

Friday, 25 October 2013

D'oh, or theme continued.

I had completely forgotten that GitHub supports this as well. They just call these snippets Gists. I think this pretty much is a no-brainer now. GitHub versions the files , allows branching and I can even download all Gists on a go, although it requires a bit of scripting (hey ho). The only thing I miss right now are tags.

And the same code as an embedded Github Gist looks like:

We have a winner!

EDIT: I just found out MyGists. It supports tagging the gists with hashtags, so now the last big problem is solved - how to find the script I want after I have a large number of them.

Snippets, continued

I tried the snippet databases mentioned in my last post. I dropped DZone quickly without even trying it because it just looks ugly. SourcePod was interesting, but not really a database as there is no login. You can only find your old scripts from the same machine you submitted them.

That leaves Snipt and Snipplr. Here's what the embedded code looks like for Snipt:


And the same code for Snipplr:


I was eventually more drawn toward Snipplr but I'm starting to lean toward Snipplr for two reasons: first it looks like not much is happening at Snipplr any more. Last blog post was two years ago. API documentation is in one initial blog post years back. Snipt on the other hand seems to still be under active development. And Snipt is open source! Snipplr is still being used but it's still a bit disconcerning.

There are things in Snipplr I wish Snipt had. The embedded output for one, line numbers are nice. It also supports versions for each snippet.

Neither supports direct Git support. It would be nice to be able to pull your scripts occasionally so that if the service stops working I still have them readily available.

Wednesday, 23 October 2013

Code snippet hosting

Dang. Smipple.net has been down for a while and it looks like fixing it isn't a top priority for the maintainer. So I need to find a new home for my code snippets and hope I can get them out of smipple at some point.

The candidates that I could find during a quick browse are:

Next I need to evaluate these. 

Thursday, 17 October 2013

Effective quickfix window use in Vim

I have now setup Vim to take more advantage of the quickfix window and I think it's a pretty neat way.

First I changed cscope to use it instead of the default way which is a bit bulky by adding the following to .vimrc:
set cscopequickfix=s-,c-,d-,i-,t-,e-   
This in itself is cool because now I can just jump between the hits.

Of course quickfix window is already used when I build the software. Just to make moving around this list I did the following mappings:
map <A-p> :cp<CR> 
map <A-n> :cn<CR> 
So now I can use Alt-p and Alt-n to move between items in the quickfix window. The nice thing is, that this now also applies to any cscope lists! So instead of searching, then selecting a number to see a single context of, say, a function call, I can jump in the code to see all the hits with those keys.

And just to top this off, I also added the following:
map <A-P> :colder<CR>
map <A-N> :newer<CR>
Which means that I can now build, then maybe do a cscope search to check something (say, a function prototype) and quickly move between these two quickfix windows with those keys!

As a sidenote vim-airline messes up my GVim window badly, especially when using those quickfix windows so I had to move back to Powerline. Shame, because Airline had plenty of stuff going for it.