Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

VIM Exrc files

News See Also Recommended Links Reference .vimrc
    History Humor Etc

Please note that the .exrc file contains commands that Vi reads when you first run it. The default directory that Vi looks in for the .exrc file is your home directory. However, if you run Vi from another directory containing a .exrc file, Vi will use the .exrc in that directory and bypass the home directory .exrc. You must precede control characters (like ^[ or ^M) with CONTROL-V. For example to enter ^M, type CONTROL-V CONTROL-M.

Some important points for .exrc files:

  1. Do not allow any blank lines in the file or processing will stop on that line.
  2. Comments are introduced by starting a line with a double quote: "
  3. All directives, whether options, abbreviations, or key macros must all be typed on a single line. The listing below has had the lines broken up for the sake of readability.
  4. Control characters like [tab],[linefeed],[escape] can be inserted by first typing ^V (hold down Ctrl, and press V), followed by the character. For instance, for [tab], hold Ctrl and press V, release Ctrl, hit [tab]. You'll see ^I. This is evident in the listing below.

For VIM the corresponding file is .vimrc (_vimrc in case of windows).

my .exrc

" .exrc - dwc - last update: 3/2002
"
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" set options the way I like 'em
"
set exrc              # allow the dangerous option of reading any
                      # .exrc files found in the current directory
set autoindent        # handy for email and programming
set edcompatible      # i'm used to the old-fashioned way
set errorbells        # let me know when i've screwed up with a beep
                      # so that I don't have to look up from my work
"set modeline         # reduces the confusion factor immeasurably
"set nomore           # i don't want to see all the verbose error messages
                      # and explanations. i can figure it out, thank you.
set number            # precede each line with a number so i can easily do
                      # stuff like- :77,87!fmt to format a block of text
set remap             # hm. don't recall, but I know I like it.  ;-)
set report=1          # *always* show me changes that commands make
set ruler             # more confusion reduction. what line/column i'm on.
set scroll=15         # got stuck in by default somewhere, so i left it.
set shiftwidth=2      # i like minimal indentation. see tabstops (ts), too.
"set showcmd          # not portable across all kinds of vi
set showmatch         # match parens and braces. good for programming.
set showmode          # portable method to show the current mode on bottom line
set tabstop=2         # this should be the same as the next line. not always.
set ts=2              # only indent 2 spaces. see shiftwidth (sw) above.
set terse             # no news is good news.
set nowrapscan        # sorry. don't recall.
set directory=/tmp    # where to put temporary files. good for most systems
"
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" abbreviations. most start with an underscore to help make them easier
" to remember. just type the first item on the line (no, not abbr),
" followed by white space or escape, and the rest will be inserted.
"
"
abbr _meat [email protected]     # no spam
abbr _dwc David W. Capella
abbr _bscb Biological Statistics and Computational Biology
abbr _dbscb Department of Biological Statistics and Computational Biology
"
" insert an img tag in an html document
abbr _img <img src="" border="0" width="" height="" alt="[image]" align="top">
"
" insert an html link
abbr _href <a href=""></a>
"
" insert an html title - line broken for readability
abbr _title <title>map ^[l i<li>^[map ^P o<p>^[map ^[p o
<pre>^[map ^[/ F<ylpr/map ^[t O<title>^[map ^E F<yf>f>
mhGo^[pF<ylpr/'h
"
" insert an html table
" the output looks like this:
" <table border="0">
" <tr>
" <td>
" </td>
" </tr>
" </table>
"
" the next line has been split for readability
abbr _table <table border="0">^M<tr>^M<td>^M</td>^M
  </tr>^M</table>^M
"
" insert function template for the PHP language
" output looks like:
"  ///////////////////////////////////////////////////////////////
"  // funcname
"  // purpose:
"  // args   :
"  // returns:
"  // globals:
"  ///////////////////////////////////////////////////////////////
"  function func() {
"  }
"
" next line split for readability
abbr phpfunc ///////////////////////////////////////////////////////////////^M
// funcname^M// purpose: ^M// args   : ^M// returns: ^M// globals: ^M
///////////////////////////////////////////////////////////////^M
function func() {^M}
"
"
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" shell,perl macros
" most of these use two-key combo's having a comma as the first key
"
" attribution line: author,date
" creates a line with the current date/time like:
" # [email protected] - Mon Mar  4 20:25:08 EST 2002
"
map ,a o# [email protected] - ^[:r !date^MkJ
"
" insert shell comment line
" looks like:
" ############################################################
map ,c o^[60i#^[
"
" insert dwc comment line
" looks like:
" # dwc
map ,d O# dwc^[^M
"
" edit .exrc
" load my .exrc. return to original document with ':rew or :N
map ,e :e $HOME/.exrc^M
"
" source .exrc - load recent edits into current session
map ,s :so $HOME/.exrc^M
"
" read in shell script template
map \s 1G:0 r /home/dave/src/skel/skel.sh^M
"
" dupe line, comment original
" handy for editing scripts where you don't want to lose the original line
" changes this:
"
"  this is a test
"
"  to this:
"
"  #this is a test
"  this is a test

map ,n YPi#^[^M
"
" open line above without entering insert mode
map ,O O^[
" open line below without entering insert mode
map ,o o^[
"
" new script (perl) - using current file name
" inserts this at top of file:
"  #/usr/bin/perl
"  # .exrc -
"  #
"  # [email protected] - Mon Mar  4 20:31:28 EST 2002
"  #
"  ############################################################
"  ############################################################
"  # EOF: .exrc

" line broken up for readability
map ,p 1GO#/usr/bin/perl^M# ^[:r!ls %^MkJA - ^M# ^M
# [email protected] - ^[:r !date^MkJo# ^M^[60a#^[Ypo
# EOF: ^[:r!ls %^MkJ1G$
"
" new script (sh)
" insert boilerplate for new shell script using current file name and date/time:
"  #/bin/sh
"  # exrc.php -
"  #
"  # [email protected] - Mon Mar  4 20:34:18 EST 2002
"  #
"  ############################################################
"  ############################################################
"  # EOF: exrc.php

" line broken up for readability
map ,t 1GO#/bin/sh^M# ^[:r!ls %^MkJA - ^M# ^M
# [email protected] - ^[:r !date^MkJo# ^M^[60a
#^[Ypo# EOF: ^[:r!ls %^MkJ1G$
"
" shebang line
map ,1 1Gi#/bin/sh^M# ^[k
"
" copyright line
map ,2  o# copyright (c) 2001,2002   dave w capella    All Rights Reserved^[
"
" warranty - insert warranty boilerplate. looks like this:

"  #
"  # May be freely distributed and used as long as this header is retained.
"  # All modifications must be clearly indicated.
"  #
"  # The author makes no promise of technical support. However, bug reports,
"  # suggestions, questions, and comments are welcome. All will be answered
"  # via electronic mail as time allows.
"  #
"  # NO WARRANTY OF ANY KIND EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
"  #

" line broken up for readability
map ,w  o#^M
# May be freely distributed and used as long as this header is retained.^M
# All modifications must be clearly indicated.^M#^M
# The author makes no promise of technical support. However, bug reports,^M
# suggestions, questions, and comments are welcome. All will be answered^M
# via electronic mail as time allows.^M#^M
# NO WARRANTY OF ANY KIND EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.^M#^[^M
"
" comment out this line. inserts a hash mark in first column.
map ,x I#^[
"
" comment, uncomment out a section (uses marks 'a and 'b)
map ,z :'a,'b s/^/#/^M
map ,y :'a,'b s/#//^M
"
"
" shell function. inserts this:
"
"  funtion () {
"  }

map \f ofuntion ^[mja () {^M}^M^[`ja
"
" shell if;then;fi construct
map \i oif [ ^[mja ] ; then^Mfi^M^[`ja
"
" here document
map \< ocat <<EOF^M^MEOF^M^[kka
"
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" html macros
" most of these combine a dash with a character. they try to be mnemonic
" but there just aren't enough keys.   8-)
"
" comment
map -c o<!-- --------------------  ------------------- -->^M^[k2f a
"
" href
map -a 0y$i<a href="">^[A</a>^[0f"p0f"l
"
" html bold the current line
map -b 0i<b>^[A</b>^[
"
" new html file - line broken for readability
map -h 1GO<!doctype html public "-//w3c//dtd html 3.2//en">^M
<html>^M<head>^M<title>^M</title>^M</head>^M
<body bgcolor="#ffffff">^M^M<h2>page title</h2>^M^M
body text^M^M</body>^M</html>^[
"
" italic current line
map -i 0i<i>^[A</i>^[
"
" font - insert font tag
map -f <font color= size= face=arial,helvetica,sans-serif>^[A</font>^[
"
" img - insert img tag
map -g i<img border=0 src=>^[i
"
" headings - wraps the current line in the tag
map -1 0i<h1>^[$a</h1>^[
map -2 0i<h2>^[$a</h2>^[
map -3 0i<h3>^[$a</h3>^[
map -4 0i<h4>^[$a</h4>^[
map -5 0i<h5>^[$a</h5>^[
map -6 0i<h6>^[$a</h6>^[
"
" html lists
map -o o<ol>^M</ol>^M^[kO <li>
map -u o<ul>^M</ul>^M^[kO <li>
map -dt o<dt>^M</dt>^M^[kO <dd>
map -l 0i<li>^[$a</li>^[
map -n o<li></li>^[F<i
"
" return to exact position, not start of line
" i changed my mind about this. heck, the backtick key already does it.
"map ' `
"
" for email
map ,. o....................<snip>....................^[^M
"
"
" new perl subroutine
" line broken up for readability
abbr newsub ############################################################^M
# name     : ^M# purpose  : ^M# usage    : ^M# arguments: ^M# returns  : ^M
# notes    : ^M
############################################################^M#^Msub  {^M}^M
"
"
" line broken up for readability
map ,- 1GO#!/bin/sh^M# ^[:r !ls %^MkJo# [email protected] - ^[:r !date^M
kJo#^[yl59pYpo# eof: ^[:r !ls %^MkJkO
"
" PHP helpers
" note that these key macros start with the ';' char
"
" wrap file in php template for web
map ;p 1GO<?php^M$title = "";^Minclude "header.php";^M?>^M^[Go^M
<?php include "footer.php"; ?>^[2Gf"
 

Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

vi tricks and tips

There are a few useful environment variables and defaults which you can set to affect vi. Defaults are set in your ~/.exrc file, and environment variables are set in the standard fashion.

The one environment variable of interest is ESCDELAY which you may want to set to a value of about 1500. This variable determines the amount of time between when ESC is pressed and a new command is issued. Since arrow keys form esc sequences, if the sequences are generated too slowly, an arrow key can, instead of moving your cursor, insert some garbage into your file (which often looks like ^[A). Try some values of ESCDELAY to fix this.



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March 12, 2019