diff --git a/README.md b/README.md index 34a2de2..644069f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ + +

Persisted.nvim

@@ -16,6 +18,8 @@ Forked from Persistence.nvim as active development had stopped

+ + ## :sparkles: Features - Automatically saves the active session under `.local/share/nvim/sessions` on exiting Neovim @@ -80,6 +84,21 @@ Ensure that the telescope extension is loaded with: require("telescope").load_extension("persisted") ``` +The layout can then be customised from within Telescope: + +```lua +require('telescope').setup({ + defaults = { + … + }, + extensions = { + persisted = { + layout_config = { width = 0.55, height = 0.55 } + } + } +}) +``` + ## :rocket: Usage **Default commands** @@ -100,8 +119,9 @@ The plugin comes with a number of commands: The Telescope extension may be opened via `:Telescope persisted`. Once opened, the available keymaps are: -* `` - Source the session file -* `` - Delete the session file + +- `` - Source the session file +- `` - Delete the session file **Statuslines** @@ -242,7 +262,7 @@ require("persisted").setup({ Specifying `~/Code` will autosave and autoload from that directory as well as all its sub-directories. -> **Note:** If `allowed_dirs` is left at its default value and `autosave` and/or `autoload` are set to `true`, then the plugin will autoload/autosave from *any* directory +> **Note:** If `allowed_dirs` is left at its default value and `autosave` and/or `autoload` are set to `true`, then the plugin will autoload/autosave from _any_ directory ### Ignored directories @@ -320,10 +340,14 @@ Finally, if you're using the excellent [Legendary.nvim](https://github.com/mrjon ### Telescope extension + +

Telescope

+ + The plugin contains an extension for [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) which allows the user to list all of the saved session files and source them via `:Telescope persisted`. ## :page_with_curl: License diff --git a/lua/telescope/_extensions/persisted.lua b/lua/telescope/_extensions/persisted.lua index 3f0cdce..4c42990 100644 --- a/lua/telescope/_extensions/persisted.lua +++ b/lua/telescope/_extensions/persisted.lua @@ -6,9 +6,11 @@ local action_state = require("telescope.actions.state") local _actions = require("telescope._extensions.actions") local _finders = require("telescope._extensions.finders") +local telescope_opts = {} + local function search_sessions(opts) - local utils = require("persisted.utils") local config = require("persisted.config").options + opts = vim.tbl_extend('force', telescope_opts, opts or {}) pickers .new(opts, { @@ -39,6 +41,9 @@ local function search_sessions(opts) end return require("telescope").register_extension({ + setup = function(topts) + telescope_opts = topts + end, exports = { persisted = search_sessions, },