@adzenith
I know it’s a old question (previous post), but I’m still interested by the answer.
"Smart" horizontal cursor positioning
Hey, sorry, didn’t notice the question until just now! I seem to recall I added them because I couldn’t use the arrow keys to navigate autocomplete.
I just tried taking the context out, and it causes a different bug:
foo| [autocomplete window, item 0 selected]
press down
|foo [autocomplete window, item 1 selected]
The insertion point moves to the beginning of the line.
Thanks for your answer.
I couldn’t reproduce this bug, or I don’t understand it:
You mean that when changing selection in autocomplete window, the cursor move in the file view ?
I couldn’t reproduce it.
Do you have the last version of the repository https://github.com/bizoo/SmartCursor
Haha nope! Looks like I still had the second commit or so. I think I’d checked out the code using git so Package Manager stopped updating it. Whoops! Works now.
Oh wait, hold up, it’s doing it again.
Open a new buffer, set it to Python (so we get autocomplete), and type:
foo
foobar
f
now press down. For me, it snaps to the beginning of the line.
Yes you’re right, there’s something that goes wrong when autocomplete is triggered.
Thanks for your feedback, I’ll take a look on this issue later…
If only Jon could implement this feature in core ST3
I just discovered also that you can’t navigate the sidebar with the arrow keys unless you have those contexts set up…
I just wanted to say thank you for creating this plugin. I also migrated from TextPad on Windows and the smart cursor feature in that program was a real insight into how programmers actually use the cursor. As far as I can tell in my initial usage you’ve correctly adapted this feature to ST.
To contribute, I noticed on this threat that aren’t any newb instructions for installing this. So I’ll add those here and hopefully help anyone else who comes along. These instructions are for ST 2
- Install Sublime Package Manager following these instructions: sublime.wbond.net/installation
- Restart Sublime (not sure if this is required)
- Menu: Preferences / Package Control
- Choose “Add Repository”
- Paste in: github.com/bizoo/SmartCursor
- Menu: Preferences / Package Control
- Choose “Install Package”
- Type SmartCursor
- You should see the SmartCursor plugin - click on it to install
- Takes a few seconds to download and it should show success at the bottom of ST
- Add the keybindings to your user keybinding file by:
** Menu: Preferences / Key Bindings - User
** Paste this file into your Key Bindings: raw.github.com/bizoo/SmartCurso … ime-keymap
** (Note this file is also located in [sublime program folder]/Data/Packages/SmartCursor if it’s easier to get from there)
** Save and close - Restart Sublime (not sure if this is required)
If anyone sees errors in those install instructions, please repost with corrections. I hope this helps another beginner with Sublime Text and SmartCursor! Thanks for developing this!
Keywords to help others find this thread: TextPad, Sublime Text, cursor position, new line, arrow keys, cursor behavior, change
Was just made aware of the SmartCursor plugin, which I haven’t yet had the chance to try.
I added the following to the existing (three year old!) request on user echo, to mimic TextPad’s behavior. It comes from my blog.
TextPad is much smarter with cursor placement
This seemingly small and subtle thing is actually what I miss most most. TextPad is much smarter about where to place the cursor when pressing the up and down keys.
First, place your cursor here, either with the keyboard or mouse:
http://i.imgur.com/kEUndtN.jpg
Type “Hello”:
http://i.imgur.com/7fmvZPh.jpg
And then press the down arrow. Sublime takes you here:
http://i.imgur.com/vsFw9lA.jpg
TextPad takes you here:
http://i.imgur.com/Q3fToVI.jpg
This makes it much much easier to do common things on contiguous lines, such as populate lists with unique values. It remembers where you originally placed the cursor, or where you started typing (after navigating around with arrows).
The second part of this is that, when clicking outside of the right margin, the remembered position is where you click the mouse, not where the cursor is actually placed. So the cursor goes to the end of the line, as you expect
http://i.imgur.com/t1aTOPL.jpg
But when you press down, Sublime goes here
http://i.imgur.com/fejI0J8.jpg
And TextPad goes here
http://i.imgur.com/tFDX7E0.jpg
In both situations, in TextPad, clicking the right or left arrow resets the position.
SmartCursor is not available via ST3 Package Control.
Just manually installed it, via the “download zip” button on the github page. Had to unzip it, then re-zip the contents–not the folder–as SmartCursor.sublime-package.
At first glance, it WORKS with situation one in my above description, when the cursor is in the middle of the line.
It doesn’t work in situation two, when the cursor is clicked outside of the right margin. Any plans for this?
But that’s a huge improvement!!
[quote=“aliteralmind”]SmartCursor is not available via ST3 Package Control.
Just manually installed it, via the “download zip” button on the github page. Had to unzip it, then re-zip the contents–not the folder–as SmartCursor.sublime-package.[/quote]
There’s a post in this topic on how to install it using Package Manager (http://www.sublimetext.com/forum/posting.php?mode=reply&f=4&t=2529#pr53225)
If I understand your explication, it’s more or less the behavior of the END key:
That put the cursor at the end of the current line and tell ST to always go to the end of line when moving up/down.
There’s also a post from jps on the subject (https://forum.sublimetext.com/t/smart-horizontal-cursor-positioning/2050/14&hilit=xpos#p38288)
But I’ve no plan to do something like that, don’t think it’s useful for me and it is probably very difficult to implement with the current mouse API.
Appreciate the response. Even in its current state, it’s much much better than without it. So thanks.