Commits

Rob Allen  committed d8c5cb7

Reorganised and updated

  • Participants
  • Parent commits 2a04249

Comments (0)

Files changed (5)

File colors/rka2.vim

+" Vim color file
+"
+" Author: Rob Allen <rob@akrabat.com>
+"
+" Note: Based on Anthony Carapetis <anthony.carapetis@gmail.com>
+"       'github' scheme which is based on github's syntax
+"       highlighting theme
+"       Used Brian Mock's darkspectrum as a starting point/template
+"       Thanks to Ryan Heath for an easy list of some of the colours:
+"       http://rpheath.com/posts/356-github-theme-for-syntax-gem
+
+hi clear
+
+set background=light
+if version > 580
+    " no guarantees for version 5.8 and below, but this makes it stop
+    " complaining
+    hi clear
+    if exists("syntax_on")
+	syntax reset
+    endif
+endif
+let g:colors_name="rka"
+
+hi Normal       guifg=#000000 guibg=#FFFFFF
+
+" {{{ Cursor
+hi Cursor		guibg=#444454 guifg=#F8F8FF
+hi CursorLine   guibg=#EEEEEE
+hi CursorColumn	guibg=#E8E8EE
+" }}}
+
+" {{{ Diff
+hi DiffAdd         guifg=#003300 guibg=#DDFFDD gui=none
+hi DiffChange                    guibg=#ececec gui=none
+hi DiffText        guifg=#000033 guibg=#DDDDFF gui=none
+hi DiffDelete      guifg=#DDCCCC guibg=#FFDDDD gui=none
+" }}}
+
+" {{{ Folding / Line Numbering / Status Lines
+hi Folded		guibg=#ECECEC guifg=#808080 gui=none
+hi vimFold		guibg=#ECECEC guifg=#808080 gui=none
+hi FoldColumn	guibg=#ECECEC guifg=#808080 gui=none
+
+hi LineNr		guifg=#666666 guibg=#F0F0F0 gui=none
+"hi NonText      guifg=#808080 guibg=#ECECEC
+hi NonText		guifg=#808080 guibg=#FFFFFF
+hi Folded		guifg=#808080 guibg=#ECECEC gui=none
+hi FoldeColumn  guifg=#808080 guibg=#ECECEC gui=none
+
+hi VertSplit	guibg=#bbbbbb guifg=#bbbbbb gui=none
+hi StatusLine   guibg=#bbbbbb guifg=#404040 gui=none
+hi StatusLineNC guibg=#d4d4d4 guifg=#404040 gui=italic
+" }}}
+
+" {{{ Misc
+hi ModeMsg		guifg=#990000
+hi MoreMsg		guifg=#990000
+
+hi Title		guifg=#ef5939
+hi WarningMsg	guifg=#ef5939
+hi SpecialKey   guifg=#177F80 gui=italic
+
+hi MatchParen	ctermbg=NONE ctermfg=NONE cterm=underline guibg=NONE guifg=NONE gui=underline
+hi Underlined	guifg=#000000 gui=underline
+hi Directory	guifg=#990000
+" }}}
+
+" {{{ Search, Visual, etc
+hi Visual		guifg=#FFFFFF guibg=#3465a4 gui=none
+hi VisualNOS    guifg=#FFFFFF guibg=#204a87 gui=none
+hi IncSearch	guibg=#cdcdfd guifg=#000000 gui=none
+hi Search		guibg=#cdcdfd guifg=#000000 gui=none
+" }}}
+
+" {{{ Syntax groups
+hi Ignore		guifg=#808080
+hi Identifier	guifg=#000000
+hi PreProc		guifg=#606060 gui=none
+hi Comment		guifg=#3C802C gui=italic
+hi Constant		guifg=#177F80 gui=none
+hi String		guifg=#D81745
+hi Function		guifg=#990000 gui=none
+hi Statement	guifg=#0829AF gui=none
+hi Type			guifg=#445588 gui=none
+hi Number		guifg=#1C9898
+hi Todo			guifg=#FFFFFF guibg=#990000 gui=none
+hi Special		guifg=#159828 gui=none
+hi rubySymbol   guifg=#960B73
+hi Error        guibg=#f8f8ff guifg=#ff1100 gui=undercurl
+hi Todo         guibg=#f8f8ff guifg=#ff1100 gui=underline
+hi Label        guifg=#000000 gui=none
+hi StorageClass guifg=#000000 gui=none
+hi Structure    guifg=#ff0000 gui=none
+hi TypeDef      guifg=#000000 gui=none
+" }}}
+
+" {{{ Completion menus
+hi WildMenu     guifg=#7fbdff guibg=#425c78 gui=none
+
+hi Pmenu        guibg=#808080 guifg=#ffffff gui=bold
+hi PmenuSel     guibg=#cdcdfd guifg=#000000 gui=italic
+hi PmenuSbar    guibg=#000000 guifg=#444444
+hi PmenuThumb   guibg=#aaaaaa guifg=#aaaaaa
+" }}}
+
+" {{{ Spelling
+hi spellBad     guisp=#fcaf3e
+hi spellCap     guisp=#73d216
+hi spellRare    guisp=#fcaf3e
+hi spellLocal   guisp=#729fcf
+" }}}
+
+" {{{ Aliases
+hi link cppSTL          Function
+hi link cppSTLType      Type
+hi link Character		Number
+hi link htmlTag			htmlEndTag
+"hi link htmlTagName     htmlTag
+hi link htmlLink		Underlined
+hi link pythonFunction	Identifier
+hi link Question		Type
+hi link CursorIM		Cursor
+hi link VisualNOS		Visual
+hi link xmlTag			Identifier
+hi link xmlTagName		Identifier
+hi link shDeref			Identifier
+hi link shVariable		Function
+hi link rubySharpBang	Special
+hi link perlSharpBang	Special
+hi link schemeFunc      Statement
+"hi link shSpecialVariables Constant
+"hi link bashSpecialVariables Constant
+" }}}
+
+" {{{ Tabs (non-gui0
+hi TabLine		guifg=#404040 guibg=#dddddd gui=none
+hi TabLineFill	guifg=#404040 guibg=#dddddd gui=none
+hi TabLineSel	guifg=#404040 gui=bold
+" }}}
+
+" {{{ Perl
+hi perlStringStartEnd guifg=#000000
+" }}}
+
+" {{{ RKA extra
+"hi ExtraWhitespace ctermbg=95 guibg=#FFE4FF
+
+" }}}
+
+" vim: sw=4 ts=4 foldmethod=marker

