dotfiles

Configuration for the software I use.
git clone https://git.sr.ht/~jbauer/dotfiles
Log | Files | Refs | README | LICENSE

commit 01d69cf62af290fe693b6f3976e0af708e04b877
parent b7a10156034bf5dec9865493be1808534d3c1bb5
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Fri, 26 Aug 2022 22:40:11 -0400

Update vim configuration

Diffstat:
M.config/nvim/init.vim | 41+++++++++++++++++++----------------------
M.config/nvim/pack/bundle/start/vim-fastline/plugin/statusline.vim | 34++++++++++++++++++++++++++--------
A.config/nvim/pack/bundle/start/vim-monochrome/colors/monochrome-light.vim | 218+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M.config/nvim/pack/bundle/start/vim-monochrome/colors/monochrome.vim | 24++++++++++++++----------
4 files changed, 277 insertions(+), 40 deletions(-)

diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim @@ -1,19 +1,18 @@ -"Plugins Used: {{{ +"Plugins Used: " vim-monochrome — (colorscheme) " vim-commentary — (shortcuts for (un)commenting lines/blocks of code) " vim-fastline — (custom status bar) " vim-surround — (quickly surround a selection with brackets/quotes/etc) " gemini-vim-synatx — (syntax highlighting for gemini) -" }}} -" General Settings {{{ +" General Settings " Leader key let mapleader = "," " Syntax Highlighting and Colours -syntax on -colorscheme monochrome + syntax on + colorscheme monochrome-light " Show Matching Parens/Brackets set showmatch @@ -25,8 +24,10 @@ nnoremap <Tab> za " Enable Filetype Plugins/Indentation filetype plugin indent on -" Disable shortcut for ex mode -nnoremap Q <Nop> +" Make common typos behave as their lowercase counterparts +cabbr W w +cabbr Q q +cabbr E e " Convenient shortcut for :center nnoremap cc :center<CR> @@ -58,9 +59,12 @@ set listchars=tab:▸\ ,eol:¬,space:. " Highlight entire line that cursor is on set cursorline -" }}} -" Line Number Settings {{{ +" Make < and > shifts retain selection +vnoremap < <gv +vnoremap > >gv + +" Line Number Settings set number relativenumber " Courtesy: Jeff Kreeftmeijer @ jeffkreeftmeijer.com/vim-number/ augroup numbertoggle @@ -68,9 +72,8 @@ augroup numbertoggle autocmd BufEnter,FocusGained,InsertLeave * set relativenumber autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber augroup END -" }}} -" Indentation Settings {{{ +" Indentation Settings set smartindent set autoindent set textwidth=80 @@ -86,21 +89,18 @@ func! ToggleIndentStyle() endif endfu noremap <C-_> :call ToggleIndentStyle()<CR> -" }}} -" Search Settings {{{ +" Search Settings set hlsearch set ignorecase set smartcase nnoremap \\ :noh<CR> -" }}} -" Printing {{{ +" Printing set printfont=IBM\ Plex\ Mono\ Text:h10 command! -range=% HardcopyPdf <line1>,<line2> hardcopy > %.ps | !ps2pdf %.ps && rm %.ps && echo "Created: %.pdf" -" }}} -" Buffer Settings and Fuzzy Search {{{ +" Buffer Settings and Fuzzy Search set hidden set splitright splitbelow set wildmenu @@ -116,9 +116,8 @@ nnoremap <Up> :resize +2<CR> nnoremap <Down> :resize -2<CR> nnoremap <Left> :vertical resize +2<CR> nnoremap <Right> :vertical resize -2<CR> -" }}} -" Enable Spell Check {{{ +" Enable Spell Check " Thesaurus: gutenberg.org/files/3202/files/mthesaur.txt " SpellFile: ftp.vim.org/pub/vim/runtime/spell/en/ func! SpellCheckToggle() @@ -128,9 +127,8 @@ func! SpellCheckToggle() setlocal spell! spelllang=en_ca endfu noremap <silent> <C-S> :call SpellCheckToggle()<CR> -" }}} -" Preferences for File Formats {{{ +" Preferences for File Formats autocmd FileType gmi call SpellCheckToggle() autocmd FileType gmi setl tw=0 autocmd FileType gitcommit call SpellCheckToggle() @@ -140,4 +138,3 @@ autocmd FileType mail setl tw=72 autocmd FileType markdown call SpellCheckToggle() autocmd FileType python setl expandtab tabstop=4 shiftwidth=4 autocmd FileType vim setl foldmethod=marker -" }}} diff --git a/.config/nvim/pack/bundle/start/vim-fastline/plugin/statusline.vim b/.config/nvim/pack/bundle/start/vim-fastline/plugin/statusline.vim @@ -1,11 +1,21 @@ " Courtesy for tutorial: https://irrellia.github.io/blogs/vim-statusline/ " Colours for the statusline -hi Base ctermbg=235 ctermfg=7 -hi Mode ctermbg=240 ctermfg=7 cterm=bold -hi Git ctermbg=240 ctermfg=7 -hi Filetype ctermbg=240 ctermfg=7 -hi LineCol ctermbg=235 ctermfg=7 -hi Warn ctermbg=235 ctermfg=9 cterm=bold +" Modi colours are defined further down +if &background == "dark" + hi Base ctermbg=238 ctermfg=7 + hi Mode ctermbg=240 ctermfg=7 cterm=bold + hi Git ctermbg=240 ctermfg=7 + hi Filetype ctermbg=240 ctermfg=7 + hi LineCol ctermbg=238 ctermfg=7 + hi Warn ctermbg=238 ctermfg=9 cterm=bold +else + hi Base ctermbg=252 ctermfg=0 + hi Mode ctermbg=254 ctermfg=0 cterm=bold + hi Git ctermbg=254 ctermfg=0 + hi Filetype ctermbg=254 ctermfg=0 + hi LineCol ctermbg=252 ctermfg=0 + hi Warn ctermbg=252 ctermfg=9 cterm=bold +endif let g:modes={ \'n' : 'Normal ', @@ -39,14 +49,22 @@ endfunction function! CheckModified(modi) if a:modi == 1 - hi Modi ctermbg=235 ctermfg=7 cterm=bold + if &background == "dark" + hi Modi ctermbg=238 ctermfg=7 cterm=bold + else + hi Modi ctermbg=252 ctermfg=0 cterm=bold + endif if expand('%') == "" return '[New File]'.'*' else return expand('%:t').'*' endif else - hi Modi ctermbg=235 ctermfg=7 cterm=NONE + if &background == "dark" + hi Modi ctermbg=238 ctermfg=7 cterm=NONE + else + hi Modi ctermbg=252 ctermfg=0 cterm=NONE + endif if expand('%') == "" return '[New File]' else diff --git a/.config/nvim/pack/bundle/start/vim-monochrome/colors/monochrome-light.vim b/.config/nvim/pack/bundle/start/vim-monochrome/colors/monochrome-light.vim @@ -0,0 +1,218 @@ +" monochrome.vim +" +" Original Author: Xavier Noria <fxn@hashref.com> +" License: MIT +" Modified By: Jake Bauer <jbauer@paritybit.ca> + +set background=light + +hi clear +if exists('syntax_on') + syntax reset +endif + +let g:colors_name = 'monochrome-light' + +let s:black = ['#1C1C1C', 234] +let s:red = ['#B21818', 1] +let s:green = ['#18B218', 2] +let s:yellow = ['#B26818', 3] +let s:cyan = ['#18B2B2', 6] +let s:white = ['#EEEEEE', 255] +let s:accent = ['#6C6C6C', 242] +let s:cursorline = ['#DADADA', 253] +let s:comment = ['#585858', 240] +let s:faded = ['#D0D0D0', 252] +let s:menu = ['#BCBCBC', 250] +let s:menusel = ['#9E9E9E', 247] + +let s:default_fg = s:black +let s:default_bg = s:white + +let s:italic = 'italic' +let s:bold = 'bold' +let s:underline = 'underline' +let s:none = 'NONE' + +let s:default_lst = [] +let s:default_str = '' + +let s:comment_attr = s:italic + +function! s:hi(...) + let group = a:1 + let fg = get(a:, 2, s:default_fg) + let bg = get(a:, 3, s:default_bg) + let attr = get(a:, 4, s:default_str) + + let cmd = ['hi', group] + + if fg != s:default_lst + call add(cmd, 'guifg='.fg[0]) + call add(cmd, 'ctermfg='.fg[1]) + endif + + if bg != s:default_lst + call add(cmd, 'guibg='.bg[0]) + call add(cmd, 'ctermbg='.bg[1]) + endif + + if attr != s:default_str + call add(cmd, 'gui='.attr) + call add(cmd, 'cterm='.attr) + endif + + exec "hi clear " group + exec join(cmd, ' ') +endfunction + + +" --- Vim interface ------------------------------------------------------------ +call s:hi('Normal', s:black, s:white, s:none) +call s:hi('Cursor', s:white, s:black) +call s:hi('CursorLine', s:black, s:cursorline, s:none) +call s:hi('CursorLineNr', s:black, s:default_bg, s:bold) +call s:hi('ColorColumn', s:black, s:faded) +call s:hi('Search', s:black, s:faded) +call s:hi('Visual', s:black, s:faded) +call s:hi('ErrorMsg', s:red, s:default_bg) + +" Status bar +call s:hi('StatusLine', s:black, s:faded) +call s:hi('StatusLineNC', s:black, s:faded) + +" Tildes at the bottom of a buffer, etc. +call s:hi('NonText', s:faded) + +" Folding. +call s:hi('FoldColumn', s:faded) +call s:hi('Folded') + +" Line numbers gutter. +call s:hi('LineNr', s:black, s:faded) + +" Small arrow used for tabs. +call s:hi('SpecialKey', s:accent, s:default_bg, s:bold) + +" File browsers. +call s:hi('Directory', s:black, s:default_bg, s:bold) + +" Help. +call s:hi('helpSpecial') +call s:hi('helpHyperTextJump', s:accent, s:default_bg, s:underline) +call s:hi('helpNote') + +" Popup menu. +call s:hi('Pmenu', s:black, s:menu) +call s:hi('PmenuSel', s:black, s:menusel) + +" Notes. +call s:hi('Todo', s:black, s:default_bg, s:bold) + +" Signs. +call s:hi('SignColumn') + +" --- Programming languages ---------------------------------------------------- +call s:hi('Statement', s:black, s:default_bg, s:bold) +call s:hi('PreProc', s:black, s:default_bg, s:bold) +call s:hi('String', s:accent) +call s:hi('Comment', s:comment, s:default_bg, s:comment_attr) +call s:hi('Constant', s:black, s:default_bg, s:bold) +call s:hi('Number', s:accent) +call s:hi('Type', s:black, s:default_bg, s:bold) +call s:hi('Function', s:black) +call s:hi('Identifier', s:default_fg, s:default_bg, s:none) +call s:hi('Special') +call s:hi('MatchParen', s:black, s:faded, s:underline) +call s:hi('Error', s:red, s:white, s:bold) + +" --- VimL --------------------------------------------------------------------- +call s:hi('vimOption') +call s:hi('vimGroup') +call s:hi('vimHiClear') +call s:hi('vimHiGroup') +call s:hi('vimHiAttrib') +call s:hi('vimHiGui') +call s:hi('vimHiGuiFgBg') +call s:hi('vimHiCTerm') +call s:hi('vimHiCTermFgBg') +call s:hi('vimSynType') +hi link vimCommentTitle Comment + +" --- Ruby --------------------------------------------------------------------- +call s:hi('rubyConstant') +call s:hi('rubySharpBang', s:comment) +call s:hi('rubyStringDelimiter', s:accent) +call s:hi('rubyStringEscape', s:accent) +call s:hi('rubyRegexpEscape', s:accent) +call s:hi('rubyRegexpAnchor', s:accent) +call s:hi('rubyRegexpSpecial', s:accent) + +" --- Elixir ------------------------------------------------------------------- +call s:hi('elixirAlias', s:default_fg, s:default_bg, s:none) +call s:hi('elixirDelimiter', s:accent) +call s:hi('elixirSelf', s:default_fg, s:default_bg, s:none) + +" For ||, ->, etc. +call s:hi('elixirOperator') + +" Module attributes like @doc or @type. +hi link elixirVariable Statement + +" While rendered as comments in other languages, docstrings are strings, +" experimental. +hi link elixirDocString String +hi link elixirDocTest String +hi link elixirStringDelimiter String + +" --- Perl --------------------------------------------------------------------- +call s:hi('perlSharpBang', s:comment) +call s:hi('perlStringStartEnd', s:accent) +call s:hi('perlStringEscape', s:accent) +call s:hi('perlMatchStartEnd', s:accent) + +" --- Python ------------------------------------------------------------------- +call s:hi('pythonEscape', s:accent) + +" --- JavaScript --------------------------------------------------------------- +call s:hi('javaScriptFunction', s:black, s:default_bg, s:bold) + +" --- Diffs -------------------------------------------------------------------- +call s:hi('diffFile', s:faded) +call s:hi('diffNewFile', s:faded) +call s:hi('diffIndexLine', s:comment) +call s:hi('diffLine', s:yellow) +call s:hi('diffSubname', s:faded) +call s:hi('diffAdded', s:green) +call s:hi('diffRemoved', s:red) + +" --- Markdown ----------------------------------------------------------------- +call s:hi('Title', s:black, s:default_bg, s:bold) +call s:hi('markdownHeadingDelimiter', s:black, s:default_bg, s:bold) +call s:hi('markdownHeadingRule', s:black, s:default_bg, s:bold) +call s:hi('markdownLinkText', s:cyan, s:default_bg, s:underline) + +" --- HTML --------------------------------------------------------------------- +call s:hi('htmlLink', s:cyan, s:default_bg, s:underline) +call s:hi('htmlArg', s:default_fg, s:default_bg) + +" --- Gemini ------------------------------------------------------------------- +" Based off of the following plugin: https://tildegit.org/sloum/gemini-vim-syntax +call s:hi('gmiHeader', s:black, s:default_bg, s:bold) +call s:hi('gmiLinkStart', s:black, s:default_bg, s:bold) +call s:hi('gmiLinkURL', s:cyan, s:default_bg, s:underline) +call s:hi('gmiLinkTitle', s:accent, s:default_bg, s:none) +call s:hi('gmiMono', s:accent, s:default_bg, s:bold) +call s:hi('gmiQuoteLine', s:accent, s:default_bg, s:bold) + +" --- Spelling ----------------------------------------------------------------- +call s:hi('SpellBad', s:red, s:default_bg, s:bold, s:underline) +call s:hi('SpellCap', s:black, s:default_bg, s:bold) +call s:hi('SpellLocal', s:default_fg, s:default_bg, s:none) +call s:hi('SpellRare', s:default_fg, s:default_bg, s:none) + +" --- Diff Mode ---------------------------------------------------------------- +call s:hi('DiffAdd', s:green, s:default_bg) +call s:hi('DiffDelete', s:red, s:default_bg) +call s:hi('DiffChange', s:black, s:default_bg) +call s:hi('DiffText', s:yellow, s:default_bg) diff --git a/.config/nvim/pack/bundle/start/vim-monochrome/colors/monochrome.vim b/.config/nvim/pack/bundle/start/vim-monochrome/colors/monochrome.vim @@ -13,16 +13,16 @@ endif let g:colors_name = 'monochrome' -let s:black = ['#111111', 0] +let s:black = ['#080808', 0] let s:red = ['#994444', 1] let s:green = ['#449944', 2] let s:yellow = ['#999444', 3] let s:cyan = ['#449999', 6] -let s:white = ['#DDDDDD', 7] +let s:white = ['#FFFFFF', 15] let s:accent = ['#5F5F5F', 59] -let s:cursorline = ['#262626', 235] +let s:cursorline = ['#4E4E4E', 239] let s:comment = ['#6C6C6C', 242] -let s:faded = ['#A8A8A8', 248] +let s:faded = ['#444444', 238] let s:default_fg = s:white let s:default_bg = s:black @@ -50,7 +50,7 @@ function! s:hi(...) call add(cmd, 'ctermfg='.fg[1]) endif - if bg != s:default_lst && bg != s:default_bg + if bg != s:default_lst call add(cmd, 'guibg='.bg[0]) call add(cmd, 'ctermbg='.bg[1]) endif @@ -66,14 +66,18 @@ endfunction " --- Vim interface ------------------------------------------------------------ -call s:hi('Normal') +call s:hi('Normal', s:white, s:black) call s:hi('Cursor', s:black, s:white) -call s:hi('CursorLine', s:default_lst, s:cursorline, s:none) +call s:hi('CursorLine', s:white, s:cursorline, s:none) call s:hi('CursorLineNr', s:white, s:default_bg, s:bold) -call s:hi('ColorColumn', s:default_lst, s:cursorline) +call s:hi('ColorColumn', s:white, s:faded) call s:hi('Search', s:white, s:accent) call s:hi('Visual', s:white, s:accent) -call s:hi('ErrorMsg', s:white, s:red) +call s:hi('ErrorMsg', s:red, s:default_bg) + +" Status bar +call s:hi('StatusLine', s:white, s:faded) +call s:hi('StatusLineNC', s:white, s:faded) " Tildes at the bottom of a buffer, etc. call s:hi('NonText', s:faded) @@ -83,7 +87,7 @@ call s:hi('FoldColumn', s:faded) call s:hi('Folded') " Line numbers gutter. -call s:hi('LineNr', s:faded) +call s:hi('LineNr', s:accent) " Small arrow used for tabs. call s:hi('SpecialKey', s:accent, s:default_bg, s:bold)