Logo Море(!) аналитической информации!
IT-консалтинг Software Engineering Программирование СУБД Безопасность Internet Сети Операционные системы Hardware

VPS в России, Европе и США

Бесплатная поддержка и администрирование

Оплата российскими и международными картами

🔥 VPS до 5.7 ГГц под любые задачи с AntiDDoS в 7 локациях

💸 Гифткод CITFORUM (250р на баланс) и попробуйте уже сейчас!

🛒 Скидка 15% на первый платеж (в течение 24ч)

Скидка до 20% на услуги дата-центра. Аренда серверной стойки. Colocation от 1U!

Миграция в облако #SotelCloud. Виртуальный сервер в облаке. Выбрать конфигурацию на сайте!

Виртуальная АТС для вашего бизнеса. Приветственные бонусы для новых клиентов!

Виртуальные VPS серверы в РФ и ЕС

Dedicated серверы в РФ и ЕС

По промокоду CITFORUM скидка 30% на заказ VPS\VDS

2006 г.

Справочник по Debian

[ назад ] [ Содержание ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ A ] [ вперед ]

Osamu Aoki, перевод Ильи В. Головко, qref.sourceforge.net

Глава 11 - Editors

11.1 Popular editors

Linux offers many alternatives for console text editors. Among them:

  • vim: Powerful and light BSD-heritage editor. VI iMproved.
  • emacs: Ultimate and heavy GNU-heritage editor. RMS (Richard M. Stallman) original.
  • xemacs: Emacs: The Next Generation, originally from Lucid.
  • mcedit: Newbie GNU editor. Identical to mc internal editor. See Редактор в MC, раздел 4.2.5.
  • ae: Default small editor (Potato). Avoid this.
  • nano: Default small GNU editor (Woody). Emulates pico.
  • joe: For WordStar or TurboPascal old-timers.
  • jed: Fast, full-featured menu-driven editor with Emacs key bindings.
  • jove: Very small editor with Emacs key bindings.
  • nvi: New vi. Bug-for-bug compatible with the original vi.

Use update-alternatives --config editor to change the default editor. Also, many programs use environment variables EDITOR or VISUAL to decide which editor to use. See Редактор в MC, раздел 4.2.5.

Also a few X-based text editors are noteworthy:

  • gvim: Vim with GUI (vim and vim-gtk package)
  • emacs: The One True Emacs (auto-detect X).
  • xemacs: Next generation Emacs (auto-detect X).

These xclient commands take standard options such as -fn a24, which makes life easy for older folks like me :) See X clients, раздел 9.4.4.

11.2 Rescue editors

There are a few editors which reside in /bin. One of these should be installed to ease editing files when /usr is not accessible.

  • elvis-tiny: Minimum vi editor (vi to start)
  • nano-tiny: Minimum non-vi editor (nano-tiny to start)
  • ed: Minimum editor (always there but tough to use)

11.3 Emacs and Vim

11.3.1 Vim hints

Read the "VIM - main help file" document by pressing <F1> while running the program.

     <F1>           Help
     <esc>          Back to normal mode
     V              Visual mode
     i              Insert mode
     :              Command-line commands
     :set tw=72     Set text width to 72
     <F11>          Insert (paste) mode
     :r! date -R    Insert RFC-822 date
     qa             Record keystrokes into register a
     q              Stop keystroke recording
     @a             Execute keystrokes from register a
     :edit foo.txt  Edit another file by loading foo.txt
     :wnext         Write current file and edit next file

q and @ can be used for simple macro recording and playback. For instance, to create a macro that inserts HTML italics tags around the word at the cursor, you could enter qii<i>^[ea</i>^[q (where ^[ is the ESC key). Then typing @i at the start of a word would add the tags <i> and </i>.

See also Using GnuPG with Vim, раздел 14.4.2.

11.3.2 Emacs hints
     <F1>                Help
     <F10>               Menu
     C-u M-! date -R     Insert RFC-822 date
11.3.3 Starting the editor
     start editor:                   emacs filename  vim filename
     start in vi compatible:                         vim -C
     start in vi non-compatible:                     vim -N
     start with compile default:     emacs -q        vim -N -u NONE
11.3.4 Editor command summary (Emacs, Vim)
     exit:                           C-x C-c         :qa /:wq /:xa /:q!
     Get back/command mode:          C-g             <esc>
     Backward(left):                 C-b             h
     Forward(right):                 C-f             l
     Next(down):                     C-n             j
     Previous(up):                   C-p             k
     stArt of line(^):               C-a             0
     End of line($):                 C-e             $
     mUltiple commands:              C-u nnn cmd     nnn cmd
     Multiple commands:              M-digitkey cmd
     save File:                      C-x C-s         :w file
     beginning of buffer:            M-<             1G
     end of buffer:                  M->             G
     scroll forward 1 screen:        C-v             ^F
     scroll forward 1/2 screen:                      ^D
     scroll forward 1 line:                          ^E
     scroll backward 1 screen:       M-v             ^B
     scroll backward 1/2 screen:                     ^U
     scroll backward 1 line:                         ^Y
     scroll the other window:        M-C-v
     delete under cursor:            C-d             x
     delete from cursor to eol:      C-k             D
     iSearch forward:                C-s
     isearch Reverse:                C-r
     Search forward:                 C-s enter       /
     search Reverse:                 C-r enter       ?
     isearch regexp:                 M-C-s
     isearch backward regexp:        M-C-r
     search regexp:                  M-C-s enter     /
     search backward regexp:         M-C-r enter     ?
     Help:                           C-h C-h         :help
     Help Apropos:                   C-h a
     Help key Bindings:              C-h b           :help [key]
     Help Info:                      C-h i
     Help Major mode:                C-h m
     Help tutorial:                  C-h t           :help howto
     Undo:                           C-_             u
     Redo:                           C-f             ^R
     Mark cursor position:           C-@             m{a-zA-Z}
     eXchange Mark and position:     C-x C-x
     goto mark in current file:                      '{a-z}
     goto mark in any file:                          '{A-Z}
     copy region:                    M-w             {visual}y
     kill region:                    C-w             {visual}d
     Yank and keep buffer:           C-y             
     Yank from kill buffer:          M-y             p
     convert region to Upper:        C-x C-u         {visual}U
     convert region to Lower:        C-x C-l         {visual}u
     Insert special char:            C-q octalnum/keystroke  
                                                     ^V decimal/keystroke
     replace:                        M-x replace-string      :%s/aaa/bbb/g
     replace regexp:                 M-x replace-regexp      :%s/aaa/bbb/g
     query replace:                  M-%                     :%s/aaa/bbb/gc
     query replace:                  M-x query-replace
     query replace regexp:           M-x query-replace-regexp
     Open file:                      C-x C-f         :r file
     Save file:                      C-x C-s         :w
     Save all buffers:               C-x s           :wa
     Save as:                        C-x C-w file    :w file
     Prompt for buffer:              C-x b
     List buffers:                   C-x C-b         :buffers
     Toggle read-only:               C-x C-q         :set ro
     Prompt and kill buffer:         C-x k
     Split vertical:                 C-x 2           :split
     Split horizontal:               C-x 3           :vsplit (ver. 6)
     Move to other window:           C-x o           ^Wp
     Delete this window:             C-x 0           :q
     Delete other window(s):         C-x 1           ^Wo
     run shell in bg:                M-x compile
     kill shell run in bg:           M-x kill-compilation
     run make:                                       :make Makefile
     check error message:            C-x`            :echo errmsg
     run shell and record:           M-x shell       :!script -a tmp
     ...clean BS, ...                                :!col -b <tmp >record
     ...save/recall shell record:    C-x C-w record  :r record
     run shell:                      M-! sh          :sh
     run command:                    M-! cmd         :!cmd
     run command and insert:         C-u M-! cmd     :r!cmd
     run filter:                     M-| file        {visual}:w file
     run filter and insert:          C-u M-| filter  {visual}:!filter
     show option                                     :se[t] {option}?
     reset option to default                         :se[t] {option}&
     reset boolean option                            :se[t] no{option}
     toggle boolean option                           :se[t] inv{option}
     wrap text at column 72                          :se tw=72
     do not wrap                                     :se tw=0
     autoindent                                      :se ai
     expand tab                                      :se et
     specify comment (mail)                          :se comments=n:>,n:\|
     
     run GDB                         M-x gdb                        
     describe GDB mode               C-h m                          
     step one line                   M-s
     next line                       M-n
     step one instruction (stepi)    M-i                            
     finish current stack frame      C-c C-f                        
     continue                        M-c                            
     up arg frames                   M-u                            
     down arg frames                 M-d                            
     copy number from point, insert at the end 
                                     C-x &                          
     set break point                 C-x SPC
11.3.5 Vim configuration

In order to use all Vim features and syntax highlighting, include the following lines in ~/.vimrc or /etc/vimrc:

     set nocompatible
     set nopaste
     set pastetoggle=<f11>
     syn on

Paste mode enables one to avoid autoindent interfering with cut-and-paste operations on a console terminal. It does more than just a simple ":set noai".

See Using GnuPG with Vim, раздел 14.4.2 for GnuPG integration.

11.3.6 Ctags

apt-get install exuberant-ctags and run ctags on the source files. Type :tag function_name in Vim to jump to the line where function_name starts. The tags work for C, C++, Java, Python, and many other languages.

Emacs has the same ctags capabilities.

11.3.7 Convert a syntax-highlighted screen to HTML source

so \$VIMRUNTIME/syntax/2html.vim from Vim command mode will convert highlighted text to HTML text. Save with :w file.html and :q. Useful for C code, etc.

11.3.8 Split screen with vim

vim can edit multiple files in a multi-split-screen environment. Type :help usr_08.txt for details.

To split the screen display between different files, type at the vi command prompt:

     :split another-file
     :vsplit another-file

Or at a shell prompt:

     $ vi -o file1.txt file2.txt   # Horizontal split
     $ vi -O file1.txt file2.txt   # Vertical split

will provide multiwindow vi.

     $ vimdiff file.txt~ file.txt         # check recent changes of file.txt
     $ vimdiff file.en.sgml file.fr.sgml  # check changes of translation
     $ gvimdiff file.txt~ file.txt        # in X

will provide a nice view of differences between an original and a backup file. In SGML it matches tags, so comparing translations in this mode works very well.

Special cursor movements with Ctrl-W commands:

     Ctrl-W +      increase the size of a window
     Ctrl-W -      decrease the size of a window
     Ctrl-W h      move to the window left
     Ctrl-W j      move to the window below
     Ctrl-W k      move to the window above
     Ctrl-W l      move to the window right
     ...

Use the following to control screen scrolling:

     :set scrollbind
     :set noscrollbind

[ назад ] [ Содержание ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ A ] [ вперед ]

VPS/VDS серверы. 30 локаций на выбор

Серверы VPS/VDS с большим диском

Хорошие условия для реселлеров

4VPS.SU - VPS в 17-ти странах

2Gbit/s безлимит

Современное железо!

Бесплатный конструктор сайтов и Landing Page

Хостинг с DDoS защитой от 2.5$ + Бесплатный SSL и Домен

SSD VPS в Нидерландах под различные задачи от 2.6$

✅ Дешевый VPS-хостинг на AMD EPYC: 1vCore, 3GB DDR4, 15GB NVMe всего за €3,50!

🔥 Anti-DDoS защита 12 Тбит/с!

Новости мира IT:

Архив новостей

IT-консалтинг Software Engineering Программирование СУБД Безопасность Internet Сети Операционные системы Hardware

Информация для рекламодателей PR-акции, размещение рекламы — adv@citforum.ru,
тел. +7 495 7861149
Пресс-релизы — pr@citforum.ru
Обратная связь
Информация для авторов
Rambler's Top100 TopList This Web server launched on February 24, 1997
Copyright © 1997-2000 CIT, © 2001-2019 CIT Forum
Внимание! Любой из материалов, опубликованных на этом сервере, не может быть воспроизведен в какой бы то ни было форме и какими бы то ни было средствами без письменного разрешения владельцев авторских прав. Подробнее...