Following the μέτρον principle of durable, thoughtful solutions: Shell Configuration: - Add refined .zshrc with modular architecture - Include .p10k.zsh for Powerlevel10k prompt - Add .zprofile for login shell configuration - Update aliases with new dotfiles management tools System Management Tools: - safe-update.sh: System updates with rollback protection - detect-drift.sh: Configuration drift detection - system-health.sh: Comprehensive health monitoring - generate-lockfile.sh: Version tracking for reproducibility Documentation: - ARCHITECTURE.md: Philosophy and design rationale - USAGE.md: Practical guide and troubleshooting Other Updates: - Update symlinks.sh to manage all config files - Add .vimrc configuration - Create Brewfile.lock for version pinning These enhancements provide visibility, safety, and maintainability while following the prime directive of prioritizing durability. 🖖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
193 lines
5.8 KiB
VimL
193 lines
5.8 KiB
VimL
" Custom VIM Settings
|
||
" David F Glidden (2020)
|
||
" Vim 8.0+
|
||
|
||
" =============================================================================
|
||
" Runtime Stuff
|
||
" =============================================================================
|
||
|
||
" True colors!
|
||
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
||
" Make Vim more useful
|
||
set nocompatible
|
||
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
|
||
set clipboard=unnamed
|
||
" Have lines wrap instead of continue off-screen
|
||
set linebreak
|
||
" Enhance command-line completion
|
||
set wildmenu
|
||
" Allow cursor keys in insert mode
|
||
set esckeys
|
||
" Allow backspace in insert mode
|
||
set backspace=indent,eol,start
|
||
" Optimize for fast terminal connections
|
||
set ttyfast
|
||
" Add the g flag to search/replace by default
|
||
set gdefault
|
||
" Use UTF-8 without BOM
|
||
set encoding=utf-8 nobomb
|
||
" Change mapleader to <,>
|
||
let mapleader=","
|
||
" Don’t add empty newlines at the end of files
|
||
set binary
|
||
set noeol
|
||
" Respect modeline in files
|
||
set modeline
|
||
set modelines=4
|
||
" Enable per-directory .vimrc files and disable unsafe commands in them
|
||
set exrc
|
||
set secure
|
||
" Enable line numbers
|
||
set number
|
||
" Enable syntax highlighting
|
||
syntax on
|
||
" Highlight current line
|
||
set cursorline
|
||
" Make tabs as wide as two spaces
|
||
set tabstop=2
|
||
" Show “invisible” characters
|
||
set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
|
||
set list
|
||
" Highlight searches
|
||
set hlsearch
|
||
" Ignore case of searches
|
||
set ignorecase
|
||
" Highlight dynamically as pattern is typed
|
||
set incsearch
|
||
" Always show status line
|
||
set laststatus=2
|
||
" Enable mouse in all modes
|
||
set mouse=a
|
||
" Disable error bells
|
||
set noerrorbells
|
||
" Don’t reset cursor to start of line when moving around.
|
||
set nostartofline
|
||
" Show the cursor position
|
||
set ruler
|
||
" Don’t show the intro message when starting Vim
|
||
set shortmess=atI
|
||
" Show the current mode
|
||
set showmode
|
||
" Show the filename in the window titlebar
|
||
set title
|
||
" Show the (partial) command as it’s being typed
|
||
set showcmd
|
||
" Start scrolling three lines before the horizontal window border
|
||
set scrolloff=3
|
||
|
||
" Strip trailing whitespace (,ss)
|
||
function! StripWhitespace()
|
||
let save_cursor = getpos(".")
|
||
let old_query = getreg('/')
|
||
:%s/\s\+$//e
|
||
call setpos('.', save_cursor)
|
||
call setreg('/', old_query)
|
||
endfunction
|
||
noremap <leader>ss :call StripWhitespace()<CR>
|
||
" Save a file as root (,W)
|
||
noremap <leader>W :w !sudo tee % > /dev/null<CR>
|
||
|
||
" =============================================================================
|
||
" Markdown Stuff
|
||
" =============================================================================
|
||
|
||
" Highlight the line the cursor is on
|
||
autocmd FileType markdown set cursorline
|
||
let g:vim_markdown_folding_disabled=1 " plasticboy’s plugin folds Markdown content by heading, and I don't like that feature by default
|
||
let g:vim_markdown_conceal_code_blocks = 0
|
||
let g:vim_markdown_math = 1
|
||
let g:vim_markdown_toml_frontmatter = 1
|
||
let g:vim_markdown_frontmatter = 1
|
||
let g:vim_markdown_strikethrough = 1
|
||
let g:vim_markdown_autowrite = 1
|
||
let g:vim_markdown_edit_url_in = 'tab'
|
||
let g:vim_markdown_follow_anchor = 1
|
||
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
|
||
|
||
" Soft line wrap for Markdown using vim-pencil
|
||
let g:pencil#wrapModeDefault = 'soft' " default is 'hard'
|
||
augroup pencil
|
||
autocmd!
|
||
autocmd FileType markdown,mkd call pencil#init()
|
||
autocmd FileType text call pencil#init({'wrap': 'hard'})
|
||
augroup END
|
||
|
||
" To start Goyo and set a CPL of 72
|
||
nmap <C-g> :Goyo 72<CR>
|
||
|
||
" =============================================================================
|
||
" Spell Check " =============================================================================
|
||
|
||
" Set spell check to Canadian English
|
||
autocmd FileType markdown setlocal spell spelllang=en_ca,fr
|
||
|
||
" =============================================================================
|
||
" Swapfiles & Backups
|
||
" =============================================================================
|
||
|
||
" Centralize backups, swapfiles and undo history
|
||
set backupdir=~/.vim/backups
|
||
set directory=~/.vim/swaps
|
||
if exists("&undodir")
|
||
set undodir=~/.vim/undo
|
||
endif
|
||
|
||
" Don’t create backups when editing files in certain directories
|
||
set backupskip=/tmp/*,/private/tmp/*
|
||
|
||
" =============================================================================
|
||
" Filetypes
|
||
" =============================================================================
|
||
|
||
" Automatic commands
|
||
if has("autocmd")
|
||
" Enable file type detection
|
||
filetype on
|
||
" Treat .json files as .js
|
||
autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
|
||
" Treat .md files as Markdown
|
||
autocmd BufNewFile,BufFilePre,BufRead *.txt set filetype=markdown
|
||
endif
|
||
|
||
" =============================================================================
|
||
" Bindings
|
||
" =============================================================================
|
||
|
||
map ; :Files<CR>
|
||
map <C-o> :NERDTreeToggle<CR>
|
||
|
||
" =============================================================================
|
||
" Vim-plug
|
||
" =============================================================================
|
||
|
||
" 1. Install and run vim-plug on first run
|
||
if empty(glob('~/.vim/autoload/plug.vim'))
|
||
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||
endif
|
||
|
||
"==============================================================================
|
||
"============== Plugin Specific Settings ======================================
|
||
"==============================================================================
|
||
|
||
call plug#begin()
|
||
|
||
Plug 'junegunn/goyo.vim'
|
||
Plug 'junegunn/limelight.vim'
|
||
Plug 'junegunn/fzf'
|
||
", { 'do': { -> fzf#install() } }
|
||
Plug 'plasticboy/vim-markdown'
|
||
Plug 'reedes/vim-pencil'
|
||
Plug 'itchyny/lightline.vim'
|
||
Plug 'tpope/vim-surround'
|
||
Plug 'tpope/vim-fugitive'
|
||
Plug 'preservim/nerdtree'
|
||
Plug 'arcticicestudio/nord-vim'
|
||
|
||
call plug#end()
|
||
|
||
" Use Nord colorscheme
|
||
colorscheme nord
|
||
highlight Comment cterm=italic
|