lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Variable {{line}} cannot be used

Open chenxuan520 opened this issue 11 months ago • 4 comments

Describe the bug {{line}} won't be parsed into line numbers as before after I update lazygit version(0.40.2)

To Reproduce

  1. Config,$LAZYGIT_FILE is an environment variable.
os:
    openCommand: 'if [ $LAZYGIT_FILE ];then echo "{{filename}} {{line}}" > $LAZYGIT_FILE;fi'
  1. Open lazygit and Press the o key.
  2. It shows this in the lower right corner 图片

Expected behavior

  • I used the previous version(0.35), and it looked like this. 图片

Version info: commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:05:48Z, build source=binaryRelease, version=0.40.2, os=linux, arch=amd64, git version=2.34.1

chenxuan520 avatar Feb 28 '24 13:02 chenxuan520

Duplicate of #2589.

The conclusion in that issue is that removing {{line}} support from the o command was by design, and we won't change that for now.

However, we will offer a {{line}} variable for custom commands, so that you can bind your command to a custom command instead of to the open command. This hasn't happened yet, though...

stefanhaller avatar Feb 28 '24 13:02 stefanhaller

But my e key has other editors to use and used habits, this is completely used to facilitate the opening of the outer vim editing files, whether there is a configuration so that the o key and e key functions can be completely exchanged?

chenxuan520 avatar Feb 28 '24 14:02 chenxuan520

As I said, once we offer {{line}} to custom commands, you will be able to configure a custom command that does the same thing as o did in your pre-0.38 configuration, and bind that command to o. Your use of e is unaffected by this.

stefanhaller avatar Feb 28 '24 14:02 stefanhaller