Commits

Marlo Simon Noval committed 0592ee6

Remove netrwhist. Updated Yankrink. Fixed =irs in css snippet.

Comments (0)

Files changed (5)

.netrwhist

-let g:netrw_dirhistmax  =10
-let g:netrw_dirhist_cnt =9
-let g:netrw_dirhist_1='ftp://novalme@noval.me//ragingfx/'
-let g:netrw_dirhist_2='ftp://novalme@noval.me//'
-let g:netrw_dirhist_3='ftp://novalme@noval.me//public_html/'
-let g:netrw_dirhist_4='ftp://novalme@noval.me/public_html/ragingfx/'
-let g:netrw_dirhist_5='ftp://novalme@noval.me//'
-let g:netrw_dirhist_6='ftp://ragingmon@noval.me/'
-let g:netrw_dirhist_7='D:/desktop/blog'
-let g:netrw_dirhist_8='D:/desktop/djangoblog/posts'
-let g:netrw_dirhist_9='D:/desktop/poll'
 *yankring.txt*      For Vim version 7.0. 
 
-Author:	        David Fishburn                             December 22, 2008
-Version:        8.0
+Author:	        David Fishburn                             August 29, 2009
+Version:        10.0
 
 For instructions on installing this file, type
 	:help add-local-help |add-local-help| inside Vim.
 <       Default: 100
         Controls how many elements to save in the yankring. >
             let g:yankring_max_history = 100
+    yankring_min_element_length 
+<       Default: 1
+        If the yanked element has a length less than this value 
+        if will not be added to the YankRing.  This can be useful if 
+        you want to bypass single letter deletes by adding the 
+        following to your .vimrc: >
+            let g:yankring_min_element_length = 2
     yankring_max_element_length 
 <       Default: 1048576 (1M)
         Will truncate a new entry to the specified maximum.  If 
 ==============================================================================
 7. History                                       *yankring-history*
 
+  10.0: January 31, 2010
+         NF: Change the buffer name to [YankRing] to resemble other
+             non-user buffers.
+         NF: Added g:yankring_min_element_length which can prevent 
+             items from being added to the YankRing if they are too small.
+             For example, single character deletes (Vedran M).
+         BF: When shifting focus back to Vim, the YankRing may incorrectly
+             report: "YR:Failed to change to the yankring buffer, 
+             please contact author".
+         BF: When entering Vim for the first time and hitting "p"
+             nothing was pasted (Mark Huiskes).
+         BF: When entering Vim for the first time and the
+             yankring_clipboard_monitor = 1, the clipboard entry 
+             was not automatically added to the yankring.
+         BF: When overriding the default and setting 
+             g:yankring_window_use_bottom = 0, the YankRing would
+             report the error (Sergey Khorev): 
+                 E21: Cannot make changes, 'modifiable' is off
+
+  9.0: August 29, 2009: 
+         BF: You cannot execute a macro with ":normal @a".  It is still
+             not possible, but you can execute it with ":normal! @a"
+             (A S Budden).  
+         BF: When g:yankring_persist = 0 the YankRing could go into
+             an infinite loop (A S Budden).  
+         BF: When replaying a macro which used any of the zap
+             keys (f,F,t,T,/,?) you were prompted again for the 
+             string to match on (Ovidiu C).
+         BF: When checking the clipboard for changes 
+             (g:yankring_clipboard_monitor == 1) only add the item 
+             if it is not already in the ring.  Previously, the item
+             was moved to the top of the YankRing each time you flipped
+             focus.
+
   8.0: December 21, 2008: 
          NF: Changed the implementation of YRGetSearch() (David Liang).
          BF: Under some unknown circumstances, the yankring can fail

plugin/yankring.vim

 " yankring.vim - Yank / Delete Ring for Vim
 " ---------------------------------------------------------------
-" Version:  8.0
+" Version:  10.0
 " Authors:  David Fishburn <dfishburn.vim@gmail.com>
-" Last Modified: 2008 Dec 21
+" Last Modified: 2010 Jan 24
 " Script:   http://www.vim.org/scripts/script.php?script_id=1234
 " Based On: Mocked up version by Yegappan Lakshmanan
 "           http://groups.yahoo.com/group/vim/post?act=reply&messageNum=34406
   finish
 endif
 
