Compare commits

..

17 commits

Author SHA1 Message Date
e35447f53f
Drop unnecessary MUcomplete customisation 2023-11-04 14:47:34 +11:00
b2da1aa506
Set default GPG recipient to myself (good for password-store) 2023-11-04 14:43:19 +11:00
93eb7fbdc6
Group + explain Skim integration plugins 2023-11-04 14:36:41 +11:00
08f8c9b77b
Group + explain Git integration plugins 2023-11-04 14:20:32 +11:00
ca333f3abd
Drop async.vim since nothing is using it 2023-11-04 14:19:41 +11:00
b0adb68988
Explain project support in plugins.vim 2023-11-04 14:18:02 +11:00
6d24555ec5
Explain Minpac setup in plugins.vim 2023-11-04 14:17:22 +11:00
088e017bb8
Update GitHub username for vim-taskwarrior 2023-11-04 14:11:46 +11:00
8d300606c9
Skip fiddling with vim-marked's order, since vim-polyglot is gone 2023-11-04 14:11:27 +11:00
2e874407f7
Load vim-sensible first by putting it at the end of the alphabet (lol?) 2023-11-04 14:11:02 +11:00
e03f91a06a
Uninstall a bunch of plugins I'm not actively using 2023-11-04 13:51:13 +11:00
e82917918f
Always load Editorconfig the same way :) 2023-11-04 13:44:52 +11:00
66dc71d9b3
Comments explaining decisions in my init.vim 2023-11-04 13:44:02 +11:00
23adaca6b2
Make sure +linebreak is available before using it 2023-11-04 13:43:26 +11:00
17915a2130
Group together completion settings in init.vim 2023-11-04 13:42:46 +11:00
30a4a89955
Skip feature detection for stuff that always works if Vim9 script does 2023-11-04 13:41:00 +11:00
6932873ac0
Simplify termguicolors handling 2023-11-04 13:39:50 +11:00
2 changed files with 101 additions and 69 deletions

View file

@ -18,14 +18,16 @@ if !isdirectory($XDG_CACHE_HOME .. '/vim/pack')
PackUpdate PackUpdate
endif endif
if has('gui_running') || has('termguicolors') # If both Vim and the terminal it's running in support true colour, use it.
if $COLORTERM == 'truecolor' # Otherwise we just fall back to 256-colour mode, or even the old 16-colour
&t_8f = "\<Esc>[38:2:%lu:%lu:%lum" # mode if necessary!
&t_8b = "\<Esc>[48:2:%lu:%lu:%lum" if has('termguicolors') && $COLORTERM == 'truecolor'
endif
set termguicolors set termguicolors
endif endif
# Colour scheme and corresponding settings. gruvbox8 happens to work on pretty
# much any setup (GUI vim, true-colour terminal, 256 colours, even a 2-colour
# term if necessary!) so we don't need to mess around too much here.
set background=dark set background=dark
g:gruvbox_transp_bg = 1 g:gruvbox_transp_bg = 1
g:gruvbox_italicize_strings = 0 g:gruvbox_italicize_strings = 0
@ -33,60 +35,72 @@ g:gruvbox_filetype_hi_groups = 1
g:gruvbox_plugin_hi_groups = 1 g:gruvbox_plugin_hi_groups = 1
colorscheme gruvbox8 colorscheme gruvbox8
# I like being able to drop out of Insert mode without reaching for the Escape
# key in the corner. Some folks use jk instead but I find jj nice and quick.
inoremap jj <Esc> inoremap jj <Esc>
# lotabout/skim.vim's fuzzy file finder! It's basically a copy of fzf.vim, but
# it uses skim as the backend instead of fzf. Rust versions of command-line
# tools my beloved
nnoremap <C-t> :Files<CR> nnoremap <C-t> :Files<CR>
silent! packadd! editorconfig # We will always have Editorconfig available as an optional package, either
# because it was bundled with Vim or because Minpac installed it that way.
packadd! editorconfig
if exists('+belloff') set belloff+=ctrlg
set belloff+=ctrlg
# I like to explicitly set 'modelines' to the default 5 because some
# distributions change it to zero in the global config, and I want modelines
# to work.
set modelines=5
if has('linebreak')
set breakindent breakindentopt=sbr
set linebreak showbreak=
endif endif
set relativenumber
set showcmd
set completeopt+=menuone set completeopt+=menuone
set linebreak showbreak=
set modelines=5
set showcmd
set wildmode=longest,full set wildmode=longest,full
if has('patch-8.2.4325') set wildoptions+=pum
set wildoptions+=pum
endif
# This is a window-local setting but I like 2 by default. :) # This is a window-local setting but I like 2 by default. :)
set conceallevel=2 set conceallevel=2
# I like small indents. This setup supports both vim-sleuth and editorconfig,
# so files with different indent schemes will automatically be handled
# correctly, but this default is what I like personally. Also, I *vastly*
# prefer tabs over spaces for indentation, for the simple reason that if
# someone else needs a bigger indent size than I do, they can just change
# their editor's tabstop setting rather than having to reindent the whole
# file.
set tabstop=2 shiftwidth=2 set tabstop=2 shiftwidth=2
if exists('+breakindent')
set breakindent breakindentopt=sbr
endif
if exists('+relativenumber')
set relativenumber
else
set number
endif
for dir_name in ['backup', 'swap', 'undo'] for dir_name in ['backup', 'swap', 'undo']
EnsureDir($XDG_STATE_HOME .. '/vim/' .. dir_name) EnsureDir($XDG_STATE_HOME .. '/vim/' .. dir_name)
endfor endfor
# Try to save backup and swap files alongside the original file, but if that's
# not possible (directory not writable, for example), then fall back to the
# appropriate XDG directory instead.
set backupdir=.,$XDG_STATE_HOME/vim/backup set backupdir=.,$XDG_STATE_HOME/vim/backup
set directory=.,$XDG_STATE_HOME/vim/swap set directory=.,$XDG_STATE_HOME/vim/swap
# I like persistent undo! If Vim was built with it, then persist undo files
# for eveything in the XDG state home. :)
if exists('+undofile') if exists('+undofile')
set undofile set undofile
set undodir=$XDG_STATE_HOME/vim/undo set undodir=$XDG_STATE_HOME/vim/undo
endif endif
# This setup installs both tpope/vim-sensible and tpope/vim-sleuth, so we
# don't also need vim-polyglot to provide that same functionality.
g:polyglot_disabled = ['sensible', 'autoindent']
g:csv_no_conceal = 1 g:csv_no_conceal = 1
g:vim_svelte_plugin_use_typescript = 1 g:GPGDefaultRecipients = [
'Danielle McLean <dani@00dani.me>',
g:LatexBox_Folding = 1 ]
g:markdown_folding = 1 g:markdown_folding = 1
@ -94,21 +108,27 @@ g:ale_set_balloons = 1
nmap <silent> <C-k> <Plug>(ale_previous_wrap) nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap) nmap <silent> <C-j> <Plug>(ale_next_wrap)
# Get the correct filetype icons and matching colours when viewing a directory
# in Fern. As the name implies, this requires Nerd Fonts support, either by
# using a patched font or by having your setup substitute an icon font when
# necessary.
g:fern#renderer = 'nerdfont' g:fern#renderer = 'nerdfont'
augroup glyphPalette augroup glyphPalette
autocmd! autocmd!
autocmd FileType fern g:glyph_palette#apply() autocmd FileType fern g:glyph_palette#apply()
augroup END augroup END
g:mucomplete#can_complete = { # Configure a statusline and tabline using vim-crystalline. I tried a bunch of
default: { # different statusline plugins and this one, which is basically just a utility
omni: (t) => strlen(&l:omnifunc) > 0 && t =~# '\m\k\%(\k\|\.\)$' # library for writing your *own* statusline functions, worked the best for my
} # purposes. Very quick, naturally very configurable, I could tell the modified
} # buffer + to appear in red, all that good stuff. Yay!
import "./statusline.vim" import "./statusline.vim"
statusline.Init() statusline.Init()
# Set up LSP client support. My lsp.vim module both tells yegappan/lsp which
# LSP servers it can connect to and provides a way to install those servers if
# necessary.
import "./lsp.vim" import "./lsp.vim"
lsp.Configure() lsp.Configure()

View file

@ -1,5 +1,9 @@
vim9script vim9script
silent! packadd minpac silent! packadd minpac
# Automatically bootstrap Minpac if necessary. Once it's installed it knows
# how to manage and update itself, but Vim doesn't know how to install it
# without our help. ;)
if !exists('g:loaded_minpac') if !exists('g:loaded_minpac')
silent !git clone https://github.com/k-takata/minpac.git $XDG_CACHE_HOME/vim/pack/minpac/opt/minpac silent !git clone https://github.com/k-takata/minpac.git $XDG_CACHE_HOME/vim/pack/minpac/opt/minpac
augroup minpac augroup minpac
@ -9,34 +13,58 @@ if !exists('g:loaded_minpac')
endif endif
packadd minpac packadd minpac
# Minpac is told to install into the XDG cache home because if we do blow away
# that directory, it can and will simply reinstall everything I've configured
# it to install the next time Vim is launched.
minpac#init({dir: $XDG_CACHE_HOME .. '/vim'}) minpac#init({dir: $XDG_CACHE_HOME .. '/vim'})
minpac#add('k-takata/minpac', {type: 'opt'}) minpac#add('k-takata/minpac', {type: 'opt'})
minpac#add('tpope/vim-sensible')
minpac#add('prabirshrestha/async.vim') # tpope/vim-sensible is a collection of default Vim settings that "everyone
# can agree on", and is an excellent starting point for anyone's Vim config.
# We'd like it to load first, before any other plugins. However somewhat
# confusingly, Vim's native 'packages' feature adds plugins from pack/*/start
# to 'runtimepath' in REVERSE alphabetical order, so we have to put
# vim-sensible at the end of the alphabet like so to get it loaded first.
minpac#add('tpope/vim-sensible', {name: 'zz-vim-sensible'})
# Git support. Fugitive is a pretty famous wrapper that adds :Git commands
# when you're in a repo, and Rhubarb is a GitHub-specific support addon for
# it. (I don't personally use GitHub much, but work does, so whatever.)
# Signify marks changed lines in the current buffer with symbols in the left
# margin, which I finde very helpful.
minpac#add('tpope/vim-fugitive')
minpac#add('tpope/vim-rhubarb')
minpac#add('mhinz/vim-signify')
minpac#add('lifepillar/vim-gruvbox8') minpac#add('lifepillar/vim-gruvbox8')
# Project handling. Direnv is a tool for setting project-local environment
# variables as you cd around, and Editorconfig is a generic format telling
# text editors what your preferred indent size and stuff are for the given
# project. Both are very helpful to have integrated with Vim.
minpac#add('direnv/direnv.vim')
if !isdirectory($VIMRUNTIME .. '/pack/dist/opt/editorconfig') if !isdirectory($VIMRUNTIME .. '/pack/dist/opt/editorconfig')
minpac#add('editorconfig/editorconfig-vim') # If this Vim doesn't already provide Editorconfig as part of its runtime,
# install it ourselves, using exactly the same package name and type (opt, so
# that it can be loaded with :packadd).
minpac#add('editorconfig/editorconfig-vim', {name: 'editorconfig', type: 'opt'})
endif endif
minpac#add('direnv/direnv.vim') # skim is a standalone fuzzy finder, kinda like fzf or fzy or selecta, but
minpac#add('godlygeek/tabular') # written in Rust. These two plugins teach Vim to integrate with it, so you
minpac#add('jamessan/vim-gnupg') # can use skim's high performance fuzzy finding to locate stuff (files,
minpac#add('junegunn/vim-easy-align') # buffers, colorschemes) inside Vim. Nice!
minpac#add('lifepillar/vim-mucomplete')
minpac#add('lotabout/skim') minpac#add('lotabout/skim')
minpac#add('lotabout/skim.vim') minpac#add('lotabout/skim.vim')
minpac#add('mhinz/vim-signify')
minpac#add('sjl/vitality.vim') minpac#add('godlygeek/tabular')
minpac#add('jamessan/vim-gnupg')
minpac#add('lifepillar/vim-mucomplete')
minpac#add('tpope/vim-apathy') minpac#add('tpope/vim-apathy')
minpac#add('tpope/vim-commentary') minpac#add('tpope/vim-commentary')
minpac#add('tpope/vim-dadbod')
minpac#add('tpope/vim-endwise') minpac#add('tpope/vim-endwise')
minpac#add('tpope/vim-eunuch') minpac#add('tpope/vim-eunuch')
minpac#add('tpope/vim-fugitive')
minpac#add('tpope/vim-repeat') minpac#add('tpope/vim-repeat')
minpac#add('tpope/vim-rhubarb')
minpac#add('tpope/vim-sleuth') minpac#add('tpope/vim-sleuth')
minpac#add('tpope/vim-surround') minpac#add('tpope/vim-surround')
minpac#add('tpope/vim-unimpaired') minpac#add('tpope/vim-unimpaired')
@ -60,15 +88,6 @@ minpac#add('lambdalisue/fern-git-status.vim')
minpac#add('lambdalisue/fern-ssh') minpac#add('lambdalisue/fern-ssh')
minpac#add('alvan/vim-closetag') minpac#add('alvan/vim-closetag')
minpac#add('LaTeX-Box-Team/LaTeX-Box')
minpac#add('vhda/verilog_systemverilog.vim')
minpac#add('sheerun/vim-polyglot')
minpac#add('eipipuz/factor.vim')
minpac#add('ehamberg/vim-cute-python')
minpac#add('Glench/Vim-Jinja2-Syntax')
minpac#add('tweekmonster/braceless.vim')
minpac#add('vito-c/jq.vim') minpac#add('vito-c/jq.vim')
minpac#add('NoahTheDuke/vim-just') minpac#add('NoahTheDuke/vim-just')
@ -77,20 +96,13 @@ minpac#add('fladson/vim-kitty')
minpac#add('fpob/nette.vim') minpac#add('fpob/nette.vim')
minpac#add('leafOfTree/vim-svelte-plugin')
if executable('task') if executable('task')
minpac#add('farseer90718/vim-taskwarrior') minpac#add('blindFS/vim-taskwarrior')
endif endif
minpac#add('pedrohdz/vim-yaml-folds') minpac#add('pedrohdz/vim-yaml-folds')
minpac#add('alx741/yesod.vim')
minpac#add('pbrisbin/vim-syntax-shakespeare')
if has('macunix') if has('macunix')
minpac#add('rizzatti/dash.vim') minpac#add('rizzatti/dash.vim')
# We rename this plugin to make sure it loads AFTER vim-polyglot, minpac#add('itspriddle/vim-marked')
# since it won't work properly if it's loaded first.
minpac#add('itspriddle/vim-marked', {name: 'zzvim-marked'})
endif endif