Comments (7)
Hmmmm weird. Is it working now? I do feel that allowed_dirs
is not the best name for the variable and may lead to confusion.
Secondly, the lua require("persisted").list()
does return a table. I won't berate myself too much for this as it is in the readme 😉 . But...I have a custom function which launches a Telescope picker:
--- functions.lua file
function om.LoadSession()
local ok, persisted = om.safe_require("persisted")
if not ok then
return
end
local sessions = persisted.list()
local path_to_trim = Sessiondir .. "/"
local sessions_short = {}
for _, session in pairs(sessions) do
sessions_short[#sessions_short + 1] = session:gsub(path_to_trim, "")
end
om.select("Session to load", sessions_short, function(choice)
if choice == nil then
return
end
vim.cmd("source " .. vim.fn.fnameescape(path_to_trim .. choice))
vim.cmd('lua require("persisted").stop()')
end)
end
--- globals.lua file
function om.select(prompt, choices, callback)
vim.ui.select(choices, { prompt = prompt }, callback)
end
from persisted.nvim.
It is working, but I am not using the allowed_dirs
option...maybe I should've appended a slash, /
, to the end of the path?
And okay, my apologies---I thought I could create a mapping directly to lua require("persisted").list()
and have it open in a Telescope window. Perhaps you would consider adding in a telescope extension? Then all that would be required for the user would be something along the lines of (note that I use the cartographer plugin for my mappings):
require('telescope').load_extension('persisted')
map.n.nore.silent['<leader>tp'] = ':Telescope persisted<cr>'
from persisted.nvim.
Love the idea of a telescope extension. I've raised this as a new issue.
Regarding allowed_dirs
, the plugin compares your current working directory (from Neovim) with the directories listed in the allowed_dirs
table. I suspect you need the full path. It should work with something like ~/Code/Projects/persisted.nvim
.
from persisted.nvim.
I think this is highlighting that I need to do a full readme write up at some point. I tried to stay as close to Folke's as possible but it's starting to fail. Thanks for your great feedback.
from persisted.nvim.
Love the idea of a telescope extension. I've raised this as a new issue.
Regarding
allowed_dirs
, the plugin compares your current working directory (from Neovim) with the directories listed in theallowed_dirs
table. I suspect you need the full path. It should work with something like~/Code/Projects/persisted.nvim
.
@calebdw I've initially added this via #7 . Let me know what you think. Also updated the readme, heavily!
from persisted.nvim.
Love the idea of a telescope extension. I've raised this as a new issue.
Regardingallowed_dirs
, the plugin compares your current working directory (from Neovim) with the directories listed in theallowed_dirs
table. I suspect you need the full path. It should work with something like~/Code/Projects/persisted.nvim
.@calebdw I've initially added this via #7 . Let me know what you think. Also updated the readme, heavily!
Awesome! It looks pretty good but I noticed a couple of things:
- There's a missing end-quote:
{
allowed_dirs = {
"~/Code/Neovim",
"~/Code/Projects/Ruby"
}
}
- The Telescope window appear to clip the last column. There's also only two columns listed whereas 4 are listed in the README?
- The
allowed_dirs
andignored_dirs
needs a little clarification. If a directory is listed, does it include all children as well? For instance, if I want to ignore my home directory ('~'), would it also prevent autoloading in my projects directory ('~/projects')?
Thanks for the quick turnaround!
from persisted.nvim.
Great feedback, thank you! I have pushed updates to the readme and improved the way directories are pattern matched!
Regarding Telescope, can we move that to this thread?
from persisted.nvim.
Related Issues (20)
- Named sessions? HOT 1
- Howto ignore dirs "~" but not "~/*"? HOT 2
- Error when loading session HOT 3
- [Bug] flash of previous buffer session is autorestored HOT 2
- [Feature] Allow loading a session by name HOT 4
- Replace callbacks with user events HOT 30
- Startup time increased dramatically HOT 3
- [Bug] The cmdheight reset to 1 after SessionLoad HOT 12
- [Bug]: Unable to turn off autosaving HOT 6
- `string.gsub(session, save_dir, "")` will fail if special characters are not escaped HOT 3
- [Bug]: sessions dir is empty and nothing opened when :SessionLoad HOT 3
- `autosave` should not fires when opening single file in any directory HOT 3
- [Bug]: SessionSave / SessionLoad not working HOT 8
- [Bug]: Session overwrite when switch via telescope? HOT 15
- [Bug]: Handle interaction with lazy.nvim HOT 1
- [Bug]: howto pin a buffer through sessions switching? HOT 1
- [Bug]: uv_close: Assertion `!uv__is_closing(handle' failed HOT 10
- [Bug]: Telescope extension doesn't work after neovim update HOT 4
- [Bug]: Autosave Not Triggered Without Existing Session File HOT 8
- [Bug]: Still running git commands when `use_git_branch=false` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from persisted.nvim.