Skip to content

Commit

Permalink
Merge branch 'main' into fix/172/keymaps_for_window
Browse files Browse the repository at this point in the history
  • Loading branch information
Tronikelis committed Sep 29, 2024
2 parents 7780666 + b41ddfc commit 4b0c112
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 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",
},

--Override default floating window mappings
Expand Down Expand Up @@ -472,8 +472,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
14 changes: 7 additions & 7 deletions doc/grapple.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*grapple.txt* For NVIM v0.9.0 Last change: 2024 May 18
*grapple.txt* For NVIM v0.9.0 Last change: 2024 September 29

==============================================================================
Table of Contents *grapple-table-of-contents*
Expand Down Expand Up @@ -52,7 +52,7 @@ FEATURES *grapple-grapple.nvim-features*

REQUIREMENTS *grapple-grapple.nvim-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)


Expand Down Expand Up @@ -286,13 +286,13 @@ Default Settings ~
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
8 changes: 5 additions & 3 deletions lua/grapple/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,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",
},

--Override default floating window mappings
Expand Down
13 changes: 6 additions & 7 deletions lua/grapple/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,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 = string.format("Press '%s' to toggle Help", app.settings.win_mappings.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 = string.format("Press '%s' to toggle Help", app.settings.win_mappings.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 4b0c112

Please sign in to comment.