Skip to content

Conversation

@maarutan
Copy link

@maarutan maarutan commented Jan 16, 2025

Enhance GitGraph: Keybindings, Layout Options, and Configuration Updates

Proposed Changes in My Fork

1. Added Keybindings for Toggling and Closing GitGraph:

  • :GitGraph - Toggle GitGraph.
  • :GitGraphClose - Close the GitGraph buffer.

2. Introduced Multiple Layout Options for Opening GitGraph:

  • Added support for floating, vertical, and horizontal layouts.

3. Updated Configuration:

  • Enhanced configurability for GitGraph with options for layout, keybindings, and symbols.

4. README Update:

  • I propose updating the README to include concise and clear information about configuration options. Here’s an example of how users can configure the plugin:

Example Configuration

require("gitgraph").setup({

	layout = "floating", -- Options: "floating", "vertical", "horizontal"
	floating_width = 80, -- Width for floating window (percentage of the screen)
	floating_height = 80, -- Height for floating window (percentage of the screen)
	border = "single", -- Options: "single", "double", "rounded", "solid", "shadow"
	toggle_keymap = "<leader>gi", -- Default keymap for toggling GitGraph
	key_close = "q", -- Keymap to close GitGraph buffer

	symbols = {
		merge_commit = "",
		commit = "",
		merge_commit_end = "",
		commit_end = "",

		-- Advanced symbols
		GVER = "",
		GHOR = "",
		GCLD = "",
		GCRD = "",
		GCLU = "",
		GCRU = "",
		GLRU = "",
		GLRD = "",
		GLUD = "",
		GRUD = "",
		GFORKU = "",
		GFORKD = "",
		GRUDCD = "",
		GRUDCU = "",
		GLUDCD = "",
		GLUDCU = "",
		GLRDCL = "",
		GLRDCR = "",
		GLRUCL = "",
		GLRUCR = "",
	},

	hooks = {
		on_select_commit = function(commit)
			log.info("Selected commit:", commit.hash)
		end,
		on_select_range_commit = function(from, to)
			log.info("Selected range:", from.hash, to.hash)
		end,
	},
	format = {
		timestamp = "%H:%M:%S %d-%m-%Y",
		fields = { "hash", "timestamp", "author", "branch_name", "tag" },
	},
	log_level = vim.log.levels.ERROR,
})

I believe these improvements make the plugin more user-friendly and configurable. Please review the changes and consider accepting my pull request. I’m looking forward to contributing further enhancements! 😊

@luisdavim
Copy link

This seems great 👍

@isakbm
Copy link
Owner

isakbm commented Jun 2, 2025

Sry been a while since I checked PR's, I see now that this needs to be rebased on upstream @maarutan

Based on the feedback I promise to try to get it in if you rebase 🤞

@DanWlker
Copy link

DanWlker commented Oct 31, 2025

Any progress on this?

@maarutan
Copy link
Author

maarutan commented Nov 4, 2025

Sorry for the late reply.
I'll take care of it in the next few days.
❤️❤️❤️

@maarutan
Copy link
Author

maarutan commented Nov 7, 2025

      window = {
        layout = "float", -- float || split || vsplit || full
        -- if layout is float
        width = 0.8, -- screen share or number of columns
        height = 0.8, -- screen share or number of lines

        close = "q", -- if current buffer is gitgraph, close it
        border = "rounded", -- single || double || rounded || none
      },

Here it is, the very option I slightly modified.
Also, two user commands are not changeable:
GitGraph - toggle
GitGraphClose - close

also changed readme added configuration
Good productivity to you ⚡

from your maaru.tan ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants