Skip to content

Commit

Permalink
Require neovim 0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Shatur committed May 22, 2024
1 parent a0b9d25 commit 4376507
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ local config = require('session_manager.config')
require('session_manager').setup({
sessions_dir = Path:new(vim.fn.stdpath('data'), 'sessions'), -- The directory where the session files will be saved.
session_filename_to_dir = session_filename_to_dir, -- Function that replaces symbols into separators and colons to transform filename into a session directory.
dir_to_session_filename = dir_to_session_filename, -- Function that replaces separators and colons into special symbols to transform session directory into a filename. Should use `vim.loop.cwd()` if the passed `dir` is `nil`.
dir_to_session_filename = dir_to_session_filename, -- Function that replaces separators and colons into special symbols to transform session directory into a filename. Should use `vim.uv.cwd()` if the passed `dir` is `nil`.
autoload_mode = config.AutoloadMode.LastSession, -- Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession
autosave_last_session = true, -- Automatically save last session on exit and on session switch.
autosave_ignore_not_normal = true, -- Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed.
Expand Down
6 changes: 3 additions & 3 deletions lua/session_manager/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ end

--- Loads a session for the current working directory.
function session_manager.load_current_dir_session(discard_current)
local cwd = vim.loop.cwd()
local cwd = vim.uv.cwd()
if cwd then
local session = config.dir_to_session_filename(cwd)
if session:exists() then
Expand All @@ -62,7 +62,7 @@ end

--- Saves a session for the current working directory.
function session_manager.save_current_session()
local cwd = vim.loop.cwd()
local cwd = vim.uv.cwd()
if cwd then
utils.save_session(config.dir_to_session_filename(cwd).filename)
end
Expand Down Expand Up @@ -94,7 +94,7 @@ end

--- Deletes the session for the current working directory.
function session_manager.delete_current_dir_session()
local cwd = vim.loop.cwd()
local cwd = vim.uv.cwd()
if cwd then
local session = config.dir_to_session_filename(cwd)
if session:exists() then
Expand Down
6 changes: 3 additions & 3 deletions lua/session_manager/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ end
---@param filename string
function utils.delete_session(filename)
Path:new(filename):rm()
local cwd = vim.loop.cwd()
local cwd = vim.uv.cwd()
if utils.is_session and cwd and filename == config.dir_to_session_filename(cwd).filename then
utils.is_session = false
end
Expand All @@ -115,7 +115,7 @@ function utils.get_sessions(opts)

-- If we are in a session already, don't list the current session.
if utils.is_session then
local cwd = vim.loop.cwd()
local cwd = vim.uv.cwd()
local is_current_session = cwd and config.dir_to_session_filename(cwd).filename == sessions[1].filename
if is_current_session then
table.remove(sessions, 1)
Expand Down Expand Up @@ -173,7 +173,7 @@ end

---@return boolean
function utils.is_dir_in_ignore_list()
local cwd = vim.loop.cwd()
local cwd = vim.uv.cwd()
-- Use `fnamemodify` to allow paths like `~/.config`.
return vim.tbl_contains(config.autosave_ignore_dirs, cwd) or vim.tbl_contains(config.autosave_ignore_dirs, vim.fn.fnamemodify(cwd, ':~'))
end
Expand Down
4 changes: 2 additions & 2 deletions plugin/session_manager.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if not vim.fn.has('nvim-0.7.0') then
require('session_manager.utils').notify('Neovim 0.7+ is required for session manager plugin', vim.log.levels.ERROR)
if not vim.fn.has('nvim-0.10.0') then
require('session_manager.utils').notify('Neovim 0.10+ is required for session manager plugin', vim.log.levels.ERROR)
return
end

Expand Down

0 comments on commit 4376507

Please sign in to comment.