Skip to content

przepompownia/git-utils.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

git-utils.nvim

Utils moved from https://github.com/przepompownia/nvim-arctgx

Commit

require('git-utils.commit')()
require('git-utils.commit')({gitDir = vim.uv.cwd()})
require('git-utils.commit')({gitDir = vim.uv.cwd(), confirmKey = '<A-CR>'}) -- default values

Use confirmKey to override the mapping inside message buffer.

Probably require('git-utils.commit')() won't work on Windows because the commit message template is obtained in some hacky way i.e. using cat as GIT_EDITOR.

Telescope extensions

Enable Telescope extensions manually:

require('telescope').load_extension('git_utils')

or enable registerTelescopeExtension option in setup.

Grep git diff

require'telescope'.extensions.git_utils.grep_git_diff({args = {'master'}})
require'telescope'.extensions.git_utils.grep_git_diff({args = {'master...HEAD'}})
:Telescope git_utils grep_git_diff args=master...HEAD

or (if called require('git-utils.createCommands')())

:GDiff master...HEAD

(try <TAB> to complete branches or tags).

Push

require 'git-utils.git'.push(require('git-utils').currentBufferDirectory(), 'origin')
require 'git-utils.git'.pushToAllRemoteRepos(require('git-utils').currentBufferDirectory())

Branches

require('git-utils').branches()
require('git-utils').branches({cwd = require('git-utils').currentBufferDirectory()})
:Telescope git_utils branches

There is a lualine component git-utils-branch. It extends its builtin branch component. Currently it only adds mouse right click action that runs the above method.

Setup

require('git-utils').setup(opts)

where default opts are:

--- @class git-utils.defaultOpts
local defaultOpts = {
  registerTelescopeExtension = false,
  telescopeAttachMappings = nil, --- @type fun(promptBuffer: string, map: fun()): boolean?
  currentBufferDirectory = require('git-utils').currentBufferDirectory, -- function used to return the directory of the current buffer to determine git dir
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages