tmux: add resurrect to save/restore pane/window layout
This commit is contained in:
parent
e1160acbe1
commit
2f2a9657c2
47 changed files with 2579 additions and 0 deletions
30
.config/tmux/plugins/resurrect/strategies/nvim_session.sh
Executable file
30
.config/tmux/plugins/resurrect/strategies/nvim_session.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# "nvim session strategy"
|
||||
#
|
||||
# Same as vim strategy, see file 'vim_session.sh'
|
||||
|
||||
ORIGINAL_COMMAND="$1"
|
||||
DIRECTORY="$2"
|
||||
|
||||
nvim_session_file_exists() {
|
||||
[ -e "${DIRECTORY}/Session.vim" ]
|
||||
}
|
||||
|
||||
original_command_contains_session_flag() {
|
||||
[[ "$ORIGINAL_COMMAND" =~ "-S" ]]
|
||||
}
|
||||
|
||||
main() {
|
||||
if nvim_session_file_exists; then
|
||||
echo "nvim -S"
|
||||
elif original_command_contains_session_flag; then
|
||||
# Session file does not exist, yet the original nvim command contains
|
||||
# session flag `-S`. This will cause an error, so we're falling back to
|
||||
# starting plain nvim.
|
||||
echo "nvim"
|
||||
else
|
||||
echo "$ORIGINAL_COMMAND"
|
||||
fi
|
||||
}
|
||||
main
|
||||
Loading…
Add table
Add a link
Reference in a new issue