X

Geertjan's Blog

  • September 21, 2006

Selecting a Line Really Quickly

Geertjan Wielenga
Product Manager
This is something I discovered by accident recently. It works in all editors everywhere (i.e., also outside NetBeans IDE and also in, for example, browsers). But, if you don't know about it, it is really helpful (once you do know about it). If you do know about it, it is really "duh". So, this is written for those who don't know about it (so please don't leave comments that basically say "duh").

In the Source Editor in the IDE, you often need to select a single line, for copying or whatever. There's a keyboard shortcut you can set for that, in the Keymap's "Other" section, you can set the "Select Line" shortcut to something. However, there's no need to do that. Why? Because you can select a line like this:

  1. Double-click on a word in the editor, to select it.
  2. Now pause for a split second.
  3. Now, click once more.

And... now the whole line is selected. The split second pause is important, as is getting the timing right. (And sometimes the split second isn't even necessary, just click three times.) But, once you've got it, it saves a lot of time. Now you can do Ctrl-C (or anything else applicable to a line) to work with the line. You can also right click and then choose a line-related action from the contextual menu.

Join the discussion

Comments ( 5 )
  • gershwinou Thursday, September 21, 2006
    i use home/shift+end
    really fast as well, and work for every editor (even not in netbeans. I think it is even better, since you don't use the mouse and so no back and forth between mouse and keyboard
  • Matthias Ernst Thursday, September 21, 2006

    First of all, I think it is a simple triple-click. The split second doesn't seem necessary in FireFox or Wordpad.

    My usual IDEA comment: If there is no selection, IDEA will select the current line first on certain commands. So there is no need to select the line first: if I want to copy it, I simply press \^-C., \^-X or \^-D anywhere in the line. That's really helpful.


  • Geertjan Thursday, September 21, 2006
    Matthias, that is really cool. Because, in NetBeans, when nothing is selected, nothing is copied when I do Ctrl-C. I would much prefer the whole line to be copied. Hoping that that will be included in the upcoming enhancements in NetBeans.

    gershwinou, I would prefer to use the keyboard (I am definitely more a keyboard person that a mouse person), but on my Vaio laptop, your key combination doesn't seem to work for me for selecting a line.

  • Geertjab Thursday, September 21, 2006
    By the way, yes, it does seem to be a simple triple click.
  • DJ Thursday, September 21, 2006
    TEsting
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.