-let loaded_yankring = 80
+let loaded_yankring = 100
 
 let s:yr_has_voperator     = 0
 if v:version > 701 || ( v:version == 701 && has("patch205") )
     let g:yankring_max_history = 100
 endif
 
+" Specify the minimum length of 1 entry 
+if !exists('g:yankring_min_element_length')
+    let g:yankring_min_element_length = 1
+endif
+
 " Specify the maximum length of 1 entry (1MB default)
 if !exists('g:yankring_max_element_length')
     let g:yankring_max_element_length = 1048576
 endif
 
 if !exists('g:yankring_zap_keys')
-    let g:yankring_zap_keys = 'f F t T / ?'
+    let g:yankring_zap_keys = 'f F t T / ? @'
 endif
 
 " Allow the user to specify what operator pending motions to map
 endif
 
 if !exists('g:yankring_clipboard_monitor')
-    let g:yankring_clipboard_monitor = 1
+    let g:yankring_clipboard_monitor = (has('clipboard')?1:0)
 endif
 
 if !exists('g:yankring_default_menu_mode')
 endif
 
 " Script variables for the yankring buffer
-let s:yr_buffer_name       = '__YankRing__'
+let s:yr_buffer_name       = '[YankRing]'
 let s:yr_buffer_last_winnr = -1
 let s:yr_buffer_last       = -1
 let s:yr_buffer_id         = -1
 
 
 " Vim window size is changed by the yankring plugin or not
-let s:yankring_winsize_chgd = 0
+let s:yr_winsize_chgd      = 0
+let s:yr_maps_created      = 0
+let s:yr_maps_created_zap  = 0
 
 " Enables or disables the yankring 
 function! s:YRToggle(...)
     " It is possible for registers to be changed outside of the 
     " maps of the YankRing.  Perform this quick check when we
     " show the contents (or when it is refreshed).
-    if g:yankring_paste_check_default_buffer == 1 && 
-                \ getreg('"') != s:yr_prev_reg_unnamed
-        " The user has performed a yank / delete operation
-        " outside of the yankring maps.  Add this 
-        " value to the yankring.
-        call YRRecord('"')
+    if g:yankring_paste_check_default_buffer == 1 
+        let save_reg = 0
+        let register = ((&clipboard=='unnamed')?'+':'"')
+
+        if &clipboard == 'unnamed' && getreg('+') != s:yr_prev_clipboard
+            let save_reg = 1
+        endif
+        if register == '"' && getreg('"') != s:yr_prev_reg_unnamed
+            let save_reg = 1
+        endif
+
+        if save_reg == 1
+            " The user has performed a yank / delete operation
+            " outside of the yankring maps.  Add this 
+            " value to the yankring.
+            call YRRecord(register)
+        endif
     endif
 
     " List is shown in order of replacement
 
 " Used in omaps if a following string is required 
 " like with motions (/,?)
-function! s:YRGetSearch()
-    " let msg = "YR:Enter string:"
-    " echomsg msg
-    let str = input("YR:Enter string:")
-    " let str = ''
-    " while 1==1
-    "     let c = getchar()
-    "     if c =~ '^\d\+$'
-    "         let c = nr2char(c)
-    "         if c == "\<C-C>"
-    "             return c
-    "         endif
-    "         if c == "\<CR>"
-    "             break
-    "         endif
-    "         let str = str.c
-    "         echomsg msg.str
-    "     else
-    "         break
-    "     endif
-    " endwhile
-    return str
-endfunction
+" function! s:YRGetSearch()
+"     " let msg = "YR:Enter string:"
+"     " echomsg msg
+"     let str = input("YR:Enter string:")
+"     " let str = ''
+"     " while 1==1
+"     "     let c = getchar()
+"     "     if c =~ '^\d\+$'
+"     "         let c = nr2char(c)
+"     "         if c == "\<C-C>"
+"     "             return c
+"     "         endif
+"     "         if c == "\<CR>"
+"     "             break
+"     "         endif
+"     "         let str = str.c
+"     "         echomsg msg.str
+"     "     else
+"     "         break
+"     "     endif
+"     " endwhile
+"     return str
+" endfunction
  
 
 " Paste a certain item from the yankring
 
 " Clears the yankring by simply setting the # of items in it to 0.
 " There is no need physically unlet each variable.
-function! s:YRInit()
+function! s:YRInit(...)
     let s:yr_next_idx              = 0
     let s:yr_last_paste_idx        = 0
     let s:yr_count                 = 0
     " reset prior to issuing the YRReplace
     let s:yr_prev_vis_mode         = 0
 
-    if g:yankring_persist == 0
+    if a:0 == 0 && g:yankring_persist == 0
         " The user wants the yankring reset each time Vim is started
         call s:YRClear()
     endif
 " There is no need physically unlet each variable.
 function! s:YRClear()
     call s:YRReset()
-    call s:YRInit()
+    call s:YRInit('DoNotClear')
 
     " If the yankring window is open, refresh it
     call s:YRWindowUpdate()
 " Determine which register the user wants to use
 " For example the 'a' register:  "ayy
 function! s:YRRegister()
-    let user_register = v:register
+    " v:register can be blank in some (unknown) cases
+    " so test for this condition and return the 
+    " default register
+    let user_register = ((v:register=='')?('"'):(v:register))
     if &clipboard == 'unnamed' && user_register == '"'
         let user_register = '+'
     endif
         let register = ((a:1 == '') ? register : a:1)
     endif
 
-    " v:register can be blank in some cases
-    if v:register == '' || v:register == '_'
+    " v:register can be blank in some (unknown) cases
+    " if v:register == '' || v:register == '_'
+    if v:register == '_'
         " Black hole register, ignore recording the operation
         return ""
     endif
 
+    let register = ((&clipboard=='unnamed')?'+':register)
+
     " let s:yr_prev_changenr    = changenr()
     if register == '"'
         " If the change has occurred via an omap, we must delay
                 \ , getregtype(register) 
                 \ )
 
+    if register =~ '[+*]'
+        let s:yr_prev_clipboard = @+
+    endif
+
     " If the yankring window is open, refresh it
     call s:YRWindowUpdate()
 
 
 " Adds this value to the yankring.
 function! YRRecord3() 
-    " v:register can be blank in some cases
-    if v:register == '' || v:register == '_'
+    let register = '"'
+
+    " v:register can be blank in some (unknown) cases
+    " if v:register == '' || v:register == '_'
+    if v:register == '_'
         " Black hole register, ignore recording the operation
         return ""
     endif
 
-    if v:register == '"'
+    let register = ((&clipboard=='unnamed')?'+':register)
+
+    if register == '"'
         " If the change has occurred via an omap, we must delay
         " the capture of the default register until this event
         " since register updates are not reflected until the 
     " Add item to list
     " This will also account for duplicates.
     call s:YRMRUAdd( 's:yr_history_list'
-                \ , getreg(v:register)
-                \ , getregtype(v:register) 
+                \ , getreg(register)
+                \ , getregtype(register) 
                 \ )
 
+    if register =~ '[+*]'
+        let s:yr_prev_clipboard = @+
+    endif
+
     " If the yankring window is open, refresh it
     call s:YRWindowUpdate()
 
         return
     endif
     
+
     let user_register  = s:YRRegister()
     let default_buffer = ((&clipboard == 'unnamed')?'+':'"')
     let v_count        = v:count
     " register
     if user_register != default_buffer
         if a:replace_last_paste_selection == 1
-            echomsg 'YR: A register cannot be specified in replace mode'
+            call s:YRWarningMsg( 'YR: A register cannot be specified in replace mode' )
             return
         else
             " Check for the expression register, in this special case
     " So if they pressed [yt ] (yank to space) and hit paste, the yankring
     " would not have the word in it, so assume they want the word pasted.
     if a:replace_last_paste_selection != 1 
-        if s:yr_count > 0
+        if s:yr_count > 0 || (default_buffer == '+' && len(@+) == 0)
             " Only check the default buffer is the user wants us to.
             " This was necessary prior to version 4.0 since we did not 
             " capture as many items as 4.0 and above does. (A. Budden)
         endif
     endif
 
-    if s:yr_count == 0
-        echomsg 'YR: yankring is empty'
+    if s:yr_count == 0 || (default_buffer == '+' && len(@+) == 0)
         " Nothing to paste
         return
     endif
         let end = line("']")
 
         if start != line('.')
-            echomsg 'YR: You must paste text first, before you can replace'
+            call s:YRWarningMsg( 'YR: You must paste text first, before you can replace' )
             return
         endif
 
 endfunction
  
 
-" Create the default maps
+" Handle any omaps
 function! YRMapsExpression(sid, motion, ...)
     let cmds     = a:motion
+    " echomsg "YRMapsE:".localtime()
+    " echomsg "YRMapsE 1:".cmds.":".v:operator.":".s:yr_maps_created_zap
 
-    if a:motion == "." && s:yr_remove_omap_dot == 1
+    if  (a:motion =~ '\.' && s:yr_remove_omap_dot == 1) || a:motion =~ '@'
         " If we are repeating a series of commands we must
         " unmap the _zap_ keys so that the user is not
         " prompted when a command is replayed.
-        " These maps we be re-instated in YRRecord3()
+        " These maps must be re-instated in YRRecord3()
         " after the action of the replay is completed.
         call s:YRMapsDelete('remove_only_zap_keys')
     endif
 
     " Check if we are in operator-pending mode
-    if cmds =~ '\('.substitute(g:yankring_zap_keys, ' ', '\\|', 'g').'\)'
-        if cmds =~ '\(/\|?\)'
+    if a:motion =~ '\('.substitute(g:yankring_zap_keys, ' ', '\\|', 'g').'\)'
+        if a:motion =~ '\(/\|?\)'
             let zapto = (a:0==0 ? "" : input("YR:Enter string:"))
             if zapto != ""
                 let zapto = zapto . "\<CR>"
 
         if zapto == "\<C-C>"
             " Abort if the user hits Control C
-            echomsg "YR:Aborting command:".v:operator.a:motion
+            call s:YRWarningMsg( "YR:Aborting command:".v:operator.a:motion )
             return "\<C-C>"
         endif
 
     if ' \('.escape(join(split(g:yankring_ignore_operator), '\|'), '/.*~$^[]' ).'\) ' !~ escape(v:operator, '/.*~$^[]') 
         " Check if we are performing an action that will
         " take us into insert mode
-        if '[cCsS]' !~ escape(v:operator, '/.*~$^[]')
+        if '[cCsS]' !~ escape(v:operator, '/.*~$^[]') && a:motion !~ '@'
+        " if '[cCsS]' !~ escape(v:operator, '/.*~$^[]')
             " If we have not entered insert mode, feed the call
             " to record the current change when the function ends.
             " This is necessary since omaps do not update registers
         endif
     endif
 
-    " echo cmds
+    " echomsg "YRMapsE 5:".a:motion.":'".cmds."':".s:yr_maps_created_zap
     return cmds
  
 endfunction
  
 
+" Handle any the @
+function! s:YRMapsMacro(bang, ...) range
+    " If we are repeating a series of commands we must
+    " unmap the _zap_ keys so that the user is not
+    " prompted when a command is replayed.
+    " These maps must be re-instated in YRRecord3()
+    " after the action of the replay is completed.
+    call s:YRMapsDelete('remove_only_zap_keys')
+
+    " let zapto = (a:0==0 ? "" : s:YRGetChar())
+    let zapto = s:YRGetChar()
+
+    if zapto == "\<C-C>"
+        " Abort if the user hits Control C
+        call s:YRWarningMsg( "YR:Aborting command:".v:operator.a:motion )
+        return ""
+    endif
+
+    let v_count    = v:count
+    " If no count was specified it will have a value of 0
+    " so set it to at least 1
+    let v_count = ((v_count > 0)?(v_count):'')
+
+    let range = ''
+    if a:firstline != a:lastline
+        let rannge = a:firstline.','.a:lastline
+    endif
+
+    let cmd = range."normal! ".v_count.'@'.zapto
+    " DEBUG
+    " echomsg cmd
+    exec cmd
+
+    call s:YRMapsCreate('add_only_zap_keys')
+endfunction
+ 
+
 " Create the default maps
 function! s:YRMapsCreate(...)
-    " 7.1.patch205 introduces the v:operator function which was essential
-    " to gain the omap support.
+    " 7.1.patch205 introduces the v:operator function which was 
+    " essential to gain the omap support.
     if s:yr_has_voperator == 1
         let s:yr_remove_omap_dot   = 1
         for key in split(g:yankring_zap_keys)
             try
-                exec 'omap <expr>' key 'YRMapsExpression("<SID>","'. key. '", 1)'
+                if key != '@'
+                    exec 'omap <expr>' key 'YRMapsExpression("<SID>", "'. key. '", 1)'
+                endif
             catch
             endtry
         endfor
     endif
 
+    silent! nmap <expr> @ YRMapsExpression("<SID>", "@", "1")
+
+    let s:yr_maps_created_zap = 1
+
     if a:0 > 0
         " We have only removed the _zap_ keys temporarily
         " so abandon further changes.
         let o_maps = split(g:yankring_o_keys)
         " Loop through and prompt the user for all buffer connection parameters.
         for key in o_maps
-            exec 'omap <expr>' key 'YRMapsExpression("<SID>","'. escape(key,'\"'). '")'
+            exec 'omap <expr>' key 'YRMapsExpression("<SID>", "'. escape(key,'\"'). '")'
         endfor
     endif
 
             nnoremap <silent> . :<C-U>YRYankCount '.'<CR>
         endif
     endif
+
     if g:yankring_v_key != ''
         exec 'xnoremap <silent>'.g:yankring_v_key." :YRYankRange 'v'<CR>"
     endif
         exec 'nnoremap <silent>'.g:yankring_replace_n_nkey." :<C-U>YRReplace '1', 'p'<CR>"
     endif
 
-    let g:yankring_enabled = 1
+    let g:yankring_enabled    = 1
+    let s:yr_maps_created     = 1
 endfunction
  
 
     let o_maps = split(g:yankring_zap_keys)
     for key in o_maps
         try
-            silent! exec 'ounmap' key
+            if key != '@'
+                silent! exec 'ounmap' key
+            endif
         catch
         endtry
     endfor
 
+    let s:yr_maps_created_zap = 0
+
     if a:0 > 0
         " We have only removed the _zap_ keys temporarily
         " so abandon further changes.
         exec 'nunmap '.g:yankring_replace_n_nkey
     endif
 
-    let g:yankring_enabled = 0
+    let g:yankring_enabled    = 0
+    let s:yr_maps_created     = 0
 endfunction
 
 function! s:YRGetValElemNbr( position, type )
     return len({a:mru_list})
 endfunction
 
+function! s:YRMRUElemFormat( element, element_type )
+    let elem    = a:element
+    if g:yankring_max_element_length != 0
+        let elem    = strpart(a:element, 0, g:yankring_max_element_length)
+    endif
+    if s:yr_history_version == 'v1'
+        let elem    = escape(elem, '@')
+        let elem    = substitute(elem, "\n", s:yr_history_v1_nl, 'g')
+    else
+        let elem    = substitute(elem, "\n", s:yr_history_v2_nl, 'g')
+    endif
+    " Append the regtype to the end so we have it available
+    let elem    = elem.",".a:element_type
+
+    return elem
+endfunction
+
 function! s:YRMRUHas( mru_list, find_str )
     " This function will find a string and return the element #
     let find_idx = index({a:mru_list}, a:find_str)
     " Only add new items if they do not already exist in the MRU.
     " If the item is found, move it to the start of the MRU.
     let found   = -1
-    let elem    = a:element
-    if g:yankring_max_element_length != 0
-        let elem    = strpart(a:element, 0, g:yankring_max_element_length)
+    " let elem    = a:element
+    " if g:yankring_max_element_length != 0
+    "     let elem    = strpart(a:element, 0, g:yankring_max_element_length)
+    " endif
+    " if s:yr_history_version == 'v1'
+    "     let elem    = escape(elem, '@')
+    "     let elem    = substitute(elem, "\n", s:yr_history_v1_nl, 'g')
+    " else
+    "     let elem    = substitute(elem, "\n", s:yr_history_v2_nl, 'g')
+    " endif
+    " " Append the regtype to the end so we have it available
+    " let elem    = elem.",".a:element_type
+
+    if strlen(a:element) < g:yankring_min_element_length
+        return 1
     endif
-    if s:yr_history_version == 'v1'
-        let elem    = escape(elem, '@')
-        let elem    = substitute(elem, "\n", s:yr_history_v1_nl, 'g')
-    else
-        let elem    = substitute(elem, "\n", s:yr_history_v2_nl, 'g')
-    endif
-    " Append the regtype to the end so we have it available
-    let elem    = elem.",".a:element_type
+
+    let elem = s:YRMRUElemFormat(a:element, a:element_type)
 
     " Refresh the List
     call s:YRHistoryRead()
 
     let msg = 'AutoClose='.g:yankring_window_auto_close.
                 \ ';ClipboardMonitor='.g:yankring_clipboard_monitor.
-                \ ';Cmds:<enter>,[g]p,[p]P,d,r,s,a,c,u,q,<space>;Help=?'.
+                \ ';Cmds:<enter>,[g]p,[g]P,d,r,s,a,c,u,q,<space>;Help=?'.
                 \ (s:yr_search==""?"":';SearchRegEx='.s:yr_search)
 
     if s:yr_has_voperator == 0
     let s:yr_buffer_last_winnr = winnr()
 
     if bufwinnr(s:yr_buffer_id) == -1
-
         if g:yankring_window_use_horiz == 1
             if g:yankring_window_use_bottom == 1
                 let location = 'botright'
             else
                 let location = 'topleft'
+                " Creating the new window will offset all other
+                " window numbers.  Account for that so we switch
+                " back to the correct window.
+                let s:yr_buffer_last_winnr = s:yr_buffer_last_winnr + 1
             endif
             let win_size = g:yankring_window_height
         else
                         \ &columns < (80 + g:yankring_window_width)
                 " one extra column is needed to include the vertical split
                 let &columns             = &columns + g:yankring_window_width + 1
-                let s:yankring_winsize_chgd = 1
+                let s:yr_winsize_chgd = 1
             else
-                let s:yankring_winsize_chgd = 0
+                let s:yr_winsize_chgd = 0
             endif
 
             if g:yankring_window_use_right == 1
             else
                 " Open the window at the leftmost place
                 let location = 'topleft vertical'
+                " Creating the new window will offset all other
+                " window numbers.  Account for that so we switch
+                " back to the correct window.
+                let s:yr_buffer_last_winnr = s:yr_buffer_last_winnr + 1
             endif
             let win_size = g:yankring_window_width
         endif
         " from being changed.
         exec ":e " . escape(s:yr_buffer_name, ' ')
         " Save buffer id
-        let s:yr_buffer_id = bufnr('%')
+        let s:yr_buffer_id = bufnr('%') + 0
     else
         " If the buffer is visible, switch to it
-        exec bufwinnr(s:yr_buffer_name) . "wincmd w"
+        exec bufwinnr(s:yr_buffer_id) . "wincmd w"
     endif
 
     " Perform a double check to ensure we have entered the correct
     " buffer since we don't want to do the %d_ in the wrong buffer!
-    if bufnr('%') != s:yr_buffer_id
+    if (bufnr('%') + 0) != s:yr_buffer_id
         call s:YRWarningMsg(
                     \ "YR:Failed to change to the yankring buffer, please contact author id:".
                     \ s:yr_buffer_id.
     " Display the contents of the yankring
     silent! put =a:results
 
-    " Erase last blank line
-    silent! exec '$delete _'
+    if getline('$') == ''
+        " Erase last blank line
+        silent! exec '$delete _'
+    endif
 
     " Move the cursor to the first line with an element
     exec 0
     if g:yankring_window_auto_close == 1 && v_count == 0 && a:op != 'd'
         " If autoclose is set close the window unless 
         " you are removing items from the YankRing
-        exec 'bdelete '.bufnr(s:yr_buffer_name)
+        exec 'bdelete '.s:yr_buffer_id
         return "" 
     endif
 
 
     if opcode ==# 'q'
         " Close the yankring window
-        if s:yankring_winsize_chgd == 1
+        if s:yr_winsize_chgd == 1
             " Adjust the Vim window width back to the width
             " it was before we showed the yankring window
             let &columns= &columns - (g:yankring_window_width)
         endif
 
         if g:yankring_window_auto_close == 1 && cmd_mode == 'v'
-            exec 'bdelete '.bufnr(s:yr_buffer_name)
+            exec 'bdelete '.s:yr_buffer_id
             return "" 
         endif
 
 function! s:YRFocusGained()
     if g:yankring_clipboard_monitor == 1
         " If the clipboard has changed record it inside the yankring
+        " echomsg "YRFocusGained[".len(@+)."][".@+.']['.s:yr_prev_clipboard.']'
         if len(@+) > 0 && @+ != s:yr_prev_clipboard
-            silent! call YRRecord("+")
-            let s:yr_prev_clipboard = @+
+            let elem    = s:YRMRUElemFormat( 
+                        \   getreg('+')
+                        \ , getregtype('+') 
+                        \ )
+            let found   = s:YRMRUHas('s:yr_history_list', elem)
+
+            " Only add the item to the "top" of the ring if it is
+            " not in the ring already.
+            if found == -1
+                call YRRecord("+")
+                " silent! call YRRecord("+")
+            endif
         endif
 
         " If the yankring window is open, refresh it
 " Call YRFocusGained to check if the clipboard has been updated
 augroup YankRing
     autocmd!
+    autocmd VimEnter    * :if has('clipboard') | call <SID>YRFocusGained() | endif
     autocmd WinLeave    * :call <SID>YRWinLeave()
     autocmd FocusGained * :if has('clipboard') | call <SID>YRFocusGained() | endif
     autocmd InsertLeave * :call <SID>YRInsertLeave()
 
 " copy register
 inoremap <script> <SID>YRGetChar <c-r>=YRGetChar()<CR>
-inoremap <script> <SID>YRGetSearch <c-r>=YRGetSearch()<CR>
+" inoremap <script> <SID>YRGetSearch <c-r>=YRGetSearch()<CR>
 nnoremap <silent> <SID>yrrecord :call YRRecord3()<cr>
 inoremap <silent> <SID>yrrecord <C-R>=YRRecord3()<cr>
 
 command!                  -nargs=? YRToggle       call s:YRToggle(<args>)
 command! -count -register -nargs=* YRYankCount    call s:YRYankCount(<args>)
 command! -range -bang     -nargs=? YRYankRange    <line1>,<line2>call s:YRYankRange(<bang>0, <args>)
+" command! -range -bang     -nargs=0 YRMapsMacro    <line1>,<line2>call s:YRMapsMacro(<bang>0, <args>)
 
 " Menus 
 if has("gui_running") && has("menu") && g:yankring_default_menu_mode != 0
 
 call s:YRInit()
 call s:YRHistoryRead()
-      
 
 " vim:fdm=marker:nowrap:ts=4:expandtab:

snippets/css.snippets

 # HTML         : <h1 id="image">Image Replacement Technique</h1>
 # Trigger Desc : s for Seamus or Stuart
 snippet =irs
-	${1:#image} {background: url(${2}) no-repeat; height: 0 !important; overflow: hidden; padding-top: ${3:0}px; width: ${4:0}px}
+	${1:#image} {height: 0 !important; overflow: hidden; padding-top: ${2:0}px; width: ${3:0}px; background: url(${4}) no-repeat}
 #
 # Author       : Leon Dwyer
 # Issues       : Doesn't solve images off/css on, still requires extra span.
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Maintainer: ragingmon
-"             http://ragingfx.com - ragingmon@gmail.com
-"
+"             http://ragingfx.com - ragingmon@gmail.com "
 " Totally_inspired_by:
 "             http://amix.dk  - amix@amix.dk
 "             http://amix.dk/blog/post/19486#The-ultimate-vim-configuration-vimrc
 map <silent> <leader>y  :YRShow<CR>
 let g:yankring_history_dir  = '~/'
 let g:yankring_history_file = '.vim-yankring'
+let g:yankring_min_element_length = 2
 
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " => NERDtree