Is there a way to bind the Home key in a way so that it behaves similar to UltraEdit?
Nearly 2 years has past, since I last asked about this: http://thread.gmane.org/gmane.editors.textmate.general/16116
Maybe there is a solution now?
The first time you press Home then the cursor jumps to the first letter on the line (/^\s*/).
The second time you press Home it jumps to the beginning of the line (/^/).
position A = ^ position B = ^\s*
Item1. pressing home and cursor jumps to position B. Item2. except when cursor already is at position B, then it jumps to A. Item3. doesn't modify the file. Item4. when shift is held down then it preserves the selection correct.
I have tried different approaches mentioned in the past on this list, but they have problems with Item3 and Item4. I have also tried making my own ruby scripts for it, but there was also problems with Item3 and Item4.
Has anyone a well behaved Smart Home command?
#################################################### # Good: Item1 and Item2 # Bad: Item3 and Item4 # # Save: Nothing # Input: Selected Text or Line # Output: Insert as Snippet # Activation: Key Equivalent, HomeKeyArrow # Scope Selector: <blank> #################################################### #! /usr/bin/ruby line = ENV['TM_CURRENT_LINE'] index = ENV['TM_LINE_INDEX'].to_i
# extract leading whitespace remain = line.sub(/(^[ \t]*)/, '')
whitespace = $1
if whitespace == nil whitespace = '' elsif index == whitespace.size whitespace = '' else line = remain end
# escape $ \ ` line.gsub!(/([$\`])/){"\#$1"}
# place cursor print "#{whitespace}${1}#{line}" ####################################################
On the same subject, I would like my END key to go to the end of the line instead of scroll the document. Can this be achieved?
The 'Smart Home' concept Simon describes is also interesting to me. I bet this would be handy.
Simon Strandgaard wrote:
Is there a way to bind the Home key in a way so that it behaves similar to UltraEdit?
Nearly 2 years has past, since I last asked about this: http://thread.gmane.org/gmane.editors.textmate.general/16116
Maybe there is a solution now?
The first time you press Home then the cursor jumps to the first letter on the line (/^\s*/).
The second time you press Home it jumps to the beginning of the line (/^/).
position A = ^ position B = ^\s*
Item1. pressing home and cursor jumps to position B. Item2. except when cursor already is at position B, then it jumps to A. Item3. doesn't modify the file. Item4. when shift is held down then it preserves the selection correct.
I have tried different approaches mentioned in the past on this list, but they have problems with Item3 and Item4. I have also tried making my own ruby scripts for it, but there was also problems with Item3 and Item4.
Has anyone a well behaved Smart Home command?
#################################################### # Good: Item1 and Item2 # Bad: Item3 and Item4 # # Save: Nothing # Input: Selected Text or Line # Output: Insert as Snippet # Activation: Key Equivalent, HomeKeyArrow # Scope Selector: <blank> #################################################### #! /usr/bin/ruby line = ENV['TM_CURRENT_LINE'] index = ENV['TM_LINE_INDEX'].to_i
# extract leading whitespace remain = line.sub(/(^[ \t]*)/, '')
whitespace = $1
if whitespace == nil whitespace = '' elsif index == whitespace.size whitespace = '' else line = remain end
# escape $ \ ` line.gsub!(/([$\`])/){"\#$1"}
# place cursor print "#{whitespace}${1}#{line}" ####################################################
I second both.
-N.
On 5 Dec 2008, at 17:11, Louis D Walch wrote:
On the same subject, I would like my END key to go to the end of the line instead of scroll the document. Can this be achieved?
The 'Smart Home' concept Simon describes is also interesting to me. I bet this would be handy.
Simon Strandgaard wrote:
Is there a way to bind the Home key in a way so that it behaves similar to UltraEdit?
Nearly 2 years has past, since I last asked about this: http://thread.gmane.org/gmane.editors.textmate.general/16116
Maybe there is a solution now?
The first time you press Home then the cursor jumps to the first letter on the line (/^\s*/).
The second time you press Home it jumps to the beginning of the line (/^/).
position A = ^ position B = ^\s*
Item1. pressing home and cursor jumps to position B. Item2. except when cursor already is at position B, then it jumps to A. Item3. doesn't modify the file. Item4. when shift is held down then it preserves the selection correct.
I have tried different approaches mentioned in the past on this list, but they have problems with Item3 and Item4. I have also tried making my own ruby scripts for it, but there was also problems with Item3 and Item4.
Has anyone a well behaved Smart Home command?
#################################################### # Good: Item1 and Item2 # Bad: Item3 and Item4 # # Save: Nothing # Input: Selected Text or Line # Output: Insert as Snippet # Activation: Key Equivalent, HomeKeyArrow # Scope Selector: <blank> #################################################### #! /usr/bin/ruby line = ENV['TM_CURRENT_LINE'] index = ENV['TM_LINE_INDEX'].to_i
# extract leading whitespace remain = line.sub(/(^[ \t]*)/, '')
whitespace = $1
if whitespace == nil whitespace = '' elsif index == whitespace.size whitespace = '' else line = remain end
# escape $ \ ` line.gsub!(/([$\`])/){"\#$1"}
# place cursor print "#{whitespace}${1}#{line}" ####################################################
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On Fri, Dec 5, 2008 at 11:11 PM, Louis D Walch me@louiswalch.com wrote:
On the same subject, I would like my END key to go to the end of the line instead of scroll the document. Can this be achieved?
[snip]
Agree. Smart End Key behavior, would be nice too. However I tried narrowing down the topic to cover just the Home key. I tried in the past asking for both Home and End in the same thread and it was unsuccessful.
-- Simon Strandgaard my graphics program for mac - http://toolboxapp.com/
Hi,
On 05.12.2008, at 23:11, Louis D Walch wrote:
On the same subject, I would like my END key to go to the end of the line instead of scroll the document. Can this be achieved?
This can be achived: http://blog.macromates.com/2005/key-bindings-for-switchers/
adi
-- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer skype: adijsieker SAP-Consultant web: http://www.sieker.info/profile openbc: https://www.openbc.com/hp/ AdiJoerg_Sieker/
On Sat, Dec 6, 2008 at 9:07 PM, Adi Jörg Sieker adi@sieker.info wrote: [snip]
This can be achived: http://blog.macromates.com/2005/key-bindings-for-switchers/
Hi Adi, you are linking to a pretty long text that takes time to read through. I don't see any solution for it there. Can you point me to where in this page its being mentioned? or post some code?
-- Simon Strandgaard my graphics program for mac - http://toolboxapp.com/
Hi Simon,
Perhaps you clicked to a different page after visiting that link, as that document is quite short. Near the end of it there is sample code that modifies the functionality of your end and home keys. Take a look there.
On Sun, Dec 7, 2008 at 1:52 AM, Simon Strandgaard neoneye@gmail.com wrote:
On Sat, Dec 6, 2008 at 9:07 PM, Adi Jörg Sieker adi@sieker.info wrote: [snip]
This can be achived: http://blog.macromates.com/2005/key-bindings-for-switchers/
Hi Adi, you are linking to a pretty long text that takes time to read through. I don't see any solution for it there. Can you point me to where in this page its being mentioned? or post some code?
-- Simon Strandgaard my graphics program for mac - http://toolboxapp.com/
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On Sun, Dec 7, 2008 at 12:07 PM, Nick ParadoxQuine@gmail.com wrote:
Perhaps you clicked to a different page after visiting that link, as that document is quite short. Near the end of it there is sample code that modifies the functionality of your end and home keys. Take a look there.
[snip]
No.
This is my own personal keybindings, exactly the same as in the key-bindings-for-switchers document. These keybindings makes the Home key go to line-begin (same as pressing ^a).
prompt> cat ~/Library/KeyBindings/DefaultKeyBinding.dict { /* home */ "\UF729" = "moveToBeginningOfLine:"; "$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* end */ "\UF72B" = "moveToEndOfLine:"; "$\UF72B" = "moveToEndOfLineAndModifySelection:";
/* page up/down */ "\UF72C" = "pageUp:"; "\UF72D" = "pageDown:"; } prompt>
This alone doesn't solve the Smart Home problem.
Smart Home is about jumping between text-begin and line-begin. Is it possible to do this?
-- Simon Strandgaard my graphics program for mac - http://toolboxapp.com/
Hi Simon,
On 07.12.2008, at 10:52, Simon Strandgaard wrote:
On Sat, Dec 6, 2008 at 9:07 PM, Adi Jörg Sieker adi@sieker.info wrote: [snip]
This can be achived: http://blog.macromates.com/2005/key-bindings-for-switchers/
Hi Adi, you are linking to a pretty long text that takes time to read through. I don't see any solution for it there. Can you point me to where in this page its being mentioned? or post some code?
My solution was for the request from Louis D Watch to make the END key go to the end of line instead of end of document.
The smart home key would be nice. :)
adi
-- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer skype: adijsieker SAP-Consultant web: http://www.sieker.info/profile openbc: https://www.openbc.com/hp/ AdiJoerg_Sieker/
On Sun, Dec 7, 2008 at 8:52 PM, Adi Sieker adi@sieker.info wrote:
On 07.12.2008, at 10:52, Simon Strandgaard wrote:
On Sat, Dec 6, 2008 at 9:07 PM, Adi Jörg Sieker adi@sieker.info wrote: [snip]
This can be achived: http://blog.macromates.com/2005/key-bindings-for-switchers/
Hi Adi, you are linking to a pretty long text that takes time to read through. I don't see any solution for it there. Can you point me to where in this page its being mentioned? or post some code?
My solution was for the request from Louis D Watch to make the END key go to the end of line instead of end of document.
The smart home key would be nice. :)
Ah, I see :-)
I think Louis D asked for Smart End Key behavior, where the caret jumps between text-end and line-end. Also pretty common in other editors.
Turbo Pascal had a really nice solution instead of Smart End Key. It did right-trim on every line, which is very useful too, (because blankspaces are usually unwanted at the end of the line).
1. Smart Home Key 2. Automatic Right-trim 3. Smart End Key
1 + 2 + 3 = awesome.
On 2008-Dec-7, at 3:02 PM, Simon Strandgaard wrote:
I think Louis D asked for Smart End Key behavior, where the caret jumps between text-end and line-end. Also pretty common in other editors.
If "text end" and "line end" aren't the same thing, the user has made an error IMO. :)
Sorry been out of town and just catching up on this...
I am not looking for anything too complex, not a smart END key. Just want it to jump to the end of the line instead of the file, which it currently does.
Just downloaded Textmate last week so I am not sure about all the ways you are supposed to configure this type of action. Used to BBEdit where its right in the prefs.
I do not have a file at: ~/Library/KeyBindings/DefaultKeyBinding.dict
On Dec 8, 2008, at 10:20 AM, Rob McBroom wrote:
On 2008-Dec-7, at 3:02 PM, Simon Strandgaard wrote:
I think Louis D asked for Smart End Key behavior, where the caret jumps between text-end and line-end. Also pretty common in other editors.
If "text end" and "line end" aren't the same thing, the user has made an error IMO. :)
-- Rob McBroom http://www.skurfer.com/
Because it screws up the order in which people normally read text.
Original message:
Why is it bad to top-post your reply?
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Louis,
If you'd like your end key to go to the end of line, just follow the instructions in this document:
http://blog.macromates.com/2005/key-bindings-for-switchers/
If a file mentioned isn't present, I'd say just create it :)
Hope that helps, Nick
On Mon, Dec 8, 2008 at 12:19 PM, Louis Walch me@louiswalch.com wrote:
Sorry been out of town and just catching up on this...
I am not looking for anything too complex, not a smart END key. Just want it to jump to the end of the line instead of the file, which it currently does.
Just downloaded Textmate last week so I am not sure about all the ways you are supposed to configure this type of action. Used to BBEdit where its right in the prefs.
I do not have a file at: ~/Library/KeyBindings/DefaultKeyBinding.dict
On Dec 8, 2008, at 10:20 AM, Rob McBroom wrote:
On 2008-Dec-7, at 3:02 PM, Simon Strandgaard wrote:
I think Louis D asked for Smart End Key behavior, where the caret jumps between text-end and line-end. Also pretty common in other editors.
If "text end" and "line end" aren't the same thing, the user has made an error IMO. :)
-- Rob McBroom http://www.skurfer.com/
Because it screws up the order in which people normally read text.
Original message:
Why is it bad to top-post your reply?
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On Fri, Dec 5, 2008 at 8:54 PM, Simon Strandgaard neoneye@gmail.com wrote:
Is there a way to bind the Home key in a way so that it behaves similar to UltraEdit?
[snip]
There is no solution to this :-(
If nobody uses smart home, then how is your Home key defined?