evilroot avatar evilroot committed 9cd34c2

some changes

Comments (0)

Files changed (12)

 let g:netrw_dirhistmax  =10
-let g:netrw_dirhist_cnt =6
+let g:netrw_dirhist_cnt =7
 let g:netrw_dirhist_1='/home/czeryna/Code/python/django_projects/bugtracker/templates'
 let g:netrw_dirhist_2='/home/czeryna/.vim'
 let g:netrw_dirhist_3='/home/czeryna/.vim/ftplugin/python/pyflakes'
 let g:netrw_dirhist_4='/home/czeryna/.zsh'
 let g:netrw_dirhist_5='/home/czeryna/rtorrent'
 let g:netrw_dirhist_6='/home/czeryna/robota/Zrobione/cukiernia'
+let g:netrw_dirhist_7='/home/czeryna/.zsh'

.vim/autoload/ctrlp.vim

 	cal add(s:prtmaps['PrtBS()'], remove(s:prtmaps['PrtCurLeft()'], 0))
 en
 
-let s:lash = ctrlp#utils#lash()
-
 let s:compare_lim = 3000
 
 let s:ficounts = {}
 	let s:mxheight = max([s:mxheight, 1])
 	let s:glob = s:showhidden ? '.*\|*' : '*'
 	let s:igntype = empty(s:usrign) ? -1 : type(s:usrign)
+	let s:lash = ctrlp#utils#lash()
 	if s:keyloop
 		let [s:lazy, s:glbs['imd']] = [0, 0]
 	en
 endf
 
 fu! ctrlp#clra()
-	let cache_dir = ctrlp#utils#cachedir()
-	if isdirectory(cache_dir)
-		let cache_files = split(s:glbpath(cache_dir, '**', 1), "\n")
+	let cadir = ctrlp#utils#cachedir()
+	if isdirectory(cadir)
+		let cafiles = split(s:glbpath(s:fnesc(cadir, 'g', ','), '**', 1), "\n")
 		let eval = '!isdirectory(v:val) && fnamemodify(v:val, ":t") !~'
 			\ . ' ''\v^<cache>[.a-z]+$|\.log$'''
-		sil! cal map(filter(cache_files, eval), 'delete(v:val)')
+		sil! cal map(filter(cafiles, eval), 'delete(v:val)')
 	en
 	cal ctrlp#clr()
 endf
 		let [lscmd, s:initcwd, g:ctrlp_allfiles] = [s:lsCmd(), s:dyncwd, []]
 		" Get the list of files
 		if empty(lscmd)
-			cal s:GlobPath(s:dyncwd, 0)
+			cal s:GlobPath(s:fnesc(s:dyncwd, 'g', ','), 0)
 		el
 			sil! cal ctrlp#progress('Indexing...')
 			try | cal s:UserCmd(lscmd)
 	cal extend(g:ctrlp_allfiles, dnf[1])
 	if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth
 		sil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1)
-		cal s:GlobPath(join(dnf[0], ','), depth)
+		cal s:GlobPath(join(map(dnf[0], 's:fnesc(v:val, "g", ",")'), ','), depth)
 	en
 endf
 
 		if s:findroot(s:dyncwd, cmd[0], 0, 1) == []
 			retu len(cmd) == 3 ? cmd[2] : ''
 		en
-		let s:vcscmd = s:lash == '\' ? 1 : 0
+		let s:vcscmd = s:lash == '\'
 		retu cmd[1]
 	elsei type(cmd) == 4 && ( has_key(cmd, 'types') || has_key(cmd, 'fallback') )
 		let fndroot = []
 		for pair in cmdtypes
 			if pair[0] == fndroot[0] | brea | en
 		endfo
-		let s:vcscmd = s:lash == '\' ? 1 : 0
+		let s:vcscmd = s:lash == '\'
 		retu pair[1]
 	en
 endf
 
 fu! s:ToggleKeyLoop()
 	let s:keyloop = !s:keyloop
+	if exists('+imd')
+		let &imd = !s:keyloop
+	en
 	if s:keyloop
 		let [&ut, s:lazy] = [0, 0]
 		cal s:KeyLoop()
 		if conds[nopt]
 			if !buflisted(bufnr) | cal s:openfile('bad', va, '', 0) | en
 		el
-			cal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1 ? 1 : 0)
+			cal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1)
 			if jf | if ic == 1
 				let crpos = [tabpagenr(), winnr()]
 			el
 " *** Paths {{{2
 " Line formatting {{{3
 fu! s:formatline(str)
-	let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(a:str)
-	retu '> '.( cond ? s:pathshorten(a:str) : a:str )
+	let str = a:str
+	if s:itemtype == 1
+		let bfnr = bufnr('^'.fnamemodify(str, ':p').'$')
+		let idc = ( bfnr == bufnr('#') ? '#' : '' )
+			\ . ( getbufvar(bfnr, '&ma') ? '' : '-' )
+			\ . ( getbufvar(bfnr, '&ro') ? '=' : '' )
+			\ . ( getbufvar(bfnr, '&mod') ? '+' : '' )
+		let str .= idc != '' ? ' '.idc : ''
+	en
+	let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(str)
+	retu '> '.( cond ? s:pathshorten(str) : str )
 endf
 
 fu! s:pathshorten(str)
 fu! s:dircompl(be, sd)
 	if a:sd == '' | retu [] | en
 	let [be, sd] = a:be == '' ? [s:dyncwd, a:sd] : [a:be, a:be.s:lash(a:be).a:sd]
