Skip to content

Commit

Permalink
Update Zed configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
serverwentdown committed Sep 20, 2024
1 parent ee8670c commit ff9ef21
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 71 deletions.
39 changes: 25 additions & 14 deletions .config/skhd/skhdrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
#

# start a terminal
alt - return : kitty --single-instance -d ~
alt + shift - return : ~/.local/bin/iterm_open
alt - return : SHELL=/bin/zsh ~/.local/bin/rio_open
#alt - return : kitty --single-instance -d ~
#alt + shift - return : ~/.local/bin/iterm_open

# kill focused window
alt + shift - q : yabai -m window --close
alt - q : yabai -m window --close

# start launcher
alt - d : skhd -k "cmd - space"
Expand Down Expand Up @@ -71,16 +72,26 @@ alt + shift - right : yabai -m window --warp east
#

# switch to workspace
alt - 0x12 : yabai -m space --focus 1
alt - 0x13 : yabai -m space --focus 2
alt - 0x14 : yabai -m space --focus 3
alt - 0x15 : yabai -m space --focus 4
alt - 0x17 : yabai -m space --focus 5
alt - 0x16 : yabai -m space --focus 6
alt - 0x1A : yabai -m space --focus 7
alt - 0x1C : yabai -m space --focus 8
alt - 0x19 : yabai -m space --focus 9
alt - 0x1D : yabai -m space --focus 10
#alt - 0x12 : yabai -m space --focus 1
#alt - 0x13 : yabai -m space --focus 2
#alt - 0x14 : yabai -m space --focus 3
#alt - 0x15 : yabai -m space --focus 4
#alt - 0x17 : yabai -m space --focus 5
#alt - 0x16 : yabai -m space --focus 6
#alt - 0x1A : yabai -m space --focus 7
#alt - 0x1C : yabai -m space --focus 8
#alt - 0x19 : yabai -m space --focus 9
#alt - 0x1D : yabai -m space --focus 10
alt - 0x12 : skhd -k "ctrl - 0x12"
alt - 0x13 : skhd -k "ctrl - 0x13"
alt - 0x14 : skhd -k "ctrl - 0x14"
alt - 0x15 : skhd -k "ctrl - 0x15"
alt - 0x17 : skhd -k "ctrl - 0x17"
alt - 0x16 : skhd -k "ctrl - 0x16"
alt - 0x1A : skhd -k "ctrl - 0x1A"
alt - 0x1C : skhd -k "ctrl - 0x1C"
alt - 0x19 : skhd -k "ctrl - 0x19"
alt - 0x1D : skhd -k "ctrl - 0x1D"
# move focused container to workspace
alt + shift - 0x12 : yabai -m window --space 1
alt + shift - 0x13 : yabai -m window --space 2
Expand Down Expand Up @@ -198,4 +209,4 @@ alt - p : yabai -m window --toggle float; yabai -m window --toggle topmost; yaba
#
# Custom focus Google Meet and mute/unmute
#
alt - m : yabai -m window --focus $(yabai -m query --windows | jq 'map(select(.title | contains("Meet"))) | .[0]?.id') && skhd -k 'cmd - d'
#alt - m : yabai -m window --focus $(yabai -m query --windows | jq 'map(select(.title | contains("Meet"))) | .[0]?.id') && skhd -k 'cmd - d'
81 changes: 47 additions & 34 deletions .config/yabai/yabairc
Original file line number Diff line number Diff line change
@@ -1,36 +1,49 @@
#!/usr/bin/env sh

sudo yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"

# global settings
yabai -m config mouse_follows_focus off
yabai -m config focus_follows_mouse off
yabai -m config window_placement second_child
yabai -m config window_topmost off
yabai -m config window_shadow off
yabai -m config window_opacity off
yabai -m config window_opacity_duration 0.0
yabai -m config active_window_opacity 1.0
yabai -m config normal_window_opacity 0.90
yabai -m config window_border on
yabai -m config window_border_width 6
yabai -m config active_window_border_color 0xddcb4b16
yabai -m config normal_window_border_color 0x00cb4b16
yabai -m config insert_feedback_color 0xff268bd2
yabai -m config split_ratio 0.50
yabai -m config auto_balance off
yabai -m config mouse_modifier fn
yabai -m config mouse_action1 move
yabai -m config mouse_action2 resize
yabai -m config mouse_drop_action swap

