diff options
| -rw-r--r-- | core/tmux.conf | 40 | ||||
| -rwxr-xr-x | core/vim.sh | 67 | ||||
| -rw-r--r-- | core/vimrc (renamed from mac/vimrc) | 11 | ||||
| -rw-r--r-- | mac/tmux.conf | 38 |
4 files changed, 44 insertions, 112 deletions
diff --git a/core/tmux.conf b/core/tmux.conf index 465641c..97084f1 100644 --- a/core/tmux.conf +++ b/core/tmux.conf | |||
| @@ -1,15 +1,41 @@ | |||
| 1 | # True-color support regardless of what TERM the outer terminal/distro sets | 1 | # Ctrl-b f: prompt for text, list windows whose name, pane title or pane contents match; Enter jumps |
| 2 | set -g default-terminal "tmux-256color" | 2 | # Ctrl-b w: tree of every window in every session; press f inside it to filter by name, Enter jumps |
| 3 | set -ga terminal-overrides ",*256col*:Tc" | 3 | # Ctrl-b s: tree of sessions (same tree, session view) |
| 4 | 4 | # Ctrl-b p: go to the previous window (lower index, wraps); Ctrl-b n goes to the next one | |
| 5 | # | ||
| 5 | # Vi mode for copy | 6 | # Vi mode for copy |
| 6 | setw -g mode-keys vi | 7 | setw -g mode-keys vi |
| 7 | 8 | ||
| 8 | # Mouse selection | 9 | # Mouse selection |
| 9 | set -g mouse on | 10 | set -g mouse on |
| 10 | 11 | ||
| 12 | # Persistent pane index labels (top-left of each pane's border) | ||
| 13 | set -g pane-border-status top | ||
| 14 | set -g pane-border-format "#P" | ||
| 15 | |||
| 16 | # Explicitly swap current pane with a pane index you type in | ||
| 17 | bind-key P command-prompt -p "swap with pane #:" "swap-pane -d -t '%%'" | ||
| 18 | # Manual: :swap-pane -s <src> -t <dst> | ||
| 19 | |||
| 20 | # Vim-style pane resizing (prefix + H/J/K/L), magnitude 1 | ||
| 21 | bind -r H resize-pane -L 1 | ||
| 22 | bind -r J resize-pane -D 1 | ||
| 23 | bind -r K resize-pane -U 1 | ||
| 24 | bind -r L resize-pane -R 1 | ||
| 25 | |||
| 11 | # v to start selection, y to yank (like vim) | 26 | # v to start selection, y to yank (like vim) |
| 12 | bind-key -T copy-mode-vi v send-keys -X begin-selection | 27 | bind-key -T copy-mode-vi v send-keys -X begin-selection |
| 13 | bind-key -T copy-mode-vi y send-keys -X copy-pipe-no-clear "openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1" | 28 | # macOS: pbcopy. Linux: wl-copy/xclip when usable, else just drain (tmux's own |
| 14 | bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-no-clear "openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1" | 29 | # buffer + set-clipboard/OSC 52 still apply). Netcat send is the same on both. |
| 15 | bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear "openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1" | 30 | if-shell 'uname | grep -q Darwin' { |
| 31 | bind-key -T copy-mode-vi y send-keys -X copy-pipe-no-clear "bash -c 'tee >(pbcopy) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 32 | bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-no-clear "bash -c 'tee >(pbcopy) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 33 | bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear "bash -c 'tee >(pbcopy) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 34 | } { | ||
| 35 | # Linux only: true-color regardless of what TERM the outer terminal/distro sets | ||
| 36 | set -g default-terminal "tmux-256color" | ||
| 37 | set -ga terminal-overrides ",*256col*:Tc" | ||
| 38 | bind-key -T copy-mode-vi y send-keys -X copy-pipe-no-clear "bash -c 'tee >(wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || cat >/dev/null) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 39 | bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-no-clear "bash -c 'tee >(wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || cat >/dev/null) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 40 | bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear "bash -c 'tee >(wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || cat >/dev/null) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 41 | } | ||
diff --git a/core/vim.sh b/core/vim.sh index 8041e0e..241673e 100755 --- a/core/vim.sh +++ b/core/vim.sh | |||
| @@ -2,71 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | cd "$(dirname "${BASH_SOURCE[0]}")" || exit | 3 | cd "$(dirname "${BASH_SOURCE[0]}")" || exit |
| 4 | 4 | ||
| 5 | # Same vimrc as the Mac (core/vimrc); OS differences are guarded inside the file. | ||
| 5 | VIMRC_PATH="/etc/vimrc" | 6 | VIMRC_PATH="/etc/vimrc" |
| 6 | [ -d /etc/vim ] && VIMRC_PATH="/etc/vim/vimrc" | 7 | [ -d /etc/vim ] && VIMRC_PATH="/etc/vim/vimrc" |
| 7 | CLIP_HOST="p.noml.ch" | ||
| 8 | CLIP_PORT="5023" | ||
| 9 | CLIP_CMD="openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 ${CLIP_HOST} ${CLIP_PORT}" | ||
| 10 | 8 | ||
| 11 | grep -q 'netcat_clipboard' "$VIMRC_PATH" && exit 0 | 9 | cp vimrc "$VIMRC_PATH" |
| 12 | |||
| 13 | cat << EOF >> "$VIMRC_PATH" | ||
| 14 | augroup netcat_clipboard | ||
| 15 | au! | ||
| 16 | au TextYankPost * call system("echo " . shellescape(@") . " | ${CLIP_CMD} >/dev/null 2>&1 &") | ||
| 17 | augroup END | ||
| 18 | |||
| 19 | " Enable line wrapping | ||
| 20 | set wrap | ||
| 21 | |||
| 22 | " Optional: Make wrapped lines easier to read by indenting them | ||
| 23 | set breakindent | ||
| 24 | set breakindentopt=shift:1 | ||
| 25 | |||
| 26 | syntax on | ||
| 27 | set mouse=a | ||
| 28 | set expandtab | ||
| 29 | set shiftwidth=4 | ||
| 30 | set softtabstop=4 | ||
| 31 | set tabstop=4 | ||
| 32 | set noautoindent | ||
| 33 | set nosmartindent | ||
| 34 | filetype plugin indent on | ||
| 35 | |||
| 36 | set laststatus=2 " permanent status bar | ||
| 37 | set statusline=%F " shows full file path | ||
| 38 | |||
| 39 | if (has("termguicolors")) | ||
| 40 | " tmux's terminfo entries (tmux-256color/screen-256color) don't define | ||
| 41 | " setrgbf/setrgbb, so vim has no termcap to build true-color escapes and | ||
| 42 | " silently emits none. Set them explicitly (standard vim+tmux fix). | ||
| 43 | if !empty($TMUX) | ||
| 44 | let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" | ||
| 45 | let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" | ||
| 46 | endif | ||
| 47 | set termguicolors | ||
| 48 | endif | ||
| 49 | |||
| 50 | "colorscheme murphy | ||
| 51 | colorscheme zellner | ||
| 52 | |||
| 53 | " Ctrl+A: Move to the beginning of the line in INSERT mode | ||
| 54 | inoremap <C-a> <Home> | ||
| 55 | |||
| 56 | " Ctrl+E: Move to the end of the line in INSERT mode | ||
| 57 | inoremap <C-e> <End> | ||
| 58 | |||
| 59 | " Ctrl+A: Move to the beginning of the line in NORMAL mode | ||
| 60 | nnoremap <C-a> 0 | ||
| 61 | |||
| 62 | " Ctrl+E: Move to the end of the line in NORMAL mode | ||
| 63 | nnoremap <C-e> $ | ||
| 64 | |||
| 65 | set number | ||
| 66 | setlocal regexpengine=2 | ||
| 67 | set foldcolumn=12 | ||
| 68 | |||
| 69 | set noswapfile | ||
| 70 | autocmd InsertLeave * silent! update | ||
| 71 | |||
| 72 | EOF | ||
| @@ -1,4 +1,5 @@ | |||
| 1 | " /etc/vim/vimrc — self-contained; source of truth: /v1/dev_env/core/vim.sh | 1 | " One vimrc for Mac and Linux. Source of truth: /Users/xs/dev_env/core/vimrc |
| 2 | " Mac: cp core/vimrc ~/.vimrc Linux: sudo bash core/vim.sh (copies it to /etc/vimrc or /etc/vim/vimrc) | ||
| 2 | " gt: go to next tab (right, wraps) | 3 | " gt: go to next tab (right, wraps) |
| 3 | " gT: go to previous tab (left, wraps) | 4 | " gT: go to previous tab (left, wraps) |
| 4 | " 2gt: go to tab number 2 (counted from 1 at the left) | 5 | " 2gt: go to tab number 2 (counted from 1 at the left) |
| @@ -111,7 +112,10 @@ autocmd InsertLeave * silent! update | |||
| 111 | function! s:LockIfManaged() abort | 112 | function! s:LockIfManaged() abort |
| 112 | if !exists('s:managed') | 113 | if !exists('s:managed') |
| 113 | let l:cargo = empty($CARGO_HOME) ? expand('~/.cargo') : $CARGO_HOME | 114 | let l:cargo = empty($CARGO_HOME) ? expand('~/.cargo') : $CARGO_HOME |
| 114 | let s:managed = [trim(system('rustup show home')), l:cargo . '/registry', l:cargo . '/git'] | 115 | let s:managed = [l:cargo . '/registry', l:cargo . '/git'] |
| 116 | if executable('rustup') | ||
| 117 | call add(s:managed, trim(system('rustup show home'))) | ||
| 118 | endif | ||
| 115 | endif | 119 | endif |
| 116 | for l:dir in s:managed | 120 | for l:dir in s:managed |
| 117 | if stridx(expand('%:p'), l:dir . '/') == 0 | 121 | if stridx(expand('%:p'), l:dir . '/') == 0 |
| @@ -126,6 +130,8 @@ augroup managed_readonly | |||
| 126 | augroup END | 130 | augroup END |
| 127 | 131 | ||
| 128 | 132 | ||
| 133 | " vim-plug is optional: skip the plugin block until plug.vim is installed (see Setup above) | ||
| 134 | if filereadable(expand('~/.vim/autoload/plug.vim')) | ||
| 129 | call plug#begin('~/.vim/plugged') | 135 | call plug#begin('~/.vim/plugged') |
| 130 | Plug 'prabirshrestha/async.vim' | 136 | Plug 'prabirshrestha/async.vim' |
| 131 | Plug 'prabirshrestha/vim-lsp' | 137 | Plug 'prabirshrestha/vim-lsp' |
| @@ -141,6 +147,7 @@ Plug 'airblade/vim-gitgutter' | |||
| 141 | Plug 'preservim/nerdtree' | 147 | Plug 'preservim/nerdtree' |
| 142 | Plug 'andymass/vim-matchup' | 148 | Plug 'andymass/vim-matchup' |
| 143 | call plug#end() | 149 | call plug#end() |
| 150 | endif | ||
| 144 | 151 | ||
| 145 | let g:gitgutter_sign_column_always = 0 | 152 | let g:gitgutter_sign_column_always = 0 |
| 146 | 153 | ||
diff --git a/mac/tmux.conf b/mac/tmux.conf deleted file mode 100644 index bd89157..0000000 --- a/mac/tmux.conf +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | # Ctrl-b f: prompt for text, list windows whose name, pane title or pane contents match; Enter jumps | ||
| 2 | # Ctrl-b w: tree of every window in every session; press f inside it to filter by name, Enter jumps | ||
| 3 | # Ctrl-b s: tree of sessions (same tree, session view) | ||
| 4 | # Ctrl-b p: go to the previous window (lower index, wraps); Ctrl-b n goes to the next one | ||
| 5 | # | ||
| 6 | # Vi mode for copy | ||
| 7 | setw -g mode-keys vi | ||
| 8 | |||
| 9 | # Mouse selection | ||
| 10 | set -g mouse on | ||
| 11 | |||
| 12 | # Persistent pane index labels (top-left of each pane's border) | ||
| 13 | set -g pane-border-status top | ||
| 14 | set -g pane-border-format "#P" | ||
| 15 | |||
| 16 | # Explicitly swap current pane with a pane index you type in | ||
| 17 | bind-key P command-prompt -p "swap with pane #:" "swap-pane -d -t '%%'" | ||
| 18 | # Manual: :swap-pane -s <src> -t <dst> | ||
| 19 | |||
| 20 | # Vim-style pane resizing (prefix + H/J/K/L), magnitude 1 | ||
| 21 | bind -r H resize-pane -L 1 | ||
| 22 | bind -r J resize-pane -D 1 | ||
| 23 | bind -r K resize-pane -U 1 | ||
| 24 | bind -r L resize-pane -R 1 | ||
| 25 | |||
| 26 | # v to start selection, y to yank (like vim) | ||
| 27 | bind-key -T copy-mode-vi v send-keys -X begin-selection | ||
| 28 | # macOS: pbcopy. Linux: wl-copy/xclip when usable, else just drain (tmux's own | ||
| 29 | # buffer + set-clipboard/OSC 52 still apply). Netcat send is the same on both. | ||
| 30 | if-shell 'uname | grep -q Darwin' { | ||
| 31 | bind-key -T copy-mode-vi y send-keys -X copy-pipe-no-clear "bash -c 'tee >(pbcopy) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 32 | bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-no-clear "bash -c 'tee >(pbcopy) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 33 | bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear "bash -c 'tee >(pbcopy) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 34 | } { | ||
| 35 | bind-key -T copy-mode-vi y send-keys -X copy-pipe-no-clear "bash -c 'tee >(wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || cat >/dev/null) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 36 | bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-no-clear "bash -c 'tee >(wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || cat >/dev/null) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 37 | bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear "bash -c 'tee >(wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || cat >/dev/null) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" | ||
| 38 | } | ||
