Skip to content

Commit

Permalink
feat: allow disabling of footer. Fixes #171
Browse files Browse the repository at this point in the history
  • Loading branch information
cbochs committed Sep 29, 2024
1 parent 7aedc26 commit 5caf3c8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ While Grapple shares similarities to Harpoon (and other file navigation plugins)

## Requirements

- [Neovim >= 0.9](https://github.com/neovim/neovim/releases/tag/v0.9.0)
- [Neovim >= 0.10](https://github.com/neovim/neovim/releases/tag/v0.10.0)
- [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons) (optional)

## Quickstart
Expand Down Expand Up @@ -282,13 +282,13 @@ require("grapple").setup({
border = "single",
focusable = false,
style = "minimal",
title_pos = "center",

-- Custom: fallback title for Grapple windows
title = "Grapple",
title = "Grapple", -- fallback title for Grapple windows
title_pos = "center",
title_padding = " ", -- custom: adds padding around window title

-- Custom: adds padding around window title
title_padding = " ",
-- footer = "", -- disable footer
footer_pos = "center",
},
})
```
Expand Down Expand Up @@ -457,8 +457,8 @@ Where:

- **`direction`**: `"next"` | `"prev"`
- **`opts?`**: `table`
- **`scope?`**: `string` scope name (default: `settings.scope`)
- **`all?`**: `boolean` (default: `false`)
- **`scope?`**: `string` scope name (default: `settings.scope`)
- **`all?`**: `boolean` (default: `false`)

<details>
<summary><b>Examples</b></summary>
Expand Down
8 changes: 5 additions & 3 deletions lua/grapple/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,13 @@ local DEFAULT_SETTINGS = {
border = "single",
focusable = false,
style = "minimal",

title = "Grapple", -- fallback title for Grapple windows
title_pos = "center",
title = "Grapple",
title_padding = " ", -- custom: adds padding around window title

-- Custom: adds padding around window title
title_padding = " ",
-- footer = "", -- disable footer
footer_pos = "center",
},

---Values for which a buffer should be excluded from being tagged
Expand Down
13 changes: 6 additions & 7 deletions lua/grapple/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,19 @@ function Window:window_options()
end

if not opts.title then
opts.title_pos = nil
opts.title = ""
end

if not opts.footer then
opts.footer = "Press '?' to toggle Help"
end

-- Remove custom fields
if opts.title_padding then
---@diagnostic disable-next-line: inject-field
opts.title_padding = nil
end

-- Add "help" footer for nvim-0.10
if vim.fn.has("nvim-0.10") == 1 then
opts.footer = "Press '?' to toggle Help"
opts.footer_pos = "center"
end

-- Window size
if opts.width and opts.width < 1 then
opts.width = math.max(1, math.floor(vim.o.columns * opts.width))
Expand Down

0 comments on commit 5caf3c8

Please sign in to comment.