summaryrefslogtreecommitdiff
path: root/core/vim.sh
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-11-01 09:55:22 +0800
committerYour Name <you@example.com>2026-11-01 09:55:22 +0800
commit708e0c38fdcfd84a0028c4b261d77c4b2f5083df (patch)
tree9569b0dd0e9886ef1cea423b733c797461f1878e /core/vim.sh
parent30b598c7d885b79e792232eff7146b524e31493b (diff)
core: one vimrc and tmux.conf for Mac and Linux
Diffstat (limited to 'core/vim.sh')
-rwxr-xr-xcore/vim.sh67
1 files changed, 2 insertions, 65 deletions
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
3cd "$(dirname "${BASH_SOURCE[0]}")" || exit 3cd "$(dirname "${BASH_SOURCE[0]}")" || exit
4 4
5# Same vimrc as the Mac (core/vimrc); OS differences are guarded inside the file.
5VIMRC_PATH="/etc/vimrc" 6VIMRC_PATH="/etc/vimrc"
6[ -d /etc/vim ] && VIMRC_PATH="/etc/vim/vimrc" 7[ -d /etc/vim ] && VIMRC_PATH="/etc/vim/vimrc"
7CLIP_HOST="p.noml.ch"
8CLIP_PORT="5023"
9CLIP_CMD="openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 ${CLIP_HOST} ${CLIP_PORT}"
10 8
11grep -q 'netcat_clipboard' "$VIMRC_PATH" && exit 0 9cp vimrc "$VIMRC_PATH"
12
13cat << EOF >> "$VIMRC_PATH"
14augroup netcat_clipboard
15 au!
16 au TextYankPost * call system("echo " . shellescape(@") . " | ${CLIP_CMD} >/dev/null 2>&1 &")
17augroup END
18
19" Enable line wrapping
20set wrap
21
22" Optional: Make wrapped lines easier to read by indenting them
23set breakindent
24set breakindentopt=shift:1
25
26syntax on
27set mouse=a
28set expandtab
29set shiftwidth=4
30set softtabstop=4
31set tabstop=4
32set noautoindent
33set nosmartindent
34filetype plugin indent on
35
36set laststatus=2 " permanent status bar
37set statusline=%F " shows full file path
38
39if (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
48endif
49
50"colorscheme murphy
51colorscheme zellner
52
53" Ctrl+A: Move to the beginning of the line in INSERT mode
54inoremap <C-a> <Home>
55
56" Ctrl+E: Move to the end of the line in INSERT mode
57inoremap <C-e> <End>
58
59" Ctrl+A: Move to the beginning of the line in NORMAL mode
60nnoremap <C-a> 0
61
62" Ctrl+E: Move to the end of the line in NORMAL mode
63nnoremap <C-e> $
64
65set number
66setlocal regexpengine=2
67set foldcolumn=12
68
69set noswapfile
70autocmd InsertLeave * silent! update
71
72EOF