NeogitOrg / NeogitOrg/neogit

feat: add option to split popup window relative to the bottom of the editor

Open
#778 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
5.6k
Forks
357
Avg merge
15h 47m
Merged PRs (30d)
2

Description

Figured I'd open an issue before just making a PR.

The config.kind setting provides a few options: tab, replace, vsplit, and notably split which will open relative the the active window; there is the extra option to split_above which opens using the top modifier for the split command, making it open relative to the top of the editor window.
But what about something like split_below which splits to the bottom of the editor?

A simple hack I have use is to set an autocmd with wincmd J on popup windows, as I have done this for similar buffers using fugitive, but for neogit? I believe this simple addition could not be out of place.

Looking at the code, this could be added by duplicating the following lines and changing the label to split_below and the vim command to bot split.

https://github.com/NeogitOrg/neogit/blob/00b4486197e7ad7cf98e128a3c663d79a2cc962f/lua/neogit/lib/buffer.lua#L220-L223

- elseif kind == "split_above" then 
+ elseif kind == "split_below" then 
-   vim.cmd("top split") 
+   vim.cmd("bot split") 
   api.nvim_set_current_buf(self.handle) 
   win = api.nvim_get_current_win() 

For those that make heavy use of quickfix or bottom splits for terminal buffers, this can cause some annoying window behaviour but this can still be a nice option for those that choose to make use of it! For me, id use it for NeogitPopup windows since the content can get cut off if you already have 3 or 4+ splits for the current tabpage.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lua/neogit/lib/buffer.lua around the existing split_above handling at lines 220-223, and compare the available config.kind values. Add the requested split_below option using the described bottom-oriented split behavior. Done means popup windows can select split_below and open relative to the bottom of the editor without changing the existing options.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.