551

How do I remove the ability to move the cursor after the end of line in IntelliJ?

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Joshua
  • 26,234
  • 22
  • 77
  • 106
  • 8
    It's funny - I want exactly the opposite for Eclipse, to enable virtual space. But I see it's currently an unresolved bug (21000). – Barry Kelly May 25 '10 at 19:14
  • 14
    Go here to vote for "unlimited whitespace" to be turned off as the default: http://youtrack.jetbrains.com/issue/IDEABKL-6478 – rogerdpack Apr 23 '13 at 21:50
  • 2
    Guys, could you provide more information on why that virtual space is inconvenient for you? – denis.zhdanov Apr 26 '13 at 10:02
  • Just personal preference. I think the wording could be a little clearer, but I also think it should stay the same default behavior. It makes IntelliJ have a unique feel. – Joshua Apr 26 '13 at 10:30
  • @denis.zhdanov It is contrary to all editors I've used so far. I often find that I have to look around to find where the cursor is. – JesperE Jun 17 '13 at 08:43
  • 10
    @denis.zhdanov I want to be able to press right-arrow and get to the beginning of the next line from the end of the current, or click arbitrarily to the right of a line and have the cursor end up exactly on the end of the line. I seldom want to put the cursor an arbitrary distance beyond the end of existing text and have the editor insert a bunch of whitespace for me when I start typing. I understand some people might prefer being able to do that, but for me I'd rather have it work as I'm used to every other text editor working. It's great that it's configurable, everyone's happy. – nairbv Jul 04 '13 at 16:50
  • 10
    Intellj 13 has changed the default for this to be off. – Bjorn Nov 20 '13 at 16:23
  • Good! I use WebStorm (where the default is apparently off) and IntelliJ (where it's on) and it's driving me nuts going back and forth. (Not to mention years of habits built up from using Eclipse.) – fool4jesus Apr 16 '14 at 01:10
  • Apparently, this can also happen in 'Column' select mode which IntelliJ will report in the status bar at the bottom-right. I was able to turn it off using the (Mac) hotkey: Cmd + Shift + 8 – steamer25 Oct 28 '15 at 15:35
  • @denis.zhdanov Also the fact that you have to spend time positioning the cursor so that you don't have five spaces before that new `else` clause... – noɥʇʎԀʎzɐɹƆ Dec 26 '15 at 04:29

6 Answers6

790

File menu -> Settings -> Editor -> General -> Virtual Space and uncheck 'Allow placement of caret after end of line' . You may also uncheck the other options in the Virtual Space panel.

Matt_Bro
  • 14,062
  • 2
  • 28
  • 41
alexpopescu
  • 9,057
  • 1
  • 20
  • 13
  • 4
    As a side effect, this lets me use the right arrow key to move the cursor from the end of a line to the beginning of the next line. Exactly what I wanted. – pts Oct 16 '11 at 13:18
  • 36
    it's strange they have a default that everybody would want to turn off. – Yada Oct 28 '11 at 04:05
  • 2
    All my virtual space options are turned off already, but I still have this... Any other solutions? – Kurru Jan 13 '12 at 01:50
  • 17
    In IntelliJ 11.1 (OS X), its Preferences > Editor > "Allow placement of caret at end of line" – romacafe Jun 12 '12 at 15:29
  • 4
    I like that "intellij disable click anywhere" is the first search suggestion when you type "intellij disable" in google. – Rag Jan 18 '13 at 15:54
  • 1
    AHH. I can breathe a sigh of relief now; this "feature" was about to make me lose my mind! Thank you! – HellaMad Jan 19 '13 at 05:25
  • 1
    @BrianGordon Not for me it isn't - it was "disable spell check". Which, to be fair, I was also about to google, right after I'd found this. It is kind of weird that this was on by default, but I am impressed at the sheer number of options available. It might well be that I *won't* have to install any addons to get a usable UI for IntelliJ, which I can't say the same for VS2010 (no middle mouse scroll, no way to turn off ctrl+middle mouse = zoom in. Who would want to zoom in on code often enough to make it a shortcut??) – neminem Jul 25 '13 at 01:16
  • In Intellij 12 Ubuntu, it's found under File > Settings > Editor – StackExchange What The Heck Aug 12 '13 at 11:09
  • 1
    At last! This was driving me insane. The exact instructions were out of of date for Intellij 13 on Mac OS X, but one of the comments above pointed me in the right direction. Namely, disable this checkbox: Preferences > Editor > Allow placement of caret at end of line. – acronce Jun 13 '14 at 21:15
  • 4
    Did this break with the last (15.0.1) update? I've never noticed this before, the mentioned setting is off, but the cursor still places after the end of line. – Jorn Dec 15 '15 at 10:19
  • There's a bug in my version. It started doing this with it off. I had to toggle the setting to get it to stop being annoying. – jgmjgm Sep 09 '19 at 16:56
239

If the other answers don't seem to be working, you might have Column Selection Mode enabled. On my Mac it's mapped to Cmd+Shift+8. It's located under the Edit menu. That menu item will show a little checkmark when the mode is enabled.

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
Stephen Henderson
  • 2,701
  • 1
  • 13
  • 10
  • 5
    For me this option was the issue. I used the shortcut `Shift`+`Cmd`+`A`, typed in `Column Selection Mode` and turned it off. – Fabian Apr 25 '15 at 10:38
  • 15
    Sweet, I think I accidentally turned this on while creating a scratch file. My hotkeys were `Shift`+`Alt`+`Insert`. For anyone one else looking for it, just open the settings and search for `Column Selection Mode` and it'll bring up its hotkey. As another note, I am on Intellij 15 using Centos 7. – jemiloii Sep 16 '15 at 15:52
  • 4
    This helped! Must have hit it by accident. Any other suggested solution didn't change anything. – Jonas Tonny Feb 06 '16 at 11:51
  • 2
    This worked for me too, but I had to manually uncheck it from the menu with the mouse -- the shortcut is correct but didn't seem to work :/ – Matthew Read Sep 01 '16 at 18:37
21

To get the expected behavior where indentations are respected when you click on a line :

In Preferences > Editor > Virtual Space

Check :

Allow placement of caret inside tabs.

Uncheck :

Allow placement of caret after end of line.

This was really annoying to me and makes very little sense as a default behavior to me.

Emil Davtyan
  • 13,808
  • 5
  • 44
  • 66
  • 1
    This is a weird setting. I use spaces instead of tabs, but it works as expected. The setting should probably read `Allow placement of caret inside indents`. – Joseph Yaduvanshi Feb 28 '14 at 15:51
19

Note that for Intellij IDEA 11 for mac, settings are placed under the IntelliJ IDEA menu and called preferences. (Maybe some sort of mac default ?)

Carl Manaster
  • 39,912
  • 17
  • 102
  • 155
Thomas N
  • 418
  • 1
  • 7
  • 14
4

What Matt_Bro said (first answer), but if you've already got the box unchecked in preferences, try re-checking it (I checked all the virtual space boxes) and restarting. Then uncheck and hit apply--at this point unlimited space was disabled for me.

cognalog
  • 440
  • 5
  • 8
4

IntelliJ IDEA 2016

By default, it's turned off (unchecked).

If it is turned on, you can use one of the following 2 approaches:

  1. File > Settings... (or Ctrl+Alt+S) > Editor > General > Virtual Space section > uncheck Allow placement of caret after end of line

    File > Settings

    Editor General Allow placement

  2. Help > Find Action... (or Ctrl+Shift+A) > type "Virtual Space: Allow end" > Enter or left click (to switch between On and Off) > Esc

    Help > Find Action

    Allow Caret On Off

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199