diff --git a/.editorconfig b/.editorconfig index 6a462a3..71843fb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index aa7cd17..a7baf64 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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 diff --git a/.gitignore b/.gitignore index b51535b..aa82804 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,2 @@ .DS_Store -*.pyc -__pycache__/ -*._* -.vim/ -node_modules/ -tags .netrwhist -.vimspector.json -*.log diff --git a/.tmux.conf b/.tmux.conf index db30a53..5406f1b 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -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"' diff --git a/.vimrc b/.vimrc index f2b818d..37b591c 100644 --- a/.vimrc +++ b/.vimrc @@ -7,13 +7,9 @@ endif let g:dotfiledir = fnamemodify(resolve(expand(':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 e :call ToggleTree() -let g:gitgutter_map_keys = 0 -nnoremap gt :GitGutterBufferToggle - -let g:tmux_navigator_no_mappings = 1 -nnoremap :TmuxNavigateLeft -nnoremap :TmuxNavigateDown -nnoremap :TmuxNavigateUp -nnoremap :TmuxNavigateRight - let g:bufferline_echo = 0 let g:bufferline_modified = '+' let g:bufferline_active_buffer_left = '[' @@ -247,7 +225,3 @@ augroup END nnoremap cbg :call theme#toggleBg() nnoremap ctb :call theme#toggleTransparent() - -if has('gui_running') - set guifont=Hack\ Nerd\ Font:h13 -endif diff --git a/README.md b/README.md index 4251d1d..6a000a3 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/bash_tools.sh b/bash_tools.sh index cd14a7e..72d67ae 100644 --- a/bash_tools.sh +++ b/bash_tools.sh @@ -1,8 +1,6 @@ # Bash-only interactive shell helpers. [[ -n ${BASH_VERSION:-} ]] || return 0 -DOTFILE_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" - export EDITOR='vim' export VISUAL="$EDITOR" case ":$PATH:" in @@ -10,29 +8,20 @@ case ":$PATH:" in *) export PATH="$PATH:$HOME/.local/bin" ;; esac -# shellcheck source=bash_tools/theme_bash.sh -source "$DOTFILE_DIR/bash_tools/theme_bash.sh" -# shellcheck source=bash_tools/ls_colors_theme.sh -source "$DOTFILE_DIR/bash_tools/ls_colors_theme.sh" - if ls --color=auto -d . >/dev/null 2>&1; then alias ls='ls --color=auto' elif [[ $OSTYPE == darwin* ]]; then alias ls='ls -G' fi -# Search for a literal string. Usage: fct -fct() { - (($# == 2)) || { printf 'Usage: fct \n' >&2; return 2; } - if command -v rg >/dev/null 2>&1; then - rg -n --fixed-strings -- "$2" "$1" - else - grep -Rnw -- "$1" -e "$2" - fi +__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)\$ ' -# Query dict.org. Usage: odict -odict() { - (($# == 1)) || { printf 'Usage: odict \n' >&2; return 2; } - curl --fail --silent --show-error "dict://dict.org/d:$1" -} + +export LS_COLORS="sg=0:ca=0:tw=0:*~=0;38;2;102;102;102:so=0;38;2;0;0;0;48;2;255;106;193:ex=1;38;2;255;92;87:ln=0;38;2;255;106;193:pi=0;38;2;0;0;0;48;2;87;199;255:di=0;38;2;87;199;255:mi=0;38;2;0;0;0;48;2;255;92;87:mh=0:fi=0:do=0;38;2;0;0;0;48;2;255;106;193:no=0:cd=0;38;2;255;106;193;48;2;51;51;51:rs=0:st=0:su=0:or=0;38;2;0;0;0;48;2;255;92;87:ow=0:bd=0;38;2;154;237;254;48;2;51;51;51:*.t=0;38;2;90;247;142:*.p=0;38;2;90;247;142:*.o=0;38;2;102;102;102:*.a=1;38;2;255;92;87:*.z=4;38;2;154;237;254:*.c=0;38;2;90;247;142:*.d=0;38;2;90;247;142:*.h=0;38;2;90;247;142:*.r=0;38;2;90;247;142:*.m=0;38;2;90;247;142:*.7z=4;38;2;154;237;254:*.hh=0;38;2;90;247;142:*.jl=0;38;2;90;247;142:*.bz=4;38;2;154;237;254:*.md=0;38;2;243;249;157:*.pm=0;38;2;90;247;142:*.di=0;38;2;90;247;142:*.kt=0;38;2;90;247;142:*.ts=0;38;2;90;247;142:*.ll=0;38;2;90;247;142:*.js=0;38;2;90;247;142:*.ko=1;38;2;255;92;87:*css=0;38;2;90;247;142:*.go=0;38;2;90;247;142:*.ex=0;38;2;90;247;142:*.py=0;38;2;90;247;142:*.wv=0;38;2;255;180;223:*.gz=4;38;2;154;237;254:*.nb=0;38;2;90;247;142:*.pl=0;38;2;90;247;142:*.cs=0;38;2;90;247;142:*.cr=0;38;2;90;247;142:*.ml=0;38;2;90;247;142:*.pp=0;38;2;90;247;142:*.so=1;38;2;255;92;87:*.gv=0;38;2;90;247;142:*.rb=0;38;2;90;247;142:*.cc=0;38;2;90;247;142:*.ps=0;38;2;255;92;87:*.la=0;38;2;102;102;102:*.xz=4;38;2;154;237;254:*.as=0;38;2;90;247;142:*.rs=0;38;2;90;247;142:*.rm=0;38;2;255;180;223:*.cp=0;38;2;90;247;142:*.lo=0;38;2;102;102;102:*.vb=0;38;2;90;247;142:*.mn=0;38;2;90;247;142:*.fs=0;38;2;90;247;142:*.el=0;38;2;90;247;142:*.td=0;38;2;90;247;142:*.hi=0;38;2;102;102;102:*.bc=0;38;2;102;102;102:*.sh=0;38;2;90;247;142:*.hs=0;38;2;90;247;142:*.ui=0;38;2;243;249;157:*.vim=0;38;2;90;247;142:*.rar=4;38;2;154;237;254:*.pkg=4;38;2;154;237;254:*.bcf=0;38;2;102;102;102:*.php=0;38;2;90;247;142:*.otf=0;38;2;255;180;223:*.bst=0;38;2;243;249;157:*.kts=0;38;2;90;247;142:*.ipp=0;38;2;90;247;142:*.mp3=0;38;2;255;180;223:*.pdf=0;38;2;255;92;87:*.mid=0;38;2;255;180;223:*.vcd=4;38;2;154;237;254:*.sql=0;38;2;90;247;142:*.csv=0;38;2;243;249;157:*.m4v=0;38;2;255;180;223:*.bin=4;38;2;154;237;254:*.img=4;38;2;154;237;254:*.git=0;38;2;102;102;102:*.ogg=0;38;2;255;180;223:*.exs=0;38;2;90;247;142:*.fls=0;38;2;102;102;102:*.jpg=0;38;2;255;180;223:*.bz2=4;38;2;154;237;254:*.xmp=0;38;2;243;249;157:*.toc=0;38;2;102;102;102:*.ltx=0;38;2;90;247;142:*.tml=0;38;2;243;249;157:*.yml=0;38;2;243;249;157:*.log=0;38;2;102;102;102:*.xls=0;38;2;255;92;87:*.h++=0;38;2;90;247;142:*.tgz=4;38;2;154;237;254:*.cxx=0;38;2;90;247;142:*.cpp=0;38;2;90;247;142:*.dpr=0;38;2;90;247;142:*.pbm=0;38;2;255;180;223:*.com=1;38;2;255;92;87:*.bbl=0;38;2;102;102;102:*.ini=0;38;2;243;249;157:*.sxi=0;38;2;255;92;87:*.bak=0;38;2;102;102;102:*.htc=0;38;2;90;247;142:*.lua=0;38;2;90;247;142:*.mli=0;38;2;90;247;142:*.pyc=0;38;2;102;102;102:*.mpg=0;38;2;255;180;223:*.c++=0;38;2;90;247;142:*.tmp=0;38;2;102;102;102:*.blg=0;38;2;102;102;102:*.aif=0;38;2;255;180;223:*.erl=0;38;2;90;247;142:*.sxw=0;38;2;255;92;87:*.zsh=0;38;2;90;247;142:*.pyd=0;38;2;102;102;102:*.bat=1;38;2;255;92;87:*.fon=0;38;2;255;180;223:*.htm=0;38;2;243;249;157:*.swp=0;38;2;102;102;102:*.doc=0;38;2;255;92;87:*.ics=0;38;2;255;92;87:*.pas=0;38;2;90;247;142:*.dmg=4;38;2;154;237;254:*.pid=0;38;2;102;102;102:*.ods=0;38;2;255;92;87:*.tif=0;38;2;255;180;223:*.hxx=0;38;2;90;247;142:*.rpm=4;38;2;154;237;254:*.pyo=0;38;2;102;102;102:*.png=0;38;2;255;180;223:*.txt=0;38;2;243;249;157:*.dox=0;38;2;165;255;195:*.fnt=0;38;2;255;180;223:*.avi=0;38;2;255;180;223:*.tex=0;38;2;90;247;142:*.nix=0;38;2;243;249;157:*.flv=0;38;2;255;180;223:*.ps1=0;38;2;90;247;142:*.ico=0;38;2;255;180;223:*.odp=0;38;2;255;92;87:*.def=0;38;2;90;247;142:*.tsx=0;38;2;90;247;142:*.hpp=0;38;2;90;247;142:*.epp=0;38;2;90;247;142:*.idx=0;38;2;102;102;102:*.mp4=0;38;2;255;180;223:*.psd=0;38;2;255;180;223:*.dll=1;38;2;255;92;87:*.tbz=4;38;2;154;237;254:*.pgm=0;38;2;255;180;223:*.tcl=0;38;2;90;247;142:*.fsi=0;38;2;90;247;142:*.ind=0;38;2;102;102;102:*.iso=4;38;2;154;237;254:*.rtf=0;38;2;255;92;87:*.bsh=0;38;2;90;247;142:*.apk=4;38;2;154;237;254:*.clj=0;38;2;90;247;142:*.wma=0;38;2;255;180;223:*.jar=4;38;2;154;237;254:*.ttf=0;38;2;255;180;223:*.tar=4;38;2;154;237;254:*.cfg=0;38;2;243;249;157:*.sbt=0;38;2;90;247;142:*.bag=4;38;2;154;237;254:*.mir=0;38;2;90;247;142:*.gif=0;38;2;255;180;223:*.rst=0;38;2;243;249;157:*.zst=4;38;2;154;237;254:*.deb=4;38;2;154;237;254:*.svg=0;38;2;255;180;223:*.inl=0;38;2;90;247;142:*.exe=1;38;2;255;92;87:*.aux=0;38;2;102;102;102:*.mkv=0;38;2;255;180;223:*.m4a=0;38;2;255;180;223:*hgrc=0;38;2;165;255;195:*.fsx=0;38;2;90;247;142:*.ppt=0;38;2;255;92;87:*.gvy=0;38;2;90;247;142:*.eps=0;38;2;255;180;223:*.pps=0;38;2;255;92;87:*.odt=0;38;2;255;92;87:*.out=0;38;2;102;102;102:*.xlr=0;38;2;255;92;87:*.bmp=0;38;2;255;180;223:*.kex=0;38;2;255;92;87:*.elm=0;38;2;90;247;142:*.wmv=0;38;2;255;180;223:*.sty=0;38;2;102;102;102:*.pod=0;38;2;90;247;142:*TODO=1:*.asa=0;38;2;90;247;142:*.inc=0;38;2;90;247;142:*.pro=0;38;2;165;255;195:*.ilg=0;38;2;102;102;102:*.bib=0;38;2;243;249;157:*.vob=0;38;2;255;180;223:*.csx=0;38;2;90;247;142:*.zip=4;38;2;154;237;254:*.wav=0;38;2;255;180;223:*.dot=0;38;2;90;247;142:*.xcf=0;38;2;255;180;223:*.cgi=0;38;2;90;247;142:*.mov=0;38;2;255;180;223:*.ppm=0;38;2;255;180;223:*.arj=4;38;2;154;237;254:*.swf=0;38;2;255;180;223:*.xml=0;38;2;243;249;157:*.awk=0;38;2;90;247;142:*.webm=0;38;2;255;180;223:*.docx=0;38;2;255;92;87:*.psm1=0;38;2;90;247;142:*.html=0;38;2;243;249;157:*.yaml=0;38;2;243;249;157:*.mpeg=0;38;2;255;180;223:*.java=0;38;2;90;247;142:*.rlib=0;38;2;102;102;102:*.orig=0;38;2;102;102;102:*.dart=0;38;2;90;247;142:*.fish=0;38;2;90;247;142:*.flac=0;38;2;255;180;223:*.psd1=0;38;2;90;247;142:*.conf=0;38;2;243;249;157:*.pptx=0;38;2;255;92;87:*.json=0;38;2;243;249;157:*.less=0;38;2;90;247;142:*.bash=0;38;2;90;247;142:*.tbz2=4;38;2;154;237;254:*.xlsx=0;38;2;255;92;87:*.epub=0;38;2;255;92;87:*.lock=0;38;2;102;102;102:*.tiff=0;38;2;255;180;223:*.make=0;38;2;165;255;195:*.toml=0;38;2;243;249;157:*.h264=0;38;2;255;180;223:*.opus=0;38;2;255;180;223:*.diff=0;38;2;90;247;142:*.jpeg=0;38;2;255;180;223:*.lisp=0;38;2;90;247;142:*.purs=0;38;2;90;247;142:*.hgrc=0;38;2;165;255;195:*.swift=0;38;2;90;247;142:*.mdown=0;38;2;243;249;157:*shadow=0;38;2;243;249;157:*.cache=0;38;2;102;102;102:*.cabal=0;38;2;90;247;142:*.shtml=0;38;2;243;249;157:*.dyn_o=0;38;2;102;102;102:*.toast=4;38;2;154;237;254:*README=0;38;2;40;42;54;48;2;243;249;157:*.class=0;38;2;102;102;102:*.scala=0;38;2;90;247;142:*.cmake=0;38;2;165;255;195:*.ipynb=0;38;2;90;247;142:*.patch=0;38;2;90;247;142:*.xhtml=0;38;2;243;249;157:*passwd=0;38;2;243;249;157:*.gradle=0;38;2;90;247;142:*.config=0;38;2;243;249;157:*.dyn_hi=0;38;2;102;102;102:*.flake8=0;38;2;165;255;195:*.groovy=0;38;2;90;247;142:*.ignore=0;38;2;165;255;195:*TODO.md=1:*COPYING=0;38;2;153;153;153:*INSTALL=0;38;2;40;42;54;48;2;243;249;157:*LICENSE=0;38;2;153;153;153:*.matlab=0;38;2;90;247;142:*.gemspec=0;38;2;165;255;195:*Doxyfile=0;38;2;165;255;195:*setup.py=0;38;2;165;255;195:*.desktop=0;38;2;243;249;157:*TODO.txt=1:*Makefile=0;38;2;165;255;195:*.rgignore=0;38;2;165;255;195:*COPYRIGHT=0;38;2;153;153;153:*.DS_Store=0;38;2;102;102;102:*.fdignore=0;38;2;165;255;195:*README.md=0;38;2;40;42;54;48;2;243;249;157:*configure=0;38;2;165;255;195:*.kdevelop=0;38;2;165;255;195:*.cmake.in=0;38;2;165;255;195:*.markdown=0;38;2;243;249;157:*.localized=0;38;2;102;102;102:*SConstruct=0;38;2;165;255;195:*.scons_opt=0;38;2;102;102;102:*CODEOWNERS=0;38;2;165;255;195:*.gitignore=0;38;2;165;255;195:*INSTALL.md=0;38;2;40;42;54;48;2;243;249;157:*README.txt=0;38;2;40;42;54;48;2;243;249;157:*.gitconfig=0;38;2;165;255;195:*SConscript=0;38;2;165;255;195:*Dockerfile=0;38;2;243;249;157:*Makefile.in=0;38;2;102;102;102:*INSTALL.txt=0;38;2;40;42;54;48;2;243;249;157:*.gitmodules=0;38;2;165;255;195:*MANIFEST.in=0;38;2;165;255;195:*LICENSE-MIT=0;38;2;153;153;153:*Makefile.am=0;38;2;165;255;195:*.travis.yml=0;38;2;90;247;142:*.synctex.gz=0;38;2;102;102;102:*CONTRIBUTORS=0;38;2;40;42;54;48;2;243;249;157:*appveyor.yml=0;38;2;90;247;142:*.fdb_latexmk=0;38;2;102;102;102:*.applescript=0;38;2;90;247;142:*configure.ac=0;38;2;165;255;195:*.clang-format=0;38;2;165;255;195:*LICENSE-APACHE=0;38;2;153;153;153:*.gitattributes=0;38;2;165;255;195:*CMakeLists.txt=0;38;2;165;255;195:*CMakeCache.txt=0;38;2;102;102;102:*CONTRIBUTORS.md=0;38;2;40;42;54;48;2;243;249;157:*requirements.txt=0;38;2;165;255;195:*CONTRIBUTORS.txt=0;38;2;40;42;54;48;2;243;249;157:*.sconsign.dblite=0;38;2;102;102;102:*package-lock.json=0;38;2;102;102;102:*.CFUserTextEncoding=0;38;2;102;102;102" diff --git a/bash_tools/ls_colors_theme.sh b/bash_tools/ls_colors_theme.sh deleted file mode 100644 index cc40888..0000000 --- a/bash_tools/ls_colors_theme.sh +++ /dev/null @@ -1,3 +0,0 @@ -# https://github.com/sharkdp/vivid - -export LS_COLORS="sg=0:ca=0:tw=0:*~=0;38;2;102;102;102:so=0;38;2;0;0;0;48;2;255;106;193:ex=1;38;2;255;92;87:ln=0;38;2;255;106;193:pi=0;38;2;0;0;0;48;2;87;199;255:di=0;38;2;87;199;255:mi=0;38;2;0;0;0;48;2;255;92;87:mh=0:fi=0:do=0;38;2;0;0;0;48;2;255;106;193:no=0:cd=0;38;2;255;106;193;48;2;51;51;51:rs=0:st=0:su=0:or=0;38;2;0;0;0;48;2;255;92;87:ow=0:bd=0;38;2;154;237;254;48;2;51;51;51:*.t=0;38;2;90;247;142:*.p=0;38;2;90;247;142:*.o=0;38;2;102;102;102:*.a=1;38;2;255;92;87:*.z=4;38;2;154;237;254:*.c=0;38;2;90;247;142:*.d=0;38;2;90;247;142:*.h=0;38;2;90;247;142:*.r=0;38;2;90;247;142:*.m=0;38;2;90;247;142:*.7z=4;38;2;154;237;254:*.hh=0;38;2;90;247;142:*.jl=0;38;2;90;247;142:*.bz=4;38;2;154;237;254:*.md=0;38;2;243;249;157:*.pm=0;38;2;90;247;142:*.di=0;38;2;90;247;142:*.kt=0;38;2;90;247;142:*.ts=0;38;2;90;247;142:*.ll=0;38;2;90;247;142:*.js=0;38;2;90;247;142:*.ko=1;38;2;255;92;87:*css=0;38;2;90;247;142:*.go=0;38;2;90;247;142:*.ex=0;38;2;90;247;142:*.py=0;38;2;90;247;142:*.wv=0;38;2;255;180;223:*.gz=4;38;2;154;237;254:*.nb=0;38;2;90;247;142:*.pl=0;38;2;90;247;142:*.cs=0;38;2;90;247;142:*.cr=0;38;2;90;247;142:*.ml=0;38;2;90;247;142:*.pp=0;38;2;90;247;142:*.so=1;38;2;255;92;87:*.gv=0;38;2;90;247;142:*.rb=0;38;2;90;247;142:*.cc=0;38;2;90;247;142:*.ps=0;38;2;255;92;87:*.la=0;38;2;102;102;102:*.xz=4;38;2;154;237;254:*.as=0;38;2;90;247;142:*.rs=0;38;2;90;247;142:*.rm=0;38;2;255;180;223:*.cp=0;38;2;90;247;142:*.lo=0;38;2;102;102;102:*.vb=0;38;2;90;247;142:*.mn=0;38;2;90;247;142:*.fs=0;38;2;90;247;142:*.el=0;38;2;90;247;142:*.td=0;38;2;90;247;142:*.hi=0;38;2;102;102;102:*.bc=0;38;2;102;102;102:*.sh=0;38;2;90;247;142:*.hs=0;38;2;90;247;142:*.ui=0;38;2;243;249;157:*.vim=0;38;2;90;247;142:*.rar=4;38;2;154;237;254:*.pkg=4;38;2;154;237;254:*.bcf=0;38;2;102;102;102:*.php=0;38;2;90;247;142:*.otf=0;38;2;255;180;223:*.bst=0;38;2;243;249;157:*.kts=0;38;2;90;247;142:*.ipp=0;38;2;90;247;142:*.mp3=0;38;2;255;180;223:*.pdf=0;38;2;255;92;87:*.mid=0;38;2;255;180;223:*.vcd=4;38;2;154;237;254:*.sql=0;38;2;90;247;142:*.csv=0;38;2;243;249;157:*.m4v=0;38;2;255;180;223:*.bin=4;38;2;154;237;254:*.img=4;38;2;154;237;254:*.git=0;38;2;102;102;102:*.ogg=0;38;2;255;180;223:*.exs=0;38;2;90;247;142:*.fls=0;38;2;102;102;102:*.jpg=0;38;2;255;180;223:*.bz2=4;38;2;154;237;254:*.xmp=0;38;2;243;249;157:*.toc=0;38;2;102;102;102:*.ltx=0;38;2;90;247;142:*.tml=0;38;2;243;249;157:*.yml=0;38;2;243;249;157:*.log=0;38;2;102;102;102:*.xls=0;38;2;255;92;87:*.h++=0;38;2;90;247;142:*.tgz=4;38;2;154;237;254:*.cxx=0;38;2;90;247;142:*.cpp=0;38;2;90;247;142:*.dpr=0;38;2;90;247;142:*.pbm=0;38;2;255;180;223:*.com=1;38;2;255;92;87:*.bbl=0;38;2;102;102;102:*.ini=0;38;2;243;249;157:*.sxi=0;38;2;255;92;87:*.bak=0;38;2;102;102;102:*.htc=0;38;2;90;247;142:*.lua=0;38;2;90;247;142:*.mli=0;38;2;90;247;142:*.pyc=0;38;2;102;102;102:*.mpg=0;38;2;255;180;223:*.c++=0;38;2;90;247;142:*.tmp=0;38;2;102;102;102:*.blg=0;38;2;102;102;102:*.aif=0;38;2;255;180;223:*.erl=0;38;2;90;247;142:*.sxw=0;38;2;255;92;87:*.zsh=0;38;2;90;247;142:*.pyd=0;38;2;102;102;102:*.bat=1;38;2;255;92;87:*.fon=0;38;2;255;180;223:*.htm=0;38;2;243;249;157:*.swp=0;38;2;102;102;102:*.doc=0;38;2;255;92;87:*.ics=0;38;2;255;92;87:*.pas=0;38;2;90;247;142:*.dmg=4;38;2;154;237;254:*.pid=0;38;2;102;102;102:*.ods=0;38;2;255;92;87:*.tif=0;38;2;255;180;223:*.hxx=0;38;2;90;247;142:*.rpm=4;38;2;154;237;254:*.pyo=0;38;2;102;102;102:*.png=0;38;2;255;180;223:*.txt=0;38;2;243;249;157:*.dox=0;38;2;165;255;195:*.fnt=0;38;2;255;180;223:*.avi=0;38;2;255;180;223:*.tex=0;38;2;90;247;142:*.nix=0;38;2;243;249;157:*.flv=0;38;2;255;180;223:*.ps1=0;38;2;90;247;142:*.ico=0;38;2;255;180;223:*.odp=0;38;2;255;92;87:*.def=0;38;2;90;247;142:*.tsx=0;38;2;90;247;142:*.hpp=0;38;2;90;247;142:*.epp=0;38;2;90;247;142:*.idx=0;38;2;102;102;102:*.mp4=0;38;2;255;180;223:*.psd=0;38;2;255;180;223:*.dll=1;38;2;255;92;87:*.tbz=4;38;2;154;237;254:*.pgm=0;38;2;255;180;223:*.tcl=0;38;2;90;247;142:*.fsi=0;38;2;90;247;142:*.ind=0;38;2;102;102;102:*.iso=4;38;2;154;237;254:*.rtf=0;38;2;255;92;87:*.bsh=0;38;2;90;247;142:*.apk=4;38;2;154;237;254:*.clj=0;38;2;90;247;142:*.wma=0;38;2;255;180;223:*.jar=4;38;2;154;237;254:*.ttf=0;38;2;255;180;223:*.tar=4;38;2;154;237;254:*.cfg=0;38;2;243;249;157:*.sbt=0;38;2;90;247;142:*.bag=4;38;2;154;237;254:*.mir=0;38;2;90;247;142:*.gif=0;38;2;255;180;223:*.rst=0;38;2;243;249;157:*.zst=4;38;2;154;237;254:*.deb=4;38;2;154;237;254:*.svg=0;38;2;255;180;223:*.inl=0;38;2;90;247;142:*.exe=1;38;2;255;92;87:*.aux=0;38;2;102;102;102:*.mkv=0;38;2;255;180;223:*.m4a=0;38;2;255;180;223:*hgrc=0;38;2;165;255;195:*.fsx=0;38;2;90;247;142:*.ppt=0;38;2;255;92;87:*.gvy=0;38;2;90;247;142:*.eps=0;38;2;255;180;223:*.pps=0;38;2;255;92;87:*.odt=0;38;2;255;92;87:*.out=0;38;2;102;102;102:*.xlr=0;38;2;255;92;87:*.bmp=0;38;2;255;180;223:*.kex=0;38;2;255;92;87:*.elm=0;38;2;90;247;142:*.wmv=0;38;2;255;180;223:*.sty=0;38;2;102;102;102:*.pod=0;38;2;90;247;142:*TODO=1:*.asa=0;38;2;90;247;142:*.inc=0;38;2;90;247;142:*.pro=0;38;2;165;255;195:*.ilg=0;38;2;102;102;102:*.bib=0;38;2;243;249;157:*.vob=0;38;2;255;180;223:*.csx=0;38;2;90;247;142:*.zip=4;38;2;154;237;254:*.wav=0;38;2;255;180;223:*.dot=0;38;2;90;247;142:*.xcf=0;38;2;255;180;223:*.cgi=0;38;2;90;247;142:*.mov=0;38;2;255;180;223:*.ppm=0;38;2;255;180;223:*.arj=4;38;2;154;237;254:*.swf=0;38;2;255;180;223:*.xml=0;38;2;243;249;157:*.awk=0;38;2;90;247;142:*.webm=0;38;2;255;180;223:*.docx=0;38;2;255;92;87:*.psm1=0;38;2;90;247;142:*.html=0;38;2;243;249;157:*.yaml=0;38;2;243;249;157:*.mpeg=0;38;2;255;180;223:*.java=0;38;2;90;247;142:*.rlib=0;38;2;102;102;102:*.orig=0;38;2;102;102;102:*.dart=0;38;2;90;247;142:*.fish=0;38;2;90;247;142:*.flac=0;38;2;255;180;223:*.psd1=0;38;2;90;247;142:*.conf=0;38;2;243;249;157:*.pptx=0;38;2;255;92;87:*.json=0;38;2;243;249;157:*.less=0;38;2;90;247;142:*.bash=0;38;2;90;247;142:*.tbz2=4;38;2;154;237;254:*.xlsx=0;38;2;255;92;87:*.epub=0;38;2;255;92;87:*.lock=0;38;2;102;102;102:*.tiff=0;38;2;255;180;223:*.make=0;38;2;165;255;195:*.toml=0;38;2;243;249;157:*.h264=0;38;2;255;180;223:*.opus=0;38;2;255;180;223:*.diff=0;38;2;90;247;142:*.jpeg=0;38;2;255;180;223:*.lisp=0;38;2;90;247;142:*.purs=0;38;2;90;247;142:*.hgrc=0;38;2;165;255;195:*.swift=0;38;2;90;247;142:*.mdown=0;38;2;243;249;157:*shadow=0;38;2;243;249;157:*.cache=0;38;2;102;102;102:*.cabal=0;38;2;90;247;142:*.shtml=0;38;2;243;249;157:*.dyn_o=0;38;2;102;102;102:*.toast=4;38;2;154;237;254:*README=0;38;2;40;42;54;48;2;243;249;157:*.class=0;38;2;102;102;102:*.scala=0;38;2;90;247;142:*.cmake=0;38;2;165;255;195:*.ipynb=0;38;2;90;247;142:*.patch=0;38;2;90;247;142:*.xhtml=0;38;2;243;249;157:*passwd=0;38;2;243;249;157:*.gradle=0;38;2;90;247;142:*.config=0;38;2;243;249;157:*.dyn_hi=0;38;2;102;102;102:*.flake8=0;38;2;165;255;195:*.groovy=0;38;2;90;247;142:*.ignore=0;38;2;165;255;195:*TODO.md=1:*COPYING=0;38;2;153;153;153:*INSTALL=0;38;2;40;42;54;48;2;243;249;157:*LICENSE=0;38;2;153;153;153:*.matlab=0;38;2;90;247;142:*.gemspec=0;38;2;165;255;195:*Doxyfile=0;38;2;165;255;195:*setup.py=0;38;2;165;255;195:*.desktop=0;38;2;243;249;157:*TODO.txt=1:*Makefile=0;38;2;165;255;195:*.rgignore=0;38;2;165;255;195:*COPYRIGHT=0;38;2;153;153;153:*.DS_Store=0;38;2;102;102;102:*.fdignore=0;38;2;165;255;195:*README.md=0;38;2;40;42;54;48;2;243;249;157:*configure=0;38;2;165;255;195:*.kdevelop=0;38;2;165;255;195:*.cmake.in=0;38;2;165;255;195:*.markdown=0;38;2;243;249;157:*.localized=0;38;2;102;102;102:*SConstruct=0;38;2;165;255;195:*.scons_opt=0;38;2;102;102;102:*CODEOWNERS=0;38;2;165;255;195:*.gitignore=0;38;2;165;255;195:*INSTALL.md=0;38;2;40;42;54;48;2;243;249;157:*README.txt=0;38;2;40;42;54;48;2;243;249;157:*.gitconfig=0;38;2;165;255;195:*SConscript=0;38;2;165;255;195:*Dockerfile=0;38;2;243;249;157:*Makefile.in=0;38;2;102;102;102:*INSTALL.txt=0;38;2;40;42;54;48;2;243;249;157:*.gitmodules=0;38;2;165;255;195:*MANIFEST.in=0;38;2;165;255;195:*LICENSE-MIT=0;38;2;153;153;153:*Makefile.am=0;38;2;165;255;195:*.travis.yml=0;38;2;90;247;142:*.synctex.gz=0;38;2;102;102;102:*CONTRIBUTORS=0;38;2;40;42;54;48;2;243;249;157:*appveyor.yml=0;38;2;90;247;142:*.fdb_latexmk=0;38;2;102;102;102:*.applescript=0;38;2;90;247;142:*configure.ac=0;38;2;165;255;195:*.clang-format=0;38;2;165;255;195:*LICENSE-APACHE=0;38;2;153;153;153:*.gitattributes=0;38;2;165;255;195:*CMakeLists.txt=0;38;2;165;255;195:*CMakeCache.txt=0;38;2;102;102;102:*CONTRIBUTORS.md=0;38;2;40;42;54;48;2;243;249;157:*requirements.txt=0;38;2;165;255;195:*CONTRIBUTORS.txt=0;38;2;40;42;54;48;2;243;249;157:*.sconsign.dblite=0;38;2;102;102;102:*package-lock.json=0;38;2;102;102;102:*.CFUserTextEncoding=0;38;2;102;102;102" diff --git a/bash_tools/theme_bash.sh b/bash_tools/theme_bash.sh deleted file mode 100644 index 1342997..0000000 --- a/bash_tools/theme_bash.sh +++ /dev/null @@ -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)\$ ' diff --git a/config/vim/autoload/theme.vim b/config/vim/autoload/theme.vim index de36934..71df0ee 100644 --- a/config/vim/autoload/theme.vim +++ b/config/vim/autoload/theme.vim @@ -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() diff --git a/config/vim/colors/sunbather_dark.vim b/config/vim/colors/sunbather.vim similarity index 90% rename from config/vim/colors/sunbather_dark.vim rename to config/vim/colors/sunbather.vim index ad939ea..93345d2 100644 --- a/config/vim/colors/sunbather_dark.vim +++ b/config/vim/colors/sunbather.vim @@ -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"}) diff --git a/config/vim/colors/sunbather_light.vim b/config/vim/colors/sunbather_light.vim deleted file mode 100644 index 4abe4b6..0000000 --- a/config/vim/colors/sunbather_light.vim +++ /dev/null @@ -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 diff --git a/install.sh b/install.sh index 5e2e400..8f986ff 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/uninstall.sh b/uninstall.sh deleted file mode 100755 index 398666b..0000000 --- a/uninstall.sh +++ /dev/null @@ -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.' diff --git a/win-install.py b/win-install.py index 7094647..74d44e6 100644 --- a/win-install.py +++ b/win-install.py @@ -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.")