aurora / rmate

Remote TextMate 2 implemented as shell script
GNU General Public License v3.0
887 stars 123 forks source link

Does not support the +N syntax and cannot be used as $EDITOR #47

Closed cyril-bouthors closed 8 years ago

cyril-bouthors commented 8 years ago

rmate does not support the +N syntax which is supposed to place caret on line number after loading file, just like --line:

$ ./rmate +3 /etc/fstab
There is more than one file specified. Opening only +3 and ignoring other.

Others editors like vi, emacs, mg support this, even nano:

emacs +3 /etc/fstab
vi +3 /etc/fstab
nano +3 /etc/fstab
mg +3 /etc/fstab

I prevents some program like 'debchange' to work:

$ export EDITOR='rmate -w'
$ debchange -i
There is more than one file specified. Opening only +3 and ignoring other.

and SublimeText opens the file called "+3"

Would it be possible to support +N as an alias to --line=N?

Thank you

PS: sorry about my initial bug report, I apparently triggered a shortcut to open the ticket before it was done

aurora commented 8 years ago

I think this should be easy to implement. I'll have a look at it, thanks for your suggestion.

aurora commented 8 years ago

Could you have a look at my latest commit? I think it should work now what you would like to do.

cyril-bouthors commented 8 years ago

@aurora,

The latest commit seems to be working but the caret stays on line 1.

Same issue with

rmate --line 3 /tmp/x

screen shot 2016-03-15 at 18 50 36
aurora commented 8 years ago

mmm ... i have to admit that i only tested with textmate ... i'll have a look at sublime later today.

aurora commented 8 years ago

It does not seem to be possible with sublime text. at least: the subl command of sublime text itself does not offer a --line option, either ... ? As i am TextMate user i have no knowledge regarding the possibilities of Sublime Text from command-line, but i'll happily add support, if someone can point me to a reference of this tool. There's a --command option for example ... can this feature be achieved using this option?

cyril-bouthors commented 8 years ago

The syntax is FILE:LINE_NUMBER, example:

subl /etc/hosts:2
aurora commented 8 years ago

Apparently i misunderstood how things work with sublime text. Sublime text is using the rsub package to achieve the remote editing functionality. So in my opinion a fix for the problem would belong to this package. As i am not the author of rsub, there's not much that i can do. But i'll have a look at it and maybe i can provide a patch for it ...

cyril-bouthors commented 8 years ago

Thanks On Thu, Mar 17, 2016 at 2:07 PM Harald Lapp notifications@github.com wrote:

Apparently i misunderstood how things work with sublime text. Sublime text is using the rsub package to achieve the remote editing functionality. So in my opinion a fix for the problem would belong to this package. As i am not the author of rsub, there's not much that i can do. But i'll have a look at it and maybe i can provide a patch for it ...

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/aurora/rmate/issues/47#issuecomment-197800924

Cyril Bouthors - go-managed.com http://www.go-managed.com/ +33-1-84-16-16-17 https://www.linkedin.com/in/cyrilbouthors

aurora commented 8 years ago

@cyril-bouthors i think i have a working patch for this, as i don't know how fast the original author of rsub is, you can fetch the change from my rsub fork at https://github.com/aurora/rsub in the meantime.

cyril-bouthors commented 8 years ago

Great!

On Thu, Mar 17, 2016 at 5:38 PM Harald Lapp notifications@github.com wrote:

@cyril-bouthors https://github.com/cyril-bouthors i think i have a working patch for this, as i don't know how fast the original author of rsub is, you can fetch the change from my rsub fork at https://github.com/aurora/rsub in the meantime.

— You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub https://github.com/aurora/rmate/issues/47#issuecomment-197882634

Cyril Bouthors - go-managed.com http://www.go-managed.com/ +33-1-84-16-16-17 https://www.linkedin.com/in/cyrilbouthors