Tech


20
Jan 11

Hiding that horrible tabline in Vim

Long time no post in here, sorry.

Since I’ve had the chance to review Kim Schulz’s Hacking Vim 7.2 ebook1 and a friend of mine started using vim as his main development tool, digging into Vim’s configurations and flavours has become somewhat even more pleasant.

In an attempt to improve my performance when editing various files, I’m trying to use tabpages instead of only several windows. It’s been working as some kind of context stack for me, as there can be one tabpage (probably with fewer windows) for modifying files from a project and another tabpage for a different but related one (or a non-related task in the same project). Plus, using more tabpages and less windows can save precious screen space.

But what to do about that odious tabline which, besides hurting my sense of aesthetics, eats a whole line of the screen? Thankfully to the Vim’s extremely flexible nature, it didn’t take long to find an answer. It came in form of disabling the tabline entirely and putting its only usable information into the statusline. Used a bit of scripting to overcome the only corner case I could think of and took the chance to try my rusty skills on python + vim bindings. Pretty much everything someone will need to put both domains together is in this little example (besides the vim module complete API, easily accessible by issuing :h python).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function! MyTabMarker(disable)
python << EOF
import vim
def tabpagecount():
return int(vim.eval("tabpagenr('$')"))
def tabpage():
return int(vim.eval("tabpagenr()"))
def tabmark():
disable = int(vim.eval("a:disable"))
if tabpagecount() > 1 and not disable:
return "\"[tab %d/%d] \"" % (tabpage(), tabpagecount())
return "\"\""
vim.command("return " + tabmark())
EOF
endfunction
set laststatus=2
set showtabline=0
set statusline=#%02n\ %{MyTabMarker(0)}%f\ %m%r%y%=\(%bd,%Bh)\ %c,%l/%L\ %P

There you see how to pass arguments into python methods and how to feed values back from it to the vim environment. Eventually I’ll publish my entire .vimrc with comments so everyone can rant about how theirs way is better ;-)

[1] as I’ve lost my notebook due to a robbery at the technical assistance, my review annotations were lost too. I’ll need to re-review the book to get something published about it then.


28
May 10

gource: OpenGL-based 3D visualisation tool for source control repositories

Too much fun the tool I’ve came to know through my friend Adenilson’s blog. In a glance one can explore effort put into a project in a way much better than any other command-line or graphical application known.

The only boring thing is to use it in my machine, a hp pavilion dv4-2167sb, which, AFAIK, still lacks a good graphical acceleration support.

I’ve made a very basic debian package (using checkinstall) for people too lazy to compile/install by themselves.

Enjoy it and have fun!


5
May 09

Old School Techniques

Talking about old times stuff at the breakfast, it was so fortunate that I’ve already read a post about this issue earlier today.

Old-school programming techniques you probably don’t miss

I’m not a punch card time guy, but concerns like memory footprint size, code running faster and thread limitations still go around my mind nowadays.

Don’t forget to take a look at the comments section for more funny and informative stories.


25
Mar 09

Git References’ Pointers

Earlier this year I’ve spent some time gathering references to study Git, the version control system everybody seems to love nowadays.

Thankfully, someone took the time to bind several useful links in one central webpage. If you wanna start studying Git, that’s the place to start. Kudos for such practical people (more specifically Scott Charcon and Petr Baudis).

http://git-scm.com/documentation

Just for reference, I’ll paste below the stuff I had.

Forwarded conversation
Subject: Git Documentation Pointers
————————
From: Milton Soares
Date: Mon, Jan 19, 2009 at 12:33 PM

Hi.

Just to organize and share all the references I’ve gathered about Git learning.

On-line Resources

$ git help git
$ man gittutorial

Git Homepage Resources

http://www.kernel.org/pub/software/scm/git/docs/everyday.html
http://www.kernel.org/pub/software/scm/git/docs/user-manual.html

SVN to Git crash course

http://git.or.cz/course/svn.html

Recording of the Git tutorial given by Bart Trojanowski for the OGRE

http://excess.org/article/2008/07/ogre-git-tutorial/

Palestra Git para o Google by Linux Torvalds

http://br.youtube.com/watch?v=4XpnKHJAok8

Git from the bottom up

http://www.newartisans.com/blog_files/git.from.bottom.up.php

———-
From: Milton Soares
Date: Tue, Jan 20, 2009 at 4:36 PM

More pointers:

GitWine – git tips by wine people

http://wiki.winehq.org/GitWine#head-079f5369fdb9346845a4a8c82475eb7a198312be

Git Wizardry

http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html

Git Wiki

http://git.or.cz/gitwiki/

Git Cheat Sheet

http://ktown.kde.org/~zrusin/git/

———-
From: Milton Soares Filho
Date: Sat, Feb 21, 2009 at 11:15 AM

Yet another usefull link (pretty graphical explanations on git objects).

Tv’s cobweb: Git for Computer Scientists

http://eagain.net/articles/git-for-computer-scientists/