text editing in ubuntu

Michael M. Moore michael at writemoore.net
Wed Aug 5 00:58:51 UTC 2009


On Wed, 2009-08-05 at 09:57 +1000, Brian Clarkson wrote:
> "A simple, sane ~/.vimrc that starts vim in insertmode, and has
> shortcut keys
> for saving/quiting:"
> 
> I am a relative newbie and I don't really understand what the line
> quoted above means.
> 
> Is "sane ~/.vimrc" a file in which all the code is to be saved?  OR 
> Is "sane" a command that acts on a file named "~/.vimrc" (where I
> presume "~" means Home directory) in which the code has been saved?
> OR
> Am I way off understanding what I need to do?  I suspect the latter!
> 
> Your further help would be appreciated.

Many programs have what is called an "rc" file that controls how the
program behaves.  I believe (though am not certain) that "rc" stands for
"resource configuration."

In *nix environments (like Linux and BSD operating systems), these files
are often referred to as "dot files."  The are so-called because the
files most everyone is most familiar with usually are preceded with a
dot (".").

If you launch a terminal and type:
	
$ ls -a

you will see many dot files, like:

.bash_history
.bash_logout
.bashrc

Bingo!  ~/.bashrc!  That's an rc file.  It controls various settings for
how bash works for your user.  If you want to change some of your bash
settings, you can edit that file (but don't do it if you don't know what
you're doing).  If you have a second user account on your system, that
second user can edit his ~/.bashrc and whatever changes he makes won't
affect bash settings in your account.  Each user on your computer who
uses bash will have his own ~/.bashrc.  Each user can fiddle with his
own bash settings to his heart's content without mucking up anyone
else's bash settings.

In Linux (actually, I guess in any multi-user operating system), it can
be useful to create a second user account you can use for testing
changes you might want to make to the way your system, or various
programs, work.  If you mess up horribly, no biggie -- just delete the
account and start over.  You still have your main user account, which
will be unaffected by whatever changes you made in your alternate
account.

Vim also has an rc file.  In Ubuntu, by default, if you install vim,
then a system-wide rc file for vim will magically appear
at /etc/vim/vimrc.  If you want to customize your vim settings, you can
copy that file to ~/.vimrc and start editing it.  Alternatively, you can
create one from scratch, saving it as ~/.vimrc.  (And yes, "~/" is a
shortcut for your user's home directory.)

A really useful website where people share their configurations for all
kinds of programs is http://dotfiles.org -- except that I don't seem to
able to connect to it at the moment.  There's also http://dotfiles.com/

-- 
Michael M.






More information about the ubuntu-users mailing list