Difference between revisions of "Vim"

From Apertium
Jump to navigation Jump to search
Line 2: Line 2:


It edits text.
It edits text.

It is a "modal" editor, meaning that you can switch "modes."
Vim starts in Command mode. More on this below.
By pressing 'i', you can switch to Insert mode. In Insert mode, you just move around with the arrow keys or mouse like in a normal editor. To type, well, just type. To get back to Command mode, press Esc.

==Command mode==
Vim has literally hundreds of different commands. However, you don't need to be overwhelmed. Just know the following, and you'll be fine for starting out.

* <code>ZZ</code> - save and exit
* <code>:open <file></code> - open <file>
* <code>:qa!</code> - discard all changes and exit
* <code>:w</code> - save changes but do not exit
* <code>:w <file></code> - save as <file> (note that this must be followed by <code>:open <file></code> if future <code>:w</code>s should use <file>)
* <code>:%s/<find>/<replace>/g</code> - find <find> and replace it with <replace>
* <code>i</code> - switch to Insert mode


==Editing XML (dix, transfer rules) in vim==
==Editing XML (dix, transfer rules) in vim==
http://www.pinkjuice.com/howto/vimxml/ is a nice guide to editing XML in vim
http://www.pinkjuice.com/howto/vimxml/ is a nice guide to editing XML in vim.


==Editing Xerox formats in vim==
==Editing Xerox formats in vim==

Revision as of 19:35, 23 March 2020

Vim is a text editor.

It edits text.

It is a "modal" editor, meaning that you can switch "modes." Vim starts in Command mode. More on this below. By pressing 'i', you can switch to Insert mode. In Insert mode, you just move around with the arrow keys or mouse like in a normal editor. To type, well, just type. To get back to Command mode, press Esc.

Command mode

Vim has literally hundreds of different commands. However, you don't need to be overwhelmed. Just know the following, and you'll be fine for starting out.

  • ZZ - save and exit
  • :open <file> - open <file>
  • :qa! - discard all changes and exit
  • :w - save changes but do not exit
  • :w <file> - save as <file> (note that this must be followed by :open <file> if future :ws should use <file>)
  • :%s/<find>/<replace>/g - find <find> and replace it with <replace>
  • i - switch to Insert mode

Editing XML (dix, transfer rules) in vim

http://www.pinkjuice.com/howto/vimxml/ is a nice guide to editing XML in vim.

Editing Xerox formats in vim

Various people have created lexc/twol syntax files for vim:

See also Apertium-specific conventions for lexc#Syntax highlighting and folding in vim