-	let dirs = ctrlp#rmbasedir(split(globpath(be, a:sd.'*/'), "\n"))
+	let dirs = ctrlp#rmbasedir(split(globpath(s:fnesc(be, 'g', ','), a:sd.'*/'), "\n"))
 	cal filter(dirs, '!match(v:val, escape(sd, ''~$.\''))'
 		\ . ' && v:val !~ ''\v(^|[\/])\.{1,2}[\/]$''')
 	retu dirs
 fu! s:findroot(curr, mark, depth, type)
 	let [depth, fnd] = [a:depth + 1, 0]
 	if type(a:mark) == 1
-		let fnd = s:glbpath(a:curr, a:mark, 1) != ''
+		let fnd = s:glbpath(s:fnesc(a:curr, 'g', ','), a:mark, 1) != ''
 	elsei type(a:mark) == 3
 		for markr in a:mark
-			if s:glbpath(a:curr, markr, 1) != '' | let fnd = 1 | brea | en
+			if s:glbpath(s:fnesc(a:curr, 'g', ','), markr, 1) != ''
+				let fnd = 1
+				brea
+			en
 		endfo
 	en
 	if fnd
 
 fu! ctrlp#setdir(path, ...)
 	let cmd = a:0 ? a:1 : 'lc!'
-	sil! exe cmd ctrlp#fnesc(a:path)
+	sil! exe cmd s:fnesc(a:path, 'c')
 	let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
 endf
 " Fallbacks {{{3
 fu! s:glbpath(...)
-	let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
-	retu call('globpath', cond ? a:000 : a:000[:1])
+	retu call('ctrlp#utils#globpath', a:000)
 endf
 
-fu! ctrlp#fnesc(path)
-	retu exists('*fnameescape') ? fnameescape(a:path) : escape(a:path, " %#*?|<\"\n")
+fu! s:fnesc(...)
+	retu call('ctrlp#utils#fnesc', a:000)
 endf
 
 fu! ctrlp#setlcdir()
 endf
 
 fu! s:migemo(str)
-	let str = a:str
-	let dict = s:glbpath(&rtp, printf("dict/%s/migemo-dict", &enc), 1)
+	let [str, rtp] = [a:str, s:fnesc(&rtp, 'g')]
+	let dict = s:glbpath(rtp, printf("dict/%s/migemo-dict", &enc), 1)
 	if !len(dict)
-		let dict = s:glbpath(&rtp, "dict/migemo-dict", 1)
+		let dict = s:glbpath(rtp, "dict/migemo-dict", 1)
 	en
 	if len(dict)
 		let [tokens, str, cmd] = [split(str, '\s'), '', 'cmigemo -v -w %s -d %s']
 endf
 
 fu! s:maxf(len)
-	retu s:maxfiles && a:len > s:maxfiles ? 1 : 0
+	retu s:maxfiles && a:len > s:maxfiles
 endf
 
 fu! s:regexfilter(str)
 	en
 	let cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd
 	let j2l = a:0 && a:1[0] ? a:1[1] : 0
-	exe cmd.( a:0 && a:1[0] ? '' : a:tail ) ctrlp#fnesc(a:fid)
+	exe cmd.( a:0 && a:1[0] ? '' : a:tail ) s:fnesc(a:fid, 'f')
 	if j2l
 		cal ctrlp#j2l(j2l)
 	en
 	retu !empty(s:lines) ? s:lines[line('.') - 1] : ''
 endf
 
+fu! ctrlp#getmarkedlist()
+	retu exists('s:marked') ? values(s:marked) : []
+endf
+
 fu! ctrlp#exit()
 	cal s:PrtExit()
 endf

.vim/autoload/ctrlp/dir.vim

 	let nr = len(g:ctrlp_alldirs)
 	if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth
 		sil! cal ctrlp#progress(nr)
+		cal map(dirs, 'ctrlp#utils#fnesc(v:val, "g", ",")')
 		cal s:globdirs(join(dirs, ','), depth)
 	en
 endf
 
 fu! s:max(len, max)
-	retu a:max && a:len > a:max ? 1 : 0
+	retu a:max && a:len > a:max
 endf
 
 fu! s:nocache()
 	let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
 	if g:ctrlp_newdir || s:nocache() || !filereadable(cafile)
 		let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
