Home Download Buy Blog Forum Support

Gobble - emacs' hungry backspace mode for ST2

Re: Gobble - emacs' hungry backspace mode for ST2

Postby facelessuser on Mon Mar 19, 2012 11:10 pm

Not so awesome in Python. Since python is an indention language, it is frustrating when you get auto-indented but you want to back out because the code block is done, and then gobble won't let you backspace proper.
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: Gobble - emacs' hungry backspace mode for ST2

Postby phillip.koebbe on Tue Mar 20, 2012 12:30 am

facelessuser wrote:Not so awesome in Python. Since python is an indention language, it is frustrating when you get auto-indented but you want to back out because the code block is done, and then gobble won't let you backspace proper.


That's what I was referring to. You're left with the choices of shift+tab or shift+backspace, neither of which is particularly appealing. If you have a keyboard with assignable keys, you can reduce it to one keystroke, so then it's just a matter of retraining the muscle memory from backspace to the new location.

I'm going to run with it a couple of days and see what happens. I never know until I try ...
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Gobble - emacs' hungry backspace mode for ST2

Postby skyronic on Tue Mar 20, 2012 4:17 am

facelessuser wrote:Not so awesome in Python. Since python is an indention language, it is frustrating when you get auto-indented but you want to back out because the code block is done, and then gobble won't let you backspace proper.


Yeah, I normally don't write python. But I noticed the same issue while I was writing the plugin source code itself.

Do you think it's better if I alias it to some other keybinding (ctrl+backspace) perhaps. This would fall back to the default binding of ctrl+backspace (backward delete word) if it's not the first character of a line - and it performs the gobble operation if it is.
skyronic
 
Posts: 14
Joined: Fri Mar 16, 2012 8:45 am

Re: Gobble - emacs' hungry backspace mode for ST2

Postby skyronic on Tue Mar 20, 2012 5:02 am

phillip.koebbe wrote:I like what you're trying to do with Gobble, but I just encountered a point of contention regarding auto indent.

Consider creating a new function in Ruby:

Code: Select all
def new_function

end


I don't use a lot of snippets, so when I do this, I type 'def new_function' and then ENTER, and with auto indenting, the insertion point would be on the next line but indented one more level:

Code: Select all
def new_function<enter>
     |<insertion point>


My normal practice is to then press ENTER again to go to the next line, BACKSPACE to back up one indentation level and type 'end'. But with Gobble, I can't. When I press BACKSPACE, I go back to the previous line. So I either need to not use auto indent (unlikely) or SHIFT+TAB instead of BACKSPACE before typing 'end'. I'm not sure which is better. I'll have to play with it a bit and see what I think.

[Or I could just start using a snippet and save myself from typing 'end' a lot! :)]

Either way, thanks for making the Sublime Community a little better!



Hi Phillip, facelessuser,

I figured out a fix for this - a way you can use Gobble and still work easily using your older muscle memory.

If you press backspace on an empty line (say after finishing a function block and wanting to type 'end') - it will only go back one level of indentation!!

Do try it out and let me know how it works!
skyronic
 
Posts: 14
Joined: Fri Mar 16, 2012 8:45 am

Re: Gobble - emacs' hungry backspace mode for ST2

Postby phillip.koebbe on Tue Mar 20, 2012 11:46 am

skyronic wrote:
Hi Phillip, facelessuser,

I figured out a fix for this - a way you can use Gobble and still work easily using your older muscle memory.

If you press backspace on an empty line (say after finishing a function block and wanting to type 'end') - it will only go back one level of indentation!!

Do try it out and let me know how it works!


I just gave it a quick whirl and it looks promising! I'll have it running today and let you know how it goes. Thanks for work!
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Gobble - emacs' hungry backspace mode for ST2

Postby adzenith on Wed May 23, 2012 11:45 pm

This looks pretty sweet! Are you planning on adding it to package control eventually?
adzenith
 
Posts: 1214
Joined: Mon Oct 19, 2009 9:12 pm

Previous

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 7 guests