set -e $cmd_hist[1][(expr $num_items - $cmd_num)] ^ /dev/null
set -e $cmd_hist[1][(expr $num_items - $cmd_num)] ^ /dev/null
return 0
end
end
tput ed
return 1
tput cuu1
set pcount (expr $pcount - 1)
set no_prompt_hist 'T'
end
end
##############
##############
...
@@ -262,7 +280,7 @@ function mark -d 'Create bookmark for present working directory.'
...
@@ -262,7 +280,7 @@ function mark -d 'Create bookmark for present working directory.'
set -U bookmarks $PWD $bookmarks
set -U bookmarks $PWD $bookmarks
set pwd_hist_lock true
set pwd_hist_lock true
commandline -f repaint
commandline -f repaint
end
end
end
end
function unmark -d 'Remove bookmark for present working directory.'
function unmark -d 'Remove bookmark for present working directory.'
...
@@ -270,7 +288,7 @@ function unmark -d 'Remove bookmark for present working directory.'
...
@@ -270,7 +288,7 @@ function unmark -d 'Remove bookmark for present working directory.'
set -e bookmarks[(contains -i $PWD $bookmarks)]
set -e bookmarks[(contains -i $PWD $bookmarks)]
set pwd_hist_lock true
set pwd_hist_lock true
commandline -f repaint
commandline -f repaint
end
end
end
end
function m -d 'List bookmarks, jump to directory in list with m <number>'
function m -d 'List bookmarks, jump to directory in list with m <number>'
...
@@ -279,8 +297,8 @@ function m -d 'List bookmarks, jump to directory in list with m <number>'
...
@@ -279,8 +297,8 @@ function m -d 'List bookmarks, jump to directory in list with m <number>'
set_color $fish_color_error[1]
set_color $fish_color_error[1]
echo 'Bookmark list is empty. '(set_color normal)'Enter '(set_color $fish_color_command[1])'mark '(set_color normal)'in INSERT mode or '(set_color $fish_color_command[1])'m '(set_color normal)'in NORMAL mode, if you want to add the current directory to your bookmark list.'
echo 'Bookmark list is empty. '(set_color normal)'Enter '(set_color $fish_color_command[1])'mark '(set_color normal)'in INSERT mode or '(set_color $fish_color_command[1])'m '(set_color normal)'in NORMAL mode, if you want to add the current directory to your bookmark list.'
return
return
end
end
for i in (seq $num_items)
for i in (seq $num_items)
if [ $PWD = $bookmarks[$i] ]
if [ $PWD = $bookmarks[$i] ]
set_color $budspencer_colors[10]
set_color $budspencer_colors[10]
else
else
...
@@ -290,22 +308,25 @@ for i in (seq $num_items)
...
@@ -290,22 +308,25 @@ for i in (seq $num_items)
set_color $budspencer_colors[4]
set_color $budspencer_colors[4]
end
end
end
end
echo (expr $num_items - $i)\t$bookmarks[$i] | sed "s|$HOME|~|"
echo '▶ '(expr $num_items - $i)\t$bookmarks[$i] | sed "s|$HOME|~|"
end
end
if [ $num_items -eq 1 ]
if [ $num_items -eq 1 ]
set last_item ''
set last_item ''
else
else
set last_item '-'(expr $num_items - 1)
set last_item '-'(expr $num_items - 1)
end
end
echo -en $budspencer_cursors[1]
echo -en $budspencer_cursors[1]
set input_length (expr length (expr $num_items - 1))
set input_length (expr length (expr $num_items - 1))
@@ -318,7 +339,7 @@ function __budspencer_delete_zombi_sessions -d 'Delete zombi sessions'
...
@@ -318,7 +339,7 @@ function __budspencer_delete_zombi_sessions -d 'Delete zombi sessions'
set -e budspencer_sessions_active_pid[$item]
set -e budspencer_sessions_active_pid[$item]
set -e budspencer_sessions_active[$item]
set -e budspencer_sessions_active[$item]
end
end
end
end
end
end
function __budspencer_create_new_session -d 'Create a new session'
function __budspencer_create_new_session -d 'Create a new session'
...
@@ -332,20 +353,20 @@ function __budspencer_erase_session -d 'Erase current session'
...
@@ -332,20 +353,20 @@ function __budspencer_erase_session -d 'Erase current session'
set_color $fish_color_error[1]
set_color $fish_color_error[1]
echo 'Missing argument: name of session to erase'
echo 'Missing argument: name of session to erase'
return
return
end
end
if contains $argv[2] $budspencer_sessions_active
if contains $argv[2] $budspencer_sessions_active
set_color $fish_color_error[1]
set_color $fish_color_error[1]
echo "Session '$argv[2]' cannot be erased because it's currently active."
echo "Session '$argv[2]' cannot be erased because it's currently active."
return
return
end
end
if contains $argv[2] $budspencer_sessions
if contains $argv[2] $budspencer_sessions
set -e budspencer_session_cmd_hist_$argv[2]
set -e budspencer_session_cmd_hist_$argv[2]
set -e budspencer_session_dir_hist_$argv[2]
set -e budspencer_session_dir_hist_$argv[2]
set -e budspencer_sessions[(contains -i $argv[2] $budspencer_sessions)]
set -e budspencer_sessions[(contains -i $argv[2] $budspencer_sessions)]
else
else
set_color $fish_color_error[1]
set_color $fish_color_error[1]
echo "Session '$argv[2]' not found. "(set_color normal)'Enter '(set_color $fish_color_command[1])'s '(set_color normal)'to show a list of all recorded sessions.'
echo "Session '$argv[2]' not found. "(set_color normal)'Enter '(set_color $fish_color_command[1])'s '(set_color normal)'to show a list of all recorded sessions.'
end
end
end
end
function __budspencer_detach_session -d 'Detach current session'
function __budspencer_detach_session -d 'Detach current session'
...
@@ -353,19 +374,20 @@ function __budspencer_detach_session -d 'Detach current session'
...
@@ -353,19 +374,20 @@ function __budspencer_detach_session -d 'Detach current session'
set dir_hist dir_hist_nosession
set dir_hist dir_hist_nosession
if [ -z $$dir_hist ] ^ /dev/null
if [ -z $$dir_hist ] ^ /dev/null
set $dir_hist $PWD
set $dir_hist $PWD
end
end
set dir_hist_val (count $$dir_hist)
set dir_hist_val (count $$dir_hist)
set -e budspencer_sessions_active_pid[$argv] ^ /dev/null
set -e budspencer_sessions_active_pid[$argv] ^ /dev/null
set -e budspencer_sessions_active[$argv] ^ /dev/null
set -e budspencer_sessions_active[$argv] ^ /dev/null
set budspencer_session_current ''
set budspencer_session_current ''
cd $$dir_hist[1][$dir_hist_val]
cd $$dir_hist[1][$dir_hist_val]
set no_prompt_hist 'T'
end
end
function __budspencer_attach_session -d 'Attach session'
function __budspencer_attach_session -d 'Attach session'
set argv (echo -sn $argv\n | sed 's|[^[:alnum:]]|_|g')
set argv (echo -sn $argv\n | sed 's|[^[:alnum:]]|_|g')
if contains $argv[1] $budspencer_sessions_active
if contains $argv[1] $budspencer_sessions_active
wmctrl -a "✻ $argv[1]"
wmctrl -a "✻ $argv[1]"
else
else
wt "✻ $argv[1]"
wt "✻ $argv[1]"
__budspencer_detach_session $argv[-1]
__budspencer_detach_session $argv[-1]
set budspencer_sessions_active $budspencer_sessions_active $argv[1]
set budspencer_sessions_active $budspencer_sessions_active $argv[1]
...
@@ -381,7 +403,8 @@ else
...
@@ -381,7 +403,8 @@ else
end
end
set dir_hist_val (count $$dir_hist)
set dir_hist_val (count $$dir_hist)
cd $$dir_hist[1][$dir_hist_val] ^ /dev/null
cd $$dir_hist[1][$dir_hist_val] ^ /dev/null
end
end
set no_prompt_hist 'T'
end
end
function s -d 'Create, delete or attach session'
function s -d 'Create, delete or attach session'
...
@@ -417,7 +440,7 @@ function s -d 'Create, delete or attach session'
...
@@ -417,7 +440,7 @@ function s -d 'Create, delete or attach session'