Difference between revisions of "Bash completion"
|  (Replaced content with 'If you want "intelligent" bash completion on TAB for apertium, lttoolbox, vislcg3, hfst, see https://github.com/unhammer/apertium-completion') | |||
| Line 1: | Line 1: | ||
| If you want  | If you want “intelligent” bash completion on TAB for apertium, lttoolbox, vislcg3 and hfst, do e.g.: | ||
|  $ git clone https://github.com/unhammer/apertium-completion.git ~/apertium-completion | |||
| and add this to your ~/.bashrc: | |||
| <pre> | |||
| if ! shopt -oq posix && \ | |||
|    [[ ( -z "$INSIDE_EMACS" || "$EMACS_BASH_COMPLETE" = "t" ) ]]; then | |||
|     for f in ~/apertium-completion/completions/*; do | |||
|         [[ -f $f ]] && source "$f" | |||
|     done | |||
| fi | |||
| </pre> | |||
| Alternatively, if your OS sources files from e.g. /etc/bash_completion_d automatically, just sudo cp ~/apertium-completion/completions/* /etc/bash_completion_d/ (then you don’t have to add anything to ~/.bashrc). | |||
| Now open a new terminal and try typing apertium and press TAB twice, you should get a list of installed language pairs; apertium -d . and TAB twice should show you a list of the possible translation modes in this directory; etc. | |||
| PROTIP: If you add | |||
| <pre>"\e\C-d": "apertium -d . \t\t"</pre> | |||
| to ~/.inputrc you can simply type "alt+ctrl+d" and your terminal will fill out "apertium -d . " and press TAB twice (showing the list of modes of your current directory). | |||
Revision as of 07:53, 14 June 2014
If you want “intelligent” bash completion on TAB for apertium, lttoolbox, vislcg3 and hfst, do e.g.:
$ git clone https://github.com/unhammer/apertium-completion.git ~/apertium-completion
and add this to your ~/.bashrc:
if ! shopt -oq posix && \
   [[ ( -z "$INSIDE_EMACS" || "$EMACS_BASH_COMPLETE" = "t" ) ]]; then
    for f in ~/apertium-completion/completions/*; do
        [[ -f $f ]] && source "$f"
    done
fi
Alternatively, if your OS sources files from e.g. /etc/bash_completion_d automatically, just sudo cp ~/apertium-completion/completions/* /etc/bash_completion_d/ (then you don’t have to add anything to ~/.bashrc).
Now open a new terminal and try typing apertium and press TAB twice, you should get a list of installed language pairs; apertium -d . and TAB twice should show you a list of the possible translation modes in this directory; etc.
PROTIP: If you add
"\e\C-d": "apertium -d . \t\t"
to ~/.inputrc you can simply type "alt+ctrl+d" and your terminal will fill out "apertium -d . " and press TAB twice (showing the list of modes of your current directory).

