On Fri Dec 5 19:54:25 Simon Strandgaard wrote:
Is there a way to bind the Home key in a way so that it behaves similar to UltraEdit?
On Fri Dec 5 22:51:55 Oliver Taylor wrote:
(please correct me if I'm wrong)
Don't think it's possible. This is because I don't think TextMate can "see" the HOME and END keys being pressed. The OS must intercept the keypress and move the view without telling TextMate it even does it.
Maybe a third-part macro utility like Keyboard Maestro could help here.
Wow. That was just dumb. Of course TextMate can assign HOME and END to snippets etc.
What am I? New?
On 06.12.2008, at 10:44, Oliver Taylor wrote:
On Fri Dec 5 19:54:25 Simon Strandgaard wrote:
Is there a way to bind the Home key in a way so that it behaves similar to UltraEdit?
For HOME one could do this:
a tmcommand bound to HOME, no input, output to show tool tip, command:
if [ $TM_COLUMN_NUMBER -eq 1 ]; then open "txmt://open?line=1" & else open "txmt://open?line=$TM_LINE_NUMBER&column=1" & fi
Up to now I don't see chance to preserve the selection. Maybe via macros. With END the same way.
--Hans
On Sat, Dec 6, 2008 at 11:19 AM, Hans-Jörg Bibiko bibiko@eva.mpg.de wrote:
On 06.12.2008, at 10:44, Oliver Taylor wrote:
On Fri Dec 5 19:54:25 Simon Strandgaard wrote:
Is there a way to bind the Home key in a way so that it behaves similar to UltraEdit?
For HOME one could do this:
a tmcommand bound to HOME, no input, output to show tool tip, command:
if [ $TM_COLUMN_NUMBER -eq 1 ]; then open "txmt://open?line=1" & else open "txmt://open?line=$TM_LINE_NUMBER&column=1" & fi
Up to now I don't see chance to preserve the selection. Maybe via macros. With END the same way.
[snip]
This looks promising. I have tried it out, but it behaves a bit odd. When I first tried experimenting with it your snippet jumps to the start of the document. Then I began writing this reply and wanted to double check.. and I inserted your snippet again, but now it does nothing.
line1: if [ $TM_COLUMN_NUMBER -eq 1 ]; then line2: open "txmt://open?line=1" & line3: else line4: open "txmt://open?line=$TM_LINE_NUMBER&column=1" & line5: fi
I wanted to write something about line2 and line4 when I evaluated them on their own. However since nothing works now, im not sure what I wanted to write.
line4 looks in particular useful, if its possible to go to an X,Y position without modifying the document.. thats could be a way to do it. if just I could get it to work.
On 07.12.2008, at 13:30, Simon Strandgaard wrote:
On Sat, Dec 6, 2008 at 11:19 AM, Hans-Jörg Bibiko bibiko@eva.mpg.de wrote:
For HOME one could do this:
a tmcommand bound to HOME, no input, output to show tool tip, command:
if [ $TM_COLUMN_NUMBER -eq 1 ]; then open "txmt://open?line=1" & else open "txmt://open?line=$TM_LINE_NUMBER&column=1" & fi
This looks promising. I have tried it out, but it behaves a bit odd. When I first tried experimenting with it your snippet jumps to the start of the document. Then I began writing this reply and wanted to double check.. and I inserted your snippet again, but now it does nothing.
First it is not a snippet in TM terms. It must be a command. Then, what's odd?
The command checks if your cursor is at the beginning of a line: TM_COULUMN_NUMBER==1? If so it moves the cursor to the beginning of the doc. If not it moves the cursor to first column of the current line.
if its possible to go to an X,Y position without modifying the document..
This is done by using 'open txmt://open?line=X&column=Y'. This command tells TM to activate the front most doc and set the cursor to X,Y without modifying the doc.
Normally I do not use the HOME key. I usually navigate by using APPLE +ARROW_LEFT/UP
--Hans
Attached my command.
On Sun, Dec 7, 2008 at 5:52 PM, Hans-Jörg Bibiko bibiko@eva.mpg.de wrote:
On 07.12.2008, at 13:30, Simon Strandgaard wrote:
[snip]
This looks promising. I have tried it out, but it behaves a bit odd. When I first tried experimenting with it your snippet jumps to the start of the document. Then I began writing this reply and wanted to double check.. and I inserted your snippet again, but now it does nothing.
First it is not a snippet in TM terms. It must be a command.
Yes I have made it as a command.
Then, what's odd?
The command checks if your cursor is at the beginning of a line: TM_COULUMN_NUMBER==1? If so it moves the cursor to the beginning of the doc. If not it moves the cursor to first column of the current line.
if its possible to go to an X,Y position without modifying the document..
This is done by using 'open txmt://open?line=X&column=Y'. This command tells TM to activate the front most doc and set the cursor to X,Y without modifying the doc.
I guessed that, but I should probably used other words for it :-)
Whenever I run the command TM places the caret on line 2 column 1. I have recorded a video of the problem, however its impossible to see what going on. I make changes to the X and Y values in this command a few times, but the caret doesn't change. http://vimeo.com/2454977
I have made a ruby script out of it, in hope of turning it into a Smart Home command.
#! /usr/bin/ruby cmd = "open 'txmt://open?line=5&column=10'" system cmd
Example, if I set X to 13 and Y to 20.. then TM jumps to line 2, column 1.
Nevermind. Your command jumps to the beginning of the line, and second time I hit Home it jumps to the beginning of the document. I have tried modifying your command to jump to column=5, but TM jumps to column 1.
if [ $TM_COLUMN_NUMBER -eq 1 ]; then open "txmt://open?line=1" & else open "txmt://open?line=$TM_LINE_NUMBER&column=5" & fi
And changing it so it jumps to line 3.. has no effect too.
if [ $TM_COLUMN_NUMBER -eq 1 ]; then open "txmt://open?line=3" & else open "txmt://open?line=$TM_LINE_NUMBER&column=1" & fi
Nevermind, I don't think we come closer to the Smart Home behavior.
This is really weird. I'm using dozens of such jumping commands and it works perfectly.
What shell are you using? Bash? Maybe try this:
#!/bin/sh if [ $TM_COLUMN_NUMBER -eq 1 ]; then open "txmt://open?line=1" else open "txmt://open?line=$TM_LINE_NUMBER&column=1" fi
Do you have BBedit installed?
What happens if you execute :
open "txmt://open?line=10&column=2"
in the Terminal?
--Hans
On Sun, Dec 7, 2008 at 7:05 PM, Hans-Jörg Bibiko bibiko@eva.mpg.de wrote:
This is really weird. I'm using dozens of such jumping commands and it works perfectly.
What shell are you using? Bash? Maybe try this: Do you have BBedit installed?
[snip]
prompt> env | grep SHELL SHELL=/bin/bash prompt>
Yes my shell is bash.
I reinstalled osx 10.5.5 on a new disk (my old drive died 4 days ago, which is why im in the process of setting up keybindings again). There is no bbedit, no textwrangler, nothing installed.
TextMate version = 1.5.7 (1436)
STEP1: before pressing home.. inside the bundle editor http://farm4.static.flickr.com/3092/3090201542_c85a071dc0_o.png
STEP2: I close the bundle editor
STEP3: and press Home
STEP4: after pressing home http://farm4.static.flickr.com/3135/3089363911_005a97445d_o.png
The caret ends up at line=3 and column=1, for some strange reason.
[snip]
What happens if you execute :
open "txmt://open?line=10&column=2"
in the Terminal?
This actually works. TM jumps to line 10, column 2.
On 07.12.2008, at 19:21, Simon Strandgaard wrote:
[snip]
What happens if you execute :
open "txmt://open?line=10&column=2"
in the Terminal?
This actually works. TM jumps to line 10, column 2.
Hmm, weird. That means that open 'txmt...' works.
Do you have any keybindings defined in KeyBindings/ DefaultKeyBinding.dict for HOME?
What happens if you change the key binding to let's say F13 ?
--Hans
On Sun, Dec 7, 2008 at 7:42 PM, Hans-Jörg Bibiko bibiko@eva.mpg.de wrote:
On 07.12.2008, at 19:21, Simon Strandgaard wrote:
[snip]
What happens if you execute :
open "txmt://open?line=10&column=2"
in the Terminal?
This actually works. TM jumps to line 10, column 2.
Hmm, weird. That means that open 'txmt...' works.
Do you have any keybindings defined in KeyBindings/ DefaultKeyBinding.dict for HOME?
What happens if you change the key binding to let's say F13 ?
[snip]
Binding it to F13 works.
My keybindings file looks like this:
prompt> cat ~/Library/KeyBindings/DefaultKeyBinding.dict { /* home */ "\UF729" = "moveToBeginningOfLine:"; "$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* end */ "\UF72B" = "moveToEndOfLine:"; "$\UF72B" = "moveToEndOfLineAndModifySelection:";
/* page up/down */ "\UF72C" = "pageUp:"; "\UF72D" = "pageDown:"; } prompt>
For some reason keybinding for Home is not overloaded by the command.