Skip to content
ํ”„๋กœ์ ํŠธ

์†Œ๊ฐœ

๐Ÿ’พ Neovim์„ ์œ„ํ•œ ๊ฐ„๋‹จํ•œ ์„ธ์…˜ ๊ด€๋ฆฌ

๊ฐœ๋ฐœ ๋„๊ตฌ

์ด ์ˆ˜์น˜๋ฅผ ์ธก์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•

What you can do

  • automatically saves the active session under ~/.local/state/nvim/sessions on exit
  • simple API to restore the current or last session

์ธก์ •๋œ ์Šคํƒ€ ์ฆ๊ฐ€

in 24h
+1
in 7 days
+2
in 15 days
+3
in 1 month
+3

์„œ๋กœ ๊ฒน์น˜๋Š” ๊ธฐ๊ฐ„์˜ ์ˆœ์ฆ๊ฐ€๋Ÿ‰์ด๋ฉฐ ์ผ๋ณ„ ํ•ฉ๊ณ„๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ์ธก์ •๊ฐ’์ด ์—†์œผ๋ฉด ๋น„์›Œ ๋‘ก๋‹ˆ๋‹ค. ์Šคํƒ€๋Š” ๊ด€์‹ฌ๋„๋ฅผ ๋‚˜ํƒ€๋‚ด๋ฉฐ ํ’ˆ์งˆ์„ ๋ณด์žฅํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

README.md

Original

๐Ÿ’พ Persistence

Persistence is a simple lua plugin for automated session management.

โœจ Features

  • automatically saves the active session under ~/.local/state/nvim/sessions on exit
  • simple API to restore the current or last session

โšก๏ธ Requirements

  • Neovim >= 0.7.2

๐Ÿ“ฆ Installation

Install the plugin with your preferred package manager:

lazy.nvim

-- Lua
{
  "folke/persistence.nvim",
  event = "BufReadPre", -- this will only start session saving when an actual file was opened
  opts = {
    -- add any custom options here
  }
}

โš™๏ธ Configuration

Persistence comes with the following defaults:

{
  dir = vim.fn.stdpath("state") .. "/sessions/", -- directory where session files are saved
  -- minimum number of file buffers that need to be open to save
  -- Set to 0 to always save
  need = 1,
  branch = true, -- use git branch to save session
}

[!TIP] To configure what should be saved in your session, check :h 'sessionoptions'

๐Ÿš€ Usage

Persistence works well with plugins like startify or dashboard. It will never restore a session automatically, but you can of course write an autocmd that does exactly that if you want.

-- load the session for the current directory
vim.keymap.set("n", "<leader>qs", function() require("persistence").load() end)

-- select a session to load
vim.keymap.set("n", "<leader>qS", function() require("persistence").select() end)

-- load the last session
vim.keymap.set("n", "<leader>ql", function() require("persistence").load({ last = true }) end)

-- stop Persistence => session won't be saved on exit
vim.keymap.set("n", "<leader>qd", function() require("persistence").stop() end)

๐Ÿ“… Events

  • PersistenceLoadPre: before loading a session
  • PersistenceLoadPost: after loading a session
  • PersistenceSavePre: before saving a session
  • PersistenceSavePost: after saving a session

๊ด€๋ จ ํ”„๋กœ์ ํŠธ ์‚ดํŽด๋ณด๊ธฐ

๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘โ€ฆ