Skip to content

Commit

Permalink
Update before re-installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Tingelöf committed Apr 24, 2024
1 parent 596d225 commit 3889218
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 162 deletions.
81 changes: 19 additions & 62 deletions templates/.tmux.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Basic setup
set -g prefix C-a
set -g default-shell {{shell}}
set -g default-terminal "tmux-256color"
set -g default-shell /usr/bin/zsh
set -g default-terminal "$TERM"
set -ag terminal-overrides ",$TERM:Tc"
set-option -g focus-events on
bind -n WheelDownPane select-pane -t= \; send-keys -M
set -ga terminal-overrides ",*256col*:Tc:smcup@:rmcup@"
Expand All @@ -22,6 +23,8 @@ bind t new-window
bind C-S-t new-window
bind-key : command-prompt
bind-key -n C-z resize-pane -Z
bind-key C-l send-keys "clear && tmux clear-history" \; send-keys "Enter"
bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
set -s escape-time 0

# so you don't end up with window numbers like: 0 1 4 5 6
Expand All @@ -48,28 +51,26 @@ set -g status-left ''
set -g status-right-length 100
set -g status-left-length 100

set -g pane-border-style fg='{{base01}}',bold
set -g pane-active-border-style fg='{{base04}}',bold
set -g message-style bg='{{base03}}',fg='{{base0C}}'
set -g status-style bg='{{base01}}',fg='{{base04}}'
set -g status-right '#[bg={{base01}}]#[fg={{base0A}}] #{?window_zoomed_flag,#[bg={{base0A}}],} '
set -ga status-right '#[bg={{base01}}]#[fg={{base02}}]#{?client_prefix,#[bg={{base0D}}],} '
set-window-option -g window-status-style fg='{{base05}}',bg=default
set-window-option -g window-status-current-style fg='{{base07}}',bg='{{base01}}'
set -g pane-border-style fg='#24292e',bold
set -g pane-active-border-style fg='#6e7681',bold
set -g message-style bg='#586069',fg='#539bf5'
set -g status-style bg='#24292e',fg='#6e7681'
set -g status-right '#[bg=#24292e]#[fg=#e3b341] #{?window_zoomed_flag,#[bg=#e3b341],} '
set -ga status-right '#[bg=#24292e]#[fg=#484f58]#{?client_prefix,#[bg=#6cb6ff],} '
set-window-option -g window-status-style fg='#8b949e',bg='#24292e'
set-window-option -g window-status-current-style fg='#f0f6fc',bg='#24292e'

setw -g window-status-current-format ' #[fg={{base0D}}]#I #W '
setw -g window-status-format ' #[fg={{base05}}]#I #W '
setw -g window-status-current-format ' #[fg=#6cb6ff]#I #W '
setw -g window-status-format ' #[fg=#8b949e]#I #W '

# Movement/resizing
# gsettings list-recursively org.gnome.desktop.wm.keybindings | sort | grep "left\|right"
# gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "[]"
# gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "[]"
bind-key -n C-M-Left previous-window
bind-key -n C-M-Right next-window
bind-key Up resize-pane -U 15
bind-key Down resize-pane -D 15
bind-key Right resize-pane -R 15
bind-key Left resize-pane -L 15
bind-key -n M-Left previous-window
bind-key -n M-Right next-window

# v and h are not binded by default, but we never know in the next versions...
unbind v
Expand All @@ -80,10 +81,10 @@ unbind % # Split vertically
unbind '"' # Split horizontally

bind v split-window -h -c "#{pane_current_path}"
bind h split-window -v -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"

bind - select-layout "even-vertical"
bind = select-layout "even-vertical"
bind + select-layout "even-horizontal"
bind M-r rotate-window

Expand All @@ -92,37 +93,6 @@ setw -g aggressive-resize on
bind a send-prefix
bind C-a send-prefix

# Copy/paste
setw -g mode-keys vi
setw -g mode-style reverse
unbind-key -T copy-mode-vi 'End'
unbind-key -T copy-mode-vi 'Home'
bind Enter copy-mode # enter copy mode
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind-key -T copy-mode-vi 'Home' send -X start-of-line
bind-key -T copy-mode-vi 'End' send -X end-of-line
bind-key -T copy-mode-vi S-up send -X page-up
bind-key -T copy-mode-vi S-down send -X page-down
run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
bind-key -T copy-mode-vi 'C-Left' select-pane -L
bind-key -T copy-mode-vi 'C-Down' select-pane -D
bind-key -T copy-mode-vi 'C-Up' select-pane -U
bind-key -T copy-mode-vi 'C-Right' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+

# Mouse copy paste improvements
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
Expand All @@ -143,19 +113,6 @@ bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xc
bind -n C-k send-keys C-k
bind -n C-l send-keys C-l

# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'M-Left' if-shell "$is_vim" 'send-keys C-Left' 'select-pane -L'
bind-key -n 'M-Right' if-shell "$is_vim" 'send-keys C-Right' 'select-pane -R'
bind-key -n 'M-Up' if-shell "$is_vim" 'send-keys C-Up' 'select-pane -U'
bind-key -n 'M-Down' if-shell "$is_vim" 'send-keys C-Down' 'select-pane -D'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+'

