Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 110 lines (85 sloc) 4.548 kb
72bcb5a Version 1.00: Initial upload
Ingo Karkat authored
1 *BracketComplete.txt* Insert mode completion for text inside various brackets.
2
3 BRACKET COMPLETE by Ingo Karkat
4 *BracketComplete.vim*
5 description |BracketComplete-description|
6 usage |BracketComplete-usage|
7 installation |BracketComplete-installation|
8 configuration |BracketComplete-configuration|
9 limitations |BracketComplete-limitations|
10 known problems |BracketComplete-known-problems|
11 todo |BracketComplete-todo|
12 history |BracketComplete-history|
13
14 ==============================================================================
15 DESCRIPTION *BracketComplete-description*
16
17 Frequently, text inside parentheses, be it a warning "(don't do this)" or
18 function arguments "(foo, bar, 42)" is repeated. This also applies to other
19 bracket delimiters, e.g. HTML tags "<img src='banner.jpg' alt=''>" or arrays
20 "[1, 2, 3]".
21 This plugin provides a completion mapping that, when you realize you're typing
22 the same contents of a bracket-delimited text again, completes the entire text
23 inside the brackets from other matches in the buffer. The completion base
24 always contains the entire text between the cursor and the previous opening
25 bracket, so it doesn't matter how far you've already been into retyping this.
26
27 SEE ALSO *
28
29 - Check out the |CompleteHelper.vim| plugin page (vimscript #3914) for a full
30 list of insert mode completions powered by it.
31
32 ==============================================================================
33 USAGE *BracketComplete-usage*
34
35 In insert mode, invoke the completion via CTRL-X ).
36 You can then search forward and backward via CTRL-N / CTRL-P, as usual.
37
38 *i_CTRL-X_)*
39 CTRL-X ) Find matches for the text before the cursor, up to the
40 previous bracket ( [ { < on the current line, and
41 offer matches of the entire text inside the brackets,
42 like the |i(| |i[| |i{| |i<| text objects.
43 This also works for |tag-blocks| with the |it| text
44 object; "<b>f|" will complete to "<b>foo bar</b>".
45
46 ==============================================================================
47 INSTALLATION *BracketComplete-installation*
48
49 This script is packaged as a |vimball|. If you have the "gunzip" decompressor
50 in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
51 the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
52 vimball or via the |:UseVimball| command. >
53 vim BracketComplete*.vmb.gz
54 :so %
55 To uninstall, use the |:RmVimball| command.
56
57 DEPENDENCIES *BracketComplete-dependencies*
58
59 - Requires Vim 7.0 or higher.
60 - Requires the |MotionComplete.vim| plugin (vimscript #4265).
61
62 ==============================================================================
63 CONFIGURATION *BracketComplete-configuration*
64
65 The general |MotionComplete-configuration| applies here, too.
66
67 For a permanent configuration, put the following commands into your |vimrc|:
68
69 *g:BracketComplete_BracketConfig*
70 The recognized bracket types are defined via a Dictionary. Its keys are the
71 opening brackets, which are mapped to an object that must have an "opposite"
72 attribute that specifies the closing bracket. If there's a text object, it can
73 be specified via the "textobject" attribute (without the preceding "a" / "i");
74 otherwise, a search to the closing bracket is used to retrieve the text.
75 To add an imaginary bracketing from : to ;, use: >
76 runtime plugin/BracketComplete.vim " Define the default brackets first.
77 let g:BracketComplete_BracketConfig[':'] = {'opposite': ';'}
78 <
79 *BracketComplete-remap*
80 If you want to use different mapping, map your keys to the
81 <Plug>(BracketComplete...) mapping target _before_ sourcing the script
82 (e.g. in your |vimrc|): >
83 imap <C-x>) <Plug>(BracketComplete)
84 <
85 ==============================================================================
86 LIMITATIONS *BracketComplete-limitations*
87
88 KNOWN PROBLEMS *BracketComplete-known-problems*
89
90 TODO *BracketComplete-todo*
91
92 IDEAS *BracketComplete-ideas*
93
94 ==============================================================================
95 HISTORY *BracketComplete-history*
96
97 1.00 12-Oct-2012
98 First published version.
99
100 0.01 02-Oct-2012
101 Started development.
102
103 ==============================================================================
104 Copyright: (C) 2012 Ingo Karkat
105 The VIM LICENSE applies to this script; see |copyright|.
106
107 Maintainer: Ingo Karkat <ingo@karkat.de>
108 ==============================================================================
109 vim:tw=78:ts=8:ft=help:norl:
Something went wrong with that request. Please try again.