-		cal s:globdirs(s:cwd, 0)
+		cal s:globdirs(ctrlp#utils#fnesc(s:cwd, 'g', ','), 0)
 		cal ctrlp#rmbasedir(g:ctrlp_alldirs)
 		if len(g:ctrlp_alldirs) <= s:compare_lim
 			cal sort(g:ctrlp_alldirs, 'ctrlp#complen')

.vim/autoload/ctrlp/rtscript.vim

 let s:filecounts = {}
 " Utilities {{{1
 fu! s:nocache()
-	retu !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
+	retu g:ctrlp_newrts ||
+		\ !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
 endf
 " Public {{{1
 fu! ctrlp#rtscript#init(caching)
 	let [s:caching, s:cwd] = [a:caching, getcwd()]
-	if g:ctrlp_newrts || s:nocache()
-		\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
+	if s:nocache() ||
+		\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
 		sil! cal ctrlp#progress('Indexing...')
-		let entries = split(globpath(&rtp, '**/*.*'), "\n")
+		let entries = split(globpath(ctrlp#utils#fnesc(&rtp, 'g'), '**/*.*'), "\n")
 		cal filter(entries, 'count(entries, v:val) == 1')
 		let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]
 	el
 		let [entries, results] = g:ctrlp_rtscache[2:3]
 	en
-	if g:ctrlp_newrts || s:nocache()
-		\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
-		if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en
+	if s:nocache() ||
+		\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
+		if !exists('echoed')
+			sil! cal ctrlp#progress('Processing...')
+		en
 		let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
 	en
 	let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0]

.vim/autoload/ctrlp/utils.vim

 fu! ctrlp#utils#lash()
 	retu &ssl || !exists('+ssl') ? '/' : '\'
 endf
-let s:lash = ctrlp#utils#lash()
 
 fu! s:lash(...)
 	retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
 endf
 
 fu! ctrlp#utils#opts()
+	let s:lash = ctrlp#utils#lash()
 	let usrhome = $HOME.s:lash($HOME)
 	let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'
-	let s:cache_dir = isdirectory(usrhome.'.ctrlp_cache')
+	let cadir = isdirectory(usrhome.'.ctrlp_cache')
 		\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
 	if exists('g:ctrlp_cache_dir')
-		let s:cache_dir = expand(g:ctrlp_cache_dir, 1)
-		if isdirectory(s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache')
-			let s:cache_dir = s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache'
+		let cadir = expand(g:ctrlp_cache_dir, 1)
+		if isdirectory(cadir.s:lash(cadir).'.ctrlp_cache')
+			let cadir = cadir.s:lash(cadir).'.ctrlp_cache'
 		en
 	en
+	let s:cache_dir = cadir
 endf
 cal ctrlp#utils#opts()
+
+let s:wig_cond = v:version > 702 || ( v:version == 702 && has('patch051') )
 " Files and Directories {{{1
 fu! ctrlp#utils#cachedir()
 	retu s:cache_dir
 endf
 
 fu! ctrlp#utils#glob(...)
-	let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
-	retu call('glob', cond ? a:000 : [a:1])
+	let path = ctrlp#utils#fnesc(a:1, 'g')
+	retu s:wig_cond ? glob(path, a:2) : glob(path)
+endf
+
+fu! ctrlp#utils#globpath(...)
+	retu call('globpath', s:wig_cond ? a:000 : a:000[:1])
+endf
+
+fu! ctrlp#utils#fnesc(path, type, ...)
+	if exists('*fnameescape')
+		if exists('+ssl')
+			if a:type == 'c'
+				let path = escape(a:path, '%#')
+			elsei a:type == 'f'
+				let path = fnameescape(a:path)
+			elsei a:type == 'g'
+				let path = escape(a:path, '?*')
+			en
+			let path = substitute(path, '[', '[[]', 'g')
+		el
+			let path = fnameescape(a:path)
+		en
+	el
+		if exists('+ssl')
+			if a:type == 'c'
+				let path = escape(a:path, '%#')
+			elsei a:type == 'f'
+				let path = escape(a:path, " \t\n%#*?|<\"")
+			elsei a:type == 'g'
+				let path = escape(a:path, '?*')
+			en
+			let path = substitute(path, '[', '[[]', 'g')
+		el
+			let path = escape(a:path, " \t\n*?[{`$\\%#'\"|!<")
+		en
+	en
+	retu a:0 ? escape(path, a:1) : path
+endf
+
+fu! ctrlp#utils#dircompl(...)
+	let [hsl, str] = [match(a:1, '[\/]'), '']
+	let par = substitute(a:1, '[^\/]*$', '', '')
+	let path = !hsl ? par : hsl > 0 ? getcwd().s:lash().par : getcwd()
+	for dir in split(globpath(ctrlp#utils#fnesc(path, 'g', ','), '*/'), '\n')
+		let str .= par.split(dir, '[\/]')[-1]."\n"
+	endfo
+	retu str
 endf
 "}}}
 

.vim/doc/ctrlp.txt

 
 Statuslines:~
   * Highlight groups:
-    CtrlPMode1 : 'prt' or 'win', also for 'regex' (Character)
-    CtrlPMode2 : 'file' or 'path', also for the local working dir (|hl-LineNr|)
+    CtrlPMode1 : 'file' or 'path', and the current mode (Character)
+    CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|)
     CtrlPStats : the scanning status (Function)
 
   For rebuilding the statuslines, see |g:ctrlp_status_func|.
     * Seth Fowler <github.com/sfowler>
     * Lowe Thiderman <github.com/thiderman>
     * Christopher Fredén <github.com/icetan>
+    * Zahary Karadjov <github.com/zah>
 
 ===============================================================================
 CHANGELOG                                                     *ctrlp-changelog*

.vim/doc/indent-object.txt

+*indent-object.txt*         Text objects based on indent levels.
+
+           Copyright (c) 2010 Michael Smith
+
+Indent Text Objects
+
+INTRODUCTION                      |idntobj-introduction|
+TEXT OBJECTS                      |idntobj-objects|
+BLANK LINES                       |idntobj-blanklines|
+ABOUT                             |idntobj-about|
+
+
+==============================================================================
+INTRODUCTION                                            *idntobj-introduction*
+
+Vim text objects provide a convenient way to select and operate on various
+types of objects. These objects include regions surrounded by various types of
+brackets and various parts of language (ie sentences, paragraphs, etc).
+
+This plugin defines a new text object, based on indentation levels. This is
+very useful in languages such as Python, in which the syntax defines scope in
+terms of indentation. Using the objects defined in this plugin, an entire if
+structure can be quickly selected, for example.
+
+
+==============================================================================
+TEXT OBJECTS                          *ai* *ii* *aI* *iI*     *idntobj-objects*
+
+This plugin defines two new text objects. These are very similar - they differ
+only in whether they include the line below the block or not.
+
+        Key Mapping       Description     ~
+>
+        <count>ai         (A)n (I)ndentation level and line above.
+        <count>ii         (I)nner (I)ndentation level (no line above).
+        <count>aI         (A)n (I)ndentation level and lines above/below.
+        <count>iI         (I)nner (I)ndentation level (no lines above/below).
+<
+
+Note that the iI mapping is mostly included simply for completeness, it is
+effectively a synonym for ii.
+
+Just like regular text objects, these mappings can be used either with
+operators expecting a motion, such as 'd' or 'c', as well as in visual mode.
+In visual mode the mapping can be repeated, which has the effect of
+iteratively increasing the scope of indentation block selected. Specifying a
+count can be used to achieve the same effect.
+
+The difference between |ai| and |aI| is that |ai| includes the line
+immediately above the indentation block, whereas aI includes not only that,
+but also the line below. Which of these is most useful largely depends on the
+structure of the language being edited.
+
+For example, when editing the Python code, |ai| is generally more useful, as
+the line above the indentation block is usually related to it. For example, in
+the following code (* is used to indicate the cursor position):
+>
+      if foo > 3:
+         log("foo is big") *
+         foo = 3
+      do_something_else()
+<
+the if clause is logically related to the code block, whereas the function
+call below is not. It is unlikely we would want to select the line below when
+we are interested in the if block.
+
+However, in other languages, such as Vim scripts, control structures are
+usually terminated with something like 'endif'. Therefore, in this example:
+>
+      if foo > 3
+         echo "foo is big" *
+         let foo = 3
+      endif
+      call do_something_else()
+<
+we would more likely want to include the endif when we select the if
+structure.
+
+
+==============================================================================
+BLANK LINES                                               *idntobj-blanklines*
+
+When scanning code blocks, the plugin usually ignores blank lines. There is an
+exception to this, however, when the block being selected is not indented. In
+this case if blank lines are ignored, then the entire file would be selected.
+Instead when code at the top level is being indented blank lines are
+considered to delimit the block.
+
+
+==============================================================================
+ABOUT                                                          *idntobj-about*
+
+vim-indent-object was written by Michael Smith <msmith@msmith.id.au>. The
+project repository is kept at:
+
+http://github.com/michaeljsmith/vim-indent-object
+
+Any feedback or criticism is welcome, and can be mailed to the author at the
+above email address. Alternatively issues can be raised on the project
+website.
+
+Licence:
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.

.vim/indent/python.vim

+"=============================================================================
+"
+"     FileName: python.vim
+"         Desc: 修改了缩进的bug
+"
+"       Author: dantezhu - http://www.vimer.cn
+"        Email: zny2008@gmail.com
+"
+"      Created: 2011-02-21 23:55:50
+"      Version: 0.0.9
+"      History:
+"               0.0.9 | dantezhu | 2011-03-15 10:15:05 | 注释和string不缩进
+"               0.0.8 | dantezhu | 2011-03-10 18:41:15 | 之前修正的有点问题
+"               0.0.7 | dantezhu | 2011-03-10 11:06:01 | 向cindent看齐,函数名
+"                                                      | 太短则和匹配的地方对齐
+"               0.0.6 | dantezhu | 2011-02-26 23:45:18 | 只约束是字母太弱了,
+"                                                      | 还有数字和下划线
+"               0.0.5 | dantezhu | 2011-02-26 23:28:16 | 修正对调用函数时,多
+"                                                      | 行参数的)的缩进
+"               0.0.4 | dantezhu | 2011-02-24 19:32:14 | 之前的fix有问题,重写
+"               0.0.3 | dantezhu | 2011-02-22 14:53:40 | 修正了Comment或者
+"                                                      | String中存在:时就会缩
+"                                                      | 进的问题
+"               0.0.2 | dantezhu | 2011-02-22 01:15:53 | 增加了对class,if,elif
+"                                                      | 等的兼容
+"               0.0.1 | dantezhu | 2011-02-21 23:55:50 | initialization
+"
+"=============================================================================
+
+" Python indent file
+" Language:	    Python
+" Maintainer:	    Eric Mc Sween <em@tomcom.de>
+" Original Author:  David Bustos <bustos@caltech.edu> 
+" Last Change:      2004 Jun 07
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+    finish
+endif
+let b:did_indent = 1
+
+setlocal expandtab
+setlocal nolisp
+setlocal autoindent
+setlocal indentexpr=GetPythonIndent(v:lnum)
+setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except
+
+let s:maxoff = 50
+
+" Find backwards the closest open parenthesis/bracket/brace.
+function! s:SearchParensPair()
+    let line = line('.')
+    let col = col('.')
+    
+    " Skip strings and comments and don't look too far
+    let skip = "line('.') < " . (line - s:maxoff) . " ? dummy :" .
+                \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? ' .
+                \ '"string\\|comment"'
+
+    " Search for parentheses
+    call cursor(line, col)
+    let parlnum = searchpair('(', '', ')', 'bW', skip)
+    let parcol = col('.')
+
+    " Search for brackets
+    call cursor(line, col)
+    let par2lnum = searchpair('\[', '', '\]', 'bW', skip)
+    let par2col = col('.')
+
+    " Search for braces
+    call cursor(line, col)
+    let par3lnum = searchpair('{', '', '}', 'bW', skip)
+    let par3col = col('.')
+
+    " Get the closest match
+    if par2lnum > parlnum || (par2lnum == parlnum && par2col > parcol)
+        let parlnum = par2lnum
+        let parcol = par2col
+    endif
+    if par3lnum > parlnum || (par3lnum == parlnum && par3col > parcol)
+        let parlnum = par3lnum
+        let parcol = par3col
+    endif 
+
+    " Put the cursor on the match
+    if parlnum > 0
+        call cursor(parlnum, parcol)
+    endif
+    return parlnum
+endfunction
+
+" Find the start of a multi-line statement
+function! s:StatementStart(lnum)
+    let lnum = a:lnum
+    while 1
+        if getline(lnum - 1) =~ '\\$'
+            let lnum = lnum - 1
+        else
+            call cursor(lnum, 1)
+            let maybe_lnum = s:SearchParensPair()
+            if maybe_lnum < 1
+                return lnum
+            else
+                let lnum = maybe_lnum
+            endif
+        endif
+    endwhile
+endfunction
+
+" Find the block starter that matches the current line
+function! s:BlockStarter(lnum, block_start_re)
+    let lnum = a:lnum
+    let maxindent = 10000       " whatever
+    while lnum > 1
+        let lnum = prevnonblank(lnum - 1)
+        if indent(lnum) < maxindent
+            if getline(lnum) =~ a:block_start_re
+                return lnum
+            else 
+                let maxindent = indent(lnum)
+                " It's not worth going further if we reached the top level
+                if maxindent == 0
+                    return -1
+                endif
+            endif
+        endif
+    endwhile
+    return -1
+endfunction
+                
+function! GetPythonIndent(lnum)
+
+    " First line has indent 0
+    if a:lnum == 1
+        return 0
+    endif
+
+"Add-Begin by dantezhu in 2011-03-15 10:14:01
+"修正注释和字符串缩进的问题
+    " If the start of the line is in a string don't change the indent.
+    if has('syntax_items')
+               \ && synIDattr(synID(a:lnum, col('.')-1, 1), 'name') =~ '\(Comment\|String\)$'
+       return -1
+    endif
+"Add-End
+
+    " If we can find an open parenthesis/bracket/brace, line up with it.
+    call cursor(a:lnum, 1)
+    let parlnum = s:SearchParensPair()
+    if parlnum > 0
+        let parcol = col('.')
+        let closing_paren = match(getline(a:lnum), '^\s*[])}]') != -1
+        if match(getline(parlnum), '[([{]\s*$', parcol - 1) != -1
+            if closing_paren
+                "Mod-Begin by dantezhu in 2011-02-21 23:38:24
+                "FROM
+                "return indent(parlnum)
+                "TO
+                "为了支持如下的格式:
+                "def fun(
+                "    a,
+                "    b
+                "    ):
+                "    print a,b
+                "又不影响如下格式:
+                "val = {
+                "    (
+                "        1,
+                "        2
+                "    ):1
+                "}
+
+                "Add-Begin by dantezhu in 2011-02-26 23:23:08
+                "增加了对
+                "x = user.getdata1_(
+                "   a,
+                "   b,
+                "   c
+                "   )
+                "的支持
+                if match(getline(parlnum), '\(\a\|\d\|_\)\s*(\s*$', 0) != -1
+                    "增加了对
+                    "x(
+                    "    1,
+                    "    2,
+                    "    3
+                    " )
+                    "user.login(
+                    "    1,
+                    "    2,
+                    "    3
+                    "    )
+                    " 的支持
+                    if (parcol -1 - indent(parlnum)) < 4
+                        return parcol - 1
+                    else
+                        return indent(parlnum) + &sw
+                    endif
+                endif
+                "Add-End
+                if match(getline(a:lnum), ')\s*:') != -1 && 
+                            \ match(getline(parlnum), '\(def\|class\|if\|elif\|while\)\(\s\+\|(\)') != -1
+                    return indent(parlnum) + &sw
+                else
+                    return indent(parlnum)
+                endif
+                "Mod-End
+            else
+                return indent(parlnum) + &sw
+            endif
+        else
+            if closing_paren
+                return parcol - 1
+            else
+                return parcol
+            endif
+        endif
+    endif
+
+    " Examine this line
+    let thisline = getline(a:lnum)
+    let thisindent = indent(a:lnum)
+
+    " If the line starts with 'elif' or 'else', line up with 'if' or 'elif'
+    if thisline =~ '^\s*\(elif\|else\)\>'
+        let bslnum = s:BlockStarter(a:lnum, '^\s*\(if\|elif\)\>')
+        if bslnum > 0
+            return indent(bslnum)
+        else
+            return -1
+        endif
+    endif
+
+    " If the line starts with 'except' or 'finally', line up with 'try'
+    " or 'except'
+    if thisline =~ '^\s*\(except\|finally\)\>'
+        let bslnum = s:BlockStarter(a:lnum, '^\s*\(try\|except\)\>')
+        if bslnum > 0
+            return indent(bslnum)
+        else
+            return -1
+        endif
+    endif
+
+    " Examine previous line
+    let plnum = a:lnum - 1
+    let pline = getline(plnum)
+    let sslnum = s:StatementStart(plnum)
+
+    " If the previous line is blank, keep the same indentation
+    if pline =~ '^\s*$'
+        return -1
+    endif
+
+    " If this line is explicitly joined, try to find an indentation that looks
+    " good. 
+    if pline =~ '\\$'
+        let compound_statement = '^\s*\(if\|while\|for\s.*\sin\|except\)\s*'
+            let maybe_indent = matchend(getline(sslnum), compound_statement)
+            if maybe_indent != -1
+                return maybe_indent
+            else
+                return indent(sslnum) + &sw * 2
+            endif
+        endif
+
+        " If the previous line ended with a colon, indent relative to
+        " statement start.
+        if pline =~ ':\s*$'
+            "Mod-Begin by dantezhu in 2011-02-24 19:30:52
+            "FROM
+            "return indent(sslnum) + &sw
+            "TO
+            let t_col = match(pline,':\s*$')+1
+            if synIDattr(synID(a:lnum-1, t_col, 1), 'name') !~ '\(Comment\|String\)$'
+                return indent(sslnum) + &sw
+            endif
+            "Mod-End
+        endif
+
+        " If the previous line was a stop-execution statement or a pass
+        if getline(sslnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
+            " See if the user has already dedented
+            if indent(a:lnum) > indent(sslnum) - &sw
+                " If not, recommend one dedent
+                return indent(sslnum) - &sw
+            endif
+            " Otherwise, trust the user
+            return -1
+        endif
+
+        " In all other cases, line up with the start of the previous statement.
+        return indent(sslnum)
+    endfunction

.vim/plugin/ctrlp.vim

 if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
 if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
 
-com! -n=? -com=dir CtrlP         cal ctrlp#init(0, { 'dir': <q-args> })
-com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': <q-args> })
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlP
+	\ cal ctrlp#init(0, { 'dir': <q-args> })
+
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPMRUFiles
+	\ cal ctrlp#init(2, { 'dir': <q-args> })
 
 com! -bar CtrlPBuffer   cal ctrlp#init(1)
 com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
 com! -bar CtrlPTag      cal ctrlp#init(ctrlp#tag#id())
 com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
 
-com! -n=? -com=dir CtrlPDir
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPDir
 	\ cal ctrlp#init(ctrlp#dir#id(), { 'dir': <q-args> })
 
 com! -n=? -com=buffer CtrlPBufTag
 com! -bar CtrlPMixed       cal ctrlp#init(ctrlp#mixed#id())
 com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
 
-com! -n=? -com=dir CtrlPBookmarkDirAdd
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPBookmarkDirAdd
 	\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
 
 " vim:ts=2:sw=2:sts=2

.vim/plugin/indent-object.vim

+"--------------------------------------------------------------------------------
+"
+"  Copyright (c) 2010 Michael Smith <msmith@msmith.id.au>
+"
+"  http://github.com/michaeljsmith/vim-indent-object
+"
+"  Permission is hereby granted, free of charge, to any person obtaining a copy
+"  of this software and associated documentation files (the "Software"), to
+"  deal in the Software without restriction, including without limitation the
+"  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+"  sell copies of the Software, and to permit persons to whom the Software is
+"  furnished to do so, subject to the following conditions:
+"  
+"  The above copyright notice and this permission notice shall be included in
+"  all copies or substantial portions of the Software.
+"  
+"  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+"  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+"  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+"  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+"  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+"  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+"  IN THE SOFTWARE.
+"
+"--------------------------------------------------------------------------------
+
+" Mappings excluding line below.
+onoremap <silent>ai :<C-u>cal <Sid>HandleTextObjectMapping(0, 0, 0, [line("."), line("."), col("."), col(".")])<CR>
+onoremap <silent>ii :<C-u>cal <Sid>HandleTextObjectMapping(1, 0, 0, [line("."), line("."), col("."), col(".")])<CR>
+vnoremap <silent>ai :<C-u>cal <Sid>HandleTextObjectMapping(0, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])<CR><Esc>gv
+vnoremap <silent>ii :<C-u>cal <Sid>HandleTextObjectMapping(1, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])<CR><Esc>gv
+
+" Mappings including line below.
+onoremap <silent>aI :<C-u>cal <Sid>HandleTextObjectMapping(0, 1, 0, [line("."), line("."), col("."), col(".")])<CR>
+onoremap <silent>iI :<C-u>cal <Sid>HandleTextObjectMapping(1, 1, 0, [line("."), line("."), col("."), col(".")])<CR>
+vnoremap <silent>aI :<C-u>cal <Sid>HandleTextObjectMapping(0, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])<CR><Esc>gv
+vnoremap <silent>iI :<C-u>cal <Sid>HandleTextObjectMapping(1, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])<CR><Esc>gv
+
+let s:l0 = -1
+let s:l1 = -1
+let s:c0 = -1
+let s:c1 = -1
+
+function! <Sid>TextObject(inner, incbelow, vis, range, count)
+
+	" Record the current state of the visual region.
+	let vismode = "V"
+
+	" Detect if this is a completely new visual selction session.
+	let new_vis = 0
+	let new_vis = new_vis || s:l0 != a:range[0]
+	let new_vis = new_vis || s:l1 != a:range[1]
+	let new_vis = new_vis || s:c0 != a:range[2]
+	let new_vis = new_vis || s:c1 != a:range[3]
+
+	let s:l0 = a:range[0]
+	let s:l1 = a:range[1]
+	let s:c0 = a:range[2]
+	let s:c1 = a:range[3]
+
+	" Repeatedly increase the scope of the selection.
+	let itr_cnt = 0
+	let cnt = a:count
+	while cnt > 0
+
+		" Look for the minimum indentation in the current visual region.
+		let l = s:l0
+		let idnt_invalid = 1000
+		let idnt = idnt_invalid
+		while l <= s:l1
+			if !(getline(l) =~ "^\\s*$")
+				let idnt = min([idnt, indent(l)])
+			endif
+			let l += 1
+		endwhile
+
+		" Keep track of where the range should be expanded to.
+		let l_1 = s:l0
+		let l_1o = l_1
+		let l2 = s:l1
+		let l2o = l2
+
+		" If we are highlighting only blank lines, we may not have found a
+		" valid indent. In this case we need to look for the next and previous
+		" non blank lines and check which of those has the largest indent.
+		if idnt == idnt_invalid
+			let idnt = 0
+			let pnb = prevnonblank(s:l0)
+			if pnb
+				let idnt = max([idnt, indent(pnb)])
+				let l_1 = pnb
+			endif
+			let nnb = nextnonblank(s:l0)
+			if nnb
+				let idnt = max([idnt, indent(nnb)])
+			endif
+
+			" If we are in whitespace at the beginning of a block, skip over
+			" it when we are selecting the range. Similarly, if we are in
+			" whitespace at the end, ignore it.
+			if idnt > indent(pnb)
+				let l_1 = nnb
+			endif
+			if idnt > indent(nnb)
+				let l2 = pnb
+			endif
+		endif
+
+		" Search backward for the first line with less indent than the target
+		" indent (skipping blank lines).
+		let blnk = getline(l_1) =~ "^\\s*$"
+		while l_1 > 0 && ((idnt == 0 && !blnk) || (idnt != 0 && (blnk || indent(l_1) >= idnt)))
+			if !blnk || !a:inner
+				let l_1o = l_1
+			endif
+			let l_1 -= 1
+			let blnk = getline(l_1) =~ "^\\s*$"
+		endwhile
+
+		" Search forward for the first line with more indent than the target
+		" indent (skipping blank lines).
+		let line_cnt = line("$")
+		let blnk = getline(l2) =~ "^\\s*$"
+		while l2 <= line_cnt && ((idnt == 0 && !blnk) || (idnt != 0 && (blnk || indent(l2) >= idnt)))
+			if !blnk || !a:inner
+				let l2o = l2
+			endif
+			let l2 += 1
+			let blnk = getline(l2) =~ "^\\s*$"
+		endwhile
+
+		" Determine which of these extensions to include. Include neither if
+		" we are selecting an 'inner' object. Exclude the bottom unless are
+		" told to include it.
+		let idnt2 = max([indent(l_1), indent(l2)])
+		if indent(l_1) < idnt2 || a:inner
+			let l_1 = l_1o
+		endif
+		if indent(l2) < idnt2 || a:inner || !a:incbelow
+			let l2 = l2o
+		endif
+		let l_1 = max([l_1, 1])
+		let l2 = min([l2, line("$")])
+
+		" Extend the columns to the start and end.
+		" If inner is selected, set the final cursor pos to the start
+		" of the text in the line.
+		let c_1 = 1
+		if a:inner
+			let c_1 = match(getline(l_1), "\\c\\S") + 1
+		endif
+		let c2 = len(getline(l2))
+		if !a:inner
+			let c2 += 1
+		endif
+
+		" Make sure there's no change if we haven't really made a
+		" significant change in linewise mode - this makes sure that
+		" we can iteratively increase selection in linewise mode.
+		if itr_cnt == 0 && vismode ==# 'V' && s:l0 == l_1 && s:l1 == l2
+			let c_1 = s:c0
+			let c2 = s:c1
+		endif
+
+		" Check whether the visual region has changed.
+		let chg = 0
+		let chg = chg || s:l0 != l_1
+		let chg = chg || s:l1 != l2
+		let chg = chg || s:c0 != c_1
+		let chg = chg || s:c1 != c2
+
+		if vismode ==# 'V' && new_vis
+			let chg = 1
+		endif
+
+		" Update the vars.
+		let s:l0 = l_1
+		let s:l1 = l2
+		let s:c0 = c_1
+		let s:c1 = c2
+
+		" If there was no change, then don't decrement the count (it didn't
+		" count because it didn't do anything).
+		if chg
+			let cnt = cnt - 1
+		else
+			" Since this didn't work, push the selection back one char. This
+			" will have the effect of getting the enclosing block. Do it at
+			" the beginning rather than the end - the beginning is very likely
+			" to be only one indentation level different.
+			if s:l0 == 0
+				return
+			endif
+			let s:l0 -= 1
+			let s:c0 = len(getline(s:l0))
+		endif
+
+		let itr_cnt += 1
+
+	endwhile
+
+	" Apply the range we have found. Make sure to use the current visual mode.
+	call cursor(s:l0, s:c0)
+	exe "normal! " . vismode
+	call cursor(s:l1, s:c1)
+	normal! o
+
+	" Update these static variables - we need to keep these up-to-date between
+	" invocations because it's the only way we can detect whether it's a new
+	" visual mode. We need to know if it's a new visual mode because otherwise
+	" if there's a single line block in visual line mode and we select it with
+	" "V", we can't tell whether it's already been selected using Vii.
+	exe "normal! \<Esc>"
+	let s:l0 = line("'<")
+	let s:l1 = line("'>")
+	let s:c0 = col("'<")
+	let s:c1 = col("'>")
+	normal gv
+
+endfunction
+
+function! <Sid>HandleTextObjectMapping(inner, incbelow, vis, range)
+	call <Sid>TextObject(a:inner, a:incbelow, a:vis, a:range, v:count1)
+endfunction
 set wildignore+=*.pyc,.hg,.git
 set nolazyredraw
 set wildmenu
