I wanted to learn Go. But as everybody knows, I need do use something to learn how to use it. After a while reading articles and watching talks about Go I started to think about what I could do, and what I did, was creating (a) tongue.

I like learning languages, yeah, human languages that is. Unfortunately I am not able to speak any single one except my native language to a good level but I like it anyways. You can’t be good at everything you know?

When creating tongue, I wanted it to be as simple as possible. It should be easy to use it with other programs. Meaning it should just store and retrieve my vocabulary, but I might use different things to display them. Maybe I would like to interact directly with tongue on the command line, but chances are good I will also want to use it to display my “vocabulary of the hour” via conky. Or use the notifcation-daemon to display a foreign word to me.

Long story short, I tried to adhere to the UNIX philosophy, of doing just one task, and doing it well.

Okay I am not so sure about the latter, but i will try my best.


I love Go because it let’s me stay on the command line all day long. I used vim with the vim-go plugin to write my code. The experience was awesome. Go is such a simple and clean language that vim is perfectly capable of handling it without any heavy customization. At work I am coding in PHP using the Symfony2 Framework, and at first I tried to do it with vim. But at some point a collegue made me try out PHPStrom, and I have to say it’s good. There is even a vim plugin which makes things much more comfortable. So it’s a good trade-off.

The beauty about Go is, that you don’t need a heavy IDE. Everything works great with vim.

Usually I opened a terminal, started tmux, created two panels with vim on top and a shell below. I coded in vim, switched to the pane below and built and tested my program.

Go and vim-go come with some nice tools that help you with your code, namely:

  • go fmt
  • go vet
  • go imports
  • go cover
  • go lint
  • go fix

If I was unaware how a function from the standard libarary or from 3rd parties worked, I could just press gd to jump to the definition. Those tools and simple vim was all the IDE-like features I needed. It was all there. Great.

release rest-reminder post first. and link to it for same possiblities with notifdy-send etc.


My main reason for creating tongue was to learn Go. But now I find myself using it a lot. Whenever I stumble upon a new word I go right into my Terminal and add it to my databse:

$ tongue add Hallo Merhaba

Because I am so proud of my ever growing list of words, I just type this from time to time to get excited:

$ tongue --verbose l
You have 10 entries in your database:
1: Hallo - Merhaba
2: schön - güzel
3: Blume - çiçek

The –verbose flag makes tongue output additional information like in this case You have 10 entries in your database. It should be used when you interact with it on the commandline directly. If you want to process the information with another program or script you shouldn’t use this flag. Your output will be easier to parse then.

Sometimes I mistype so I have to delete a word again:

$ tongue add Afe maymun

$ tongue delete Afe

$ tongue add Affe maymun

$ tongue list
1: Hallo - Merhaba
2: Affe - maymun

When I am totally confused and don’t know how to use tongue anymore there is:

$ tongue --help
tongue - a cli vocabulary manager

tongue [global options] command [command options] [arguments...]


Michael Vetter <>

add, a		add a new entry to the database. First argument is native, second is foreign word.
delete, d	delete entry from the database. Argument is the native word. Only the first occurance will be deleted.
list, l		list all entries
show, s		display an entry
help, h		Shows a list of commands or help for one command

--no-native					don't display native word
--no-foreign				don't display foreign word
--file "collection.json"	specify JSON file
--verbose, -m				display (more) additional messages
--help, -h					show help
--version, -v				print the version

$ tongue show --help
show - display an entry

command show [command options] [arguments...]

--index, -i "0"	display entry with index 'index'
--native, -n	display entry where native word is 'native'
--foreign, -f	display entry where foreign word is 'foreign'

Another nice feature is that you can configure conky to display a new random word combination every X minutes, just by adding the following line to your .conkyrc:

${execi 5 tongue show}

It is probably a good idea to use the global –no-native flag to display the foreign word only in your conky. So you can think first, see if you can come up with the native word yourself and if not just run tongue show --foreign Merhaba to see the word.

$ tongue --no-native show

$ tongue show --foreign Merhaba

In similar ways you can use notify-send to get a message on your desktop every X minutes containing your vocabulary. This time I tell tongue to use my spanish database instead of the standard one:

watch -n 10 "notify-send '$(tongue show --file ~/spanish.json)'"

You guessed right, tongue is available on GitHub.

Composed with vim. Published on Wed, Apr 29, 2015 via Hugo.
© Michael Vetter