如何使Home键在Eclipse中位于位置1? [英] How can I make the Home key put me at position 1 in Eclipse?

查看:124
本文介绍了如何使Home键在Eclipse中位于位置1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse Galileo,还有一个用于PHP开发的插件。我在工作中和家里使用相同的编辑器进行个人项目(在工作中,我不使用PHP或PHP插件)。



有一点使用虽然我花了几个小时时间挖掘了Window-> Preferences中的所有不同的选项(以及在互联网上搜索),但是我却无法找到如何做到这一点事情。也许这里有人可以帮助我吗?



这是发生了什么。我有一行代码:

 <?php 
echoHello world; //< - 我在说这条线
?>

,我的光标位于'世界'''中。



我点击了我的键盘上的Home键。在我的关键映射中,它声称这应该是把我带到行的开头('Line Start',确切地说)。对我而言,开始是指这个位置的左边没有任何东西,也就是位置1.如同在,没有标签,没有空格,没有任何东西,如果我按了我的键盘上的左箭头键,我应该移动到上一行的末尾。你知道你的浏览器如何在文本区域内工作,以及Word,记事本,Excel以及几乎所有其他程序的工作原理。



相反,当我点击首页时,我的光标移动到位置5,字符echo的开头。这样,如果不清楚,这不是线的开始。这是非空白内容的开始,但这不是我期望这个键的功能。如果我再次打到首页,我会进入真正的开始线 - 位置1.再次击中,我回到5.



这是可能的这不仅仅是家的关键,而且还可能是智能压缩功能的副作用。我也无法弄清楚如何关闭(我已经看到这里的几个帖子,表明它不能完成),它经常混乱我的格式化,这导致我浪费我的时间修复它,因为我特别关于编码时我的代码的外观。例如,当我复制/粘贴一行时,缩进就会被搞砸了(Eclipse认为应该是这个粘贴的行标签,尽管我已经复制的所有前面的空格和文本在一起)。这可能与家庭密钥的操作有关,也可能与Eclipse对开始行真正意义的看法有关。



我意识到,那些不像我这样编码的人将会有一个初始的反应,即改变你的方式,或者忽略混乱的格式化,让Eclipse自动修复它或类似的东西。这是可能的,但会花费相当多的时间,并且受到我正在改变我在这个应用程序上工作的方式的积极阻碍(在这一个设置中,因为它不会在工作中)而所有其他人将继续按照我的期望运作。所以对我来说,这种建议并不是一个非常可行的选择。



提前感谢您提供的任何帮助,建议或帮助。



PS。如果你知道我有一种方法来保持自动缩进,但关闭智能缩进,请让我知道。

解决方案

Untick 常规>编辑器>文本编辑器>行开始和结束时的智能插入位置。请注意,这将适用于所有Eclipse编辑器,而不仅仅是PHP编辑器。


I'm using Eclipse Galileo, with a plugin for PHP development. I use the same editor at work and at home for my personal projects (at work, I do not use PHP or the PHP plugin, however).

One thing about using it is driving me crazy, though, and though I've spent a couple of hours digging through all the different options under Window->Preferences (as well as searching around the Internet), I can't find out how to do this one thing. Maybe someone here can help me?

Here's what's happening. I've got a line of code:

<?php
    echo "Hello world";  // <-- I'm talking about this line
?>

and my cursor is on the 'w' in 'world'.

I hit the 'Home' key on my keyboard. In my key mappings, it claims this is supposed to take me to the beginning of the line ('Line Start', to be exact). To me, 'start' means 'there is nothing to the left of this position', aka position 1. As in, no tabs, no spaces, no nothing, and if I hit the 'Left arrow' key on my keyboard, I should then move to the end of the previous line. You know, how your browser works inside of a textarea, and how Word, Notepad, Excel, and almost every other program works.

Instead, when I hit 'Home', my cursor moves to position 5, the very beginning of the word 'echo'. This, in case it's not clear, is NOT the start of the line. It's the start of the non-whitespace content on the line, but that's not the way I expect this key to function. If I hit 'Home' again, I get to the REAL start of the line - position 1. Hit it again, and I'm back to 5.

It's possible that it's not a matter of the 'Home' key at all, but potentially a side-effect of the 'Smart Indenting' function. I also can't figure out how to turn that off (I've seen a few posts here that indicate that it can't be done), and it frequently messes up my formatting which causes me to waste my time fixing it, as I'm particular about how my code looks when I'm coding. For example, when I copy/paste a line, the indenting gets all messed up (the pasted line tabs in to where Eclipse thinks it should be, in spite of all of the preceding whitespace I've copied along with the text on the line). This may be related to the operation of the 'Home' key, or to Eclipse's conception of what the 'start' of the line really means.

I realize that people out there who don't code like I do will have an initial reaction of 'change the way you type', or 'ignore the messed-up formatting and let Eclipse auto-fix it later' or something similar. That's possible, but will take quite a bit of time, and is actively hindered by the fact that I'd be changing the way I work on this one app (in this one setting, as it doesn't do this at work), while all the others will continue to operate as I expect them to. So for me, that sort of suggestion is not a very viable option.

Thanks in advance for any help, advice or assistance you can offer.

PS. If you know of a way for me to keep 'Auto-indenting' on but turn off 'Smart Indenting', please let me know that too.

解决方案

Untick General > Editors > Text Editors > Smart caret positioning at line start and end. Note that this will apply to all Eclipse editors, not just the PHP editor.

这篇关于如何使Home键在Eclipse中位于位置1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