mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 12:55:47 +02:00
Add nvim-remote editor preset
This allows us to jump back to the parent neovim process when we want to edit a file, rather than opening a new neovim process within lazygit. Arguably this should be the default, but I'm not familiar with the various ways people use lazygit with neovim.
This commit is contained in:
parent
9e7018db8a
commit
aa74239f05
2 changed files with 15 additions and 4 deletions
|
@ -324,10 +324,13 @@ os:
|
||||||
editPreset: 'vscode'
|
editPreset: 'vscode'
|
||||||
```
|
```
|
||||||
|
|
||||||
Supported presets are `vim`, `nvim`, `emacs`, `nano`, `vscode`, `sublime`, `bbedit`,
|
Supported presets are `vim`, `nvim`, `nvim-remote`, `emacs`, `nano`, `vscode`, `sublime`, `bbedit`,
|
||||||
`kakoune`, `helix`, and `xcode`. In many cases lazygit will be able to guess the right preset
|
`kakoune`, `helix`, and `xcode`. In many cases lazygit will be able to guess the right preset
|
||||||
from your $(git config core.editor), or an environment variable such as $VISUAL or $EDITOR.
|
from your $(git config core.editor), or an environment variable such as $VISUAL or $EDITOR.
|
||||||
|
|
||||||
|
`nvim-remote` is an experimental preset for when you have invoked lazygit from within a neovim
|
||||||
|
process, allowing lazygit to open the file from within the parent process rather than spawning a new one.
|
||||||
|
|
||||||
If for some reason you are not happy with the default commands from a preset, or
|
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
|
there simply is no preset for your editor, you can customize the commands by
|
||||||
setting the `edit`, `editAtLine`, and `editAtLineAndWait` options, e.g.:
|
setting the `edit`, `editAtLine`, and `editAtLineAndWait` options, e.g.:
|
||||||
|
|
|
@ -51,6 +51,14 @@ func getPreset(osConfig *OSConfig, guessDefaultEditor func() string) *editPreset
|
||||||
"vi": standardTerminalEditorPreset("vi"),
|
"vi": standardTerminalEditorPreset("vi"),
|
||||||
"vim": standardTerminalEditorPreset("vim"),
|
"vim": standardTerminalEditorPreset("vim"),
|
||||||
"nvim": standardTerminalEditorPreset("nvim"),
|
"nvim": standardTerminalEditorPreset("nvim"),
|
||||||
|
"nvim-remote": {
|
||||||
|
editTemplate: `nvim --server "$NVIM" --remote-tab {{filename}}`,
|
||||||
|
editAtLineTemplate: `nvim --server "$NVIM" --remote-tab {{filename}}; [ -z "$NVIM" ] || nvim --server "$NVIM" --remote-send ":{{line}}<CR>"`,
|
||||||
|
// No remote-wait support yet. See https://github.com/neovim/neovim/pull/17856
|
||||||
|
editAtLineAndWaitTemplate: `nvim +{{line}} {{filename}}`,
|
||||||
|
openDirInEditorTemplate: `nvim --server "$NVIM" --remote-tab {{dir}}`,
|
||||||
|
editInTerminal: false,
|
||||||
|
},
|
||||||
"emacs": standardTerminalEditorPreset("emacs"),
|
"emacs": standardTerminalEditorPreset("emacs"),
|
||||||
"nano": standardTerminalEditorPreset("nano"),
|
"nano": standardTerminalEditorPreset("nano"),
|
||||||
"kakoune": standardTerminalEditorPreset("kak"),
|
"kakoune": standardTerminalEditorPreset("kak"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue