Skip to content

Commit

Permalink
break!: searchFileHistory setting restructured, see README
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Nov 7, 2023
1 parent a27fd70 commit 022ab2c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,15 @@ local defaultConfig = {
mergedPR = "🟪",
closedPR = "🟥",
},
searchFileHistory = {
diffPopupWidth = 0.8, -- float, 0 to 1
diffPopupHeight = 0.8, -- float, 0 to 1
diffPopupBorder = "single",
historySearch = {
diffPopup = {
width = 0.8, -- float, 0 to 1
height = 0.8,
border = "single",
},
-- if trying to call `git log` on a shallow repository, automatically
-- unshallow the repo by running `git fetch --unshallow`
autoUnshallowIfNeeded = false,
},
}
```
Expand Down
26 changes: 15 additions & 11 deletions lua/tinygit/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ local M = {}
---@field spellcheck boolean
---@field openReferencedIssue boolean

---@class searchFileHistoryConfig
---@field diffPopupWidth number
---@field diffPopupHeight number
---@field diffPopupBorder "single"|"double"|"rounded"|"solid"|"none"|"shadow"|string[]
---@class historySearchConfig
---@field diffPopup { width: number, height: number, border: "single"|"double"|"rounded"|"solid"|"none"|"shadow"|string[]}
---@field autoUnshallowIfNeeded boolean

---@class pushConfig
---@class pushConfig
---@field preventPushingFixupOrSquashCommits boolean
---@field confirmationSound boolean

Expand Down Expand Up @@ -55,7 +54,7 @@ local defaultConfig = {

-- enable vim's builtin spellcheck for the commit message input field.
-- (configured to ignore capitalization and correctly consider camelCase)
spellcheck = false,
spellcheck = false,

-- if commit message references issue/PR, open it in the browser
openReferencedIssue = false,
Expand All @@ -71,11 +70,16 @@ local defaultConfig = {
mergedPR = "🟪",
closedPR = "🟥",
},
searchFileHistory = {
diffPopupWidth = 0.8,
diffPopupHeight = 0.8,
diffPopupBorder = "single",
}
historySearch = {
diffPopup = {
width = 0.8, -- float, 0 to 1
height = 0.8,
border = "single",
},
-- if trying to call `git log` on a shallow repository, automatically
-- unshallow the repo by running `git fetch --unshallow`
autoUnshallowIfNeeded = false,
},
}

--------------------------------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions lua/tinygit/pickaxe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local M = {}
local fn = vim.fn
local u = require("tinygit.utils")
local a = vim.api
local config = require("tinygit.config").config.searchFileHistory
local config = require("tinygit.config").config.historySearch
--------------------------------------------------------------------------------

---@class currentRun saves metadata for the current pickaxe operation
Expand Down Expand Up @@ -62,8 +62,8 @@ local function showDiff(commitIdx, type)
a.nvim_buf_set_option(bufnr, "modifiable", false)

-- open new win for the buff
local width = math.min(config.diffPopupWidth, 0.99)
local height = math.min(config.diffPopupHeight, 0.99)
local width = math.min(config.diffPopup.width, 0.99)
local height = math.min(config.diffPopup.height, 0.99)

local winnr = a.nvim_open_win(bufnr, true, {
relative = "win",
Expand All @@ -74,7 +74,7 @@ local function showDiff(commitIdx, type)
col = math.floor((1 - width) * a.nvim_win_get_width(0) / 2),
title = (" %s (%s) "):format(shortMsg, date),
title_pos = "center",
border = config.diffPopupBorder,
border = config.diffPopup.border,
style = "minimal",
zindex = 1, -- below nvim-notify floats
})
Expand Down Expand Up @@ -235,7 +235,7 @@ function M.functionHistory()
if u.notInGitRepo() then return end

-- TODO figure out how to query treesitter for function names, and use
-- treesitter instead
-- treesitter instead?
currentRun.filename = fn.expand("%")
local lspWithSymbolSupport = false
local clients = vim.lsp.get_active_clients { bufnr = 0 }
Expand Down

0 comments on commit 022ab2c

Please sign in to comment.