Importing the ssh agent functions, and created one for switching kitty tabs with fzf

This commit is contained in:
Sergio Laín 2023-09-09 22:54:54 +02:00
parent be874089da
commit f3d007ea66
No known key found for this signature in database
8 changed files with 59 additions and 8 deletions

View file

@ -0,0 +1,7 @@
if test -z "$SSH_ENV"
set -xg SSH_ENV $HOME/.ssh/environment
end
if not __ssh_agent_is_started
__ssh_agent_start
end

View file

@ -0,0 +1,24 @@
function __ssh_agent_is_started -d "check if ssh agent is already started"
if begin
test -n "$SSH_AUTH_SOCK"; and test -e "$SSH_AUTH_SOCK"
end
return 0
end
if begin
test -f $SSH_ENV; and test -z "$SSH_AGENT_PID"
end
source $SSH_ENV >/dev/null
end
if begin
test -z "$SSH_AGENT_PID"; and test -z "$SSH_CONNECTION"
end
return 1
end
ssh-add -l >/dev/null 2>&1
if test $status -eq 2
return 1
end
end

View file

@ -0,0 +1,5 @@
function __ssh_agent_start -d "start a new ssh agent"
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV
chmod 600 $SSH_ENV
source $SSH_ENV > /dev/null
end

View file

@ -0,0 +1,15 @@
function switch_kitty_tab
set kitty_info (kitty @ -- ls)
set -l tabs (echo $kitty_info | jq -r '.[0].tabs[].title')
set -l tab_ids (echo $kitty_info | jq -r '.[0].tabs[].id')
if test -n "$tabs"
set -l selected_tab (printf "%s\n" $tabs | fzf)
if test -n "$selected_tab"
kitty @ focus-tab --match "title:^$selected_tab"
end
else
echo "No se encontraron pestañas de Kitty"
end
end

View file

@ -5,3 +5,4 @@ bind \cg fgit
bind \e\z cdzi bind \e\z cdzi
bind \e\ci navi bind \e\ci navi
bind \cr repos bind \cr repos
bind \e\[Z switch_kitty_tab

View file

@ -915,7 +915,7 @@ tab_activity_symbol none
#: leading or trailing spaces, surround the text with quotes. See #: leading or trailing spaces, surround the text with quotes. See
#: tab_title_template for how this is rendered. #: tab_title_template for how this is rendered.
tab_title_template {title}{' :{}:'.format(num_windows) if num_windows > 1 else ''} tab_title_template "{f'{title[:30]}…' if title.rindex(title[-1]) + 1 > 30 else (title.center(6) if (title.rindex(title[-1]) + 1) % 2 == 0 else title.center(5))}"
#: A template to render the tab title. The default just renders the #: A template to render the tab title. The default just renders the
#: title with optional symbols for bell and activity. If you wish to #: title with optional symbols for bell and activity. If you wish to
@ -941,11 +941,11 @@ active_tab_title_template none
#: Template to use for active tabs. If not specified falls back to #: Template to use for active tabs. If not specified falls back to
#: tab_title_template. #: tab_title_template.
active_tab_foreground #181926 active_tab_foreground #1e2030
active_tab_background #C6A0F6 active_tab_background #b7bdf8
inactive_tab_foreground #CAD3F5 inactive_tab_foreground #CAD3F5
inactive_tab_background #1E2030 inactive_tab_background #1E2030
tab_bar_background #181926 tab_bar_background #1e2030
active_tab_font_style bold-italic active_tab_font_style bold-italic
inactive_tab_font_style normal inactive_tab_font_style normal
@ -954,7 +954,7 @@ inactive_tab_font_style normal
#: Background color for the tab bar. Defaults to using the terminal #: Background color for the tab bar. Defaults to using the terminal
#: background color. #: background color.
tab_bar_margin_color none tab_bar_margin_color #1e2030
#: Color for the tab bar margin area. Defaults to using the terminal #: Color for the tab bar margin area. Defaults to using the terminal
#: background color. #: background color.
@ -1842,7 +1842,6 @@ map kitty_mod+, move_tab_backward
map kitty_mod+alt+t set_tab_title map kitty_mod+alt+t set_tab_title
map shift+cmd+i set_tab_title map shift+cmd+i set_tab_title
map ctrl+t set_tab_title
#: You can also create shortcuts to go to specific tabs, with 1 being #: You can also create shortcuts to go to specific tabs, with 1 being

View file

@ -12,7 +12,7 @@
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"color-picker.nvim": { "branch": "master", "commit": "06cb5f853535dea529a523e9a0e8884cdf9eba4d" }, "color-picker.nvim": { "branch": "master", "commit": "06cb5f853535dea529a523e9a0e8884cdf9eba4d" },
"compiler.nvim": { "branch": "main", "commit": "7c8bb1faf3adf7a77f0fc28aad4adc6a846f7979" }, "compiler.nvim": { "branch": "main", "commit": "7c8bb1faf3adf7a77f0fc28aad4adc6a846f7979" },
"copilot-cmp": { "branch": "master", "commit": "23cc592ceaadbbebbc3b52482679ce1706047266" }, "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" },
"copilot.lua": { "branch": "master", "commit": "2c942f33ba5c621c906e625e00a1bb504b65e2f0" }, "copilot.lua": { "branch": "master", "commit": "2c942f33ba5c621c906e625e00a1bb504b65e2f0" },
"crates.nvim": { "branch": "main", "commit": "d5caf28aba49e81ac4099426231f3cf3c151013a" }, "crates.nvim": { "branch": "main", "commit": "d5caf28aba49e81ac4099426231f3cf3c151013a" },
"diffview.nvim": { "branch": "main", "commit": "7e5a85c186027cab1e825d018f07c350177077fc" }, "diffview.nvim": { "branch": "main", "commit": "7e5a85c186027cab1e825d018f07c350177077fc" },

View file

@ -28,5 +28,5 @@ inject_theme_js = 1
; DO NOT CHANGE! ; DO NOT CHANGE!
[Backup] [Backup]
version = 1.2.18.999.g9b38fc27 version = 1.2.20.1210.g2a8a8a57
with = Dev with = Dev