1
0
Fork 0
mirror of synced 2024-11-22 08:45:34 -05:00

Made ir-black the default color scheme

Switched away from using gui tabs and made some changes to the default text tab via set_tabline.vim plugin.

Added a new mapping <leader>t<leader> that can open a specific tab number.
This commit is contained in:
amix 2012-07-02 18:57:21 -04:00
parent f43b19edf3
commit 3c8e295105
8 changed files with 160 additions and 276 deletions

3
.gitmodules vendored
View file

@ -47,9 +47,6 @@
[submodule "sources_colors/vim-colors-solarized"] [submodule "sources_colors/vim-colors-solarized"]
path = sources_colors/vim-colors-solarized path = sources_colors/vim-colors-solarized
url = git://github.com/altercation/vim-colors-solarized.git url = git://github.com/altercation/vim-colors-solarized.git
[submodule "sources_colors/vim-irblack"]
path = sources_colors/vim-irblack
url = git://github.com/wgibbs/vim-irblack.git
[submodule "sources_colors/mayansmoke"] [submodule "sources_colors/mayansmoke"]
path = sources_colors/mayansmoke path = sources_colors/mayansmoke
url = git://github.com/vim-scripts/mayansmoke.git url = git://github.com/vim-scripts/mayansmoke.git

View file

@ -595,6 +595,10 @@ hi link CalToday PreProc
hi link MyTagListTagName IncSearch hi link MyTagListTagName IncSearch
hi link MyTagListTagScope Constant hi link MyTagListTagScope Constant
hi TabLineFill guifg=#9098a0 guibg=#111111
hi TabLine guifg=black guibg=#888888
hi TabLineSel guifg=white guibg=#202020 gui=bold
" COLOR LINKS DEFINE END " COLOR LINKS DEFINE END
" vim:et:nosta:sw=2:ts=8: " vim:et:nosta:sw=2:ts=8:

View file

@ -0,0 +1,30 @@
function! CustomizedTabLine()
let s = ''
let t = tabpagenr()
let i = 1
while i <= tabpagenr('$')
let buflist = tabpagebuflist(i)
let winnr = tabpagewinnr(i)
let s .= '%' . i . 'T'
let s .= (i == t ? '%1*' : '%2*')
let s .= ' '
let s .= i . ':'
let s .= '%*'
let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#')
let file = bufname(buflist[winnr - 1])
let file = fnamemodify(file, ':p:t')
if file == ''
let file = '[No Name]'
endif
let s .= file
let s .= ' '
let i = i + 1
endwhile
let s .= '%T%#TabLineFill#%='
let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
return s
endfunction
" Always show the tablilne
set stal=2
set tabline=%!CustomizedTabLine()

View file

@ -1,13 +1,11 @@
*yankring.txt* For Vim version 7.0. *yankring.txt* For Vim version 7.0.
Author: David Fishburn September 16, 2011 Author: David Fishburn August 29, 2009
Version: 12.0 Version: 10.0
For instructions on installing this file, type For instructions on installing this file, type
:help add-local-help |add-local-help| inside Vim. :help add-local-help |add-local-help| inside Vim.
Homepage: http://vim.sourceforge.net/script.php?script_id=1234
============================================================================== ==============================================================================
1. Contents *yankring* *yankring-contents* 1. Contents *yankring* *yankring-contents*
@ -18,7 +16,6 @@ Homepage: http://vim.sourceforge.net/script.php?script_id=1234
3.1 Global Variables...................: |yankring-globals| 3.1 Global Variables...................: |yankring-globals|
3.2 Default Keys.......................: |yankring-mappings| 3.2 Default Keys.......................: |yankring-mappings|
3.3 Customizing Maps...................: |yankring-custom-maps| 3.3 Customizing Maps...................: |yankring-custom-maps|
3.4 Customizing Menus..................: |yankring-custom-menus|
4. Using the YankRing Window..............: |yankring-window| 4. Using the YankRing Window..............: |yankring-window|
5. Commands...............................: |yankring-commands| 5. Commands...............................: |yankring-commands|
5.1 YRToggle..........................: |YRToggle| 5.1 YRToggle..........................: |YRToggle|
@ -49,7 +46,6 @@ Homepage: http://vim.sourceforge.net/script.php?script_id=1234
6.12 YRSearch..........................: |YRSearch-example| 6.12 YRSearch..........................: |YRSearch-example|
7. History................................: |yankring-history| 7. History................................: |yankring-history|
============================================================================== ==============================================================================
2. Description *yankring-description* 2. Description *yankring-description*
@ -82,7 +78,6 @@ always welcome.
For details on the changes between versions see |yankring-history|. For details on the changes between versions see |yankring-history|.
============================================================================== ==============================================================================
3. Configuration *yankring-configure* 3. Configuration *yankring-configure*
@ -274,33 +269,6 @@ your |.vimrc|.
no way to noticing. To disable this feature you can put the following no way to noticing. To disable this feature you can put the following
in your |vimrc| > in your |vimrc| >
let g:yankring_paste_check_default_buffer = 0 let g:yankring_paste_check_default_buffer = 0
yankring_default_menu_mode
< - Menus are useful for a number of reasons:
See a list of available commands.
Remember what the shortcut maps are.
Have a floating menu when using the plugin a lot.
Quick reference guide.
There are four settings that will control the placement
of the menu:
"0": Turns the menu off.
"1": Turns the 'Yankring' menu on with no menu shortcut.
"2": Turns the 'Yankring 'menu on with <alt>-y as the shortcut.
"3": Turns the 'Plugin -> YankRing' menu on with <alt>-y as
the shortcut.
This option defaults to a value of 3 and can be changed
by adding the following to your vimrc: >
:let g:yankring_default_menu_mode = 3
yankring_menu_root
< - Can be used in conjuction with g:yankring_default_menu_mode = 3 but
it also allows you to control the fullname and location of the
YankRing menu. To create the menu: 'MyPlugins -> YankRing' you
can create the following variable: >
:let g:yankring_menu_root = 'MyPlugin.&YankRing'
yankring_menu_priority
< - Menus are created in a documented order by Vim (|menu-priority|).
This option allows you to override the setting and shift the
YankRing menu item to the left between the Edit and Tools menu. >
:let g:yankring_menu_priority = 30
< <
3.2 Default Keys *yankring-mappings* 3.2 Default Keys *yankring-mappings*
@ -498,15 +466,6 @@ You can do anything you need in this function. >
This line remaps Y (which the user presses) to the YRYankCount command. The This line remaps Y (which the user presses) to the YRYankCount command. The
YRYankCount tells Vim to execute y$ instead. YRYankCount tells Vim to execute y$ instead.
3.4 Customizing Menus *yankring-custom-menus*
There are several global variables which can be created in your vimrc to
allow you to customize where and what is displayed for the YankRing menu.
Simply look up the following global variables: >
yankring_default_menu_mode
yankring_menu_root
yankring_menu_priority
============================================================================== ==============================================================================
4. Using the YankRing Window: *yankring-window* 4. Using the YankRing Window: *yankring-window*
@ -568,6 +527,8 @@ in the YankRing window.
? Toggles the display of the help. ? Toggles the display of the help.
============================================================================== ==============================================================================
5. Commands: *yankring-commands* 5. Commands: *yankring-commands*
@ -1170,30 +1131,6 @@ mapping: >
============================================================================== ==============================================================================
7. History *yankring-history* 7. History *yankring-history*
12.0: September 16, 2011
NF: Added support for the clipboard option "unnamedplus" which was
added after 7.3 (Hong Xu).
NF: When displaying the YankRing using YRShow, a new command "R"
has been added to display all of Vim's registers [0-9a-z].
BF: YRMapsDelete did not remove the normal mode @ map, which
interfers with recorded macros (Philippe Vaucher ).
11.0: August 09, 2010
NF: Documented the global variables to customize the location
of the YankRing menu.
NF: The YankRing menu now shows the maps used for the default
actions to help learn them more easily.
NF: Added g:yankring_menu_root and g:yankring_menu_priority
(David Barsam).
NF: Added a warning indicating a stored value has been truncated
based on g:yankring_max_element_length and a new option to
suppress this warning, g:yankring_warn_on_truncate (Hans-Günter).
BF: The YRAfterMaps() function (if it exists) was not re-run if
YRToggle was used to disable and enable the YankRing.
BF: Multibyte strings may not have been pasted correctly (Dr. Chip).
BF: When pasting a string of 1111's, and additional -1 could also
be included in the output.
10.0: January 31, 2010 10.0: January 31, 2010
NF: Change the buffer name to [YankRing] to resemble other NF: Change the buffer name to [YankRing] to resemble other
non-user buffers. non-user buffers.

View file

