sponsor Vim development Vim logo Vim Book Ad

AssistEnclose.vim : Assist manipulation on brackets, quotes

 script karma  Rating 12/13, Downloaded by 4857  Comments, bugs, improvements  Vim wiki

created by
Han-seok Ryu
 
script type
ftplugin
 
description
=========================================================================

[ Usage ]

___________
    1. Enclosing


On text

<Alt>  +      ) (

text     →    (text)



visual block on 'some text' and <Alt> + )(   on text

some text      →   (some text)


with the same way working on

[...] <...> {....}

<Alt> +  ][  or  ><  or  }{  

to make each enclosing.


Basically, enclosing range is in the unit of word,
so you don't need care about cursor position precisely.
Regardless of input mode(normal or visual),
put on across somewhere of the word you want.




When to make enclosure with single or double quotations

             '...'           "..."

<Alt> +         ';      or      ":

(this is to make consistency with other key mapping)



(example)

stdio.h

"stdio.h"

<"stdio.h">


<...> {...} [...] (...) eat over single or double quotations '...' "..."


In (vertical)visual mode (<C-v>)

by pressing <leader> key before same key operation,
you can encapsulate 'on each word'.

w◘rd
w◘rd
w◘rd

(word)
(word)
(word)  

__________________________
    2. Delete contents in enclosure


On the word enclosed with (...)

<Alt> + ((

Same way is applied to  

             {...}   [...]   <...>   "..."   '...'

<Alt> +      {{      [[      <<      ::      ;;      on each




___________________________________
    3. Delete enclosure leaving contents intact


On the word enclosed with (...)

<Alt> + ))

Same way is applied to  

           {...}   [...]   <...>   "..."   '...'

<Alt> +    }}      ]]      >>      ""      ''          on each




________________________________________
    4. Blow out the contents at once in the enclosure


hit <A-;'> to blow out in '...' or "..."

hit <A-[]> to blow out in [...] <...> {...} (...)


You can also rearrange "priority order" by modifying g:ListBraTotal

Default order is  {...}   ­  (...)   ­ <...>   ­   [...]

                   ←                                      →
                   High                                   Low


___________________________________
    5. when manipulate snippets file or html file


word -> ${1:word}           when in .snipptes
word -> <em>word</em>       when in .html
word -> \emph{word}         when in .tex

with Alt + ][


______________
    6. smart escape


This function is separated to easy-through-pairing.vim
for functional rearrangement.

please, check if you thought this script not bad.

http://www.vim.org/scripts/script.php?script_id=4578



--------------------------------------------------------------------------

[ NOTE ]


You would have get more help from following scripts.

Ckeck out,

surround.vim
http://www.vim.org/scripts/script.php?script_id=1697

autoclose.vim
http://www.vim.org/scripts/script.php?script_id=1849
 
install details
Just drop in .vim/plugin or vimfiles/plugin
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
AssistEnclose.vim 0.18a 2013-05-13 7.3 Han-seok Ryu variable confuse fix (easy-through-pairing.vim)
AssistEnclose.vim 0.18 2013-05-13 7.3 Han-seok Ryu each encapsulation work version
smart escape is separated to easy-through-pairing.vim
AssistEnclose.vim 0.17 2013-05-06 7.3 Han-seok Ryu EscapeSmart update
name changed to EasyThrough
silent added to mapping
AssistEnclose.vim 0.16 2013-04-23 7.3 Han-seok Ryu add smart escape <C-j>
assistEncloseManip.vim 0.15b 2013-04-23 7.3 Han-seok Ryu bug fix (range confuse)
assistEncloseManip.vim 0.15 2013-04-23 7.3 Han-seok Ryu workaround complete
add \emph{} for .tex file <M-][>
assistEncloseManip.vim 0.14c 2013-04-04 7.3 Han-seok Ryu work around conflict with autoclose.vim
fix visual mode 'V' enclosing
assistEncloseManip.vim 0.14a 2013-03-25 7.3 Han-seok Ryu remapping keys
fix visual block enclosing disorder
fix abnormal when removing enclosure
fix parameter error (for .snippets)
fix infinite loop
functions rewrite
assistEncloseManip.vim 0.14 2013-03-24 7.3 Han-seok Ryu remapping keys
fix visual block enclosing disorder
fix abnormal when removing enclosure
fix parameter error (for .snippets)
functions rewrite
assistEncloseManip.vim 0.12 2013-03-22 7.3 Han-seok Ryu for .html .snippets key map added
ip used for rating: 44.220.184.63

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github