Skip to content

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
I put together this .vimrc for computer science students at University of Missouri - Columbia because at MU the .vimrc file that we have by default leaves much to be desired. I hope that in providing this .vimrc to my peers that they see just how useful Vim can be. It aims to be as minimalistic and unintrusive as possible. It is intentionally sm…
Download the gist containing starter.vimrc.
Once you have that done, you will need to use an SFTP client of your choice
to move starter.vimrc to your home directory. FileZilla is an option if you
don't have one already.
You will just need the client.
Once you have your SFTP software installed and set up transfer starter.vimrc to your home folder.
You will then need to run the following command to overwrite your current .vimrc and delete the
temporary file. You should be able to copy and paste for simplicity.
mv starter.vimrc .vimrc
**warning the above command overwrites your .vimrc.
The fact that it overwrites your default .vimrc is irrelevant to most people who this file was
created for and you should know if overwriting your current .vimrc will cause a problem for you.**
After you run that command your .vimrc will have the contents of starter.vimrc
**What you've actually done is renamed the starter.vimrc file to .vimrc
which overwrote the old .vimrc file. **
if you run an ls command you will see that starter.vimrc is no longer in your home folder!
That's it! One important note, if you check your .vimrc file you
will see a link for the vim template plugin. It is highly advised that you install this vim
plugin and uncomment the line that I have commented out:
set runtimepath+=$HOME/.vim/template
This enables the use of templates which will maximize the usefulness of the
LastModified function if you include a line with "Last Modified" in the first 20 lines of your template.
I keep mine at the top so any descriptions I add won't push it past the twenty line mark.
If you have any questions please feel free to reach out to me.
" Last Modified: Wed Jan 08, 2014 03:56AM
" Maintainer:
" Tyler Nivin
" Version:
" 1.x - lots of changes from the r/vim thread.
" 1.4 - add mouse toggle function.
" 1.3 - add H and L maps.
" 1.2 - added LastModified function and toggle mouse function.
" 1.1 - added runtime path for template plugin.
" 1.0 - based on
" For a great place to learn VimScript check out this site:
" Also, try :vimtutor or :help <command> for the built-in documentation. No
" .vimrc will be a good replacement for learning to use vim correctly.
" Various settings
" allow vim to use template plugin --Check this out if you don't have it. Very useful. ***
"set runtimepath+=$HOME/.vim/template
"Let vim detect what filetype is being used and turn on plugin and indent
"files. :help vimrc-filetype for more info.
filetype plugin indent on
"Switch the mapleader to , because many people find this easier to reach and
"use then the default \. Look around online to find the inevitable debate and
"decide for yourself what you want to use. One of the main advantages is the
"the shortcuts we map later - <leader>m and <leader>n and easier to hit if
"your leader is ",".
let mapleader = ","
"Set mouse support enabled by default
set mouse=a
"show line numbers by default :help number for more info
set number
"Copy indent from current line when starting a new line :help ai for more info
set autoindent
"By default Vim waits for you to hit enter when doing a search. This setting
"makes the search incremental, searching as you type. :help incsearch for more
set incsearch
"This highlights the results of your previous search for you. :help hlsearch
"for more info.
set hlsearch
" Functions
" If buffer modified, update any 'Last modified: ' in the first 20 lines.
" Restores cursor and window position using save_cursor variable.
function! LastModified()
if &modified
let save_cursor = getpos(".")
let n = min([20, line("$")])
keepjumps exe '1,' . n . 's#^\(.\{,10}Last Modified: \).*#\1' .
\ strftime('%a %b %d, %Y %I:%M%p') . '#e'
call histdel('search', -1)
call setpos('.', save_cursor)
autocmd BufWritePre * call LastModified()
"Did you know - OS X (mac): hold alt/option while selecting to make the cursor
"behave as if it were disabled!? source:
" I find that using a toggle allows the best of both worlds when it comes to
" mouse usage. If you are on a mac, you will need a terminal that allows
" mouse usage. I personally use iterm2, however explore your options.
"enable mouse toggle - quick and dirty, probably better ways to do it.
function! ToggleMouse()
if &mouse == 'a'
set mouse-=a
echo "Mouse disabled."
set mouse=a
echo "Mouse enabled."
noremap <leader>m :call ToggleMouse()<cr>
"enable a toggle for showing line numbers
nnoremap <leader>n :setlocal number!<cr>
" Movement tweaks
" Treat longlines as two seperate lines -- First two lines are for j and k
" movement and last two are for arrow key movement.
"nnoremap j gj
"nnoremap k gk
" --Others suggested to not change default j and k behavior for
"beginners. Try reenabling these and experiment with how it changes things.
"Comment them out again if you don't like the way it changes vims movement. --
nnoremap <down> gj
nnoremap <up> gk
" remap jj to escape in insert mode.
inoremap jj <Esc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.