chore: use vim.notify (#108)
* Updated warnings and info to print with vim.notify * Updated formattingmain
parent
284d714b8d
commit
edd8aa41cd
|
|
@ -12,7 +12,6 @@ Table of Contents *persisted.nvim-table-of-contents*
|
|||
|
||||
FEATURES *persisted.nvim-features*
|
||||
|
||||
|
||||
- Supports sessions across multiple git branches
|
||||
- Telescope extension to work with saved sessions
|
||||
- Custom events which users can hook into for tighter integration
|
||||
|
|
@ -23,7 +22,6 @@ FEATURES *persisted.nvim-features*
|
|||
|
||||
REQUIREMENTS *persisted.nvim-requirements*
|
||||
|
||||
|
||||
- Neovim >= 0.8.0
|
||||
|
||||
|
||||
|
|
@ -107,7 +105,6 @@ COMMANDS ~
|
|||
|
||||
The plugin comes with a number of commands:
|
||||
|
||||
|
||||
- `:SessionToggle` - Determines whether to load, start or stop a session
|
||||
- `:SessionStart` - Start recording a session. Useful if `autosave = false`
|
||||
- `:SessionStop` - Stop recording a session
|
||||
|
|
@ -123,7 +120,6 @@ TELESCOPE EXTENSION ~
|
|||
The Telescope extension may be opened via `:Telescope persisted`. The available
|
||||
actions are:
|
||||
|
||||
|
||||
- `<CR>` - Open/source the session file
|
||||
- `<C-b>` - Add/update the git branch for the session file
|
||||
- `<C-c>` - Copy the session file
|
||||
|
|
@ -134,7 +130,6 @@ GLOBAL VARIABLES ~
|
|||
|
||||
The plugin sets a number of global variables throughout its lifecycle:
|
||||
|
||||
|
||||
- `vim.g.persisting` - (bool) Determines if the plugin is active for the current session
|
||||
- `vim.g.persisted_exists` - (bool) Determines if a session exists for the current working directory
|
||||
- `vim.g.persisted_loaded_session` - (string) The file path to the current session
|
||||
|
|
@ -171,7 +166,7 @@ WHAT IS SAVED IN THE SESSION? ~
|
|||
|
||||
As the plugin uses Vim’s `:mksession` command then you may change the
|
||||
`vim.o.sessionoptions` value to determine what to write into the session.
|
||||
Please see `:h sessionoptions` for more information.
|
||||
Please see |sessionoptions| for more information.
|
||||
|
||||
|
||||
**Note**The author uses: `vim.o.sessionoptions =
|
||||
|
|
@ -356,7 +351,6 @@ EVENTS / CALLBACKS ~
|
|||
|
||||
The plugin fires events at various points during its lifecycle:
|
||||
|
||||
|
||||
- `PersistedLoadPre` - For _before_ a session is loaded
|
||||
- `PersistedLoadPost` - For _after_ a session is loaded
|
||||
- `PersistedTelescopeLoadPre` - For _before_ a session is loaded via Telescope
|
||||
|
|
|
|||
|
|
@ -113,15 +113,14 @@ function M.get_branch(dir)
|
|||
if vim.fn.filereadable(branch_session) ~= 0 then
|
||||
return branch
|
||||
else
|
||||
vim.api.nvim_echo({
|
||||
{ "[Persisted.nvim]\n", "Question" },
|
||||
{ "Could not load a session for branch " },
|
||||
{ git_branch[1] .. "\n", "WarningMsg" },
|
||||
{ "Trying to load a session for branch " },
|
||||
{ config.options.default_branch, "Title" },
|
||||
{ " ..." },
|
||||
}, true, {})
|
||||
|
||||
vim.notify(
|
||||
string.format("[Persisted.nvim]: Trying to load a session for branch %s", config.options.default_branch),
|
||||
vim.log.levels.INFO
|
||||
)
|
||||
vim.notify(
|
||||
string.format("[Persisted.nvim]: Could not load a session for branch %s.", git_branch[1]),
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
vim.g.persisted_branch_session = branch_session
|
||||
return config.options.branch_separator .. config.options.default_branch
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ local fp_sep = vim.loop.os_uname().sysname:lower():match("windows") and "\\" or
|
|||
--@return string
|
||||
local function echoerr(msg, error)
|
||||
vim.api.nvim_echo({
|
||||
{ "[persisted.nvim]: ", "ErrorMsg" },
|
||||
{ "[Persisted.nvim]: ", "ErrorMsg" },
|
||||
{ msg, "WarningMsg" },
|
||||
{ error, "Normal" },
|
||||
}, true, {})
|
||||
|
|
|
|||
Loading…
Reference in New Issue