2

The acme "editor" has this awesome feature where you can click on some output like

foobar.foo:212

and acme opens that file at that line number.

I'd love to add support for something like that into tmux (I don't think anything like it exists already)

The way I see it working is that you enter copy-mode, place your cursor over a line and then run a command which opens that file on that line in an editor of your choice. My question is - I don't see anyway I could implement a feature like that without forking tmux. Does anyone have any suggestions?

0

I don't use acme but I use Emacs. In Emacs one can pass a filename to open +<LINE_NUM> <FILENAME>, for example: +13 ~/HINTS. I added the following to my ~/.tmux.conf:

bind C-e run "tmux save-buffer - | xargs emacs"

Now I can just write +1 ~/HINTS in terminal, enter copy mode and copy this string and press C-b C-e to open line 1 in file ~/HINTS with Emacs.

0

You can't use send-keys directly in copy-mode, but you can do something like this:

bind-key O send-keys space e enter \; new-window open-at-line \: paste-buffer \; send-keys enter

Then, in copy-mode, put the cursor on the first letter of filename:line and hit <prefix> O.

This will copy the filename and line number (send-keys space e enter), open a new window with the open-at-line command, which is a shell script:

#!/usr/bin/env zsh
read combo
eval `vim ${combo:s/:/ -c :/}`

That gets the combined filename:line from paste-buffer and passes that to vim.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.