Open chendo opened 11 years ago
@chendo I'm not sure I'm understanding your suggestion fully. Is it showing the beginning and end of lines for all lines or just the current line? If it's just the current line, I think there are easier keystrokes for doing that. If you're suggesting all lines in the visible view, it's easy to get to the beginning of a line with the existing goto line functionality (ctrl-L
). In Vintage mode you can get to the end of the line with $
and the first non-blank character with ^
, so I think in most cases those shortcuts are about as easy to use as EasyMotion is.
Alternatively, if you're looking at the character at the beginning of the line or the end of the line, you can just use easy motion to jump to whatever character is there. So in your example, if you wanted to get to the end of class Foo
you'd just use EasyMotion to look for o
and choose the 2nd one. If you wanted to get to the start of the line for def bar
you'd just EasyMotion for d
and choose the 1st one.
Am I missing something in your suggestion?
For all lines, ideally. Jumping to line can be annoying when you're in triple digit territory and is a few keystrokes more when you want to jump to the end (Ctrl-G
, 1
, 2
, 3
, Esc
, Shift+$
/Ctrl-E
), where Cmd+;
, Enter
, (Enter
if it's not highlighted), <letter>
.
Also, jumping to a character puts the cursor before the character which I find extremely annoying, because if I want to edit that character, I can't just go Backspace
and Delete
is further away.
I've seen a number of times where I would have found this useful as well (especially EOL) so I'm planning on doing at least BOL and EOL for this.
I'm wondering if for your 2nd point if my suggestion in #27 using an offset
would fit what you're looking for. Is the cursor always 1 character to the left of where you're wanting it to be, or only sometimes? If I implement it the way I'm thinking, you might need to have two different keybindings depending on if you want the cursor to the left or to the right of the chosen character.
So would this be implemented with Enter/Return
as the 'character'?
Hmmm, I think most of use cases would want to be to the right of the character if my intent is to modify, however I can see the current behaviour useful when I want to perform a selection. Multiple keybindings would work I guess but I feel there's a better option.
The offset would be way better for my use cases than only EOL. (I may have missed some of your explanations) I'm not sure how the offset would impact the selection because currently, the carret is going just after the character and it's fine.
@chendo I'm a little fuzzy on how you're suggesting the cursor get positioned. If you can clearly define the rules on when (in insert mode) you'd want the cursor to the left of the jump target (maybe if it's the beginning of a word? or not the last character in a word?) and when it should be to the right (maybe if it's the last character in a word?) it's something I might be able to enable as an optional mode that people could use.
If it's not consistently always before the character or after the character (as it would be with offset) that does mean that there would be some places that the cursor would be unable to get to with EasyMotion.
I'm almost always using the plugin in normal (non-insert) mode so I don't have a good feel for what would be good for those that use it in insert mode.
@tednaleid Having it on the left of the target if it's at the beginning of a word works for me, but yeah there will be locations where you can't jump to. That said, I rarely jump to within a word; usually the start and end of words. If you make a smart_jump
option or something or even just offset
, I'm sure we can figure it out :)
Partial support is now in for jumping to BOL and EOL with cmd+;
then enter
. Doesn't currently work with making a selection, also doesn't decorate empty lines. Probably doesn't do what OP wants with character position in insert mode as well. I'll continue to work on this and look at some sort of smart_jump
type option...
Looks good, however not decorating empty lines is a problem for me as I've got trim trailing whitespace on and this doesn't let me jump those lines. Also EOL feels a bit weird for me as it's going to the letter before (insert mode), so I'm still waiting for the offset
feature
Yep, this is definitely not a complete solution. Getting empty lines decorated is the next step, but there's more to it as we need to insert characters where there aren't ones now, which affects offsets. Doable, just not done :).
Yeah... I kind of wish Sublime had an overlay API that doesn't involve editing the actual buffer.
This plugin would be so much easier and less kludgy if that were there. I was a disappointed that (as far as I can tell) ST3 doesn't look like it includes anything like this. Apparently, it's more of a cross platform issue than anything.
Gave adding a placeholder empty character to empty lines and ST2 gets very weird when I erase them and try to jump to those lines. The code gets very messy with this in there...the cursor moving API in ST2 is pretty screwy and this pushes it past a level that I'm comfortable with.
Thinking about changing the implementation a bit so that for BOL/EOL jumping it puts the jump target in the gutter rather than decorating all of the text.
It would be cool to be able to hit something like
Cmd+;
, thenEnter
to have it show beginning of line (after all the indenting) and end of line, or possibly just the one if it's just an empty line with indenting in front.Use case:
Cmd+;
,Enter
would show BOL and EOLs, and just one jump point for where the . is so I could jump there.