vim icon


All About Vim


. . .


Okay, all the Vimming we can do in 90 minutes!









ACM Student Chapter

Radford University


October 15, 2015

Overview - Four Main Topics

  1. Introduction - What and Why
  2. Starting with Vim
  3. Vim for Programmers
  4. More Cool Things You Can Do
  5. Resources

Introduction: What and Why

Introduction

What is Vim

Why Vim

Why Vim - 2

Why Vim - 3

Getting Started with Vim

Installing, Running, Exiting, Vim Tutor

Installing Vim

Running Vim

Important: How to Exit Vim"

Learn on Your Own with Vim Tutor

Commands in Vim Tutor

  1. hjkl, :q!, x, i, esc, A, wq
  2. de, dw, d$, d motion, count motion, d number motion, dd, u, U, ^r
  3. p, r, ce, cw, c$, c count motion, esc
  4. ^G, G, gg, number G, /, ?, n, N, ^o, ^i, %,
  5. :s/old/new/, :s/o/n/g, :#,#s/o/n/g, :%s/o/n/g, :%s/o/n/gc
  6. :!, :!ls, :w fname, v move :w fname, :r fname, :r !ls
  7. o, O, esc, a, R, v move y, yw
  8. :set ic, hlsearch, incsearch, hls, is, noic, /foo\c
  9. , :help, ^W^W, :q, vimrc, :anything^D,

Modes, Input, Replace, Undo

Modes

Norm Ins Esc i

Input Commands

Replace Commands

Undo, Redo, and Do Again

Commands for Movement

Cursor Movement: Line, Character, Word

Cursor Movement: To a Location

Screen Movement

Counts

Searching

Delete and Change Text

Delete Text

Changing Text

Combining Operator and Motion

Combining Counts with Operator and Motion

Cut and Paste



Paste Deleted Text



Copy (Yank) and Paste

Command Line Mode, Help, Set

Command Line Mode (aka ex mode)

Common Commands

Abbreviations

:help

Set

Configuration: Vimrc

.vimrc

Most Important Commands for Vimrc

Vim for Programmers

Query Settings

More Vimrc Commands

Tabbed Editing

Split Windows

Command History Window

Search History Window

Plugins

User Plugins

Filetype Plugins

User Filetype Plugins

Example User Filetype Plugin: java.vim


    ab pc public class <CR>{<CR><CR>}<UP><up><up><END><left>
    ab psvm public static void main(String[] args)<CR>{<CR><CR>}<UP><TAB><TAB>
    ab sop System.out.println();<LEFT><LEFT>
    ab fori for (int i = 0; i < X; i++)<CR>{<CR><CR>}<UP><TAB><TAB>

    set makeprg=javac\ % 

Example User Filetype Plugin: ada.vim


    ab fori for i in 1 .. 1 loop end loop;
    ab ati ada.text_io; use ada.text_io; 
    ab afti ada.float_text_io; use ada.float_text_io; 
    ab aiti ada.integer_text_io; use ada.integer_text_io; 
    ab proc procedure foo is beginend foo;
    autocmd BufNewFile,BufRead *.ad* set makeprg=gnatmake\ %

Autocmd

Quickfix window

Make program for Ada, C, Java

Templates

Editing

Shift and Indent

Visual Commands

Three kinds of highlighted areas

Commands on Visual Areas

Commands on Visual Blocks

Other Visual Commands

Text Objects

More Text Objects

Screen Movement

Cursor Movement

Mark Movement

Jump Movement

Searching

Search Options

Advanced Searching

Substitute Command - Substitute one string for another

Regular Expressions

%, *, #

gd, gD

What happend to my paste??

Control commands in input mode - Advanced

Folds

Creating, Opening, and Closing Folds

Net Read/Write

Resources

Books

Online References and Other Stuff