Commit Graph

342 Commits (main)

Author SHA1 Message Date
olimorris 548b43aec4 refactor: function names and comment blocks 2023-12-21 13:26:48 +00:00
Christopher Speck 7944b9afe3
refactor: update logic for autoload or starting sessions (#104)
* Update logic for autoload or starting sessions.

The logic to prevent autoloading/starting sessions when any arguments
are supplied to neovim is to prevent session management from kicking in
when editing a single file.

This updates the logic to allow a single argument passed to neovim as
long as the argument is an existing directory. When neovim is launched
in this way it behaves the same as opening neovim with no arguments but
has changed the working directory.

This results in consistent behavior of the autoloading/starting of
sessions when passing a directory argument to start neovim.

See: https://github.com/olimorris/persisted.nvim/discussions/93

* Fix comment, make comparisons more direct

* Update functions to be directory-aware

The main functionality in `init.lua` assumes using current working
directory in most cases. This refactors these functions to allow passing
in a directory instead.

The default behavior is to now use the current directory unless neovim
was started with a single directory argument, using that instead.

This also special-cases `.` as `vim.fn.expand()` does not resolve that
to the current working directory.
2023-12-21 11:15:05 +00:00
olimorris 66d540f949 refactor!: do not append `main` to non-git repo sessions
https://github.com/olimorris/persisted.nvim/discussions/103
2023-12-20 12:47:51 +00:00
olimorris ff261c2d22 feat: add copy session to Telescope actions 2023-12-20 12:45:11 +00:00
olimorris 3e0c504ba2 docs: update README.md 2023-12-18 23:49:27 +00:00
olimorris ab7040d8c0 chore: formatting 2023-12-18 23:49:07 +00:00
olimorris a1cc308580 feat: telescope add/update branch name 2023-12-18 23:46:57 +00:00
olimorris bcdada28d2 fix: prevent double running of git command
Should improve loading times significantly
2023-12-18 23:22:10 +00:00
olimorris 86ce6f14ae refactor!: telescope reset_prompt api 2023-12-18 23:21:04 +00:00
Mike Iversen fc9f398393
feat: Added exact ignored_dirs support (#100) 2023-11-26 10:38:57 +00:00
olimorris d821524f94 docs: add `CONTRIBUTING.MD` 2023-11-18 19:44:49 +00:00
olimorris 3ebc5d77ae refactor: `override` to `force` for SessionSave 2023-11-18 16:07:38 +00:00
olimorris 2b3ec15ebd docs: remove duplication 2023-11-18 15:41:11 +00:00
olimorris 0ea44f1586 feat: add global var for if session exists in cwd 2023-11-18 15:38:16 +00:00
olimorris d90f9adb04 fix: #96 improve startup time
For those who do not use the git branching feature, this may improve their Neovim startup time significantly
2023-11-16 09:50:09 +00:00
olimorris 5b5ec1c797 docs: add better event examples 2023-11-06 12:18:44 +00:00
olimorris 71352aa7dc chore(formatting) 2023-11-06 12:16:35 +00:00
olimorris deae7ab202 tests: use plenary v0.1.3 for tests 2023-10-23 09:10:24 +01:00
olimorris afa9d9a8ad chore: update bug_report template 2023-10-22 20:32:48 +01:00
Rafael Bodill 315cd1a8a5
fix: unnecessary shell commands when autosave off (#85)
* fix: unnecessary shell commands when autosave off

Problem:    Shell programs aren't able to detect nvim exit.

Solution:   Avoid running shell-commands unnecessarily on exit.

Programs that spawn nvim in-order to edit a file are unable to detect
nvim exit cleanly because of a race-condition that happens in
`VimLeavePre` and `get_current()` which runs shell commands during exit
even when `autosave` is off.

For example, using nvim nightly, run persisted.nvim with:

```lua
opts.should_autosave = function()
	-- Do not autosave if git commit/rebase session.
	return vim.env.GIT_EXEC_PATH == nil
end
```

And run `EDITOR=nvim git commit` from shell; git will fail waiting for
nvim to exit cleanly.

* fix: global variable in lowercase initial
2023-08-11 14:07:50 +01:00
olimorris 2de1fe69e7 feat: add event for `PersistedToggled` 2023-08-11 10:33:54 +01:00
olimorris c1c4bbff8a feat: add global variable for last loaded session 2023-07-26 16:17:42 +01:00
olimorris 06946ed12d feat: allow session to be saved from telescope 2023-07-25 21:12:30 +01:00
olimorris b03c863731 Revert "fix: prevent autoloading when there are extra command line arguments passed to nvim (#76)"
This reverts commit 975cd4cd06.
2023-06-30 05:09:55 +01:00
Beartama 975cd4cd06
fix: prevent autoloading when there are extra command line arguments passed to nvim (#76)
When nvim is used as a man pager with `export MANPAGER='nvim +Man! '`, with autoload set to true, persisted.nvim still autoloads the current directory which is not desirable
2023-06-27 17:07:11 -07:00
olimorris c384aa6706 chore: active session mark in telescope 2023-06-12 09:04:37 +01:00
Dhruv Manilawala 0cdbc8a3fe
feat: mark active session in telescope, use `vim.fn.confirm` 2023-06-12 08:36:05 +01:00
Dhruv Manilawala f5d84ea6e1
fix: update telescope extension structure (#72)
Telescope extension folder structure is described here:
https://github.com/nvim-telescope/telescope.nvim/wiki/Extensions#extension-folder-structure

When `telescope.load_extension(<name>)` is done, the name is loaded from
path `telescope._extensions.<name>`. With the current structure, one
could do `telescope.load_extension('finders')` and then it will be
available to load through `Telescope finders` which will error

> Error executing Lua callback: ...share/nvim/lazy/telescope.nvim/lua/telescope/command.lua:193: attempt to call a nil value
> stack traceback:
>     ...share/nvim/lazy/telescope.nvim/lua/telescope/command.lua:193: in function 'run_command'
>     ...share/nvim/lazy/telescope.nvim/lua/telescope/command.lua:253: in function 'load_command'
>     ...ocal/share/nvim/lazy/telescope.nvim/plugin/telescope.lua:108: in function <...ocal/share/nvim/lazy/telescope.nvim/plugin/telescope.lua:107>
2023-06-11 21:51:26 +01:00
Agustin Marquez 536513779b
docs: fix lazy installation in README.md 2023-06-07 10:02:04 +01:00
olimorris 2e6946c1ad refactor: clean up `mks` command 2023-06-02 10:22:04 +01:00
olimorris b42a8a87da docs: update README.md 2023-05-31 22:45:49 +01:00
olimorris c58219567d ci: test for Neovim 0.9.0 2023-05-26 16:53:03 +01:00
Oli 304a3c5551
feat: load the session from the main branch if no branch session (#66) 2023-04-24 17:44:57 +01:00
Turiiya dbdd6af184
docs: update command name `SessionLoadFromPath->SessionLoadFromFile` 2023-04-14 16:28:00 +01:00
olimorris e053ff3348 fix: #61 `SessionSave` command 2023-03-13 19:45:24 +00:00
olimorris 7d91c60135 fix: #60 autosave ignoring vim.fn.argc 2023-03-09 09:57:27 +00:00
olimorris 4ee6e4c991 chore: update bug report desc 2023-03-09 09:56:54 +00:00
olimorris 6075b36afc fix: issue yml files 2023-03-09 09:49:38 +00:00
olimorris 32d3679a8c chore: update issue templates 2023-03-09 09:46:56 +00:00
olimorris 866de841a6 docs: update 2023-03-09 09:46:47 +00:00
olimorris 7b295391b4 Merge branch 'main' of https://github.com/olimorris/persistence.nvim 2023-03-09 09:45:39 +00:00
olimorris b7f21efaf9 ci: remove docs generator 2023-03-09 09:43:40 +00:00
github-actions[bot] 228df07acc chore(build): auto-generate vimdoc 2023-03-09 09:42:23 +00:00
olimorris d72e5eac4d docs: update docs and readme 2023-03-09 09:41:30 +00:00
olimorris 0a6be5db0e refactor: remove deprecations 2023-03-09 09:41:22 +00:00
olimorris 3dcad75325 tests: update testing and makefile 2023-03-09 09:40:20 +00:00
olimorris 88f27dcab2 fix: PersistedSavePre called when autosave = false 2023-02-28 23:21:54 +00:00
github-actions[bot] 4cde12d8b9 chore(build): auto-generate vimdoc 2023-02-28 22:30:31 +00:00
olimorris b88867dc37 docs: update readme 2023-02-28 22:29:00 +00:00
olimorris bcd99ed00c chore: rename functions 2023-02-28 22:28:44 +00:00