jesseduffield / jesseduffield/lazygit

select file at startup for staging/etc

Open
#3,788 6 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Is your feature request related to a problem? Please describe.**
my primary use of lazygit is for line-by-line staging of single files. selecting a file to start staging on the command line would be useful, instead of scrolling through the `Files` panel.

also, in addition to invoking lazygit in a terminal, i currently sometimes use a shortcut in vim to switch to lazygit, stage some lines, and commit them. it would be nice if the file i am currently editing was selected in lazygit.

**Describe the solution you'd like**
1) run: `lazygit --select-file src/file.cpp`
2) see lazygit start as normal
3) among files in the `Files` tab of panel[2], if that file's path (relative to the root of the repo) matches `src/file.cpp`, select that modified or unstaged file, as if selecting that row in `Files` with the kb or mouse (expanding dirs in the filetree as necessary)

**Describe alternatives you've considered**
- scripting keys at startup to do something like `xdotool key '/'`, `xdotool type $FILENAME`, `xdotool key Return` (this is awful, non-portable, and possibly subject to race conditions)
- creating a temporary custom cmd with yaml before startup that selects a file with a specific name (still have to press a button at startup)
- creating a permanent custom cmd that selects a file based on an environment variable $VIM_FILE and setting that (still have to press a button at startup)

**Additional context**
none

EDIT: edited to make it clear that this feature request is not related to vim, though it would play nicely with ANY programmer-friendly text editor.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.