@ -1,8 +1,8 @@
" yankring.vim - Yank / Delete Ring for Vim " yankring.vim - Yank / Delete Ring for Vim
" --------------------------------------------------------------- " ---------------------------------------------------------------
" Version: 12.0 " Version: 10.0
" Authors: David Fishburn <dfishburn.vim@gmail.com> " Authors: David Fishburn <dfishburn.vim@gmail.com>
" Last Modified: 2011 Jun 14 " Last Modified: 2010 Jan 24
" Script: http://www.vim.org/scripts/script.php?script_id=1234 " Script: http://www.vim.org/scripts/script.php?script_id=1234
" Based On: Mocked up version by Yegappan Lakshmanan " Based On: Mocked up version by Yegappan Lakshmanan
" http://groups.yahoo.com/group/vim/post?act=reply&messageNum=34406 " http://groups.yahoo.com/group/vim/post?act=reply&messageNum=34406
@ -18,7 +18,7 @@ if v:version < 700
finish finish
endif endif
let loaded_yankring = 120 let loaded_yankring = 100
let s:yr_has_voperator = 0 let s:yr_has_voperator = 0
if v:version > 701 || ( v:version == 701 && has("patch205") ) if v:version > 701 || ( v:version == 701 && has("patch205") )
@ -52,11 +52,6 @@ if !exists('g:yankring_max_element_length')
let g:yankring_max_element_length = 1048576 let g:yankring_max_element_length = 1048576
endif endif
" Warn if truncation occurs
if !exists('g:yankring_warn_on_truncate')
let g:yankring_warn_on_truncate = 1
endif
" Allow the user to specify if the plugin is enabled or not " Allow the user to specify if the plugin is enabled or not
if !exists('g:yankring_enabled') if !exists('g:yankring_enabled')
let g:yankring_enabled = 1 let g:yankring_enabled = 1
@ -328,11 +323,6 @@ function! s:YRShow(...)
let toggle = matchstr(a:1, '\d\+') let toggle = matchstr(a:1, '\d\+')
endif endif
let show_registers = 0
if a:0 > 1 && a:2 ==# 'R'
let show_registers = 1
endif
if toggle == 1 if toggle == 1
if bufwinnr(s:yr_buffer_id) > -1 if bufwinnr(s:yr_buffer_id) > -1
" If the YankRing window is already open close it " If the YankRing window is already open close it
@ -361,9 +351,9 @@ function! s:YRShow(...)
" show the contents (or when it is refreshed). " show the contents (or when it is refreshed).
if g:yankring_paste_check_default_buffer == 1 if g:yankring_paste_check_default_buffer == 1
let save_reg = 0 let save_reg = 0
let register = ((&clipboard=~'unnamed')?'+':'"') let register = ((&clipboard=='unnamed')?'+':'"')
if &clipboard =~ 'unnamed' && getreg('+') != s:yr_prev_clipboard if &clipboard == 'unnamed' && getreg('+') != s:yr_prev_clipboard
let save_reg = 1 let save_reg = 1
endif endif
if register == '"' && getreg('"') != s:yr_prev_reg_unnamed if register == '"' && getreg('"') != s:yr_prev_reg_unnamed
@ -381,23 +371,14 @@ function! s:YRShow(...)
" List is shown in order of replacement " List is shown in order of replacement
" assuming using previous yanks " assuming using previous yanks
let output = "--- YankRing ---\n" let output = "--- YankRing ---\n"
let output = output . (show_registers == 1 ? 'Reg ' : 'Elem')." Content\n" let output = output . "Elem Content\n"
if show_registers == 1 call s:YRHistoryRead()
for reg_name in map( range(char2nr('0'), char2nr('9')) + let disp_item_nr = 1
\ (range(char2nr('a'), char2nr('z'))) for elem in s:yr_history_list
\, 'nr2char(v:val)' let output = output . s:YRDisplayElem(disp_item_nr, elem) . "\n"
\ ) let disp_item_nr += 1
let output = output . s:YRDisplayElem(reg_name, getreg(reg_name).',') . "\n" endfor
endfor
else
call s:YRHistoryRead()
let disp_item_nr = 1
for elem in s:yr_history_list
let output = output . s:YRDisplayElem(disp_item_nr, elem) . "\n"
let disp_item_nr += 1
endfor
endif
if g:yankring_window_use_separate == 1 if g:yankring_window_use_separate == 1
call s:YRWindowOpen(output) call s:YRWindowOpen(output)
@ -457,7 +438,7 @@ function! s:YRGetElem(...)
return -1 return -1
endif endif
let default_buffer = ((&clipboard=~'unnamed')?'+':'"') let default_buffer = ((&clipboard=='unnamed')?'+':'"')
let direction = 'p' let direction = 'p'
if a:0 > 1 if a:0 > 1
@ -502,7 +483,7 @@ function! s:YRGetElem(...)
return -1 return -1
endif endif
let default_buffer = ((&clipboard=~'unnamed')?'+':'"') let default_buffer = ((&clipboard=='unnamed')?'+':'"')
call setreg(default_buffer call setreg(default_buffer
\ , s:YRGetValElemNbr((elem), 'v') \ , s:YRGetValElemNbr((elem), 'v')
\ , s:YRGetValElemNbr((elem), 't') \ , s:YRGetValElemNbr((elem), 't')
@ -651,7 +632,7 @@ endfunction
" Resets the common script variables for managing the ring. " Resets the common script variables for managing the ring.
function! s:YRReset() function! s:YRReset()
call s:YRHistoryDelete() let s:yr_history_list = []
" Update the history file " Update the history file
call s:YRHistorySave() call s:YRHistorySave()
endfunction endfunction
@ -715,7 +696,7 @@ function! s:YRRegister()
" so test for this condition and return the " so test for this condition and return the
" default register " default register
let user_register = ((v:register=='')?('"'):(v:register)) let user_register = ((v:register=='')?('"'):(v:register))
if &clipboard =~ 'unnamed' && user_register == '"' if &clipboard == 'unnamed' && user_register == '"'
let user_register = '+' let user_register = '+'
endif endif
return user_register return user_register
@ -737,7 +718,7 @@ function! s:YRPush(...)
" If we are pushing something on to the yankring, add it to " If we are pushing something on to the yankring, add it to
" the default buffer as well so the next item pasted will " the default buffer as well so the next item pasted will
" be the item pushed " be the item pushed
let default_buffer = ((&clipboard=~'unnamed')?'+':'"') let default_buffer = ((&clipboard=='unnamed')?'+':'"')
call setreg(default_buffer, getreg(user_register), call setreg(default_buffer, getreg(user_register),
\ getregtype(user_register)) \ getregtype(user_register))
@ -800,7 +781,7 @@ function! YRRecord(...)
return "" return ""
endif endif
let register = ((&clipboard=~'unnamed')?'+':register) let register = ((&clipboard=='unnamed')?'+':register)
" let s:yr_prev_changenr = changenr() " let s:yr_prev_changenr = changenr()
if register == '"' if register == '"'
@ -823,16 +804,14 @@ function! YRRecord(...)
let s:yr_prev_clipboard = @+ let s:yr_prev_clipboard = @+
endif endif
" Manage the numbered registers
if g:yankring_manage_numbered_reg == 1
" Allow the user to define an autocmd to dynamically
" setup their connection information.
silent! doautocmd User YRSetNumberedReg
endif
" If the yankring window is open, refresh it " If the yankring window is open, refresh it
call s:YRWindowUpdate() call s:YRWindowUpdate()
" Manage the numbered registers
if g:yankring_manage_numbered_reg == 1
call s:YRSetNumberedReg()
endif
return "" return ""
endfunction endfunction
@ -848,7 +827,7 @@ function! YRRecord3()
return "" return ""
endif endif
let register = ((&clipboard=~'unnamed')?'+':register) let register = ((&clipboard=='unnamed')?'+':register)
if register == '"' if register == '"'
" If the change has occurred via an omap, we must delay " If the change has occurred via an omap, we must delay
@ -874,16 +853,14 @@ function! YRRecord3()
let s:yr_prev_clipboard = @+ let s:yr_prev_clipboard = @+
endif endif
" Manage the numbered registers
if g:yankring_manage_numbered_reg == 1
" Allow the user to define an autocmd to dynamically
" setup their connection information.
silent! doautocmd User YRSetNumberedReg
endif
" If the yankring window is open, refresh it " If the yankring window is open, refresh it
call s:YRWindowUpdate() call s:YRWindowUpdate()
" Manage the numbered registers
if g:yankring_manage_numbered_reg == 1
call s:YRSetNumberedReg()
endif
return "" return ""
endfunction endfunction
@ -1035,27 +1012,19 @@ endfunction
" Manages the Vim's numbered registers " Manages the Vim's numbered registers
function! s:YRSetNumberedReg() function! s:YRSetNumberedReg()
let i = 0 let i = 1
while i <= 10 while i <= 10
if i > s:yr_count if i > s:yr_count
break break
endif endif
call setreg( (i) call setreg( (i-1)
\ , s:YRGetValElemNbr((i),'v') \ , s:YRGetValElemNbr((i-1),'v')
\ , s:YRGetValElemNbr((i),'t') \ , s:YRGetValElemNbr((i-1),'t')
\ ) \ )
let i += 1 let i += 1
endwhile endwhile
" There are a few actions that Vim automatically takes
" when modifying the numbered registers.
" Modifying register 1 - changes the named register.
" It is impossible to set register 2 to a value, since Vim will change it.
" This will at least preserve the default register
let @" = @0
endfunction endfunction
@ -1159,7 +1128,7 @@ endfunction
function! s:YRYankRange(do_delete_selection, ...) range function! s:YRYankRange(do_delete_selection, ...) range
let user_register = s:YRRegister() let user_register = s:YRRegister()
let default_buffer = ((&clipboard=~'unnamed')?'+':'"') let default_buffer = ((&clipboard=='unnamed')?'+':'"')
" Default command mode to normal mode 'n' " Default command mode to normal mode 'n'
let cmd_mode = 'n' let cmd_mode = 'n'
@ -1216,7 +1185,7 @@ function! s:YRPaste(replace_last_paste_selection, nextvalue, direction, ...)
let user_register = s:YRRegister() let user_register = s:YRRegister()
let default_buffer = ((&clipboard =~ 'unnamed')?'+':'"') let default_buffer = ((&clipboard == 'unnamed')?'+':'"')
let v_count = v:count let v_count = v:count
" Default command mode to normal mode 'n' " Default command mode to normal mode 'n'
@ -1387,7 +1356,7 @@ function! YRMapsExpression(sid, motion, ...)
" echomsg "YRMapsE:".localtime() " echomsg "YRMapsE:".localtime()
" echomsg "YRMapsE 1:".cmds.":".v:operator.":".s:yr_maps_created_zap " echomsg "YRMapsE 1:".cmds.":".v:operator.":".s:yr_maps_created_zap
if (a:motion =~ '\.' && s:yr_remove_omap_dot == 1) || a:motion =~ '@' if (a:motion =~ '\.' && s:yr_remove_omap_dot == 1) || a:motion =~ '@'
" If we are repeating a series of commands we must " If we are repeating a series of commands we must
" unmap the _zap_ keys so that the user is not " unmap the _zap_ keys so that the user is not
" prompted when a command is replayed. " prompted when a command is replayed.
@ -1439,54 +1408,47 @@ function! YRMapsExpression(sid, motion, ...)
endif endif
endif endif
" This will not work since we are already executing an expression
" if a:motion =~ '@'
" let cmds = 'normal! ' . cmds
" endif
" echomsg "YRMapsE 5:".a:motion.":'".cmds."':".s:yr_maps_created_zap " echomsg "YRMapsE 5:".a:motion.":'".cmds."':".s:yr_maps_created_zap
return cmds return cmds
endfunction endfunction
" Handle macros (@). " Handle any the @
" This routine is not used, YRMapsExpression is used to function! s:YRMapsMacro(bang, ...) range
" handle the @ symbol. " If we are repeating a series of commands we must
" function! s:YRMapsMacro(bang, ...) range " unmap the _zap_ keys so that the user is not
" " If we are repeating a series of commands we must " prompted when a command is replayed.
" " unmap the _zap_ keys so that the user is not " These maps must be re-instated in YRRecord3()
" " prompted when a command is replayed. " after the action of the replay is completed.
" " These maps must be re-instated in YRRecord3() call s:YRMapsDelete('remove_only_zap_keys')
" " 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()
" " let zapto = (a:0==0 ? "" : s:YRGetChar())
" let zapto = s:YRGetChar() if zapto == "\<C-C>"
" " Abort if the user hits Control C
" if zapto == "\<C-C>" call s:YRWarningMsg( "YR:Aborting command:".v:operator.a:motion )
" " Abort if the user hits Control C return ""
" call s:YRWarningMsg( "YR:Aborting command:".v:operator.a:motion ) endif
" return ""
" endif let v_count = v:count
" " If no count was specified it will have a value of 0
" let v_count = v:count " so set it to at least 1
" " If no count was specified it will have a value of 0 let v_count = ((v_count > 0)?(v_count):'')
" " so set it to at least 1
" let v_count = ((v_count > 0)?(v_count):'') let range = ''
" if a:firstline != a:lastline
" let range = '' let rannge = a:firstline.','.a:lastline
" if a:firstline != a:lastline endif
" let rannge = a:firstline.','.a:lastline
" endif let cmd = range."normal! ".v_count.'@'.zapto
" " DEBUG
" let cmd = range."normal! ".v_count.'@'.zapto " echomsg cmd
" " DEBUG exec cmd
" " echomsg cmd
" exec cmd call s:YRMapsCreate('add_only_zap_keys')
" endfunction
" call s:YRMapsCreate('add_only_zap_keys')
" endfunction
" Create the default maps " Create the default maps
@ -1587,11 +1549,6 @@ function! s:YRMapsCreate(...)
let g:yankring_enabled = 1 let g:yankring_enabled = 1
let s:yr_maps_created = 1 let s:yr_maps_created = 1
if exists('*YRRunAfterMaps')
" This will allow you to override the default maps if necessary
call YRRunAfterMaps()
endif
endfunction endfunction
@ -1636,78 +1593,83 @@ function! s:YRMapsDelete(...)
endfor endfor
if g:yankring_map_dot == 1 if g:yankring_map_dot == 1
silent! exec "nunmap ." exec "nunmap ."
endif endif
if g:yankring_v_key != '' if g:yankring_v_key != ''
silent! exec 'vunmap '.g:yankring_v_key exec 'vunmap '.g:yankring_v_key
endif endif
if g:yankring_del_v_key != '' if g:yankring_del_v_key != ''
for v_map in split(g:yankring_del_v_key) for v_map in split(g:yankring_del_v_key)
if strlen(v_map) > 0 if strlen(v_map) > 0
try try
silent! exec 'vunmap '.v_map exec 'vunmap '.v_map
catch catch
endtry endtry
endif endif
endfor endfor
endif endif
if g:yankring_paste_n_bkey != '' if g:yankring_paste_n_bkey != ''
silent! exec 'nunmap '.g:yankring_paste_n_bkey exec 'nunmap '.g:yankring_paste_n_bkey
if g:yankring_paste_using_g == 1 if g:yankring_paste_using_g == 1
silent! exec 'nunmap g'.g:yankring_paste_n_bkey exec 'nunmap g'.g:yankring_paste_n_bkey
endif endif
endif endif
if g:yankring_paste_n_akey != '' if g:yankring_paste_n_akey != ''
silent! exec 'nunmap '.g:yankring_paste_n_akey exec 'nunmap '.g:yankring_paste_n_akey
if g:yankring_paste_using_g == 1 if g:yankring_paste_using_g == 1
silent! exec 'nunmap g'.g:yankring_paste_n_akey exec 'nunmap g'.g:yankring_paste_n_akey
endif endif
endif endif
if g:yankring_paste_v_bkey != '' if g:yankring_paste_v_bkey != ''
silent! exec 'vunmap '.g:yankring_paste_v_bkey exec 'vunmap '.g:yankring_paste_v_bkey
endif endif
if g:yankring_paste_v_akey != '' if g:yankring_paste_v_akey != ''
silent! exec 'vunmap '.g:yankring_paste_v_akey exec 'vunmap '.g:yankring_paste_v_akey
endif endif
if g:yankring_replace_n_pkey != '' if g:yankring_replace_n_pkey != ''
silent! exec 'nunmap '.g:yankring_replace_n_pkey exec 'nunmap '.g:yankring_replace_n_pkey
endif endif
if g:yankring_replace_n_nkey != '' if g:yankring_replace_n_nkey != ''
silent! exec 'nunmap '.g:yankring_replace_n_nkey exec 'nunmap '.g:yankring_replace_n_nkey
endif endif
silent! exec 'nunmap @'
let g:yankring_enabled = 0 let g:yankring_enabled = 0
let s:yr_maps_created = 0 let s:yr_maps_created = 0
endfunction endfunction
function! s:YRGetValElemNbr( position, type ) function! s:YRGetValElemNbr( position, type )
let needed_elem = a:position let needed_elem = a:position
" The List which contains the items in the yankring " The List which contains the items in the yankring
" history is also ordered, most recent at the top " history is also ordered, most recent at the top
let elem = s:YRMRUGet('s:yr_history_list', needed_elem) let elem = s:YRMRUGet('s:yr_history_list', needed_elem)
if a:type == 't' if elem >= 0
let elem = matchstr(elem, '^.*,\zs.*$') if a:type == 't'
else return matchstr(elem, '^.*,\zs.*$')
let elem = matchstr(elem, '^.*\ze,.*$')
if s:yr_history_version == 'v1'
" Match three @@@ in a row as long as it is not
" preceeded by a @@@
" v1
let elem = substitute(elem, s:yr_history_v1_nl_pat, "\n", 'g')
let elem = substitute(elem, '\\@', '@', 'g')
else else
let elem = substitute(elem, s:yr_history_v2_nl_pat, "\n", 'g') let elem = matchstr(elem, '^.*\ze,.*$')
if s:yr_history_version == 'v1'
" Match three @@@ in a row as long as it is not
" preceeded by a @@@
" v1
let elem = substitute(elem, s:yr_history_v1_nl_pat, "\n", 'g')
let elem = substitute(elem, '\\@', '@', 'g')
else
let elem = substitute(elem, s:yr_history_v2_nl_pat, "\n", 'g')
endif
return elem
endif endif
else
return -1
endif endif
return elem return ""
endfunction endfunction
function! s:YRMRUReset( mru_list ) function! s:YRMRUReset( mru_list )
let {a:mru_list} = [] let {a:mru_list} = []
return 1 return 1
@ -1721,16 +1683,6 @@ function! s:YRMRUElemFormat( element, element_type )
let elem = a:element let elem = a:element
if g:yankring_max_element_length != 0 if g:yankring_max_element_length != 0
let elem = strpart(a:element, 0, g:yankring_max_element_length) let elem = strpart(a:element, 0, g:yankring_max_element_length)
if (g:yankring_warn_on_truncate > 0)
let bytes = len (a:element) - len(elem)
if (bytes > 0)
call s:YRWarningMsg("Yankring truncated its element by ".
\ bytes.
\ " bytes due to a g:yankring_max_element_length of ".
\ g:yankring_max_element_length
\ )
endif
endif
endif endif
if s:yr_history_version == 'v1' if s:yr_history_version == 'v1'
let elem = escape(elem, '@') let elem = escape(elem, '@')
@ -1802,6 +1754,7 @@ function! s:YRMRUAdd( mru_list, element, element_type )
endfunction endfunction
function! s:YRMRUDel( mru_list, elem_nbr ) function! s:YRMRUDel( mru_list, elem_nbr )
if a:elem_nbr >= 0 && a:elem_nbr < s:yr_count if a:elem_nbr >= 0 && a:elem_nbr < s:yr_count
call remove({a:mru_list}, a:elem_nbr) call remove({a:mru_list}, a:elem_nbr)
call s:YRHistorySave() call s:YRHistorySave()
@ -1810,23 +1763,6 @@ function! s:YRMRUDel( mru_list, elem_nbr )
return 1 return 1
endfunction endfunction
function! s:YRHistoryDelete()
let s:yr_history_list = []
let yr_filename = s:yr_history_file_{s:yr_history_version}
if filereadable(yr_filename)
let rc = delete(yr_filename)
if rc != 0
call s:YRErrorMsg(
\ 'YRHistoryDelete: Unable to delete the yankring history file: '.
\ yr_filename
\ )
endif
endif
return 0
endfunction
function! s:YRHistoryRead() function! s:YRHistoryRead()
let refresh_needed = 1 let refresh_needed = 1
let yr_history_list = [] let yr_history_list = []
@ -1865,22 +1801,20 @@ function! s:YRHistoryRead()
endfunction endfunction
function! s:YRHistorySave() function! s:YRHistorySave()
let yr_filename = s:yr_history_file_{s:yr_history_version}
if len(s:yr_history_list) > g:yankring_max_history if len(s:yr_history_list) > g:yankring_max_history
" Remove items which exceed the max # specified " Remove items which exceed the max # specified
call remove(s:yr_history_list, g:yankring_max_history) call remove(s:yr_history_list, g:yankring_max_history)
endif endif
let rc = writefile(s:yr_history_list, yr_filename) let rc = writefile(s:yr_history_list, s:yr_history_file_{s:yr_history_version})
if rc == 0 if rc == 0
let s:yr_history_last_upd = getftime(yr_filename) let s:yr_history_last_upd = getftime(s:yr_history_file_{s:yr_history_version})
let s:yr_count = len(s:yr_history_list) let s:yr_count = len(s:yr_history_list)
else else
call s:YRErrorMsg( call s:YRErrorMsg(
\ 'YRHistorySave: Unable to save yankring history file: '. \ 'YRHistorySave: Unable to save yankring history file: '.
\ yr_filename \ s:yr_history_file_{s:yr_history_version}
\ ) \ )
endif endif
endfunction endfunction
@ -1945,7 +1879,7 @@ function! s:YRWindowStatus(show_help)
let msg = 'AutoClose='.g:yankring_window_auto_close. let msg = 'AutoClose='.g:yankring_window_auto_close.
\ ';ClipboardMonitor='.g:yankring_clipboard_monitor. \ ';ClipboardMonitor='.g:yankring_clipboard_monitor.
\ ';Cmds:<enter>,[g]p,[g]P,d,r,s,a,c,u,R,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) \ (s:yr_search==""?"":';SearchRegEx='.s:yr_search)
if s:yr_has_voperator == 0 if s:yr_has_voperator == 0
@ -1962,8 +1896,7 @@ function! s:YRWindowStatus(show_help)
\ '" [g]P : [g][P]aste selection'."\n". \ '" [g]P : [g][P]aste selection'."\n".
\ '" r : [p]aste selection in reverse order'."\n". \ '" r : [p]aste selection in reverse order'."\n".
\ '" s : [s]earch the yankring for text'."\n". \ '" s : [s]earch the yankring for text'."\n".
\ '" u : [u]pdate display show YankRing'."\n". \ '" u : [u]pdate display'."\n".
\ '" R : [R]egisters display'."\n".
\ '" a : toggle [a]utoclose setting'."\n". \ '" a : toggle [a]utoclose setting'."\n".
\ '" c : toggle [c]lipboard monitor setting'."\n". \ '" c : toggle [c]lipboard monitor setting'."\n".
\ '" q : [q]uit / close the yankring window'."\n". \ '" q : [q]uit / close the yankring window'."\n".
@ -2151,7 +2084,6 @@ function! s:YRWindowOpen(results)
nnoremap <buffer> <silent> ? :call <SID>YRWindowAction ('?' ,'n')<CR> nnoremap <buffer> <silent> ? :call <SID>YRWindowAction ('?' ,'n')<CR>
nnoremap <buffer> <silent> u :call <SID>YRWindowAction ('u' ,'n')<CR> nnoremap <buffer> <silent> u :call <SID>YRWindowAction ('u' ,'n')<CR>
nnoremap <buffer> <silent> q :call <SID>YRWindowAction ('q' ,'n')<CR> nnoremap <buffer> <silent> q :call <SID>YRWindowAction ('q' ,'n')<CR>
nnoremap <buffer> <silent> R :call <SID>YRWindowAction ('R' ,'n')<CR>
nnoremap <buffer> <silent> <space> \|:silent exec 'vertical resize '. nnoremap <buffer> <silent> <space> \|:silent exec 'vertical resize '.
\ ( \ (
\ g:yankring_window_use_horiz!=1 && winwidth('.') > g:yankring_window_width \ g:yankring_window_use_horiz!=1 && winwidth('.') > g:yankring_window_width
@ -2219,7 +2151,7 @@ function! s:YRWindowActionN(op, cmd_mode)
endfunction endfunction
function! s:YRWindowAction(op, cmd_mode) range function! s:YRWindowAction(op, cmd_mode) range
let default_buffer = ((&clipboard=~'unnamed')?'+':'"') let default_buffer = ((&clipboard=='unnamed')?'+':'"')
let opcode = a:op let opcode = a:op
let lines = [] let lines = []
let v_count = v:count let v_count = v:count
@ -2288,12 +2220,6 @@ function! s:YRWindowAction(op, cmd_mode) range
call s:YRShow(0) call s:YRShow(0)
return return
elseif opcode ==# 'R'
" Switch back to the original buffer
exec s:yr_buffer_last_winnr . "wincmd w"
call s:YRShow(0, 'R')
return
elseif opcode ==# 'a' elseif opcode ==# 'a'
let l:curr_line = line(".") let l:curr_line = line(".")
" Toggle the auto close setting " Toggle the auto close setting
@ -2473,8 +2399,6 @@ augroup YankRing
autocmd WinLeave * :call <SID>YRWinLeave() autocmd WinLeave * :call <SID>YRWinLeave()
autocmd FocusGained * :if has('clipboard') | call <SID>YRFocusGained() | endif autocmd FocusGained * :if has('clipboard') | call <SID>YRFocusGained() | endif
autocmd InsertLeave * :call <SID>YRInsertLeave() autocmd InsertLeave * :call <SID>YRInsertLeave()
autocmd User YRSetNumberedReg :call <SID>YRSetNumberedReg()
" autocmd User YRSetNumberedReg :let i = 0 | while i <= 10 | if i > s:yr_count | break | endif | call setreg( (i), s:YRGetValElemNbr((i),'v'), s:YRGetValElemNbr((i),'t') ) | let i += 1 | endwhile
augroup END augroup END
@ -2507,30 +2431,18 @@ command! -range -bang -nargs=? YRYankRange <line1>,<line2>call s:YRYankRa
if has("gui_running") && has("menu") && g:yankring_default_menu_mode != 0 if has("gui_running") && has("menu") && g:yankring_default_menu_mode != 0
if g:yankring_default_menu_mode == 1 if g:yankring_default_menu_mode == 1
let menuRoot = 'YankRing' let menuRoot = 'YankRing'
let menuPriority = ''
elseif g:yankring_default_menu_mode == 2 elseif g:yankring_default_menu_mode == 2
let menuRoot = '&YankRing' let menuRoot = '&YankRing'
let menuPriority = ''
elseif g:yankring_default_menu_mode == 3
let menuRoot = exists("g:yankring_menu_root") ? g:yankring_menu_root : '&Plugin.&YankRing'
let menuPriority = exists("g:yankring_menu_priority") ? yankring_menu_priority : ''
else else
let menuRoot = '&Plugin.&YankRing' let menuRoot = '&Plugin.&YankRing'
let menuPriority = ''
endif endif
let leader = '\' exec 'noremenu <script> '.menuRoot.'.YankRing\ Window :YRShow<CR>'
if exists('g:mapleader') exec 'noremenu <script> '.menuRoot.'.YankRing\ Search :YRSearch<CR>'
let leader = g:mapleader exec 'noremenu <script> '.menuRoot.'.Replace\ with\ Previous :YRReplace ''-1'', ''P''<CR>'
endif exec 'noremenu <script> '.menuRoot.'.Replace\ with\ Next :YRReplace ''1'', ''P''<CR>'
let leader = escape(leader, '\') exec 'noremenu <script> '.menuRoot.'.Clear :YRClear<CR>'
exec 'noremenu <script> '.menuRoot.'.Toggle :YRToggle<CR>'
exec 'noremenu <script> '.menuPriority.' '.menuRoot.'.YankRing\ Window :YRShow<CR>'
exec 'noremenu <script> '.menuPriority.' '.menuRoot.'.YankRing\ Search :YRSearch<CR>'
exec 'noremenu <script> '.menuPriority.' '.menuRoot.'.Replace\ with\ Previous<TAB>'.leader.'<C-P> :YRReplace ''-1'', ''P''<CR>'
exec 'noremenu <script> '.menuPriority.' '.menuRoot.'.Replace\ with\ Next<TAB>'.leader.'<C-N> :YRReplace ''1'', ''P''<CR>'
exec 'noremenu <script> '.menuPriority.' '.menuRoot.'.Clear :YRClear<CR>'
exec 'noremenu <script> '.menuPriority.' '.menuRoot.'.Toggle :YRToggle<CR>'
endif endif
if g:yankring_enabled == 1 if g:yankring_enabled == 1
@ -2538,6 +2450,11 @@ if g:yankring_enabled == 1
call s:YRMapsCreate() call s:YRMapsCreate()
endif endif
if exists('*YRRunAfterMaps')
" This will allow you to override the default maps if necessary
call YRRunAfterMaps()
endif
call s:YRInit() call s:YRInit()
call s:YRHistoryRead() call s:YRHistoryRead()

View file

@ -133,7 +133,7 @@ set background=dark
" Set extra options when running in GUI mode " Set extra options when running in GUI mode
if has("gui_running") if has("gui_running")
set guioptions-=T set guioptions-=T
set guioptions+=e set guioptions-=e
set t_Co=256 set t_Co=256
set guitablabel=%M\ %t set guitablabel=%M\ %t
endif endif
@ -216,6 +216,7 @@ map <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr> map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr> map <leader>tc :tabclose<cr>
map <leader>tm :tabmove map <leader>tm :tabmove
map <leader>t<leader> :tabnext
" Opens a new tab with the current buffer's path " Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory " Super useful when editing files in the same directory

View file

@ -11,8 +11,6 @@
set background=dark set background=dark
if has("gui_running") if has("gui_running")
colorscheme peaksea
else
colorscheme ir_black colorscheme ir_black
endif endif