Elric's random thoughts in idle times

"Why stop now, when I'm just starting to hate it?" – Marvin the robot

Posts Tagged ‘vim

Using vim-addons and PO plugin

leave a comment »

I really like vim-addons. It provides a very convenient and quick way to install, enable, disable, and more, addons for Vim. You can do it per-user if you run without privileges (a link is created under ~/.vim, or system-wide. To work, it needs some data fields in a yaml file for every plugin. The package vim-scripts in Debian provides such file, so I just used that one.

By default, vim-addons searches for plugins under /usr/share/vim/addons, whereas the plugins provided by vim-scripts are located under /usr/share/vim-scripts. This means you can add any plugin under /addons with the knowledge that it won’t interfere with other vim-scripts.

The reason I did this is because I don’t like the PO plugin file provided with vim-scripts. I rather like its fork, which also includes documentation. This is the entry I created for it in /usr/share/vim/registry/vim-scripts.yaml. You can also create a new yaml file and place it under the same directory. I didn’t have to specify the field basedir, as I placed the files under vim/addons.

addon: po-fork
description: "Enhanced PO addon"
disabledby: "let loaded_alternateFile = 1"
- ftplugin/po.vim
- doc/po.txt

This done, use vim-addons list to see all addons with a yaml file, and vim-addons install addon to activate it. Use vim-addons help to get an idea of what you can do with this program.


Written by elric80

December 1, 2010 at 12:30 pm

Posted in debian, l10n, linux, vim

Tagged with , , , ,

po4a and vim-doc-es. Example of text format usage.

leave a comment »

po4a and vim are among my favourite FOSS applications ever since I started to like GNU/Linux systems. Some time ago, I joined vim-doc-es and (recently) po4a projects as a translator. However, I was in grief as I couldn’t use po4a in my vim-doc-es project due to some formatting problems. Up to now :)

This post is for people who don’t know about po4a, and intended as a simple example of adapting po4a to your project (or the other way around) if it’s just documentation what you need to translate. The po4a.cfg file is so complete I had no need to change the directory structure, though I guess it may be neccesarry in projects where you need to extract the translatable strings from the code. At vim-doc-es we only deal with text format (I would like to go html some time). The requirements of po4a in this project are very simple. I hope this will enlighten your way if you’ve never touched po4a before.

As I said, the central part of automatizing po4a in your project is the po4a.cfg file. Here’s vim-doc-es one.

# vim-doc-es po4a.cfg

[po4a_langs] es

# The languages to which you want to translate the document.

[po4a_paths] original/POT/$master.pot es:traducido/PO/$master.po

# The paths to both pot’s and po’s. The $master variable is perfect when you need to translate several documents. If you only have one document, you may do the following.

[po4a_paths] original/POT/original.pot $lang:traducido/PO/$lang.po

# In this case, original.pot would be translated to as many languages as specified in the [po4a_langs] field.

# General options for po4a (po4a-translate and po4a-updatepo). Specify the module options below.

[options] opt:"-v --package-name Vim --package-version 7.2\
--msgid-bugs-address vim@bugs.org --no-backups"

# You can see here that some fields are automatically filled up with po4a.

# Aliases for the text module. You may create as many aliases as needed, or none and just use [type:module] for every document.

[po4a_alias:vimtxt] text opt:"-M utf-8 -L utf-8 -o tabs=verbatim -o nobullets"
[po4a_alias:vimtxt0] text opt:"-M utf-8 -L utf-8 -k 0 -o tabs=verbatim -o nobullets"
# I need one file to recieve different options.

# List of documents. The source and destination paths of the original and translated document. You may use the $lang variable in case you have more languages. Note how every document is set to a module alias, not to the module itself. You can specify as many format modules as needed.

# help.txt
[type:vimtxt] original/TXT/help.txt es:traducido/ESX/help.esx

# Tabla de contenidos
[type:vimtxt0] original/TXT/usr_toc.txt es:traducido/ESX/usr_toc.esx

# Manual de usuario.
[type:vimtxt] original/TXT/usr_01.txt es:traducido/ESX/usr_01.esx
[type:vimtxt] original/TXT/usr_02.txt es:traducido/ESX/usr_02.esx
[type:vimtxt] original/TXT/usr_03.txt es:traducido/ESX/usr_03.esx
[type:vimtxt] original/TXT/usr_04.txt es:traducido/ESX/usr_04.esx
[type:vimtxt] original/TXT/usr_05.txt es:traducido/ESX/usr_05.esx
[type:vimtxt] original/TXT/usr_06.txt es:traducido/ESX/usr_06.esx
[type:vimtxt] original/TXT/usr_07.txt es:traducido/ESX/usr_07.esx
[type:vimtxt] original/TXT/usr_08.txt es:traducido/ESX/usr_08.esx
[type:vimtxt] original/TXT/usr_09.txt es:traducido/ESX/usr_09.esx
[type:vimtxt] original/TXT/usr_10.txt es:traducido/ESX/usr_10.esx
[type:vimtxt] original/TXT/usr_11.txt es:traducido/ESX/usr_11.esx
[type:vimtxt] original/TXT/usr_12.txt es:traducido/ESX/usr_12.esx
[type:vimtxt] original/TXT/usr_20.txt es:traducido/ESX/usr_20.esx
[type:vimtxt] original/TXT/usr_21.txt es:traducido/ESX/usr_21.esx
[type:vimtxt] original/TXT/usr_22.txt es:traducido/ESX/usr_22.esx
[type:vimtxt] original/TXT/usr_23.txt es:traducido/ESX/usr_23.esx
[type:vimtxt] original/TXT/usr_24.txt es:traducido/ESX/usr_24.esx

Running “po4a po4a.cfg” updates pot and po files, as well as the translated documents.
And that’s about it. Easy and cool.

Written by elric80

November 24, 2009 at 3:56 pm

Posted in l10n, linux

Tagged with , , , ,

Proyecto vim-doc-es. Manual de usuario de Vim en español.

leave a comment »

El proyecto vim-doc-es nació con la intención de ofrecer una correcta y completa traducción de Vim al español, incluyendo la documentación (páginas de manual y archivos de ayuda) así como la interfaz gráfica y los mensajes del programa. Read the rest of this entry »

Written by elric80

November 1, 2009 at 7:33 pm

Posted in l10n, vim

Tagged with , ,

Vimpress. Blogging in WordPress with Vim.

leave a comment »

I really like the fact that Vim can do nearly anything, with the appropiate script. Since Vim is a light app, it’s great that you can read your RSS feeds, play music and many more things with it.
Right now, I’m starting to enjoy Vimpress. No need to go to WordPress, edit new post, and pray that nothing goes wrong, and that you don’t lose what you wrote so far (which has happened to me, and I have posted less than 10 times, so far). Plus, the plugin supports tags and categories. You won’t have the html editing facilities WordPress provides you, but this script is powerful enough to do the majority of your tasks. Read the rest of this entry »

Written by elric80

October 27, 2009 at 4:44 am

Posted in linux, vim

Tagged with , ,

Mpd on Debian with Vim

with one comment

Yes, I know Vim is much more than a music player, or that it surpasses by large any use I may give to it. I just love to use it for almost anything. And as a non-programmer, that anything means whatever but code editing. It’s still pretty enjoyable :)

Being the music lover I am, and the fact that I like to try any music app there is around, it was just a matter a time that I ended up using ANY interface to control my mpd local server. In search for a light one, what the fuck? Vim.

Read the rest of this entry »

Written by elric80

September 1, 2009 at 8:33 pm

Posted in debian, linux, music, vim

Tagged with , , , , ,