File ftplugin/perl.vim

+" PHP specific settings
+
+
+setlocal eol
+
+" Cliff's tab settings
+set nosmarttab                        " Insert tabs on the start of a line according to tabstop
+set shiftwidth=4                      " Use indents of 4 spaces
+set noexpandtab                       " Tabs are tabs, not spaces
+set tabstop=8                         " Tabs are 8 spaces though
+set softtabstop=4                     " Let backspace delete spaced indent

File ftplugin/php.vim

 " PHP specific settings
 
 setlocal eol
+set smarttab                          " Insert tabs on the start of a line according to shiftwidth, not tabstop
+set shiftwidth=4                      " Use indents of 4 spaces
+set expandtab                         " Tabs are spaces, not tabs
+set tabstop=4                         " An indentation every four columns
+set softtabstop=4                     " Let backspace delete indent
 set vb t_vb=
 set guioptions-=m  "no menu
 set guioptions-=T  "no toolbar
-set guioptions-=l
-set guioptions-=L
-set guioptions-=r  "no scrollbar
-set guioptions-=R
+set guioptions-=l  "no left hand scrollbar
+set guioptions-=L  "no left hand scrollbar when split
+set guioptions+=r  "right hand scrollbar
+set guioptions+=R  "right hand scrollbar when split
 
 
 " MacVim modifications
 if has("gui_macvim")
   " Disable print shortcut for 'goto anything...'
-  macmenu File.Print key=<nop>
+  " macmenu File.Print key=<nop>
 
   " Disable close shortcut so we can use it for :bd
   macmenu File.Close key=<nop>
   " Bind new tab to cmd+alt+shift+n
   macmenu File.New\ Tab key=<D-M-N>
     
-  " Move with cmd+alt
+  " Move with shift+cmd+left/right
   macm Window.Select\ Previous\ Tab  key=<D-M-LEFT>
   macm Window.Select\ Next\ Tab    key=<D-M-RIGHT>
 
   map <D-s> <esc>:w<cr><esc>
 
   " Indent lines with cmd+[ and cmd+]
-  nmap <D-]> >>
-  nmap <D-[> <<
-  vmap <D-[> <gv
-  vmap <D-]> >gv
+  " nmap <D-]> >>
+  " nmap <D-[> <<
+  " vmap <D-[> <gv
+  " vmap <D-]> >gv
 
-  "Open sidebar with cmd+k
-  map <D-k> :NERDTreeTabsToggle<CR>
+  "Open sidebar with shift+cmd+1
+  map <S-D-1> :NERDTreeTabsToggle<CR>
 
   " This mapping makes Ctrl-Tab switch between tabs.
   " Ctrl-Shift-Tab goes the other way.
-set nocompatible                   " Use ViMproved, don't emulate old vi
-let $VIMHOME = split(&rtp, ',')[0] " Find the Vim path
+" See also: http://vim.wikia.com/wiki/Keep_your_vimrc_file_clean
 
+set nocompatible                    " Use ViMproved, don't emulate old vi
+let $VIMHOME = split(&rtp, ',')[0]  " Find the Vim path
+
+" =========================================================================
 " Vundle
-filetype off " Turned back on after loading bundles
+" =========================================================================
+filetype off                        " Turned back on after loading bundles
 set rtp+=$VIMHOME/bundle/vundle
 call vundle#rc()
 
-" Bundles
-Bundle 'gmarik/vundle'
-Bundle 'scrooloose/nerdtree'
-Bundle 'EvanDotPro/vim-zoom'
-Bundle 'EvanDotPro/nerdtree-symlink'
-Bundle 'kien/ctrlp.vim'
-Bundle 'Lokaltog/vim-powerline', 'develop'
-Bundle 'L9', '1.1'
-Bundle 'terryma/vim-multiple-cursors'
-Bundle "myusuf3/numbers.vim"
-
-Bundle 'tpope/vim-fugitive'
-Bundle 'tpope/vim-surround'
-Bundle 'tpope/vim-markdown'
-Bundle 'tpope/vim-repeat'
-
-Bundle 'godlygeek/tabular'
-Bundle 'SirVer/ultisnips'
-
-Bundle 'mattn/webapi-vim'
-Bundle 'mattn/gist-vim'
-Bundle 'mattn/pastebin-vim'
-
-Bundle 'scrooloose/syntastic', '3.0.0'
-Bundle 'joonty/vdebug'
-
-Bundle 'StanAngeloff/php.vim'
-Bundle 'shawncplus/phpcomplete.vim'
-Bundle 'EvanDotPro/php_getset.vim'
-Bundle 'mikehaertl/pdv-standalone'
-Bundle 'tomtom/tcomment_vim'
-
-Bundle 'rizzatti/funcoo.vim'
-Bundle 'rizzatti/dash.vim'
-
-Bundle 'taglist.vim'
-Bundle 'VST'
-Bundle 'grep.vim'
-
-
-Bundle 'Shougo/unite.vim'
-Bundle 'Shougo/vimproc.vim'
-Bundle 'tsukkee/unite-tag'
-
-" General Settings
-
-
-filetype plugin indent on       " Automatically detect file types.
-syntax on                       " syntax highlighting
-set mouse=a                     " automatically enable mouse usage
-set virtualedit=all             " allow for cursor beyond last character
-set history=1000                " Store a ton of history (default is 20)
-set hidden                      " allow buffer switching without saving
-set tm=1000                     " Timeout length of leader
-scriptencoding utf-8
-set encoding=utf-8
-set nobomb                      " Do not set a BOM marker
-
-" Set mapleader to "," (http://stevelosh.com/blog/2010/09/coming-home-to-vim)
-let mapleader = ","
-
-set shortmess+=I                       " Disable splash text
-set t_Co=256                           " Fix colors in the terminal
-silent color rka                       " Vim colorscheme
-set laststatus=2                       " Always show status bar
-set mousemodel=popup                   " Enable context menu
-
-set backspace=indent,eol,start         " Working backspace
-set linespace=0                        " no extra spaces between rows
-set number                             " line numbers on
-set cpoptions+=$                       " cool trick to show what you're replacing
-set showmatch                          " show matching brackets/parenthesis
-set showcmd                            " show multi-key commands as you type
-set incsearch                          " find as you type search
-set hlsearch                           " highlight search terms
-set winminheight=0                     " windows can be 0 line high
-set ignorecase                         " case insensitive search
-set smartcase                          " case sensitive when uc present
-set wildmenu                           " show list instead of just completing
-set wildmode=list:longest,full         " command <Tab> completion, list matches, then longest common part, then all.
-set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pdf,*.phar
-set scrolljump=5                       " lines to scroll when cursor leaves screen
-set scrolloff=3                        " minimum lines to keep above and below cursor
-set list listchars=tab:\ \ ,trail:·    " Display · for trailing whitespace
-
-set autoindent                         " indent at the same level of the previous line
-set shiftwidth=4                       " use indents of 4 spaces
-set expandtab                          " tabs are spaces, not tabs
-set tabstop=4                          " an indentation every four columns
-set softtabstop=4                      " let backspace delete indent
-
-set noerrorbells                       " No beeps
-set visualbell
-set t_vb=
+" Plugins managed by Vundle
+Plugin 'gmarik/vundle'
+Plugin 'kien/ctrlp.vim'
+
+Plugin 'tpope/vim-fugitive'
+Plugin 'tpope/vim-surround'
+Plugin 'tpope/vim-markdown'
+Plugin 'tpope/vim-repeat'
+Plugin 'tpope/vim-unimpaired'
+Plugin 'scrooloose/syntastic'
+Plugin 'SirVer/ultisnips'
+Plugin 'mattn/gist-vim'
+Plugin 'mattn/pastebin-vim'
+Plugin 'tomtom/tcomment_vim'
+Plugin 'terryma/vim-multiple-cursors'
+Plugin 'rizzatti/funcoo.vim'
+Plugin 'rizzatti/dash.vim'
+Plugin 'rking/ag.vim'
+Plugin 'taglist.vim'
+Plugin 'VST'
+Plugin 'grep.vim'
+Plugin 'DetectIndent'
+Plugin 'mikehaertl/pdv-standalone'
+Plugin 'maxbrunsfeld/vim-yankstack'
+
+" PHP syntax highlighting for 5.4, 5.5+
+Plugin 'StanAngeloff/php.vim'
+"Improved PHP omnicompletion
+Plugin 'shawncplus/phpcomplete.vim'
 
-set backupcopy=yes              " Preserve Finder labels on OS X
-set splitright                  " Split vertical windows right to the current windows
-"set splitbelow                  " Split horizontal windows below to the current windows
-set autowrite                   " Automatically save before :next, :make etc.
-set autoread                    " Automatically reread changed files without asking me anything
+" =========================================================================
+" Settings
+" =========================================================================
 
-set synmaxcol=2048              " Number of columns to syntax highlight
+filetype plugin indent on               " Automatically detect file types.
+let mapleader = ","                     " Set mapleader to ","
+
+set autoindent                          " Indent at the same level of the previous line
+set autowrite                           " Automatically save before :next, :make etc.
+set autoread                            " Automatically reread changed files without asking me anything
+set backspace=indent,eol,start          " Sensible backspace
+set backupcopy=yes                      " Preserve Finder labels on OS X
+set complete-=i                         " Don't search the path for autocomplete
+set hidden                              " Buffer switching without saving
+set history=1000                        " Store lots of history
+set hlsearch                            " Highlight search terms
+set hlsearch                            " highlight search terms
+set ignorecase                          " case insensitive search
+set incsearch                           " Find as you type search
+set laststatus=2                        " Always show status bar
+set mouse=a                             " Enable mouse usage
+set mousemodel=popup                    " Enable context menu
+set nrformats-=octal                    " Don't increment octals
+set number                              " Dispaly line numbers
+set ruler                               " Display line and column in status bar
+set scrolloff=1                         " Lines to scroll when cursor leaves screen
+set shiftround                          " Use multiple of shiftwidth when indenting with '<' and '>'
+set shortmess+=I                        " Disable splash text
+set showcmd                             " show multi-key commands as you type
+set showmatch                           " show matching brackets/parenthesis
+set sidescrolloff=5                     " Columns to scroll when cursor leaves screen
+set smartcase                           " Case sensitive when an upper case letter is present
+set synmaxcol=2048                      " Number of columns to syntax highlight
+set timeoutlen=500                      " Timeout for mappings
+set title                               " Change the terminal's title
+set ttimeout                            " Enable time out on :mappings and key codes
+set ttimeoutlen=100                     " Timeout for key codes
+set undolevels=1000                     " Many levels of undo
+set virtualedit=all                     " allow for cursor beyond last character
+set nofoldenable                        " Turn off code folding
+set t_Co=256                            " Colours on a terminal
+
+set wildmenu                            " show list instead of just completing
+set wildmode=list:longest               " <Tab> completion: list matches, then longest common part
+set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pdf,*.phar,*.class,*.pyc,*.bak
+
+" tab settings
+set smarttab                            " Insert tabs on the start of a line according to shiftwidth, not tabstop
+set shiftwidth=4                        " Use indents of 4 spaces
+set expandtab                           " Tabs are spaces, not tabs
+set tabstop=4                           " An indentation every four columns
+set softtabstop=4                       " Let backspace delete indent
+
+set noerrorbells                        " No beeps
+set visualbell                          " No beeps
+set t_vb=
 
-"let g:loaded_matchparen = 1
-"autocmd ColorScheme * highlight MatchParen ctermbg=NONE ctermfg=NONE cterm=underline guibg=NONE guifg=NONE gui=underline
+set splitright                          " Split vertical windows right to the current windows
+set splitbelow                          " Split horizontal windows below to the current windows
+set autowrite                           " Automatically save before :next, :make etc.
+set autoread                            " Automatically reread changed files without asking me anything
 
+" encoding
+set encoding=utf-8
+set nobomb
 
+" List characters: nothing for tab, · for trailing chars
+set list
+set listchars=tab:\ \ ,trail:·,extends:>,precedes:<,nbsp:+
 
-" Directories for swp files
+" Directories for swp & backup files
 set backupdir=~/.vim.backup
 set directory=~/.vim.backup
+set nobackup                            " We're not in the 70s any more
+set noswapfile                          " We're not in the 70s any more
 
 
- " Yank from the cursor to the end of the line, to be consistent with C and D.
-nnoremap Y y$
+if !empty(&viminfo)
+  set viminfo^=!
+endif
+set sessionoptions-=options
 
-" Code folding options
-nmap <leader>f0 :set foldlevel=0<CR>
-nmap <leader>f1 :set foldlevel=1<CR>
-nmap <leader>f2 :set foldlevel=2<CR>
-nmap <leader>f3 :set foldlevel=3<CR>
-nmap <leader>f4 :set foldlevel=4<CR>
-nmap <leader>f5 :set foldlevel=5<CR>
-nmap <leader>f6 :set foldlevel=6<CR>
-nmap <leader>f7 :set foldlevel=7<CR>
-nmap <leader>f8 :set foldlevel=8<CR>
-nmap <leader>f9 :set foldlevel=9<CR>
+" Colour scheme
+silent color rka2
 
-" Easier moving in tabs and windows
-map <C-J> <C-W>j<C-W>_
-map <C-K> <C-W>k<C-W>_
-map <C-L> <C-W>l<C-W>_
-map <C-H> <C-W>h<C-W>_
+" Status line
+function! InsertStatuslineColor(mode)
+  if a:mode == 'i'
+    hi statusline guibg=Cyan ctermfg=6 guifg=Black ctermbg=0
+  elseif a:mode == 'r'
+    hi statusline guibg=Purple ctermfg=5 guifg=Black ctermbg=0
+  else
+    hi statusline guibg=DarkRed ctermfg=1 guifg=Black ctermbg=0
+  endif
+endfunction
 
-" Clearing highlighted search
-nmap <silent> <leader>/ :nohlsearch<CR>
+au InsertEnter * call InsertStatuslineColor(v:insertmode)
+au InsertLeave * hi statusline guibg=DarkGreen ctermfg=8 guifg=White ctermbg=15
 
-" Ctrl-a for select all
-map <C-A> ggVG
+" default the statusline to green when entering Vim
+hi statusline guibg=DarkGreen ctermfg=8 guifg=White ctermbg=15
 
-" For when you forget to sudo.. Really Write the file.
-cmap w!! w !sudo tee % >/dev/null
+" Formats the statusline
+set statusline=%f                           " file name
+set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
+set statusline+=%{&ff}] "file format
+set statusline+=%y      "filetype
+set statusline+=%h      "help file flag
+set statusline+=%m      "modified flag
+set statusline+=%r      "read only flag
 
+" Puts in the current git status
+set statusline+=%{fugitive#statusline()}
 
-" Toggle numbers.vim
-nnoremap <F3> :NumbersToggle<CR>
+" Puts in syntastic warnings
+    " if count(g:pathogen_disabled, 'Syntastic') < 1
+        set statusline+=%#warningmsg#
+        set statusline+=%{SyntasticStatuslineFlag()}
+        set statusline+=%*
+    "endif
 
-" Support buffer switch on tab even if MiniBufExplorer is not used
-if has("gui_running")
-    noremap <C-TAB>   :bnext<CR>
-    noremap <C-S-TAB> :bprev<CR>
-endif
+set statusline+=\ %=                        " align left
+set statusline+=Line:%l/%L[%p%%]            " line X of Y [percent of file]
+set statusline+=\ Col:%c                    " current column
+set statusline+=\ Buf:%n                    " Buffer number
+set statusline+=\ [%b][0x%B]\               " ASCII and byte code under cursor
 
-" pdv-standalone
-nnoremap <C-\>p :call PhpDocSingle()<CR>
-vnoremap <C-\>p :call PhpDocRange()<CR>
-nnoremap <C-K> :call PhpDocSingle()<CR>
-vnoremap <C-K> :call PhpDocRange()<CR>
 
+" =========================================================================
+" Key mappings
+" =========================================================================
+
+set pastetoggle=<F2>
+
+" navigate virtual lines
+nnoremap j gj
+nnoremap k gk
+
+" Easy window navigation
+map <C-h> <C-w>h
+map <C-j> <C-w>j
+map <C-k> <C-w>k
+map <C-l> <C-w>l
+
+" ,o to replace current word and set up so that . will do the same on the next
+" instance of the current word
+nmap <leader>o *Ncgn
+
+" Underline the current line with '='
+nmap <silent> <leader>ul :t.<CR>Vr=
+
+" For when you forget to sudo.. Really Write the file.
+cmap w!! w !sudo tee % >/dev/null
+
+" control-tab to switch buffers
+noremap <C-TAB>   :bnext<CR>
+noremap <C-S-TAB> :bprev<CR>
 
 " clear matches using leader-space
 nmap <leader><space> :noh<cr>
 
-"Shortcut to auto indent entire file
-nmap <S-F2> 1G=G``
-imap <S-F2> <ESC>1G=Ga``
+" Use <C-L> to clear the highlighting of :set hlsearch.
+if maparg('<C-L>', 'n') ==# ''
+  nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
+endif
 
+"Shortcut to auto indent entire file
+nmap <S-C-r> 1G=G``
+imap <S-C-r> <ESC>1G=Ga``
 
 " Remove the Windows ^M - when the encodings gets messed up
 nmap <Leader>M mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
 " Close Quickfix window (,qq)
 map <leader>qq :cclose<CR>
 
-" Indent lines with cmd+[ and cmd+]
-nmap <M-]> >>
-nmap <M-[> <<
-vmap <M-[> <gv
-vmap <M-]> >gv
-" Indent lines with tab and shfit+tab
-nmap <Tab> >>
-nmap <S-Tab> <<
-vmap <Tab> <gv
-vmap <S-Tab> >gv
-
 "Omni complete on ctrl-space
 inoremap <C-Space> <C-x><C-o>
 inoremap <C-@> <C-Space>
 
-" Close the Omni-Completion tip window when leaving insert mode
-augroup close_ocwindow
-    autocmd!
-    autocmd InsertLeave * if pumvisible() == 0|pclose|endif
-augroup END
-
 " Close every buffer
-map <leader>ba :1,1000 bd!<cr>
-
+map <leader>qa :1,1000 bd!<cr>
 
 " Ctrl+h/k for buffer switching
 nnoremap <C-h> :bp<CR>
 nnoremap <C-l> :bn<CR>
 
-" leader-v to reselect text that was pasted in
-nnoremap <leader>v V`]
-
-" puy the caret in a logical place after a visual mode yank
+" put the caret in a logical place after a visual mode yank
 vmap y ygv<Esc>
 
+" Switch between last two buffers
+nnoremap <leader><leader> <C-^>
 
-"dash
-:nmap <silent> <F1> <Plug>DashSearch
-:imap <silent> <F1> <esc><Plug>DashSearch
+"What syntax highight is under the cursor?
+map <F9> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
+\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
+\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
 
 
+" Easier copy/paste
+    map <leader>v "+gP
+    map <leader>c "+y
 
+" Ctrl-a for select all
+map <C-A> ggVG
 
+" Yankstack keys
+call yankstack#setup()
+nmap <leader>p <Plug>yankstack_substitute_older_paste
+nmap <leader>P <Plug>yankstack_substitute_newer_paste
 
-" =========================================================================
-" Plugins
-" =========================================================================
-
-"----------------------------------------------------------------------------
-" Grep
-
-"let g:Grep_Default_Options = "-iHn"
-"\ . " --context=2"
-"\ . " --color"
-"\ . " --exclude='*.svn*'"
-"\ . " --exclude='*.svn*'"
-"\ . " --exclude='*.log*'"
-"\ . " --exclude='*.pdf*'"
-"\ . " --exclude='*tmp*'"
-"\ . " --exclude-dir='**/tmp'"
-"\ . " --exclude-dir='**/var'"
-"\ . " --exclude-dir='**/_var'"
-"\ . " --exclude-dir='CVS'"
-"\ . " --exclude-dir='.svn'"
-"\ . " --exclude-dir='.git'"
-
-let g:Grep_Default_Options = "-iHn"
-
-:let Grep_Skip_Dirs = '.svn .git tmp var _var'
-:let Grep_Skip_Files = '*~ *.pdf *.phar *.log'
-
-
-"----------------------------------------------------------------------------
-" Unite
-let g:unite_source_history_yank_enable = 1
-let g:unite_source_file_mru_limit = 100
-
-let g:unite_source_grep_default_opts = "-iHn"
-\ . " --context=2"
-\ . " --color"
-\ . " --exclude='*.svn*'"
-\ . " --exclude='*.svn*'"
-\ . " --exclude='*.log*'"
-\ . " --exclude='*.pdf*'"
-\ . " --exclude='*tmp*'"
-\ . " --exclude-dir='**/tmp'"
-\ . " --exclude-dir='**/var'"
-\ . " --exclude-dir='**/_var'"
-\ . " --exclude-dir='CVS'"
-\ . " --exclude-dir='.svn'"
-\ . " --exclude-dir='.git' "
-
-call unite#filters#matcher_default#use(['matcher_fuzzy'])
-call unite#filters#sorter_default#use(['sorter_rank'])
-
-nnoremap <leader>r :<C-u>Unite -start-insert file_rec/async:!<CR>
-nmap <silent> <leader>/ :<C-u>Unite -start-insert grep:.<cr>
-vmap <silent> <leader>/ :<C-u>Unite -start-insert grep:.<cr>
-nmap <silent> <leader>. :<C-u>Unite -start-insert grep:.<cr>
-vmap <silent> <leader>. :<C-u>Unite -start-insert grep:.<cr>
-
-nnoremap <leader>y :<C-u>Unite -buffer-name=yank    history/yank<cr>
-
-" Custom mappings for the unite buffer
-"autocmd FileType unite call s:unite_settings()
-"function! s:unite_settings()
-"  " Play nice with supertab
-"  let b:SuperTabDisabled=1
-"endfunction
-
-autocmd FileType unite call s:unite_my_settings()
-function! s:unite_my_settings()"{{{
-  " Overwrite settings.
-
-  nmap <buffer> <ESC>      <Plug>(unite_exit)
-  imap <buffer> jj      <Plug>(unite_insert_leave)
- endfunction"}}}
-
-
+" map Y to work like D and C
+nmap Y y$
 
-"----------------------------------------------------------------------------
-" CtrlP
+" CtrlP keys
 nmap <leader>m :CtrlP<cr>
 nmap <leader>l :CtrlPBuffer<cr>
 nmap <leader>bl :CtrlPBuffer<cr>
 
+" TagList keys
+nnoremap <silent> <F8> :TlistToggle<CR>
+nnoremap <silent> <D-r> :TlistToggle<CR>
+nnoremap <silent> <leader>r :TlistToggle<CR>
 
-"----------------------------------------------------------------------------
-" NerdTree
-map <C-e> :NERDTreeToggle<CR>
-map <leader>e :NERDTreeFind<CR>
-nmap <leader>nt :NERDTreeFind<CR>
 
-let NERDTreeShowBookmarks=1
-let NERDTreeChDirMode=0
-let NERDTreeQuitOnOpen=1
-let NERDTreeShowHidden=1
-let NERDTreeKeepTreeInNewTab=1
-let NERDTreeMinimalUI=1
+" =========================================================================
+" Plugin configuration
+" =========================================================================
 
+" Close the Omni-Completion tip window when leaving insert mode
+augroup close_ocwindow
+    autocmd!
+    autocmd InsertLeave * if pumvisible() == 0|pclose|endif
+augroup END
+
+" Grep
+let g:Grep_Default_Options = "-iHnR"
+let Grep_Skip_Dirs = '.svn .git tmp var _var'
+let Grep_Skip_Files = '*~ *.pdf *.phar *.log'
 
-"----------------------------------------------------------------------------
 " vim-gist
 let g:gist_show_privates = 0
 
+"pastebin
+let g:pastebin_api_dev_key="4d2e29b03694cb5905be55418acf17d5"
+let g:pastebin_api_user_name="akrabat"
+let g:pastebin_api_user_password="3JuFvmRBf8sa62HWxh4w"
+let g:pastebin_expire_date="N"
+let g:pastebin_private="1"
+
+" netrw
+let g:netrw_liststyle=3
 
-"----------------------------------------------------------------------------
 " pdv-standalone
 " use "" as parameter to turn tag off
 let g:pdv_cfg_php4guess=0
 "let g:pdv_cfg_Copyright=""
 "let g:pdv_cfg_License=""
 
-"----------------------------------------------------------------------------
-" TagList
-nnoremap <silent> <F8> :TlistToggle<CR>
-
 " set the names of flags
 let tlist_php_settings = 'php;c:class;f:function;d:constant'
 " close all folds except for current file
 " one file at a time
 let Tlist_Show_One_File = 1
 
-"----------------------------------------------------------------------------
-"pastebin
-let g:pastebin_api_dev_key="4d2e29b03694cb5905be55418acf17d5"
-let g:pastebin_api_user_name="akrabat"
-let g:pastebin_api_user_password="3JuFvmRBf8sa62HWxh4w"
-let g:pastebin_expire_date="N"
-let g:pastebin_private="1"
 
-"----------------------------------------------------------------------------
 " Syntastic
 " On check for php syntax errors. default is ['php' , 'phpcs', 'phpmd']
-let g:syntastic_php_checkers=['php']
+let g:syntastic_php_checkers=['php', 'phpcs']
 let g:syntastic_html_tidy_ignore_errors=['<link> escaping malformed URI reference']
-
-
-"----------------------------------------------------------------------------
+let g:syntastic_php_phpcs_args='--standard=PSR2 -n'
 
 
 
 " Functions
 " =========================================================================
 
+" http://nvie.com/posts/how-i-boosted-my-vim/
+fun! s:ToggleMouse()
+    if !exists("s:old_mouse")
+        let s:old_mouse = "a"
+    endif
+
+    if &mouse == ""
+        let &mouse = s:old_mouse
+        echo "Mouse is for Vim (" . &mouse . ")"
+    else
+        let s:old_mouse = &mouse
+        let &mouse=""
+        echo "Mouse is for terminal"
+    endif
+endfunction
+
 " Source: http://vim.wikia.com/wiki/VimTip165
 " Cleanly deletes a buffer without messing up the window layout.
 " Modified by Evan Coury to prompt for unsaved changes.
-function s:Kwbd(kwbdStage)
+function! s:Kwbd(kwbdStage)
   if(a:kwbdStage == 1)
     if(!buflisted(winbufnr(0)))
       bd!
 noremap <silent> <c-s-up> :call <SID>swap_up()<CR>
 noremap <silent> <c-s-down> :call <SID>swap_down()<CR>
 
+"----------------------------------------------------------------------------
+" Append modeline after last line in buffer.
+" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX
+" files.
+function! AppendModeline()
+  let l:modeline = printf(" vim: set tabstop=%d softtabstop=%d shiftwidth=%d %sexpandtab :",
+        \ &tabstop, &softtabstop, &shiftwidth, &expandtab ? '' : 'no')
+  let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
+  call append(line("$"), '')
+  call append(line("$"), l:modeline)
+endfunction
+nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
+
+function! AppendCliffModeline()
+  let l:modeline = " vim: set tabstop=8 softtabstop=4 shiftwidth=4 noexpandtab :"
+  let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
+  call append(line("$"), '')
+  call append(line("$"), l:modeline)
+endfunction
+nnoremap <silent> <Leader>cml :call AppendCliffModeline()<CR>
+
 
 "----------------------------------------------------------------------------
 " Highlight matches to the current word without moving
 endfunction
 vnoremap <silent> <F7> :<C-U>let @/="<C-R>=MakePattern(@*)<CR>"<CR>:set hls<CR>
 
+"----------------------------------------------------------------------------
 " Strip trailing whitespace (,sw)
 function! StripWhitespace ()
     let save_cursor = getpos(".")
 endfunction
 noremap <leader>sw :call StripWhitespace ()<CR>
 
-
-
 " =========================================================================
-" auto
+" Auto
 " =========================================================================
 
+" Remove trailing whitespaces and ^M chars
+" autocmd FileType c,cpp,java,php,javascript,python,twig,xml,yml,phtml,vimrc autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
 
 
 " re-source .vimrc on save so changes are effective immediately
 
 
 " =========================================================================
-" File types
+" File type specifics
 " =========================================================================
 " .inc, phpt, phps files as PHP
 augroup php_filetypes
 
 au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
 
+
+
+
+