vim -u filename
# Turn compatibility mode off via set command
:set nocompatible
# view special characters in a vim session
:set list
:set nolist # disable
# set search result hilighting
:set hlsearch
# use different visible characters to see special characters in vim
:set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:< :set list # view line numbers
:set nu
:set nonu # disable
# enable linewrap (on by default)
:set wrap
:set nowrap #disable
# indenting source code (setup)
:set et # expand tabs to spaces
:set sw=4
:set smarttab
# Manually choose the language for syntax highlighting
:setf language:setf html # example
# The available languages for syntax highlighting
# can be found in the vim install directory.
# In my system, it was /usr/share/vim/vim72/syntax# indenting source code (usage)
1) in command mode press v to and arrows to select a range of lines
2) after selecting, press ==
http://vim.wikia.com/wiki/Indenting_source_code
# indent multiple lines (not necessarily source code)
1) in command mode press v and arrows to select a range of lines
2) type shift >
shift < will shift a block back
# compatibility mode
# by default, vim will enter into compatibility mode when loading.
# Disable this behavior one of two ways
# 1) Create a .vimrc in your home directory
# 2) Within the vim command line, type :set nocompatible
# trim whitespace at end of line
:1,$s/[ <tab>]*$//
# get vim to return the previous position when editing files
" Tell vim to remember certain things when we exit " '10 : marks will be remembered for up to 10 previously edited files " "100 : will save up to 100 lines for each register " :20 : up to 20 lines of command-line history will be remembered " % : saves and restores the buffer list " n... : where to save the viminfo files set viminfo='10,\"100,:20,%,n~/.viminfo " when we reload, tell vim to restore the cursor to the saved position augroup JumpCursorOnEdit au! autocmd BufReadPost * \ if expand(":p:h") !=? $TEMP | \ if line("'\"") > 1 && line("'\"") <= line("$") | \ let JumpCursorOnEdit_foo = line("'\"") | \ let b:doopenfold = 1 | \ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) | \ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 | \ let b:doopenfold = 2 | \ endif | \ exe JumpCursorOnEdit_foo | \ endif | \ endif " Need to postpone using "zv" until after reading the modelines. autocmd BufWinEnter * \ if exists("b:doopenfold") | \ exe "normal zv" | \ if(b:doopenfold > 1) | \ exe "+".1 | \ endif | \ unlet b:doopenfold | \ endif augroup END
http://vim.wikia.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session
http://ubuntuforums.org/showthread.php?t=789327
http://www.oualline.com/vim-cook.html
http://stackoverflow.com/questions/1675688/make-vim-show-all-white-spaces-as-a-character
http://jamesreubenknowles.com/set-vim-syntax-language-270