fix: codespaces widgets
This commit is contained in:
@@ -9,6 +9,7 @@ alias zen='curl -s https://api.github.com/zen && echo'
|
||||
alias la='ls -la'
|
||||
alias vi='vim'
|
||||
alias copilot='gh copilot'
|
||||
if [[ -z "${CODESPACES:-}" ]]; then
|
||||
cs() {
|
||||
local codespace="${1:-}"
|
||||
if [[ -z "$codespace" ]]; then
|
||||
@@ -27,6 +28,7 @@ cs() {
|
||||
fi
|
||||
return $rc
|
||||
}
|
||||
fi
|
||||
alias colby='copilot --allow-all-tools --allow-all-paths'
|
||||
alias gs='git s'
|
||||
alias gd='git d'
|
||||
@@ -41,6 +43,7 @@ gb() { local b; b="$(git branch --all --sort=-committerdate --format='%(refname:
|
||||
glo() { git log --oneline --color --decorate | fzf --ansi --preview 'git show --color --stat {1}' --bind 'enter:become(echo {1})'; }
|
||||
f() { local f; f="$(fzf --preview 'head -100 {}')" && ${EDITOR:-vim} "$f"; }
|
||||
|
||||
if [[ -z "${CODESPACES:-}" ]]; then
|
||||
ssh() {
|
||||
local ssh_target="${@: -1}"
|
||||
[[ -n "$TMUX" ]] && tmux rename-window "ssh:$ssh_target"
|
||||
@@ -70,4 +73,5 @@ ssh() {
|
||||
return $rc
|
||||
}
|
||||
s() { local h; h="$(_dots_ssh_hosts | fzf)" && ssh "$h"; }
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
export WORKSPACE="${WORKSPACE:-$HOME/Workspace}"
|
||||
if [[ -n "${CODESPACES:-}" ]]; then
|
||||
export DOTFILES="${DOTFILES:-/workspaces/.codespaces/.persistedshare/dotfiles}"
|
||||
else
|
||||
export DOTFILES="${DOTFILES:-$HOME/.dotfiles}"
|
||||
fi
|
||||
export EDITOR=vim
|
||||
export VISUAL=vim
|
||||
export PAGER=less
|
||||
|
||||
@@ -27,8 +27,8 @@ set -g set-clipboard on
|
||||
setw -g mode-keys vi
|
||||
bind -T copy-mode-vi v send -X begin-selection
|
||||
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy 2>/dev/null || xclip -selection clipboard 2>/dev/null || xsel --clipboard"
|
||||
bind -T copy-mode-vi MouseDown1Pane send -X cancel
|
||||
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "pbcopy 2>/dev/null || xclip -selection clipboard 2>/dev/null || xsel --clipboard"
|
||||
bind -T copy-mode-vi MouseDown1Pane send -X clear-selection
|
||||
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe "pbcopy 2>/dev/null || xclip -selection clipboard 2>/dev/null || xsel --clipboard"
|
||||
|
||||
# Splits
|
||||
bind | split-window -h -c "#{pane_current_path}"
|
||||
|
||||
@@ -107,6 +107,7 @@ _dots_load_keybindings() {
|
||||
bindkey '^E' _dots_edit_widget
|
||||
|
||||
# Ctrl+G: remote connect
|
||||
if [[ -z "${CODESPACES:-}" ]]; then
|
||||
_dots_ssh_hosts() {
|
||||
local ssh_log="${XDG_DATA_HOME:-$HOME/.local/share}/ssh/log"
|
||||
local cs_cache="$_dots_cache_dir/codespaces"
|
||||
@@ -138,6 +139,7 @@ _dots_load_keybindings() {
|
||||
}
|
||||
zle -N _dots_ssh_widget
|
||||
bindkey '^G' _dots_ssh_widget
|
||||
fi
|
||||
|
||||
# Ctrl+F: find in files
|
||||
_dots_find_in_files_widget() {
|
||||
|
||||
@@ -160,7 +160,7 @@ run() {
|
||||
else
|
||||
time_color="$RED"
|
||||
fi
|
||||
printf "\n${CYAN}>>> ${CYAN_BOLD}${script_name}, ${NC}"
|
||||
printf "${CYAN}>>> ${CYAN_BOLD}${script_name}, ${NC}"
|
||||
printf "completed in ${time_color}${execution_ms_formatted}ms${NC}\n"
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user