Добавлены конфиги tmux и zsh
This commit is contained in:
23
tmux/plugins/tmux-ressurect/strategies/irb_default_strategy.sh
Executable file
23
tmux/plugins/tmux-ressurect/strategies/irb_default_strategy.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# "irb default strategy"
|
||||
#
|
||||
# Example irb process with junk variables:
|
||||
# irb RBENV_VERSION=1.9.3-p429 GREP_COLOR=34;47 TERM_PROGRAM=Apple_Terminal
|
||||
#
|
||||
# When executed, the above will fail. This strategy handles that.
|
||||
|
||||
ORIGINAL_COMMAND="$1"
|
||||
DIRECTORY="$2"
|
||||
|
||||
original_command_wo_junk_vars() {
|
||||
echo "$ORIGINAL_COMMAND" |
|
||||
sed 's/RBENV_VERSION[^ ]*//' |
|
||||
sed 's/GREP_COLOR[^ ]*//' |
|
||||
sed 's/TERM_PROGRAM[^ ]*//'
|
||||
}
|
||||
|
||||
main() {
|
||||
echo "$(original_command_wo_junk_vars)"
|
||||
}
|
||||
main
|
||||
25
tmux/plugins/tmux-ressurect/strategies/mosh-client_default_strategy.sh
Executable file
25
tmux/plugins/tmux-ressurect/strategies/mosh-client_default_strategy.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# "mosh-client default strategy"
|
||||
#
|
||||
# Example mosh-client process:
|
||||
# mosh-client -# charm tmux at | 198.199.104.142 60001
|
||||
#
|
||||
# When executed, the above will fail. This strategy handles that.
|
||||
|
||||
ORIGINAL_COMMAND="$1"
|
||||
DIRECTORY="$2"
|
||||
|
||||
mosh_command() {
|
||||
local args="$ORIGINAL_COMMAND"
|
||||
|
||||
args="${args#*-#}"
|
||||
args="${args%|*}"
|
||||
|
||||
echo "mosh $args"
|
||||
}
|
||||
|
||||
main() {
|
||||
echo "$(mosh_command)"
|
||||
}
|
||||
main
|
||||
30
tmux/plugins/tmux-ressurect/strategies/nvim_session.sh
Executable file
30
tmux/plugins/tmux-ressurect/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
|
||||
32
tmux/plugins/tmux-ressurect/strategies/vim_session.sh
Executable file
32
tmux/plugins/tmux-ressurect/strategies/vim_session.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# "vim session strategy"
|
||||
#
|
||||
# Restores a vim session from 'Session.vim' file, if it exists.
|
||||
# If 'Session.vim' does not exist, it falls back to invoking the original
|
||||
# command (without the `-S` flag).
|
||||
|
||||
ORIGINAL_COMMAND="$1"
|
||||
DIRECTORY="$2"
|
||||
|
||||
vim_session_file_exists() {
|
||||
[ -e "${DIRECTORY}/Session.vim" ]
|
||||
}
|
||||
|
||||
original_command_contains_session_flag() {
|
||||
[[ "$ORIGINAL_COMMAND" =~ "-S" ]]
|
||||
}
|
||||
|
||||
main() {
|
||||
if vim_session_file_exists; then
|
||||
echo "vim -S"
|
||||
elif original_command_contains_session_flag; then
|
||||
# Session file does not exist, yet the original vim command contains
|
||||
# session flag `-S`. This will cause an error, so we're falling back to
|
||||
# starting plain vim.
|
||||
echo "vim"
|
||||
else
|
||||
echo "$ORIGINAL_COMMAND"
|
||||
fi
|
||||
}
|
||||
main
|
||||
Reference in New Issue
Block a user