Compare commits

...

10 Commits

Author SHA1 Message Date
d30553d2d2 Added words to custom dictionary 2025-06-09 14:35:48 -04:00
271aa3182b Removed autowrite section
I suspect it created a ton of sync-conflicts in my notes. Auto saving
isn't worth it if that's the result.
2025-05-28 12:31:33 -04:00
6a9ca5c23d Added vim-setcolor script
Must be sourced. Colorscheme browser. Use F8/Shift-F8 to browse
colorschemes.
2025-05-19 18:18:37 -04:00
0edac00442 Testing autowrite,autoread for md files
Will autosave Markdown files on exit. Should also read changes made
outside of Vim. Purpose: to minimize file conflicts in Syncthing.
2025-05-17 20:09:09 -04:00
cc9e42b469 Added more words to dictionary +abbreviations
Added some commonly misspelled words to my .vimrc abbreviations
2025-05-14 11:49:13 -04:00
1274eb0597 Removed filename from readinglist template 2025-05-12 21:50:47 -04:00
18ae6546e6 ExtractWikiLinks
Added a separate function to extract wiki links
It must be sourced on-demand, since it's not tested
2025-05-10 19:31:56 -04:00
7f94c04724 Removed extraneous comments, improved keybindings
Finally removed all the commented out lines that I was saving in case I
needed to roll them back. Switched some keybindings to keys that made
more sense.
2025-05-08 20:34:37 -04:00
9bc08347a8 Added vim-signify
and configured to show Git info in gutter. Updated config to show more
git info in statusline
2025-05-08 16:58:35 -04:00
b7ca4be5cf .vimrc with the custom colors mostly removed
relying on the colorscheme
2025-05-08 08:48:23 -04:00
5 changed files with 208 additions and 41 deletions

30
.vim/ExtractWikiLinks.vim Normal file
View File

@@ -0,0 +1,30 @@
function! ExtractWikiLinks()
let links = []
let pattern = '\v\[\[([^\]]+)\]\]'
let linenr = 1
while linenr <= line('$')
let line = getline(linenr)
let match = match(line, pattern)
while match != -1
let link_start = match + 2 " Start after '[['
let link_end = matchend(line, pattern) - 2 " End before ']]'
if link_end > link_start
let link = strpart(line, link_start, link_end - link_start)
call add(links, link)
endif
let match = match(line, pattern, matchend(line, pattern)) " Find next match
endwhile
let linenr = linenr + 1
endwhile
" Open a new buffer with the extracted links
new
" Make the buffer modifiable temporarily
set modifiable
call setline(1, links)
" Set the buffer options after writing
set nomodifiable buftype=nofile bufhidden=wipe nobuflisted noswapfile
echo "Extracted " . len(links) . " wiki links."
endfunction
command! ExtractLinks call ExtractWikiLinks()

View File

@@ -66,3 +66,24 @@ chawley
phansible
Abaddon
ChromeOS
TeachingBooks
NeuroSquad
Wormdingler
jinja
TODO
Neovim
Zettelkasten
Harpocrates
Weechat
Lorain
Meadowbrook
NotebookLLM
Satola
DeSha
Redis
hostname
Shawshank
Delly
tmux
freecycle
ReadEra

View File

@@ -1,6 +1,5 @@
:insert
---
filename:
filecreated:
fileupdated:
filetags: [readinglist]

120
.vim/vim-setcolors.vim Normal file
View File

@@ -0,0 +1,120 @@
" Change the color scheme from a list of color scheme names.
" Version 2010-09-12 from http://vim.wikia.com/wiki/VimTip341
" Press key:
" F8 next scheme
" Shift-F8 previous scheme
" Alt-F8 random scheme
" Set the list of color schemes used by the above (default is 'all'):
" :SetColors all (all $VIMRUNTIME/colors/*.vim)
" :SetColors my (names built into script)
" :SetColors blue slate ron (these schemes)
" :SetColors (display current scheme names)
" Set the current color scheme based on time of day:
" :SetColors now
if v:version < 700 || exists('loaded_setcolors') || &cp
finish
endif
let loaded_setcolors = 1
let s:mycolors = ['slate', 'torte', 'darkblue', 'delek', 'murphy', 'elflord', 'pablo', 'koehler'] " colorscheme names that we use to set color
" Set list of color scheme names that we will use, except
" argument 'now' actually changes the current color scheme.
function! s:SetColors(args)
if len(a:args) == 0
echo 'Current color scheme names:'
let i = 0
while i < len(s:mycolors)
echo ' '.join(map(s:mycolors[i : i+4], 'printf("%-14s", v:val)'))
let i += 5
endwhile
elseif a:args == 'all'
let paths = split(globpath(&runtimepath, 'colors/*.vim'), "\n")
let s:mycolors = uniq(sort(map(paths, 'fnamemodify(v:val, ":t:r")')))
echo 'List of colors set from all installed color schemes'
elseif a:args == 'my'
let c1 = 'default elflord peachpuff desert256 breeze morning'
let c2 = 'darkblue gothic aqua earth black_angus relaxedgreen'
let c3 = 'darkblack freya motus impact less chocolateliquor'
let s:mycolors = split(c1.' '.c2.' '.c3)
echo 'List of colors set from built-in names'
elseif a:args == 'now'
call s:HourColor()
else
let s:mycolors = split(a:args)
echo 'List of colors set from argument (space-separated names)'
endif
endfunction
command! -nargs=* SetColors call s:SetColors('<args>')
" Set next/previous/random (how = 1/-1/0) color from our list of colors.
" The 'random' index is actually set from the current time in seconds.
" Global (no 's:') so can easily call from command line.
function! NextColor(how)
call s:NextColor(a:how, 1)
endfunction
" Helper function for NextColor(), allows echoing of the color name to be
" disabled.
function! s:NextColor(how, echo_color)
if len(s:mycolors) == 0
call s:SetColors('all')
endif
if exists('g:colors_name')
let current = index(s:mycolors, g:colors_name)
else
let current = -1
endif
let missing = []
let how = a:how
for i in range(len(s:mycolors))
if how == 0
let current = localtime() % len(s:mycolors)
let how = 1 " in case random color does not exist
else
let current += how
if !(0 <= current && current < len(s:mycolors))
let current = (how>0 ? 0 : len(s:mycolors)-1)
endif
endif
try
execute 'colorscheme '.s:mycolors[current]
break
catch /E185:/
call add(missing, s:mycolors[current])
endtry
endfor
redraw
if len(missing) > 0
echo 'Error: colorscheme not found:' join(missing)
endif
if (a:echo_color)
echo g:colors_name
endif
endfunction
nnoremap <F8> :call NextColor(1)<CR>
nnoremap <S-F8> :call NextColor(-1)<CR>
nnoremap <A-F8> :call NextColor(0)<CR>
" Set color scheme according to current time of day.
function! s:HourColor()
let hr = str2nr(strftime('%H'))
if hr <= 3
let i = 0
elseif hr <= 7
let i = 1
elseif hr <= 14
let i = 2
elseif hr <= 18
let i = 3
else
let i = 4
endif
let nowcolors = 'elflord morning desert evening pablo'
execute 'colorscheme '.split(nowcolors)[i]
redraw
echo g:colors_name
endfunction

77
.vimrc
View File

@@ -25,9 +25,10 @@ set scrolloff=10 " number of lines to keep a
set showmatch " show matching brackets when text indicator is over them
set splitright " Split to right by default
if !has('nvim')
set term=xterm-256color " LOTS of colors
set term=xterm-256color " LOTS of colors
endif
set wildmenu " enhanced command line completion
set fillchars=vert:\|,fold:.,diff:-
" Text Wrapping
set colorcolumn= " disable colorzing <textwidth> column
@@ -131,6 +132,10 @@ Plug 'bullets-vim/bullets.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" vim-signify
" https://github.com/mhinz/vim-signify
Plug 'mhinz/vim-signify'
call plug#end()
" ---------------------------------------------------------------------------------------------------------------------
@@ -164,9 +169,9 @@ let g:bullets_enabled_file_types = [ 'markdown', 'gitcommit' ]
let g:bullets_outline_levels = ['num', 'abc', 'std*', 'std+', 'std-']
"vim-airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_extensions = ['hunks', 'branch', 'tabline']
let g:airline_detect_theme_from_guicolors = 1
let g:airline_powerline_fonts = 1
" ---------------------------------------------------------------------------------------------------------------------
" ==> FZF Helper Functions
@@ -225,31 +230,14 @@ let g:fzf_action = {
\ 'ctrl-l': function('PasteFzfWikiLink')
\ }
" ---------------------------------------------------------------------------------------------------------------------
" ==> Colors
" Term GUI Colors
" colorscheme replaced by ~/.vimcustom
" If there is a file at ~/.vimcustom, the colorscheme defined in that file
" will be applied. If not, colorscheme defaults to 'darkburn'
" cursorcolumn
hi cursorcolumn cterm=NONE ctermbg=black ctermfg=white
" visual mode colors
hi visual cterm=NONE ctermbg=lightyellow ctermfg=black
set fillchars=vert:\|,fold:.,diff:-
" In split windows - active buffer status bar is green, inactive is yellow
hi StatusLine ctermfg=white ctermbg=darkgreen cterm=bold
hi StatusLineNC ctermfg=darkgray ctermbg=gray cterm=none
" ---------------------------------------------------------------------------------------------------------------------
" => Keymaps: Highlights
" <leader><space> to turn off search highlight
nnoremap <leader><space> :nohls <enter>
" <F6> to toggle search highlight
nnoremap <F6> :nohls <enter>
" <leader>C to toggle row/column highlight
nnoremap <leader>C :set cursorline! cursorcolumn!<CR>
" <F7> to toggle row/column highlight
nnoremap <F7> :set cursorline! cursorcolumn!<CR>
" ---------------------------------------------------------------------------------------------------------------------
" ==> Keymaps: Buffers & Panes
@@ -273,9 +261,6 @@ nnoremap <leader>c :bd <enter>
" <c-s> to save buffer
nnoremap <c-s> :w<CR>
" <c-x> to bring up the copy buffer
noremap <c-x> "+
" <alt>-arrow keys to navigate panes
" UP
map <esc>[1;3A <c-w><c-k>
@@ -305,7 +290,7 @@ nnoremap <leader>f :call fzf#run(fzf#vim#with_preview(fzf#wrap({'source': 'find
nnoremap <leader>w :execute "if &wrap\n set nowrap\nelse\n set wrap linebreak\nendif"<CR>
" Toggle line numbers
nnoremap <leader>n :set number! relativenumber!<CR>
nnoremap <leader>n :set number! relativenumber! <CR>
" ---------------------------------------------------------------------------------------------------------------------
" ==> Keymaps: Text bubbling (http://vimcasts.org/episodes/bubbling-text/)
@@ -373,18 +358,15 @@ hi clear SpellBad
hi clear SpellCap
hi clear SpellLocal
hi clear SpellRare
hi SpellCap cterm=underline ctermbg=none ctermfg=magenta
hi SpellBad cterm=underline ctermbg=none ctermfg=red
hi SpellLocal cterm=underline ctermbg=none ctermfg=gray
hi SpellRare cterm=underline ctermbg=none ctermfg=gray
hi SpellCap cterm=underline ctermbg=none
hi SpellBad cterm=underline ctermbg=none
hi SpellLocal cterm=underline ctermbg=none
hi SpellRare cterm=underline ctermbg=none
" ---------------------------------------------------------------------------------------------------------------------
" ==> Templates: markdown documents with frontmatter (.md)
autocmd BufNewFile *.md so $HOME/.vim/templates/mdfm
"autocmd BufNewFile *.md %s/filename:.*/s//filename:\=expand('%:t:r')
"autocmd BufNewFile *.md %s/filename:.*/\='filename: '.expand('%:t:r')
"autocmd BufNewFile *.md exe "g/^filename:.*/s//filename: " .expand('%:t:r')
autocmd BufNewFile *.md exe "g/^filecreated:.*/s//filecreated: " .strftime("%Y-%m-%d")
autocmd BufNewFile *.md exe "normal Go"
autocmd BufWritePre,filewritepre *.md execute "normal! ma"
@@ -415,13 +397,9 @@ nnoremap ,begend :-1read $HOME/.vim/templates/begend<CR>jA
nnoremap ,sh :0read $HOME/.vim/templates/sh<CR> <bar> :1<CR>dd <bar> :4%s/filename/\=expand('%:t')/g<CR>
" section readinglist header
"nnoremap ,rl :0read $HOME/.vim/templates/readinglist<CR> <bar> :1<CR>dd $
"nnoremap ,rl :0read $HOME/.vim/templates/rlfm<CR> <bar>zR<CR> <bar> :1<CR>dd :%s/^filename:/\="filename: " . expand('%:t:r')/g<CR>
nnoremap ,rl :0read $HOME/.vim/templates/rlfm<CR> <bar>zR<CR> <bar> :1<CR>dd
" section markdown file header
"nnoremap ,md :0read $HOME/.vim/templates/md<CR> <bar> :1<CR>dd <bar> :%s/filename/\=expand('%:t:r')/g<CR>
"nnoremap ,md :0read $HOME/.vim/templates/mdfm<CR> <bar>zR<CR> <bar> :1<CR>dd :%s/^filename:/\="filename: " . expand('%:t:r')/g<CR>
nnoremap ,md :0read $HOME/.vim/templates/mdfm<CR> <bar>zR<CR> <bar> :1<CR>dd
" ---------------------------------------------------------------------------------------------------------------------
@@ -437,6 +415,25 @@ autocmd FileType netrw setl bufhidden=delete
autocmd BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=manual
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Abbreviations
" Correcting common misspellings
iab couljd could
iab wouljd would
iab monring morning
iab teh the
iab adn and
iab form from
iab wiht with
iab becuase because
iab definately definitely
iab seperate separate
" ---------------------------------------------------------------------------------------------------------------------
" ==> Colors
" Term GUI Colors
" colorscheme replaced by ~/.vimcustom
" If there is a file at ~/.vimcustom, the colorscheme defined in that file
" will be applied. If not, colorscheme defaults to 'darkburn'
" ---------------------------------------------------------------------------------------------------------------------
" ==> Source Local Customizations and Set Colorscheme