开发者

How to force bash autocomplete to one command?

I just upgrade to 开发者_Go百科Ubuntu Karmic 9.10 and there is now emphaty. The problem is that em-TAB- doesn't autocomplete to emacs anymore ...

I there a way to the my Bourne-Shell to complete em-TAB- always to emacs ?

Thank you


If you add an alias for em to your .bashrc you can skip the Tab-completion all together:

alias em=emacs

With this you can start emacs by simply typing the command em.


I use another approach - simple e command:

#!/bin/sh

# Written by Oleksandr Gavenko , 2008.
# File placed by author in public domain.

# View file in emacs buffer using emacsclient.
# If emacs not already running, run it.
# Put this file 'e' in your PATH.
# Name `e' because `edit'.

case "$1" in
  -h|-help|--help)
    echo "Emacsclient run script."
    echo "Usage:"
    echo "  e [-h|--help] file..."
    exit 0
    ;;
  "")
    echo "What file you want to open?"
    exit 0
    ;;
esac

if [ -n "$COMSPEC" ]; then
  # We probably under Windows like OS. I like native Emacs over Cygwin.
  for arg; do
    emacsclientw -a emacs -n "$arg"
  done
else
  # We under UNIX like OS.
  for arg; do
    emacsclient -a emacs -n "$arg"
  done
fi

Also I write similar script in batch file (.bat) language for MS Windows:

@echo off

REM Written by Oleksandr Gavenko , 2008.
REM File placed by author in public domain.

REM View files in emacs buffer using emacsclientw.
REM If emacs not already running, run it.
REM Put this file (e.bat) in your PATH.
REM Name `e' because `edit'.

REM If path to file contain spaces it must be inclosed into quotes.

if x%1 == x-h     goto usage
if x%1 == x-help  goto usage
if x%1 == x--help goto usage

:loop
emacsclientw -a runemacs -n %1
shift
if not x%1 == x goto loop
goto :eof

:usage
@echo Alias for emacsclient without waiting for editing ending.
@echo Usage:
@echo   e [-h^|--help] file...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