From 3a807afedd53033c5e26c05014fd26f9e0e36de5 Mon Sep 17 00:00:00 2001 From: Laurynas Lazauskas <8823448+lawrence-laz@users.noreply.github.com> Date: Wed, 9 Nov 2022 00:08:18 +0200 Subject: [PATCH] Update README.md with nvim --listen and --server The provided instructions help to set up an environment where pressing the key `e` on a file in `lazygit` will edit the file in the same nvim instance. --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 405d05e..515eecf 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,24 @@ If you have `neovim-remote` and don't want `lazygit.nvim` to use it, you can dis let g:lazygit_use_neovim_remote = 0 ``` +**Using nvim --listen and nvim --server to edit files in same process** + +You can use vanilla nvim server to edit files in the same nvim instance when you use `e` inside `lazygit`. + +1. You have to start nvim with the `--listen` parameter. An easy way to ensure this is to use an alias: +```bash +# ~/.bashrc +alias vim='nvim --listen /tmp/nvim-server.pipe' +``` + +2. You have to modify lazygit to attempt connecting to existing nvim instance on edit: +```yml +# ~/.config/jesseduffield/lazygit/config.yml +os: + editCommand: 'nvim' + editCommandTemplate: '{{editor}} --server /tmp/nvim-server.pipe --remote-tab "$(pwd)/{{filename}}"' +``` + ### Telescope Plugin The Telescope plugin is used to track all git repository visited in one nvim session.