-set wildmode=list,longest,full " longest,list
+set wildmode=list:longest " longest,list
+set scrolloff=3
 
 " formatting options
 set formatoptions=qrnl
 au FileType javascript setlocal foldmethod=marker
 au FileType javascript setlocal foldmarker={,}
 
+autocmd FileType rst setlocal shiftwidth=2 tabstop=2
+
 autocmd FileType htmldjango set sw=2
 autocmd FileType htmldjango set ts=2
 autocmd FileType htmldjango set sts=2
 
 au BufNewFile,BufRead *.less,*.css inoremap <buffer> {<cr> {}<left><cr><space><space><space><space>.<cr><esc>kA<bs>}
 
+autocmd BufWritePre *.py mark z | %s/ *$//e | 'z
+
+let g:ctrlp_map = ',e'
 let g:ctrlp_dont_split = 'NERD_tree_2'
 let g:ctrlp_jump_to_buffer = 0
 let g:ctrlp_working_path_mode = 0
 let g:ctrlp_max_height = 20
 let g:ctrlp_extensions = ['tag']
 
+let g:ctrlp_custom_ignore = {
+  \ 'dir': '\v[\/](\.git|\.hg|\.svn)$',
+  \ 'file': '\.pyc$\|\.pyo$',
+  \ }
+
 nnoremap <leader>. :CtrlPTag<cr>
 nnoremap <leader>, :CtrlPMRU<cr>
 
 alias poweroff='sudo shutdown -h now'
 alias reboot='sudo shutdown -r now'
 #alias cp='cp -av'
-alias cp='rsync -P'
+alias cp='rsync -rP'
 alias mv='mv -v'
 alias ssh='ssh'
 alias scp='scp -rC'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.