Posts Tagged ‘gnome’

UTF-8 by default for gedit

Monday, January 14th, 2008

For a long time, I use UTF-8 for source files. But it isn’t the default charset encoding of my gnome environment.

GEdit tries to autodetect the encoding to be used and it works fine. But this feature don’t work with the Snap Open plugin. Each time, Snap Open opens a file .. I need to confirm the usage of UTF-8 :-(

I tested this week-end a small script wrapper to change the default charset encoding to UTF-8 before starting gedit :


#!/bin/sh
LC_CTYPE=en_US.UTF-8
export LC_CTYPE
/usr/bin/gedit $*

Here are several minutes saved per day :-)

Go to gtk bookmarks in your shell

Wednesday, November 28th, 2007

Gnome (I mean the FileChooser, Nautilus, etc) supports for a few time Bookmarks/Places. You can go back to your favorite folders in a single click. Very usefull in Gedit for example.

But when you’re in your shell ? I use a lot the Ctrl+R search in my zsh history, but it’s a bit tiring to search always the same thing.

First step : a small ruby script to find the wanted path in the gtk boorkmark.

Second step : because a script can’t change the current path of your shell, a function called by an alias is needed. Under zsh, you can make it like that (into your .zshrc) :

function go_impl() {
  target_name=$1
  target=`go-path $target_name`

  if [ -d "$target" ]; then
    cd $target
  else
    echo "target not found : $target_name" 2>&1
  fi
}

alias go='go_impl'

And then ?

[hyppo:~] go freecast
[hyppo:..g/freecast/trunk]

:-)

For the moment, I didn’t manage to setup the zsh completion … The following code :

function go_targets { reply=(`go-path --all`); }
compctl -K go_targets go

… doesn’t nothing