Skip to content

lostl1ght/lazygit.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lazygit.nvim

A lazygit integration into Neovim.

Table of contents

Requirements

Installation

With lazy.nvim:

return {
  'lostl1ght/lazygit.nvim',
  lazy = true,
  cmd = 'Lazygit',
  keys = { { '<leader>g', '<cmd>Lazygit<cr>', desc = 'Lazygit' } },
}

Usage

---@param path string?
---@param use_last boolean?
require('lazygit').open(path?, use_last?)
:Lazygit[!] {path}    Open lazygit on {path}. Bang toggles "use_last".

Preventing nesting

With flatten.nvim:

require('flatten').setup({
  window = { open = 'smart' },
  callbacks = {
    pre_open = vim.schedule_wrap(function() require('lazygit').hide() end),
    block_end = vim.schedule_wrap(function() require('lazygit').show() end),
  },
})

With nvim-unception:

vim.env['GIT_EDITOR'] = [[nvim --cmd 'let g:unception_block_while_host_edits=1']]
vim.api.nvim_create_autocmd('User', {
  pattern = 'UnceptionEditRequestReceived',
  callback = function() require('lazygit').hide() end,
})

Plugin Configuration

Configure the plugin by calling require('lazygit').setup().

Default setup values:

{
  winscale = 0.85,
  mappings = {
    t = {
      ['q'] = 'hide', -- matches 'quit' lazygit mapping
    },
    n = {
      ['q'] = 'hide', -- matches 'quit' lazygit mapping
    },
  },
}

Set mapping's action to false to disable.

Adding a custom mapping

An action can be a function. This function accepts 1 argument which is a buffer number.

function(bufnr)
  print('Lazygit bufnr is' .. bufnr)
end

Lazygit Configuration

os:
  editPreset: 'nvim-remote'
promptToReturnFromSubprocess: false

Default Mappings

Mappings Action Configuration option
<c-q> Hide Lazygit window hide

About

A lazygit integration into Neovim.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages