--- a/.tmux.conf Mon Nov 15 08:40:32 2010 -0500
+++ b/.tmux.conf Mon Nov 15 17:15:57 2010 -0500
@@ -1,15 +1,14 @@
-# Prefix is something nicer, like C-J
+# prefix = C-j
set-option -g prefix C-j
bind C-j send-prefix
+# vim
setw -g mode-keys vi
-bind C-h select-pane -L
-bind C-j select-pane -D
-bind C-k select-pane -U
-bind C-l select-pane -R
+# esc to copy
unbind [
bind Escape copy-mode
+
setw -g automatic-rename
# status bar
@@ -31,6 +30,28 @@
set-option -g pane-border-fg white
set-option -g pane-active-border-fg magenta
-bind s split-window -v
-bind v split-window -h
+# splitting panes
+bind s split-window -v
+bind C-s split-window -v
+bind v split-window -h
+bind C-v split-window -h
+# moving between panes
+bind h select-pane -L
+bind C-h select-pane -L
+bind j select-pane -D
+bind C-j select-pane -D
+bind k select-pane -U
+bind C-k select-pane -U
+bind l select-pane -R
+bind C-l select-pane -R
+
+# resizing panes
+bind Down resize-pane -D 10
+bind Up resize-pane -U 10
+bind Left resize-pane -L 10
+bind Right resize-pane -R 10
+
+# resource
+bind r source-file ~/.tmux.conf
+bind C-r source-file ~/.tmux.conf
--- a/vim/.vimrc Mon Nov 15 08:40:32 2010 -0500
+++ b/vim/.vimrc Mon Nov 15 17:15:57 2010 -0500
@@ -152,7 +152,6 @@
map <leader>a :Ack
" Yankring
-nnoremap <silent> <F3> :YRShow<cr>
nnoremap <silent> <leader>y :YRShow<cr>
" Formatting, TextMate-style
@@ -220,8 +219,8 @@
nmap <leader>R :RainbowParenthesesToggle<CR>
" Edit vim stuff.
-nmap <leader>ev <C-w>s<C-w>j<C-w>L:e $MYVIMRC<cr>
-nmap <leader>es <C-w>s<C-w>j<C-w>L:e ~/.vim/snippets/<cr>
+nnoremap <leader>ev <C-w>s<C-w>j<C-w>L:e $MYVIMRC<cr>
+nnoremap <leader>es <C-w>s<C-w>j<C-w>L:e ~/.vim/snippets/<cr>
" Sudo to write
cmap w!! w !sudo tee % >/dev/null
@@ -231,7 +230,10 @@
nnoremap _jt :set ft=htmljinja<CR>
nnoremap _cw :set ft=confluencewiki<CR>
nnoremap _pd :set ft=python.django<CR>
-"
+
+" Python docs
+nnoremap <leader>p :Pydoc<space>
+
" HALP
nnoremap _wtfcw :!open 'http://confluence.atlassian.com/renderer/notationhelp.action?section=all'<cr>
@@ -289,37 +291,56 @@
onoremap ad a[
" Next ()
+vnoremap <silent> inb :<C-U>normal! f(vib<cr>
onoremap <silent> inb :<C-U>normal! f(vib<cr>
+vnoremap <silent> anb :<C-U>normal! f(vab<cr>
onoremap <silent> anb :<C-U>normal! f(vab<cr>
+vnoremap <silent> in( :<C-U>normal! f(vi(<cr>
onoremap <silent> in( :<C-U>normal! f(vi(<cr>
+vnoremap <silent> an( :<C-U>normal! f(va(<cr>
onoremap <silent> an( :<C-U>normal! f(va(<cr>
" Next {}
+vnoremap <silent> inB :<C-U>normal! f{viB<cr>
onoremap <silent> inB :<C-U>normal! f{viB<cr>
+vnoremap <silent> anB :<C-U>normal! f{vaB<cr>
onoremap <silent> anB :<C-U>normal! f{vaB<cr>
+vnoremap <silent> in{ :<C-U>normal! f{vi{<cr>
onoremap <silent> in{ :<C-U>normal! f{vi{<cr>
+vnoremap <silent> an{ :<C-U>normal! f{va{<cr>
onoremap <silent> an{ :<C-U>normal! f{va{<cr>
" Next []
+vnoremap <silent> ind :<C-U>normal! f[vi[<cr>
onoremap <silent> ind :<C-U>normal! f[vi[<cr>
+vnoremap <silent> and :<C-U>normal! f[va[<cr>
onoremap <silent> and :<C-U>normal! f[va[<cr>
+vnoremap <silent> in[ :<C-U>normal! f[vi[<cr>
onoremap <silent> in[ :<C-U>normal! f[vi[<cr>
+vnoremap <silent> an[ :<C-U>normal! f[va[<cr>
onoremap <silent> an[ :<C-U>normal! f[va[<cr>
" Next <>
+vnoremap <silent> in< :<C-U>normal! f<vi<<cr>
onoremap <silent> in< :<C-U>normal! f<vi<<cr>
+vnoremap <silent> an< :<C-U>normal! f<va<<cr>
onoremap <silent> an< :<C-U>normal! f<va<<cr>
" Next ''
+vnoremap <silent> in' :<C-U>normal! f'vi'<cr>
onoremap <silent> in' :<C-U>normal! f'vi'<cr>
+vnoremap <silent> an' :<C-U>normal! f'va'<cr>
onoremap <silent> an' :<C-U>normal! f'va'<cr>
" Next ""
+vnoremap <silent> in" :<C-U>normal! f"vi"<cr>
onoremap <silent> in" :<C-U>normal! f"vi"<cr>
+vnoremap <silent> an" :<C-U>normal! f"va"<cr>
onoremap <silent> an" :<C-U>normal! f"va"<cr>
" Skipreturn
inoremap <c-cr> <esc>A<cr>
+inoremap <s-cr> <esc>A:<cr>
" VimClojure
let vimclojure#HighlightBuiltins=1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/bundle/delimitMate/.gitignore Mon Nov 15 17:15:57 2010 -0500
@@ -0,0 +1,8 @@
+*.sw?
+*.un?
+*.vba
+*.zip
+*.gz
+vimball.txt
+*.orig
+tags
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/bundle/delimitMate/Makefile Mon Nov 15 17:15:57 2010 -0500
@@ -0,0 +1,62 @@
+PLUGIN=$(shell basename "$$PWD")
+SCRIPT=$(wildcard plugin/*.vim)
+#AUTOL=$(wildcard autoload/*.vim)
+AUTOL=autoload/$(PLUGIN).vim
+DOC=$(wildcard doc/*.txt)
+TESTS=$(wildcard autoload/*Tests.vim)
+VERSION=$(shell perl -ne 'if (/\*\sCurrent\srelease:/) {s/^\s+(\d+\.\S+)\s.*$$/\1/;print}' $(DOC))
+VIMFOLDER=~/.vim/
+VIM=/usr/bin/vim
+
+.PHONY: $(PLUGIN).vba README
+
+all: vimball README zip gzip
+
+vimball: $(PLUGIN).vba
+
+clean:
+ @echo clean
+ rm -f *.vba */*.orig *.~* .VimballRecord *.zip *.gz
+
+dist-clean: clean
+
+undo:
+ for i in */*.orig; do mv -f "$$i" "$${i%.*}"; done
+
+README:
+ @echo README
+ cp -f $(DOC) README
+
+$(PLUGIN).vba:
+ @echo $(PLUGIN).vba
+ rm -f $(PLUGIN)-$(VERSION).vba
+ $(VIM) -N -c 'ru! vimballPlugin.vim' -c ':call append("0", [ "$(SCRIPT)", "$(AUTOL)", "$(DOC)"])' -c '$$d' -c ":%MkVimball $(PLUGIN)-$(VERSION) ." -c':q!'
+ ln -f $(PLUGIN)-$(VERSION).vba $(PLUGIN).vba
+
+zip:
+ @echo zip
+ rm -f *.zip
+ zip -r $(PLUGIN).zip doc plugin autoload
+ zip $(PLUGIN).zip -d \*.sw\? || echo 1
+ zip $(PLUGIN).zip -d \*.un\? || echo 1
+ zip $(PLUGIN).zip -d \*.orig || echo 1
+ zip $(PLUGIN).zip -d \*tags || echo 1
+ zip $(PLUGIN).zip -d $(TESTS)
+ ln -f $(PLUGIN).zip $(PLUGIN)-$(VERSION).zip
+
+gzip: vimball
+ @echo vimball
+ gzip -f $(PLUGIN).vba
+
+release: version all
+
+version:
+ @echo version: $(VERSION)
+ perl -i.orig -pne 'if (/^"\sVersion:/) {s/(\d+\.\S+)/$(VERSION)/}' $(SCRIPT) $(AUTOL)
+ perl -i.orig -pne 'if (/let\sdelimitMate_version/) {s/"(\d+\.\S+)"/"$(VERSION)"/}' $(SCRIPT)
+ perl -i.orig -pne 'if (/beasts/) {s/(v\d+\.\S+)/v$(VERSION)/}' $(DOC)
+ perl -i.orig -MPOSIX -pne 'if (/^"\sModified:/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/e}' $(SCRIPT) $(AUTOL)
+ perl -i.orig -MPOSIX -pne 'if (/^\s+$(VERSION)\s+\d+-\d+-\d+\s+\*/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/}' $(DOC)
+ @echo Version: $(VERSION)
+
+echo:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/bundle/delimitMate/README Mon Nov 15 17:15:57 2010 -0500
@@ -0,0 +1,761 @@
+*delimitMate.txt* Trying to keep those beasts at bay! v2.5.1 *delimitMate*
+
+
+
+ MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+ MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMM MMMMM MMMMMMMMMMMMMMMMMMMMM ~
+ MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMM MMM MMMMMMMMMMMMMMMMMMMMM
+ MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMM MMM M M MMMMMMMMMM MMMMMMMMM ~
+ MMMM MMM MMM MM MM M M MMM MM MM MM MM MMM MMM MMM MM
+ MM MM M MM MMMMMM MMMMMMM MMM MMMMM MM M MMM MMM M M ~
+ M M MM MM MM MM M M MM MMM MMM MMMMM MMMMM MMM MMM M
+ M M MM MMMMM MM MM M M MM MMM MMM MMMMM MMM MMM MMM MMMM ~
+ M M MM M MM MM MM M M MM MMM MMM MMMMM MM M MMM MMM M M
+ MM MMM MMM MM MM M M MM MMM MM MMMMM MMM MMM MMM MM ~
+ MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+
+
+
+==============================================================================
+ 0.- CONTENTS *delimitMate-contents*
+
+ 1. Introduction____________________________|delimitMateIntro|
+ 2. Customization___________________________|delimitMateOptions|
+ 2.1 Options summary____________________|delimitMateOptionSummary|
+ 2.2 Options details____________________|delimitMateOptionDetails|
+ 3. Functionality___________________________|delimitMateFunctionality|
+ 3.1 Automatic closing & exiting________|delimitMateAutoClose|
+ 3.2 Expansion of space and CR__________|delimitMateExpansion|
+ 3.3 Backspace__________________________|delimitMateBackspace|
+ 3.4 Smart Quotes_______________________|delimitMateSmartQuotes|
+ 3.5 Balancing matching pairs___________|delimitMateBalance|
+ 3.6 FileType based configuration_______|delimitMateFileType|
+ 3.7 Syntax awareness___________________|delimitMateSyntax|
+ 4. Commands________________________________|delimitMateCommands|
+ 5. Mappings________________________________|delimitMateMappings|
+ 6. Functions_______________________________|delimitMateFunctions|
+ 7. TODO list_______________________________|delimitMateTodo|
+ 8. Maintainer______________________________|delimitMateMaintainer|
+ 9. Credits_________________________________|delimitMateCredits|
+ 10. History_________________________________|delimitMateHistory|
+
+==============================================================================
+ 1.- INTRODUCTION *delimitMateIntro*
+
+This plug-in provides automatic closing of quotes, parenthesis, brackets,
+etc.; besides some other related features that should make your time in insert
+mode a little bit easier.
+
+Most of the features can be modified or disabled permanently, using global
+variables, or on a FileType basis, using autocommands. With a couple of
+exceptions and limitations, this features don't brake undo, redo or history.
+
+NOTE 1: If you have any trouble with this plugin, please run |:DelimitMateTest|
+in a new buffer to see what is not working.
+
+NOTE 2: |'timeout'| needs to be set when working in the terminal, otherwise you
+might find weird behaviour with mappings including <Esc> or arrow keys.
+
+NOTE 3: Abbreiations set with |:iabbrev| will not be expanded by delimiters
+used on delimitMate, you should use <C-]> (read |i_CTRL-]|) to expand them on
+the go.
+
+==============================================================================
+ 2. CUSTOMIZATION *delimitMateOptions*
+
+You can create your own mappings for some features using the global functions.
+Read |DelimitMateFunctions| for more info.
+
+------------------------------------------------------------------------------
+ 2.1 OPTIONS SUMMARY *delimitMateOptionSummary*
+
+The behaviour of this script can be customized setting the following options
+in your vimrc file. You can use local options to set the configuration for
+specific file types, see |delimitMateOptionDetails| for examples.
+
+|'loaded_delimitMate'| Turns off the script.
+
+|'delimitMate_autoclose'| Tells delimitMate whether to automagically
+ insert the closing delimiter.
+
+|'delimitMate_matchpairs'| Tells delimitMate which characters are
+ matching pairs.
+
+|'delimitMate_quotes'| Tells delimitMate which quotes should be
+ used.
+
+|'delimitMate_nesting_quotes'| Tells delimitMate which quotes should be
+ allowed to be nested.
+
+|'delimitMate_expand_cr'| Turns on/off the expansion of <CR>.
+
+|'delimitMate_expand_space'| Turns on/off the expansion of <Space>.
+
+|'delimitMate_smart_quotes'| Turns on/off the "smart quotes" feature.
+
+|'delimitMate_balance_matchpairs'|Turns on/off the "balance matching pairs"
+ feature.
+
+|'delimitMate_excluded_regions'| Turns off the script for the given regions or
+ syntax group names.
+
+|'delimitMate_excluded_ft'| Turns off the script for the given file types.
+
+|'delimitMate_apostrophes'| Tells delimitMate how it should "fix"
+ balancing of single quotes when used as
+ apostrophes. NOTE: Not needed any more, kept
+ for compatibility with older versions.
+
+------------------------------------------------------------------------------
+ 2.2 OPTIONS DETAILS *delimitMateOptionDetails*
+
+Add the shown lines to your vimrc file in order to set the below options.
+Buffer variables take precedence over global ones and can be used along with
+autocmd to modify delimitMate's behavior for specific file types, read more in
+|delimitMateFileType|.
+
+Note: Use buffer variables only to set options for specific file types using
+:autocmd, use global variables to set options for every buffer. Read more in
+|g:var| and |b:var|.
+
+------------------------------------------------------------------------------
+ *'loaded_delimitMate'*
+ *'b:loaded_delimitMate'*
+This option prevents delimitMate from loading.
+e.g.: >
+ let loaded_delimitMate = 1
+ au FileType mail let b:loaded_delimitMate = 1
+<
+------------------------------------------------------------------------------
+ *'delimitMate_autoclose'*
+ *'b:delimitMate_autoclose'*
+Values: 0 or 1. ~
+Default: 1 ~
+
+If this option is set to 0, delimitMate will not add a closing delimiter
+automagically. See |delimitMateAutoClose| for details.
+e.g.: >
+ let delimitMate_autoclose = 0
+ au FileType mail let b:delimitMate_autoclose = 0
+<
+------------------------------------------------------------------------------
+ *'delimitMate_matchpairs'*
+ *'b:delimitMate_matchpairs'*
+Values: A string with |'matchpairs'| syntax, plus support for multi-byte~
+ characters.~
+Default: &matchpairs ~
+
+Use this option to tell delimitMate which characters should be considered
+matching pairs. Read |delimitMateAutoClose| for details.
+e.g: >
+ let delimitMate_matchpairs = "(:),[:],{:},<:>"
+ au FileType vim,html let b:delimitMate_matchpairs = "(:),[:],{:},<:>"
+<
+------------------------------------------------------------------------------
+ *'delimitMate_quotes'*
+ *'b:delimitMate_quotes'*
+Values: A string of characters separated by spaces. ~
+Default: "\" ' `" ~
+
+Use this option to tell delimitMate which characters should be considered as
+quotes. Read |delimitMateAutoClose| for details.
+e.g.: >
+ let delimitMate_quotes = "\" ' ` *"
+ au FileType html let b:delimitMate_quotes = "\" '"
+<
+------------------------------------------------------------------------------
+ *'delimitMate_nesting_quotes'*
+ *'b:delimitMate_nesting_quotes'*
+Values: A list of quotes. ~
+Default: [] ~
+
+Quotes listed here will not be able to jump out of the empty pair, thus
+allowing the autoclosed quotes to be nested.
+e.g.: >
+ let delimitMate_nesting_quotes = ['"','`']
+ au FileType python let b:delimitMate_nesting_quotes = ['"']
+<
+------------------------------------------------------------------------------
+ *'delimitMate_expand_cr'*
+ *'b:delimitMate_expand_cr'*
+Values: 1 or 0 ~
+Default: 0 ~
+
+This option turns on/off the expansion of <CR>. Read |delimitMateExpansion|
+for details.
+e.g.: >
+ let delimitMate_expand_cr = 1
+ au FileType mail let b:delimitMate_expand_cr = 1
+<
+------------------------------------------------------------------------------
+ *'delimitMate_expand_space'*
+ *'b:delimitMate_expand_space'*
+Values: 1 or 0 ~
+Default: 0 ~
+
+This option turns on/off the expansion of <Space>. Read |delimitMateExpansion|
+for details.
+e.g.: >
+ let delimitMate_expand_space = 1
+ au FileType tcl let b:delimitMate_expand_space = 1
+<
+------------------------------------------------------------------------------
+ *'delimitMate_smart_quotes'*
+ *'b:delimitMate_smart_quotes'*
+Values: 1 or 0 ~
+Default: 1 ~
+
+This option turns on/off the smart quotes feature. Read
+|delimitMateSmartQuotes| for details.
+e.g.: >
+ let delimitMate_smart_quotes = 0
+ au FileType tcl let b:delimitMate_smart_quotes = 0
+<
+------------------------------------------------------------------------------
+ *'delimitMate_balance_matchpairs'*
+ *'b:delimitMate_balance_matchpairs'*
+Values: 1 or 0 ~
+Default: 0 ~
+
+This option turns on/off the balancing of matching pairs. Read
+|delimitMateBalance| for details.
+e.g.: >
+ let delimitMate_balance_matchpairs = 1
+ au FileType tcl let b:delimitMate_balance_matchpairs = 1
+<
+------------------------------------------------------------------------------
+ *'delimitMate_excluded_regions'*
+Values: A string of syntax group names names separated by single commas. ~
+Default: Comment ~
+
+This options turns delimitMate off for the listed regions, read |group-name|
+for more info about what is a region.
+e.g.: >
+ let delimitMate_excluded_regions = "Comments,String"
+<
+------------------------------------------------------------------------------
+ *'delimitMate_excluded_ft'*
+Values: A string of file type names separated by single commas. ~
+Default: Empty. ~
+
+This options turns delimitMate off for the listed file types, use this option
+only if you don't want any of the features it provides on those file types.
+e.g.: >
+ let delimitMate_excluded_ft = "mail,txt"
+<
+------------------------------------------------------------------------------
+ *'delimitMate_apostrophes'*
+Values: Strings separated by ":". ~
+Default: No longer used. ~
+
+NOTE: This feature is turned off by default, it's been kept for compatibility
+with older version, read |delimitMateSmartQuotes| for details.
+If auto-close is enabled, this option tells delimitMate how to try to fix the
+balancing of single quotes when used as apostrophes. The values of this option
+are strings of text where a single quote would be used as an apostrophe (e.g.:
+the "n't" of wouldn't or can't) separated by ":". Set it to an empty string to
+disable this feature.
+e.g.: >
+ let delimitMate_apostrophes = ""
+ au FileType tcl let delimitMate_apostrophes = ""
+<
+==============================================================================
+ 3. FUNCTIONALITY *delimitMateFunctionality*
+
+------------------------------------------------------------------------------
+ 3.1 AUTOMATIC CLOSING AND EXITING *delimitMateAutoClose*
+
+With automatic closing enabled, if an opening delimiter is inserted the plugin
+inserts the closing delimiter and places the cursor between the pair. With
+automatic closing disabled, no closing delimiters is inserted by delimitMate,
+but when a pair of delimiters is typed, the cursor is placed in the middle.
+
+When the cursor is inside an empty pair or located next to the left of a
+closing delimiter, the cursor is placed outside the pair to the right of the
+closing delimiter.
+
+Unless |'delimitMate_matchpairs'| or |'delimitMate_quotes'|are set, this
+script uses the values in '&matchpairs' to identify the pairs, and ", ' and `
+for quotes respectively.
+
+The following table shows the behaviour, this applies to quotes too (the final
+position of the cursor is represented by a "|"):
+
+With auto-close: >
+ Type | You get
+ ====================
+ ( | (|)
+ –––––––––|––––––––––
+ () | ()|
+ –––––––––|––––––––––
+ (<S-Tab> | ()|
+<
+Without auto-close: >
+
+ Type | You get
+ =====================
+ () | (|)
+ –––––––––-|––––––––––
+ ()) | ()|
+ –––––––––-|––––––––––
+ ()<S-Tab> | ()|
+<
+NOTE: Abbreviations will not be expanded by delimiters used on delimitMate,
+you should use <C-]> (read |i_CTRL-]|) to expand them on the go.
+
+------------------------------------------------------------------------------
+ 3.2 EXPANSION OF SPACE AND CAR RETURN *delimitMateExpansion*
+
+When the cursor is inside an empty pair of delimiters, <Space> and <CR> can be
+expanded, see |'delimitMate_expand_space'| and
+|'delimitMate_expand_cr'|:
+
+Expand <Space> to: >
+
+ <Space><Space><Left> | You get
+ ====================================
+ (|) | ( | )
+<
+Expand <CR> to: >
+
+ <CR><CR><Up> | You get
+ ============================
+ (|) | (
+ | |
+ | )
+<
+
+NOTE that the expansion of <CR> will brake the redo command.
+
+Since <Space> and <CR> are used everywhere, I have made the functions involved
+in expansions global, so they can be used to make custom mappings. Read
+|delimitMateFunctions| for more details.
+
+------------------------------------------------------------------------------
+ 3.3 BACKSPACE *delimitMateBackspace*
+
+If you press backspace inside an empty pair, both delimiters are deleted. When
+expansions are enabled, <BS> will also delete the expansions. NOTE that
+deleting <CR> expansions will brake the redo command.
+
+If you type <S-BS> (shift + backspace) instead, only the closing delimiter
+will be deleted. NOTE that this will not usually work when using Vim from the
+terminal, see 'delimitMate#JumpAny()' below to see how to fix it.
+
+e.g. typing at the "|": >
+
+ What | Before | After
+ ==============================================
+ <BS> | call expand(|) | call expand|
+ ---------|-------------------|-----------------
+ <BS> | call expand( | ) | call expand(|)
+ ---------|-------------------|-----------------
+ <BS> | call expand( | call expand(|)
+ | | |
+ | ) |
+ ---------|-------------------|-----------------
+ <S-BS> | call expand(|) | call expand(|
+<
+
+------------------------------------------------------------------------------
+ 3.4 SMART QUOTES *delimitMateSmartQuotes*
+
+Only one quote will be inserted following a quote, a "\" or, following or
+preceding an alphanumeric character. This should cover closing quotes after a
+string, opening quotes before a string, escaped quotes and apostrophes. Except
+for apostrophes, this feature can be disabled setting the option
+|'delimitMate_smart_quotes'| to 0.
+
+e.g. typing at the "|": >
+
+ What | Before | After
+ =======================================
+ " | Text | | Text "|"
+ " | "String| | "String"|
+ " | let i = "| | let i = "|"
+ 'm | I| | I'm|
+<
+------------------------------------------------------------------------------
+ 3.5 BALANCING MATCHING PAIRS *delimitMateBalance*
+
+When inserting an opening paren and |'delimitMate_balance_matchpairs'| is
+enabled, delimitMate will try to balance the closing pairs in the current
+line.
+
+e.g. typing at the "|": >
+
+ What | Before | After
+ =======================================
+ ( | |) | (|)
+ ( | | | (|)
+ ( | (|) | ((|))
+<
+------------------------------------------------------------------------------
+ 3.6 FILE TYPE BASED CONFIGURATION *delimitMateFileType*
+
+delimitMate options can be set globally for all buffers using global
+("regular") variables in your |vimrc| file. But |:autocmd| can be used to set
+options for specific file types (see |'filetype'|) using buffer variables in
+the following way: >
+
+ au FileType mail,text let b:delimitMate_autoclose = 0
+ ^ ^ ^ ^ ^
+ | | | | |
+ | | | | - Option value.
+ | | | - Option name.
+ | | - Buffer variable.
+ | - File types for which the option will be set.
+ - Don't forget to put this event.
+<
+NOTE that you should use buffer variables (|b:var|) only to set options with
+|:autocmd|, for global options use regular variables (|g:var|) in your vimrc.
+
+------------------------------------------------------------------------------
+ 3.7 SYNTAX AWARENESS *delimitMateSyntax*
+
+The features of this plug-in might not be always helpful, comments and strings
+usualy don't need auto-completion. delimitMate monitors which region is being
+edited and if it detects that the cursor is in a comment it'll turn itself off
+until the cursor leaves the comment. The excluded regions can be set using the
+option |'delimitMate_excluded_regions'|. Read |group-name| for a list of
+regions or syntax group names.
+
+NOTE that this feature relies on a proper syntax file for the current file
+type, if the appropiate syntax file doesn't define a region, delimitMate won't
+know about it.
+
+==============================================================================
+ 4. COMMANDS *delimitMateCommands*
+
+------------------------------------------------------------------------------
+:DelimitMateReload *:DelimitMateReload*
+
+Re-sets all the mappings used for this script, use it if any option has been
+changed or if the filetype option hasn't been set yet.
+
+------------------------------------------------------------------------------
+:DelimitMateSwitch *:DelimitMateSwitch*
+
+Switches the plug-in on and off.
+
+------------------------------------------------------------------------------
+:DelimitMateTest *:DelimitMateTest*
+
+This command tests every mapping set-up for this script, useful for testing
+custom configurations.
+
+The following output corresponds to the default values, it will be different
+depending on your configuration. "Open & close:" represents the final result
+when the closing delimiter has been inserted, either manually or
+automatically, see |delimitMateExpansion|. "Delete:" typing backspace in an
+empty pair, see |delimitMateBackspace|. "Exit:" typing a closing delimiter
+inside a pair of delimiters, see |delimitMateAutoclose|. "Space:" the
+expansion, if any, of space, see |delimitMateExpansion|. "Visual-L",
+"Visual-R" and "Visual" shows visual wrapping, see
+|delimitMateVisualWrapping|. "Car return:" the expansion of car return, see
+|delimitMateExpansion|. The cursor's position at the end of every test is
+represented by an "|": >
+
+ * AUTOCLOSE:
+ Open & close: (|)
+ Delete: |
+ Exit: ()|
+ Space: ( |)
+ Visual-L: (v)
+ Visual-R: (v)
+ Car return: (
+ |)
+
+ Open & close: {|}
+ Delete: |
+ Exit: {}|
+ Space: { |}
+ Visual-L: {v}
+ Visual-R: {v}
+ Car return: {
+ |}
+
+ Open & close: [|]
+ Delete: |
+ Exit: []|
+ Space: [ |]
+ Visual-L: [v]
+ Visual-R: [v]
+ Car return: [
+ |]
+
+ Open & close: "|"
+ Delete: |
+ Exit: ""|
+ Space: " |"
+ Visual: "v"
+ Car return: "
+ |"
+
+ Open & close: '|'
+ Delete: |
+ Exit: ''|
+ Space: ' |'
+ Visual: 'v'
+ Car return: '
+ |'
+
+ Open & close: `|`
+ Delete: |
+ Exit: ``|
+ Space: ` |`
+ Visual: `v`
+ Car return: `
+ |`
+<
+
+==============================================================================
+ 5. MAPPINGS *delimitMateMappings*
+
+delimitMate doesn't override any existing map, so you may encounter that it
+doesn't work as expected because a mapping is missing. In that case, the
+conflicting mappings should be resolved by either disabling the conflicting
+mapping or creating a custom mappings.
+
+In order to make custom mappings easier and prevent overwritting existing
+ones, delimitMate uses the |<Plug>| + |hasmapto()| (|usr_41.txt|) construct
+for its mappings.
+
+The following are the mappings alway set by delimitMate:
+
+<BS> is mapped to <Plug>delimitMateBS
+<S-BS> is mapped to <Plug>delimitMateS-BS
+<S-Tab> is mapped to <Plug>delimitMateS-Tab
+<Del> is mapped to <Plug>delimitMateDel
+<Esc> is mapped to <Plug>delimitMateEsc
+<Left> is mapped to <Plug>delimitMateLeft
+<Right> is mapped to <Plug>delimitMateRight
+<Home> is mapped to <Plug>delimitMateHome
+<End> is mapped to <Plug>delimitMateEnd
+<Up> is mapped to <Plug>delimitMateUp
+<Down> is mapped to <Plug>delimitMateDown
+<PageUp> is mapped to <Plug>delimitMatePageUp
+<PageDown> is mapped to <Plug>delimitMatePageDown
+<S-Down> is mapped to <Plug>delimitMateS-Down
+<S-Up> is mapped to <Plug>delimitMateS-Up
+<LeftMouse> is mapped to <Plug>delimitMateMLeftMouse
+<RightMouse> is mapped to <Plug>delimitMateMRightMouse
+
+The rest of the mappings correspond to parens, quotes, CR, Space, etc. and they
+depend on the values of the delimitMate options, they have the following form:
+
+<Plug>delimitMate + char
+
+e.g.: for "(":
+
+( is mapped to <Plug>delimitMate(
+
+e.g.: If you have <CR> expansion enabled, you might want to skip it on pop-up
+menus:
+
+ imap <expr> <CR> pumvisible() ?
+ \"\<c-y>" :
+ \ "<Plug>delimitMateCR"
+
+
+==============================================================================
+ 6. FUNCTIONS *delimitMateFunctions*
+
+------------------------------------------------------------------------------
+delimitMate#WithinEmptyPair() *delimitMate_WithinEmptyPair()*
+
+Returns 1 if the cursor is inside an empty pair, 0 otherwise.
+e.g.: >
+
+ inoremap <expr> <CR> delimitMate#WithinEmptyPair() ?
+ \ "\<C-R>=delimitMate#ExpandReturn()\<CR>" :
+ \ "external_mapping"
+<
+
+------------------------------------------------------------------------------
+delimitMate#ShouldJump() *delimitMate#ShouldJump()*
+
+Returns 1 if there is a closing delimiter or a quote to the right of the
+cursor, 0 otherwise.
+
+------------------------------------------------------------------------------
+delimitMate#JumpAny(key) *delimitMate#JumpAny()*
+
+This function returns a mapping that will make the cursor jump to the right
+when delimitMate#ShouldJump() returns 1, returns the argument "key" otherwise.
+e.g.: You can use this to create your own mapping to jump over any delimiter.
+>
+ inoremap <C-Tab> <C-R>=delimitMate#JumpAny("\<C-Tab>")<CR>
+<
+
+==============================================================================
+ 7. TODO LIST *delimitMateTodo*
+
+- Automatic set-up by file type.
+- Make block-wise visual wrapping work on un-even regions.
+
+==============================================================================
+ 8. MAINTAINER *delimitMateMaintainer*
+
+Hi there! My name is Israel Chauca F. and I can be reached at:
+ mailto:israelchauca@gmail.com
+
+Feel free to send me any suggestions and/or comments about this plugin, I'll
+be very pleased to read them.
+
+==============================================================================
+ 9. CREDITS *delimitMateCredits*
+
+Some of the code that make this script is modified or just shamelessly copied
+from the following sources:
+
+ - Ian McCracken
+ Post titled: Vim, Part II: Matching Pairs:
+ http://concisionandconcinnity.blogspot.com/
+
+ - Aristotle Pagaltzis
+ From the comments on the previous blog post and from:
+ http://gist.github.com/144619
+
+ - Karl Guertin
+ AutoClose:
+ http://www.vim.org/scripts/script.php?script_id=1849
+
+ - Thiago Alves
+ AutoClose:
+ http://www.vim.org/scripts/script.php?script_id=2009
+
+ - Edoardo Vacchi
+ ClosePairs:
+ http://www.vim.org/scripts/script.php?script_id=2373
+
+This script was inspired by the auto-completion of delimiters on TextMate.
+
+==============================================================================
+ 10. HISTORY *delimitMateHistory*
+
+ Version Date Release notes ~
+|---------|------------|-----------------------------------------------------|
+ 2.5.1 2010-09-30 * Current release:
+ - Remove visual wrapping. Surround.vim offers a much
+ better implementation.
+ - Minor mods to DelimitMateTest.
+|---------|------------|-----------------------------------------------------|
+ 2.5 2010-09-22 * - Better handling of mappings.
+ - Add report for mappings in |:DelimitMateTest|.
+ - Allow the use of "|" and multi-byte characters in
+ |'delimitMate_quotes'| and |'delimitMate_matchpairs'|.
+ - Allow commands to be concatenated using |.
+|---------|------------|-----------------------------------------------------|
+ 2.4.1 2010-07-31 * - Fix problem with <Home> and <End>.
+ - Add missing doc on |'delimitMate_smart_quotes'|,
+ |delimitMateBalance| and
+ |'delimitMate_balance_matchpairs'|.
+|---------|------------|-----------------------------------------------------|
+ 2.4 2010-07-29 * - Unbalanced parens: see :help delimitMateBalance.
+ - Visual wrapping now works on block-wise visual
+ with some limitations.
+ - Arrow keys didn't work on terminal.
+ - Added option to allow nested quotes.
+ - Expand Smart Quotes to look for a string on the
+ right of the cursor.
+
+|---------|------------|-----------------------------------------------------|
+ 2.3.1 2010-06-06 * - Fix: an extra <Space> is inserted after <Space>
+ expansion.
+
+|---------|------------|-----------------------------------------------------|
+ 2.3 2010-06-06 * - Syntax aware: Will turn off when editing comments
+ or other regions, customizable.
+ - Changed format of most mappings.
+ - Fix: <CR> expansion doesn't brake automatic
+ indentation adjustments anymore.
+ - Fix: Arrow keys would insert A, B, C or D instead
+ of moving the cursor when using Vim on a terminal.
+
+|---------|------------|-----------------------------------------------------|
+ 2.2 2010-05-16 * - Added command to switch the plug-in on and off.
+ - Fix: some problems with <Left>, <Right> and <CR>.
+ - Fix: A small problem when inserting a delimiter at
+ the beginning of the line.
+
+|---------|------------|-----------------------------------------------------|
+ 2.1 2010-05-10 * - Most of the functions have been moved to an
+ autoload script to avoid loading unnecessary ones.
+ - Fixed a problem with the redo command.
+ - Many small fixes.
+
+|---------|------------|-----------------------------------------------------|
+ 2.0 2010-04-01 * New features:
+ - All features are redo/undo-wise safe.
+ - A single quote typed after an alphanumeric
+ character is considered an apostrophe and one
+ single quote is inserted.
+ - A quote typed after another quote inserts a single
+ quote and the cursor jumps to the middle.
+ - <S-Tab> jumps out of any empty pair.
+ - <CR> and <Space> expansions are fixed, but the
+ functions used for it are global and can be used in
+ custom mappings. The previous system is still
+ active if you have any of the expansion options
+ set.
+ - <S-Backspace> deletes the closing delimiter.
+ * Fixed bug:
+ - s:vars were being used to store buffer options.
+
+|---------|------------|-----------------------------------------------------|
+ 1.6 2009-10-10 * Now delimitMate tries to fix the balancing of single
+ quotes when used as apostrophes. You can read
+ |delimitMate_apostrophes| for details.
+ Fixed an error when |b:delimitMate_expand_space|
+ wasn't set but |delimitMate_expand_space| wasn't.
+
+|---------|------------|-----------------------------------------------------|
+ 1.5 2009-10-05 * Fix: delimitMate should work correctly for files
+ passed as arguments to Vim. Thanks to Ben Beuchler
+ for helping to nail this bug.
+
+|---------|------------|-----------------------------------------------------|
+ 1.4 2009-09-27 * Fix: delimitMate is now enabled on new buffers even
+ if they don't have set the file type option or were
+ opened directly from the terminal.
+
+|---------|------------|-----------------------------------------------------|
+ 1.3 2009-09-24 * Now local options can be used along with autocmd
+ for specific file type configurations.
+ Fixes:
+ - Unnamed register content is not lost on visual
+ mode.
+ - Use noremap where appropiate.
+ - Wrapping a single empty line works as expected.
+
+|---------|------------|-----------------------------------------------------|
+ 1.2 2009-09-07 * Fixes:
+ - When inside nested empty pairs, deleting the
+ innermost left delimiter would delete all right
+ contiguous delimiters.
+ - When inside an empty pair, inserting a left
+ delimiter wouldn't insert the right one, instead
+ the cursor would jump to the right.
+ - New buffer inside the current window wouldn't
+ have the mappings set.
+
+|---------|------------|-----------------------------------------------------|
+ 1.1 2009-08-25 * Fixed an error that ocurred when mapleader wasn't
+ set and added support for GetLatestScripts
+ auto-detection.
+
+|---------|------------|-----------------------------------------------------|
+ 1.0 2009-08-23 * Initial upload.
+
+|---------|------------|-----------------------------------------------------|
+
+
+ `\|||/´ MMM \|/ www __^__ ~
+ (o o) (o o) @ @ (O-O) /(o o)\\ ~
+ooO_(_)_Ooo__ ooO_(_)_Ooo___oOO_(_)_OOo___oOO__(_)__OOo___oOO__(_)__OOo_____ ~
+_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____ ~
+__|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_ ~
+_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____ ~
+
+vim:tw=78:et:ts=2:sw=2:ft=help:norl:formatoptions+=tcroqn:autoindent:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/bundle/delimitMate/autoload/delimitMate.vim Mon Nov 15 17:15:57 2010 -0500
@@ -0,0 +1,538 @@
+" ============================================================================
+" File: autoload/delimitMate.vim
+" Version: 2.5.1
+" Modified: 2010-09-30
+" Description: This plugin provides auto-completion for quotes, parens, etc.
+" Maintainer: Israel Chauca F. <israelchauca@gmail.com>
+" Manual: Read ":help delimitMate".
+
+" Utilities {{{
+
+let delimitMate_loaded = 1
+
+function! delimitMate#ShouldJump() "{{{
+ " Returns 1 if the next character is a closing delimiter.
+ let col = col('.')
+ let lcol = col('$')
+ let char = getline('.')[col - 1]
+
+ " Closing delimiter on the right.
+ for cdel in b:_l_delimitMate_right_delims + b:_l_delimitMate_quotes_list
+ if char == cdel
+ return 1
+ endif
+ endfor
+
+ " Closing delimiter with space expansion.
+ let nchar = getline('.')[col]
+ if b:_l_delimitMate_expand_space && char == " "
+ for cdel in b:_l_delimitMate_right_delims + b:_l_delimitMate_quotes_list
+ if nchar == cdel
+ return 1
+ endif
+ endfor
+ endif
+
+ " Closing delimiter with CR expansion.
+ let uchar = getline(line('.') + 1)[0]
+ if b:_l_delimitMate_expand_cr && char == ""
+ for cdel in b:_l_delimitMate_right_delims + b:_l_delimitMate_quotes_list
+ if uchar == cdel
+ return 1
+ endif
+ endfor
+ endif
+
+ return 0
+endfunction "}}}
+
+function! delimitMate#IsEmptyPair(str) "{{{
+ for pair in b:_l_delimitMate_matchpairs_list
+ if a:str == join( split( pair, ':' ),'' )
+ return 1
+ endif
+ endfor
+ for quote in b:_l_delimitMate_quotes_list
+ if a:str == quote . quote
+ return 1
+ endif
+ endfor
+ return 0
+endfunction "}}}
+
+function! delimitMate#IsCRExpansion() " {{{
+ let nchar = getline(line('.')-1)[-1:]
+ let schar = getline(line('.')+1)[:0]
+ let isEmpty = getline('.') == ""
+ if index(b:_l_delimitMate_left_delims, nchar) > -1 &&
+ \ index(b:_l_delimitMate_left_delims, nchar) == index(b:_l_delimitMate_right_delims, schar) &&
+ \ isEmpty
+ return 1
+ elseif index(b:_l_delimitMate_quotes_list, nchar) > -1 &&
+ \ index(b:_l_delimitMate_quotes_list, nchar) == index(b:_l_delimitMate_quotes_list, schar) &&
+ \ isEmpty
+ return 1
+ else
+ return 0
+ endif
+endfunction " }}} delimitMate#IsCRExpansion()
+
+function! delimitMate#IsSpaceExpansion() " {{{
+ let line = getline('.')
+ let col = col('.')-2
+ if col > 0
+ let pchar = line[col - 1]
+ let nchar = line[col + 2]
+ let isSpaces = (line[col] == line[col+1] && line[col] == " ")
+
+ if index(b:_l_delimitMate_left_delims, pchar) > -1 &&
+ \ index(b:_l_delimitMate_left_delims, pchar) == index(b:_l_delimitMate_right_delims, nchar) &&
+ \ isSpaces
+ return 1
+ elseif index(b:_l_delimitMate_quotes_list, pchar) > -1 &&
+ \ index(b:_l_delimitMate_quotes_list, pchar) == index(b:_l_delimitMate_quotes_list, nchar) &&
+ \ isSpaces
+ return 1
+ endif
+ endif
+ return 0
+endfunction " }}} IsSpaceExpansion()
+
+function! delimitMate#WithinEmptyPair() "{{{
+ let cur = strpart( getline('.'), col('.')-2, 2 )
+ return delimitMate#IsEmptyPair( cur )
+endfunction "}}}
+
+function! delimitMate#WriteBefore(str) "{{{
+ let len = len(a:str)
+ let line = getline('.')
+ let col = col('.')-2
+ if col < 0
+ call setline('.',line[(col+len+1):])
+ else
+ call setline('.',line[:(col)].line[(col+len+1):])
+ endif
+ return a:str
+endfunction " }}}
+
+function! delimitMate#WriteAfter(str) "{{{
+ let len = len(a:str)
+ let line = getline('.')
+ let col = col('.')-2
+ if (col) < 0
+ call setline('.',a:str.line)
+ else
+ call setline('.',line[:(col)].a:str.line[(col+len):])
+ endif
+ return ''
+endfunction " }}}
+
+function! delimitMate#GetSyntaxRegion(line, col) "{{{
+ return synIDattr(synIDtrans(synID(a:line, a:col, 1)), 'name')
+endfunction " }}}
+
+function! delimitMate#GetCurrentSyntaxRegion() "{{{
+ let col = col('.')
+ if col == col('$')
+ let col = col - 1
+ endif
+ return delimitMate#GetSyntaxRegion(line('.'), col)
+endfunction " }}}
+
+function! delimitMate#GetCurrentSyntaxRegionIf(char) "{{{
+ let col = col('.')
+ let origin_line = getline('.')
+ let changed_line = strpart(origin_line, 0, col - 1) . a:char . strpart(origin_line, col - 1)
+ call setline('.', changed_line)
+ let region = delimitMate#GetSyntaxRegion(line('.'), col)
+ call setline('.', origin_line)
+ return region
+endfunction "}}}
+
+function! delimitMate#IsForbidden(char) "{{{
+ if b:_l_delimitMate_excluded_regions_enabled == 0
+ return 0
+ endif
+ "let result = index(b:_l_delimitMate_excluded_regions_list, delimitMate#GetCurrentSyntaxRegion()) >= 0
+ if index(b:_l_delimitMate_excluded_regions_list, delimitMate#GetCurrentSyntaxRegion()) >= 0
+ "echom "Forbidden 1!"
+ return 1
+ endif
+ let region = delimitMate#GetCurrentSyntaxRegionIf(a:char)
+ "let result = index(b:_l_delimitMate_excluded_regions_list, region) >= 0
+ "return result || region == 'Comment'
+ "echom "Forbidden 2!"
+ return index(b:_l_delimitMate_excluded_regions_list, region) >= 0
+endfunction "}}}
+
+function! delimitMate#FlushBuffer() " {{{
+ let b:_l_delimitMate_buffer = []
+ return ''
+endfunction " }}}
+
+function! delimitMate#BalancedParens(char) "{{{
+ " Returns:
+ " = 0 => Parens balanced.
+ " > 0 => More opening parens.
+ " < 0 => More closing parens.
+
+ let line = getline('.')
+ let col = col('.') - 2
+ let col = col >= 0 ? col : 0
+ let list = split(line, '\zs')
+ let left = b:_l_delimitMate_left_delims[index(b:_l_delimitMate_right_delims, a:char)]
+ let right = a:char
+ let opening = 0
+ let closing = 0
+
+ " If the cursor is not at the beginning, count what's behind it.
+ if col > 0
+ " Find the first opening paren:
+ let start = index(list, left)
+ " Must be before cursor:
+ let start = start < col ? start : col - 1
+ " Now count from the first opening until the cursor, this will prevent
+ " extra closing parens from being counted.
+ let opening = count(list[start : col - 1], left)
+ let closing = count(list[start : col - 1], right)
+ " I don't care if there are more closing parens than opening parens.
+ let closing = closing > opening ? opening : closing
+ endif
+
+ " Evaluate parens from the cursor to the end:
+ let opening += count(list[col :], left)
+ let closing += count(list[col :], right)
+
+ "echom "–––––––––"
+ "echom line
+ "echom col
+ ""echom left.":".a:char
+ "echom string(list)
+ "echom string(list[start : col - 1]) . " : " . string(list[col :])
+ "echom opening . " - " . closing . " = " . (opening - closing)
+
+ " Return the found balance:
+ return opening - closing
+endfunction "}}}
+
+" }}}
+
+" Doers {{{
+function! delimitMate#SkipDelim(char) "{{{
+ if delimitMate#IsForbidden(a:char)
+ return a:char
+ endif
+ let col = col('.') - 1
+ let line = getline('.')
+ if col > 0
+ let cur = line[col]
+ let pre = line[col-1]
+ else
+ let cur = line[col]
+ let pre = ""
+ endif
+ if pre == "\\"
+ " Escaped character
+ return a:char
+ elseif cur == a:char
+ " Exit pair
+ "return delimitMate#WriteBefore(a:char)
+ return a:char . delimitMate#Del()
+ elseif delimitMate#IsEmptyPair( pre . a:char )
+ " Add closing delimiter and jump back to the middle.
+ call insert(b:_l_delimitMate_buffer, a:char)
+ return delimitMate#WriteAfter(a:char)
+ else
+ " Nothing special here, return the same character.
+ return a:char
+ endif
+endfunction "}}}
+
+function! delimitMate#ParenDelim(char) " {{{
+ if delimitMate#IsForbidden(a:char)
+ return ''
+ endif
+ " Try to balance matchpairs
+ if b:_l_delimitMate_balance_matchpairs &&
+ \ delimitMate#BalancedParens(a:char) <= 0
+ return ''
+ endif
+ let line = getline('.')
+ let col = col('.')-2
+ if b:_l_delimitMate_smart_matchpairs &&
+ \ line[col+1] =~ '\w'
+ return ''
+ elseif (col) < 0
+ call setline('.',a:char.line)
+ call insert(b:_l_delimitMate_buffer, a:char)
+ else
+ "echom string(col).':'.line[:(col)].'|'.line[(col+1):]
+ call setline('.',line[:(col)].a:char.line[(col+1):])
+ call insert(b:_l_delimitMate_buffer, a:char)
+ endif
+ return ''
+endfunction " }}}
+
+function! delimitMate#QuoteDelim(char) "{{{
+ if delimitMate#IsForbidden(a:char)
+ return a:char
+ endif
+ let line = getline('.')
+ let col = col('.') - 2
+ if line[col] == "\\"
+ " Seems like a escaped character, insert one quotation mark.
+ return a:char
+ elseif line[col + 1] == a:char &&
+ \ index(b:_l_delimitMate_nesting_quotes, a:char) < 0
+ " Get out of the string.
+ return a:char . delimitMate#Del()
+ elseif (line[col] =~ '\w' && a:char == "'") ||
+ \ (b:_l_delimitMate_smart_quotes &&
+ \ (line[col] =~ '\w' ||
+ \ line[col + 1] =~ '\w'))
+ " Seems like an apostrophe or a smart quote case, insert a single quote.
+ return a:char
+ elseif (line[col] == a:char && line[col + 1 ] != a:char) && b:_l_delimitMate_smart_quotes
+ " Seems like we have an unbalanced quote, insert one quotation mark and jump to the middle.
+ call insert(b:_l_delimitMate_buffer, a:char)
+ return delimitMate#WriteAfter(a:char)
+ else
+ " Insert a pair and jump to the middle.
+ call insert(b:_l_delimitMate_buffer, a:char)
+ call delimitMate#WriteAfter(a:char)
+ return a:char
+ endif
+endfunction "}}}
+
+function! delimitMate#JumpOut(char) "{{{
+ if delimitMate#IsForbidden(a:char)
+ return a:char
+ endif
+ let line = getline('.')
+ let col = col('.')-2
+ if line[col+1] == a:char
+ return a:char . delimitMate#Del()
+ else
+ return a:char
+ endif
+endfunction " }}}
+
+function! delimitMate#JumpAny(key) " {{{
+ if delimitMate#IsForbidden('')
+ return a:key
+ endif
+ if !delimitMate#ShouldJump()
+ return a:key
+ endif
+ " Let's get the character on the right.
+ let char = getline('.')[col('.')-1]
+ if char == " "
+ " Space expansion.
+ "let char = char . getline('.')[col('.')] . delimitMate#Del()
+ return char . getline('.')[col('.')] . delimitMate#Del() . delimitMate#Del()
+ "call delimitMate#RmBuffer(1)
+ elseif char == ""
+ " CR expansion.
+ "let char = "\<CR>" . getline(line('.') + 1)[0] . "\<Del>"
+ let b:_l_delimitMate_buffer = []
+ return "\<CR>" . getline(line('.') + 1)[0] . "\<Del>"
+ else
+ "call delimitMate#RmBuffer(1)
+ return char . delimitMate#Del()
+ endif
+endfunction " delimitMate#JumpAny() }}}
+
+function! delimitMate#MapMsg(msg) "{{{
+ redraw
+ echomsg a:msg
+ return ""
+endfunction "}}}
+
+function! delimitMate#ExpandReturn() "{{{
+ if delimitMate#IsForbidden("")
+ return "\<CR>"
+ endif
+ if delimitMate#WithinEmptyPair()
+ " Expand:
+ call delimitMate#FlushBuffer()
+ "return "\<Esc>a\<CR>x\<CR>\<Esc>k$\"_xa"
+ return "\<CR>\<UP>\<Esc>o"
+ else
+ return "\<CR>"
+ endif
+endfunction "}}}
+
+function! delimitMate#ExpandSpace() "{{{
+ if delimitMate#IsForbidden("\<Space>")
+ return "\<Space>"
+ endif
+ if delimitMate#WithinEmptyPair()
+ " Expand:
+ call insert(b:_l_delimitMate_buffer, 's')
+ return delimitMate#WriteAfter(' ') . "\<Space>"
+ else
+ return "\<Space>"
+ endif
+endfunction "}}}
+
+function! delimitMate#BS() " {{{
+ if delimitMate#IsForbidden("")
+ return "\<BS>"
+ endif
+ if delimitMate#WithinEmptyPair()
+ "call delimitMate#RmBuffer(1)
+ return "\<BS>" . delimitMate#Del()
+" return "\<Right>\<BS>\<BS>"
+ elseif delimitMate#IsSpaceExpansion()
+ "call delimitMate#RmBuffer(1)
+ return "\<BS>" . delimitMate#Del()
+ elseif delimitMate#IsCRExpansion()
+ return "\<BS>\<Del>"
+ else
+ return "\<BS>"
+ endif
+endfunction " }}} delimitMate#BS()
+
+function! delimitMate#Del() " {{{
+ if len(b:_l_delimitMate_buffer) > 0
+ let line = getline('.')
+ let col = col('.') - 2
+ call delimitMate#RmBuffer(1)
+ call setline('.', line[:col] . line[col+2:])
+ return ''
+ else
+ return "\<Del>"
+ endif
+endfunction " }}}
+
+function! delimitMate#Finish() " {{{
+ let len = len(b:_l_delimitMate_buffer)
+ if len > 0
+ let buffer = join(b:_l_delimitMate_buffer, '')
+ let len2 = len(buffer)
+ " Reset buffer:
+ let b:_l_delimitMate_buffer = []
+ let line = getline('.')
+ let col = col('.') -2
+ "echom 'col: ' . col . '-' . line[:col] . "|" . line[col+len+1:] . '%' . buffer
+ if col < 0
+ call setline('.', line[col+len2+1:])
+ else
+ call setline('.', line[:col] . line[col+len2+1:])
+ endif
+ let i = 1
+ let lefts = "\<Left>"
+ while i < len
+ let lefts = lefts . "\<Left>"
+ let i += 1
+ endwhile
+ return substitute(buffer, "s", "\<Space>", 'g') . lefts
+ endif
+ return ''
+endfunction " }}}
+
+function! delimitMate#RmBuffer(num) " {{{
+ if len(b:_l_delimitMate_buffer) > 0
+ call remove(b:_l_delimitMate_buffer, 0, (a:num-1))
+ endif
+ return ""
+endfunction " }}}
+
+" }}}
+
+" Tools: {{{
+function! delimitMate#TestMappings() "{{{
+ let options = sort(keys(delimitMate#OptionsList()))
+ let optoutput = ['delimitMate Report', '==================', '', '* Options: (-) unset, (g) global, (b) buffer','']
+ for option in options
+ exec 'call add(optoutput, ''('.(exists('b:delimitMate_'.option) ? 'b' : exists('g:delimitMate_'.option) ? 'g' : '-').') delimitMate_''.option.'' = ''.string(b:_l_delimitMate_'.option.'))'
+ endfor
+ call append(line('$'), optoutput + ['--------------------',''])
+
+ " Check if mappings were set. {{{
+ let imaps = b:_l_delimitMate_right_delims
+ let imaps = imaps + ( b:_l_delimitMate_autoclose ? b:_l_delimitMate_left_delims : [] )
+ let imaps = imaps +
+ \ b:_l_delimitMate_quotes_list +
+ \ b:_l_delimitMate_apostrophes_list +
+ \ ['<BS>', '<S-BS>', '<Del>', '<S-Tab>', '<Esc>'] +
+ \ ['<Up>', '<Down>', '<Left>', '<Right>', '<LeftMouse>', '<RightMouse>'] +
+ \ ['<Home>', '<End>', '<PageUp>', '<PageDown>', '<S-Down>', '<S-Up>']
+ let imaps = imaps + ( b:_l_delimitMate_expand_cr ? ['<CR>'] : [] )
+ let imaps = imaps + ( b:_l_delimitMate_expand_space ? ['<Space>'] : [] )
+
+ let vmaps =
+ \ b:_l_delimitMate_right_delims +
+ \ b:_l_delimitMate_left_delims +
+ \ b:_l_delimitMate_quotes_list
+
+ let ibroken = []
+ for map in imaps
+ if maparg(map, "i") !~? 'delimitMate'
+ let output = ''
+ if map == '|'
+ let map = '<Bar>'
+ endif
+ redir => output | execute "verbose imap ".map | redir END
+ let ibroken = ibroken + [map.": is not set:"] + split(output, '\n')
+ endif
+ endfor
+
+ unlet! output
+ if ibroken == []
+ let output = ['* Mappings:', '', 'All mappings were set-up.', '--------------------', '', '']
+ else
+ let output = ['* Mappings:', ''] + ibroken + ['--------------------', '']
+ endif
+ call append('$', output+['* Showcase:', ''])
+ " }}}
+ if b:_l_delimitMate_autoclose
+ " {{{
+ for i in range(len(b:_l_delimitMate_left_delims))
+ exec "normal GGoOpen: " . b:_l_delimitMate_left_delims[i]. "|"
+ exec "normal oDelete: " . b:_l_delimitMate_left_delims[i] . "\<BS>|"
+ exec "normal oExit: " . b:_l_delimitMate_left_delims[i] . b:_l_delimitMate_right_delims[i] . "|"
+ exec "normal oSpace: " . b:_l_delimitMate_left_delims[i] . " |"
+ exec "normal oDelete space: " . b:_l_delimitMate_left_delims[i] . " \<BS>|"
+ exec "normal oCar return: " . b:_l_delimitMate_left_delims[i] . "\<CR>|"
+ exec "normal GGoDelete car return: " . b:_l_delimitMate_left_delims[i] . "\<CR>\<BS>|\<Esc>GG\<Esc>o"
+ endfor
+ for i in range(len(b:_l_delimitMate_quotes_list))
+ exec "normal GGAOpen: " . b:_l_delimitMate_quotes_list[i] . "|"
+ exec "normal oDelete: " . b:_l_delimitMate_quotes_list[i] . "\<BS>|"
+ exec "normal oExit: " . b:_l_delimitMate_quotes_list[i] . b:_l_delimitMate_quotes_list[i] . "|"
+ exec "normal oSpace: " . b:_l_delimitMate_quotes_list[i] . " |"
+ exec "normal oDelete space: " . b:_l_delimitMate_quotes_list[i] . " \<BS>|"
+ exec "normal oCar return: " . b:_l_delimitMate_quotes_list[i] . "\<CR>|"
+ exec "normal GGoDelete car return: " . b:_l_delimitMate_quotes_list[i] . "\<CR>\<BS>|\<Esc>GG\<Esc>o"
+ endfor
+ "}}}
+ else
+ "{{{
+ for i in range(len(b:_l_delimitMate_left_delims))
+ exec "normal GGoOpen & close: " . b:_l_delimitMate_left_delims[i] . b:_l_delimitMate_right_delims[i] . "|"
+ exec "normal oDelete: " . b:_l_delimitMate_left_delims[i] . b:_l_delimitMate_right_delims[i] . "\<BS>|"
+ exec "normal oExit: " . b:_l_delimitMate_left_delims[i] . b:_l_delimitMate_right_delims[i] . b:_l_delimitMate_right_delims[i] . "|"
+ exec "normal oSpace: " . b:_l_delimitMate_left_delims[i] . b:_l_delimitMate_right_delims[i] . " |"
+ exec "normal oDelete space: " . b:_l_delimitMate_left_delims[i] . b:_l_delimitMate_right_delims[i] . " \<BS>|"
+ exec "normal oCar return: " . b:_l_delimitMate_left_delims[i] . b:_l_delimitMate_right_delims[i] . "\<CR>|"
+ exec "normal GGoDelete car return: " . b:_l_delimitMate_left_delims[i] . b:_l_delimitMate_right_delims[i] . "\<CR>\<BS>|\<Esc>GG\<Esc>o"
+ endfor
+ for i in range(len(b:_l_delimitMate_quotes_list))
+ exec "normal GGoOpen & close: " . b:_l_delimitMate_quotes_list[i] . b:_l_delimitMate_quotes_list[i] . "|"
+ exec "normal oDelete: " . b:_l_delimitMate_quotes_list[i] . b:_l_delimitMate_quotes_list[i] . "\<BS>|"
+ exec "normal oExit: " . b:_l_delimitMate_quotes_list[i] . b:_l_delimitMate_quotes_list[i] . b:_l_delimitMate_quotes_list[i] . "|"
+ exec "normal oSpace: " . b:_l_delimitMate_quotes_list[i] . b:_l_delimitMate_quotes_list[i] . " |"
+ exec "normal oDelete space: " . b:_l_delimitMate_quotes_list[i] . b:_l_delimitMate_quotes_list[i] . " \<BS>|"
+ exec "normal oCar return: " . b:_l_delimitMate_quotes_list[i] . b:_l_delimitMate_quotes_list[i] . "\<CR>|"
+ exec "normal GGoDelete car return: " . b:_l_delimitMate_quotes_list[i] . b:_l_delimitMate_quotes_list[i] . "\<CR>\<BS>|\<Esc>GG\<Esc>o"
+ endfor
+ endif "}}}
+endfunction "}}}
+
+function! delimitMate#OptionsList() "{{{
+ return {'autoclose' : 1,'matchpairs': &matchpairs, 'quotes' : '" '' `', 'nesting_quotes' : [], 'expand_cr' : 0, 'expand_space' : 0, 'smart_quotes' : 1, 'smart_matchpairs' : 1, 'balance_matchpairs' : 0, 'excluded_regions' : 'Comment', 'excluded_ft' : '', 'apostrophes' : ''}
+endfunction " delimitMate#OptionsList }}}
+"}}}
+
+" vim:foldmethod=marker:foldcolumn=4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/bundle/delimitMate/autoload/delimitMateTests.vim Mon Nov 15 17:15:57 2010 -0500
@@ -0,0 +1,260 @@
+function! delimitMateTests#Main()
+ if !exists("g:delimitMate_testing")
+ echoerr "delimitMateTests#Main(): If you really want to use me, you must set delimitMate_testing to any value."
+ return
+ elseif g:delimitMate_testing == "fork"
+ !gvim -N -u NONE -U NONE -c "set backspace=eol,start" -c "set background=light" -c "syntax on" -c "let delimitMate_testing = 1" -c "so autoload/delimitMate.vim" -c "so autoload/delimitMateTests.vim" -c "so plugin/delimitMate.vim" -c "call delimitMateTests\#Main()"
+ return ""
+ endif
+ nmap <F1> :qall!<CR>
+ let nomore = &more
+ set nomore
+ let b:test_results = {}
+ let b:errors = 0
+ let b:corrects = 0
+ let b:ignores = 0
+
+ function! SetOptions(list) " {{{
+ let b:delimitMate_autoclose = 1
+ let b:delimitMate_matchpairs = &matchpairs
+ let b:delimitMate_quotes = "\" ' `"
+ let b:delimitMate_excluded_regions = "Comment"
+ let b:delimitMate_expand_space = 0
+ let b:delimitMate_expand_cr = 0
+ let b:delimitMate_smart_quotes = 1
+ let b:delimitMate_apostrophes = ""
+ let b:delimitMate_tab2exit = 1
+ " Set current test options:
+ for str in a:list
+ "echom '1:'.str
+ let op = strpart(str, 0, stridx(str,':'))
+ "echom op
+ let val = strpart(str, stridx(str, ':' ) + 1)
+ "echom val
+ exec "let b:delimitMate_" . op . " = " . val
+ endfor
+ DelimitMateReload
+ endfunction " }}}
+
+ function! Type(name, input, output, options, ...) " {{{
+ if a:0 > 0
+ let ignore = a:1
+ else
+ let ignore = 0
+ endif
+ if a:input != "\<Esc>."
+ " Set default options:
+ call SetOptions(a:options)
+ let CapR = ""
+ normal ggVG"_d
+ exec "normal i" . a:input . "|\<Esc>"
+ else
+ let CapR = "_R"
+ normal gg.
+ endif
+
+ exec "normal \<Esc>"
+ call setpos('.', [0, 1, 1, 0])
+ let result = len(a:output) != line('$')
+ for line in a:output
+ if getline('.') != line || result == 1
+ let result = 1
+ break
+ endif
+ call setpos('.', [0, line('.') + 1, 1, 0])
+ endfor
+ let text = getline('.')
+ let i = 2
+ while i <= line('$')
+ let text = text . "<cr>" . getline(i)
+ let i += 1
+ endwhile
+ if ignore == 1
+ let label = "Ignored"
+ let result = "?="
+ let b:ignores += 1
+ elseif result == 0
+ let label = "Passed"
+ let result = "=="
+ let b:corrects += 1
+ else
+ let label = "Failed"
+ let result = "!="
+ let b:errors += 1
+ endif
+ exec "let b:test_results['" .
+ \ substitute(a:name, "[^a-zA-Z0-9_]", "_", "g") . CapR . "'] = '" .
+ \ label . ": ' . a:input . ' => ' . text . ' " .
+ \ result . " ' . join(a:output, '<cr>')"
+ endfunction " }}}
+
+ function! RepeatLast(name, output, ...) " {{{
+ if a:0 > 0
+ let arg1 = a:1
+ else
+ let arg1 = ''
+ endif
+ call Type(a:name, "\<Esc>.", a:output, [], arg1)
+ endfunction " }}}
+
+ " Test's test {{{
+ call Type("Test 1", "123", ["123|"], [])
+ call RepeatLast("Test 1", ["123|123|"])
+
+ " Auto-closing parens
+ call Type("Autoclose parens", "(", ["(|)"], [])
+ call RepeatLast("Autoclose_parens", ["(|)(|)"])
+
+ " Auto-closing quotes
+ call Type("Autoclose quotes", '"', ['"|"'], [])
+ call RepeatLast("Autoclose_quotes", ['"|""|"'])
+
+ " Deleting parens
+ call Type("Delete empty parens", "(\<BS>", ["|"], [])
+ call RepeatLast("Delete empty parens", ["||"])
+
+ " Deleting quotes
+ call Type("Delete emtpy quotes", "\"\<BS>", ['|'], [])
+ call RepeatLast("Delete empty quotes", ["||"])
+
+ " Manual closing parens
+ call Type("Manual closing parens", "()", ["(|)"], ["autoclose:0"])
+ call RepeatLast("Manual closing parens", ["(|)(|)"])
+
+ " Manual closing quotes
+ call Type("Manual closing quotes", "\"\"", ['"|"'], ["autoclose:0"])
+ call RepeatLast("Manual closing quotes", ['"|""|"'])
+
+ " Jump over paren
+ call Type("Jump over paren", "()", ['()|'], [])
+ call RepeatLast("Jump over paren", ['()|()|'])
+
+ " Jump over quote
+ call Type("Jump over quote", "\"\"", ['""|'], [])
+ call RepeatLast("Jump over quote", ['""|""|'])
+
+ " Apostrophe
+ call Type("Apostrophe", "test'", ["test'|"], [])
+ call RepeatLast("Apostrophe", ["test'|test'|"])
+
+ " Close quote
+ call Type("Close quote", "'\<Del>\<Esc>a'", ["'|'"], [])
+
+ " Closing paren
+ call Type("Closing paren", "abcd)", ["abcd)|"], [])
+
+ " <S-Tab>
+ call Type("S Tab", "(\<S-Tab>", ["()|"], [])
+ call RepeatLast("S Tab", ["()|()|"])
+
+ " Space expansion
+ call Type("Space expansion", "(\<Space>\<BS>", ['(|)'], ['expand_space:1'])
+ call RepeatLast("BS with space expansion", ['(|)(|)'])
+
+ " BS with space expansion
+ call Type("BS with space expansion", "(\<Space>", ['( | )'], ['expand_space:1'])
+ call RepeatLast("Space expansion", ['( | )( | )'])
+
+ " Car return expansion
+ call Type("CR expansion", "(\<CR>", ['(', '|', ')'], ['expand_cr:1'])
+ call RepeatLast("CR expansion", ['(', '|', ')(', '|', ')'], 1)
+
+ " BS with car return expansion
+ call Type("BS with CR expansion", "(\<CR>\<BS>", ['(|)'], ['expand_cr:1'])
+ call RepeatLast("BS with CR expansion", ['(|)(|)'], 1)
+
+ " Smart quotes
+ call Type("Smart quote alphanumeric", "a\"4", ['a"4|'], [])
+ call RepeatLast("Smart quote alphanumeric", ['a"4|a"4|'])
+
+ " Smart quotes
+ call Type("Smart quote escaped", "esc\\\"", ['esc\"|'], [])
+ call RepeatLast("Smart quote escaped", ['esc\"|esc\"|'])
+
+ " Smart quotes
+ call Type("Smart quote apostrophe", "I'm", ["I'm|"], ['smart_quotes:0'])
+ call RepeatLast("Smart quote escaped", ["I'm|I'm|"])
+
+ " Backspace inside space expansion
+ call Type("Backspace inside space expansion", "(\<Space>\<BS>", ['(|)'], ['expand_space:1'])
+ call RepeatLast("Backspace inside space expansion", ['(|)(|)'])
+
+ " <Right-arrow> inserts text
+ call Type("<Right-arrow> inserts text", "(he\<Right>\<Space>th\<Right>\<Right>", ['(he) th|'], [])
+
+ " Backspace inside CR expansion
+ call Type("Backspace inside CR expansion", "(\<CR>\<BS>", ['(|)'], ['expand_cr:1'])
+ call RepeatLast("Backspace inside CR expansion", ['(|)(|)'], 1)
+
+ " FileType event
+ let g:delimitMate_excluded_ft = "vim"
+ set ft=vim
+ call Type("FileType Autoclose parens", "(", ["(|"], [])
+ unlet g:delimitMate_excluded_ft
+ set ft=
+
+ " Duplicated delimiter after CR
+ call Type("Duplicated delimiter after CR", "(\<CR>", ['(', '|)'], [])
+
+ " Deactivate on comments: The first call to a closing delimiter
+ " will not work here as expected, but it does in real life tests.
+ set ft=vim
+ call Type("Deactivate on comments", "\"()``[]''\"\"", ["\"()``[]''\"\"|"], ["autoclose:0"], 1)
+ set ft=
+
+ " Deactivate parens on comments: The first call to a closing delimiter
+ " will not work here as expected, but it does in real life tests.
+ set ft=vim
+ call Type("Deactivate parens on comments", "\"()[]", ["\"()[]|"], ["autoclose:0"], 1)
+ set ft=
+
+ " Deactivate quotes on comments: See previous note.
+ set ft=vim
+ call Type("Deactivate parens on comments", "\"(`", ["\"(``|"], [], 1)
+ set ft=
+
+ " Manual close at start of line
+ call Type("Manual close at start of line", "m)\<Left>\<Left>)", [')|m)'], ["autoclose:0"])
+
+ " Use | in quotes
+ call Type("Use <Bar> in quotes", "\<Bar>bars", ['|bars|'], ["quotes:'|'"])
+
+ " Use | in matchpairs
+ call Type("Use <Bar> in matchpairs", "\<Bar>bars", ['|bars|$$'], ["matchpairs:'|:$'"])
+
+ "}}}
+
+ " Show results: {{{
+ normal ggVG"_d
+ call append(0, split(string(b:test_results)[1:-2], ', '))
+ call append(0, "*TESTS REPORT: " . b:errors . " failed, " . b:corrects . " passed and " . b:ignores . " ignored.")
+ normal "_ddgg
+ let @/ = ".\\+Failed:.*!="
+ 2,$sort /^.\+':/
+ normal gg
+ exec search('Ignored:','nW').",$sort! /^.\\+':/"
+ set nohlsearch
+ syn match lineIgnored ".*Ignored.*"
+ syn match labelPassed "'\@<=.\+\(': 'Passed\)\@="
+ syn match labelFailed "'\@<=.\+\(': 'Failed\)\@="
+ syn match resultPassed "\('Passed: \)\@<=.\+\('$\)\@="
+ syn match resultFailed "\('Failed: \)\@<=.\+\('$\)\@=" contains=resultInequal
+ syn match resultIgnored "\('Ignored: \)\@<=.\+\('$\)\@="
+ syn match resultInequal "!="
+ syn match resultSummary "^\*.\+" contains=resultSummaryNumber
+ syn match resultSummaryNumber "[1-9][0-9]* failed*" contained
+
+ hi def link lineIgnored Ignore
+ hi def link labelPassed Comment
+ hi def link labelFailed Special
+ hi def link resultPassed Ignore
+ hi def link resultFailed Boolean
+ hi def link resultInequal Error
+ hi def link resultSummary SpecialComment
+ hi def link resultSummaryNumber Error
+ " }}}
+
+ let &more = nomore
+endfunction
+" vim:foldmethod=marker:foldcolumn=4
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/bundle/delimitMate/doc/delimitMate.txt Mon Nov 15 17:15:57 2010 -0500
@@ -0,0 +1,799 @@
+*delimitMate.txt* Trying to keep those beasts at bay! v2.5.1 *delimitMate*
+
+
+
+ MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+ MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMM MMMMM MMMMMMMMMMMMMMMMMMMMM ~
+ MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMM MMM MMMMMMMMMMMMMMMMMMMMM
+ MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMM MMM M M MMMMMMMMMM MMMMMMMMM ~
+ MMMM MMM MMM MM MM M M MMM MM MM MM MM MMM MMM MMM MM
+ MM MM M MM MMMMMM MMMMMMM MMM MMMMM MM M MMM MMM M M ~
+ M M MM MM MM MM M M MM MMM MMM MMMMM MMMMM MMM MMM M
+ M M MM MMMMM MM MM M M MM MMM MMM MMMMM MMM MMM MMM MMMM ~
+ M M MM M MM MM MM M M MM MMM MMM MMMMM MM M MMM MMM M M
+ MM MMM MMM MM MM M M MM MMM MM MMMMM MMM MMM MMM MM ~
+ MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+
+
+
+==============================================================================
+ 0.- CONTENTS *delimitMate-contents*
+
+ 1. Introduction____________________________|delimitMateIntro|
+ 2. Customization___________________________|delimitMateOptions|
+ 2.1 Options summary____________________|delimitMateOptionSummary|
+ 2.2 Options details____________________|delimitMateOptionDetails|
+ 3. Functionality___________________________|delimitMateFunctionality|
+ 3.1 Automatic closing & exiting________|delimitMateAutoClose|
+ 3.2 Expansion of space and CR__________|delimitMateExpansion|
+ 3.3 Backspace__________________________|delimitMateBackspace|
+ 3.4 Smart Quotes_______________________|delimitMateSmartQuotes|
+ 3.5 Balancing matching pairs___________|delimitMateBalance|
+ 3.6 FileType based configuration_______|delimitMateFileType|
+ 3.7 Syntax awareness___________________|delimitMateSyntax|
+ 4. Commands________________________________|delimitMateCommands|
+ 5. Mappings________________________________|delimitMateMappings|
+ 6. Functions_______________________________|delimitMateFunctions|
+ 7. TODO list_______________________________|delimitMateTodo|
+ 8. Maintainer______________________________|delimitMateMaintainer|
+ 9. Credits_________________________________|delimitMateCredits|
+ 10. History_________________________________|delimitMateHistory|
+
+==============================================================================
+ 1.- INTRODUCTION *delimitMateIntro*
+
+This plug-in provides automatic closing of quotes, parenthesis, brackets,
+etc.; besides some other related features that should make your time in insert
+mode a little bit easier.
+
+Most of the features can be modified or disabled permanently, using global
+variables, or on a FileType basis, using autocommands. With a couple of
+exceptions and limitations, this features don't brake undo, redo or history.
+
+NOTE 1: If you have any trouble with this plugin, please run |:DelimitMateTest|
+in a new buffer to see what is not working.
+
+NOTE 2: |'timeout'| needs to be set when working in the terminal, otherwise you
+might find weird behaviour with mappings including <Esc> or arrow keys.
+
+NOTE 3: Abbreiations set with |:iabbrev| will not be expanded by delimiters
+used on delimitMate, you should use <C-]> (read |i_CTRL-]|) to expand them on
+the go.
+
+==============================================================================
+ 2. CUSTOMIZATION *delimitMateOptions*
+
+You can create your own mappings for some features using the global functions.
+Read |DelimitMateFunctions| for more info.
+
+------------------------------------------------------------------------------
+ 2.1 OPTIONS SUMMARY *delimitMateOptionSummary*
+
+The behaviour of this script can be customized setting the following options
+in your vimrc file. You can use local options to set the configuration for
+specific file types, see |delimitMateOptionDetails| for examples.
+
+|'loaded_delimitMate'| Turns off the script.
+
+|'delimitMate_autoclose'| Tells delimitMate whether to automagically
+ insert the closing delimiter.
+
+|'delimitMate_matchpairs'| Tells delimitMate which characters are
+ matching pairs.
+
+|'delimitMate_quotes'| Tells delimitMate which quotes should be
+ used.
+
+|'delimitMate_nesting_quotes'| Tells delimitMate which quotes should be
+ allowed to be nested.
+
+|'delimitMate_expand_cr'| Turns on/off the expansion of <CR>.
+
+|'delimitMate_expand_space'| Turns on/off the expansion of <Space>.
+
+|'delimitMate_smart_quotes'| Turns on/off the "smart quotes" feature.
+
+|'delimitMate_smart_matchpairs'| Turns on/off the "smart matchpairs" feature.
+
+|'delimitMate_balance_matchpairs'|Turns on/off the "balance matching pairs"
+ feature.
+
+|'delimitMate_excluded_regions'| Turns off the script for the given regions or
+ syntax group names.
+
+|'delimitMate_excluded_ft'| Turns off the script for the given file types.
+
+|'delimitMate_apostrophes'| Tells delimitMate how it should "fix"
+ balancing of single quotes when used as
+ apostrophes. NOTE: Not needed any more, kept
+ for compatibility with older versions.
+
+------------------------------------------------------------------------------
+ 2.2 OPTIONS DETAILS *delimitMateOptionDetails*
+
+Add the shown lines to your vimrc file in order to set the below options.
+Buffer variables take precedence over global ones and can be used along with
+autocmd to modify delimitMate's behavior for specific file types, read more in
+|delimitMateFileType|.
+
+Note: Use buffer variables only to set options for specific file types using
+:autocmd, use global variables to set options for every buffer. Read more in
+|g:var| and |b:var|.
+
+------------------------------------------------------------------------------
+ *'loaded_delimitMate'*
+ *'b:loaded_delimitMate'*
+This option prevents delimitMate from loading.
+e.g.: >
+ let loaded_delimitMate = 1
+ au FileType mail let b:loaded_delimitMate = 1
+<
+------------------------------------------------------------------------------
+ *'delimitMate_autoclose'*
+ *'b:delimitMate_autoclose'*
+Values: 0 or 1. ~
+Default: 1 ~
+
+If this option is set to 0, delimitMate will not add a closing delimiter
+automagically. See |delimitMateAutoClose| for details.
+e.g.: >
+ let delimitMate_autoclose = 0
+ au FileType mail let b:delimitMate_autoclose = 0
+<
+------------------------------------------------------------------------------
+ *'delimitMate_matchpairs'*
+ *'b:delimitMate_matchpairs'*
+Values: A string with |'matchpairs'| syntax, plus support for multi-byte~
+ characters.~
+Default: &matchpairs ~
+
+Use this option to tell delimitMate which characters should be considered
+matching pairs. Read |delimitMateAutoClose| for details.
+e.g: >
+ let delimitMate_matchpairs = "(:),[:],{:},<:>"
+ au FileType vim,html let b:delimitMate_matchpairs = "(:),[:],{:},<:>"
+<
+------------------------------------------------------------------------------
+ *'delimitMate_quotes'*
+ *'b:delimitMate_quotes'*
+Values: A string of characters separated by spaces. ~
+Default: "\" ' `" ~
+
+Use this option to tell delimitMate which characters should be considered as
+quotes. Read |delimitMateAutoClose| for details.
+e.g.: >
+ let delimitMate_quotes = "\" ' ` *"
+ au FileType html let b:delimitMate_quotes = "\" '"
+<
+------------------------------------------------------------------------------
+ *'delimitMate_nesting_quotes'*
+ *'b:delimitMate_nesting_quotes'*
+Values: A list of quotes. ~
+Default: [] ~
+
+Quotes listed here will not be able to jump out of the empty pair, thus
+allowing the autoclosed quotes to be nested.
+e.g.: >
+ let delimitMate_nesting_quotes = ['"','`']
+ au FileType python let b:delimitMate_nesting_quotes = ['"']
+<
+------------------------------------------------------------------------------
+ *'delimitMate_expand_cr'*
+ *'b:delimitMate_expand_cr'*
+Values: 1 or 0 ~
+Default: 0 ~
+
+This option turns on/off the expansion of <CR>. Read |delimitMateExpansion|
+for details. NOTE This feature requires that 'backspace' is either set to 2 or
+has "eol" and "start" as part of its value.
+e.g.: >
+ let delimitMate_expand_cr = 1
+ au FileType mail let b:delimitMate_expand_cr = 1
+<
+------------------------------------------------------------------------------
+ *'delimitMate_expand_space'*
+ *'b:delimitMate_expand_space'*
+Values: 1 or 0 ~
+Default: 0 ~
+This option turns on/off the expansion of <Space>. Read |delimitMateExpansion|
+for details.
+e.g.: >
+ let delimitMate_expand_space = 1
+ au FileType tcl let b:delimitMate_expand_space = 1
+<
+------------------------------------------------------------------------------
+ *'delimitMate_smart_quotes'*
+ *'b:delimitMate_smart_quotes'*
+Values: 1 or 0 ~
+Default: 1 ~
+
+This option turns on/off the smart quotes feature. Read
+|delimitMateSmartQuotes| for details.
+e.g.: >
+ let delimitMate_smart_quotes = 0
+ au FileType tcl let b:delimitMate_smart_quotes = 0
+<
+------------------------------------------------------------------------------
+ *'delimitMate_smart_matchpairs'*
+ *'b:delimitMate_smart_matchpairs'*
+Values: 1 or 0 ~
+Default: 1 ~
+
+This option turns on/off the smart matchpairs feature. Read
+|delimitMateSmartMatchpairs| for details.
+e.g.: >
+ let delimitMate_smart_matchpairs = 0
+ au FileType tcl let b:delimitMate_smart_matchpairs = 0
+<
+------------------------------------------------------------------------------
+ *'delimitMate_balance_matchpairs'*
+ *'b:delimitMate_balance_matchpairs'*
+Values: 1 or 0 ~
+Default: 0 ~
+
+This option turns on/off the balancing of matching pairs. Read
+|delimitMateBalance| for details.
+e.g.: >
+ let delimitMate_balance_matchpairs = 1
+ au FileType tcl let b:delimitMate_balance_matchpairs = 1
+<
+------------------------------------------------------------------------------
+ *'delimitMate_excluded_regions'*
+Values: A string of syntax group names names separated by single commas. ~
+Default: Comment ~
+
+This options turns delimitMate off for the listed regions, read |group-name|
+for more info about what is a region.
+e.g.: >
+ let delimitMate_excluded_regions = "Comments,String"
+<
+------------------------------------------------------------------------------
+ *'delimitMate_excluded_ft'*
+Values: A string of file type names separated by single commas. ~
+Default: Empty. ~
+
+This options turns delimitMate off for the listed file types, use this option
+only if you don't want any of the features it provides on those file types.
+e.g.: >
+ let delimitMate_excluded_ft = "mail,txt"
+<
+------------------------------------------------------------------------------
+ *'delimitMate_apostrophes'*
+Values: Strings separated by ":". ~
+Default: No longer used. ~
+
+NOTE: This feature is turned off by default, it's been kept for compatibility
+with older version, read |delimitMateSmartQuotes| for details.
+If auto-close is enabled, this option tells delimitMate how to try to fix the
+balancing of single quotes when used as apostrophes. The values of this option
+are strings of text where a single quote would be used as an apostrophe (e.g.:
+the "n't" of wouldn't or can't) separated by ":". Set it to an empty string to
+disable this feature.
+e.g.: >
+ let delimitMate_apostrophes = ""
+ au FileType tcl let delimitMate_apostrophes = ""
+<
+==============================================================================
+ 3. FUNCTIONALITY *delimitMateFunctionality*
+
+------------------------------------------------------------------------------
+ 3.1 AUTOMATIC CLOSING AND EXITING *delimitMateAutoClose*
+
+With automatic closing enabled, if an opening delimiter is inserted the plugin
+inserts the closing delimiter and places the cursor between the pair. With
+automatic closing disabled, no closing delimiters is inserted by delimitMate,
+but when a pair of delimiters is typed, the cursor is placed in the middle.
+
+When the cursor is inside an empty pair or located next to the left of a
+closing delimiter, the cursor is placed outside the pair to the right of the
+closing delimiter.
+
+Unless |'delimitMate_matchpairs'| or |'delimitMate_quotes'|are set, this
+script uses the values in '&matchpairs' to identify the pairs, and ", ' and `
+for quotes respectively.
+
+The following table shows the behaviour, this applies to quotes too (the final
+position of the cursor is represented by a "|"):
+
+With auto-close: >
+ Type | You get
+ ====================
+ ( | (|)
+ –––––––––|––––––––––
+ () | ()|
+ –––––––––|––––––––––
+ (<S-Tab> | ()|
+<
+Without auto-close: >
+
+ Type | You get
+ =====================
+ () | (|)
+ –––––––––-|––––––––––
+ ()) | ()|
+ –––––––––-|––––––––––
+ ()<S-Tab> | ()|
+<
+NOTE: Abbreviations will not be expanded by delimiters used on delimitMate,
+you should use <C-]> (read |i_CTRL-]|) to expand them on the go.
+
+------------------------------------------------------------------------------
+ 3.2 EXPANSION OF SPACE AND CAR RETURN *delimitMateExpansion*
+
+When the cursor is inside an empty pair of delimiters, <Space> and <CR> can be
+expanded, see |'delimitMate_expand_space'| and
+|'delimitMate_expand_cr'|:
+
+Expand <Space> to: >
+
+ <Space><Space><Left> | You get
+ ====================================
+ (|) | ( | )
+<
+Expand <CR> to: >
+
+ <CR><CR><Up> | You get
+ ============================
+ (|) | (
+ | |
+ | )
+<
+
+NOTE that the expansion of <CR> will brake the redo command.
+
+Since <Space> and <CR> are used everywhere, I have made the functions involved
+in expansions global, so they can be used to make custom mappings. Read
+|delimitMateFunctions| for more details.
+
+------------------------------------------------------------------------------
+ 3.3 BACKSPACE *delimitMateBackspace*
+
+If you press backspace inside an empty pair, both delimiters are deleted. When
+expansions are enabled, <BS> will also delete the expansions. NOTE that
+deleting <CR> expansions will brake the redo command.
+
+If you type <S-BS> (shift + backspace) instead, only the closing delimiter
+will be deleted. NOTE that this will not usually work when using Vim from the
+terminal, see 'delimitMate#JumpAny()' below to see how to fix it.
+
+e.g. typing at the "|": >
+
+ What | Before | After
+ ==============================================
+ <BS> | call expand(|) | call expand|
+ ---------|-------------------|-----------------
+ <BS> | call expand( | ) | call expand(|)
+ ---------|-------------------|-----------------
+ <BS> | call expand( | call expand(|)
+ | | |
+ | ) |
+ ---------|-------------------|-----------------
+ <S-BS> | call expand(|) | call expand(|
+<
+
+------------------------------------------------------------------------------
+ 3.4 SMART QUOTES *delimitMateSmartQuotes*
+
+Only one quote will be inserted following a quote, a "\" or, following or
+preceding a keyword character. This should cover closing quotes after a
+string, opening quotes before a string, escaped quotes and apostrophes. Except
+for apostrophes, this feature can be disabled setting the option
+|'delimitMate_smart_quotes'| to 0.
+
+e.g. typing at the "|": >
+
+ What | Before | After
+ =======================================
+ " | Text | | Text "|"
+ " | "String| | "String"|
+ " | let i = "| | let i = "|"
+ 'm | I| | I'm|
+<
+------------------------------------------------------------------------------
+ 3.4 SMART MATCHPAIRS *delimitMateSmartMatchpairs*
+
+Like "smart quotes", but applied to parens (as well as [, {, etc.), only
+inserting the opening delimiter if preceding a keyword character. This should
+cover adding parens, etc around existing words without having to handle the
+uncessary closing delimiter. This feature can be disabled by setting the
+option |'delimitMate_smart_matchpairs'| to 0.
+
+e.g. typing at the "|": >
+
+ What | Before | After
+ =======================================
+ ( | function| | function(|)
+ ( | |var | (|var
+<
+------------------------------------------------------------------------------
+ 3.5 BALANCING MATCHING PAIRS *delimitMateBalance*
+
+When inserting an opening paren and |'delimitMate_balance_matchpairs'| is
+enabled, delimitMate will try to balance the closing pairs in the current
+line.
+
+e.g. typing at the "|": >
+
+ What | Before | After
+ =======================================
+ ( | |) | (|)
+ ( | | | (|)
+ ( | (|) | ((|))
+<
+------------------------------------------------------------------------------
+ 3.6 FILE TYPE BASED CONFIGURATION *delimitMateFileType*
+
+delimitMate options can be set globally for all buffers using global
+("regular") variables in your |vimrc| file. But |:autocmd| can be used to set
+options for specific file types (see |'filetype'|) using buffer variables in
+the following way: >
+
+ au FileType mail,text let b:delimitMate_autoclose = 0
+ ^ ^ ^ ^ ^
+ | | | | |
+ | | | | - Option value.
+ | | | - Option name.
+ | | - Buffer variable.
+ | - File types for which the option will be set.
+ - Don't forget to put this event.
+<
+NOTE that you should use buffer variables (|b:var|) only to set options with
+|:autocmd|, for global options use regular variables (|g:var|) in your vimrc.
+
+------------------------------------------------------------------------------
+ 3.7 SYNTAX AWARENESS *delimitMateSyntax*
+
+The features of this plug-in might not be always helpful, comments and strings
+usualy don't need auto-completion. delimitMate monitors which region is being
+edited and if it detects that the cursor is in a comment it'll turn itself off
+until the cursor leaves the comment. The excluded regions can be set using the
+option |'delimitMate_excluded_regions'|. Read |group-name| for a list of
+regions or syntax group names.
+
+NOTE that this feature relies on a proper syntax file for the current file
+type, if the appropiate syntax file doesn't define a region, delimitMate won't
+know about it.
+
+==============================================================================
+ 4. COMMANDS *delimitMateCommands*
+
+------------------------------------------------------------------------------
+:DelimitMateReload *:DelimitMateReload*
+
+Re-sets all the mappings used for this script, use it if any option has been
+changed or if the filetype option hasn't been set yet.
+
+------------------------------------------------------------------------------
+:DelimitMateSwitch *:DelimitMateSwitch*
+
+Switches the plug-in on and off.
+
+------------------------------------------------------------------------------
+:DelimitMateTest *:DelimitMateTest*
+
+This command tests every mapping set-up for this script, useful for testing
+custom configurations.
+
+The following output corresponds to the default values, it will be different
+depending on your configuration. "Open & close:" represents the final result
+when the closing delimiter has been inserted, either manually or
+automatically, see |delimitMateExpansion|. "Delete:" typing backspace in an
+empty pair, see |delimitMateBackspace|. "Exit:" typing a closing delimiter
+inside a pair of delimiters, see |delimitMateAutoclose|. "Space:" the
+expansion, if any, of space, see |delimitMateExpansion|. "Visual-L",
+"Visual-R" and "Visual" shows visual wrapping, see
+|delimitMateVisualWrapping|. "Car return:" the expansion of car return, see
+|delimitMateExpansion|. The cursor's position at the end of every test is
+represented by an "|": >
+
+ * AUTOCLOSE:
+ Open & close: (|)
+ Delete: |
+ Exit: ()|
+ Space: ( |)
+ Visual-L: (v)
+ Visual-R: (v)
+ Car return: (
+ |)
+
+ Open & close: {|}
+ Delete: |
+ Exit: {}|
+ Space: { |}
+ Visual-L: {v}
+ Visual-R: {v}
+ Car return: {
+ |}
+
+ Open & close: [|]
+ Delete: |
+ Exit: []|
+ Space: [ |]
+ Visual-L: [v]
+ Visual-R: [v]
+ Car return: [
+ |]
+
+ Open & close: "|"
+ Delete: |
+ Exit: ""|
+ Space: " |"
+ Visual: "v"
+ Car return: "
+ |"
+
+ Open & close: '|'
+ Delete: |
+ Exit: ''|
+ Space: ' |'
+ Visual: 'v'
+ Car return: '
+ |'
+
+ Open & close: `|`
+ Delete: |
+ Exit: ``|
+ Space: ` |`
+ Visual: `v`
+ Car return: `
+ |`
+<
+
+==============================================================================
+ 5. MAPPINGS *delimitMateMappings*
+
+delimitMate doesn't override any existing map, so you may encounter that it
+doesn't work as expected because a mapping is missing. In that case, the
+conflicting mappings should be resolved by either disabling the conflicting
+mapping or creating a custom mappings.
+
+In order to make custom mappings easier and prevent overwritting existing
+ones, delimitMate uses the |<Plug>| + |hasmapto()| (|usr_41.txt|) construct
+for its mappings.
+
+The following are the mappings alway set by delimitMate:
+
+<BS> is mapped to <Plug>delimitMateBS
+<S-BS> is mapped to <Plug>delimitMateS-BS
+<S-Tab> is mapped to <Plug>delimitMateS-Tab
+<Del> is mapped to <Plug>delimitMateDel
+<Esc> is mapped to <Plug>delimitMateEsc
+<Left> is mapped to <Plug>delimitMateLeft
+<Right> is mapped to <Plug>delimitMateRight
+<Home> is mapped to <Plug>delimitMateHome
+<End> is mapped to <Plug>delimitMateEnd
+<Up> is mapped to <Plug>delimitMateUp
+<Down> is mapped to <Plug>delimitMateDown
+<PageUp> is mapped to <Plug>delimitMatePageUp
+<PageDown> is mapped to <Plug>delimitMatePageDown
+<S-Down> is mapped to <Plug>delimitMateS-Down
+<S-Up> is mapped to <Plug>delimitMateS-Up
+<LeftMouse> is mapped to <Plug>delimitMateMLeftMouse
+<RightMouse> is mapped to <Plug>delimitMateMRightMouse
+
+The rest of the mappings correspond to parens, quotes, CR, Space, etc. and they
+depend on the values of the delimitMate options, they have the following form:
+
+<Plug>delimitMate + char
+
+e.g.: for "(":
+
+( is mapped to <Plug>delimitMate(
+
+e.g.: If you have <CR> expansion enabled, you might want to skip it on pop-up
+menus:
+
+ imap <expr> <CR> pumvisible() ?
+ \"\<c-y>" :
+ \ "<Plug>delimitMateCR"
+
+
+==============================================================================
+ 6. FUNCTIONS *delimitMateFunctions*
+
+------------------------------------------------------------------------------
+delimitMate#WithinEmptyPair() *delimitMate_WithinEmptyPair()*
+
+Returns 1 if the cursor is inside an empty pair, 0 otherwise.
+e.g.: >
+
+ inoremap <expr> <CR> delimitMate#WithinEmptyPair() ?
+ \ "\<C-R>=delimitMate#ExpandReturn()\<CR>" :
+ \ "external_mapping"
+<
+
+------------------------------------------------------------------------------
+delimitMate#ShouldJump() *delimitMate#ShouldJump()*
+
+Returns 1 if there is a closing delimiter or a quote to the right of the
+cursor, 0 otherwise.
+
+------------------------------------------------------------------------------
+delimitMate#JumpAny(key) *delimitMate#JumpAny()*
+
+This function returns a mapping that will make the cursor jump to the right
+when delimitMate#ShouldJump() returns 1, returns the argument "key" otherwise.
+e.g.: You can use this to create your own mapping to jump over any delimiter.
+>
+ inoremap <C-Tab> <C-R>=delimitMate#JumpAny("\<C-Tab>")<CR>
+<
+
+==============================================================================
+ 7. TODO LIST *delimitMateTodo*
+
+- Automatic set-up by file type.
+- Make block-wise visual wrapping work on un-even regions.
+
+==============================================================================
+ 8. MAINTAINER *delimitMateMaintainer*
+
+Hi there! My name is Israel Chauca F. and I can be reached at:
+ mailto:israelchauca@gmail.com
+
+Feel free to send me any suggestions and/or comments about this plugin, I'll
+be very pleased to read them.
+
+==============================================================================
+ 9. CREDITS *delimitMateCredits*
+
+Contributors: ~
+
+ - Kim Silkebækken ~
+ Fixed mappings being echoed in the terminal.
+
+ - Eric Van Dewoestine ~
+ Implemented smart matchpairs.
+
+Some of the code that makes this script was modified or just shamelessly
+copied from the following sources:
+
+ - Ian McCracken ~
+ Post titled: Vim, Part II: Matching Pairs:
+ http://concisionandconcinnity.blogspot.com/
+
+ - Aristotle Pagaltzis ~
+ From the comments on the previous blog post and from:
+ http://gist.github.com/144619
+
+ - Karl Guertin ~
+ AutoClose:
+ http://www.vim.org/scripts/script.php?script_id=1849
+
+ - Thiago Alves ~
+ AutoClose:
+ http://www.vim.org/scripts/script.php?script_id=2009
+
+ - Edoardo Vacchi ~
+ ClosePairs:
+ http://www.vim.org/scripts/script.php?script_id=2373
+
+This script was inspired by the auto-completion of delimiters on TextMate.
+
+==============================================================================
+ 10. HISTORY *delimitMateHistory*
+
+ Version Date Release notes ~
+|---------|------------|-----------------------------------------------------|
+ 2.5.1 2010-09-30 * Current release:
+ - Remove visual wrapping. Surround.vim offers a much
+ better implementation.
+ - Minor mods to DelimitMateTest.
+|---------|------------|-----------------------------------------------------|
+ 2.5 2010-09-22 * - Better handling of mappings.
+ - Add report for mappings in |:DelimitMateTest|.
+ - Allow the use of "|" and multi-byte characters in
+ |'delimitMate_quotes'| and |'delimitMate_matchpairs'|.
+ - Allow commands to be concatenated using |.
+|---------|------------|-----------------------------------------------------|
+ 2.4.1 2010-07-31 * - Fix problem with <Home> and <End>.
+ - Add missing doc on |'delimitMate_smart_quotes'|,
+ |delimitMateBalance| and
+ |'delimitMate_balance_matchpairs'|.
+|---------|------------|-----------------------------------------------------|
+ 2.4 2010-07-29 * - Unbalanced parens: see :help delimitMateBalance.
+ - Visual wrapping now works on block-wise visual
+ with some limitations.
+ - Arrow keys didn't work on terminal.
+ - Added option to allow nested quotes.
+ - Expand Smart Quotes to look for a string on the
+ right of the cursor.
+
+|---------|------------|-----------------------------------------------------|
+ 2.3.1 2010-06-06 * - Fix: an extra <Space> is inserted after <Space>
+ expansion.
+
+|---------|------------|-----------------------------------------------------|
+ 2.3 2010-06-06 * - Syntax aware: Will turn off when editing comments
+ or other regions, customizable.
+ - Changed format of most mappings.
+ - Fix: <CR> expansion doesn't brake automatic
+ indentation adjustments anymore.
+ - Fix: Arrow keys would insert A, B, C or D instead
+ of moving the cursor when using Vim on a terminal.
+
+|---------|------------|-----------------------------------------------------|
+ 2.2 2010-05-16 * - Added command to switch the plug-in on and off.
+ - Fix: some problems with <Left>, <Right> and <CR>.
+ - Fix: A small problem when inserting a delimiter at
+ the beginning of the line.
+
+|---------|------------|-----------------------------------------------------|
+ 2.1 2010-05-10 * - Most of the functions have been moved to an
+ autoload script to avoid loading unnecessary ones.
+ - Fixed a problem with the redo command.
+ - Many small fixes.
+
+|---------|------------|-----------------------------------------------------|
+ 2.0 2010-04-01 * New features:
+ - All features are redo/undo-wise safe.
+ - A single quote typed after an alphanumeric
+ character is considered an apostrophe and one
+ single quote is inserted.
+ - A quote typed after another quote inserts a single
+ quote and the cursor jumps to the middle.
+ - <S-Tab> jumps out of any empty pair.
+ - <CR> and <Space> expansions are fixed, but the
+ functions used for it are global and can be used in
+ custom mappings. The previous system is still
+ active if you have any of the expansion options
+ set.
+ - <S-Backspace> deletes the closing delimiter.
+ * Fixed bug:
+ - s:vars were being used to store buffer options.
+
+|---------|------------|-----------------------------------------------------|
+ 1.6 2009-10-10 * Now delimitMate tries to fix the balancing of single
+ quotes when used as apostrophes. You can read
+ |delimitMate_apostrophes| for details.
+ Fixed an error when |b:delimitMate_expand_space|
+ wasn't set but |delimitMate_expand_space| wasn't.
+
+|---------|------------|-----------------------------------------------------|
+ 1.5 2009-10-05 * Fix: delimitMate should work correctly for files
+ passed as arguments to Vim. Thanks to Ben Beuchler
+ for helping to nail this bug.
+
+|---------|------------|-----------------------------------------------------|
+ 1.4 2009-09-27 * Fix: delimitMate is now enabled on new buffers even
+ if they don't have set the file type option or were
+ opened directly from the terminal.
+
+|---------|------------|-----------------------------------------------------|
+ 1.3 2009-09-24 * Now local options can be used along with autocmd
+ for specific file type configurations.
+ Fixes:
+ - Unnamed register content is not lost on visual
+ mode.
+ - Use noremap where appropiate.
+ - Wrapping a single empty line works as expected.
+
+|---------|------------|-----------------------------------------------------|
+ 1.2 2009-09-07 * Fixes:
+ - When inside nested empty pairs, deleting the
+ innermost left delimiter would delete all right
+ contiguous delimiters.
+ - When inside an empty pair, inserting a left
+ delimiter wouldn't insert the right one, instead
+ the cursor would jump to the right.
+ - New buffer inside the current window wouldn't
+ have the mappings set.
+
+|---------|------------|-----------------------------------------------------|
+ 1.1 2009-08-25 * Fixed an error that ocurred when mapleader wasn't
+ set and added support for GetLatestScripts
+ auto-detection.
+
+|---------|------------|-----------------------------------------------------|
+ 1.0 2009-08-23 * Initial upload.
+
+|---------|------------|-----------------------------------------------------|
+
+
+ `\|||/´ MMM \|/ www __^__ ~
+ (o o) (o o) @ @ (O-O) /(o o)\\ ~
+ooO_(_)_Ooo__ ooO_(_)_Ooo___oOO_(_)_OOo___oOO__(_)__OOo___oOO__(_)__OOo_____ ~
+_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____ ~
+__|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_ ~
+_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____ ~
+
+vim:tw=78:et:ts=2:sw=2:ft=help:norl:formatoptions+=tcroqn:autoindent:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/bundle/delimitMate/plugin/delimitMate.vim Mon Nov 15 17:15:57 2010 -0500
@@ -0,0 +1,427 @@
+" ============================================================================
+" File: plugin/delimitMate.vim
+" Version: 2.5.1
+" Modified: 2010-09-30
+" Description: This plugin provides auto-completion for quotes, parens, etc.
+" Maintainer: Israel Chauca F. <israelchauca@gmail.com>
+" Manual: Read ":help delimitMate".
+
+" Initialization: {{{
+
+if exists("g:loaded_delimitMate") || &cp
+ " User doesn't want this plugin or compatible is set, let's get out!
+ finish
+endif
+let g:loaded_delimitMate = 1
+
+if exists("s:loaded_delimitMate") && !exists("g:delimitMate_testing")
+ " Don't define the functions if they already exist: just do the work
+ " (unless we are testing):
+ call s:DelimitMateDo()
+ finish
+endif
+
+if v:version < 700
+ echoerr "delimitMate: this plugin requires vim >= 7!"
+ finish
+endif
+
+let s:loaded_delimitMate = 1
+let delimitMate_version = "2.5.1"
+
+function! s:option_init(name, default) "{{{
+ let b = exists("b:delimitMate_" . a:name)
+ let g = exists("g:delimitMate_" . a:name)
+ let prefix = "_l_delimitMate_"
+
+ if !b && !g
+ let sufix = a:default
+ elseif !b && g
+ exec "let sufix = g:delimitMate_" . a:name
+ else
+ exec "let sufix = b:delimitMate_" . a:name
+ endif
+ if exists("b:" . prefix . a:name)
+ exec "unlockvar! b:" . prefix . a:name
+ endif
+ exec "let b:" . prefix . a:name . " = " . string(sufix)
+ exec "lockvar! b:" . prefix . a:name
+endfunction "}}}
+
+function! s:init() "{{{
+" Initialize variables:
+
+ " autoclose
+ call s:option_init("autoclose", 1)
+
+ " matchpairs
+ call s:option_init("matchpairs", string(&matchpairs)[1:-2])
+ call s:option_init("matchpairs_list", split(b:_l_delimitMate_matchpairs, ','))
+ call s:option_init("left_delims", split(b:_l_delimitMate_matchpairs, ':.,\='))
+ call s:option_init("right_delims", split(b:_l_delimitMate_matchpairs, ',\=.:'))
+
+ " quotes
+ call s:option_init("quotes", "\" ' `")
+ call s:option_init("quotes_list", split(b:_l_delimitMate_quotes))
+
+ " nesting_quotes
+ call s:option_init("nesting_quotes", [])
+
+ " excluded_regions
+ call s:option_init("excluded_regions", "Comment")
+ call s:option_init("excluded_regions_list", split(b:_l_delimitMate_excluded_regions, ',\s*'))
+ let enabled = len(b:_l_delimitMate_excluded_regions_list) > 0
+ call s:option_init("excluded_regions_enabled", enabled)
+
+ " excluded filetypes
+ call s:option_init("excluded_ft", "")
+
+ " expand_space
+ if exists("b:delimitMate_expand_space") && type(b:delimitMate_expand_space) == type("")
+ echom "b:delimitMate_expand_space is '".b:delimitMate_expand_space."' but it must be either 1 or 0!"
+ echom "Read :help 'delimitMate_expand_space' for more details."
+ unlet b:delimitMate_expand_space
+ let b:delimitMate_expand_space = 1
+ endif
+ if exists("g:delimitMate_expand_space") && type(g:delimitMate_expand_space) == type("")
+ echom "delimitMate_expand_space is '".g:delimitMate_expand_space."' but it must be either 1 or 0!"
+ echom "Read :help 'delimitMate_expand_space' for more details."
+ unlet g:delimitMate_expand_space
+ let g:delimitMate_expand_space = 1
+ endif
+ call s:option_init("expand_space", 0)
+
+ " expand_cr
+ if exists("b:delimitMate_expand_cr") && type(b:delimitMate_expand_cr) == type("")
+ echom "b:delimitMate_expand_cr is '".b:delimitMate_expand_cr."' but it must be either 1 or 0!"
+ echom "Read :help 'delimitMate_expand_cr' for more details."
+ unlet b:delimitMate_expand_cr
+ let b:delimitMate_expand_cr = 1
+ endif
+ if exists("g:delimitMate_expand_cr") && type(g:delimitMate_expand_cr) == type("")
+ echom "delimitMate_expand_cr is '".g:delimitMate_expand_cr."' but it must be either 1 or 0!"
+ echom "Read :help 'delimitMate_expand_cr' for more details."
+ unlet g:delimitMate_expand_cr
+ let g:delimitMate_expand_cr = 1
+ endif
+ if ((&backspace !~ 'eol' || &backspace !~ 'start') && &backspace != 2) &&
+ \ ((exists('b:delimitMate_expand_cr') && b:delimitMate_expand_cr == 1) ||
+ \ (exists('g:delimitMate_expand_cr') && g:delimitMate_expand_cr == 1))
+ echom "delimitMate: There seems to be some incompatibility with your settings that may interfer with the expansion of <CR>. See :help 'delimitMate_expand_cr' for details."
+ endif
+ call s:option_init("expand_cr", 0)
+
+ " smart_matchpairs
+ call s:option_init("smart_matchpairs", 1)
+
+ " smart_quotes
+ call s:option_init("smart_quotes", 1)
+
+ " apostrophes
+ call s:option_init("apostrophes", "")
+ call s:option_init("apostrophes_list", split(b:_l_delimitMate_apostrophes, ":\s*"))
+
+ " tab2exit
+ call s:option_init("tab2exit", 1)
+
+ " balance_matchpairs
+ call s:option_init("balance_matchpairs", 0)
+
+ let b:_l_delimitMate_buffer = []
+
+ let b:loaded_delimitMate = 1
+
+endfunction "}}} Init()
+
+"}}}
+
+" Functions: {{{
+
+function! s:Map() "{{{
+ " Set mappings:
+ try
+ let save_cpo = &cpo
+ let save_keymap = &keymap
+ let save_iminsert = &iminsert
+ let save_imsearch = &imsearch
+ set keymap=
+ set cpo&vim
+ if b:_l_delimitMate_autoclose
+ call s:AutoClose()
+ else
+ call s:NoAutoClose()
+ endif
+ call s:ExtraMappings()
+ finally
+ let &cpo = save_cpo
+ let &keymap = save_keymap
+ let &iminsert = save_iminsert
+ let &imsearch = save_imsearch
+ endtry
+
+ let b:delimitMate_enabled = 1
+
+endfunction "}}} Map()
+
+function! s:Unmap() " {{{
+ let imaps =
+ \ b:_l_delimitMate_right_delims +
+ \ b:_l_delimitMate_left_delims +
+ \ b:_l_delimitMate_quotes_list +
+ \ b:_l_delimitMate_apostrophes_list +
+ \ ['<BS>', '<S-BS>', '<Del>', '<CR>', '<Space>', '<S-Tab>', '<Esc>'] +
+ \ ['<Up>', '<Down>', '<Left>', '<Right>', '<LeftMouse>', '<RightMouse>'] +
+ \ ['<Home>', '<End>', '<PageUp>', '<PageDown>', '<S-Down>', '<S-Up>']
+
+ for map in imaps
+ if maparg(map, "i") =~? 'delimitMate'
+ if map == '|'
+ let map = '<Bar>'
+ endif
+ exec 'silent! iunmap <buffer> ' . map
+ endif
+ endfor
+
+ if !has('gui_running')
+ silent! iunmap <C-[>OC
+ endif
+
+ let b:delimitMate_enabled = 0
+endfunction " }}} s:Unmap()
+
+function! s:TestMappingsDo() "{{{
+ %d
+ if !exists("g:delimitMate_testing")
+ silent call delimitMate#TestMappings()
+ else
+ let temp_varsDM = [b:_l_delimitMate_expand_space, b:_l_delimitMate_expand_cr, b:_l_delimitMate_autoclose]
+ for i in [0,1]
+ let b:delimitMate_expand_space = i
+ let b:delimitMate_expand_cr = i
+ for a in [0,1]
+ let b:delimitMate_autoclose = a
+ call s:init()
+ call s:Unmap()
+ call s:Map()
+ call delimitMate#TestMappings()
+ normal o
+ endfor
+ endfor
+ let b:delimitMate_expand_space = temp_varsDM[0]
+ let b:delimitMate_expand_cr = temp_varsDM[1]
+ let b:delimitMate_autoclose = temp_varsDM[2]
+ unlet temp_varsDM
+ endif
+ normal gg
+ g/\%^$/d
+endfunction "}}}
+
+function! s:DelimitMateDo(...) "{{{
+ " Initialize settings:
+ call s:init()
+
+ " Check if this file type is excluded:
+ if exists("g:delimitMate_excluded_ft") &&
+ \ index(split(g:delimitMate_excluded_ft, ','), &filetype, 0, 1) >= 0
+
+ " Remove any magic:
+ call s:Unmap()
+
+ " Finish here:
+ return 1
+ endif
+
+ " First, remove all magic, if needed:
+ if exists("b:delimitMate_enabled") && b:delimitMate_enabled == 1
+ call s:Unmap()
+ endif
+
+ " Now, add magic:
+ call s:Map()
+
+ if a:0 > 0
+ echo "delimitMate has been reset."
+ endif
+endfunction "}}}
+
+function! s:DelimitMateSwitch() "{{{
+ call s:init()
+ if exists("b:delimitMate_enabled") && b:delimitMate_enabled
+ call s:Unmap()
+ echo "delimitMate has been disabled."
+ else
+ call s:Unmap()
+ call s:Map()
+ echo "delimitMate has been enabled."
+ endif
+endfunction "}}}
+
+function! s:Finish()
+ if exists('g:delimitMate_loaded')
+ return delimitMate#Finish()
+ endif
+ return ''
+endfunction
+
+function! s:FlushBuffer()
+ if exists('g:delimitMate_loaded')
+ return delimitMate#FlushBuffer()
+ endif
+ return ''
+endfunction
+
+"}}}
+
+" Mappers: {{{
+function! s:NoAutoClose() "{{{
+ " inoremap <buffer> ) <C-R>=delimitMate#SkipDelim('\)')<CR>
+ for delim in b:_l_delimitMate_right_delims + b:_l_delimitMate_quotes_list
+ if delim == '|'
+ let delim = '<Bar>'
+ endif
+ exec 'inoremap <silent> <Plug>delimitMate' . delim . ' <C-R>=delimitMate#SkipDelim("' . escape(delim,'"') . '")<CR>'
+ exec 'silent! imap <unique> <buffer> '.delim.' <Plug>delimitMate'.delim
+ endfor
+endfunction "}}}
+
+function! s:AutoClose() "{{{
+ " Add matching pair and jump to the midle:
+ " inoremap <silent> <buffer> ( ()<Left>
+ let i = 0
+ while i < len(b:_l_delimitMate_matchpairs_list)
+ let ld = b:_l_delimitMate_left_delims[i] == '|' ? '<bar>' : b:_l_delimitMate_left_delims[i]
+ let rd = b:_l_delimitMate_right_delims[i] == '|' ? '<bar>' : b:_l_delimitMate_right_delims[i]
+ exec 'inoremap <silent> <Plug>delimitMate' . ld . ' ' . ld . '<C-R>=delimitMate#ParenDelim("' . escape(rd, '|') . '")<CR>'
+ exec 'silent! imap <unique> <buffer> '.ld.' <Plug>delimitMate'.ld
+ let i += 1
+ endwhile
+
+ " Exit from inside the matching pair:
+ for delim in b:_l_delimitMate_right_delims
+ exec 'inoremap <silent> <Plug>delimitMate' . delim . ' <C-R>=delimitMate#JumpOut("\' . delim . '")<CR>'
+ exec 'silent! imap <unique> <buffer> ' . delim . ' <Plug>delimitMate'. delim
+ endfor
+
+ " Add matching quote and jump to the midle, or exit if inside a pair of matching quotes:
+ " inoremap <silent> <buffer> " <C-R>=delimitMate#QuoteDelim("\"")<CR>
+ for delim in b:_l_delimitMate_quotes_list
+ if delim == '|'
+ let delim = '<Bar>'
+ endif
+ exec 'inoremap <silent> <Plug>delimitMate' . delim . ' <C-R>=delimitMate#QuoteDelim("\' . delim . '")<CR>'
+ exec 'silent! imap <unique> <buffer> ' . delim . ' <Plug>delimitMate' . delim
+ endfor
+
+ " Try to fix the use of apostrophes (kept for backward compatibility):
+ " inoremap <silent> <buffer> n't n't
+ for map in b:_l_delimitMate_apostrophes_list
+ exec "inoremap <silent> " . map . " " . map
+ exec 'silent! imap <unique> <buffer> ' . map . ' <Plug>delimitMate' . map
+ endfor
+endfunction "}}}
+
+function! s:ExtraMappings() "{{{
+ " If pair is empty, delete both delimiters:
+ inoremap <silent> <Plug>delimitMateBS <C-R>=delimitMate#BS()<CR>
+ " If pair is empty, delete closing delimiter:
+ inoremap <silent> <expr> <Plug>delimitMateS-BS delimitMate#WithinEmptyPair() ? "\<C-R>=delimitMate#Del()\<CR>" : "\<S-BS>"
+ " Expand return if inside an empty pair:
+ inoremap <silent> <Plug>delimitMateCR <C-R>=delimitMate#ExpandReturn()<CR>
+ " Expand space if inside an empty pair:
+ inoremap <silent> <Plug>delimitMateSpace <C-R>=delimitMate#ExpandSpace()<CR>
+ " Jump out ot any empty pair:
+ inoremap <silent> <Plug>delimitMateS-Tab <C-R>=delimitMate#JumpAny("\<S-Tab>")<CR>
+ " Change char buffer on Del:
+ inoremap <silent> <Plug>delimitMateDel <C-R>=delimitMate#Del()<CR>
+ " Flush the char buffer on movement keystrokes or when leaving insert mode:
+ for map in ['Esc', 'Left', 'Right', 'Home', 'End']
+ exec 'inoremap <silent> <Plug>delimitMate'.map.' <C-R>=<SID>Finish()<CR><'.map.'>'
+ if !hasmapto('<Plug>delimitMate'.map, 'i')
+ exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
+ endif
+ endfor
+ " Except when pop-up menu is active:
+ for map in ['Up', 'Down', 'PageUp', 'PageDown', 'S-Down', 'S-Up']
+ exec 'inoremap <silent> <expr> <Plug>delimitMate'.map.' pumvisible() ? "\<'.map.'>" : "\<C-R>=\<SID>Finish()\<CR>\<'.map.'>"'
+ if !hasmapto('<Plug>delimitMate'.map, 'i')
+ exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
+ endif
+ endfor
+ " Avoid ambiguous mappings:
+ for map in ['LeftMouse', 'RightMouse']
+ exec 'inoremap <silent> <Plug>delimitMateM'.map.' <C-R>=delimitMate#Finish()<CR><'.map.'>'
+ if !hasmapto('<Plug>delimitMate'.map, 'i')
+ exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMateM'.map
+ endif
+ endfor
+
+ " Map away!
+ if !hasmapto('<Plug>delimitMateDel', 'i')
+ silent! imap <unique> <buffer> <Del> <Plug>delimitMateDel
+ endif
+ if !hasmapto('<Plug>delimitMateBS','i')
+ silent! imap <unique> <buffer> <BS> <Plug>delimitMateBS
+ endif
+ if !hasmapto('<Plug>delimitMateS-BS','i')
+ silent! imap <unique> <buffer> <S-BS> <Plug>delimitMateS-BS
+ endif
+ if b:_l_delimitMate_expand_cr != 0 && !hasmapto('<Plug>delimitMateCR', 'i')
+ silent! imap <unique> <buffer> <CR> <Plug>delimitMateCR
+ endif
+ if b:_l_delimitMate_expand_space != 0 && !hasmapto('<Plug>delimitMateSpace', 'i')
+ silent! imap <unique> <buffer> <Space> <Plug>delimitMateSpace
+ endif
+ if b:_l_delimitMate_tab2exit && !hasmapto('<Plug>delimitMateS-Tab', 'i')
+ silent! imap <unique> <buffer> <S-Tab> <Plug>delimitMateS-Tab
+ endif
+ " The following simply creates an ambiguous mapping so vim fully processes
+ " the escape sequence for terminal keys, see 'ttimeout' for a rough
+ " explanation, this just forces it to work
+ if !has('gui_running')
+ imap <silent> <C-[>OC <RIGHT>
+ endif
+endfunction "}}}
+
+"}}}
+
+" Commands: {{{
+
+call s:DelimitMateDo()
+
+" Let me refresh without re-loading the buffer:
+command! -bar DelimitMateReload call s:DelimitMateDo(1)
+
+" Quick test:
+command! -bar DelimitMateTest silent call s:TestMappingsDo()
+
+" Switch On/Off:
+command! -bar DelimitMateSwitch call s:DelimitMateSwitch()
+"}}}
+
+" Autocommands: {{{
+
+augroup delimitMate
+ au!
+ " Run on file type change.
+ "autocmd VimEnter * autocmd FileType * call <SID>DelimitMateDo()
+ autocmd FileType * call <SID>DelimitMateDo()
+
+ " Run on new buffers.
+ autocmd BufNewFile,BufRead,BufEnter *
+ \ if !exists("b:loaded_delimitMate") |
+ \ call <SID>DelimitMateDo() |
+ \ endif
+
+ " Flush the char buffer:
+ autocmd InsertEnter * call <SID>FlushBuffer()
+ autocmd BufEnter *
+ \ if mode() == 'i' |
+ \ call <SID>FlushBuffer() |
+ \ endif
+
+augroup END
+
+"}}}
+
+" GetLatestVimScripts: 2754 1 :AutoInstall: delimitMate.vim
+" vim:foldmethod=marker:foldcolumn=4
--- a/vim/bundle/histwin/Makefile Mon Nov 15 08:40:32 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-SCRIPT=$(wildcard plugin/*.vim)
-AUTOL =$(wildcard autoload/*.vim)
-DOC=$(wildcard doc/*.txt)
-PLUGIN=$(shell basename "$$PWD")
-VERSION=$(shell sed -n '/Version:/{s/^.*\(\S\.\S\+\)$$/\1/;p}' $(SCRIPT))
-
-.PHONY: $(PLUGIN).vba README
-
-all: uninstall vimball install README
-
-vimball: $(PLUGIN).vba
-
-clean:
- rm -f *.vba */*.orig *.~* .VimballRecord
-
-dist-clean: clean
-
-install:
- vim -N -c':so %' -c':q!' $(PLUGIN)-$(VERSION).vba
-
-uninstall:
- vim -N -c':RmVimball' -c':q!' $(PLUGIN)-$(VERSION).vba
-
-undo:
- for i in */*.orig; do mv -f "$$i" "$${i%.*}"; done
-
-README:
- cp -f $(DOC) README
-
-$(PLUGIN).vba:
- rm -f $(PLUGIN)-$(VERSION).vba
- vim -N -c 'ru! vimballPlugin.vim' -c ':call append("0", [ "$(SCRIPT)", "$(AUTOL)", "$(DOC)"])' -c '$$d' -c ":%MkVimball $(PLUGIN)-$(VERSION) ." -c':q!'
- ln -f $(PLUGIN)-$(VERSION).vba $(PLUGIN).vba
-
-release: version all
-
-version:
- perl -i.orig -pne 'if (/Version:/) {s/\.(\d*)/sprintf(".%d", 1+$$1)/e}' ${SCRIPT} ${AUTOL}
- perl -i.orig -pne 'if (/g:loaded_undo_browse =/) {s/\.(\d*)/sprintf(".%d", 1+$$1)/e}' ${SCRIPT}
- perl -i -pne 'if (/GetLatestVimScripts:/) {s/(\d+)\s+:AutoInstall:/sprintf("%d :AutoInstall:", 1+$$1)/e}' ${SCRIPT} ${AUTOL}
- #perl -i -pne 'if (/Last Change:/) {s/\d+\.\d+\.\d\+$$/sprintf("%s", `date -R`)/e}' ${SCRIPT}
- perl -i -pne 'if (/Last Change:/) {s/(:\s+).*\n/sprintf(": %s", `date -R`)/e}' ${SCRIPT} ${AUTOL}
- perl -i.orig -pne 'if (/Version:/) {s/\.(\d+).*\n/sprintf(".%d %s", 1+$$1, `date -R`)/e}' ${DOC}
- VERSION=$(shell sed -n '/Version:/{s/^.*\(\S\.\S\+\)$$/\1/;p}' $(SCRIPT))
--- a/vim/bundle/histwin/README Mon Nov 15 08:40:32 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-*histwin.txt* Plugin to browse the undo-tree
-
-Version: 0.15 Thu, 07 Oct 2010 23:47:20 +0200
-Author: Christian Brabandt <cb@256bit.org>
-Copyright: (c) 2009, 2010 by Christian Brabandt *histwin-copyright*
- The VIM LICENSE applies to histwin.vim and histwin.txt
- (see |copyright|) except use histwin instead of "Vim".
- NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK.
-
-==============================================================================
-1. Contents *histwin-contents*
-
-1. Contents.................................................|histwin-contents|
-2. Functionality............................................|histwin-plugin|
- Opening the Undo-Tree Window.............................|histwin-browse|
- Using tags...............................................|histwin-tags|
-3. Keybindings..............................................|histwin-keys|
-4. Configuration............................................|histwin-config|
- Configuraion Variables...................................|histwin-var|
- Color Configuration......................................|histwin-color|
- Undolevels settings......................................|histwin-ut|
-5. Feedback.................................................|histwin-feedback|
-6. History..................................................|histwin-history|
-
-==============================================================================
- *histwin-plugin* *histwin*
-2. Functionality
-
-This plugin was written to allow an easy way of browsing the |undo-tree|, that
-is available with Vim. This allows to go back to any change that has been made
-previously, because these states are remembered by Vim within a branch in the
-undo-history. You can use |g-| or |g+| to move in Vim within the different
-undo-branches.
-
-Unfortunately, going back to any state isn't very comfortable and you always
-need to remember at what time you did that change. Therefore the
-histwin-Plugin allows to easily view the available states and branch back to
-any of these states. It opens a new window, which contains all available
-states and using this plugin allows you to tag a previous change or go back to
-a particular state.
-
- *histwin-browse* *:UB*
-2.1 Opening the Undo-Tree Window
-
-By default you can open the Undo-Tree Window by issuing :UB (Mnemonic:
-UndoBrowse). If you do this, you will see a window that looks
-like this:
-
-+------------------------------------------------------+
-|Undo-Tree: FILENAME |#!/bin/bash |
-|====================== | |
-| | |
-|" actv. keys in this window |if [ $# -ne 2 ]; the |
-|" I toggles help screen | echo "Name: $0: arg|
-|" <Enter> goto undo branch | echo |
-|" <C-L> Update view | exit 1 |
-|" T Tag sel. branch |fi |
-|" P Toggle view | |
-|" D Diff sel. branch |if true; then |
-|" R Replay sel. branch | dir="${1%/*}" |
-|" C Clear all tags | file="${1##*/}" |
-|" Q Quit window | target="${2}/${di |
-|" | if [ ! -e "${targ |
-|" Undo-Tree, v0.13 | mkdir -p "$ta |
-| | mv "$1" "$tar |
-|Nr Time Fl Tag | |
-|1) Sep 01 /Start Editing/| |
-|2) Sep 01 ! /First draft/ | |
-|3) 23:01:22 | |
-|4) 23:02:57 * /Release 1/ | |
-|5) 23:05:04 | |
-+------------------------------------------------------+
-
-This shows an extract of a sample file on the right side. The window on the
-left side, contains an overview of all available states that are known for
-this buffer or that have been tagged to remember that change.
-
-The first line contains 'Undo-Tree: filename' so that the user knows, for
-which file this window shows the available undo-branches. This is the heading.
-
-Following the heading is a small information banner, that contains the most
-important key combinations, that are available in this window.
-
-After that list, all available undo-changes are displayed. This is a list,
-that contains the number, the time this change was made, some flags and the
-tags, that have been entered.
-
-The flags can be any of '!' or '*'. The '!' indicates, that this particular
-undo branch (that was probably tagged before) isn't available any more. The
-'*' indicates, if that particular undo branch has been saved before (but is
-only visible in the dense view). See |histwin-ut| on why certain states might
-become inaccessible and what can be done against it.
-
-In the detailed view, that is by default displayed, when you press 'P', the
-undo branch list will possibly be much longer. That is, because in this view,
-each save state will be displayed (along with it's save number). You
-can imagine, that this list might become very long.
-
-Additionally, the Change number, that identifies each change in the undo tree
-will be displayed. The change number can be used with the |:undo| command to
-jump to a particular change and the save number is useful with the |:earlier|
-and |:later| commands.
-
-The active undo-branch on the right side is highlighted with the UBActive
-highlighting and the cursor will be positioned on that line. Use >
-
-:hi UBActive
-
-to see how it will be highlighted. See also |histwin-color|.
-
-
- *histwin-tags*
-
-By default, tags that you enter will be volatile. That is, whenever you quit
-Vim, these tags are lost. Currently there is no way, to store or retrieve old
-tags.
-
-This behaviour was okay, until with Vim 7.3 the new permanent undo feature was
-included into Vim which makes undo information available even after restarting
-Vim. Starting with Vim 7.3 it is often desirable, to also store the tag
-information permanently.
-
-There is an easy way, to store your tag information easily, though. You can
-make use of the |viminfo| file, that stores states and search patterns and a
-like for later use. If you include the '!' flag when setting the option, vim
-will also store global variables, which then will be read back when restarting
-Vim (or by use of |rviminfo|). So if you like your tags be stored permanently,
-be sure, that you set your viminfo option correctly.
-
-(Note, currently, the viminfo file only stores global variables of type
-String, Float or Number, it can't store Dictionaries of Lists. There is a
-patch available, that will hopefully be soon be integrated in Vim mainline.
-So even if you set up your |viminfo| file correctly, the histwin plugin won't
-be able to restore your tags)
-
-==============================================================================
- *histwin-keys*
-3. Keybindings
-
-By default, the following keys are active in Normal mode in the Undo-Tree
-window:
-
-'Enter' Go to the branch, on which is selected with the cursor. By default,
- if switching to an older branch, the buffer will be set to
- 'nomodifiable'. If you don't want that, you need to set the
- g:undo_tree_nomod variable to off (see |histwin-var|).
-'<C-L>' Update the window
-'T' Tag the branch, that is selected. You'll be prompted for a tag.
- To make the tag permanent, see |histwin-tags|
-'P' Toggle view (the change-number and save number will be displayed).
- You can use this number to go directly to that change (see |:undo|).
- Additionally the saved counter will be displayed, which can be used
- to go directly to the text version of a file write using |later| or
- |earlier|.
-'D' Start diff mode with the branch that is selected by the cursor.
- (see |08.7|)
-'R' Replay all changes, that have been made from the beginning.
- (see |histwin-config| for adjusting the speed)
-'C' Clear all tags.
-'Q' Quit window
-
-==============================================================================
- *histwin-var* *histwin-config*
-4.1 Configuration variables
-
-You can adjust several parameters for the Undo-Tree window, by setting some
-variables in your .vimrc file.
-
-------------------------------------------------------------------------------
-
-4.1.1 Disable printing the help
-
-To always show only a small information banner, set this in your .vimrc
-(by default this variable is 1) >
-
- :let g:undo_tree_help = 0
-
-------------------------------------------------------------------------------
-
-4.1.2 Display more details
-
-To always display the detailed view (which includes the Change number and the
-file save counter), set the g:undo_tree_dtl=0:
-(by default, this variable is 1) >
-
- :let g:undo_tree_dtl = 0
-
-The change number can be used to directly jump to a undo state using |:undo|
-and the save counter can be used to directly go to the buffer's state when the
-file was written using |:earlier| and |:later|
-
-------------------------------------------------------------------------------
-
-4.1.3 Customize the replay speed
-
-The speed with which to show each change, when replaying a undo-branch can be
-adjusted by setting to a value in milliseconds. If not specified, this is
-100ms. >
-
- :let g:undo_tree_speed=200
-
-------------------------------------------------------------------------------
-
-4.1.4 Adjust the window size.
-
-You can adjust the windows size by setting g:undo_tree_wdth to the number of
-columns you like. By default this is considered 30. When the change number is
-included in the list (see above), this value will increase by 10. >
-
- :let g:undo_tree_wdth=40
-
-This will change the width of the window to 40 or 50, if the change number
-is included.
-
-------------------------------------------------------------------------------
-
-4.1.5 Read-only and writable buffer states
-
-By default, old buffer states are set read only and you cannot modify these.
-This was done, since the author of the plugin started browsing the undo
-branches and started changing older versions over and over again. This is
-really confusing, since you start creating even more branches and you might
-end up fixing old bugs over and over.
-
-This is what happened to the author of this plugin, so now there is a
-configuration available that will set old buffers to be only read-only.
-Currently, this works, by detecting, if the cursor was on the last branch in
-the histwin window, and if the cursor was not on the last branch, the buffer
-will be set 'nomodifiable'. You can always set the buffer to be modifiable by
-issuing: >
-
- :setl modifiable
-
-The default is to set the buffer read only. To disable this, you can set the
-g:undo_tree_nomod variable in your |.vimrc| like this: >
-
- :let g:undo_tree_nomod = 0
-
-------------------------------------------------------------------------------
-
- *histwin-color*
-4.2 Color configuration
-
-If you want to customize the colors, you can simply change the following
-groups, that are defined by the Undo-Tree Browser:
-
-UBTitle this defines the color of the title file-name. By default this links
- to Title (see |hl-Title|)
-UBInfo this defines how the information banner looks like. By default this
- links to Comment.
-UBList this group defines the List items at the start e.g. 1), 2), This
- links to Identifier.
-UBTime this defines, how the time is displayed. This links to Underlined.
-UBTag This defines, how the tag should be highlighted. By default this
- links to Special
-UBDelim This group defines the look of the delimiter for the tag. By default
- this links to Ignore
-UBActive This group defines how the active selection is displayed. By default
- this links to PmenuSel (see |hl-PmenuSel|)
-UBKey This group defines, how keys are displayed within the information
- banner. By default, this links to SpecialKey (see |hl-SpecialKey|)
-
-Say you want to change the color for the Tag values and you think, it should
-look like |IncSerch|, so you can do this in your .vimrc file: >
-
-:hi link UBTag IncSearch
-
-------------------------------------------------------------------------------
-
- *histwin-ut*
-4.3 Undolevel settings
-
-When using Vim's |persistent-undo| feature and making many changes, you might
-encounter the situation, when some of your tags will be flagged with an '!'.
-This happens, when these undo-states are not available any more. This happens
-especially, when making so many changes, that your 'undolevels' setting
-interferes. Basically you have done so many changes, that your first changes
-will already be deleted. So the obvious fix is to set the 'undolevels' setting
-to a much higher value, like 10,000 or even higher. This will however increase
-the memory usage quite a lot.
-
-==============================================================================
- *histwin-feedback*
-5. Feedback
-
-Feedback is always welcome. If you like the plugin, please rate it at the
-vim-page:
-http://www.vim.org/scripts/script.php?script_id=2932
-
-You can also follow the development of the plugin at github:
-http://github.com/chrisbra/histwin.vim
-
-Please don't hesitate to report any bugs to the maintainer, mentioned in the
-third line of this document.
-
-==============================================================================
- *histwin-history*
-6. histwin History
-
-0.14 - don't fix the width of the histwin window
- - now use the undotree() function by default (if patch 7.3.005 is
- included)
- - display save states in the detailed view
- - display the '!' when a state is not accessible anymore
- - fixed an annoying bug, that when jumping to a particular undo state,
- the plugin would jump to the wrong state (I hate octal mode)
- - Make displaying the time much more reliable and also don't display
- the time, if the change happened more than 24h ago (instead, display
- the date, when this change was done).
- - slightly improved error handling.
- - prepare plugin, to permantly store the undotags in the viminfo file
- (this isn't supported by a plain vanilla vim and requires a patch)
- - A major rewrite (code cleanup, better documentation)
-0.13 - New version that uses Vim 7.3 persistent undo features
- |new-persistent-undo|
- - Display saved counter in detailed view
- - Display indicator for saved branches.
- - in diff mode, don't set the original buffer to be nomodifiable
- (so you can always merge chunks).
- - Check for Vim Version 7.3 (the plugin won't work with older versions
- of Vim)
-0.12 - Small extension to the help file
- - generate help file with 'et' set, so the README at github looks
- better
- - Highlight the key binding using |hl-SpecialKey|
- - The help tag for the color configuration was wrong.
-0.11 - Set old buffers read only (disable the setting via the
- g:undo_tree_nomod variable
- - Make sure, Warning Messages are really displayed using :unsilent
-0.10 - Fixed annoying Resizing bug
- - linebreak tags, if they are too long
- - dynamically grow the histwin window, for longer tags (up
- to a maximum)
- - Bugfix: Always indicate the correct branch
- - Added a few try/catch statements and some error handling
-0.9 - Error handling for Replaying (it may not work always)
- - Documentation
- - Use syntax highlighting
- - Tagging finally works
-0.8 - code cleanup
- - make speed of the replay adjustable. Use g:undo_tree_speed to set
- time in milliseconds
-0.7.2 - make sure, when switching to a different undo-branch, the undo-tree will be reloaded
- - check 'undolevel' settings
-0.7.1 - fixed a problem with mapping the keys which broke the Undo-Tree keys
- (I guess I don't fully understand, when to use s: and <sid>)
-0.7 - created autoloadPlugin (patch by Charles Campbell) Thanks!
- - enabled GLVS (patch by Charles Campbell) Thanks!
- - cleaned up old comments
- - deleted :noautocmd which could cause trouble with other plugins
- - small changes in coding style (<sid> to s:, fun instead of fu)
- - made Plugin available as histwin.vba
- - Check for availability of :UB before defining it
- (could already by defined Blockquote.vim does for example)
-0.6 - fix missing bufname() when creating the undo_tree window
- - make undo_tree window a little bit smaller
- (size is adjustable via g:undo_tree_wdth variable)
-0.5 - add missing endif (which made version 0.4 unusuable)
-0.4 - Allow diffing with selected branch
- - highlight current version
- - Fix annoying bug, that displays
- --No lines in buffer--
-0.3 - Use changenr() to determine undobranch
- - <C-L> updates view
- - allow switching to initial load state, before
- buffer was edited
-==============================================================================
-vim:tw=78:ts=8:ft=help:et
--- a/vim/bundle/histwin/autoload/histwin.vim Mon Nov 15 08:40:32 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,649 +0,0 @@
-" histwin.vim - Vim global plugin for browsing the undo tree
-" -------------------------------------------------------------
-" Last Change: Thu, 07 Oct 2010 23:47:20 +0200
-" Maintainer: Christian Brabandt <cb@256bit.org>
-" Version: 0.15
-" Copyright: (c) 2009, 2010 by Christian Brabandt
-" The VIM LICENSE applies to histwin.vim
-" (see |copyright|) except use "histwin.vim"
-" instead of "Vim".
-" No warranty, express or implied.
-" *** *** Use At-Your-Own-Risk! *** ***
-" TODO: - make tags permanent (needs patch for Vim)
-" - rewrite script and make use of undotree() functionality
-" that is available since Vim 7.3 (should work now)
-" - Bugfix: Sometimes the histwin window contains invalid data,
-" not sure how to reproduce it. Closing and reoping is
-" the workaround.
-"
-" Init: {{{1
-let s:cpo= &cpo
-set cpo&vim
-
-" Show help banner?
-" per default enabled, you can change it,
-" if you set g:undobrowse_help to 0 e.g.
-" put in your .vimrc
-" :let g:undo_tree_help=0
-let s:undo_help=((exists("s:undo_help") ? s:undo_help : 1) )
-" This is a little bit confusing. If the variable is set to zero and the
-" detailed view will be shown. If it is set to 1 the short view will be
-" displayed.
-let s:undo_tree_dtl = (exists('g:undo_tree_dtl') ? g:undo_tree_dtl : (exists("s:undo_tree_dtl") ? s:undo_tree_dtl : 1))
-
-" Functions:
-"
-fun! s:Init()"{{{1
- if exists("g:undo_tree_help")
- let s:undo_help=g:undo_tree_help
- endif
- if !exists("s:undo_winname")
- let s:undo_winname='Undo_Tree'
- endif
- " speed, with which the replay will be played
- " (duration between each change in milliseconds)
- " set :let g:undo_tree_speed=250 in your .vimrc to override
- let s:undo_tree_speed = (exists('g:undo_tree_speed') ? g:undo_tree_speed : 100)
- " Set prefered width
- let s:undo_tree_wdth = (exists('g:undo_tree_wdth') ? g:undo_tree_wdth : 30)
- " Show detail with Change nr?
- let s:undo_tree_dtl = (exists('g:undo_tree_dtl') ? g:undo_tree_dtl : s:undo_tree_dtl)
- " Set old versions nomodifiable
- let s:undo_tree_nomod = (exists('g:undo_tree_nomod') ? g:undo_tree_nomod : 1)
- " When switching to the undotree() function, be sure to use a Vim that is
- " newer than 7.3.005
- let s:undo_tree_epoch = (v:version > 703 || (v:version == 703 && has("patch005")) ? 1 : 0)
-
- if !exists("s:undo_tree_wdth_orig")
- let s:undo_tree_wdth_orig = s:undo_tree_wdth
- endif
- if !exists("s:undo_tree_wdth_max")
- let s:undo_tree_wdth_max = 50
- endif
-
- if bufname('') != s:undo_winname
- let s:orig_buffer = bufnr('')
- endif
-
- " Make sure we are in the right buffer
- " and this window still exists
- if bufwinnr(s:orig_buffer) == -1
- wincmd p
- let s:orig_buffer=bufnr('')
- endif
-
- " Move to the buffer, we are monitoring
- exe bufwinnr(s:orig_buffer) . 'wincmd w'
- if !exists("b:undo_customtags")
- " TODO: Activate, when viminfo patch has been incorporated into vim
- "
- " let fpath=fnameescape(fnamemodify(bufname('.'), ':p'))
- " if exists("g:UNDO_CTAGS") && has_key(g:UNDO_CTAGS, fpath)
- " let b:undo_customtags = g:UNDO_CTAGS[fpath]
- " else
- let b:undo_customtags={}
- " endif
- endif
-
- " global variable, that will be stored in the 'viminfo' file
- " TODO: Activate, when viminfo patch has been incorporated into vim
- " (currently, viminfo only stores numbers and strings, no dictionaries)
- " delete the '&& 0' to enable
- if !exists("g:UNDO_CTAGS") && s:undo_tree_epoch && 0
- let filename=fnameescape(fnamemodify(bufname('.'),':p'))
- let g:UNDO_CTAGS={}
- let g:UNDO_CTAGS[filename]=b:undo_customtags
- if (!s:ReturnLastChange(g:UNDO_CTAGS[filename]) <= changenr())
- unlet g:UNDO_CTAGS[filename]
- if !len(g:UNDO_CTAGS)
- unlet g:UNDO_CTAGS
- endif
- endif
- endif
-endfun "}}}
-fun! histwin#WarningMsg(msg)"{{{1
- echohl WarningMsg
- let msg = "histwin: " . a:msg
- if exists(":unsilent") == 2
- unsilent echomsg msg
- else
- echomsg msg
- endif
- echohl Normal
- let v:errmsg = msg
-endfun "}}}
-fun! s:ReturnHistList()"{{{1
- let histdict={}
- let customtags=copy(b:undo_customtags)
- redir => a
- sil :undol
- redir end
- " First item contains the header
- let templist=split(a, '\n')[1:]
-
-
- if s:undo_tree_epoch
- if empty(templist)
- return {}
- endif
- let ut=[]
- " Vim 7.3 introduced the undotree function, which we'll use to get all save
- " states. Unfortunately, Vim would crash, if you used the undotree()
- " function before version 7.3.005
- "
- " return a list of all the changes and then use only these changes,
- " that are returned by the :undolist command
- " (it's hard to get the right branches, so we parse the :undolist
- " command and only take these entries (plus the first and last entry)
- let ut=s:GetUndotreeEntries(undotree().entries)
- let templist=map(templist, 'split(v:val)[0]')
- let re = '^\%(' . join(templist, '\|') . '\)$'
- let first = ut[0]
- let first.tag='Start Editing'
- if s:undo_tree_dtl
- call filter(ut, 'v:val.seq =~ re')
- else
- call filter(ut, 'v:val.seq =~ re || v:val.save > 0')
- endif
- let ut= [first] + ut
-
- for item in ut
- if has_key(customtags, item.seq)
- let tag=customtags[item.seq].tag
- call remove(customtags,item.seq)
- else
- let tag=(has_key(item, 'tag') ? item.tag : '')
- endif
- let histdict[item.seq]={'change': item.seq,
- \'number': item.number,
- \'time': item.time,
- \'tag': tag,
- \'save': (has_key(item, 'save') ? item.save : 0),
- \}
- endfor
- let first_seq = first.seq
- else
- " include the starting point as the first change.
- " unfortunately, there does not seem to exist an
- " easy way to obtain the state of the first change,
- " so we will be inserting a dummy entry and need to
- " check later, if this is called.
- let histdict[0] = {'number': 0, 'change': 0, 'time': '00:00:00', 'tag': 'Start Editing' ,'save':0}
- let first_seq = matchstr(templist[0], '^\s\+\zs\d\+')+0
-
- let i=1
- for item in templist
- let change = matchstr(item, '^\s\+\zs\d\+') + 0
- " Actually the number attribute will not be used, but we store it
- " anyway, since we are already parsing the undolist manually.
- let nr = matchstr(item, '^\s\+\d\+\s\+\zs\d\+') + 0
- let time = matchstr(item, '^\%(\s\+\d\+\)\{2}\s\+\zs.\{-}\ze\s*\d*$')
- let save = matchstr(item, '\s\+\zs\d\+$') + 0
- if time !~ '\d\d:\d\d:\d\d'
- let time=matchstr(time, '^\d\+')
- let time=strftime('%H:%M:%S', localtime()-time)
- endif
- if has_key(customtags, change)
- let tag=customtags[change].tag
- call remove(customtags,change)
- else
- let tag=''
- endif
- let histdict[change]={'change': change, 'number': nr, 'time': time, 'tag': tag, 'save': save}
- let i+=1
- endfor
- endif
- unlet item
- " Mark invalid entries in the customtags dictionary
- for [key,item] in items(customtags)
- if item.change < first_seq
- let customtags[key].number = -1
- endif
- endfor
- return extend(histdict,customtags,"force")
-endfun
-
-fun! s:SortValues(a,b)"{{{1
- return (a:a.change+0)==(a:b.change+0) ? 0 : (a:a.change+0) > (a:b.change+0) ? 1 : -1
-endfun
-
-fun! s:MaxTagsLen()"{{{1
- let tags = getbufvar(s:orig_buffer, 'undo_customtags')
- let d=[]
- " return a list of all tags
- let d=values(map(copy(tags), 'v:val["tag"]'))
- let d+= ["Start Editing"]
- "call map(d, 'strlen(substitute(v:val, ".", "x", "g"))')
- call map(d, 'strlen(v:val)')
- return max(d)
-endfu
-
-fun! s:HistWin()"{{{1
- let undo_buf=bufwinnr('^'.s:undo_winname.'$')
- " Adjust size so that each tag will fit on the screen
- " 16 is just the default length, that should fit within 30 chars
- "let maxlen=s:MaxTagsLen() % (s:undo_tree_wdth_max)
- let maxlen=s:MaxTagsLen()
-" if !s:undo_tree_dtl
-" let maxlen+=20 " detailed pane
-" else
-" let maxlen+=13 " short pane
-" endif
- let rd = (!s:undo_tree_dtl ? 20 : 13)
-
- if maxlen > 16
- let s:undo_tree_wdth = (s:undo_tree_wdth + maxlen - rd) % s:undo_tree_wdth_max
- let s:undo_tree_wdth = (s:undo_tree_wdth < s:undo_tree_wdth_orig ? s:undo_tree_wdth_orig : s:undo_tree_wdth)
- endif
- " for the detail view, we need more space
- if (!s:undo_tree_dtl)
- let s:undo_tree_wdth = s:undo_tree_wdth_orig + 10
- else
- let s:undo_tree_wdth = s:undo_tree_wdth_orig
- endif
- "if (maxlen + (!s:undo_tree_dtl*7)) > 13 + (!s:undo_tree_dtl*7)
- " let s:undo_tree_wdth+=(s:undo_tree_wdth + maxlen) % s:undo_tree_wdth_max
- "endif
- if undo_buf != -1
- exe undo_buf . 'wincmd w'
- if winwidth(0) != s:undo_tree_wdth
- exe "vert res " . s:undo_tree_wdth
- endif
- else
- execute s:undo_tree_wdth . "vsp " . s:undo_winname
- setl noswapfile buftype=nowrite bufhidden=delete foldcolumn=0 nobuflisted
- let undo_buf=bufwinnr("")
- endif
- exe bufwinnr(s:orig_buffer) . ' wincmd w'
- return undo_buf
-endfun
-
-fun! s:PrintUndoTree(winnr)"{{{1
- let bufname = (empty(bufname(s:orig_buffer)) ? '[No Name]' : fnamemodify(bufname(s:orig_buffer),':t'))
- let changenr = changenr()
- let histdict = b:undo_tagdict
- exe a:winnr . 'wincmd w'
- setl modifiable
- " silent because :%d outputs this message:
- " --No lines in buffer--
- silent %d _
- call setline(1,'Undo-Tree: '.bufname)
- put =repeat('=', strlen(getline(1)))
- put =''
- call s:PrintHelp(s:undo_help)
- if s:undo_tree_dtl
- call append('$', printf("%-*s %-9s %2s %s", strlen(len(histdict)), "Nr", " Time", "Fl", "Tag"))
- else
- call append('$', printf("%-*s %-9s %-6s %-4s %2s %s", strlen(len(histdict)), "Nr", " Time", "Change", "Save", "Fl", "Tag"))
- endif
-
- if len(histdict) == 0
- call append('$', "\" No undotree available")
- let list=[]
- else
- let i=1
- let list=sort(values(histdict), 's:SortValues')
- for line in list
- if s:undo_tree_dtl && line.number==0
- continue
- endif
- let tag=line.tag
- " this is only an educated guess.
- " This should be calculated
- let width=winwidth(0) - (!s:undo_tree_dtl ? 22 : 14)
- if strlen(tag) > width
- let tag=substitute(tag, '.\{'.width.'}', '&\r', 'g')
- endif
- let tag = (empty(tag) ? tag : '/'.tag.'/')
- if !s:undo_tree_dtl
- call append('$',
- \ printf("%0*d) %8s %6d %4d %1s %s",
- \ strlen(len(histdict)), i,
- \ localtime() - line['time'] > 24*3600 ? strftime('%b %d', line['time']) : strftime('%H:%M:%S', line['time']),
- \ line['change'], line['save'],
- \ (line['number']<0 ? '!' : ' '),
- \ tag))
- else
- call append('$',
- \ printf("%0*d) %8s %1s %s",
- \ strlen(len(histdict)), i,
- \ localtime() - line['time'] > 24*3600 ? strftime('%b %d', line['time']) : strftime('%H:%M:%S', line['time']),
- \ (line['number']<0 ? '!' : (line['save'] ? '*' : ' ')),
- \ tag))
- " DEBUG Version:
- " call append('$',
- " \ printf("%0*d) %8s %1s%1s %s %s",
- " \ strlen(len(histdict)), i,
- " \ localtime() - line['time'] > 24*3600 ? strftime('%b %d', line['time']) : strftime('%H:%M:%S', line['time']),
- " \(line['save'] ? '*' : ' '),
- " \(line['number']<0 ? '!' : ' '),
- " \ tag, line['change']))
- endif
- let i+=1
- endfor
- %s/\r/\=submatch(0).repeat(' ', match(getline('.'), '\/')+1)/eg
- endif
- call s:HilightLines(s:GetLineNr(changenr,list)+1)
- norm! zb
- setl nomodifiable
-endfun
-
-fun! s:HilightLines(changenr)"{{{1
- syn match UBTitle '^\%1lUndo-Tree: \zs.*$'
- syn match UBInfo '^".*$' contains=UBKEY
- syn match UBKey '^"\s\zs\%(\(<[^>]*>\)\|\u\)\ze\s'
- syn match UBList '^\d\+\ze' nextgroup=UBDate,UBTime
- syn match UBDate '\w\+\s\d\+\ze'
- syn match UBTime '\d\d:\d\d:\d\d' "nextgroup=UBDelimStart
- syn region UBTag matchgroup=UBDelim start='/' end='/$' keepend
- if a:changenr
- let search_pattern = '^0*'.a:changenr.')[^/]*'
- "exe 'syn match UBActive "^0*'.a:changenr.')[^/]*"'
- exe 'syn match UBActive "' . search_pattern . '"'
- " Put cursor on the active tag
- call search(search_pattern, 'cW')
- endif
-
- hi def link UBTitle Title
- hi def link UBInfo Comment
- hi def link UBList Identifier
- hi def link UBTag Special
- hi def link UBTime Underlined
- hi def link UBDate Underlined
- hi def link UBDelim Ignore
- hi def link UBActive PmenuSel
- hi def link UBKey SpecialKey
-endfun
-
-fun! s:PrintHelp(...)"{{{1
- let mess=['" actv. keys in this window']
- call add(mess, '" I toggles help screen')
- if a:1
- call add(mess, "\" <Enter> goto undo branch")
- call add(mess, "\" <C-L>\t Update view")
- call add(mess, "\" T\t Tag sel. branch")
- call add(mess, "\" P\t Toggle view")
- call add(mess, "\" D\t Diff sel. branch")
- call add(mess, "\" R\t Replay sel. branch")
- call add(mess, "\" C\t Clear all tags")
- call add(mess, "\" Q\t Quit window")
- call add(mess, '"')
- call add(mess, "\" Undo-Tree, v" . printf("%.02f",g:loaded_undo_browse))
- endif
- call add(mess, '')
- call append('$', mess)
-endfun
-
-fun! s:DiffUndoBranch()"{{{1
- try
- let change = s:ReturnBranch()
- catch /histwin:/
- call histwin#WarningMsg("Please put the cursor on one list item, when switching to a branch!")
- return
- endtry
- let prevchangenr=<sid>UndoBranch()
- if empty(prevchangenr)
- return ''
- endif
- let cur_ft = &ft
- let buffer=getline(1,'$')
- try
- exe ':u ' . prevchangenr
- setl modifiable
- catch /Vim(undo):Undo number \d\+ not found/
- call s:WarningMsg("Undo Change not found!")
- return ''
- endtry
- exe ':botright vsp '.tempname()
- call setline(1, bufname(s:orig_buffer) . ' undo-branch: ' . change)
- call append('$',buffer)
- exe "setl ft=".cur_ft
- silent w!
- diffthis
- exe bufwinnr(s:orig_buffer) . 'wincmd w'
- diffthis
-endfun
-
-fun! s:GetLineNr(changenr,list) "{{{1
- let i=0
- for item in a:list
- if s:undo_tree_dtl && item.number == 0
- continue
- endif
- if item['change'] >= a:changenr
- return i
- endif
- let i+=1
- endfor
- return -1
-endfun
-
-fun! s:ReplayUndoBranch()"{{{1
- try
- let change = s:ReturnBranch()
- catch /histwin:/
- call histwin#WarningMsg("Please put the cursor on one list item, when replaying a branch!")
- return
- endtry
-
- let tags = getbufvar(s:orig_buffer, 'undo_tagdict')
-
- if empty(tags)
- call histwin#WarningMsg("No Undotree available. Won't Replay")
- return
- endif
- let tlist = sort(values(tags), "s:SortValues")
- if s:undo_tree_dtl
- call filter(tlist, 'v:val.number != 0')
- endif
- let key = (len(tlist) > change ? tlist[change].change : '')
-
- if empty(key)
- call histwin#WarningMsg("Nothing to do")
- return
- endif
- exe bufwinnr(s:orig_buffer) . ' wincmd w'
- let change_old = changenr()
- try
- exe ':u ' . b:undo_tagdict[key]['change']
- exe 'earlier 99999999'
- redraw
- while changenr() < b:undo_tagdict[key]['change']
- red
- redraw
- exe ':sleep ' . s:undo_tree_speed . 'm'
- endw
- "catch /Undo number \d\+ not found/
- catch /Vim(undo):Undo number 0 not found/
- exe ':u ' . change_old
- call s:WarningMsg("Replay not possible for initial state")
- catch /Vim(undo):Undo number \d\+ not found/
- exe ':u ' . change_old
- call s:WarningMsg("Replay not possible\nDid you reload the file?")
- endtry
-endfun
-
-fun! s:ReturnBranch()"{{{1
- let a=matchstr(getline('.'), '^0*\zs\d\+\ze')+0
- if a == -1
- call search('^\d\+)', 'b')
- let a=matchstr(getline('.'), '^0*\zs\d\+\ze')+0
- endif
- if a <= 0
- throw "histwin: No Branch"
- return 0
- endif
- return a-1
-endfun
-
-fun! s:ToggleHelpScreen()"{{{1
- let s:undo_help=!s:undo_help
- exe bufwinnr(s:orig_buffer) . ' wincmd w'
- call s:PrintUndoTree(s:HistWin())
-endfun
-
-fun! s:ToggleDetail()"{{{1
- let s:undo_tree_dtl=!s:undo_tree_dtl
- call histwin#UndoBrowse()
-endfun
-
-fun! s:UndoBranchTag()"{{{1
-
- try
- let change = s:ReturnBranch()
- catch /histwin:/
- call histwin#WarningMsg("Please put the cursor on one list item, when tagging a branch!")
- return
- endtry
- let tags = getbufvar(s:orig_buffer, 'undo_tagdict')
- if empty(tags)
- call histwin#WarningMsg("No Undotree available. Won't tag")
- return
- endif
- let cdict = getbufvar(s:orig_buffer, 'undo_customtags')
- let tlist = sort(values(tags), "s:SortValues")
- if s:undo_tree_dtl
- call filter(tlist, 'v:val.number != 0')
- endif
- let key = (len(tlist) > change ? tlist[change].change : '')
- if empty(key)
- return
- endif
- call inputsave()
- let tag=input("Tagname " . (change+1) . ": ", tags[key]['tag'])
- call inputrestore()
-
- let cdict[key] = {'tag': tag,
- \'number': tags[key].number+0,
- \'time': tags[key].time+0,
- \'change': key+0,
- \'save': tags[key].save+0}
- "let cdict[key] = {'tag': tag, 'number': 0, 'time': strftime('%H:%M:%S'), 'change': key, 'save': 0}
- "let tags[changenr] = {'tag': cdict[changenr][tag], 'change': changenr, 'number': tags[key]['number'], 'time': tags[key]['time']}
- let tags[key]['tag'] = tag
- call setbufvar(s:orig_buffer, 'undo_tagdict', tags)
- call setbufvar(s:orig_buffer, 'undo_customtags', cdict)
-endfun
-
-fun! s:UndoBranch()"{{{1
- let dict = getbufvar(s:orig_buffer, 'undo_tagdict')
- if empty(dict)
- call histwin#WarningMsg("No Undotree available. Can't switch to a different state!")
- return
- endif
- try
- let key = s:ReturnBranch()
- catch /histwin:/
- call histwin#WarningMsg("Please put the cursor on one list item, when switching to a branch!")
- return
- endtry
- let tlist = sort(values(dict), "s:SortValues")
- if s:undo_tree_dtl
- call filter(tlist, 'v:val.number != 0')
- endif
- let key = (len(tlist) > key ? tlist[key].change : '')
- if empty(key)
- call histwin#WarningMsg("Nothing to do.")
- return
- endif
- " Last line?
- if line('.') == line('$')
- let tmod = 0
- else
- let tmod = 1
- endif
- exe bufwinnr(s:orig_buffer) . 'wincmd w'
- " Save cursor pos
- let cpos = getpos('.')
- let cmd=''
- let cur_changenr=changenr()
- "let list=sort(values(b:undo_tagdict), 's:SortValues')
- "let len = len(b:undo_tagdict)
- " if len==1, then there is no
- " undo branch available, which means
- " we can't undo anyway
- try
- if key==0
- " Jump back to initial state
- "let cmd=':earlier 9999999'
- :u1
- if !&modifiable
- setl modifiable
- endif
- norm 1u
- else
- exe ':u '.dict[key]['change']
- endif
- if s:undo_tree_nomod && tmod
- setl nomodifiable
- else
- setl modifiable
- endif
- catch /E830: Undo number \d\+ not found/
- exe ':u ' . cur_changenr
- call histwin#WarningMsg("Undo Change not found.")
- return
- endtry
- " this might have changed, so we return to the old cursor
- " position. This could still be wrong, so
- " So this is our best effort approach.
- call setpos('.', cpos)
- return cur_changenr
-endfun
-
-fun! s:MapKeys()"{{{1
- nnoremap <script> <silent> <buffer> I :<C-U>silent :call <sid>ToggleHelpScreen()<CR>
- nnoremap <script> <silent> <buffer> <C-L> :<C-U>silent :call histwin#UndoBrowse()<CR>
- nnoremap <script> <silent> <buffer> D :<C-U>silent :call <sid>DiffUndoBranch()<CR>
- nnoremap <script> <silent> <buffer> R :<C-U>call <sid>ReplayUndoBranch()<CR>:silent! :call histwin#UndoBrowse()<CR>
- nnoremap <script> <silent> <buffer> Q :<C-U>q<CR>
- nnoremap <script> <silent> <buffer> <CR> :<C-U>silent :call <sid>UndoBranch()<CR>:call histwin#UndoBrowse()<CR>
- nmap <script> <silent> <buffer> T :call <sid>UndoBranchTag()<CR>:call histwin#UndoBrowse()<CR>
- nmap <script> <silent> <buffer> P :<C-U>silent :call <sid>ToggleDetail()<CR><C-L>
- nmap <script> <silent> <buffer> C :call <sid>ClearTags()<CR><C-L>
-endfun "}}}
-fun! s:ClearTags()"{{{1
- exe bufwinnr(s:orig_buffer) . 'wincmd w'
- let b:undo_customtags={}
- call histwin#UndoBrowse()
-endfun
-fun! histwin#UndoBrowse()"{{{1
- if &ul != -1
- call s:Init()
- let b:undo_win = s:HistWin()
- let b:undo_tagdict=s:ReturnHistList()
- call s:PrintUndoTree(b:undo_win)
- call s:MapKeys()
- else
- echoerr "Histwin: Undo has been disabled. Check your undolevel setting!"
- endif
-endfun "}}}
-fun! s:ReturnLastChange(histdict) "{{{1
- return max(keys(a:histdict))
-endfun
-
-fun! s:GetUndotreeEntries(entry) "{{{1
- let b=[]
- " Return only entries, that have an 'alt' key, which means, an undo branch
- " started there
- for item in a:entry
- call add(b, { 'seq': item.seq, 'time': item.time, 'number': 1,
- \'save': has_key(item, 'save') ? item.save : 0})
- if has_key(item, "alt")
- " need to add the last seq. number that was in an alternative
- " branch, so decrementing item.seq by one.
- call extend(b,s:GetUndotreeEntries(item.alt))
- endif
- endfor
- return b
-endfun
-
-" Debug function, not needed {{{1
-fun! SortUndoTreeValues(a,b)"{{{2
- return (a:a.seq)==(a:b.seq) ? 0 : (a:a.seq) > (a:b.seq) ? 1 : -1
-endfun"}}}2
-
-" Modeline and Finish stuff: {{{1
-let &cpo=s:cpo
-unlet s:cpo
-" vim: ts=4 sts=4 fdm=marker com+=l\:\" fdl=0
--- a/vim/bundle/histwin/doc/histwin.txt Mon Nov 15 08:40:32 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-*histwin.txt* Plugin to browse the undo-tree
-
-Version: 0.15 Thu, 07 Oct 2010 23:47:20 +0200
-Author: Christian Brabandt <cb@256bit.org>
-Copyright: (c) 2009, 2010 by Christian Brabandt *histwin-copyright*
- The VIM LICENSE applies to histwin.vim and histwin.txt
- (see |copyright|) except use histwin instead of "Vim".
- NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK.
-
-==============================================================================
-1. Contents *histwin-contents*
-
-1. Contents.................................................|histwin-contents|
-2. Functionality............................................|histwin-plugin|
- Opening the Undo-Tree Window.............................|histwin-browse|
- Using tags...............................................|histwin-tags|
-3. Keybindings..............................................|histwin-keys|
-4. Configuration............................................|histwin-config|
- Configuraion Variables...................................|histwin-var|
- Color Configuration......................................|histwin-color|
- Undolevels settings......................................|histwin-ut|
-5. Feedback.................................................|histwin-feedback|
-6. History..................................................|histwin-history|
-
-==============================================================================
- *histwin-plugin* *histwin*
-2. Functionality
-
-This plugin was written to allow an easy way of browsing the |undo-tree|, that
-is available with Vim. This allows to go back to any change that has been made
-previously, because these states are remembered by Vim within a branch in the
-undo-history. You can use |g-| or |g+| to move in Vim within the different
-undo-branches.
-
-Unfortunately, going back to any state isn't very comfortable and you always
-need to remember at what time you did that change. Therefore the
-histwin-Plugin allows to easily view the available states and branch back to
-any of these states. It opens a new window, which contains all available
-states and using this plugin allows you to tag a previous change or go back to
-a particular state.
-
- *histwin-browse* *:UB*
-2.1 Opening the Undo-Tree Window
-
-By default you can open the Undo-Tree Window by issuing :UB (Mnemonic:
-UndoBrowse). If you do this, you will see a window that looks
-like this:
-
-+------------------------------------------------------+
-|Undo-Tree: FILENAME |#!/bin/bash |
-|====================== | |
-| | |
-|" actv. keys in this window |if [ $# -ne 2 ]; the |
-|" I toggles help screen | echo "Name: $0: arg|
-|" <Enter> goto undo branch | echo |
-|" <C-L> Update view | exit 1 |
-|" T Tag sel. branch |fi |
-|" P Toggle view | |
-|" D Diff sel. branch |if true; then |
-|" R Replay sel. branch | dir="${1%/*}" |
-|" C Clear all tags | file="${1##*/}" |
-|" Q Quit window | target="${2}/${di |
-|" | if [ ! -e "${targ |
-|" Undo-Tree, v0.13 | mkdir -p "$ta |
-| | mv "$1" "$tar |
-|Nr Time Fl Tag | |
-|1) Sep 01 /Start Editing/| |
-|2) Sep 01 ! /First draft/ | |
-|3) 23:01:22 | |
-|4) 23:02:57 * /Release 1/ | |
-|5) 23:05:04 | |
-+------------------------------------------------------+
-
-This shows an extract of a sample file on the right side. The window on the
-left side, contains an overview of all available states that are known for
-this buffer or that have been tagged to remember that change.
-
-The first line contains 'Undo-Tree: filename' so that the user knows, for
-which file this window shows the available undo-branches. This is the heading.
-
-Following the heading is a small information banner, that contains the most
-important key combinations, that are available in this window.
-
-After that list, all available undo-changes are displayed. This is a list,
-that contains the number, the time this change was made, some flags and the
-tags, that have been entered.
-
-The flags can be any of '!' or '*'. The '!' indicates, that this particular
-undo branch (that was probably tagged before) isn't available any more. The
-'*' indicates, if that particular undo branch has been saved before (but is
-only visible in the dense view). See |histwin-ut| on why certain states might
-become inaccessible and what can be done against it.
-
-In the detailed view, that is by default displayed, when you press 'P', the
-undo branch list will possibly be much longer. That is, because in this view,
-each save state will be displayed (along with it's save number). You
-can imagine, that this list might become very long.
-
-Additionally, the Change number, that identifies each change in the undo tree
-will be displayed. The change number can be used with the |:undo| command to
-jump to a particular change and the save number is useful with the |:earlier|
-and |:later| commands.
-
-The active undo-branch on the right side is highlighted with the UBActive
-highlighting and the cursor will be positioned on that line. Use >
-
-:hi UBActive
-
-to see how it will be highlighted. See also |histwin-color|.
-
-
- *histwin-tags*
-
-By default, tags that you enter will be volatile. That is, whenever you quit
-Vim, these tags are lost. Currently there is no way, to store or retrieve old
-tags.
-
-This behaviour was okay, until with Vim 7.3 the new permanent undo feature was
-included into Vim which makes undo information available even after restarting
-Vim. Starting with Vim 7.3 it is often desirable, to also store the tag
-information permanently.
-
-There is an easy way, to store your tag information easily, though. You can
-make use of the |viminfo| file, that stores states and search patterns and a
-like for later use. If you include the '!' flag when setting the option, vim
-will also store global variables, which then will be read back when restarting
-Vim (or by use of |rviminfo|). So if you like your tags be stored permanently,
-be sure, that you set your viminfo option correctly.
-
-(Note, currently, the viminfo file only stores global variables of type
-String, Float or Number, it can't store Dictionaries of Lists. There is a
-patch available, that will hopefully be soon be integrated in Vim mainline.
-So even if you set up your |viminfo| file correctly, the histwin plugin won't
-be able to restore your tags)
-
-==============================================================================
- *histwin-keys*
-3. Keybindings
-
-By default, the following keys are active in Normal mode in the Undo-Tree
-window:
-
-'Enter' Go to the branch, on which is selected with the cursor. By default,
- if switching to an older branch, the buffer will be set to
- 'nomodifiable'. If you don't want that, you need to set the
- g:undo_tree_nomod variable to off (see |histwin-var|).
-'<C-L>' Update the window
-'T' Tag the branch, that is selected. You'll be prompted for a tag.
- To make the tag permanent, see |histwin-tags|
-'P' Toggle view (the change-number and save number will be displayed).
- You can use this number to go directly to that change (see |:undo|).
- Additionally the saved counter will be displayed, which can be used
- to go directly to the text version of a file write using |later| or
- |earlier|.
-'D' Start diff mode with the branch that is selected by the cursor.
- (see |08.7|)
-'R' Replay all changes, that have been made from the beginning.
- (see |histwin-config| for adjusting the speed)
-'C' Clear all tags.
-'Q' Quit window
-
-==============================================================================
- *histwin-var* *histwin-config*
-4.1 Configuration variables
-
-You can adjust several parameters for the Undo-Tree window, by setting some
-variables in your .vimrc file.
-
-------------------------------------------------------------------------------
-
-4.1.1 Disable printing the help
-
-To always show only a small information banner, set this in your .vimrc
-(by default this variable is 1) >
-
- :let g:undo_tree_help = 0
-
-------------------------------------------------------------------------------
-
-4.1.2 Display more details
-
-To always display the detailed view (which includes the Change number and the
-file save counter), set the g:undo_tree_dtl=0:
-(by default, this variable is 1) >
-
- :let g:undo_tree_dtl = 0
-
-The change number can be used to directly jump to a undo state using |:undo|
-and the save counter can be used to directly go to the buffer's state when the
-file was written using |:earlier| and |:later|
-
-------------------------------------------------------------------------------
-
-4.1.3 Customize the replay speed
-
-The speed with which to show each change, when replaying a undo-branch can be
-adjusted by setting to a value in milliseconds. If not specified, this is
-100ms. >
-
- :let g:undo_tree_speed=200
-
-------------------------------------------------------------------------------
-
-4.1.4 Adjust the window size.
-
-You can adjust the windows size by setting g:undo_tree_wdth to the number of
-columns you like. By default this is considered 30. When the change number is
-included in the list (see above), this value will increase by 10. >
-
- :let g:undo_tree_wdth=40
-
-This will change the width of the window to 40 or 50, if the change number
-is included.
-
-------------------------------------------------------------------------------
-
-4.1.5 Read-only and writable buffer states
-
-By default, old buffer states are set read only and you cannot modify these.
-This was done, since the author of the plugin started browsing the undo
-branches and started changing older versions over and over again. This is
-really confusing, since you start creating even more branches and you might
-end up fixing old bugs over and over.
-
-This is what happened to the author of this plugin, so now there is a
-configuration available that will set old buffers to be only read-only.
-Currently, this works, by detecting, if the cursor was on the last branch in
-the histwin window, and if the cursor was not on the last branch, the buffer
-will be set 'nomodifiable'. You can always set the buffer to be modifiable by
-issuing: >
-
- :setl modifiable
-
-The default is to set the buffer read only. To disable this, you can set the
-g:undo_tree_nomod variable in your |.vimrc| like this: >
-
- :let g:undo_tree_nomod = 0
-
-------------------------------------------------------------------------------
-
- *histwin-color*
-4.2 Color configuration
-
-If you want to customize the colors, you can simply change the following
-groups, that are defined by the Undo-Tree Browser:
-
-UBTitle this defines the color of the title file-name. By default this links
- to Title (see |hl-Title|)
-UBInfo this defines how the information banner looks like. By default this
- links to Comment.
-UBList this group defines the List items at the start e.g. 1), 2), This
- links to Identifier.
-UBTime this defines, how the time is displayed. This links to Underlined.
-UBTag This defines, how the tag should be highlighted. By default this
- links to Special
-UBDelim This group defines the look of the delimiter for the tag. By default
- this links to Ignore
-UBActive This group defines how the active selection is displayed. By default
- this links to PmenuSel (see |hl-PmenuSel|)
-UBKey This group defines, how keys are displayed within the information
- banner. By default, this links to SpecialKey (see |hl-SpecialKey|)
-
-Say you want to change the color for the Tag values and you think, it should
-look like |IncSerch|, so you can do this in your .vimrc file: >
-
-:hi link UBTag IncSearch
-
-------------------------------------------------------------------------------
-
- *histwin-ut*
-4.3 Undolevel settings
-
-When using Vim's |persistent-undo| feature and making many changes, you might
-encounter the situation, when some of your tags will be flagged with an '!'.
-This happens, when these undo-states are not available any more. This happens
-especially, when making so many changes, that your 'undolevels' setting
-interferes. Basically you have done so many changes, that your first changes
-will already be deleted. So the obvious fix is to set the 'undolevels' setting
-to a much higher value, like 10,000 or even higher. This will however increase
-the memory usage quite a lot.
-
-==============================================================================
- *histwin-feedback*
-5. Feedback
-
-Feedback is always welcome. If you like the plugin, please rate it at the
-vim-page:
-http://www.vim.org/scripts/script.php?script_id=2932
-
-You can also follow the development of the plugin at github:
-http://github.com/chrisbra/histwin.vim
-
-Please don't hesitate to report any bugs to the maintainer, mentioned in the
-third line of this document.
-
-==============================================================================
- *histwin-history*
-6. histwin History
-
-0.14 - don't fix the width of the histwin window
- - now use the undotree() function by default (if patch 7.3.005 is
- included)
- - display save states in the detailed view
- - display the '!' when a state is not accessible anymore
- - fixed an annoying bug, that when jumping to a particular undo state,
- the plugin would jump to the wrong state (I hate octal mode)
- - Make displaying the time much more reliable and also don't display
- the time, if the change happened more than 24h ago (instead, display
- the date, when this change was done).
- - slightly improved error handling.
- - prepare plugin, to permantly store the undotags in the viminfo file
- (this isn't supported by a plain vanilla vim and requires a patch)
- - A major rewrite (code cleanup, better documentation)
-0.13 - New version that uses Vim 7.3 persistent undo features
- |new-persistent-undo|
- - Display saved counter in detailed view
- - Display indicator for saved branches.
- - in diff mode, don't set the original buffer to be nomodifiable
- (so you can always merge chunks).
- - Check for Vim Version 7.3 (the plugin won't work with older versions
- of Vim)
-0.12 - Small extension to the help file
- - generate help file with 'et' set, so the README at github looks
- better
- - Highlight the key binding using |hl-SpecialKey|
- - The help tag for the color configuration was wrong.
-0.11 - Set old buffers read only (disable the setting via the
- g:undo_tree_nomod variable
- - Make sure, Warning Messages are really displayed using :unsilent
-0.10 - Fixed annoying Resizing bug
- - linebreak tags, if they are too long
- - dynamically grow the histwin window, for longer tags (up
- to a maximum)
- - Bugfix: Always indicate the correct branch
- - Added a few try/catch statements and some error handling
-0.9 - Error handling for Replaying (it may not work always)
- - Documentation
- - Use syntax highlighting
- - Tagging finally works
-0.8 - code cleanup
- - make speed of the replay adjustable. Use g:undo_tree_speed to set
- time in milliseconds
-0.7.2 - make sure, when switching to a different undo-branch, the undo-tree will be reloaded
- - check 'undolevel' settings
-0.7.1 - fixed a problem with mapping the keys which broke the Undo-Tree keys
- (I guess I don't fully understand, when to use s: and <sid>)
-0.7 - created autoloadPlugin (patch by Charles Campbell) Thanks!
- - enabled GLVS (patch by Charles Campbell) Thanks!
- - cleaned up old comments
- - deleted :noautocmd which could cause trouble with other plugins
- - small changes in coding style (<sid> to s:, fun instead of fu)
- - made Plugin available as histwin.vba
- - Check for availability of :UB before defining it
- (could already by defined Blockquote.vim does for example)
-0.6 - fix missing bufname() when creating the undo_tree window
- - make undo_tree window a little bit smaller
- (size is adjustable via g:undo_tree_wdth variable)
-0.5 - add missing endif (which made version 0.4 unusuable)
-0.4 - Allow diffing with selected branch
- - highlight current version
- - Fix annoying bug, that displays
- --No lines in buffer--
-0.3 - Use changenr() to determine undobranch
- - <C-L> updates view
- - allow switching to initial load state, before
- buffer was edited
-==============================================================================
-vim:tw=78:ts=8:ft=help:et
--- a/vim/bundle/histwin/histwin.vba Mon Nov 15 08:40:32 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1068 +0,0 @@
-" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.
-UseVimball
-finish
-plugin/histwinPlugin.vim [[[1
-42
-" histwin.vim - Vim global plugin for browsing the undo tree
-" -------------------------------------------------------------
-" Last Change: Thu, 07 Oct 2010 23:47:20 +0200
-" Maintainer: Christian Brabandt <cb@256bit.org>
-" Version: 0.15
-" Copyright: (c) 2009, 2010 by Christian Brabandt
-" The VIM LICENSE applies to histwin.vim
-" (see |copyright|) except use "histwin.vim"
-" instead of "Vim".
-" No warranty, express or implied.
-" *** *** Use At-Your-Own-Risk! *** ***
-"
-" GetLatestVimScripts: 2932 9 :AutoInstall: histwin.vim
-
-" Init:
-if exists("g:loaded_undo_browse") || &cp || &ul == -1
- finish
-endif
-
-if v:version < 703
- call histwin#WarningMsg("This plugin requires Vim 7.3 or higher")
- finish
-endif
-
-let g:loaded_undo_browse = 0.15
-let s:cpo = &cpo
-set cpo&vim
-
-" User_Command:
-if exists(":UB") != 2
- com -nargs=0 UB :call histwin#UndoBrowse()
-else
- call histwin#WarningMsg("UB is already defined. May be by another Plugin?")
-endif
-
-" ChangeLog:
-" see :h histwin-history
-
-" Restore:
-let &cpo=s:cpo
-unlet s:cpo
-" vim: ts=4 sts=4 fdm=marker com+=l\:\" fdm=syntax
-autoload/histwin.vim [[[1
-649
-" histwin.vim - Vim global plugin for browsing the undo tree
-" -------------------------------------------------------------
-" Last Change: Thu, 07 Oct 2010 23:47:20 +0200
-" Maintainer: Christian Brabandt <cb@256bit.org>
-" Version: 0.15
-" Copyright: (c) 2009, 2010 by Christian Brabandt
-" The VIM LICENSE applies to histwin.vim
-" (see |copyright|) except use "histwin.vim"
-" instead of "Vim".
-" No warranty, express or implied.
-" *** *** Use At-Your-Own-Risk! *** ***
-" TODO: - make tags permanent (needs patch for Vim)
-" - rewrite script and make use of undotree() functionality
-" that is available since Vim 7.3 (should work now)
-" - Bugfix: Sometimes the histwin window contains invalid data,
-" not sure how to reproduce it. Closing and reoping is
-" the workaround.
-"
-" Init: {{{1
-let s:cpo= &cpo
-set cpo&vim
-
-" Show help banner?
-" per default enabled, you can change it,
-" if you set g:undobrowse_help to 0 e.g.
-" put in your .vimrc
-" :let g:undo_tree_help=0
-let s:undo_help=((exists("s:undo_help") ? s:undo_help : 1) )
-" This is a little bit confusing. If the variable is set to zero and the
-" detailed view will be shown. If it is set to 1 the short view will be
-" displayed.
-let s:undo_tree_dtl = (exists('g:undo_tree_dtl') ? g:undo_tree_dtl : (exists("s:undo_tree_dtl") ? s:undo_tree_dtl : 1))
-
-" Functions:
-"
-fun! s:Init()"{{{1
- if exists("g:undo_tree_help")
- let s:undo_help=g:undo_tree_help
- endif
- if !exists("s:undo_winname")
- let s:undo_winname='Undo_Tree'
- endif
- " speed, with which the replay will be played
- " (duration between each change in milliseconds)
- " set :let g:undo_tree_speed=250 in your .vimrc to override
- let s:undo_tree_speed = (exists('g:undo_tree_speed') ? g:undo_tree_speed : 100)
- " Set prefered width
- let s:undo_tree_wdth = (exists('g:undo_tree_wdth') ? g:undo_tree_wdth : 30)
- " Show detail with Change nr?
- let s:undo_tree_dtl = (exists('g:undo_tree_dtl') ? g:undo_tree_dtl : s:undo_tree_dtl)
- " Set old versions nomodifiable
- let s:undo_tree_nomod = (exists('g:undo_tree_nomod') ? g:undo_tree_nomod : 1)
- " When switching to the undotree() function, be sure to use a Vim that is
- " newer than 7.3.005
- let s:undo_tree_epoch = (v:version > 703 || (v:version == 703 && has("patch005")) ? 1 : 0)
-
- if !exists("s:undo_tree_wdth_orig")
- let s:undo_tree_wdth_orig = s:undo_tree_wdth
- endif
- if !exists("s:undo_tree_wdth_max")
- let s:undo_tree_wdth_max = 50
- endif
-
- if bufname('') != s:undo_winname
- let s:orig_buffer = bufnr('')
- endif
-
- " Make sure we are in the right buffer
- " and this window still exists
- if bufwinnr(s:orig_buffer) == -1
- wincmd p
- let s:orig_buffer=bufnr('')
- endif
-
- " Move to the buffer, we are monitoring
- exe bufwinnr(s:orig_buffer) . 'wincmd w'
- if !exists("b:undo_customtags")
- " TODO: Activate, when viminfo patch has been incorporated into vim
- "
- " let fpath=fnameescape(fnamemodify(bufname('.'), ':p'))
- " if exists("g:UNDO_CTAGS") && has_key(g:UNDO_CTAGS, fpath)
- " let b:undo_customtags = g:UNDO_CTAGS[fpath]
- " else
- let b:undo_customtags={}
- " endif
- endif
-
- " global variable, that will be stored in the 'viminfo' file
- " TODO: Activate, when viminfo patch has been incorporated into vim
- " (currently, viminfo only stores numbers and strings, no dictionaries)
- " delete the '&& 0' to enable
- if !exists("g:UNDO_CTAGS") && s:undo_tree_epoch && 0
- let filename=fnameescape(fnamemodify(bufname('.'),':p'))
- let g:UNDO_CTAGS={}
- let g:UNDO_CTAGS[filename]=b:undo_customtags
- if (!s:ReturnLastChange(g:UNDO_CTAGS[filename]) <= changenr())
- unlet g:UNDO_CTAGS[filename]
- if !len(g:UNDO_CTAGS)
- unlet g:UNDO_CTAGS
- endif
- endif
- endif
-endfun "}}}
-fun! histwin#WarningMsg(msg)"{{{1
- echohl WarningMsg
- let msg = "histwin: " . a:msg
- if exists(":unsilent") == 2
- unsilent echomsg msg
- else
- echomsg msg
- endif
- echohl Normal
- let v:errmsg = msg
-endfun "}}}
-fun! s:ReturnHistList()"{{{1
- let histdict={}
- let customtags=copy(b:undo_customtags)
- redir => a
- sil :undol
- redir end
- " First item contains the header
- let templist=split(a, '\n')[1:]
-
-
- if s:undo_tree_epoch
- if empty(templist)
- return {}
- endif
- let ut=[]
- " Vim 7.3 introduced the undotree function, which we'll use to get all save
- " states. Unfortunately, Vim would crash, if you used the undotree()
- " function before version 7.3.005
- "
- " return a list of all the changes and then use only these changes,
- " that are returned by the :undolist command
- " (it's hard to get the right branches, so we parse the :undolist
- " command and only take these entries (plus the first and last entry)
- let ut=s:GetUndotreeEntries(undotree().entries)
- let templist=map(templist, 'split(v:val)[0]')
- let re = '^\%(' . join(templist, '\|') . '\)$'
- let first = ut[0]
- let first.tag='Start Editing'
- if s:undo_tree_dtl
- call filter(ut, 'v:val.seq =~ re')
- else
- call filter(ut, 'v:val.seq =~ re || v:val.save > 0')
- endif
- let ut= [first] + ut
-
- for item in ut
- if has_key(customtags, item.seq)
- let tag=customtags[item.seq].tag
- call remove(customtags,item.seq)
- else
- let tag=(has_key(item, 'tag') ? item.tag : '')
- endif
- let histdict[item.seq]={'change': item.seq,
- \'number': item.number,
- \'time': item.time,
- \'tag': tag,
- \'save': (has_key(item, 'save') ? item.save : 0),
- \}
- endfor
- let first_seq = first.seq
- else
- " include the starting point as the first change.
- " unfortunately, there does not seem to exist an
- " easy way to obtain the state of the first change,
- " so we will be inserting a dummy entry and need to
- " check later, if this is called.
- let histdict[0] = {'number': 0, 'change': 0, 'time': '00:00:00', 'tag': 'Start Editing' ,'save':0}
- let first_seq = matchstr(templist[0], '^\s\+\zs\d\+')+0
-
- let i=1
- for item in templist
- let change = matchstr(item, '^\s\+\zs\d\+') + 0
- " Actually the number attribute will not be used, but we store it
- " anyway, since we are already parsing the undolist manually.
- let nr = matchstr(item, '^\s\+\d\+\s\+\zs\d\+') + 0
- let time = matchstr(item, '^\%(\s\+\d\+\)\{2}\s\+\zs.\{-}\ze\s*\d*$')
- let save = matchstr(item, '\s\+\zs\d\+$') + 0
- if time !~ '\d\d:\d\d:\d\d'
- let time=matchstr(time, '^\d\+')
- let time=strftime('%H:%M:%S', localtime()-time)
- endif
- if has_key(customtags, change)
- let tag=customtags[change].tag
- call remove(customtags,change)
- else
- let tag=''
- endif
- let histdict[change]={'change': change, 'number': nr, 'time': time, 'tag': tag, 'save': save}
- let i+=1
- endfor
- endif
- unlet item
- " Mark invalid entries in the customtags dictionary
- for [key,item] in items(customtags)
- if item.change < first_seq
- let customtags[key].number = -1
- endif
- endfor
- return extend(histdict,customtags,"force")
-endfun
-
-fun! s:SortValues(a,b)"{{{1
- return (a:a.change+0)==(a:b.change+0) ? 0 : (a:a.change+0) > (a:b.change+0) ? 1 : -1
-endfun
-
-fun! s:MaxTagsLen()"{{{1
- let tags = getbufvar(s:orig_buffer, 'undo_customtags')
- let d=[]
- " return a list of all tags
- let d=values(map(copy(tags), 'v:val["tag"]'))
- let d+= ["Start Editing"]
- "call map(d, 'strlen(substitute(v:val, ".", "x", "g"))')
- call map(d, 'strlen(v:val)')
- return max(d)
-endfu
-
-fun! s:HistWin()"{{{1
- let undo_buf=bufwinnr('^'.s:undo_winname.'$')
- " Adjust size so that each tag will fit on the screen
- " 16 is just the default length, that should fit within 30 chars
- "let maxlen=s:MaxTagsLen() % (s:undo_tree_wdth_max)
- let maxlen=s:MaxTagsLen()
-" if !s:undo_tree_dtl
-" let maxlen+=20 " detailed pane
-" else
-" let maxlen+=13 " short pane
-" endif
- let rd = (!s:undo_tree_dtl ? 20 : 13)
-
- if maxlen > 16
- let s:undo_tree_wdth = (s:undo_tree_wdth + maxlen - rd) % s:undo_tree_wdth_max
- let s:undo_tree_wdth = (s:undo_tree_wdth < s:undo_tree_wdth_orig ? s:undo_tree_wdth_orig : s:undo_tree_wdth)
- endif
- " for the detail view, we need more space
- if (!s:undo_tree_dtl)
- let s:undo_tree_wdth = s:undo_tree_wdth_orig + 10
- else
- let s:undo_tree_wdth = s:undo_tree_wdth_orig
- endif
- "if (maxlen + (!s:undo_tree_dtl*7)) > 13 + (!s:undo_tree_dtl*7)
- " let s:undo_tree_wdth+=(s:undo_tree_wdth + maxlen) % s:undo_tree_wdth_max
- "endif
- if undo_buf != -1
- exe undo_buf . 'wincmd w'
- if winwidth(0) != s:undo_tree_wdth
- exe "vert res " . s:undo_tree_wdth
- endif
- else
- execute s:undo_tree_wdth . "vsp " . s:undo_winname
- setl noswapfile buftype=nowrite bufhidden=delete foldcolumn=0 nobuflisted
- let undo_buf=bufwinnr("")
- endif
- exe bufwinnr(s:orig_buffer) . ' wincmd w'
- return undo_buf
-endfun
-
-fun! s:PrintUndoTree(winnr)"{{{1
- let bufname = (empty(bufname(s:orig_buffer)) ? '[No Name]' : fnamemodify(bufname(s:orig_buffer),':t'))
- let changenr = changenr()
- let histdict = b:undo_tagdict
- exe a:winnr . 'wincmd w'
- setl modifiable
- " silent because :%d outputs this message:
- " --No lines in buffer--
- silent %d _
- call setline(1,'Undo-Tree: '.bufname)
- put =repeat('=', strlen(getline(1)))
- put =''
- call s:PrintHelp(s:undo_help)
- if s:undo_tree_dtl
- call append('$', printf("%-*s %-9s %2s %s", strlen(len(histdict)), "Nr", " Time", "Fl", "Tag"))
- else
- call append('$', printf("%-*s %-9s %-6s %-4s %2s %s", strlen(len(histdict)), "Nr", " Time", "Change", "Save", "Fl", "Tag"))
- endif
-
- if len(histdict) == 0
- call append('$', "\" No undotree available")
- let list=[]
- else
- let i=1
- let list=sort(values(histdict), 's:SortValues')
- for line in list
- if s:undo_tree_dtl && line.number==0
- continue
- endif
- let tag=line.tag
- " this is only an educated guess.
- " This should be calculated
- let width=winwidth(0) - (!s:undo_tree_dtl ? 22 : 14)
- if strlen(tag) > width
- let tag=substitute(tag, '.\{'.width.'}', '&\r', 'g')
- endif
- let tag = (empty(tag) ? tag : '/'.tag.'/')
- if !s:undo_tree_dtl
- call append('$',
- \ printf("%0*d) %8s %6d %4d %1s %s",
- \ strlen(len(histdict)), i,
- \ localtime() - line['time'] > 24*3600 ? strftime('%b %d', line['time']) : strftime('%H:%M:%S', line['time']),
- \ line['change'], line['save'],
- \ (line['number']<0 ? '!' : ' '),
- \ tag))
- else
- call append('$',
- \ printf("%0*d) %8s %1s %s",
- \ strlen(len(histdict)), i,
- \ localtime() - line['time'] > 24*3600 ? strftime('%b %d', line['time']) : strftime('%H:%M:%S', line['time']),
- \ (line['number']<0 ? '!' : (line['save'] ? '*' : ' ')),
- \ tag))
- " DEBUG Version:
- " call append('$',
- " \ printf("%0*d) %8s %1s%1s %s %s",
- " \ strlen(len(histdict)), i,
- " \ localtime() - line['time'] > 24*3600 ? strftime('%b %d', line['time']) : strftime('%H:%M:%S', line['time']),
- " \(line['save'] ? '*' : ' '),
- " \(line['number']<0 ? '!' : ' '),
- " \ tag, line['change']))
- endif
- let i+=1
- endfor
- %s/\r/\=submatch(0).repeat(' ', match(getline('.'), '\/')+1)/eg
- endif
- call s:HilightLines(s:GetLineNr(changenr,list)+1)
- norm! zb
- setl nomodifiable
-endfun
-
-fun! s:HilightLines(changenr)"{{{1
- syn match UBTitle '^\%1lUndo-Tree: \zs.*$'
- syn match UBInfo '^".*$' contains=UBKEY
- syn match UBKey '^"\s\zs\%(\(<[^>]*>\)\|\u\)\ze\s'
- syn match UBList '^\d\+\ze' nextgroup=UBDate,UBTime
- syn match UBDate '\w\+\s\d\+\ze'
- syn match UBTime '\d\d:\d\d:\d\d' "nextgroup=UBDelimStart
- syn region UBTag matchgroup=UBDelim start='/' end='/$' keepend
- if a:changenr
- let search_pattern = '^0*'.a:changenr.')[^/]*'
- "exe 'syn match UBActive "^0*'.a:changenr.')[^/]*"'
- exe 'syn match UBActive "' . search_pattern . '"'
- " Put cursor on the active tag
- call search(search_pattern, 'cW')
- endif
-
- hi def link UBTitle Title
- hi def link UBInfo Comment
- hi def link UBList Identifier
- hi def link UBTag Special
- hi def link UBTime Underlined
- hi def link UBDate Underlined
- hi def link UBDelim Ignore
- hi def link UBActive PmenuSel
- hi def link UBKey SpecialKey
-endfun
-
-fun! s:PrintHelp(...)"{{{1
- let mess=['" actv. keys in this window']
- call add(mess, '" I toggles help screen')
- if a:1
- call add(mess, "\" <Enter> goto undo branch")
- call add(mess, "\" <C-L>\t Update view")
- call add(mess, "\" T\t Tag sel. branch")
- call add(mess, "\" P\t Toggle view")
- call add(mess, "\" D\t Diff sel. branch")
- call add(mess, "\" R\t Replay sel. branch")
- call add(mess, "\" C\t Clear all tags")
- call add(mess, "\" Q\t Quit window")
- call add(mess, '"')
- call add(mess, "\" Undo-Tree, v" . printf("%.02f",g:loaded_undo_browse))
- endif
- call add(mess, '')
- call append('$', mess)
-endfun
-
-fun! s:DiffUndoBranch()"{{{1
- try
- let change = s:ReturnBranch()
- catch /histwin:/
- call histwin#WarningMsg("Please put the cursor on one list item, when switching to a branch!")
- return
- endtry
- let prevchangenr=<sid>UndoBranch()
- if empty(prevchangenr)
- return ''
- endif
- let cur_ft = &ft
- let buffer=getline(1,'$')
- try
- exe ':u ' . prevchangenr
- setl modifiable
- catch /Vim(undo):Undo number \d\+ not found/
- call s:WarningMsg("Undo Change not found!")
- return ''
- endtry
- exe ':botright vsp '.tempname()
- call setline(1, bufname(s:orig_buffer) . ' undo-branch: ' . change)
- call append('$',buffer)
- exe "setl ft=".cur_ft
- silent w!
- diffthis
- exe bufwinnr(s:orig_buffer) . 'wincmd w'
- diffthis
-endfun
-
-fun! s:GetLineNr(changenr,list) "{{{1
- let i=0
- for item in a:list
- if s:undo_tree_dtl && item.number == 0
- continue
- endif
- if item['change'] >= a:changenr
- return i
- endif
- let i+=1
- endfor
- return -1
-endfun
-
-fun! s:ReplayUndoBranch()"{{{1
- try
- let change = s:ReturnBranch()
- catch /histwin:/
- call histwin#WarningMsg("Please put the cursor on one list item, when replaying a branch!")
- return
- endtry
-
- let tags = getbufvar(s:orig_buffer, 'undo_tagdict')
-
- if empty(tags)
- call histwin#WarningMsg("No Undotree available. Won't Replay")
- return
- endif
- let tlist = sort(values(tags), "s:SortValues")
- if s:undo_tree_dtl
- call filter(tlist, 'v:val.number != 0')
- endif
- let key = (len(tlist) > change ? tlist[change].change : '')
-
- if empty(key)
- call histwin#WarningMsg("Nothing to do")
- return
- endif
- exe bufwinnr(s:orig_buffer) . ' wincmd w'
- let change_old = changenr()
- try
- exe ':u ' . b:undo_tagdict[key]['change']
- exe 'earlier 99999999'
- redraw
- while changenr() < b:undo_tagdict[key]['change']
- red
- redraw
- exe ':sleep ' . s:undo_tree_speed . 'm'
- endw
- "catch /Undo number \d\+ not found/
- catch /Vim(undo):Undo number 0 not found/
- exe ':u ' . change_old
- call s:WarningMsg("Replay not possible for initial state")
- catch /Vim(undo):Undo number \d\+ not found/
- exe ':u ' . change_old
- call s:WarningMsg("Replay not possible\nDid you reload the file?")
- endtry
-endfun
-
-fun! s:ReturnBranch()"{{{1
- let a=matchstr(getline('.'), '^0*\zs\d\+\ze')+0
- if a == -1
- call search('^\d\+)', 'b')
- let a=matchstr(getline('.'), '^0*\zs\d\+\ze')+0
- endif
- if a <= 0
- throw "histwin: No Branch"
- return 0
- endif
- return a-1
-endfun
-
-fun! s:ToggleHelpScreen()"{{{1
- let s:undo_help=!s:undo_help
- exe bufwinnr(s:orig_buffer) . ' wincmd w'
- call s:PrintUndoTree(s:HistWin())
-endfun
-
-fun! s:ToggleDetail()"{{{1
- let s:undo_tree_dtl=!s:undo_tree_dtl
- call histwin#UndoBrowse()
-endfun
-
-fun! s:UndoBranchTag()"{{{1
-
- try
- let change = s:ReturnBranch()
- catch /histwin:/
- call histwin#WarningMsg("Please put the cursor on one list item, when tagging a branch!")
- return
- endtry
- let tags = getbufvar(s:orig_buffer, 'undo_tagdict')
- if empty(tags)
- call histwin#WarningMsg("No Undotree available. Won't tag")
- return
- endif
- let cdict = getbufvar(s:orig_buffer, 'undo_customtags')
- let tlist = sort(values(tags), "s:SortValues")
- if s:undo_tree_dtl
- call filter(tlist, 'v:val.number != 0')
- endif
- let key = (len(tlist) > change ? tlist[change].change : '')
- if empty(key)
- return
- endif
- call inputsave()
- let tag=input("Tagname " . (change+1) . ": ", tags[key]['tag'])
- call inputrestore()
-
- let cdict[key] = {'tag': tag,
- \'number': tags[key].number+0,
- \'time': tags[key].time+0,
- \'change': key+0,
- \'save': tags[key].save+0}
- "let cdict[key] = {'tag': tag, 'number': 0, 'time': strftime('%H:%M:%S'), 'change': key, 'save': 0}
- "let tags[changenr] = {'tag': cdict[changenr][tag], 'change': changenr, 'number': tags[key]['number'], 'time': tags[key]['time']}
- let tags[key]['tag'] = tag
- call setbufvar(s:orig_buffer, 'undo_tagdict', tags)
- call setbufvar(s:orig_buffer, 'undo_customtags', cdict)
-endfun
-
-fun! s:UndoBranch()"{{{1
- let dict = getbufvar(s:orig_buffer, 'undo_tagdict')
- if empty(dict)
- call histwin#WarningMsg("No Undotree available. Can't switch to a different state!")
- return
- endif
- try
- let key = s:ReturnBranch()
- catch /histwin:/
- call histwin#WarningMsg("Please put the cursor on one list item, when switching to a branch!")
- return
- endtry
- let tlist = sort(values(dict), "s:SortValues")
- if s:undo_tree_dtl
- call filter(tlist, 'v:val.number != 0')
- endif
- let key = (len(tlist) > key ? tlist[key].change : '')
- if empty(key)
- call histwin#WarningMsg("Nothing to do.")
- return
- endif
- " Last line?
- if line('.') == line('$')
- let tmod = 0
- else
- let tmod = 1
- endif
- exe bufwinnr(s:orig_buffer) . 'wincmd w'
- " Save cursor pos
- let cpos = getpos('.')
- let cmd=''
- let cur_changenr=changenr()
- "let list=sort(values(b:undo_tagdict), 's:SortValues')
- "let len = len(b:undo_tagdict)
- " if len==1, then there is no
- " undo branch available, which means
- " we can't undo anyway
- try
- if key==0
- " Jump back to initial state
- "let cmd=':earlier 9999999'
- :u1
- if !&modifiable
- setl modifiable
- endif
- norm 1u
- else
- exe ':u '.dict[key]['change']
- endif
- if s:undo_tree_nomod && tmod
- setl nomodifiable
- else
- setl modifiable
- endif
- catch /E830: Undo number \d\+ not found/
- exe ':u ' . cur_changenr
- call histwin#WarningMsg("Undo Change not found.")
- return
- endtry
- " this might have changed, so we return to the old cursor
- " position. This could still be wrong, so
- " So this is our best effort approach.
- call setpos('.', cpos)
- return cur_changenr
-endfun
-
-fun! s:MapKeys()"{{{1
- nnoremap <script> <silent> <buffer> I :<C-U>silent :call <sid>ToggleHelpScreen()<CR>
- nnoremap <script> <silent> <buffer> <C-L> :<C-U>silent :call histwin#UndoBrowse()<CR>
- nnoremap <script> <silent> <buffer> D :<C-U>silent :call <sid>DiffUndoBranch()<CR>
- nnoremap <script> <silent> <buffer> R :<C-U>call <sid>ReplayUndoBranch()<CR>:silent! :call histwin#UndoBrowse()<CR>
- nnoremap <script> <silent> <buffer> Q :<C-U>q<CR>
- nnoremap <script> <silent> <buffer> <CR> :<C-U>silent :call <sid>UndoBranch()<CR>:call histwin#UndoBrowse()<CR>
- nmap <script> <silent> <buffer> T :call <sid>UndoBranchTag()<CR>:call histwin#UndoBrowse()<CR>
- nmap <script> <silent> <buffer> P :<C-U>silent :call <sid>ToggleDetail()<CR><C-L>
- nmap <script> <silent> <buffer> C :call <sid>ClearTags()<CR><C-L>
-endfun "}}}
-fun! s:ClearTags()"{{{1
- exe bufwinnr(s:orig_buffer) . 'wincmd w'
- let b:undo_customtags={}
- call histwin#UndoBrowse()
-endfun
-fun! histwin#UndoBrowse()"{{{1
- if &ul != -1
- call s:Init()
- let b:undo_win = s:HistWin()
- let b:undo_tagdict=s:ReturnHistList()
- call s:PrintUndoTree(b:undo_win)
- call s:MapKeys()
- else
- echoerr "Histwin: Undo has been disabled. Check your undolevel setting!"
- endif
-endfun "}}}
-fun! s:ReturnLastChange(histdict) "{{{1
- return max(keys(a:histdict))
-endfun
-
-fun! s:GetUndotreeEntries(entry) "{{{1
- let b=[]
- " Return only entries, that have an 'alt' key, which means, an undo branch
- " started there
- for item in a:entry
- call add(b, { 'seq': item.seq, 'time': item.time, 'number': 1,
- \'save': has_key(item, 'save') ? item.save : 0})
- if has_key(item, "alt")
- " need to add the last seq. number that was in an alternative
- " branch, so decrementing item.seq by one.
- call extend(b,s:GetUndotreeEntries(item.alt))
- endif
- endfor
- return b
-endfun
-
-" Debug function, not needed {{{1
-fun! SortUndoTreeValues(a,b)"{{{2
- return (a:a.seq)==(a:b.seq) ? 0 : (a:a.seq) > (a:b.seq) ? 1 : -1
-endfun"}}}2
-
-" Modeline and Finish stuff: {{{1
-let &cpo=s:cpo
-unlet s:cpo
-" vim: ts=4 sts=4 fdm=marker com+=l\:\" fdl=0
-doc/histwin.txt [[[1
-368
-*histwin.txt* Plugin to browse the undo-tree
-
-Version: 0.15 Thu, 07 Oct 2010 23:47:20 +0200
-Author: Christian Brabandt <cb@256bit.org>
-Copyright: (c) 2009, 2010 by Christian Brabandt *histwin-copyright*
- The VIM LICENSE applies to histwin.vim and histwin.txt
- (see |copyright|) except use histwin instead of "Vim".
- NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK.
-
-==============================================================================
-1. Contents *histwin-contents*
-
-1. Contents.................................................|histwin-contents|
-2. Functionality............................................|histwin-plugin|
- Opening the Undo-Tree Window.............................|histwin-browse|
- Using tags...............................................|histwin-tags|
-3. Keybindings..............................................|histwin-keys|
-4. Configuration............................................|histwin-config|
- Configuraion Variables...................................|histwin-var|
- Color Configuration......................................|histwin-color|
- Undolevels settings......................................|histwin-ut|
-5. Feedback.................................................|histwin-feedback|
-6. History..................................................|histwin-history|
-
-==============================================================================
- *histwin-plugin* *histwin*
-2. Functionality
-
-This plugin was written to allow an easy way of browsing the |undo-tree|, that
-is available with Vim. This allows to go back to any change that has been made
-previously, because these states are remembered by Vim within a branch in the
-undo-history. You can use |g-| or |g+| to move in Vim within the different
-undo-branches.
-
-Unfortunately, going back to any state isn't very comfortable and you always
-need to remember at what time you did that change. Therefore the
-histwin-Plugin allows to easily view the available states and branch back to
-any of these states. It opens a new window, which contains all available
-states and using this plugin allows you to tag a previous change or go back to
-a particular state.
-
- *histwin-browse* *:UB*
-2.1 Opening the Undo-Tree Window
-
-By default you can open the Undo-Tree Window by issuing :UB (Mnemonic:
-UndoBrowse). If you do this, you will see a window that looks
-like this:
-
-+------------------------------------------------------+
-|Undo-Tree: FILENAME |#!/bin/bash |
-|====================== | |
-| | |
-|" actv. keys in this window |if [ $# -ne 2 ]; the |
-|" I toggles help screen | echo "Name: $0: arg|
-|" <Enter> goto undo branch | echo |
-|" <C-L> Update view | exit 1 |
-|" T Tag sel. branch |fi |
-|" P Toggle view | |
-|" D Diff sel. branch |if true; then |
-|" R Replay sel. branch | dir="${1%/*}" |
-|" C Clear all tags | file="${1##*/}" |
-|" Q Quit window | target="${2}/${di |
-|" | if [ ! -e "${targ |
-|" Undo-Tree, v0.13 | mkdir -p "$ta |
-| | mv "$1" "$tar |
-|Nr Time Fl Tag | |
-|1) Sep 01 /Start Editing/| |
-|2) Sep 01 ! /First draft/ | |
-|3) 23:01:22 | |
-|4) 23:02:57 * /Release 1/ | |
-|5) 23:05:04 | |
-+------------------------------------------------------+
-
-This shows an extract of a sample file on the right side. The window on the
-left side, contains an overview of all available states that are known for
-this buffer or that have been tagged to remember that change.
-
-The first line contains 'Undo-Tree: filename' so that the user knows, for
-which file this window shows the available undo-branches. This is the heading.
-
-Following the heading is a small information banner, that contains the most
-important key combinations, that are available in this window.
-
-After that list, all available undo-changes are displayed. This is a list,
-that contains the number, the time this change was made, some flags and the
-tags, that have been entered.
-
-The flags can be any of '!' or '*'. The '!' indicates, that this particular
-undo branch (that was probably tagged before) isn't available any more. The
-'*' indicates, if that particular undo branch has been saved before (but is
-only visible in the dense view). See |histwin-ut| on why certain states might
-become inaccessible and what can be done against it.
-
-In the detailed view, that is by default displayed, when you press 'P', the
-undo branch list will possibly be much longer. That is, because in this view,
-each save state will be displayed (along with it's save number). You
-can imagine, that this list might become very long.
-
-Additionally, the Change number, that identifies each change in the undo tree
-will be displayed. The change number can be used with the |:undo| command to
-jump to a particular change and the save number is useful with the |:earlier|
-and |:later| commands.
-
-The active undo-branch on the right side is highlighted with the UBActive
-highlighting and the cursor will be positioned on that line. Use >
-
-:hi UBActive
-
-to see how it will be highlighted. See also |histwin-color|.
-
-
- *histwin-tags*
-
-By default, tags that you enter will be volatile. That is, whenever you quit
-Vim, these tags are lost. Currently there is no way, to store or retrieve old
-tags.
-
-This behaviour was okay, until with Vim 7.3 the new permanent undo feature was
-included into Vim which makes undo information available even after restarting
-Vim. Starting with Vim 7.3 it is often desirable, to also store the tag
-information permanently.
-
-There is an easy way, to store your tag information easily, though. You can
-make use of the |viminfo| file, that stores states and search patterns and a
-like for later use. If you include the '!' flag when setting the option, vim
-will also store global variables, which then will be read back when restarting
-Vim (or by use of |rviminfo|). So if you like your tags be stored permanently,
-be sure, that you set your viminfo option correctly.
-
-(Note, currently, the viminfo file only stores global variables of type
-String, Float or Number, it can't store Dictionaries of Lists. There is a
-patch available, that will hopefully be soon be integrated in Vim mainline.
-So even if you set up your |viminfo| file correctly, the histwin plugin won't
-be able to restore your tags)
-
-==============================================================================
- *histwin-keys*
-3. Keybindings
-
-By default, the following keys are active in Normal mode in the Undo-Tree
-window:
-
-'Enter' Go to the branch, on which is selected with the cursor. By default,
- if switching to an older branch, the buffer will be set to
- 'nomodifiable'. If you don't want that, you need to set the
- g:undo_tree_nomod variable to off (see |histwin-var|).
-'<C-L>' Update the window
-'T' Tag the branch, that is selected. You'll be prompted for a tag.
- To make the tag permanent, see |histwin-tags|
-'P' Toggle view (the change-number and save number will be displayed).
- You can use this number to go directly to that change (see |:undo|).
- Additionally the saved counter will be displayed, which can be used
- to go directly to the text version of a file write using |later| or
- |earlier|.
-'D' Start diff mode with the branch that is selected by the cursor.
- (see |08.7|)
-'R' Replay all changes, that have been made from the beginning.
- (see |histwin-config| for adjusting the speed)
-'C' Clear all tags.
-'Q' Quit window
-
-==============================================================================
- *histwin-var* *histwin-config*
-4.1 Configuration variables
-
-You can adjust several parameters for the Undo-Tree window, by setting some
-variables in your .vimrc file.
-
-------------------------------------------------------------------------------
-
-4.1.1 Disable printing the help
-
-To always show only a small information banner, set this in your .vimrc
-(by default this variable is 1) >
-
- :let g:undo_tree_help = 0
-
-------------------------------------------------------------------------------
-
-4.1.2 Display more details
-
-To always display the detailed view (which includes the Change number and the
-file save counter), set the g:undo_tree_dtl=0:
-(by default, this variable is 1) >
-
- :let g:undo_tree_dtl = 0
-
-The change number can be used to directly jump to a undo state using |:undo|
-and the save counter can be used to directly go to the buffer's state when the
-file was written using |:earlier| and |:later|
-
-------------------------------------------------------------------------------
-
-4.1.3 Customize the replay speed
-
-The speed with which to show each change, when replaying a undo-branch can be
-adjusted by setting to a value in milliseconds. If not specified, this is
-100ms. >
-
- :let g:undo_tree_speed=200
-
-------------------------------------------------------------------------------
-
-4.1.4 Adjust the window size.
-
-You can adjust the windows size by setting g:undo_tree_wdth to the number of
-columns you like. By default this is considered 30. When the change number is
-included in the list (see above), this value will increase by 10. >
-
- :let g:undo_tree_wdth=40
-
-This will change the width of the window to 40 or 50, if the change number
-is included.
-
-------------------------------------------------------------------------------
-
-4.1.5 Read-only and writable buffer states
-
-By default, old buffer states are set read only and you cannot modify these.
-This was done, since the author of the plugin started browsing the undo
-branches and started changing older versions over and over again. This is
-really confusing, since you start creating even more branches and you might
-end up fixing old bugs over and over.
-
-This is what happened to the author of this plugin, so now there is a
-configuration available that will set old buffers to be only read-only.
-Currently, this works, by detecting, if the cursor was on the last branch in
-the histwin window, and if the cursor was not on the last branch, the buffer
-will be set 'nomodifiable'. You can always set the buffer to be modifiable by
-issuing: >
-
- :setl modifiable
-
-The default is to set the buffer read only. To disable this, you can set the
-g:undo_tree_nomod variable in your |.vimrc| like this: >
-
- :let g:undo_tree_nomod = 0
-
-------------------------------------------------------------------------------
-
- *histwin-color*
-4.2 Color configuration
-
-If you want to customize the colors, you can simply change the following
-groups, that are defined by the Undo-Tree Browser:
-
-UBTitle this defines the color of the title file-name. By default this links
- to Title (see |hl-Title|)
-UBInfo this defines how the information banner looks like. By default this
- links to Comment.
-UBList this group defines the List items at the start e.g. 1), 2), This
- links to Identifier.
-UBTime this defines, how the time is displayed. This links to Underlined.
-UBTag This defines, how the tag should be highlighted. By default this
- links to Special
-UBDelim This group defines the look of the delimiter for the tag. By default
- this links to Ignore
-UBActive This group defines how the active selection is displayed. By default
- this links to PmenuSel (see |hl-PmenuSel|)
-UBKey This group defines, how keys are displayed within the information
- banner. By default, this links to SpecialKey (see |hl-SpecialKey|)
-
-Say you want to change the color for the Tag values and you think, it should
-look like |IncSerch|, so you can do this in your .vimrc file: >
-
-:hi link UBTag IncSearch
-
-------------------------------------------------------------------------------
-
- *histwin-ut*
-4.3 Undolevel settings
-
-When using Vim's |persistent-undo| feature and making many changes, you might
-encounter the situation, when some of your tags will be flagged with an '!'.
-This happens, when these undo-states are not available any more. This happens
-especially, when making so many changes, that your 'undolevels' setting
-interferes. Basically you have done so many changes, that your first changes
-will already be deleted. So the obvious fix is to set the 'undolevels' setting
-to a much higher value, like 10,000 or even higher. This will however increase
-the memory usage quite a lot.
-
-==============================================================================
- *histwin-feedback*
-5. Feedback
-
-Feedback is always welcome. If you like the plugin, please rate it at the
-vim-page:
-http://www.vim.org/scripts/script.php?script_id=2932
-
-You can also follow the development of the plugin at github:
-http://github.com/chrisbra/histwin.vim
-
-Please don't hesitate to report any bugs to the maintainer, mentioned in the
-third line of this document.
-
-==============================================================================
- *histwin-history*
-6. histwin History
-
-0.14 - don't fix the width of the histwin window
- - now use the undotree() function by default (if patch 7.3.005 is
- included)
- - display save states in the detailed view
- - display the '!' when a state is not accessible anymore
- - fixed an annoying bug, that when jumping to a particular undo state,
- the plugin would jump to the wrong state (I hate octal mode)
- - Make displaying the time much more reliable and also don't display
- the time, if the change happened more than 24h ago (instead, display
- the date, when this change was done).
- - slightly improved error handling.
- - prepare plugin, to permantly store the undotags in the viminfo file
- (this isn't supported by a plain vanilla vim and requires a patch)
- - A major rewrite (code cleanup, better documentation)
-0.13 - New version that uses Vim 7.3 persistent undo features
- |new-persistent-undo|
- - Display saved counter in detailed view
- - Display indicator for saved branches.
- - in diff mode, don't set the original buffer to be nomodifiable
- (so you can always merge chunks).
- - Check for Vim Version 7.3 (the plugin won't work with older versions
- of Vim)
-0.12 - Small extension to the help file
- - generate help file with 'et' set, so the README at github looks
- better
- - Highlight the key binding using |hl-SpecialKey|
- - The help tag for the color configuration was wrong.
-0.11 - Set old buffers read only (disable the setting via the
- g:undo_tree_nomod variable
- - Make sure, Warning Messages are really displayed using :unsilent
-0.10 - Fixed annoying Resizing bug
- - linebreak tags, if they are too long
- - dynamically grow the histwin window, for longer tags (up
- to a maximum)
- - Bugfix: Always indicate the correct branch
- - Added a few try/catch statements and some error handling
-0.9 - Error handling for Replaying (it may not work always)
- - Documentation
- - Use syntax highlighting
- - Tagging finally works
-0.8 - code cleanup
- - make speed of the replay adjustable. Use g:undo_tree_speed to set
- time in milliseconds
-0.7.2 - make sure, when switching to a different undo-branch, the undo-tree will be reloaded
- - check 'undolevel' settings
-0.7.1 - fixed a problem with mapping the keys which broke the Undo-Tree keys
- (I guess I don't fully understand, when to use s: and <sid>)
-0.7 - created autoloadPlugin (patch by Charles Campbell) Thanks!
- - enabled GLVS (patch by Charles Campbell) Thanks!
- - cleaned up old comments
- - deleted :noautocmd which could cause trouble with other plugins
- - small changes in coding style (<sid> to s:, fun instead of fu)
- - made Plugin available as histwin.vba
- - Check for availability of :UB before defining it
- (could already by defined Blockquote.vim does for example)
-0.6 - fix missing bufname() when creating the undo_tree window
- - make undo_tree window a little bit smaller
- (size is adjustable via g:undo_tree_wdth variable)
-0.5 - add missing endif (which made version 0.4 unusuable)
-0.4 - Allow diffing with selected branch
- - highlight current version
- - Fix annoying bug, that displays
- --No lines in buffer--
-0.3 - Use changenr() to determine undobranch
- - <C-L> updates view
- - allow switching to initial load state, before
- buffer was edited
-==============================================================================
-vim:tw=78:ts=8:ft=help:et
--- a/vim/bundle/histwin/plugin/histwinPlugin.vim Mon Nov 15 08:40:32 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-" histwin.vim - Vim global plugin for browsing the undo tree
-" -------------------------------------------------------------
-" Last Change: Thu, 07 Oct 2010 23:47:20 +0200
-" Maintainer: Christian Brabandt <cb@256bit.org>
-" Version: 0.15
-" Copyright: (c) 2009, 2010 by Christian Brabandt
-" The VIM LICENSE applies to histwin.vim
-" (see |copyright|) except use "histwin.vim"
-" instead of "Vim".
-" No warranty, express or implied.
-" *** *** Use At-Your-Own-Risk! *** ***
-"
-" GetLatestVimScripts: 2932 9 :AutoInstall: histwin.vim
-
-" Init:
-if exists("g:loaded_undo_browse") || &cp || &ul == -1
- finish
-endif
-
-if v:version < 703
- call histwin#WarningMsg("This plugin requires Vim 7.3 or higher")
- finish
-endif
-
-let g:loaded_undo_browse = 0.15
-let s:cpo = &cpo
-set cpo&vim
-
-" User_Command:
-if exists(":UB") != 2
- com -nargs=0 UB :call histwin#UndoBrowse()
-else
- call histwin#WarningMsg("UB is already defined. May be by another Plugin?")
-endif
-
-" ChangeLog:
-" see :h histwin-history
-
-" Restore:
-let &cpo=s:cpo
-unlet s:cpo
-" vim: ts=4 sts=4 fdm=marker com+=l\:\" fdm=syntax
--- a/vim/bundle/histwin/post.pl Mon Nov 15 08:40:32 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use warnings;
-
-use WWW::Mechanize;
-
-sub GetPassword() {
- my $i=0;
- my @pass;
- my $passfile="./vim_passfile"; # line1: username, line2: password
- open(PASS, '<',$passfile) or die "Can't open passwordfile: $passfile\n";
- while(<PASS>){
- chomp;
- $pass[$i++] = $_;
- }
- close(PASS);
- return @pass;
-}
-
-my $sid=2932;
-my $file;
-my @files=glob('*.vba');
-#my $scriptversion=shift @ARGV;
-my $scriptversion = 0;
-my $versioncomment=shift @ARGV;
-
-
-my @userpasswordpair = GetPassword();
-for (@files) {
- my $f = $_ if [ -f $_ ] && $_ =~ /\w+-[^.]+\.(\d+)\.vba/;
- if ($1 > $scriptversion) {
- $scriptversion=$1;
- $file = $f;
- }
-}
-
-my $mech=WWW::Mechanize->new(autocheck => 1);
-$mech->get("http://www.vim.org/login.php");
-$mech->submit_form(
- form_name => "login",
- with_fields => {
- userName => $userpasswordpair[0],
- password => $userpasswordpair[1],
- },
-);
-$mech->get("http://www.vim.org/scripts/script.php?script_id=$sid");
-$mech->follow_link(text => 'upload new version');
-$mech->form_name("script");
-$mech->field(script_file => $file);
-$mech->field(vim_version => 7.3);
-$mech->field(script_version => $scriptversion);
-$mech->field(version_comment => $versioncomment);
-$mech->click_button(value => "upload");
--- a/vim/bundle/histwin/todo Mon Nov 15 08:40:32 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-Todo List for the histwin plugin
-
-- Do we really need to include only the items from the undotree(), that have an
- 'alt' key? Or what is the best way to identify the branches from the
- undotree() function? (currently we are cheating and take only the items from
- the undolist into account)
-- make tags permanent (needs patch for Vim)
-- rewrite script and make use of undotree() functionality that is available
- since Vim 7.3 (should work now)
-- Bugfix: Sometimes the histwin window contains invalid data, not sure how to
- reproduce it. Closing and reoping is the workaround.
-- Open old versions in new tab/window
-- Bugfix: plugin errors, when there is no history available for the buffer
-
-# vim:tw=80
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/bundle/pydoc/plugin/pydoc.vim Mon Nov 15 17:15:57 2010 -0500
@@ -0,0 +1,110 @@
+"pydoc.vim: pydoc integration for vim
+"performs searches and can display the documentation of python modules
+"Author: André Kelpe <efeshundertelf at googlemail dot com>
+"Author: Romain Chossart <romainchossat at gmail dot com>
+"Author: Matthias Vogelgesang
+"http://www.vim.org/scripts/script.php?script_id=910
+"This plugin integrates the pydoc into vim. You can view the
+"documentation of a module by using :Pydoc foo.bar.baz or search
+"a word (uses pydoc -k) in the documentation by typing PydocSearch
+"foobar. You can also view the documentation of the word under the
+"cursor by pressing <leader>pw or the WORD (see :help WORD) by pressing
+"<leader>pW. "This is very useful if you want to jump to a module which was found by
+"PydocSearch. To have a browser like feeling you can use u and CTRL-R to
+"go back and forward, just like editing normal text.
+
+"If you want to use the script and pydoc is not in your PATH, just put a
+"line like
+
+" let g:pydoc_cmd = \"/usr/bin/pydoc" (without the backslash!!)
+
+"in your .vimrc
+
+
+"pydoc.vim is free software, you can redistribute or modify
+"it under the terms of the GNU General Public License Version 2 or any
+"later Version (see http://www.gnu.org/copyleft/gpl.html for details).
+
+"Please feel free to contact me.
+
+
+set switchbuf=useopen
+function! ShowPyDoc(name, type)
+ if !exists('g:pydoc_cmd')
+ let g:pydoc_cmd = 'pydoc'
+ endif
+
+ if bufloaded("__doc__") >0
+ let l:buf_is_new = 0
+ else
+ let l:buf_is_new = 1
+ endif
+
+ if bufnr("__doc__") >0
+ execute "sb __doc__"
+ else
+ execute 'split __doc__'
+ endif
+ setlocal noswapfile
+ set buftype=nofile
+ setlocal modifiable
+ normal ggdG
+ let s:name2 = substitute(a:name, '(.*', '', 'g' )
+ let s:name2 = substitute(a:name, ':', '', 'g' )
+ if a:type==1
+ execute "silent read ! " . g:pydoc_cmd . " " . s:name2
+ else
+ execute "silent read ! " . g:pydoc_cmd . " -k " . s:name2
+ endif
+ setlocal nomodified
+ set filetype=man
+ normal 1G
+
+ if !exists('g:pydoc_wh')
+ let g:pydoc_wh = 10
+ end
+ resize -999
+ execute "silent resize +" . g:pydoc_wh
+
+ if !exists('g:pydoc_highlight')
+ let g:pydoc_highlight = 1
+ endif
+ if g:pydoc_highlight == 1
+ call Highlight(s:name2)
+ endif
+
+ let l:line = getline(2)
+ if l:line =~ "^no Python documentation found for.*$"
+ if l:buf_is_new
+ execute "bd!"
+ else
+ normal u
+ endif
+ redraw
+ echohl WarningMsg | echo l:line | echohl None
+ endif
+endfunction
+
+
+function! Highlight(name)
+ execute "sb __doc__"
+ set filetype=man
+ syn on
+ execute 'syntax keyword pydoc '.s:name2
+ hi pydoc gui=reverse
+endfunction
+
+
+"mappings
+au FileType python,man map <buffer> <leader>pw :call ShowPyDoc('<C-R><C-W>', 1)<CR>
+au FileType python,man map <buffer> <leader>pW :call ShowPyDoc('<C-R><C-A>', 1)<CR>
+au FileType python,man map <buffer> <leader>pk :call ShowPyDoc('<C-R><C-W>', 0)<CR>
+au FileType python,man map <buffer> <leader>pK :call ShowPyDoc('<C-R><C-A>', 0)<CR>
+
+" remap the K (or 'help') key
+nnoremap <silent> <buffer> K :call ShowPyDoc(expand("<cword>"), 1)<CR>
+
+
+"commands
+command! -nargs=1 Pydoc :call ShowPyDoc('<args>', 1)
+command! -nargs=* PydocSearch :call ShowPyDoc('<args>', 0)
--- a/vim/colors/molokai.vim Mon Nov 15 08:40:32 2010 -0500
+++ b/vim/colors/molokai.vim Mon Nov 15 17:15:57 2010 -0500
@@ -58,7 +58,7 @@
hi Macro guifg=#C4BE89 gui=italic
hi SpecialKey guifg=#66D9EF gui=italic
-hi MatchParen guifg=#E4E400 guibg=bg gui=bold
+hi MatchParen guifg=#E4E400 guibg=NONE gui=bold
hi ModeMsg guifg=#E6DB74
hi MoreMsg guifg=#E6DB74
hi Operator guifg=#F92672
--- a/vim/snippets/django.snippets Mon Nov 15 08:40:32 2010 -0500
+++ b/vim/snippets/django.snippets Mon Nov 15 17:15:57 2010 -0500
@@ -77,26 +77,16 @@
snippet model
class ${1:ModelName}(models.Model):
- """${2:docstring}"""
- ${3}
+ ${2}
created = models.DateTimeField(auto_now_add=True, editable=False)
modified = models.DateTimeField(auto_now=True, editable=False)
class Meta:
ordering = ['-created']
- ${4}
def __unicode__(self):
- return u'%s' % self.${5}
-
- def save(self, *args, **kwargs):
- ${6}
- return super($1, self).save(*args, **kwargs)
-
- @models.permalink
- def get_absolute_url(self):
- return ('${7:view_or_url_name}', (), {})
+ return u'%s' % self.${3}
snippet modeladmin
class ${1:ModelName}Admin(admin.ModelAdmin):