File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,12 @@ original_command_contains_session_flag() {
1515 [[ " $ORIGINAL_COMMAND " =~ " -S" ]]
1616}
1717
18+ persistence_nvim_plugin_exists () {
19+ nvim --headless -c ' lua if not pcall(require, "persistence") then os.exit(1) end' -c ' qa'
20+ # shellcheck disable=2181
21+ [ $? -eq 0 ]
22+ }
23+
1824main () {
1925 if nvim_session_file_exists; then
2026 echo " nvim -S"
@@ -23,6 +29,10 @@ main() {
2329 # session flag `-S`. This will cause an error, so we're falling back to
2430 # starting plain nvim.
2531 echo " nvim"
32+ elif persistence_nvim_plugin_exists; then
33+ # Load folke's persistence.nvim sessions. And Shoutout to ThePrimeagen and TjDevries.
34+ # Also Shoutout to my favorite youtuber Mr. Hussein Nasser because I'm learning a lot from you.
35+ echo " nvim -c 'lua require(\" persistence\" ).load()'"
2636 else
2737 echo " $ORIGINAL_COMMAND "
2838 fi
You can’t perform that action at this time.
0 commit comments