refactor: trim configuration and drop unused plugins
check / validate (push) Canceled after 0s

- Merge sunbather dark/light into one background-aware color scheme
- Fold uninstall.sh into install.sh as a subcommand; drop clone logic
- Inline bash_tools/ helpers; remove fct and odict
- Remove TPM, tmux-sensible, and tmux-fuzzback; tmux has no plugins now
- Remove vim-repeat, vim-fugitive, vim-gitgutter, vim-tmux-navigator,
  and moonfly; everforest is the default dark theme
- Fetch vim-plug via git instead of curl; require git, not curl
- Guard termguicolors on Windows consoles without VT support and set
  nomore before the vimrc loads so headless installs cannot hang
- Fall back to sunbather when a color scheme fails to load, without
  overwriting the saved preference
- Append config/vim to runtimepath so netrw stops writing into the repo
- Fix .editorconfig Python indent; trim .gitignore; update CI and README

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBfsAH6iJg9inkNLKq11YC
This commit is contained in:
2026-09-14 01:06:39 +00:00
co-authored by Claude Fable 5.1
parent 2928ef3bc0
commit 215c5cea44
15 changed files with 108 additions and 456 deletions
+5 -1
View File
@@ -6,9 +6,13 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{sh,py,vim}]
[*.{sh,vim}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[*.py]
indent_style = space
indent_size = 4
+2 -2
View File
@@ -18,8 +18,8 @@ jobs:
- name: Check shell scripts
run: |
bash -n install.sh uninstall.sh bash_tools.sh bash_tools/*.sh
shellcheck install.sh uninstall.sh bash_tools.sh bash_tools/*.sh
bash -n install.sh bash_tools.sh
shellcheck install.sh bash_tools.sh
- name: Check Python
run: python3 -m compileall -q win-install.py
-8
View File
@@ -1,10 +1,2 @@
.DS_Store
*.pyc
__pycache__/
*._*
.vim/
node_modules/
tags
.netrwhist
.vimspector.json
*.log
+6 -18
View File
@@ -17,27 +17,15 @@ bind-key -r C-j resize-pane -D
bind-key -r C-k resize-pane -U
bind-key -r C-l resize-pane -R
# Ctrl-H/J/K/L moves seamlessly between tmux panes and Vim splits.
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\\.?(view|l?n?vim?x?)(diff)?(-wrapped)?$'"
bind-key -n C-h if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n C-j if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n C-k if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n C-l if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
bind-key -n 'C-\' if-shell "$is_vim" 'send-keys C-\' 'select-pane -l'
# Ctrl-H/J/K/L moves between panes.
bind-key -n C-h select-pane -L
bind-key -n C-j select-pane -D
bind-key -n C-k select-pane -U
bind-key -n C-l select-pane -R
bind-key -n 'C-\' select-pane -l
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'roosta/tmux-fuzzback'
set -g @fuzzback-popup-size '90%'
set -g @fuzzback-popup 1
set -g @fuzzback-fzf-colors 'gutter:-1,bg+:-1'
if-shell 'test -x "$HOME/.tmux/plugins/tpm/tpm"' \
'run-shell "$HOME/.tmux/plugins/tpm/tpm"'
+4 -30
View File
@@ -7,13 +7,9 @@ endif
let g:dotfiledir = fnamemodify(resolve(expand('<sfile>:p')), ':h') . '/'
let g:dotvimdir = g:dotfiledir . 'config/vim'
let g:vim_dir = has('win32') || has('win64') ? expand('~/vimfiles') : expand('~/.vim')
execute 'set runtimepath^=' . fnameescape(g:dotvimdir)
execute 'set runtimepath+=' . fnameescape(g:dotvimdir)
let g:os = has('win32') || has('win64') ? 'Windows'
\ : has('macunix') ? 'Darwin'
\ : substitute(system('uname'), '\n', '', '')
if g:os ==# 'Windows'
if has('win32') || has('win64')
if executable('pwsh')
set shell=pwsh
elseif executable('powershell')
@@ -56,7 +52,6 @@ set tabstop=4
set softtabstop=4
set autoindent
set nojoinspaces
set nospell
set list
set listchars=tab:•\ ,trail:•,extends:»,precedes:«
let &fillchars = 'eob: ,vert:│,stl: ,stlnc: '
@@ -66,7 +61,7 @@ set undofile
set undolevels=1000
set undoreload=10000
set viewoptions=folds
if has('termguicolors')
if has('termguicolors') && (!has('win32') || has('vcon') || has('gui_running'))
set termguicolors
endif
@@ -82,7 +77,7 @@ execute 'set undodir=' . fnameescape(g:vim_dir . '/undo//')
execute 'set viewdir=' . fnameescape(g:vim_dir . '/view//')
if has('clipboard')
if g:os ==# 'Darwin' || g:os ==# 'Windows'
if has('macunix') || has('win32') || has('win64')
set clipboard=unnamed
else
set clipboard=unnamedplus
@@ -97,7 +92,6 @@ augroup DotfilesCore
autocmd FileType help setlocal colorcolumn=
autocmd FileType * setlocal formatoptions-=o
autocmd BufNewFile,BufRead *.html.twig setfiletype html.twig
autocmd BufNewFile,BufRead *.ts setfiletype typescript
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line('$') | execute 'normal! g`"' | endif
autocmd BufWinLeave ?* if &buftype ==# '' && !empty(expand('%:p')) | silent! mkview | endif
autocmd BufWinEnter ?* if &buftype ==# '' && !empty(expand('%:p')) | silent! loadview | endif
@@ -131,20 +125,14 @@ if filereadable(s:plug_vim)
Plug 'preservim/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
Plug 'ryanoasis/vim-devicons'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'mhinz/vim-startify'
Plug 'Donaldttt/vim-bufferline'
Plug 'Donaldttt/vim-global-statusline', { 'branch': 'vim9' }
Plug 'christoomey/vim-tmux-navigator'
Plug 'sainnhe/everforest'
Plug 'bluz71/vim-moonfly-colors', { 'as': 'moonfly' }
Plug 'NLKNguyen/papercolor-theme'
call plug#end()
else
@@ -153,7 +141,6 @@ else
echohl None
endif
" Fuzzbox replaces the former Fuzzyy plugin and keeps its familiar mappings.
let g:fuzzbox_dropdown = 1
let g:fuzzbox_window_defaults = {'maxwidth': 0.8, 'maxheight': 0.8}
let g:fuzzbox_window_options = {
@@ -186,15 +173,6 @@ function! s:ToggleTree() abort
endfunction
nnoremap <silent> <leader>e :call <SID>ToggleTree()<CR>
let g:gitgutter_map_keys = 0
nnoremap <silent> <leader>gt :GitGutterBufferToggle<CR>
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <C-h> :TmuxNavigateLeft<CR>
nnoremap <silent> <C-j> :TmuxNavigateDown<CR>
nnoremap <silent> <C-k> :TmuxNavigateUp<CR>
nnoremap <silent> <C-l> :TmuxNavigateRight<CR>
let g:bufferline_echo = 0
let g:bufferline_modified = '+'
let g:bufferline_active_buffer_left = '['
@@ -247,7 +225,3 @@ augroup END
nnoremap <silent> <leader>cbg :call theme#toggleBg()<CR>
nnoremap <silent> <leader>ctb :call theme#toggleTransparent()<CR>
if has('gui_running')
set guifont=Hack\ Nerd\ Font:h13
endif
+8 -10
View File
@@ -7,7 +7,6 @@ Windows installer manages the same Vim configuration.
- Git
- Vim 9 or newer
- `curl` for the Unix installer
- Optional: tmux, zoxide, ripgrep, and a Nerd Font
## Install
@@ -15,7 +14,7 @@ Windows installer manages the same Vim configuration.
Clone the repository, then install all components:
```bash
git clone https://github.com/Donaldttt/dotfiles.git ~/.dotfiles
git clone https://git.justconn.top/gitea-admin/dotfiles.git ~/.dotfiles
~/.dotfiles/install.sh
```
@@ -27,9 +26,8 @@ Components can be installed independently and combined:
```
The installer backs up conflicting files, creates managed links, and installs
Vim plugins and TPM. It never updates an existing repository automatically and
does not install zoxide; if zoxide is already available, the managed Bash block
initializes it.
Vim plugins. It does not install zoxide; if zoxide is already available, the
managed Bash block initializes it.
On Windows, clone the repository and run:
@@ -39,8 +37,8 @@ python .\win-install.py
## Vim
The Vim setup includes Fuzzbox and NERDTree navigation, Fugitive and GitGutter,
Startify, a compact global statusline, and five color schemes.
The Vim setup includes Fuzzbox and NERDTree navigation, Startify, a compact
global statusline, and three color schemes.
Useful mappings use `,` as the leader key:
@@ -70,8 +68,8 @@ git -C ~/.dotfiles pull --ff-only
To remove managed links and the managed Bash block:
```bash
~/.dotfiles/uninstall.sh
~/.dotfiles/install.sh uninstall
```
Uninstalling intentionally retains the repository, backups, Vim data/plugins,
and TPM so user data is never removed implicitly.
Uninstalling intentionally retains the repository, backups, and Vim
data/plugins so user data is never removed implicitly.
+9 -20
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-9
View File
@@ -1,9 +0,0 @@
__dotfiles_git_prompt() {
local branch marks=''
branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) || return
git diff --no-ext-diff --quiet --ignore-submodules -- 2>/dev/null || marks+=' *'
git diff --cached --no-ext-diff --quiet --ignore-submodules -- 2>/dev/null || marks+=' +'
printf '\[\e[38;5;166m\](%s\[\e[38;5;204m\]%s\[\e[38;5;166m\])\[\e[0m\]' "$branch" "$marks"
}
PS1=' \[\e[38;5;106m\]\w\[\e[0m\]$(__dotfiles_git_prompt)\$ '
+7 -6
View File
@@ -1,7 +1,7 @@
let s:path = get(g:, 'vim_dir', expand('~/.vim')) . '/theme.json'
let s:defaults = {
\ 'background': 'dark',
\ 'dark': {'theme': 'moonfly', 'transparent': v:false},
\ 'dark': {'theme': 'everforest', 'transparent': v:false},
\ 'light': {'theme': 'PaperColor', 'transparent': v:false}}
let s:config = deepcopy(s:defaults)
let s:applying = v:false
@@ -60,11 +60,15 @@ endfunction
function! theme#apply(name) abort
let l:background = &background
let l:name = s:Available(a:name) ? a:name
\ : (l:background ==# 'dark' ? 'sunbather_dark' : 'sunbather_light')
let l:name = s:Available(a:name) ? a:name : 'sunbather'
let s:applying = v:true
try
execute 'colorscheme ' . l:name
catch
" A scheme that fails to load (for example, one that needs true color in a
" terminal without it) must not leave Vim without a color scheme. The
" saved preference is kept so the next capable session restores it.
colorscheme sunbather
finally
let s:applying = v:false
endtry
@@ -100,9 +104,6 @@ function! theme#onColorScheme(name) abort
if s:applying
return
endif
if a:name !~# '^sunbather_' && index(['everforest', 'moonfly', 'PaperColor'], a:name) < 0
return
endif
let s:config.background = &background
let s:config[&background].theme = a:name
call s:ApplyTransparency()
@@ -15,7 +15,7 @@ if exists('syntax on')
syntax reset
endif
let g:colors_name='sunbather_dark'
let g:colors_name='sunbather'
let s:black = { "gui": "#000000", "cterm": "232" }
let s:medium_gray = { "gui": "#767676", "cterm": "243" }
@@ -45,19 +45,31 @@ let s:yellow = { "gui": "#F3E430", "cterm": "11" }
let s:light_yellow = { "gui": "#ffff87", "cterm": "228" }
let s:dark_yellow = { "gui": "#A89C14", "cterm": "3" }
let s:background = 'dark'
let s:bg = s:black
let s:bg_subtle = s:lighter_black
let s:bg_very_subtle = s:subtle_black
let s:norm = s:lighter_gray
let s:norm_subtle = s:medium_gray
let s:pink = s:light_pink
let s:cyan = s:light_cyan
let s:green = s:light_green
let s:red = s:light_red
let s:visual = s:light_pink
let s:yellow = s:light_yellow
if &background ==# 'light'
let s:bg = s:actual_white
let s:bg_subtle = s:light_gray
let s:bg_very_subtle = s:lightest_gray
let s:norm = s:light_black
let s:norm_subtle = s:medium_gray
let s:pink = s:dark_pink
let s:cyan = s:dark_cyan
let s:green = s:dark_green
let s:red = s:dark_red
let s:visual = s:dark_pink
let s:yellow = s:dark_yellow
else
let s:bg = s:black
let s:bg_subtle = s:lighter_black
let s:bg_very_subtle = s:subtle_black
let s:norm = s:lighter_gray
let s:norm_subtle = s:medium_gray
let s:pink = s:light_pink
let s:cyan = s:light_cyan
let s:green = s:light_green
let s:red = s:light_red
let s:visual = s:light_pink
let s:yellow = s:light_yellow
endif
" https://github.com/noahfrederick/vim-hemisu/
function! s:h(group, style)
@@ -74,7 +86,6 @@ endfunction
call s:h("Normal", {"bg": s:bg, "fg": s:norm})
" restore &background's value in case changing Normal changed &background (:help :hi-normal-cterm)
execute "set background=" . s:background
call s:h("Cursor", {"bg": s:pink, "fg": s:norm })
call s:h("Comment", {"fg": s:bg_subtle, "gui": "italic"})
-214
View File
@@ -1,214 +0,0 @@
" Name: sunbather.vim
" Version: 0.1.0
" Maintainer: github.com/nikolvs
" License: The MIT License (MIT)
"
" A minimal pink colorscheme for Vim.
"
" Forked from paramount:
" https://github.com/owickstrom/vim-colors-paramount
"
"""
hi clear
if exists('syntax on')
syntax reset
endif
let g:colors_name='sunbather_light'
let s:black = { "gui": "#000000", "cterm": "232" }
let s:medium_gray = { "gui": "#767676", "cterm": "243" }
let s:white = { "gui": "#F1F1F1", "cterm": "15" }
let s:actual_white = { "gui": "#FFFFFF", "cterm": "231" }
let s:subtle_black = { "gui": "#121212", "cterm": "233" }
let s:light_black = { "gui": "#262626", "cterm": "235" }
let s:lighter_black = { "gui": "#4E4E4E", "cterm": "239" }
let s:light_gray = { "gui": "#A8A8A8", "cterm": "248" }
let s:lighter_gray = { "gui": "#C6C6C6", "cterm": "251" }
let s:lightest_gray = { "gui": "#EEEEEE", "cterm": "255" }
let s:dark_pink = { "gui": "#ff5f87", "cterm": "204" }
let s:light_pink = { "gui": "#d75f87", "cterm": "168" }
let s:dark_red = { "gui": "#C30771", "cterm": "1" }
let s:light_red = { "gui": "#E32791", "cterm": "1" }
let s:orange = { "gui": "#D75F5F", "cterm": "167" }
let s:darker_blue = { "gui": "#005F87", "cterm": "18" }
let s:dark_blue = { "gui": "#008EC4", "cterm": "32" }
let s:blue = { "gui": "#20BBFC", "cterm": "12" }
let s:light_blue = { "gui": "#b6d6fd", "cterm": "153" }
let s:dark_cyan = { "gui": "#20A5BA", "cterm": "6" }
let s:light_cyan = { "gui": "#4FB8CC", "cterm": "14" }
let s:dark_green = { "gui": "#10A778", "cterm": "2" }
let s:light_green = { "gui": "#5FD7A7", "cterm": "10" }
let s:light_purple = { "gui": "#a790d5", "cterm": "140" }
let s:yellow = { "gui": "#F3E430", "cterm": "11" }
let s:light_yellow = { "gui": "#ffff87", "cterm": "228" }
let s:dark_yellow = { "gui": "#A89C14", "cterm": "3" }
let s:background = 'light'
let s:bg = s:actual_white
let s:bg_subtle = s:light_gray
let s:bg_very_subtle = s:lightest_gray
let s:norm = s:light_black
let s:norm_subtle = s:medium_gray
let s:pink = s:dark_pink
let s:cyan = s:dark_cyan
let s:green = s:dark_green
let s:red = s:dark_red
let s:visual = s:dark_pink
let s:yellow = s:dark_yellow
" https://github.com/noahfrederick/vim-hemisu/
function! s:h(group, style)
execute "highlight" a:group
\ "guifg=" (has_key(a:style, "fg") ? a:style.fg.gui : "NONE")
\ "guibg=" (has_key(a:style, "bg") ? a:style.bg.gui : "NONE")
\ "guisp=" (has_key(a:style, "sp") ? a:style.sp.gui : "NONE")
\ "gui=" (has_key(a:style, "gui") ? a:style.gui : "NONE")
\ "ctermfg=" (has_key(a:style, "fg") ? a:style.fg.cterm : "NONE")
\ "ctermbg=" (has_key(a:style, "bg") ? a:style.bg.cterm : "NONE")
\ "cterm=" (has_key(a:style, "cterm") ? a:style.cterm : "NONE")
endfunction
call s:h("Normal", {"bg": s:bg, "fg": s:norm})
" restore &background's value in case changing Normal changed &background (:help :hi-normal-cterm)
execute "set background=" . s:background
call s:h("Cursor", {"bg": s:pink, "fg": s:norm })
call s:h("Comment", {"fg": s:bg_subtle, "gui": "italic"})
call s:h("Constant", {"fg": s:pink})
hi! link Character Constant
hi! link Number Constant
hi! link Boolean Constant
hi! link Float Constant
hi! link String Constant
"call s:h("Identifier", {"fg": s:dark_blue})
hi! link Identifier Normal
hi! link Function Identifier
call s:h("Statement", {"fg": s:norm_subtle})
hi! link Conditonal Statement
hi! link Repeat Statement
hi! link Label Statement
hi! link Keyword Statement
hi! link Exception Statement
call s:h("Operator", {"fg": s:norm, "cterm": "bold", "gui": "bold"})
call s:h("PreProc", {"fg": s:norm_subtle})
hi! link Include PreProc
hi! link Define PreProc
hi! link Macro PreProc
hi! link PreCondit PreProc
call s:h("Type", {"fg": s:norm})
hi! link StorageClass Type
hi! link Structure Type
hi! link Typedef Type
call s:h("Special", {"fg": s:norm_subtle, "gui": "italic"})
hi! link SpecialChar Special
hi! link Tag Special
hi! link Delimiter Special
hi! link SpecialComment Special
hi! link Debug Special
call s:h("Underlined", {"fg": s:norm, "gui": "underline", "cterm": "underline"})
call s:h("Ignore", {"fg": s:bg})
call s:h("Error", {"fg": s:actual_white, "bg": s:red, "cterm": "bold"})
call s:h("Todo", {"fg": s:pink, "gui": "underline", "cterm": "underline"})
call s:h("SpecialKey", {"fg": s:light_green})
call s:h("NonText", {"fg": s:medium_gray})
call s:h("Directory", {"fg": s:dark_blue})
call s:h("ErrorMsg", {"fg": s:red})
call s:h("IncSearch", {"bg": s:yellow, "fg": s:light_black})
call s:h("Search", {"bg": s:light_green, "fg": s:light_black})
call s:h("MoreMsg", {"fg": s:medium_gray, "cterm": "bold", "gui": "bold"})
hi! link ModeMsg MoreMsg
call s:h("LineNr", {"fg": s:bg_subtle})
call s:h("CursorLineNr", {"fg": s:pink, "bg": s:bg_very_subtle})
call s:h("Question", {"fg": s:red})
call s:h("StatusLine", {"bg": s:bg_very_subtle})
call s:h("StatusLineNC", {"bg": s:bg_very_subtle, "fg": s:medium_gray})
call s:h("VertSplit", {"bg": s:bg_very_subtle, "fg": s:bg_very_subtle})
call s:h("Title", {"fg": s:dark_blue})
call s:h("Visual", {"fg": s:norm, "bg": s:visual})
call s:h("VisualNOS", {"bg": s:bg_subtle})
call s:h("WarningMsg", {"fg": s:yellow})
call s:h("WildMenu", {"fg": s:bg, "bg": s:norm})
call s:h("Folded", {"fg": s:medium_gray})
call s:h("FoldColumn", {"fg": s:bg_subtle})
call s:h("DiffAdd", {"fg": s:green})
call s:h("DiffDelete", {"fg": s:red})
call s:h("DiffChange", {"fg": s:dark_yellow})
call s:h("DiffText", {"fg": s:dark_blue})
call s:h("SignColumn", {"fg": s:light_green})
if has("gui_running")
call s:h("SpellBad", {"gui": "underline", "sp": s:red})
call s:h("SpellCap", {"gui": "underline", "sp": s:light_green})
call s:h("SpellRare", {"gui": "underline", "sp": s:light_purple})
call s:h("SpellLocal", {"gui": "underline", "sp": s:dark_green})
else
call s:h("SpellBad", {"cterm": "underline", "fg": s:red})
call s:h("SpellCap", {"cterm": "underline", "fg": s:light_green})
call s:h("SpellRare", {"cterm": "underline", "fg": s:light_purple})
call s:h("SpellLocal", {"cterm": "underline", "fg": s:dark_green})
endif
call s:h("Pmenu", {"fg": s:norm, "bg": s:bg_very_subtle})
call s:h("PmenuSel", {"fg": s:subtle_black, "bg": s:pink})
call s:h("PmenuSbar", {"fg": s:norm, "bg": s:bg_subtle})
call s:h("PmenuThumb", {"fg": s:norm, "bg": s:bg_subtle})
call s:h("TabLine", {"fg": s:norm, "bg": s:bg_very_subtle})
call s:h("TabLineSel", {"fg": s:subtle_black, "bg": s:pink, "gui": "bold", "cterm": "bold"})
call s:h("TabLineFill", {"fg": s:norm, "bg": s:bg_very_subtle})
call s:h("CursorColumn", {"bg": s:bg_very_subtle})
call s:h("CursorLine", {"bg": s:bg_very_subtle})
call s:h("ColorColumn", {"bg": s:bg_subtle})
call s:h("MatchParen", {"bg": s:bg_subtle, "fg": s:norm})
call s:h("qfLineNr", {"fg": s:medium_gray})
call s:h("htmlH1", {"bg": s:bg, "fg": s:norm})
call s:h("htmlH2", {"bg": s:bg, "fg": s:norm})
call s:h("htmlH3", {"bg": s:bg, "fg": s:norm})
call s:h("htmlH4", {"bg": s:bg, "fg": s:norm})
call s:h("htmlH5", {"bg": s:bg, "fg": s:norm})
call s:h("htmlH6", {"bg": s:bg, "fg": s:norm})
" Syntastic
call s:h("SyntasticWarningSign", {"fg": s:yellow})
call s:h("SyntasticWarning", {"bg": s:yellow, "fg": s:black, "gui": "bold", "cterm": "bold"})
call s:h("SyntasticErrorSign", {"fg": s:red})
call s:h("SyntasticError", {"bg": s:red, "fg": s:white, "gui": "bold", "cterm": "bold"})
" which-key.nvim
call s:h("WhichKey", {"bg": s:bg, "fg": s:pink, "gui": "bold", "cterm": "bold"})
call s:h("WhichKeyDesc", {"bg": s:bg, "fg": s:norm_subtle, "gui": "bold", "cterm": "bold"})
call s:h("WhichKeySeparator", {"bg": s:bg, "fg": s:norm, "gui": "bold", "cterm": "bold"})
call s:h("WhichKeyFloat", {"bg": s:bg})
hi link WhichKeyGroup WhichKey
" Neomake
hi link NeomakeWarningSign SyntasticWarningSign
hi link NeomakeErrorSign SyntasticErrorSign
" ALE
hi link ALEWarningSign SyntasticWarningSign
hi link ALEErrorSign SyntasticErrorSign
" Signify, git-gutter
hi link SignifySignAdd LineNr
hi link SignifySignDelete LineNr
hi link SignifySignChange LineNr
hi link GitGutterAdd LineNr
hi link GitGutterDelete LineNr
hi link GitGutterChange LineNr
hi link GitGutterChangeDelete LineNr
+33 -45
View File
@@ -2,17 +2,7 @@
set -Eeuo pipefail
readonly APP_NAME='dotfiles'
readonly REPO_URI="${REPO_URI:-https://github.com/Donaldttt/dotfiles.git}"
readonly REPO_BRANCH="${REPO_BRANCH:-main}"
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" 2>/dev/null && pwd -P || true)"
if [[ -n "$SCRIPT_DIR" && -e "$SCRIPT_DIR/.git" ]]; then
APP_PATH="${APP_PATH:-$SCRIPT_DIR}"
else
APP_PATH="${APP_PATH:-$HOME/.$APP_NAME}"
fi
readonly APP_PATH
readonly APP_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
readonly VIM_PATH="${VIM_PATH:-$HOME/.vim}"
readonly MANAGED_START='# >>> dotfiles >>>'
readonly MANAGED_END='# <<< dotfiles <<<'
@@ -23,28 +13,18 @@ warn() { printf '\033[33m[!]\033[0m %s\n' "$*" >&2; }
die() { printf '\033[31m[✘]\033[0m %s\n' "$*" >&2; exit 1; }
usage() {
cat <<'EOF'
Usage: ./install.sh [all|vim|shell|tmux]...
cat <<'USAGE'
Usage: ./install.sh [all|vim|shell|tmux|uninstall]...
With no arguments, installs every component. Components can be combined, for
example: ./install.sh vim tmux
EOF
USAGE
}
require() {
command -v "$1" >/dev/null 2>&1 || die "Required program not found: $1"
}
ensure_repo() {
require git
if [[ -d "$APP_PATH/.git" ]]; then
return
fi
[[ ! -e "$APP_PATH" ]] || die "$APP_PATH exists but is not a Git repository."
info "Cloning $REPO_URI into $APP_PATH"
git clone --branch "$REPO_BRANCH" --depth 1 "$REPO_URI" "$APP_PATH"
}
backup_path() {
local target=$1
if [[ -e "$target" || -L "$target" ]]; then
@@ -59,19 +39,26 @@ backup_path() {
}
link_config() {
local source=$1 target=$2 current=''
if [[ -L "$target" ]]; then
current=$(readlink "$target" || true)
[[ "$current" == "$source" ]] && return
local source=$1 target=$2
if [[ -L "$target" && "$(readlink "$target" || true)" == "$source" ]]; then
return
fi
backup_path "$target"
ln -s "$source" "$target"
success "Linked $target -> $source"
}
remove_managed_link() {
local target=$1 expected=$2
if [[ -L "$target" && "$(readlink "$target")" == "$expected" ]]; then
rm -- "$target"
info "Removed $target"
fi
}
remove_managed_block() {
local file=$1 temp
[[ -f "$file" ]] || return
[[ -f "$file" ]] || return 0
temp=$(mktemp)
awk -v start="$MANAGED_START" -v end="$MANAGED_END" '
$0 == start { managed = 1; next }
@@ -84,22 +71,21 @@ remove_managed_block() {
install_vim() {
require vim
require curl
require git
if ! vim --clean -Nu NONE -n -es \
'+if v:version < 900 | cquit | endif' '+qall'; then
die 'Vim 9 or newer is required.'
fi
link_config "$APP_PATH/.vimrc" "$HOME/.vimrc"
mkdir -p "$VIM_PATH/autoload"
local temp
temp=$(mktemp)
curl --fail --location --silent --show-error \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim \
--output "$temp"
mv "$temp" "$VIM_PATH/autoload/plug.vim"
temp=$(mktemp -d)
git clone --depth 1 --quiet https://github.com/junegunn/vim-plug "$temp"
cp "$temp/plug.vim" "$VIM_PATH/autoload/plug.vim"
rm -rf "$temp"
link_config "$APP_PATH/.vimrc" "$HOME/.vimrc"
vim -Nu "$APP_PATH/.vimrc" -n -es \
'+set nomore' '+PlugInstall --sync' '+qall'
--cmd 'set nomore' '+PlugInstall --sync' '+qall'
success 'Installed Vim configuration and plugins.'
}
@@ -120,13 +106,15 @@ install_shell() {
install_tmux() {
require tmux
link_config "$APP_PATH/.tmux.conf" "$HOME/.tmux.conf"
local tpm="$HOME/.tmux/plugins/tpm"
if [[ ! -d "$tpm/.git" ]]; then
[[ ! -e "$tpm" ]] || die "$tpm exists but is not a Git repository."
mkdir -p "$(dirname "$tpm")"
git clone --depth 1 https://github.com/tmux-plugins/tpm "$tpm"
fi
success 'Installed tmux configuration and TPM.'
success 'Installed tmux configuration.'
}
uninstall() {
remove_managed_link "$HOME/.vimrc" "$APP_PATH/.vimrc"
remove_managed_link "$HOME/.tmux.conf" "$APP_PATH/.tmux.conf"
remove_managed_block "$HOME/.bashrc"
success 'Removed dotfile links and the managed Bash block.'
info 'The repository, Vim data/plugins, and backups were retained.'
}
main() {
@@ -134,7 +122,6 @@ main() {
-h|--help) usage; return ;;
esac
ensure_repo
local components=("$@") component
((${#components[@]})) || components=(all)
for component in "${components[@]}"; do
@@ -147,6 +134,7 @@ main() {
vim) install_vim ;;
shell) install_shell ;;
tmux) install_tmux ;;
uninstall) uninstall ;;
*) usage; die "Unknown component: $component" ;;
esac
done
-41
View File
@@ -1,41 +0,0 @@
#!/usr/bin/env bash
set -Eeuo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" 2>/dev/null && pwd -P || true)"
if [[ -n "$SCRIPT_DIR" && -e "$SCRIPT_DIR/.git" ]]; then
APP_PATH="${APP_PATH:-$SCRIPT_DIR}"
else
APP_PATH="${APP_PATH:-$HOME/.dotfiles}"
fi
readonly APP_PATH
readonly MANAGED_START='# >>> dotfiles >>>'
readonly MANAGED_END='# <<< dotfiles <<<'
remove_managed_link() {
local target=$1 expected=$2
if [[ -L "$target" && "$(readlink "$target")" == "$expected" ]]; then
rm -- "$target"
printf 'Removed %s\n' "$target"
fi
}
remove_managed_block() {
local file=$1 temp
[[ -f "$file" ]] || return
temp=$(mktemp)
awk -v start="$MANAGED_START" -v end="$MANAGED_END" '
$0 == start { managed = 1; next }
$0 == end { managed = 0; next }
!managed { print }
' "$file" > "$temp"
cat "$temp" > "$file"
rm -f "$temp"
}
remove_managed_link "$HOME/.vimrc" "$APP_PATH/.vimrc"
remove_managed_link "$HOME/.tmux.conf" "$APP_PATH/.tmux.conf"
remove_managed_block "$HOME/.bashrc"
printf '%s\n' 'Dotfile links and the managed Bash block were removed.'
printf '%s\n' 'The repository, Vim data/plugins, TPM, and backups were retained.'
+8 -34
View File
@@ -1,18 +1,14 @@
"""Install the Vim 9 configuration on Windows."""
from pathlib import Path
from shutil import which
from shutil import copyfile, which
import subprocess
import tempfile
import time
import urllib.request
HOME = Path.home()
SCRIPT_PATH = Path(__file__).resolve().parent
DEFAULT_APP_PATH = HOME / ".dotfiles"
APP_PATH = SCRIPT_PATH if (SCRIPT_PATH / ".git").exists() else DEFAULT_APP_PATH
REPO_URL = "https://github.com/Donaldttt/dotfiles.git"
REPO_BRANCH = "main"
APP_PATH = Path(__file__).resolve().parent
VIM_PATH = HOME / "vimfiles"
VIMRC = HOME / "_vimrc"
@@ -26,26 +22,6 @@ def require(program):
raise SystemExit(f"Error: {program} must be installed.")
def ensure_repo():
if (APP_PATH / ".git").exists():
return
if APP_PATH.exists():
raise SystemExit(f"Error: {APP_PATH} exists but is not a Git repository.")
print(f"Cloning dotfiles into {APP_PATH}...")
run(
[
"git",
"clone",
"--branch",
REPO_BRANCH,
"--depth",
"1",
REPO_URL,
str(APP_PATH),
]
)
def check_vim_version():
result = subprocess.run(
["vim", "--clean", "-Nu", "NONE", "-n", "-es", "+if v:version < 900 | cquit | endif", "+qall"]
@@ -57,10 +33,9 @@ def check_vim_version():
def install_vim_plug():
target = VIM_PATH / "autoload" / "plug.vim"
target.parent.mkdir(parents=True, exist_ok=True)
urllib.request.urlretrieve(
"https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim",
target,
)
with tempfile.TemporaryDirectory() as temp:
run(["git", "clone", "--depth", "1", "--quiet", "https://github.com/junegunn/vim-plug", temp])
copyfile(Path(temp) / "plug.vim", target)
def install_vimrc():
@@ -77,10 +52,9 @@ def main():
require("git")
require("vim")
check_vim_version()
ensure_repo()
install_vimrc()
install_vim_plug()
run(["vim", "-Nu", str(APP_PATH / ".vimrc"), "+set nomore", "+PlugInstall --sync", "+qall"])
install_vimrc()
run(["vim", "-Nu", str(APP_PATH / ".vimrc"), "-n", "-es", "--cmd", "set nomore", "+PlugInstall --sync", "+qall"])
print("Vim configuration installed.")