Re: bracket completion

2007-03-31 Thread A.J.Mechelynck

Greg Fitzgerald wrote:
Anyone know of a way to achieve bracket completion? For example if your 
typing a if statement, if (something) { once you type the first bracket

the 2nd one is inserted below for you. Scribes and a few other editors
have this functionality and was hoping to achieve it with Vim. Another
thing that this does, if you were to type $data[' for example. The 2nd '
would be inserted for you after your cursor. Just seems to save time
when I played with scribes a few days ago. I was looking through the
help, scripts and mailing list archives for something like this but have
not hit any matches. Just wondering if people have ideas on how this
could be done or maybe know of an existing way. Thanks in advance.

--Greg



:inoremap { {}
:inoremap [ []
:inoremap ( ()

etc.

This assumes brace indenting is taken care of (by 'cindent' or 'indentexpr').

IIUC, you can still enter an "unpaired brace" (or bracket or paren) by 
prefixing it with Ctrl-V (or with Ctrl-Q if Ctrl-V pastes).


Best regards,
Tony.
--
Experience varies directly with equipment ruined.


Re: bracket completion

2007-03-31 Thread A.J.Mechelynck

A.J.Mechelynck wrote:

Greg Fitzgerald wrote:
Anyone know of a way to achieve bracket completion? For example if 
your typing a if statement, if (something) { once you type the first 
bracket

the 2nd one is inserted below for you. Scribes and a few other editors
have this functionality and was hoping to achieve it with Vim. Another
thing that this does, if you were to type $data[' for example. The 2nd '
would be inserted for you after your cursor. Just seems to save time
when I played with scribes a few days ago. I was looking through the
help, scripts and mailing list archives for something like this but have
not hit any matches. Just wondering if people have ideas on how this
could be done or maybe know of an existing way. Thanks in advance.

--Greg



:inoremap { {}
:inoremap [ []
:inoremap ( ()

etc.

This assumes brace indenting is taken care of (by 'cindent' or 
'indentexpr').


IIUC, you can still enter an "unpaired brace" (or bracket or paren) by 
prefixing it with Ctrl-V (or with Ctrl-Q if Ctrl-V pastes).


Best regards,
Tony.


P.S. If you implement it for quotes, you may want to disable it for vimscript, 
which has unpaired double quotes (marking off comments) and unpaired single 
and double quotes (in the argument of ":normal" for registers or marks).


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
156. You forget your friend's name but not her e-mail address.


Re: bracket completion

2007-03-31 Thread Greg Fitzgerald
On Sun, Apr 01, 2007 at 06:01:34AM +0200, A.J.Mechelynck wrote:

> A.J.Mechelynck wrote:
> >Greg Fitzgerald wrote:
> >>Anyone know of a way to achieve bracket completion? For example if 
> >>your typing a if statement, if (something) { once you type the first 
> >>bracket
> >>the 2nd one is inserted below for you. Scribes and a few other editors
> >>have this functionality and was hoping to achieve it with Vim. Another
> >>thing that this does, if you were to type $data[' for example. The 2nd '
> >>would be inserted for you after your cursor. Just seems to save time
> >>when I played with scribes a few days ago. I was looking through the
> >>help, scripts and mailing list archives for something like this but have
> >>not hit any matches. Just wondering if people have ideas on how this
> >>could be done or maybe know of an existing way. Thanks in advance.
> >>
> >>--Greg
> >>
> >
> >:inoremap { {}
> >:inoremap [ []
> >:inoremap ( ()
> >
> >etc.
> >
> >This assumes brace indenting is taken care of (by 'cindent' or 
> >'indentexpr').
> >
> >IIUC, you can still enter an "unpaired brace" (or bracket or paren) by 
> >prefixing it with Ctrl-V (or with Ctrl-Q if Ctrl-V pastes).
> >
> >Best regards,
> >Tony.
> 
> P.S. If you implement it for quotes, you may want to disable it for 
> vimscript, which has unpaired double quotes (marking off comments) and 
> unpaired single and double quotes (in the argument of ":normal" for 
> registers or marks).
> 
> Best regards,
> Tony.
> -- 
> hundred-and-one symptoms of being an internet addict:
> 156. You forget your friend's name but not her e-mail address.

Great advice Tony. Thanks for the really quick response as well.
I'll just add a statment enabling this for certain languages. This has
also giving me a couple new ideas to play with. Thanks again. :)

--Greg


Re: bracket completion

2007-04-01 Thread Fritz Mehner

A.J.Mechelynck schrieb:


Greg Fitzgerald wrote:

Anyone know of a way to achieve bracket completion? For example if 
your typing a if statement, if (something) { once you type the first 
bracket

the 2nd one is inserted below for you. Scribes and a few other editors
have this functionality and was hoping to achieve it with Vim. Another
thing that this does, if you were to type $data[' for example. The 2nd '
would be inserted for you after your cursor. Just seems to save time
when I played with scribes a few days ago. I was looking through the
help, scripts and mailing list archives for something like this but have
not hit any matches. Just wondering if people have ideas on how this
could be done or maybe know of an existing way. Thanks in advance.

--Greg



:inoremap { {}
:inoremap [ []
:inoremap ( ()

etc.

This assumes brace indenting is taken care of (by 'cindent' or 
'indentexpr').


IIUC, you can still enter an "unpaired brace" (or bracket or paren) by 
prefixing it with Ctrl-V (or with Ctrl-Q if Ctrl-V pastes).


Best regards,
Tony.


In addition I use the following settings

vnoremap  (  s()P
vnoremap  [  s[]P
vnoremap  {  s{}P

to surround a  selection in visual mode.
Regards,
Fritz






Re: bracket completion

2007-04-02 Thread Panos Laganakos

Those are great, thanks alot :)

On 4/1/07, Fritz Mehner <[EMAIL PROTECTED]> wrote:

A.J.Mechelynck schrieb:

> Greg Fitzgerald wrote:
>
>> Anyone know of a way to achieve bracket completion? For example if
>> your typing a if statement, if (something) { once you type the first
>> bracket
>> the 2nd one is inserted below for you. Scribes and a few other editors
>> have this functionality and was hoping to achieve it with Vim. Another
>> thing that this does, if you were to type $data[' for example. The 2nd '
>> would be inserted for you after your cursor. Just seems to save time
>> when I played with scribes a few days ago. I was looking through the
>> help, scripts and mailing list archives for something like this but have
>> not hit any matches. Just wondering if people have ideas on how this
>> could be done or maybe know of an existing way. Thanks in advance.
>>
>> --Greg
>>
>
> :inoremap { {}
> :inoremap [ []
> :inoremap ( ()
>
> etc.
>
> This assumes brace indenting is taken care of (by 'cindent' or
> 'indentexpr').
>
> IIUC, you can still enter an "unpaired brace" (or bracket or paren) by
> prefixing it with Ctrl-V (or with Ctrl-Q if Ctrl-V pastes).
>
> Best regards,
> Tony.

In addition I use the following settings

vnoremap  (  s()P
vnoremap  [  s[]P
vnoremap  {  s{}P

to surround a  selection in visual mode.
Regards,
Fritz








--
Panos Laganakos


Re: bracket completion

2007-04-02 Thread shawn bright

i am finding these usefull too, thanks
sk

On 4/2/07, Panos Laganakos <[EMAIL PROTECTED]> wrote:

Those are great, thanks alot :)

On 4/1/07, Fritz Mehner <[EMAIL PROTECTED]> wrote:
> A.J.Mechelynck schrieb:
>
> > Greg Fitzgerald wrote:
> >
> >> Anyone know of a way to achieve bracket completion? For example if
> >> your typing a if statement, if (something) { once you type the first
> >> bracket
> >> the 2nd one is inserted below for you. Scribes and a few other editors
> >> have this functionality and was hoping to achieve it with Vim. Another
> >> thing that this does, if you were to type $data[' for example. The 2nd '
> >> would be inserted for you after your cursor. Just seems to save time
> >> when I played with scribes a few days ago. I was looking through the
> >> help, scripts and mailing list archives for something like this but have
> >> not hit any matches. Just wondering if people have ideas on how this
> >> could be done or maybe know of an existing way. Thanks in advance.
> >>
> >> --Greg
> >>
> >
> > :inoremap { {}
> > :inoremap [ []
> > :inoremap ( ()
> >
> > etc.
> >
> > This assumes brace indenting is taken care of (by 'cindent' or
> > 'indentexpr').
> >
> > IIUC, you can still enter an "unpaired brace" (or bracket or paren) by
> > prefixing it with Ctrl-V (or with Ctrl-Q if Ctrl-V pastes).
> >
> > Best regards,
> > Tony.
>
> In addition I use the following settings
>
> vnoremap  (  s()P
> vnoremap  [  s[]P
> vnoremap  {  s{}P
>
> to surround a  selection in visual mode.
> Regards,
> Fritz
>
>
>
>
>


--
Panos Laganakos



Re: bracket completion

2007-04-02 Thread Greg Matheson
On Mon, 02 Apr 2007, shawn bright wrote:

> i am finding these usefull too, thanks

Check out Luc Hermitte's development of Stephen Riehm's
bracketing macros.

http://hermitte.free.fr/vim/settings.php#settings

--
Greg MathesonI have an elaborate mnemonic for
 remembering what day it is. It's
 called the number system.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: bracket completion

2007-04-02 Thread shawn bright

this looks like exactly what i am after.
i am kind of a newbie here, and cant quite get it to work right.
i believe that i need a python.vim file in /ftplugin directory.
but i dont know how to word it to make this plugin work,
could anyone kinda help me here, i can't make out what i should do
from the docs on the website that you linked to

thanks for any tips

sk

On 4/2/07, Greg Matheson <[EMAIL PROTECTED]> wrote:

On Mon, 02 Apr 2007, shawn bright wrote:

> i am finding these usefull too, thanks

Check out Luc Hermitte's development of Stephen Riehm's
bracketing macros.

http://hermitte.free.fr/vim/settings.php#settings

--
Greg MathesonI have an elaborate mnemonic for
 remembering what day it is. It's
 called the number system.

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




Re: bracket completion

2007-04-02 Thread shawn bright

whoa !, nevermind, found an example file on his website, tried it and works,.
sorry, my own rftm mistake

sk

On 4/2/07, shawn bright <[EMAIL PROTECTED]> wrote:

this looks like exactly what i am after.
i am kind of a newbie here, and cant quite get it to work right.
i believe that i need a python.vim file in /ftplugin directory.
but i dont know how to word it to make this plugin work,
could anyone kinda help me here, i can't make out what i should do
from the docs on the website that you linked to

thanks for any tips

sk

On 4/2/07, Greg Matheson <[EMAIL PROTECTED]> wrote:
> On Mon, 02 Apr 2007, shawn bright wrote:
>
> > i am finding these usefull too, thanks
>
> Check out Luc Hermitte's development of Stephen Riehm's
> bracketing macros.
>
> http://hermitte.free.fr/vim/settings.php#settings
>
> --
> Greg MathesonI have an elaborate mnemonic for
>  remembering what day it is. It's
>  called the number system.
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>



Re: bracket completion

2007-04-02 Thread Zarko Coklin
It is hard to expand on Tony's feedback, ever. Still,
I found the following works a bit better. Not only
that it creates a right brace but it also places a
cursor on the right spot (taking into consideration
indentation if you set it).


:inoremap { {}
:inoremap [ []
:inoremap ( ()

Regards,
Zarko Coklin


 

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121


RE: bracket completion

2007-04-02 Thread Waters, Bill
Can you provide and example of how to do this?

Thanks,
Bill


> >
> >:inoremap { {}
> >:inoremap [ []
> >:inoremap ( ()
> >
>
> I'll just add a statment enabling this for certain languages. This has
> also giving me a couple new ideas to play with. Thanks again. :)
> 
> --Greg


Re: bracket completion

2007-04-02 Thread A.J.Mechelynck

Zarko Coklin wrote:

It is hard to expand on Tony's feedback, ever. Still,
I found the following works a bit better. Not only
that it creates a right brace but it also places a
cursor on the right spot (taking into consideration
indentation if you set it).


:inoremap { {}
:inoremap [ []
:inoremap ( ()

Regards,
Zarko Coklin


"The right spot" depends on your C coding style: your mapping might apply for

if (condition) {
statement;
statement;
}

and

void function functionname(void* p) {
statement;
statement;
}

though it might be better to place  _after_  in the {rhs} to avoid 
splitting a word in the middle. Mine is better for


if (condition)
{   statement;
statement;
}

and

void function functionname(void* p)
{   statement;
statement;
}

and can still be used for yours, by hitting  after the mapped {


Best regards,
Tony.
--
Taxes are going up so fast, the government is likely to price itself
out of the market.


Re: bracket completion

2007-04-02 Thread Luc Hermitte
Hello,

* On Mon, Apr 02, 2007 at 10:38:14AM -0500, shawn bright <[EMAIL PROTECTED]> 
wrote:
> >> Check out Luc Hermitte's development of Stephen Riehm's
> >> bracketing macros.
> >>
> >> http://hermitte.free.fr/vim/settings.php#settings

> On 4/2/07, shawn bright <[EMAIL PROTECTED]> wrote:
> >this looks like exactly what i am after.  i am kind of a newbie here,
> >and cant quite get it to work right.
> >i believe that i need a python.vim file in /ftplugin directory.

Only if you want to customize the bracketing system for python.

> >but i dont know how to word it to make this plugin work,
> >could anyone kinda help me here, i can't make out what i should do
> >from the docs on the website that you linked to

> whoa !, nevermind, found an example file on his website, tried it and 
> works,.
> sorry, my own rftm mistake


The doc is a little bit outdated. The plugin used to word standalone.
But now there are a lot of inter-dependendies between by plugins -- I'm
still in the process of refactoring everything. As a consequence,
prefer the tarball archives.

lh-map-tools.tar.gz should be enough -- but don't forget to define a
ftplugin suited to your needs. If you want a more complete suite,
check the C&C++ ftplugins suite (which encapsulates/contains map-tools),
which is the most complete of all [1]. There are a few other suites,
which are not really maintained anymore. [2]

If you have any questions feel free to ask. I've tried to write a
documentation (the one in the tarball) as complete as I could, but I may
have missed a few details.

HTH,

[1] it contains many mappings to insert control-statements (if, for,
...) in every mode.
[2] http://hermitte.free.fr/vim/ressources -> *.tar.gz

-- 
Luc Hermitte
http://hermitte.free.fr/vim/


Re: bracket completion

2007-04-02 Thread Panos Laganakos

One thing that would also be great, was if you were able to "tab" your
way out of it, ie move to the outside of the bracket, once you're
done. Now you need to either press right, to move ahead (which is not
quite vim-ish), or hit escape and Shift_A, to resume editing.

Only possible way I can think of, is to use a snippet system, like
snippetsEmu[1] or something. Any other suggestions?


[1] http://www.vim.org/scripts/script.php?script_id=1318

On 4/2/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Zarko Coklin wrote:
> It is hard to expand on Tony's feedback, ever. Still,
> I found the following works a bit better. Not only
> that it creates a right brace but it also places a
> cursor on the right spot (taking into consideration
> indentation if you set it).
>
>
> :inoremap { {}
> :inoremap [ []
> :inoremap ( ()
>
> Regards,
> Zarko Coklin

"The right spot" depends on your C coding style: your mapping might apply for

if (condition) {
statement;
statement;
}

and

void function functionname(void* p) {
statement;
statement;
}

though it might be better to place  _after_  in the {rhs} to avoid
splitting a word in the middle. Mine is better for

if (condition)
{   statement;
statement;
}

and

void function functionname(void* p)
{   statement;
statement;
}

and can still be used for yours, by hitting  after the mapped {


Best regards,
Tony.
--
Taxes are going up so fast, the government is likely to price itself
out of the market.




--
Panos Laganakos


Re: bracket completion

2007-04-02 Thread Luc Hermitte
* On Tue, Apr 03, 2007 at 02:14:59AM +0300, Panos Laganakos <[EMAIL PROTECTED]> 
wrote:
> One thing that would also be great, was if you were able to "tab" your
> way out of it, ie move to the outside of the bracket, once you're
> done. Now you need to either press right, to move ahead (which is not
> quite vim-ish), or hit escape and Shift_A, to resume editing.
> 
> Only possible way I can think of, is to use a snippet system, like
> snippetsEmu[1] or something. Any other suggestions?

Well. You can use my bracketing system, or the fork of mu-template I'm
maintaining (which relies on the bracketing system) -- see my signature.
The marker/placeholder can be easily enable or disabled, cutomized for
every language, ...

-- 
Luc Hermitte
http://hermitte.free.fr/vim/ressources/


Re: bracket completion

2007-04-02 Thread shawn bright

Thanks Luc,
i got the main functionality working, pretty much. I only really
desire the bracket matching, and so far, i am really pleased. They all
work except the [] . So i think maybe there is a conflict with another
plugin ( i have the snippets-Emu, supertabs, and taglist plugins also.
) The overall effect is really cool.

thanks again.

sk

On 4/2/07, Luc Hermitte <[EMAIL PROTECTED]> wrote:

* On Tue, Apr 03, 2007 at 02:14:59AM +0300, Panos Laganakos <[EMAIL PROTECTED]> 
wrote:
> One thing that would also be great, was if you were able to "tab" your
> way out of it, ie move to the outside of the bracket, once you're
> done. Now you need to either press right, to move ahead (which is not
> quite vim-ish), or hit escape and Shift_A, to resume editing.
>
> Only possible way I can think of, is to use a snippet system, like
> snippetsEmu[1] or something. Any other suggestions?

Well. You can use my bracketing system, or the fork of mu-template I'm
maintaining (which relies on the bracketing system) -- see my signature.
The marker/placeholder can be easily enable or disabled, cutomized for
every language, ...

--
Luc Hermitte
http://hermitte.free.fr/vim/ressources/



Re: bracket completion

2007-04-03 Thread hermitte
shawn bright <[EMAIL PROTECTED]> wrote:

> i got the main functionality working, pretty much. I only really
> desire the bracket matching, and so far, i am really pleased. They all
> work except the [] . So i think maybe there is a conflict with another
> plugin ( i have the snippets-Emu, supertabs, and taglist plugins also.
> ) The overall effect is really cool.

I can't tell if there are conflicts with these plugins as I don't use them.

Try a
   :verbose imap [

If my plugin is correctly working, and not overidden, it should point to a
mapping defined in plugin/common_brackets.vim


> thanks again.

You're welcome.


--
Luc Hermitte
http://hermitte.free.fr/vim/


Re: bracket completion

2007-04-03 Thread Karl Guertin

On 3/31/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote:

Anyone know of a way to achieve bracket completion?


I've been sitting on a plugin that does this for a month or so. The
main difference between my plugin and the rest of the options here is
that I do the completion without breaking history or repeat.

Freshly uploaded to vim.org:

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

This plugin was pared down from a larger script that included a set of
less reusable mappings, so let me know if there's a problem.


Re: bracket completion

2007-04-03 Thread Silent1

Just tried the plugin and it works great, the only issue i'm having is
typing '{'
results in this
'{|}' not
{
  |
}
where | is the cursor position. Is there any option to change this or
am i doing something wrong? Thanks
--Brendon

On 4/3/07, Karl Guertin <[EMAIL PROTECTED]> wrote:

On 3/31/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote:
> Anyone know of a way to achieve bracket completion?

I've been sitting on a plugin that does this for a month or so. The
main difference between my plugin and the rest of the options here is
that I do the completion without breaking history or repeat.

Freshly uploaded to vim.org:

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

This plugin was pared down from a larger script that included a set of
less reusable mappings, so let me know if there's a problem.



Re: bracket completion

2007-04-03 Thread Karl Guertin

On 4/3/07, Silent1 <[EMAIL PROTECTED]> wrote:

where | is the cursor position. Is there any option to change this or
am i doing something wrong?


Sorry, no. I'll probably add support for {{ doing that, which was the
plan, but I never got around to it. Maybe this afternoon.


Re: bracket completion

2007-04-03 Thread Charles E Campbell Jr

Panos Laganakos wrote:


One thing that would also be great, was if you were able to "tab" your
way out of it, ie move to the outside of the bracket, once you're
done. Now you need to either press right, to move ahead (which is not
quite vim-ish), or hit escape and Shift_A, to resume editing.

Only possible way I can think of, is to use a snippet system, like
snippetsEmu[1] or something. Any other suggestions?


Here's one: http://vim.sourceforge.net/scripts/script.php?script_id=1269

As an example of use:

if`   (that's a backquote)

expands to

if() {}

(with indentation handled by cindent)

and the cursor after the first "(".  Type whatever, hit .  The 
cursor is then moved

to a new line after the "{".

Regards,
Chip Campbell



RE: bracket completion

2007-04-03 Thread David Fishburn
 

> -Original Message-
> From: Karl Guertin [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, April 03, 2007 6:42 AM
> To: vim@vim.org
> Subject: Re: bracket completion
> 
> On 3/31/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote:
> > Anyone know of a way to achieve bracket completion?
> 
> I've been sitting on a plugin that does this for a month or 
> so. The main difference between my plugin and the rest of the 
> options here is that I do the completion without breaking 
> history or repeat.
> 
> Freshly uploaded to vim.org:
> 
> http://www.vim.org/scripts/script.php?script_id=1849
> 
> This plugin was pared down from a larger script that included 
> a set of less reusable mappings, so let me know if there's a problem.

Thanks for the script Karl.

Not a problem, but a suggestion.

Could you make an option to ignore the autoclose if there is a following
character.  If I am typing a line:

If (  <-- here I want the autoclose.

If I have this line:

If (something_is_already_here)
  ^
And I place my cursor on the "i" in "something" I do not want to add the
closing brace since generally if I am inserting that the closing brace will
be placed at the end of the line (or something).

Just a preference, which is why I was hoping it could be an option.
So only complete when the ([[ is the last item on the line (as I am typing).

Thanks,
Dave



Re: bracket completion

2007-04-03 Thread Panos Laganakos

I tried out Karl's plugin, and it works great, good job :)

Although, I'd prefer if I could use tab to move outside, instead of
the corresponding closing bracket char.

Could this be achieved in a future version?

On 4/3/07, David Fishburn <[EMAIL PROTECTED]> wrote:



> -Original Message-
> From: Karl Guertin [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 03, 2007 6:42 AM
> To: vim@vim.org
> Subject: Re: bracket completion
>
> On 3/31/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote:
> > Anyone know of a way to achieve bracket completion?
>
> I've been sitting on a plugin that does this for a month or
> so. The main difference between my plugin and the rest of the
> options here is that I do the completion without breaking
> history or repeat.
>
> Freshly uploaded to vim.org:
>
> http://www.vim.org/scripts/script.php?script_id=1849
>
> This plugin was pared down from a larger script that included
> a set of less reusable mappings, so let me know if there's a problem.

Thanks for the script Karl.

Not a problem, but a suggestion.

Could you make an option to ignore the autoclose if there is a following
character.  If I am typing a line:

If (  <-- here I want the autoclose.

If I have this line:

If (something_is_already_here)
  ^
And I place my cursor on the "i" in "something" I do not want to add the
closing brace since generally if I am inserting that the closing brace will
be placed at the end of the line (or something).

Just a preference, which is why I was hoping it could be an option.
So only complete when the ([[ is the last item on the line (as I am typing).

Thanks,
Dave





--
Panos Laganakos


Re: bracket completion

2007-04-03 Thread Jonas Persson
I just downloaded and it works great. I have one wish though. I have 
syntax folding for C++ and usually have a lot of open/closed folds. But 
when I write a {, all folds open. Is it possible to have the {} pair 
inserted without disturbing the folds?


/ Jonas

Karl Guertin skrev:

On 3/31/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote:

Anyone know of a way to achieve bracket completion?


I've been sitting on a plugin that does this for a month or so. The
main difference between my plugin and the rest of the options here is
that I do the completion without breaking history or repeat.

Freshly uploaded to vim.org:

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

This plugin was pared down from a larger script that included a set of
less reusable mappings, so let me know if there's a problem.





Re: bracket completion

2007-04-03 Thread Karl Guertin

On 4/3/07, Panos Laganakos <[EMAIL PROTECTED]> wrote:

Although, I'd prefer if I could use tab to move outside, instead of
the corresponding closing bracket char.


This should be fairly simple to add. I won't map it, but I'll set up a
 for you.

On 4/3/07, Jonas Persson <[EMAIL PROTECTED]> wrote:

Is it possible to have the {} pair inserted without disturbing the folds?


I use marker based folds and the script doesn't disturb them. If
you're doing syntax folding, I can imagine that the folding might get
confused, as there's a fair bit of sleight of hand going on. I'll try
to fix it, but I'm not sure that I can.

On 4/3/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote:

I do have a issue using it though. Every
time i load vim with your script i can no longer use directional keys
when in insert mode. This meaning up,down,left,right or h,j,k,l. Anytime
i try to use these keys vim starts printing capital letters when i hit
the keys instead of moving around. I have to leave insert mode to move
around then go back into insert mode to type again. Any ideas about
that?


I can't reproduce this under vim 7.0.122 (debian), gVim 7.0 windows,
on gVim 7.0.203 windows. Any ideas?


Re: bracket completion

2007-04-03 Thread Greg Fitzgerald
On Tue, Apr 03, 2007 at 04:51:46PM -0400, Karl Guertin wrote:

> On 4/3/07, Panos Laganakos <[EMAIL PROTECTED]> wrote:
> >Although, I'd prefer if I could use tab to move outside, instead of
> >the corresponding closing bracket char.
> 
> This should be fairly simple to add. I won't map it, but I'll set up a
>  for you.
> 
> On 4/3/07, Jonas Persson <[EMAIL PROTECTED]> wrote:
> >Is it possible to have the {} pair inserted without disturbing the folds?
> 
> I use marker based folds and the script doesn't disturb them. If
> you're doing syntax folding, I can imagine that the folding might get
> confused, as there's a fair bit of sleight of hand going on. I'll try
> to fix it, but I'm not sure that I can.
> 
> On 4/3/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote:
> >I do have a issue using it though. Every
> >time i load vim with your script i can no longer use directional keys
> >when in insert mode. This meaning up,down,left,right or h,j,k,l. Anytime
> >i try to use these keys vim starts printing capital letters when i hit
> >the keys instead of moving around. I have to leave insert mode to move
> >around then go back into insert mode to type again. Any ideas about
> >that?
> 
> I can't reproduce this under vim 7.0.122 (debian), gVim 7.0 windows,
> on gVim 7.0.203 windows. Any ideas?

I just played around with this. Using vim 7.0.201 on Gentoo, i have
tried removing all other scripts and even my .vimrc and i still have
the problem only when i load up yours. I looked through your script
thinking i could possibly figure it out and I have no clue. After giving
up on that I uploaded it to my OpenBSD box vim 7 something i'm to lazy
to look for the patch level now. Same issue. Very weird, if you can't
reproduce it i'm sure it's on my end. Just trying to find out what would
cause it. Like i mentioned i go into insert mode type anything. If i try
to use the directional keys while in insert mode i start getting letters
inserted above the line i'm on. It is always the same letters though for
each key.

Left = D
Right = C
Up = A
Down = B

Each time i hit a direction a new letter appears above the (on it's own
line each time, keeps adding to it.) So any ideas would be welcomed. If
i avoid moving around in insert mode it really does work nice. So hope
i'm not giving you the wrong impression. I just have been in the habit
of being about to move around while in insert mode for years now.


Re: bracket completion

2007-04-04 Thread A.J.Mechelynck

Greg Fitzgerald wrote:

On Tue, Apr 03, 2007 at 04:51:46PM -0400, Karl Guertin wrote:


On 4/3/07, Panos Laganakos <[EMAIL PROTECTED]> wrote:

Although, I'd prefer if I could use tab to move outside, instead of
the corresponding closing bracket char.

This should be fairly simple to add. I won't map it, but I'll set up a
 for you.

On 4/3/07, Jonas Persson <[EMAIL PROTECTED]> wrote:

Is it possible to have the {} pair inserted without disturbing the folds?

I use marker based folds and the script doesn't disturb them. If
you're doing syntax folding, I can imagine that the folding might get
confused, as there's a fair bit of sleight of hand going on. I'll try
to fix it, but I'm not sure that I can.

On 4/3/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote:

I do have a issue using it though. Every
time i load vim with your script i can no longer use directional keys
when in insert mode. This meaning up,down,left,right or h,j,k,l. Anytime
i try to use these keys vim starts printing capital letters when i hit
the keys instead of moving around. I have to leave insert mode to move
around then go back into insert mode to type again. Any ideas about
that?

I can't reproduce this under vim 7.0.122 (debian), gVim 7.0 windows,
on gVim 7.0.203 windows. Any ideas?


I just played around with this. Using vim 7.0.201 on Gentoo, i have
tried removing all other scripts and even my .vimrc and i still have
the problem only when i load up yours. I looked through your script
thinking i could possibly figure it out and I have no clue. After giving
up on that I uploaded it to my OpenBSD box vim 7 something i'm to lazy
to look for the patch level now. Same issue. Very weird, if you can't
reproduce it i'm sure it's on my end. Just trying to find out what would
cause it. Like i mentioned i go into insert mode type anything. If i try
to use the directional keys while in insert mode i start getting letters
inserted above the line i'm on. It is always the same letters though for
each key.

Left = D
Right = C
Up = A
Down = B

Each time i hit a direction a new letter appears above the (on it's own
line each time, keeps adding to it.) So any ideas would be welcomed. If
i avoid moving around in insert mode it really does work nice. So hope
i'm not giving you the wrong impression. I just have been in the habit
of being about to move around while in insert mode for years now.



Sounds like a wrong termcap entry for the terminal you're on.

See, among others,
:help :set-termcap
:help 'term'
:help 'ttybuiltin'
:help 'timeout'
:help 'ttimeout'
:help 'timeoutlen'
:help 'ttimeoutlen

Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
161. You get up before the sun rises to check your e-mail, and you
 find yourself in the very same chair long after the sun has set.


Re: bracket completion

2007-04-04 Thread Greg Fitzgerald
On Wed, Apr 04, 2007 at 07:14:11PM +0200, A.J.Mechelynck wrote:

> Greg Fitzgerald wrote:
> >On Tue, Apr 03, 2007 at 04:51:46PM -0400, Karl Guertin wrote:
> >
> >>On 4/3/07, Panos Laganakos <[EMAIL PROTECTED]> wrote:
> >>>Although, I'd prefer if I could use tab to move outside, instead of
> >>>the corresponding closing bracket char.
> >>This should be fairly simple to add. I won't map it, but I'll set up a
> >> for you.
> >>
> >>On 4/3/07, Jonas Persson <[EMAIL PROTECTED]> wrote:
> >>>Is it possible to have the {} pair inserted without disturbing the folds?
> >>I use marker based folds and the script doesn't disturb them. If
> >>you're doing syntax folding, I can imagine that the folding might get
> >>confused, as there's a fair bit of sleight of hand going on. I'll try
> >>to fix it, but I'm not sure that I can.
> >>
> >>On 4/3/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote:
> >>>I do have a issue using it though. Every
> >>>time i load vim with your script i can no longer use directional keys
> >>>when in insert mode. This meaning up,down,left,right or h,j,k,l. Anytime
> >>>i try to use these keys vim starts printing capital letters when i hit
> >>>the keys instead of moving around. I have to leave insert mode to move
> >>>around then go back into insert mode to type again. Any ideas about
> >>>that?
> >>I can't reproduce this under vim 7.0.122 (debian), gVim 7.0 windows,
> >>on gVim 7.0.203 windows. Any ideas?
> >
> >I just played around with this. Using vim 7.0.201 on Gentoo, i have
> >tried removing all other scripts and even my .vimrc and i still have
> >the problem only when i load up yours. I looked through your script
> >thinking i could possibly figure it out and I have no clue. After giving
> >up on that I uploaded it to my OpenBSD box vim 7 something i'm to lazy
> >to look for the patch level now. Same issue. Very weird, if you can't
> >reproduce it i'm sure it's on my end. Just trying to find out what would
> >cause it. Like i mentioned i go into insert mode type anything. If i try
> >to use the directional keys while in insert mode i start getting letters
> >inserted above the line i'm on. It is always the same letters though for
> >each key.
> >
> >Left = D
> >Right = C
> >Up = A
> >Down = B
> >
> >Each time i hit a direction a new letter appears above the (on it's own
> >line each time, keeps adding to it.) So any ideas would be welcomed. If
> >i avoid moving around in insert mode it really does work nice. So hope
> >i'm not giving you the wrong impression. I just have been in the habit
> >of being about to move around while in insert mode for years now.
> >
> 
> Sounds like a wrong termcap entry for the terminal you're on.
> 
> See, among others,
>   :help :set-termcap
>   :help 'term'
>   :help 'ttybuiltin'
>   :help 'timeout'
>   :help 'ttimeout'
>   :help 'timeoutlen'
>   :help 'ttimeoutlen
> 
> Best regards,
> Tony.
> -- 
> hundred-and-one symptoms of being an internet addict:
> 161. You get up before the sun rises to check your e-mail, and you
>  find yourself in the very same chair long after the sun has set.

Well you seem to be right, I logged into console only not loading up
xorg. When i use the arrow keys there it leaves insert mode and starts
to move around just fine. When i go back into xorg and run xterm my keys
are screwed up again. I tried exporting a few of the different termcap
entries available for xterm on my system, xterm, xterm-color,
xterm-xfree86. Had no luck with them. I then wondered if it was a
problem with zsh since i had done some custom key mappings. Changed my
shell to bash same. I'll have to play with some of the term settings
you mentioned in vim later on. Have not figured it out just yet but at
least you have me going down the right road now. Thanks.'


Re: bracket completion

2007-04-04 Thread A.J.Mechelynck

Greg Fitzgerald wrote:

[...] I did some more termcap
tests as well as on other systems, this time FreeBSD. Still the same
issue. So i'm starting to wondering if it's really termcap if 3 linux
boxes, openbsd, and freebsd are having the same problem. Although if i
am in console with term set to linux it does go away. 


Hm. It may just be a badly set 'term' option (it ought to match $TERM), or a 
'ttybuiltin' set to true instead or false, or vice-versa. This might mean a 
bad line (or even a missing line) in your vimc. You might also try using 
konsole where, if all else fails, you can set your "session type" to "Linux 
console", which ought to give you the same keyboard interface as in /dev/tty 
(the non-X text console).


(konsole is the terminal application which comes with kde)


Best regards,
Tony.
--
Syntactic sugar causes cancer of the semicolon.
-- Epigrams in Programming, ACM SIGPLAN Sept. 1982


RE: bracket completion

2007-04-04 Thread Waters, Bill
> I'll just add a statement enabling this for certain languages

Can someone provide an example of how to enable this for a certain
language?  I assume that it is a condition around the "remap" in your
vimrc??


-Original Message-
From: Waters, Bill 
Sent: Monday, April 02, 2007 1:42 PM
To: Greg Fitzgerald; A.J.Mechelynck
Cc: vim@vim.org
Subject: RE: bracket completion

Can you provide and example of how to do this?

Thanks,
Bill


> >
> >:inoremap { {}
> >:inoremap [ []
> >:inoremap ( ()
> >
>
> I'll just add a statment enabling this for certain languages. This has
> also giving me a couple new ideas to play with. Thanks again. :)
> 
> --Greg


Re: bracket completion

2007-04-04 Thread Karl Guertin

On 4/4/07, Waters, Bill <[EMAIL PROTECTED]> wrote:

Can someone provide an example of how to enable this for a certain
language?  I assume that it is a condition around the "remap" in your
vimrc??


The easiest way to do language-specific customizations is to create
.vim in your ~/.vim/after/ftplugin/ directory. This file is
sourced after everything else so the settings in this file override
previously set values.

e.g.

cat 'set expandtab' >> ~/.vim/after/ftplugin/python.vim

ensures that spaces are inserted in your python files rather than tabs.


Re: bracket completion

2007-04-04 Thread Winfred Lu

2007/4/3, Charles E Campbell Jr <[EMAIL PROTECTED]>:

Here's one: http://vim.sourceforge.net/scripts/script.php?script_id=1269

It is very useful, thank you.