Today
-
Yesterday
-
Total
-
  • 날아갈 듯 가벼운 mg 편집기
    Programmer/Emacs 2019. 2. 28. 11:02

    시스템 운영을 하는데 있어서 이맥스는 좀 무겁다.
    간단한 설정 파일 편집에는 적합하지 않다.
    대안으로, `nano', `vi(m)'이 있다.
    그런데, `nano'는 익숙하지 않은데다 배우기도 싫다.
    `vi(m)'은 이단으로 교리에 위배된다.

     

    여기에 `mg'라는 가벼운 유사 이맥스가 있다.
    명령이 떨어지기 무섭게 커서가 떨어진다.
    주요 키바인딩(단축키)이 이맥스와 같다.
    이맥스 사용자가 익숙하게 사용할 수 있다.

     

    마이너한 오픈 소스의 문제 중에 유지 보수가 잘 이루어지지 않는 것이 있다.
    `mg'는 그런 점에서는 안심해도 된다.
    OpenBSD의 요소로 간주되어 유지보수를 잘 해주고 있다.

     

    단순 편집기 기능 이외에 다중 윈도우, dired, ctags, cscope와 같은 유용한 기능도 지원한다.

     

    우분투에서 설치하는 방법이다.

    sudo apt-get install mg

    시스템 운영의 표준 편집기로 지정한다.

    sudo update-alternatives --config editor
    There are 5 choices for the alternative editor (providing /usr/bin/editor).
    
      Selection    Path                Priority   Status
    ------------------------------------------------------------
    * 0            /bin/nano            40        auto mode
      1            /bin/ed             -100       manual mode
      2            /bin/nano            40        manual mode
      3            /usr/bin/mg          30        manual mode
      4            /usr/bin/vim.basic   30        manual mode
      5            /usr/bin/vim.tiny    15        manual mode
      
      
    Press <enter> to keep the current choice[*], or type selection number:

    이 화면에서 `mg'에 해당하는 번호를 입력하여 선택한다.
    위 화면으로 예를 든다면, `3'를 입력하고 엔터를 누른다.

     

    기본 편집기를 선택하는 화면이 뜨지 않으면 아래 명령으로 추가한다.

    sudo alternatives —install /usr/bin/editor editor /usr/bin/mg 30

     

    사용 방법은 `man mg'로 mg의 man 페이지에서 볼 수 있다.

    MG(1)                                                                            BSD General Commands Manual                                                                            MG(1)
    
    NAME
         mg — emacs-like text editor
    
    SYNOPSIS
         mg [-nR] [-f mode] [+number] [file ...]
    
    DESCRIPTION
         mg is intended to be a small, fast, and portable editor for people who can't (or don't want to) run emacs for one reason or another, or are not familiar with the vi(1) editor.  It is
         compatible with emacs because there shouldn't be any reason to learn more editor types than emacs or vi(1).
    
         The options are as follows:
    
         +number
                 Go to the line specified by number (do not insert a space between the ‘+’ sign and the number).  If a negative number is specified, the line number counts backwards from the
                 end of the file i.e. +-1 will be the last line of the file, +-2 will be second last, and so on.
    
         -f mode
                 Run the mode command for all buffers created from arguments on the command line, including the scratch buffer and all files.
    
         -n      Turn off backup file generation.
    
         -R      Files specified on the command line will be opened read-only.
     ....

     

    추가1) UTF-8을 지원하지 않아서 한글이 깨진다. 작은 이맥스 계열(mg, uemacs, jove 등)은 전부 그러한 듯 하다. 한글이 포함되어 있다면 emacs(어쩔 수 없는 경우만, vim)를 사용한다.

    댓글

Designed by Tistory.