# general space settings
yabai -m config layout bsp
yabai -m config top_padding 16
yabai -m config bottom_padding 16
yabai -m config left_padding 16
yabai -m config right_padding 16
yabai -m config window_gap 12

echo "yabai configuration loaded.."
#sudo yabai --load-sa
#yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"

MAIN_DISPLAY=$(system_profiler SPDisplaysDataType | grep -B 3 'Main Display:' | awk '/Display Type/ {print $3}')

if [[ $MAIN_DISPLAY = "Built-in" ]]; then
yabai -m config external_bar main:0:0
else
yabai -m config external_bar main:36:0
fi

config=(
# global settings
mouse_follows_focus on
focus_follows_mouse autoraise
window_placement second_child
window_shadow off
window_opacity off
window_opacity_duration 0.0
active_window_opacity 1.0
normal_window_opacity 0.90
insert_feedback_color 0xff268bd2
split_ratio 0.50
auto_balance off
mouse_modifier alt
mouse_action1 move
mouse_action2 resize
mouse_drop_action swap

# general space settings
layout bsp
top_padding 16
bottom_padding 16
left_padding 16
right_padding 16
window_gap 12

# bar integration
external_bar all:36:0
)
yabai -m config "${config[@]}"

echo "yabai configuration loaded..."

borders active_color=0xddcb4b16 inactive_color=0x00cb4b16 width=6.0 &

