Update documentation

This commit is contained in:
Stefan Haller 2023-03-28 17:55:00 +02:00
parent e4e16fa38e
commit e3c5e07b20

View file

@ -96,9 +96,12 @@ git:
parseEmoji: false parseEmoji: false
diffContextSize: 3 # how many lines of context are shown around a change in diffs diffContextSize: 3 # how many lines of context are shown around a change in diffs
os: os:
editCommand: '' # see 'Configuring File Editing' section editPreset: '' # see 'Configuring File Editing' section
editCommandTemplate: '' edit: ''
openCommand: '' editAtLine: ''
editAtLineAndWait: ''
open: ''
openLink: ''
refresher: refresher:
refreshInterval: 10 # File/submodule refresh interval in seconds. Auto-refresh can be disabled via option 'git.autoRefresh'. refreshInterval: 10 # File/submodule refresh interval in seconds. Auto-refresh can be disabled via option 'git.autoRefresh'.
fetchInterval: 60 # Re-fetch interval in seconds. Auto-fetch can be disabled via option 'git.autoFetch'. fetchInterval: 60 # Re-fetch interval in seconds. Auto-fetch can be disabled via option 'git.autoFetch'.
@ -268,40 +271,41 @@ os:
### Configuring File Editing ### Configuring File Editing
Lazygit will edit a file with the first set editor in the following: There are two commands for opening files, `o` for "open" and `e` for "edit". `o`
acts as if the file was double-clicked in the Finder/Explorer, so it also works
for non-text files, whereas `e` opens the file in an editor. `e` can also jump
to the right line in the file if you invoke it from the staging panel, for
example.
1. config.yaml To tell lazygit which editor to use for the `e` command, the easiest way to do
that is to provide an editPreset config, e.g.
```yaml ```yaml
os: os:
editCommand: 'vim' # as an example editPreset: 'vscode'
``` ```
2. \$(git config core.editor) Supported presets are `vim`, `emacs`, `nano`, `vscode`, `sublime`, `bbedit`, and
3. \$GIT_EDITOR `xcode`. In many cases lazygit will be able to guess the right preset from your
4. \$VISUAL $(git config core.editor), or an environment variable such as $VISUAL or $EDITOR.
5. \$EDITOR
6. \$(which vi)
Lazygit will log an error if none of these options are set. If for some reason you are not happy with the default commands from a preset, or
there simply is no preset for your editor, you can customize the commands by
You can specify the current line number when you're in the patch explorer. setting the `edit`, `editAtLine`, and `editAtLineAndWait` options, e.g.:
```yaml ```yaml
os: os:
editCommand: 'vim' edit: 'myeditor {{filename}}'
editCommandTemplate: '{{editor}} +{{line}} -- {{filename}}' editAtLine: 'myeditor --line={{line}} {{filename}}'
editAtLineAndWait: 'myeditor --block --line={{line}} {{filename}}'
editInTerminal: true
``` ```
or The `editInTerminal` option is used to decide whether lazygit needs to suspend
itself to the background before calling the editor.
```yaml Contributions of new editor presets are welcome; see the `getPreset` function in
os: [`editor_presets.go`](https://github.com/jesseduffield/lazygit/blob/master/pkg/config/editor_presets.go).
editCommand: 'code'
editCommandTemplate: '{{editor}} --goto -- {{filename}}:{{line}}'
```
`{{editor}}` in `editCommandTemplate` is replaced with the value of `editCommand`.
### Overriding default config file location ### Overriding default config file location
@ -317,15 +321,6 @@ or
LG_CONFIG_FILE="$HOME/.base_lg_conf,$HOME/.light_theme_lg_conf" lazygit LG_CONFIG_FILE="$HOME/.base_lg_conf,$HOME/.light_theme_lg_conf" lazygit
``` ```
### Recommended Config Values
for users of VSCode
```yaml
os:
openCommand: 'code -rg {{filename}}'
```
## Color Attributes ## Color Attributes
For color attributes you can choose an array of attributes (with max one color attribute) For color attributes you can choose an array of attributes (with max one color attribute)