<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.vim/colors/tango-morning.vim</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -211,6 +211,7 @@ x.......Close the current nodes parent...........................|NERDTree-x|
 X.......Recursively close all children of the current node.......|NERDTree-X|
 e.......Edit the current dif.....................................|NERDTree-e|
 
+&lt;CR&gt;...............same as |NERDTree-o|.
 double-click.......same as the |NERDTree-o| map.
 middle-click.......same as |NERDTree-i| for files, same as
                    |NERDTree-e| for dirs.
@@ -221,8 +222,8 @@ P.......Jump to the root node....................................|NERDTree-P|
 p.......Jump to current nodes parent.............................|NERDTree-p|
 K.......Jump up inside directories at the current tree depth.....|NERDTree-K|
 J.......Jump down inside directories at the current tree depth...|NERDTree-J|
-&lt;C-j&gt;...Jump down to the next sibling of the current directory...|NERDTree-c-j|
-&lt;C-k&gt;...Jump up to the previous sibling of the current directory.|NERDTree-c-k|
+&lt;C-J&gt;...Jump down to the next sibling of the current directory...|NERDTree-C-J|
+&lt;C-K&gt;...Jump up to the previous sibling of the current directory.|NERDTree-C-K|
 
 C.......Change the tree root to the selected dir.................|NERDTree-C|
 u.......Move the tree root up one directory......................|NERDTree-u|
@@ -430,16 +431,16 @@ If the cursor is already on the last node then do the following:
     * go to the last child of that node
 
 ------------------------------------------------------------------------------
-                                                                *NERDTree-c-j*
-Default key: &lt;C-j&gt;
+                                                                *NERDTree-C-J*
+Default key: &lt;C-J&gt;
 Map option: NERDTreeMapJumpNextSibling
 Applies to: files and directories.
 
 Jump to the next sibling of the selected node.
 
 ------------------------------------------------------------------------------
-                                                                *NERDTree-c-k*
-Default key: &lt;C-k&gt;
+                                                                *NERDTree-C-K*
+Default key: &lt;C-K&gt;
 Map option: NERDTreeMapJumpPrevSibling
 Applies to: files and directories.
 
@@ -498,6 +499,14 @@ Applies to: files and directories.
 Display the filesystem menu. See |NERDTreeFilesysMenu| for details.
 
 ------------------------------------------------------------------------------
+                                                                 *NERDTree-cd*
+Default key: cd
+Map option: NERDTreeMapChdir
+Applies to: files and directories.
+
+Change vims current working directory to that of the selected node.
+
+------------------------------------------------------------------------------
                                                                   *NERDTree-I*
 Default key: I
 Map option: NERDTreeMapToggleHidden
@@ -679,7 +688,7 @@ If set to 1, the NERD tree window will center around the cursor if it moves to
 within |'NERDTreeAutoCenterThreshold'| lines of the top/bottom of the window.
 
 This is ONLY done in response to tree navigation mappings,
-i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-c-K| |NERDTree-p|
+i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-C-K| |NERDTree-p|
 |NERDTree-P|
 
 The centering is done with a |zz| operation.
@@ -742,7 +751,7 @@ Values: 0 or 1.
 Default: 1.
 
 If set to 1, the current cursor line in the NERD tree buffer will be
-highlighted. This is done using the |cursorline| option.
+highlighted. This is done using the |'cursorline'| option.
 
 ------------------------------------------------------------------------------
                                                        *'NERDTreeHijackNetrw'*
@@ -988,6 +997,15 @@ The latest dev versions are on github
 ==============================================================================
 6. Changelog                                               *NERDTreeChangelog*
 
+3.1.1
+    - fix a bug where a non-listed no-name buffer was getting created every
+      time the tree windows was created, thanks to Derek Wyatt and owen1
+    - make &lt;CR&gt; behave the same as the 'o' mapping
+    - some helptag fixes in the doc, thanks strull
+    - fix a bug when using :set nohidden and opening a file where the previous
+      buf was modified. Thanks iElectric
+    - other minor fixes
+
 3.1.0
     New features:
     - add mappings to open files in a vsplit, see :help NERDTree-s and :help</diff>
      <filename>.vim/doc/NERD_tree.txt</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
 &quot; File:        NERD_tree.vim
 &quot; Description: vim global plugin that provides a nice tree explorer
 &quot; Maintainer:  Martin Grenfell &lt;martin_grenfell at msn dot com&gt;
-&quot; Last Change: 27 Jan, 2009
+&quot; Last Change: 7 Jun, 2009
 &quot; License:     This program is free software. It comes without any warranty,
 &quot;              to the extent permitted by applicable law. You can redistribute
 &quot;              it and/or modify it under the terms of the Do What The Fuck You
@@ -10,7 +10,7 @@
 &quot;              See http://sam.zoy.org/wtfpl/COPYING for more details.
 &quot;
 &quot; ============================================================================
-let s:NERD_tree_version = '3.1.0'
+let s:NERD_tree_version = '3.1.1'
 
 &quot; SECTION: Script init stuff {{{1
 &quot;============================================================
@@ -154,7 +154,7 @@ command! -n=? -complete=dir -bar NERDTree :call s:initNerdTree('&lt;args&gt;')
 command! -n=? -complete=dir -bar NERDTreeToggle :call s:toggle('&lt;args&gt;')
 command! -n=0 -bar NERDTreeClose :call s:closeTreeIfOpen()
 command! -n=1 -complete=customlist,s:completeBookmarks -bar NERDTreeFromBookmark call s:initNerdTree('&lt;args&gt;')
-command! -n=0 -complete=customlist,s:completeNERDTreeMirrors -bar NERDTreeMirror call s:initNerdTreeMirror()
+command! -n=0 -bar NERDTreeMirror call s:initNerdTreeMirror()
 &quot; SECTION: Auto commands {{{1
 &quot;============================================================
 augroup NERDTree
@@ -796,12 +796,12 @@ function! s:TreeFileNode.open()
         call s:exec(winnr . &quot;wincmd w&quot;)
 
     else
-        if !s:isWindowUsable(winnr(&quot;#&quot;)) &amp;&amp; s:firstNormalWindow() ==# -1
+        if !s:isWindowUsable(winnr(&quot;#&quot;)) &amp;&amp; s:firstUsableWindow() ==# -1
             call self.openSplit()
         else
             try
                 if !s:isWindowUsable(winnr(&quot;#&quot;))
-                    call s:exec(s:firstNormalWindow() . &quot;wincmd w&quot;)
+                    call s:exec(s:firstUsableWindow() . &quot;wincmd w&quot;)
                 else
                     call s:exec('wincmd p')
                 endif
@@ -2355,12 +2355,13 @@ function! s:createTreeWin()
     &quot;create the nerd tree window
     let splitLocation = g:NERDTreeWinPos ==# &quot;left&quot; ? &quot;topleft &quot; : &quot;botright &quot;
     let splitSize = g:NERDTreeWinSize
-    silent! exec splitLocation . 'vertical ' . splitSize . ' new'
 
     if !exists('t:NERDTreeBufName')
         let t:NERDTreeBufName = s:nextBufferName()
+        silent! exec splitLocation . 'vertical ' . splitSize . ' new'
         silent! exec &quot;edit &quot; . t:NERDTreeBufName
     else
+        silent! exec splitLocation . 'vertical ' . splitSize . ' split'
         silent! exec &quot;buffer &quot; . t:NERDTreeBufName
     endif
 
@@ -2404,6 +2405,7 @@ function! s:dumpHelp()
         let @h=@h.&quot;\&quot; ============================\n&quot;
         let @h=@h.&quot;\&quot; File node mappings~\n&quot;
         let @h=@h.&quot;\&quot; &quot;. (g:NERDTreeMouseMode ==# 3 ? &quot;single&quot; : &quot;double&quot;) .&quot;-click,\n&quot;
+        let @h=@h.&quot;\&quot; &lt;CR&gt;,\n&quot;
         if b:NERDTreeType ==# &quot;primary&quot;
             let @h=@h.&quot;\&quot; &quot;. g:NERDTreeMapActivateNode .&quot;: open in prev window\n&quot;
         else
@@ -2516,14 +2518,15 @@ function! s:echoError(msg)
     call s:echo(a:msg)
     echohl normal
 endfunction
-&quot;FUNCTION: s:firstNormalWindow(){{{2
+&quot;FUNCTION: s:firstUsableWindow(){{{2
 &quot;find the window number of the first normal window
-function! s:firstNormalWindow()
+function! s:firstUsableWindow()
     let i = 1
     while i &lt;= winnr(&quot;$&quot;)
         let bnum = winbufnr(i)
         if bnum != -1 &amp;&amp; getbufvar(bnum, '&amp;buftype') ==# ''
                     \ &amp;&amp; !getwinvar(i, '&amp;previewwindow')
+                    \ &amp;&amp; (!getbufvar(bnum, '&amp;modified') || &amp;hidden)
             return i
         endif
 
@@ -2630,8 +2633,8 @@ function! s:isTreeOpen()
     return s:getTreeWinNum() != -1
 endfunction
 &quot;FUNCTION: s:isWindowUsable(winnumber) {{{2
-&quot;Returns 1 if opening a file from the tree in the given window requires it to
-&quot;be split
+&quot;Returns 0 if opening a file from the tree in the given window requires it to
+&quot;be split, 1 otherwise
 &quot;
 &quot;Args:
 &quot;winnumber: the number of the window in question
@@ -3042,7 +3045,8 @@ function! s:activateNode(forceKeepWindowOpen)
                 call bookmark.toRoot()
             else
                 if bookmark.validate()
-                    call (s:TreeFileNode.New(bookmark.path)).open()
+                    let n = s:TreeFileNode.New(bookmark.path)
+                    call n.open()
                 endif
             endif
         endif
@@ -3058,6 +3062,7 @@ function! s:bindMappings()
 
     exec &quot;nnoremap &lt;silent&gt; &lt;buffer&gt; &quot;. g:NERDTreeMapActivateNode . &quot; :call &lt;SID&gt;activateNode(0)&lt;cr&gt;&quot;
     exec &quot;nnoremap &lt;silent&gt; &lt;buffer&gt; &quot;. g:NERDTreeMapOpenSplit .&quot; :call &lt;SID&gt;openEntrySplit(0,0)&lt;cr&gt;&quot;
+    exec &quot;nnoremap &lt;silent&gt; &lt;buffer&gt; &lt;cr&gt; :call &lt;SID&gt;activateNode(0)&lt;cr&gt;&quot;
 
     exec &quot;nnoremap &lt;silent&gt; &lt;buffer&gt; &quot;. g:NERDTreeMapPreview .&quot; :call &lt;SID&gt;previewNode(0)&lt;cr&gt;&quot;
     exec &quot;nnoremap &lt;silent&gt; &lt;buffer&gt; &quot;. g:NERDTreeMapPreviewSplit .&quot; :call &lt;SID&gt;previewNode(1)&lt;cr&gt;&quot;</diff>
      <filename>.vim/plugin/NERD_tree.vim</filename>
    </modified>
    <modified>
      <diff>@@ -1,189 +1,241 @@
-&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
-&quot; AutoClose.vim - Automatically close pair of characters: ( with ), [ with ], { with }, etc.
-&quot; Version: 1.1
-&quot; Author: Thiago Alves &lt;thiago.salves@gmail.com&gt;
-&quot; Maintainer: Thiago Alves &lt;thiago.salves@gmail.com&gt;
-&quot; URL: http://thiagoalves.org
-&quot; Licence: This script is released under the Vim License.
-&quot; Last modified: 08/25/2008 
-&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
-
-let s:debug = 1
-
-&quot; check if script is already loaded
-if s:debug == 0 &amp;&amp; exists(&quot;g:loaded_AutoClose&quot;)
-    finish &quot;stop loading the script&quot;
+&quot; File: autoclose.vim
+&quot; Author: Karl Guertin &lt;grayrest@gr.ayre.st&gt;
+&quot; Version: 1.2
+&quot; Last Modified: June 18, 2009
+&quot; Description: AutoClose, closes what's opened.
+&quot;
+&quot;    This plugin closes opened parenthesis, braces, brackets, quotes as you
+&quot;    type them. As of 1.1, if you type the open brace twice ({{), the closing
+&quot;    brace will be pushed down to a new line.
+&quot;
+&quot;    You can enable or disable this plugin by typing \a (or &lt;Leader&gt;a if you
+&quot;    changed your Leader char). You can define your own mapping and will need
+&quot;    to do so if you have something else mapped to \a since this plugin won't
+&quot;    clobber your mapping. Here's how to map \x:
+&quot;
+&quot;       nmap &lt;Leader&gt;x &lt;Plug&gt;ToggleAutoCloseMappings
+&quot;
+&quot;    You'll also probably want to know you can type &lt;C-V&gt; (&lt;C-Q&gt; if mswin is
+&quot;    set) and the next character you type doesn't have mappings applied. This
+&quot;    is useful when you want to insert only an opening paren or something.
+&quot;
+&quot;    NOTE: If you're using this on a terminal and your arrow keys are broken,
+&quot;          be sure to :set ttimeout and :set ttimeoutlen=100
+&quot;
+&quot;    Version Changes: --------------------------------------------------{{{2
+&quot;    1.2   -- Fixed some edge cases where double the closing characters are
+&quot;             entered when exiting insert mode.
+&quot;             Finally (!) reproduced the arrow keys problem other people were
+&quot;             running into and fixed.
+&quot;             Typing a closing character will now behave consistently (jump
+&quot;             out) regardless of the plugin's internal state.
+&quot;
+&quot;             As a part of the close fix, I've opted to not try tracking the
+&quot;             position of the closing characters through all the things that
+&quot;             could be done with them, so arrowing/jumping around and not
+&quot;             winding up back where you started will cause the input to not be
+&quot;             repeatable.
+&quot;             June 18, 2009
+&quot;    1.1.2 -- Fixed a mapping typo and caught a double brace problem,
+&quot;             September 20, 2007
+&quot;    1.1.1 -- Missed a bug in 1.1, September 19, 2007
+&quot;    1.1   -- When not inserting at the end, previous version would eat chars
+&quot;             at end of line, added double open-&gt;newline, September 19, 2007
+&quot;    1.0.1 -- Cruft from other parts of the mapping, knew I shouldn't have
+&quot;             released the first as 1.0, April 3, 2007
+
+&quot; Setup -----------------------------------------------------{{{2
+if exists('g:autoclose_loaded') || &amp;cp
+    finish
 endif
-let g:loaded_AutoClose = 1
 
-let s:global_cpo = &amp;cpo &quot; store compatible-mode in local variable
-set cpo&amp;vim             &quot; go into nocompatible-mode
 
-&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
-&quot; Functions
-&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
-function! s:GetNextChar()
-    if col('$') == col('.')
-        return &quot;\0&quot;
-    endif
-    return strpart(getline('.'), col('.')-1, 1)
-endfunction
-
-function! s:GetPrevChar()
-    if col('.') == 1
-        return &quot;\0&quot;
-    endif
-    return strpart(getline('.'), col('.')-2, 1)
-endfunction
+let g:autoclose_loaded = 1
+let s:cotstate = &amp;completeopt
 
-function! s:IsEmptyPair()
-    let l:prev = s:GetPrevChar()
-    let l:next = s:GetNextChar()
-    if l:prev == &quot;\0&quot; || l:next == &quot;\0&quot;
-        return 0
-    endif
-    return get(s:charsToClose, l:prev, &quot;\0&quot;) == l:next
-endfunction
-
-function! s:GetCurrentSyntaxRegion()
-    return synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
-endfunction
-
-function! s:GetCurrentSyntaxRegionIf(char)
-    let l:origin_line = getline('.')
-    let l:changed_line = strpart(l:origin_line, 0, col('.')-1) . a:char . strpart(l:origin_line, col('.')-1)
-    call setline('.', l:changed_line)
-    let l:region = synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
-    call setline('.', l:origin_line)
-    return l:region
-endfunction
+if !exists('g:autoclose_on')
+    let g:autoclose_on = 1
+endif
 
-function! s:IsForbidden(char)
-    let l:result = index(s:protectedRegions, s:GetCurrentSyntaxRegion()) &gt;= 0
-    if l:result
-        return l:result
+&quot; (Toggle) Mappings -----------------------------{{{1
+&quot;
+nmap &lt;Plug&gt;ToggleAutoCloseMappings :call &lt;SID&gt;ToggleAutoCloseMappings()&lt;CR&gt;
+if (!hasmapto( '&lt;Plug&gt;ToggleAutoCloseMappings', 'n' ))
+    nmap &lt;unique&gt; &lt;Leader&gt;a &lt;Plug&gt;ToggleAutoCloseMappings
+endif
+fun &lt;SID&gt;ToggleAutoCloseMappings() &quot; --- {{{2
+    if g:autoclose_on
+        iunmap &quot;
+        iunmap '
+        iunmap (
+        iunmap )
+        iunmap [
+        iunmap ]
+        iunmap {
+        iunmap }
+        iunmap &lt;BS&gt;
+        iunmap &lt;C-h&gt;
+        iunmap &lt;Esc&gt;
+        let g:autoclose_on = 0
+        echo &quot;AutoClose Off&quot;
+    else
+        inoremap &lt;silent&gt; &quot; &lt;C-R&gt;=&lt;SID&gt;QuoteDelim('&quot;')&lt;CR&gt;
+        inoremap &lt;silent&gt; ' &lt;C-R&gt;=match(getline('.')[col('.') - 2],'\w') == 0 &amp;&amp; getline('.')[col('.')-1] != &quot;'&quot; ? &quot;'&quot; : &lt;SID&gt;QuoteDelim(&quot;'&quot;)&lt;CR&gt;
+        inoremap &lt;silent&gt; ( (&lt;C-R&gt;=&lt;SID&gt;CloseStackPush(')')&lt;CR&gt;
+        inoremap ) &lt;C-R&gt;=&lt;SID&gt;CloseStackPop(')')&lt;CR&gt;
+        inoremap &lt;silent&gt; [ [&lt;C-R&gt;=&lt;SID&gt;CloseStackPush(']')&lt;CR&gt;
+        inoremap &lt;silent&gt; ] &lt;C-R&gt;=&lt;SID&gt;CloseStackPop(']')&lt;CR&gt;
+        &quot;inoremap &lt;silent&gt; { {&lt;C-R&gt;=&lt;SID&gt;CloseStackPush('}')&lt;CR&gt;
+        inoremap &lt;silent&gt; { &lt;C-R&gt;=&lt;SID&gt;OpenSpecial('{','}')&lt;CR&gt;
+        inoremap &lt;silent&gt; } &lt;C-R&gt;=&lt;SID&gt;CloseStackPop('}')&lt;CR&gt;
+        inoremap &lt;silent&gt; &lt;BS&gt; &lt;C-R&gt;=&lt;SID&gt;OpenCloseBackspace()&lt;CR&gt;
+        inoremap &lt;silent&gt; &lt;C-h&gt; &lt;C-R&gt;=&lt;SID&gt;OpenCloseBackspace()&lt;CR&gt;
+        inoremap &lt;silent&gt; &lt;Esc&gt; &lt;C-R&gt;=&lt;SID&gt;CloseStackPop('')&lt;CR&gt;&lt;Esc&gt;
+        inoremap &lt;silent&gt; &lt;C-[&gt; &lt;C-R&gt;=&lt;SID&gt;CloseStackPop('')&lt;CR&gt;&lt;C-[&gt;
+        &quot;the following simply creates an ambiguous mapping so vim fully
+        &quot;processes the escape sequence for terminal keys, see 'ttimeout' for a
+        &quot;rough explanation, this just forces it to work
+        if &amp;term[:4] == &quot;xterm&quot;
+            inoremap &lt;silent&gt; &lt;C-[&gt;OC &lt;RIGHT&gt;
+        endif
+        let g:autoclose_on = 1
+        if a:0 == 0
+            &quot;this if is so this message doesn't show up at load
+            echo &quot;AutoClose On&quot;
+        endif
     endif
-    let l:region = s:GetCurrentSyntaxRegionIf(a:char)
-    let l:result = index(s:protectedRegions, l:region) &gt;= 0
-    return l:result &amp;&amp; l:region == 'Comment'
-endfunction
-
-function! s:InsertPair(char)
-    let l:next = s:GetNextChar()
-    let l:result = a:char
-    if s:running &amp;&amp; !s:IsForbidden(a:char) &amp;&amp; (l:next == &quot;\0&quot; || l:next !~ '\w')
-        let l:result .= s:charsToClose[a:char] . &quot;\&lt;Left&gt;&quot;
+endf
+let s:closeStack = []
+
+&quot; AutoClose Utilities -----------------------------------------{{{1
+function &lt;SID&gt;OpenSpecial(ochar,cchar) &quot; ---{{{2
+    let line = getline('.')
+    let col = col('.') - 2
+    &quot;echom string(col).':'.line[:(col)].'|'.line[(col+1):]
+    if a:ochar == line[(col)] &amp;&amp; a:cchar == line[(col+1)] &quot;&amp;&amp; strlen(line) - (col) == 2
+        &quot;echom string(s:closeStack)
+        while len(s:closeStack) &gt; 0
+            call remove(s:closeStack, 0)
+        endwhile
+        return &quot;\&lt;esc&gt;a\&lt;CR&gt;;\&lt;CR&gt;&quot;.a:cchar.&quot;\&lt;esc&gt;\&quot;_xk$\&quot;_xa&quot;
     endif
-    return l:result
+    return a:ochar.&lt;SID&gt;CloseStackPush(a:cchar)
 endfunction
 
-function! s:ClosePair(char)
-    if s:running &amp;&amp; s:GetNextChar() == a:char
-        let l:result = &quot;\&lt;Right&gt;&quot;
+function &lt;SID&gt;CloseStackPush(char) &quot; ---{{{2
+    &quot;echom &quot;push&quot;
+    let line = getline('.')
+    let col = col('.')-2
+    if (col) &lt; 0
+        call setline('.',a:char.line)
     else
-        let l:result = a:char
+        &quot;echom string(col).':'.line[:(col)].'|'.line[(col+1):]
+        call setline('.',line[:(col)].a:char.line[(col+1):])
     endif
-    return l:result
-endfunction
-
-function! s:CheckPair(char)
-    let l:lastpos = 0
-    let l:occur = stridx(getline('.'), a:char, l:lastpos) == 0 ? 1 : 0
-
-    while l:lastpos &gt; -1
-        let l:lastpos = stridx(getline('.'), a:char, l:lastpos+1)
-        if l:lastpos &gt; col('.')-2
-            break
-        endif
-        if l:lastpos &gt;= 0
-            let l:occur += 1
+    call insert(s:closeStack, a:char)
+    &quot;echom join(s:closeStack,'').' -- '.a:char
+    return ''
+endf
+
+function &lt;SID&gt;JumpOut(char) &quot; ----------{{{2
+    let column = col('.') - 1
+    let line = getline('.')
+    let mcol = match(line[column :], a:char)
+    if a:char != '' &amp;&amp;  mcol &gt;= 0
+        &quot;Yeah, this is ugly but vim actually requires each to be special
+        &quot;cased to avoid screen flashes/not doing the right thing.
+        echom len(line).' '.(column+mcol)
+        if line[column] == a:char
+            return &quot;\&lt;Right&gt;&quot;
+        elseif column+mcol == len(line)-1
+            return &quot;\&lt;C-O&gt;A&quot;
+        else
+            return &quot;\&lt;C-O&gt;f&quot;.a:char.&quot;\&lt;Right&gt;&quot;
         endif
-    endwhile
-
-    if l:occur == 0 || l:occur%2 == 0
-        &quot; Opening char
-        return s:InsertPair(a:char)
     else
-        &quot; Closing char
-        return s:ClosePair(a:char)
+        return a:char
     endif
-endfunction
-
-function! s:Backspace()
-    if s:running &amp;&amp; s:IsEmptyPair()
-        return &quot;\&lt;BS&gt;\&lt;Del&gt;&quot;
-    endif    
-    return &quot;\&lt;BS&gt;&quot;
-endfunction
-
-function! s:ToggleAutoClose()
-    let s:running = !s:running
-    if s:running
-        echo &quot;AutoClose ON&quot;
-    else
-        echo &quot;AutoClose OFF&quot;
+endf
+function &lt;SID&gt;CloseStackPop(char) &quot; ---{{{2
+    &quot;echom &quot;pop&quot;
+    if(a:char == '')
+        pclose
     endif
-endfunction
-
-function! s:SetVEAll()
-    let s:save_ve = &amp;ve
-    set ve=all
-    return &quot;&quot;
-endfunction
-
-function! s:RestoreVE()
-    exec &quot;set ve=&quot; . s:save_ve
-    unlet s:save_ve
-    return &quot;&quot;
-endfunction
-
-&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
-&quot; Configuration
-&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
-&quot; let user define which character he/she wants to autocomplete
-if exists(&quot;g:AutoClosePairs&quot;) &amp;&amp; type(g:AutoClosePairs) == type({})
-    let s:charsToClose = g:AutoClosePairs
-    unlet g:AutoClosePairs
-else
-    let s:charsToClose = {'(': ')', '{': '}', '[': ']', '&quot;': '&quot;', &quot;'&quot;: &quot;'&quot;}
-endif
-
-&quot; let user define in which regions the autocomplete feature should not occur
-if exists(&quot;g:AutoCloseProtectedRegions&quot;) &amp;&amp; type(g:AutoCloseProtectedRegions) == type([])
-    let s:protectedRegions = g:AutoCloseProtectedRegions
-    unlet g:AutoCloseProtectedRegions
-else
-    let s:protectedRegions = [&quot;Comment&quot;, &quot;String&quot;, &quot;Character&quot;]
-endif
-
-&quot; let user define if he/she wants the plugin turned on when vim start. Defaul is YES
-if exists(&quot;g:AutoCloseOn&quot;) &amp;&amp; type(g:AutoCloseOn) == type(0)
-    let s:running = g:AutoCloseOn
-    unlet g:AutoCloseOn
-else
-    let s:running = 1
-endif
-
-&quot; create appropriate maps to defined open/close characters
-for key in keys(s:charsToClose)
-    if key == '&quot;'
-        let open_func_arg = '&quot;\&quot;&quot;'
-        let close_func_arg = '&quot;\&quot;&quot;'
-    else
-        let open_func_arg = '&quot;' . key . '&quot;'
-        let close_func_arg = '&quot;' . s:charsToClose[key] . '&quot;'
-    endif 
-     
-    if key == s:charsToClose[key]
-        exec &quot;inoremap &lt;silent&gt; &quot; . key . &quot; &lt;C-R&gt;=&lt;SID&gt;SetVEAll()&lt;CR&gt;&lt;C-R&gt;=&lt;SID&gt;CheckPair(&quot; . open_func_arg . &quot;)&lt;CR&gt;&lt;C-R&gt;=&lt;SID&gt;RestoreVE()&lt;CR&gt;&quot;
+    if len(s:closeStack) == 0
+        return &lt;SID&gt;JumpOut(a:char)
+    endif
+    let column = col('.') - 1
+    let line = getline('.')
+    let popped = ''
+    let lastpop = ''
+    &quot;echom join(s:closeStack,'').' || '.lastpop
+    while len(s:closeStack) &gt; 0 &amp;&amp; ((lastpop == '' &amp;&amp; popped == '') || lastpop != a:char)
+        let lastpop = remove(s:closeStack,0)
+        let popped .= lastpop
+        &quot;echom join(s:closeStack,'').' || '.lastpop.' || '.popped
+    endwhile
+    &quot;echom ' --&gt; '.popped
+    if line[column : column+strlen(popped)-1] != popped
+        return &lt;SID&gt;JumpOut('')
+    endif
+    if column &gt; 0
+        call setline('.',line[:column-1].line[(column+strlen(popped)):])
     else
-        exec &quot;inoremap &lt;silent&gt; &quot; . s:charsToClose[key] . &quot; &lt;C-R&gt;=&lt;SID&gt;SetVEAll()&lt;CR&gt;&lt;C-R&gt;=&lt;SID&gt;ClosePair(&quot; . close_func_arg . &quot;)&lt;CR&gt;&lt;C-R&gt;=&lt;SID&gt;RestoreVE()&lt;CR&gt;&quot;
-        exec &quot;inoremap &lt;silent&gt; &quot; . key . &quot; &lt;C-R&gt;=&lt;SID&gt;SetVEAll()&lt;CR&gt;&lt;C-R&gt;=&lt;SID&gt;InsertPair(&quot; . open_func_arg . &quot;)&lt;CR&gt;&lt;C-R&gt;=&lt;SID&gt;RestoreVE()&lt;CR&gt;&quot;
+        call setline('.','')
     endif
-endfor
-exec &quot;inoremap &lt;silent&gt; &lt;BS&gt; &lt;C-R&gt;=&lt;SID&gt;SetVEAll()&lt;CR&gt;&lt;C-R&gt;=&lt;SID&gt;Backspace()&lt;CR&gt;&lt;C-R&gt;=&lt;SID&gt;RestoreVE()&lt;CR&gt;&quot;
+    return popped
+endf
+
+function &lt;SID&gt;QuoteDelim(char) &quot; ---{{{2
+  let line = getline('.')
+  let col = col('.')
+  if line[col - 2] == &quot;\\&quot;
+    &quot;Inserting a quoted quotation mark into the string
+    return a:char
+  elseif line[col - 1] == a:char
+    &quot;Escaping out of the string
+    return &quot;\&lt;C-R&gt;=&quot;.s:SID().&quot;CloseStackPop(\&quot;\\&quot;.a:char.&quot;\&quot;)\&lt;CR&gt;&quot;
+  else
+    &quot;Starting a string
+    return a:char.&quot;\&lt;C-R&gt;=&quot;.s:SID().&quot;CloseStackPush(\&quot;\\&quot;.a:char.&quot;\&quot;)\&lt;CR&gt;&quot;
+  endif
+endf
+
+&quot; The strings returned from QuoteDelim aren't in scope for &lt;SID&gt;, so I
+&quot; have to fake it using this function (from the Vim help, but tweaked)
+function s:SID()
+    return matchstr(expand('&lt;sfile&gt;'), '&lt;SNR&gt;\d\+_\zeSID$')
+endfun
+
+function &lt;SID&gt;OpenCloseBackspace() &quot; ---{{{2
+    &quot;if pumvisible()
+    &quot;    pclose
+    &quot;    call &lt;SID&gt;StopOmni()
+    &quot;    return &quot;\&lt;C-E&gt;&quot;
+    &quot;else
+        let curline = getline('.')
+        let curpos = col('.')
+        let curletter = curline[curpos-1]
+        let prevletter = curline[curpos-2]
+        if (prevletter == '&quot;' &amp;&amp; curletter == '&quot;') ||
+\          (prevletter == &quot;'&quot; &amp;&amp; curletter == &quot;'&quot;) ||
+\          (prevletter == &quot;(&quot; &amp;&amp; curletter == &quot;)&quot;) ||
+\          (prevletter == &quot;{&quot; &amp;&amp; curletter == &quot;}&quot;) ||
+\          (prevletter == &quot;[&quot; &amp;&amp; curletter == &quot;]&quot;)
+            if len(s:closeStack) &gt; 0
+                call remove(s:closeStack,0)
+            endif
+            return &quot;\&lt;Delete&gt;\&lt;BS&gt;&quot;
+        else
+            return &quot;\&lt;BS&gt;&quot;
+        endif
+    &quot;endif
+endf
 
-&quot; Define convenient commands
-command! AutoCloseOn :let s:running = 1
-command! AutoCloseOff :let s:running = 0
-command! AutoCloseToggle :call s:ToggleAutoClose()
+&quot; Initialization ----------------------------------------{{{1
+if g:autoclose_on
+    let g:autoclose_on = 0
+    silent call &lt;SID&gt;ToggleAutoCloseMappings()
+endif
+&quot; vim: set ft=vim ff=unix et sw=4 ts=4 :
+&quot; vim600: set foldmethod=marker foldmarker={{{,}}} foldlevel=1 :</diff>
      <filename>.vim/plugin/autoclose.vim</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>693f846c5cd14ade8a26a0f2696257c55d3665d6</id>
    </parent>
  </parents>
  <author>
    <name>Tomas Restrepo</name>
    <email>tomas@winterdom.com</email>
  </author>
  <url>http://github.com/tomasr/dotfiles/commit/b7447d8350991746ffc5373b07280ebe4136e5aa</url>
  <id>b7447d8350991746ffc5373b07280ebe4136e5aa</id>
  <committed-date>2009-06-23T05:33:57-07:00</committed-date>
  <authored-date>2009-06-23T05:33:57-07:00</authored-date>
  <message>Updating some Vim plugins</message>
  <tree>fe5494397c0ac5202f920bf1d189fd6b1c57dd45</tree>
  <committer>
    <name>Tomas Restrepo</name>
    <email>tomas@winterdom.com</email>
  </committer>
</commit>