#
14 changes: 11 additions & 3 deletions .config/zed/keymap.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
[
{
"context": "EmptyPane",
"bindings": {
"space b": "workspace::ToggleRightDock"
}
},
{
"context": "Editor && vim_mode == normal && !VimWaiting && !menu",
"bindings": {
"space b": "workspace::ToggleLeftDock"
"space b": "workspace::ToggleRightDock",
"space f": "editor::Format"
}
},
{
"context": "ProjectPanel && not_editing",
"bindings": {
"space b": "workspace::ToggleLeftDock",
"ctrl-w l": "project_panel::ToggleFocus"
"space b": "workspace::ToggleRightDock",
"ctrl-w l": "project_panel::ToggleFocus",
"ctrl-w r": "project_panel::ToggleFocus"
}
}
]
34 changes: 32 additions & 2 deletions .config/zed/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,37 @@
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
// Disable collaboration and chat features
"collaboration_panel": {
"button": false
},
"chat_panel": {
"button": false
},
"assistant": {
"version": "2",
"button": false
},
"features": {
"inline_completion_provider": "none"
},
// Layout
"project_panel": {
"dock": "right"
},
// Appearance
"theme": {
"mode": "system",
"dark": "Solarized Dark",
"light": "Solarized Light"
},
"ui_font_size": 14,
"buffer_font_size": 14,
"buffer_font_family": "Fira Code",
// Editor
"vim_mode": true,
"ui_font_size": 15,
"buffer_font_size": 15
"relative_line_numbers": true,
"wrap_guides": [80, 110],
// Security
"redact_private_values": true
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
!.config/yabai
!.config/yadm
!.config/zed
.config/zed/.tmp*
.config/zed/*
!.config/zed/*.json
!.config/zsh-completions
.config/zsh-completions/*
!.config/zsh-completions/download.sh
Expand Down
72 changes: 55 additions & 17 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# zmodload zsh/zprof
#zmodload zsh/zprof

# basic settings

Expand Down Expand Up @@ -46,15 +46,20 @@ sup() {
}
prompt_run_count=0
on_second_prompt() {
if [[ "$prompt_run_count" == 1 ]] && [[ "$USER" != "root" ]]; then
if [[ "$prompt_run_count" != 1 ]]; then
(( prompt_run_count = prompt_run_count + 1 ))
else
# zmodload zsh/zprof
load_slower
load_slowest
# zprof
precmd_functions_remove=( on_second_prompt )
precmd_functions=( ${precmd_functions:|precmd_functions_remove} )
fi
(( prompt_run_count = prompt_run_count + 1 ))
}
precmd_functions+=( on_second_prompt )
if [[ "$USER" != "root" ]]; then
precmd_functions+=( on_second_prompt )
fi

# executables

Expand All @@ -72,27 +77,30 @@ export DENO_INSTALL="$HOME/.deno"
[[ -d "$DENO_INSTALL" ]] && setup_deno

setup_pyenv() {
autoload -Uz compinit
compinit
unfunction -m pyenv python python3 pip pip3
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
eval "$(pip completion --zsh)"
}
pyenv_loaded=0
setup_pyenv_on_demand() {
setup_pyenv_once() {
if [[ ! -d "$PYENV_ROOT" ]] && ! which pip >/dev/null 2>/dev/null; then
git clone https://github.com/pyenv/pyenv.git "$PYENV_ROOT"
git clone https://github.com/pyenv/pyenv-virtualenv.git "$PYENV_ROOT/plugins/pyenv-virtualenv"
fi
if [[ "$pyenv_loaded" != 1 ]]; then
echo "-- Loading pyenv --"
setup_pyenv && pyenv_loaded=1
fi
echo -n "loading pyenv... "
setup_pyenv
}
setup_pyenv_when_python_version() {
if [[ -f .python-version ]]; then
setup_pyenv_once
if [[ "$pwd_last" != "$PWD" ]]; then
if [[ -f .python-version ]]; then
setup_pyenv_once
precmd_functions_remove=( setup_pyenv_when_python_version )
precmd_functions=( ${precmd_functions:|precmd_functions_remove} )
fi
fi
}
precmd_functions+=( setup_pyenv_when_python_version )
Expand All @@ -103,7 +111,25 @@ setup_pyenv_on_demand() {
pip3() { setup_pyenv_once && pip3 "$@" }
}
export PYENV_ROOT="$HOME/.pyenv"
setup_pyenv_on_demand
if [[ -z "$VIRTUAL_ENV" ]]; then
setup_pyenv_on_demand
fi

detect_venv() {
directories=( .env env .venv venv )
if [[ "$pwd_last" != "$PWD" ]]; then
for directory in $directories; do
if [[ -f "$directory/bin/activate" ]]; then
echo -n "activating venv... "
source "$directory/bin/activate"
break
fi
done
fi
}
if [[ -z "$VIRTUAL_ENV" ]]; then
precmd_functions+=( detect_venv )
fi

setup_nvm() {
unfunction -m nvm npm npx node
Expand Down Expand Up @@ -133,10 +159,10 @@ setup_bun() {
export BUN_INSTALL="$HOME/.bun"
[[ -d "$BUN_INSTALL" ]] && setup_bun

setup_ruby() {
export PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH"
}
which ruby >/dev/null 2>/dev/null && setup_ruby
#setup_ruby() {
# export PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH"
#}
#which ruby >/dev/null 2>/dev/null && setup_ruby

setup_go() {
export PATH="$(go env GOPATH)/bin:$PATH"
Expand Down Expand Up @@ -452,6 +478,10 @@ setup_prompt_colors() {
prompt_color_cyan=6
prompt_color_green=2
prompt_color_always_base3=$prompt_color_base3
if [[ "$ZED_TERM" == true ]]; then
# TODO: Customization
return
fi
if [[ $LIGHT == true ]]; then
prompt_color_temp03=$prompt_color_temp03
prompt_color_temp02=$prompt_color_temp02
Expand Down Expand Up @@ -598,6 +628,14 @@ setup_nope() {
}
slowest_functions+=( setup_nope )

# pwd tracking

pwd_last=
pwd_last_update() {
pwd_last="$PWD"
}
precmd_functions+=( pwd_last_update )

# helper scripts

function theme {
Expand Down Expand Up @@ -690,4 +728,4 @@ if which gpgconf >/dev/null 2>/dev/null; then
}
fi

# zprof
#zprof

0 comments on commit ff9ef21

Please sign in to comment.