Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cursor layout #878

Merged
merged 18 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
…nto feat/add-cursor-layout
  • Loading branch information
Luxed committed May 31, 2021
commit befdb7de21b491172c91fae1583abb98185a2b99
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ We have some built in themes but are looking for more cool options.
|--------------------------|-----------------------------------------------------------------------|
| `themes.get_dropdown` | A list like centered list. [dropdown](https://i.imgur.com/SorAcXv.png)|
| `themes.get_cursor` | A cursor relative list. |
| ... | Your next awesome theme here :D |
| `themes.get_ivy` | Bottom panel overlay. [Ivy #771](https://github.com/nvim-telescope/telescope.nvim/pull/771)|


To use a theme, simply append it to a built-in function:
Expand Down
28 changes: 15 additions & 13 deletions lua/telescope/pickers/layout_strategies.lua
Original file line number Diff line number Diff line change
Expand Up @@ -324,19 +324,21 @@ layout_strategies.cursor = function(self, columns, lines)
}
end

--[[
+-----------------+
| Previewer |
| Previewer |
| Previewer |
+-----------------+
| Result |
| Result |
| Result |
+-----------------+
| Prompt |
+-----------------+
--]]
--- Vertical perviewer stacks the items on top of each other.
---
--- <pre>
--- +-----------------+
--- | Previewer |
--- | Previewer |
--- | Previewer |
--- +-----------------+
--- | Result |
--- | Result |
--- | Result |
--- +-----------------+
--- | Prompt |
--- +-----------------+
--- </pre>
layout_strategies.vertical = function(self, max_columns, max_lines)
local layout_config = validate_layout_config(self.layout_config or {}, {
width_padding = "How many cells to pad the width",
Expand Down
35 changes: 35 additions & 0 deletions lua/telescope/themes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,39 @@ function themes.get_cursor(opts)
return vim.tbl_deep_extend('force', theme_opts, opts)
end

--- Ivy style theme.
--- <pre>
---
--- Usage:
---
--- `local builtin = require('telescope.builtin')`
--- `local themes = require('telescope.themes')`
--- `builtin.find_files(themes.get_ivy())`
--- </pre>
function themes.get_ivy(opts)
opts = opts or {}

return vim.tbl_deep_extend("force", {
theme = "ivy",

sorting_strategy = "ascending",

preview_title = "",

layout_strategy = "bottom_pane",
layout_config = {
height = 25,
},

border = true,
borderchars = {
"z",
prompt = { "─", " ", " ", " ", "─", "─", " ", " " },
results = { " " },
-- results = { "a", "b", "c", "d", "e", "f", "g", "h" },
preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰"},
},
}, opts)
end

return themes
You are viewing a condensed version of this merge commit. You can view the full changes here.