Category: tweaks


vim: ./configure and it’s fucking cache

July 7th, 2011 — 01:51 pm

If while configuring vim‘s Makefile you have any problem with missing dependencies I give you and advice:

After installing those dependencies, delete $VIM_SOURCE/src/config.cache or there’ll be variables set on that file that’ll fool ./configure into thinking that those dependencies are still missing.

Fuck yeah!!

Comment » | tweaks, vim

mac: Install MacVim

July 6th, 2011 — 05:38 pm

Today, trying to compile MacVim I ran into a problem with some shared libraries:

...
Undefined symbols:
  "_iconv_close", referenced from:
      _buf_write in fileio.o
      _readfile in fileio.o
      _readfile in fileio.o
...

The problem has to do with lib search path. I don’t know yet why isn’t used the system path (under /usr/lib) rather than the one used by macports.

Well, the thing is that the libiconv2.dylib under /opt/local/lib doesn’t have the _iconv_close function (among others):

[madtrick { lib } ]pwd
/opt/local/lib
 
[madtrick { lib } ]nm libiconv.2.dylib | grep "iconv_close"
000163f0 T _libiconv_close

While libiconv.2.dylib on /usr/lib does:

[madtrick { lib } ]pwd
/usr/lib
 
[madtrick { lib } ]nm libiconv.2.dylib | grep "iconv_close"
0000b905 T _iconv_close
0000fcce T _libiconv_close

So to fix this problem you have several choices:

  • Deactivate libiconv on macports (and all its dependencies)
  • Prepend a lib path

I went for the second one:

LDFLAGS="-L/usr/lib" ./configure _your_options_here_

There you go : )

4 comments » | mac, tweaks

git: bash-completion

July 4th, 2011 — 06:10 pm

Looking for a way to easyly know if there’s something changed on my git repos I found out that git itself ships a bash script that perfectly satisfy my needs.

Introducing: __git_ps1

Usage:

Include a call to __git_ps1 in your promt string (for example in bash):

PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '

This will show the current branch on your prompt.

Customization:

__git_ps1 allows to customize its output using environment variables. Here is a list of avaliable options:

  • GIT_PS1_SHOWDIRTYSTATE.  When set to something not empty, __git_ps1 will display unstaged (*) and staged (+) next to the branch name.
  • GIT_PS1_SHOWSTASHSTATE.  When set to something no empty, __git_ps1 will display $ next to the branch name when something is staged.
  • GIT_PS1_SHOWUNTRACKEDFILES.  When set to something no empty, __git_ps1 will display % next to the branch name when there’re untracked files.
  • GIT_PS1_SHOWUPSTREAM.  This cat take several (comma separated) values: auto, verbose, legacy, git and svn. __git_ps1 will show the difference between HEAD and its upstream.

Export them if your shell dotfile before calling __git_ps1.

Comment » | bash, git, tweaks

mac: tabswitching in Visor

July 4th, 2011 — 05:44 pm

I tryed Visor, a quake-like terminal for Mac OS, in the past but left it because there wasn’t an easy way to switch between tabs.

Until now…

Today I found TerminalTabSwitching. A plugin to enable cmd + <tab_number> switching on Terminal.app.

I’m a bit happier : )

Comment » | mac, tweaks

Vim: Ficheros *~

February 20th, 2009 — 12:44 pm

Cada vez que edito algún fichero con Vim en mi macbook voy dejando restos en forma de ficheros con terminación ~. Es decir, si edito el fichero foo tras guardar y salir me encuentro que ahora también tengo el fichero foo~.

¿Soluciones? Varias.

De todas formas yo opte por la mas sencilla -aunque menos drástica, deshabilitar la opción escribir ficheros de backup, que no guardar una copia temporal  mientras editamos.

Extracto de la documentación de Vim

If you write to an existing file (but do not append) while the ‘backup’,
‘writebackup’ or ‘patchmode’ option is on, a backup of the original file is
made. The file is either copied or renamed (see ‘backupcopy’). After the
file has been successfully written and when the ‘writebackup’ option is on and
the ‘backup’ option is off, the backup file is deleted. When the ‘patchmode’
option is on the backup file may be renamed.

*backup-table*
‘backup’  ’writebackup’    action
off                off                no backup made
off                on                backup current file, deleted afterwards
on                off                delete old backup, backup current file
on                on                delete old backup, backup current file

Es decir, en mi .vimrc tengo las siguientes lineas

set nobackup
set writebackup

Con ello, y atendiendo a la anterior tabla, se creara un fichero *.swp mientras editamos y este sera borrado al finalizar.Lo cual por lo menos para mi, es suficiente.

Existen otras soluciones, como crear directorios donde almacenar estos ficheros,… comentadas aquí

1 comment » | programacion, tweaks, vim