Skip to content

Commit

Permalink
fix: Zed config dir
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleralbee committed Jan 11, 2025
1 parent b9ec7dc commit b2a9ea2
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 16 deletions.
15 changes: 5 additions & 10 deletions sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,20 @@ ZED_KEYMAP="$ZED_CONFIG_DIR/keymap.json"
ZED_SETTINGS="$ZED_CONFIG_DIR/settings.json"

# Repository paths
REPO_TMUX="./tmux"
REPO_VSCODE="./vscode"
REPO_TMUX_DIR="./tmux"
REPO_VSCODE_DIR="./vscode"
REPO_ZED_DIR="./zed"

# Ensure directory paths
mkdir -p tmux
mkdir -p vscode
mkdir -p zed

# Document sources
echo $TMUX_CONFIG > "$REPO_TMUX/SOURCE"
echo $VSCODE_USER_CONFIG_DIR > "$REPO_VSCODE/SOURCE"
echo $ZED_CONFIG_DIR > "$REPO_ZED/SOURCE"

# Copy
cp $TMUX_CONFIG "$REPO_TMUX/.tmux.conf"
cp $TMUX_CONFIG "$REPO_TMUX_DIR/.tmux.conf"

cp $VSCODE_USER_CONFIG_KEYBINDINGS "$REPO_VSCODE/keybindings.json"
cp $VSCODE_USER_CONFIG_SETTINGS "$REPO_VSCODE/settings.json"
cp $VSCODE_USER_CONFIG_KEYBINDINGS "$REPO_VSCODE_DIR/keybindings.json"
cp $VSCODE_USER_CONFIG_SETTINGS "$REPO_VSCODE_DIR/settings.json"

cp $ZED_KEYMAP "$REPO_ZED_DIR/keymap.json"
cp $ZED_SETTINGS "$REPO_ZED_DIR/settings.json"
14 changes: 12 additions & 2 deletions tmux/.tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@ bind-key M-a send-prefix

# switch panes using vim motions directions without prefix
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R

# set default shell to bash
set-option -g default-command "/bin/bash"

# enable copy mode
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

# remove delay when switching to normal using esc
set -s escape-time 0

# increase scrollback buffer size
set -g history-limit 5000

1 change: 0 additions & 1 deletion tmux/SOURCE

This file was deleted.

1 change: 0 additions & 1 deletion vscode/SOURCE

This file was deleted.

110 changes: 109 additions & 1 deletion zed/keymap.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,116 @@
[
// Use neovim's yank behavior: yank to end of line.
{
"context": "vim_mode == normal && !menu",
"bindings": {
"shift-y": ["workspace::SendKeystrokes", "y $"]
}
},
// Multicursor in normal, visual, operator, and insert modes if not in a menu
{
"context": "(VimControl || vim_mode == insert) && !menu",
"bindings": {
"alt-j": "editor::AddSelectionBelow",
"alt-k": "editor::AddSelectionAbove"
}
},
// Surround vim
{
"context": "vim_mode == visual",
"bindings": {
"s": [
"vim::PushOperator",
{
"AddSurrounds": {}
}
]
}
},
// TODO: Use alt-j and alt-k instead of ctrl-d and ctrl-u for scrolling
// - This currently doesn't work because hover hints are not in the menu context
// {
// "context": "menu",
// "bindings": {
// "alt-j": "vim::ScrollDown",
// "alt-k": "vim::ScrollUp"
// }
// },
{
"context": "Editor",
"bindings": {
"alt-f": "editor::Format"
"ctrl-.": "editor::ToggleCodeActions",

"alt-f": "editor::Format",
"alt-h": ["workspace::ActivatePaneInDirection", "Left"],
"alt-l": ["workspace::ActivatePaneInDirection", "Right"],
"alt-space": "editor::ToggleCodeActions",

"alt-shift-i": "editor::SplitSelectionIntoLines",
"alt-shift-j": "editor::MoveLineDown",
"alt-shift-k": "editor::MoveLineUp",
"alt-shift-r": "editor::RestartLanguageServer"
}
},
{
"bindings": {
// allow file finder in insert mode (still doesn't work in completion menus)
"ctrl-p": "file_finder::Toggle",

// Toggle between Terminal and Editor without closing terminal
"ctrl-shift-k": "terminal_panel::ToggleFocus",
// Open/Close Terminal
"ctrl-shift-i": "workspace::ToggleBottomDock",

"alt-[": "workspace::ToggleLeftDock",
"alt-]": "workspace::ToggleRightDock",

"alt-,": "zed::OpenSettings",
"alt-.": "zed::OpenKeymap",

"alt-shift-,": "zed::OpenDefaultSettings",
"alt-shift-.": "zed::OpenDefaultKeymap",
"alt-shift-/": "vim::OpenDefaultKeymap",

// Project file search, command palette
"alt-j": "menu::SelectNext",
"alt-k": "menu::SelectPrev"
}
},
// Code Actions, Autocomplete
{
"context": "Editor && (showing_code_actions || showing_completions)",
"bindings": {
"alt-j": "editor::ContextMenuNext",
"alt-k": "editor::ContextMenuPrev"
}
},
// Split Panes
{
"context": "Pane",
"bindings": {
"alt-shift-h": "pane::SplitLeft",
"alt-shift-l": "pane::SplitRight"
}
},
// Firefox Developer Keyboard Shortcuts (kind of) + Pane Navigation from Terminal
{
"context": "Terminal",
"bindings": {
// Pane navigation
"alt-h": ["workspace::ActivatePaneInDirection", "Left"],
"alt-j": ["workspace::ActivatePaneInDirection", "Down"],
"alt-k": ["workspace::ActivatePaneInDirection", "Up"],
"alt-l": ["workspace::ActivatePaneInDirection", "Right"]
}
},
// Pane Navigation from Project Panel
{
"context": "ProjectPanel",
"bindings": {
"alt-h": ["workspace::ActivatePaneInDirection", "Left"],
"alt-j": ["workspace::ActivatePaneInDirection", "Down"],
"alt-k": ["workspace::ActivatePaneInDirection", "Up"],
"alt-l": ["workspace::ActivatePaneInDirection", "Right"]
}
}
]
62 changes: 61 additions & 1 deletion zed/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
// from the command palette or from `Zed` application menu.
{
// Settings applied after Welcome
"assistant": {
"default_model": {
"provider": "copilot_chat",
"model": "gpt-4o"
},
"version": "2"
},
"base_keymap": "VSCode",
"vim_mode": true,
"telemetry": {
Expand All @@ -30,6 +37,59 @@
},
"buffer_font_family": "Droid Sans Mono for Powerline",
"formatter": "prettier",
"file_types": {
"env": [".env*"], // requires Zed env extension
"JSON": [".prettierrc"],
"JSONC": [
"**/.vscode/**/*.json",
"**/packages/tsconfig/*.json",
"**/turbo.json",
"**/host.json",
"**/local.settings.json",
"**/tsconfig.json"
],
"LOG": ["*.log", "*.log.*"]
},
"gutter": { "code_actions": false },
"preview_tabs": {
"enabled": false
},
"project_panel": {
"show_diagnostics": "all",
"auto_fold_dirs": false,
"indent_size": 16
},
"relative_line_numbers": true,
"scroll_sensitivity": 2,
"search": { "case_sensitive": true, "regex": false, "whole_word": false },
"search_wrap": false, // disables `n` on last result looping back to first result using `/` search
"tab_bar": {
"show_nav_history_buttons": false
},
"tab_size": 4,
"ui_font_family": "Droid Sans Mono for Powerline"
"tabs": {
"file_icons": true,
"git_status": true,
"show_diagnostics": "all"
},
"terminal": {
// Powerline font necessary for oh-my-bash context renderer (git branch, etc.)
"font_family": "Droid Sans Mono for Powerline",
"font_size": 12
},
"toolbar": {
"quick_actions": false,
"selections_menu": false,
"breadcrumbs": false
},
"ui_font_family": "Droid Sans Mono for Powerline",
"use_autoclose": false,
"use_smartcase_search": true,
"vim": {
"use_multiline_find": true,
"use_smartcase_find": true,
"toggle_relative_line_numbers": true,
"highlight_on_yank_duration": 100,
"use_system_clipboard": "always"
}
}

0 comments on commit b2a9ea2

Please sign in to comment.