indent problem after the ()

24 views
Skip to first unread message

adshuangjoh

unread,
Jul 2, 2011, 6:11:23 AM7/2/11
to xptemplate
anyone can tell me how to fix the problem? it just happen on some file
types like: cpp/c/cs/java/

Problem:
//////////////////////////////////////////////////////////////////
void foo() //press enter after the ')'
//cursor is here

expected:

void foo()
//i want the cursor here.

dr-dr xp

unread,
Jul 3, 2011, 2:40:51 PM7/3/11
to xptem...@googlegroups.com
Without a ";" I think the cursor should just be there where you actually got. 

It is an indentation feature by VIM itself.


--
You received this message because you are subscribed to the Google Groups "xptemplate" group.
To post to this group, send email to xptem...@googlegroups.com.
To unsubscribe from this group, send email to xptemplate+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xptemplate?hl=en.




--
要了几天饱饭就不记得西北风啥味了

adshuangjoh

unread,
Jul 4, 2011, 12:47:47 AM7/4/11
to xptemplate
yes, you are right, the problem is that when I try to input the { at
the cursor there, the { will automatically move to the begin of the
line, but it doesn't work when the xptemplate is installed.

do you think it is a problem or do you know how can i fix it?

how to reproduce:

A: without: xptemplate:
void foo() //step 1: enter
//cursor here, step 2: then input the '{', the '{' will go to the
begin of the line.

like:
void foo()
{

B: with xptemplate installed:
void foo() //step 1: enter
//cursor here, step 2: then input the '{', the '{' will keep them
with the '}' added.

like:
void foo()
{}


Johnny

dr-dr xp

unread,
Jul 4, 2011, 1:52:46 AM7/4/11
to xptem...@googlegroups.com

Yes It is a problem.

Moving "{" back to column 1 is controlled by VIM option "indentkeys".

Because that is a different way in which XPT puts chars on to screen, "indentkeys" doesn't work with XPT natively.

I'm gonna have a look at this issue. 
A possible solution is copying behaviors of  "indentkeys".

2011/7/4 adshuangjoh <adshu...@gmail.com>



--
要了几天饱饭就不记得西北风啥味了

adshuangjoh

unread,
Jul 4, 2011, 10:52:11 AM7/4/11
to xptemplate
thanks very much, wait for your update.

Johnny

On Jul 4, 1:52 pm, dr-dr xp <drdr...@gmail.com> wrote:
> Yes It is a problem.
>
> Moving "{" back to column 1 is controlled by VIM option "indentkeys".
>
> Because that is a different way in which XPT puts chars on to screen,
> "indentkeys" doesn't work with XPT natively.
>
> I'm gonna have a look at this issue.
> A possible solution is copying behaviors of "indentkeys".
>
> 2011/7/4 adshuangjoh <adshuang...@gmail.com>

dr-dr xp

unread,
Jul 5, 2011, 12:17:45 PM7/5/11
to xptem...@googlegroups.com
This issue has been fixed. check it out.

2011/7/4 adshuangjoh <adshu...@gmail.com>



--
要了几天饱饭就不记得西北风啥味了

adshuangjoh

unread,
Jul 6, 2011, 1:30:55 AM7/6/11
to xptemplate
thanks for you effort but sounds like it doesn't work on my OFFICE
PC. I will have a test when I back home tomorrow on my HOME PC.

Is this fix just for the Vim 7.2 ? does it matter if I use the Vim
7.3 ? also it seems like the default value for the option
"g:xptemplate_brace_complete" has been change to 0? I have to set it
to 1 on the vimrc file to make this feature work.

am I missing anything? I am just start to use Vim for around 1 month.


On Jul 6, 12:17 am, dr-dr xp <drdr...@gmail.com> wrote:
> This issue has been fixed. check it out.
>
> 2011/7/4 adshuangjoh <adshuang...@gmail.com>

dr-dr xp

unread,
Jul 6, 2011, 3:35:18 AM7/6/11
to xptem...@googlegroups.com
2011/7/6 adshuangjoh <adshu...@gmail.com>

thanks for you effort but sounds like it doesn't work on my OFFICE
PC.  I will have a test when I back home tomorrow on my HOME PC.

Is this fix just for the Vim 7.2 ? does it matter if I use the Vim

I am not sure now about this issue. I use VIM 7.3 and it works fine. I'm gonna do more test on it.
Because it depends on two settings 'indentkeys' and 'indentexpr' to work,  any of them may cause it not to work.

Would you send me your .vimrc and a list of your plugins installed?

And please tell me the values of these following settings on your VIM with a .java file opened:
:set indentkeys?
:set indentexpr?
:set cindent?
:set cinkeys?
:set cinoptions?

This will help a lot for tracking the problem. 
Thanks.

 
7.3 ? also it seems like the default value for the option
"g:xptemplate_brace_complete" has been change to 0? I have to set it
to 1 on the vimrc file to make this feature work.
 
Default value of g:xptemplate_brace_complete is 0 from this release. Because someone complained about this.



--
要了几天饱饭就不记得西北风啥味了

dr-dr xp

unread,
Jul 6, 2011, 3:43:39 AM7/6/11
to xptem...@googlegroups.com
I noticed that if I type:
void a()<CR>{
it automatically reduces the indent.

But:
void a()<CR><Space><LEFT>{
it does not reduce indent.

On my notepad, VIM and XPT acts the same in this way.
Not sure if this is just the issue you have had.

2011/7/6 dr-dr xp <drd...@gmail.com>



--
要了几天饱饭就不记得西北风啥味了

adshuangjoh

unread,
Jul 6, 2011, 4:56:22 AM7/6/11
to xptemplate
Hi,

Thanks for still working on this, I have send the vimrc file to you
gmail, please check it.

vim plugin as below:
Directory of C:\Program Files (x86)\Vim\vim73\plugin\
////////////////////////////////////////////
a.vim
bufexplorer.vim
cscope_macros.vim
EnhancedCommentify.vim
getscriptPlugin.vim
gzip.vim
matchparen.vim
minibufexpl.vim
NERD_commenter.vim
NERD_tree.vim
netrwPlugin.vim
New Text Document.txt
README.txt
rrhelper.vim
spellfile.vim
supertab.vba
taglist.vim
tarPlugin.vim
tohtml.vim
vimballPlugin.vim
vimspell.vim_
zipPlugin.vim

/////////////////////////////////////////////////////////////
C:\Program Files (x86)\Vim\vimfiles\...
snipMate.vim
supertab.vim
omnicppcomplete.vim
Align.vim
AlignMaps.vim
visual_studio.vim



On Jul 6, 3:35 pm, dr-dr xp <drdr...@gmail.com> wrote:
> 2011/7/6 adshuangjoh <adshuang...@gmail.com>

adshuangjoh

unread,
Jul 6, 2011, 5:25:44 AM7/6/11
to xptemplate
On Jul 6, 3:35 pm, dr-dr xp <drdr...@gmail.com> wrote:
> 2011/7/6 adshuangjoh <adshuang...@gmail.com>

adshuangjoh

unread,
Jul 6, 2011, 10:49:53 AM7/6/11
to xptemplate
Hi,
I just install the vim73 in a clean machine, with the only plugin
xptemplate installed, unfortunatelly, the issue is still there with
the vimrc as below:

set nocompatible
filetype plugin on
let g:xptemplate_brace_complete=1

so it sounds like we need another settings to make it work?

On Jul 6, 3:35 pm, dr-dr xp <drdr...@gmail.com> wrote:
> 2011/7/6 adshuangjoh <adshuang...@gmail.com>

adshuangjoh

unread,
Jul 6, 2011, 10:52:58 AM7/6/11
to xptemplate
Hi,

I just have the Vim7.3 + xptemplate installed on a CLEAN machine, and
the problem is still there, sounds like it need other options set to
make it work correctly.

vimrc file:
set nocompatible
filetype plugin on
let g:xptemplate_brace_complete=1



On Jul 6, 3:35 pm, dr-dr xp <drdr...@gmail.com> wrote:
> 2011/7/6 adshuangjoh <adshuang...@gmail.com>

adshuangjoh

unread,
Jul 6, 2011, 11:01:58 AM7/6/11
to xptemplate
Sorry, I sent to drdrxp@gmail by mistake, please check it now.

also update:
I just have the Vim7.3 with the only plugin xptemplate installed on a
CLEAN machine, and the problem is still there, sounds like it need
other options set to make it work correctly.

vimrc file:
set nocompatible
filetype plugin on
let g:xptemplate_brace_complete=1

dr-dr xp

unread,
Jul 8, 2011, 2:12:14 PM7/8/11
to xptem...@googlegroups.com
Fixed. 
Reply all
Reply to author
Forward
0 new messages