Skip to content

Commit

Permalink
thanks clason :)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conni2461 committed Jul 9, 2021
1 parent 2a44bbe commit 7d15d0f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 31 deletions.
26 changes: 12 additions & 14 deletions doc/telescope.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ telescope.setup({opts}) *telescope.setup()*

*telescope.defaults.history*
history: ~
This field handles the configuration for prompt history. It can either
be a table or false.
If its false then history is disabled.
This field handles the configuration for prompt history.
By default it is a table, with default values (more below).
To disable history, set it to either false or nil.

Currently mappings still need to be added, Example:
mappings = {
Expand All @@ -62,23 +62,21 @@ telescope.setup({opts}) *telescope.setup()*
},

Fields:
- path: the path to the telescope history as string
- path: The path to the telescope history as string.
default: stdpath("data")/telescope_history
- limit: the amount of entries that will be written in the history
if limit is set to nil it will grown unbound
- limit: The amount of entries that will be written in the
history.
Warning: If limit is set to nil it will grown unbound.
default: 100
- handler: is a developer setting that is meant for extensions.
You can replace the actual implementation of the history
and provide your own. One example of this is
nvim-telescope/telescope-smart-history.nvim which allows
context sensitive (cwd + picker) history.
- handler: A lua function that implements the history.
This is meant as a developer setting for extensions to
override the history handling, e.g.,
https://github.com/nvim-telescope/telescope-smart-history.nvim,
which allows context sensitive (cwd + picker) history.

Default:
require('telescope.actions.history').get_simple_history

Is a simple history implementation that is not context
sensitive, it writes all history in one text file.


*telescope.defaults.layout_config*
layout_config: ~
Expand Down
2 changes: 1 addition & 1 deletion lua/telescope/actions/history.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ histories.History.__index = histories.History
---@field pre_get function: Will be called before a next or previous item will be returned (optional)
function histories.History:new(opts)
local obj = {}
if conf.history == false or type(conf.history) ~= "table" then
if not conf.history or type(conf.history) ~= "table" then
obj.enabled = false
return setmetatable(obj, self)
end
Expand Down
2 changes: 1 addition & 1 deletion lua/telescope/actions/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ end
function action_state.get_current_history()
local history = global_state.get_global_key("history")
if not history then
if conf.history == false or type(conf.history) ~= "table" then
if not conf.history or type(conf.history) ~= "table" then
history = require('telescope.actions.history').get_simple_history()
global_state.set_global_key("history", history)
else
Expand Down
28 changes: 13 additions & 15 deletions lua/telescope/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ local telescope_defaults = {
limit = 100,
handler = function(...) return require('telescope.actions.history').get_simple_history(...) end,
}, [[
This field handles the configuration for prompt history. It can either
be a table or false.
If its false then history is disabled.
This field handles the configuration for prompt history.
By default it is a table, with default values (more below).
To disable history, set it to either false or nil.
Currently mappings still need to be added, Example:
mappings = {
Expand All @@ -233,22 +233,20 @@ local telescope_defaults = {
},
Fields:
- path: the path to the telescope history as string
- path: The path to the telescope history as string.
default: stdpath("data")/telescope_history
- limit: the amount of entries that will be written in the history
if limit is set to nil it will grown unbound
- limit: The amount of entries that will be written in the
history.
Warning: If limit is set to nil it will grown unbound.
default: 100
- handler: is a developer setting that is meant for extensions.
You can replace the actual implementation of the history
and provide your own. One example of this is
nvim-telescope/telescope-smart-history.nvim which allows
context sensitive (cwd + picker) history.
- handler: A lua function that implements the history.
This is meant as a developer setting for extensions to
override the history handling, e.g.,
https://github.com/nvim-telescope/telescope-smart-history.nvim,
which allows context sensitive (cwd + picker) history.
Default:
require('telescope.actions.history').get_simple_history
Is a simple history implementation that is not context
sensitive, it writes all history in one text file.
]],

},
Expand Down Expand Up @@ -383,7 +381,7 @@ function config.set_defaults(user_defaults, tele_defaults)
)
end
if name == "history" then
if user_defaults[name] == false or config.values[name] == false then
if not user_defaults[name] or not config.values[name] then
return false
end

Expand Down

0 comments on commit 7d15d0f

Please sign in to comment.