" sets spell check to be enabled to files which
" end with either .md or .txt
" 
" To get auto complete type z= when you are
" over the word.
autocmd BufRead,BufNewFile *.md setlocal spell spelllang=en_us
autocmd BufRead,BufNewFile *.txt setlocal spell spelllang=en_us


""" Indentation and Tabs """
"file based indentation
filetype plugin indent on

"copy indentation from current line when making a new line
set autoindent
" Smart indentation when programming: indent after {
set smartindent 

set tabstop=4     " number of spaces per tab
set expandtab     " convert tabs to spaces
set shiftwidth=4  " set a tab press equal to 4 spaces


""" Looks and Appearance"""

" Enable syntax highlighting
syntax enable

" Enable 256 colors palette in Gnome Terminal
if $COLORTERM == 'gnome-terminal'
    set t_Co=256
endif

try
    colorscheme desert
catch
endtry

set background=dark

" Set extra options when running in GUI mode
if has("gui_running")
    set guioptions-=T
    set guioptions-=e
    set t_Co=256
    set guitablabel=%M\ %t
endif


" File Encodings

" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8

" Use Unix as the standard file type
set ffs=unix,dos,mac


" Productivity 

" Set Line Numbers to show
set number

" Highlights the current line with a underscore
set cursorline

" Displays a red bar at 80 characters
set colorcolumn=80

" Shows a auto complete tab when you are typing a command
" like :sp <tab>
set wildmenu

" sets the size of the status bar at bottom to have a height of two
set laststatus=2



"  Searching when in command mode type /words to find
" search as characters are entered
set incsearch
" highlight matched characters
set hlsearch

" Ignore case when searching
set ignorecase



"Disable ding sound on error, flashes cursor instead
set visualbell

" Display ruler on bottom right -- should be there by default
set ruler

" Enables mouse support
set mouse=a

" Auto updates file if an external source edits the file
set autoread

" Improves performance by only redrawing screen when needed
set lazyredraw


" Copy and paste
" Selection
" v and arrows select characters
" V select entire lines
" d on something selected cuts it -- also used for delete
" y = yank = copy
" P paste before cursor
" p paste after cursor



" Basic Vim navigation
" :sp file  -- this will open a new file horizontally
" :vsp file -- will open a file splitting vertically
" ctrl-w w -- this will toggle to another open vim window