Sdcv

From ArchWiki
Jump to navigation Jump to search

Sdcv is a command line dictionary. It provides access to dictionaries in StarDict's format.

Installation

sdcv is available from the official repositories.

Usage

sdcv can be started from the command line:

sdcv

This gives you a 'shell-like' command-line from which you can query the database.

Adding dictionaries

There are various places on the web where you can download StarDict dictionaries (e.g. https://web.archive.org/web/20200702000038/http://download.huzheng.org/).

Once you have the appropriate files you can extract them into /usr/share/stardict/dic.

If you don't have root permission, you can set the STARDICT_DATA_DIR environment variable. For example:

export STARDICT_DATA_DIR=$XDG_DATA_HOME

sdcv will look in the dic subdirectory so make sure that it is created and then place your dictionary files inside it.

If all is done correctly, sdcv should be able to output definitions for words passed into it.

Tips

Output Formatting

You can use a wrapper around sdcv to conveniently format its output (Source):

def() {
	sdcv -n --utf8-output --color "$@" 2>&1 | \
	fold --width=$(tput cols) | \
	less -FRX
}

See Also