Permalink
Browse files

updating bundled scripts to latest versions. Adding note to readme

  • Loading branch information...
1 parent ebf65f9 commit e79f9a6846259dabe533b345ade6980d715a47e8 @spf13 committed Oct 5, 2010
Showing with 418 additions and 24 deletions.
  1. +4 −0 README.md
  2. +75 −19 autoload/xolox.vim
  3. +2 −2 autoload/xolox/escape.vim
  4. +3 −3 autoload/xolox/timer.vim
  5. +334 −0 doc/easytags.txt
View
@@ -1,3 +1,7 @@
+### Note for SPF13 fork
+I have taken Peters excellent script and packaged it so that the git repo can be installed itself, without using the zip file.
+I have an excellent .vim setup which is well organized using git and submodules which uses this. [spf13-vim](http://github.com/spf13/spf13-vim)
+
# Automated tag generation and syntax highlighting in Vim
[Vim](http://www.vim.org/) has long been my favorite text editor and combined with [Exuberant Ctags] [exuberant_ctags] it has the potential to provide most of what I expect from an [integrated development environment](http://en.wikipedia.org/wiki/Integrated_development_environment). Exuberant Ctags is the latest incarnation of a [family of computer programs](http://en.wikipedia.org/wiki/Ctags) that scan source code files to create an index of identifiers (tags) and where they are defined. Vim uses this index (a so-called tags file) to enable you to jump to the definition of any identifier using the [Control-\]](http://vimdoc.sourceforge.net/htmldoc/tagsrch.html#CTRL-]) mapping.
View
@@ -1,15 +1,36 @@
" Vim script
" Maintainer: Peter Odding <peter@peterodding.com>
-" Last Change: June 6, 2010
+" Last Change: August 30, 2010
" URL: http://peterodding.com/code/vim/profile/autoload/xolox.vim
" Miscellaneous functions used throughout my Vim profile and plug-ins.
-function! xolox#trim(s) " -- trim whitespace from start/end of string {{{1
+" Lately I've been losing my message history a lot so I've added this option
+" which keeps a ring buffer with the last N messages in "g:xolox_messages".
+if !exists('g:xolox_message_buffer')
+ let g:xolox_message_buffer = 100
+endif
+
+if !exists('g:xolox_messages')
+ let g:xolox_messages = []
+endif
+
+function! xolox#trim(s) " -- trim whitespace from start/end of {s} {{{1
return substitute(a:s, '^\s*\(.\{-}\)\s*$', '\1', '')
endfunction
-function! xolox#unique(list) " -- remove duplicate values from list (in-place) {{{1
+function! xolox#quote_pattern(s) " -- convert {s} to pattern that matches {s} literally (on word boundaries!) {{{1
+ let patt = xolox#escape#pattern(a:s)
+ if patt =~ '^\w'
+ let patt = '\<' . patt
+ endif
+ if patt =~ '\w$'
+ let patt = patt . '\>'
+ endif
+ return patt
+endfunction
+
+function! xolox#unique(list) " -- remove duplicate values from {list} (in-place) {{{1
let index = 0
while index < len(a:list)
let value = a:list[index]
@@ -25,26 +46,61 @@ function! xolox#unique(list) " -- remove duplicate values from list (in-place) {
endfunction
function! xolox#message(...) " -- show a formatted informational message to the user {{{1
- return s:message('title', a:000)
+ call s:message('title', a:000)
endfunction
function! xolox#warning(...) " -- show a formatted warning message to the user {{{1
- return s:message('warningmsg', a:000)
+ call s:message('warningmsg', a:000)
+endfunction
+
+function! xolox#debug(...) " -- show a formatted debugging message to the user {{{1
+ if &vbs >= 1
+ call s:message('question', a:000)
+ endif
endfunction
function! s:message(hlgroup, args) " -- implementation of message() and warning() {{{1
- try
- execute 'echohl' a:hlgroup
- " Redraw to avoid the |hit-enter| prompt.
- redraw
- let nargs = len(a:args)
- if nargs >= 2
- echomsg call('printf', a:args)
- elseif nargs == 1
- echomsg a:args[0]
- endif
- finally
- " Always clear message highlighting -- even when interrupted by Ctrl-C.
- echohl none
- endtry
+ let nargs = len(a:args)
+ if nargs == 1
+ let message = a:args[0]
+ elseif nargs >= 2
+ let message = call('printf', a:args)
+ endif
+ if exists('message')
+ try
+ " Temporarily disable Vim's |hit-enter| prompt and mode display.
+ if !exists('s:more_save')
+ let s:more_save = &more
+ let s:ruler_save = &ruler
+ let s:smd_save = &showmode
+ endif
+ set nomore noshowmode
+ if winnr('$') == 1 | set noruler | endif
+ augroup PluginXoloxHideMode
+ autocmd! CursorHold,CursorHoldI * call s:clear_message()
+ augroup END
+ execute 'echohl' a:hlgroup
+ " Redraw to avoid |hit-enter| prompt.
+ redraw | echomsg message
+ if g:xolox_message_buffer > 0
+ call add(g:xolox_messages, message)
+ if len(g:xolox_messages) > g:xolox_message_buffer
+ call remove(g:xolox_messages, 0)
+ endif
+ endif
+ finally
+ " Always clear message highlighting -- even when interrupted by Ctrl-C.
+ echohl none
+ endtry
+ endif
+endfunction
+
+function! s:clear_message()
+ echo ''
+ let &more = s:more_save
+ let &showmode = s:smd_save
+ let &ruler = s:ruler_save
+ unlet s:more_save s:ruler_save s:smd_save
+ autocmd! PluginXoloxHideMode
+ augroup! PluginXoloxHideMode
endfunction
@@ -1,6 +1,6 @@
" Vim script
" Maintainer: Peter Odding <peter@peterodding.com>
-" Last Change: June 5, 2010
+" Last Change: August 31, 2010
" URL: http://peterodding.com/code/vim/profile/autoload/xolox/escape.vim
" pattern() -- convert a string into a :substitute pattern that matches the string literally {{{1
@@ -17,7 +17,7 @@ endfunction
function! xolox#escape#substitute(string)
if type(a:string) == type('')
- let string = escape(a:string, '\&~')
+ let string = escape(a:string, '\&~%')
return substitute(string, '\n', '\\r', 'g')
endif
return ''
View
@@ -1,6 +1,6 @@
" Vim script
" Maintainer: Peter Odding <peter@peterodding.com>
-" Last Change: June 15, 2010
+" Last Change: June 16, 2010
" URL: http://peterodding.com/code/vim/profile/autoload/xolox/timer.vim
if !exists('g:timer_enabled')
@@ -50,7 +50,7 @@ function! xolox#timer#format_timespan(ts)
if seconds < 5
let extract = matchstr(a:ts, '^\d\+\(\.0*[123456789][123456789]\?\)\?')
if extract =~ '[123456789]'
- return extract . ' second' . (seconds > 1 ? 's' : '')
+ return extract . ' second' . (extract != '1' ? 's' : '')
endif
endif
@@ -60,7 +60,7 @@ function! xolox#timer#format_timespan(ts)
if seconds >= size
let counter = seconds / size
let seconds = seconds % size
- let suffix = counter > 1 ? 's' : ''
+ let suffix = counter != 1 ? 's' : ''
call add(result, printf('%i %s%s', counter, name, suffix))
endif
endfor
Oops, something went wrong.

0 comments on commit e79f9a6

Please sign in to comment.