# List of plugins
Expand Down
172 changes: 139 additions & 33 deletions templates/Code/User/keybindings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
"key": "ctrl+w",
"command": "-workbench.action.closeActiveEditor"
},
{
"key": "ctrl+e",
"command": "workbench.action.toggleSidebarVisibility"
},
{
"key": "alt+numpad1",
"command": "-workbench.view.explorer",
Expand Down Expand Up @@ -121,10 +117,6 @@
"command": "-editor.action.codeAction",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+v",
"command": "python.refactorExtractVariable"
},
{
"key": "ctrl+s",
"command": "-workbench.action.files.saveAll"
Expand Down Expand Up @@ -173,8 +165,7 @@
},
{
"key": "ctrl+p",
"command": "workbench.action.openRecent",
"when": "editorFocus"
"command": "workbench.action.openRecent"
},
{
"key": "ctrl+r",
Expand All @@ -184,30 +175,10 @@
"key": "ctrl+p",
"command": "-workbench.action.quickOpen"
},
{
"key": "[IntlBackslash] d",
"command": "editor.action.marker.next",
"when": "editorFocus"
},
{
"key": "alt+f8",
"command": "-editor.action.marker.next",
"when": "editorFocus"
},
{
"key": "shift+[IntlBackslash] d",
"command": "editor.action.marker.prev",
"when": "editorFocus"
},
{
"key": "shift+alt+f8",
"command": "-editor.action.marker.prev",
"when": "editorFocus"
},
{
"key": "down",
"command": "search.action.focusNextSearchResult",
"when": "hasSearchResult || inSearchEditor"
"when": "inSearchEditor"
},
{
"key": "f4",
Expand All @@ -217,7 +188,7 @@
{
"key": "up",
"command": "search.action.focusPreviousSearchResult",
"when": "hasSearchResult || inSearchEditor"
"when": "inSearchEditor"
},
{
"key": "shift+f4",
Expand Down Expand Up @@ -341,5 +312,140 @@
{
"key": "ctrl+y",
"command": "editor.action.duplicateSelection"
},
{
"key": "f8",
"command": "-editor.action.marker.nextInFiles",
"when": "editorFocus"
},
{
"key": "ctrl+shift+i",
"command": "workbench.action.files.newUntitledFile"
},
{
"key": "alt+insert",
"command": "-workbench.action.files.newUntitledFile",
"when": "!editorTextFocus || editorTextFocus && !editorHasCodeActionsProvider"
},
{
"key": "ctrl+e",
"command": "workbench.action.toggleSidebarVisibility"
},
{
"key": "ctrl+b",
"command": "-workbench.action.toggleSidebarVisibility"
},
{
"key": "ctrl+o",
"command": "-workbench.action.files.openFileFolder",
"when": "isMacNative && openFolderWorkspaceSupport"
},
{
"key": "backspace",
"command": "-extension.vim_backspace",
"when": "editorTextFocus && vim.active && !inDebugRepl"
},
{
"key": "ctrl+n",
"command": "workbench.action.quickOpen"
},
{
"key": "ctrl+e",
"command": "-workbench.action.quickOpen"
},
{
"key": "ctrl+r",
"command": "editor.action.startFindReplaceAction",
"when": "editorFocus || editorIsOpen"
},
{
"key": "ctrl+h",
"command": "-editor.action.startFindReplaceAction",
"when": "editorFocus || editorIsOpen"
},
{
"key": "ctrl+shift+d",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+shift+alt+down",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+w",
"command": "editor.action.smartSelect.expand",
"when": "editorTextFocus"
},
{
"key": "shift+alt+right",
"command": "-editor.action.smartSelect.expand",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+w",
"command": "editor.action.smartSelect.shrink",
"when": "editorTextFocus"
},
{
"key": "shift+alt+left",
"command": "-editor.action.smartSelect.shrink",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+r",
"command": "-command-runner.run"
},
{
"key": "ctrl+shift+j",
"command": "-json.shortcut"
},
{
"key": "ctrl+shift+j",
"command": "editor.action.joinLines"
},
{
"key": "ctrl+k ctrl+k",
"command": "-editor.action.defineKeybinding",
"when": "resource == 'vscode-userdata:/home/epedape/.config/Code/User/keybindings.json'"
},
{
"key": "shift+alt+f5",
"command": "-workbench.action.compareEditor.previousChange",
"when": "textCompareEditorVisible"
},
{
"key": "ctrl+shift+n",
"command": "welcome.showNewFileEntries"
},
{
"key": "ctrl+alt+meta+n",
"command": "-welcome.showNewFileEntries"
},
{
"key": "ctrl+shift+n",
"command": "-workbench.action.newWindow"
},
{
"key": "ctrl+o",
"command": "-workbench.action.files.openFile",
"when": "true"
},
{
"key": "ctrl+alt+n",
"command": "find-it-faster.findFiles"
},
{
"key": "ctrl+shift+j",
"command": "-find-it-faster.findFiles"
},
{
"key": "ctrl+alt+u",
"command": "find-it-faster.findWithinFiles"
},
{
"key": "ctrl+shift+u",
"command": "-find-it-faster.findWithinFiles"
}
]
]
Loading

0 comments on commit 3889218

Please sign in to comment.