docs: update README.md
parent
a9d1d6e2ce
commit
46722016e0
29
README.md
29
README.md
|
|
@ -408,7 +408,7 @@ vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
**Git Branching from directories that are not the CWD** by [mrloop](https://github.com/mrloop)
|
**Git Branching and Sub-directories** by [mrloop](https://github.com/mrloop)
|
||||||
|
|
||||||
As per [#149](https://github.com/olimorris/persisted.nvim/discussions/149), if you invoke Neovim from a sub-directory then the git branch will not be detected. The code below amends for this:
|
As per [#149](https://github.com/olimorris/persisted.nvim/discussions/149), if you invoke Neovim from a sub-directory then the git branch will not be detected. The code below amends for this:
|
||||||
|
|
||||||
|
|
@ -432,7 +432,7 @@ As per [#149](https://github.com/olimorris/persisted.nvim/discussions/149), if y
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Ignore Branches**
|
**Ignore Certain Branches**
|
||||||
|
|
||||||
If you'd like to ignore certain branches from being saved as a session:
|
If you'd like to ignore certain branches from being saved as a session:
|
||||||
|
|
||||||
|
|
@ -462,6 +462,31 @@ If you'd like to ignore certain branches from being saved as a session:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Only Save Certain Sessions**
|
||||||
|
|
||||||
|
You may wish to only save a session if the current working directory is in a table of allowed directories:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{
|
||||||
|
"olimorris/persisted.nvim",
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
local persisted = require("persisted")
|
||||||
|
local utils = require("persisted.utils")
|
||||||
|
local allowed_dirs = {
|
||||||
|
"~/code",
|
||||||
|
"~/notes/api"
|
||||||
|
}
|
||||||
|
|
||||||
|
persisted.setup({
|
||||||
|
should_save = function()
|
||||||
|
return utils.dirs_match(vim.fn.getcwd(), allowed_dirs)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
<!-- panvimdoc-ignore-start -->
|
<!-- panvimdoc-ignore-start -->
|
||||||
|
|
||||||
## :clap: Acknowledgements
|
## :clap: Acknowledgements
|
||||||
|
|
|
||||||
|
|
@ -429,8 +429,7 @@ Autoloading a session if arguments are passed to Neovim:
|
||||||
})
|
})
|
||||||
<
|
<
|
||||||
|
|
||||||
**Git Branching from directories that are not the CWD** by mrloop
|
**Git Branching and Sub-directories** by mrloop <https://github.com/mrloop>
|
||||||
<https://github.com/mrloop>
|
|
||||||
|
|
||||||
As per #149 <https://github.com/olimorris/persisted.nvim/discussions/149>, if
|
As per #149 <https://github.com/olimorris/persisted.nvim/discussions/149>, if
|
||||||
you invoke Neovim from a sub-directory then the git branch will not be
|
you invoke Neovim from a sub-directory then the git branch will not be
|
||||||
|
|
@ -456,7 +455,7 @@ detected. The code below amends for this:
|
||||||
}
|
}
|
||||||
<
|
<
|
||||||
|
|
||||||
**Ignore Branches**
|
**Ignore Certain Branches**
|
||||||
|
|
||||||
If you’d like to ignore certain branches from being saved as a session:
|
If you’d like to ignore certain branches from being saved as a session:
|
||||||
|
|
||||||
|
|
@ -486,6 +485,32 @@ If you’d like to ignore certain branches from being saved as a session:
|
||||||
}
|
}
|
||||||
<
|
<
|
||||||
|
|
||||||
|
**Only Save Certain Sessions**
|
||||||
|
|
||||||
|
You may wish to only save a session if the current working directory is in a
|
||||||
|
table of allowed directories:
|
||||||
|
|
||||||
|
>lua
|
||||||
|
{
|
||||||
|
"olimorris/persisted.nvim",
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
local persisted = require("persisted")
|
||||||
|
local utils = require("persisted.utils")
|
||||||
|
local allowed_dirs = {
|
||||||
|
"~/code",
|
||||||
|
"~/notes/api"
|
||||||
|
}
|
||||||
|
|
||||||
|
persisted.setup({
|
||||||
|
should_save = function()
|
||||||
|
return utils.dirs_match(vim.fn.getcwd(), allowed_dirs)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
<
|
||||||
|
|
||||||
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
|
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
|
||||||
|
|
||||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue