Vim is a powerful text editor that originated as an improved version of the vi editor. It provides robust features like syntax highlighting, multi-level undo/redo, extensive regex support, code folding, and plugin capabilities. Vim can be customized extensively and is available on almost all operating systems. It is navigated primarily through keyboard shortcuts to move around files and perform actions like copying, deleting, and repeating edits.
What's New in Teams Calling, Meetings and Devices April 2024
Augusta Linux User Group - Vim Introduction
1. ViM – A text editor
About me
● Keith Pickett
● Married, 0 kids, 2 dogs
● From SE Tennessee (Appalachian Mountains.. that explains the ak-cent :) )
● Software developer (mostly web development)
● 22 years in Unix/Linux experience
● Love technology and the recent push in the CSRA.
● Why am I here? To provide what I know and to learn something from you.
● @KeithPickett
● http://about.me/KeithPickett
2. ViM – A text editor
What is Vim?
● Vim is a text editor. Not a word processor.
● Based on the vi text editor.
● You can't 'WYSIWYG' it. Through syntax highlighting, you can get close. That's not its purpose,
however.
History
Vi
● Created by Bill Joy (one of the co-founders of Sun Microsystems).
● Defined as "a screen-oriented text editor originally created for the Unix operating system. The
portable subset of the behavior of vi and programs based on it, and the ex editor language
supported within these programs, is described by (and thus standardized by) the Single Unix
Specification and POSIX." (source: http://en.wikipedia.org/wiki/Vi )
● Developed at first on an old ADM-3A terminal, before computer mice became ubiquitous. Users
relied on commands and keyboard-based navigation to interact with the editor. (See pictures)
● Derived from very painful editor named "ed" and a series of other command-line editors like ex.
The ex functionality is still part of Vim.
● Ex v2.0 became Vi. Version 3.1 became a permanent part of what we now know as Unix.
5. ViM – A text editor
Vim (Vi IMproved)
● Created by Bram Moolenaar in 1988 for the Atari platform. Mr. Moolenaar is active in the
International Child Care Fund (ICCF) to help educate children in Uganda.
● First public release in 1991 (Unix and early implementations of Linux later).
● The name "Vim" is an acronym for "Vi IMproved" because Vim is an extended version of the vi
editor, with many additional features designed to be helpful in editing program source code. -
[Source: http://en.wikipedia.org/wiki/Vim_(text_editor) ]
● Ported to Unix in 1992.
6. ViM – A text editor
Feature List
● Highly customizable
● Compatible with Vi (but now 100% compatible)
● Built in vimtutor for learning Vim
● GUI mode (gVim) with full mouse integration.
● Multi-level undo.
● Extended Regular Expression support.
● Code-completion
● Code merging
● Strong diff functionality (vimdiff)
● Code folding
● Syntax highlighting
● Session / State Preservation
● Built in text expansion using “iab” or can use plugins (snippetsEMU).
● Has its own scripting language (vimscript) for configuration and writing plugins.
● Plugins can be written in Lua (as of Vim 7.3), Perl, Python, Racket (formerly PLT Scheme), Ruby, and Tcl. It's not real robust, but scripts in these languages do work.
● Project distributions exist to make Vim more specific in its functionality. Cream is the most popular of these. Its aim is to make Vim more modern by taking advantages
of the GUI feature set.
7. ViM – A text editor
Availability
● All major operating systems and even the minor ones too.
● Versions are available for Android and iOS.
Other Interesting Facts
● Shells like KSH and BASH have vi mode. (set -o vi)
● Allows you to use most of the ex/vi commands and movements on the command line.
● ESC invokes vi mode. ESC-k brings up previous command. Pressing j or k will scroll through
command history. Pressing h or l will move the cursor over the command. 0 places cursor at the
beginning of the line and $ at the end.
8. ViM – A text editor
Navigation
When Vim is launched, the window is in “Normal” mode. This allows for the navigation of the cursor through the document. Pressing h, j,
k, l navigates the cursor.
0(Zero) -- positiosn cursor at the beginning of line
$ -- positions cursor at the end of the line
e – place cursor at the end of the next word. (dog, ford, cigar)
w -- set cursor to the beginning of the next word
b -- set cursor to the beginning of the previous word
E – place cursor at the end of the next non-blank spaced character (dogfood”, ford-focus”, cigar^box')
– Same for W and B respectively
Tab -- normal function
"." -- Repeat action
yy -- yank (copy) current line (line that cursor is positioned on).
dd -- delete current line (line that cursor is positioned on).
u -- undo last action (multi-level undo)
CTRL-R – Repeat next history item (multi-level re-do)
9.
10.
11.
12.
13.
14.
15.
16. ViM – A text editor
Follow-up items from the discussion:
Is there a vi mode in ZSH? Yes. It apparently doesn't behave as you would expect. A couple of Google searches yielded some
blog posts discussing the matter.
To split a Vim session horizontally, go into command mode and type “split”.
To split a Vim session vertically, go into command mode and type “vsplit”.
Examples:
(horizontal split)
:split
(vertical split)
:vsplit
To switch between windows * See Note-1 below*:
Split windows :: CTRL+ws
or :split in command mode.
Split windows vertically :: CTRL+wv
or :vsplit in command mode.
Switch between windows :: CTRL+ww
Quit a window :: CTRL+wq -
*Note-1*
The CTRL+<key> sequences above (example: CTRL+ws) probably look confusing and may not actually work if you don't execute
them correctly. The proper way to execute the command is to hold down CTRL and 'w', let go, and then tap the letter next to w. For
example, CTRL+ws, 's' would be the key to tap after 'CTRL w'.
17. ViM – A text editor
Links:
www.vim.org
www.viemu.com
http://arstechnica.com/information-technology/2011/11/two-decades-of-productivity-vims-20th-ann
http://en.wikipedia.org/wiki/Vi
http://en.wikipedia.org/wiki/Vim_(text_editor)
Questions?