From be0a5b31eed48594faf1d23fc2ec7742da0cc5d7 Mon Sep 17 00:00:00 2001 From: Max Bucknell Date: Sat, 7 Sep 2024 10:06:24 +1000 Subject: [PATCH] We are back with Vim, everybody --- .../UltiSnips/sql.snippets | 0 .../UltiSnips/typescript.snippets | 0 .../UltiSnips/typescriptreact.snippets | 0 .../after/plugin/animate.vim | 0 .../after/plugin/coc.vim | 0 .../after/plugin/fzf.vim | 0 .../coc-settings.json | 0 .../colors/default-light.vim | 0 .../colors/dim.vim | 0 .../init.vim | 0 .../plugin/automkdir.vim | 0 .../plugin/fugitive.vim | 0 .../plugin/pathviewer.vim | 0 .../plugin/startup.vim | 0 .../plugin/synstack.vim | 0 .../plugin/windowmanagement.vim | 0 .../plugin/zoom.vim | 0 nvim/nvim.xdg.symlink/init.lua | 85 ++++++++ vim/vim.symlink/colors/mpwb.vim | 68 +++++++ vim/vimrc.symlink | 181 ++++++++++++++++++ zsh/zshrc.symlink | 9 +- 21 files changed, 336 insertions(+), 7 deletions(-) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/UltiSnips/sql.snippets (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/UltiSnips/typescript.snippets (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/UltiSnips/typescriptreact.snippets (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/after/plugin/animate.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/after/plugin/coc.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/after/plugin/fzf.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/coc-settings.json (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/colors/default-light.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/colors/dim.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/init.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/plugin/automkdir.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/plugin/fugitive.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/plugin/pathviewer.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/plugin/startup.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/plugin/synstack.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/plugin/windowmanagement.vim (100%) rename nvim/{nvim.xdg.symlink => nvim.xdg.symlink.old}/plugin/zoom.vim (100%) create mode 100644 nvim/nvim.xdg.symlink/init.lua create mode 100644 vim/vim.symlink/colors/mpwb.vim diff --git a/nvim/nvim.xdg.symlink/UltiSnips/sql.snippets b/nvim/nvim.xdg.symlink.old/UltiSnips/sql.snippets similarity index 100% rename from nvim/nvim.xdg.symlink/UltiSnips/sql.snippets rename to nvim/nvim.xdg.symlink.old/UltiSnips/sql.snippets diff --git a/nvim/nvim.xdg.symlink/UltiSnips/typescript.snippets b/nvim/nvim.xdg.symlink.old/UltiSnips/typescript.snippets similarity index 100% rename from nvim/nvim.xdg.symlink/UltiSnips/typescript.snippets rename to nvim/nvim.xdg.symlink.old/UltiSnips/typescript.snippets diff --git a/nvim/nvim.xdg.symlink/UltiSnips/typescriptreact.snippets b/nvim/nvim.xdg.symlink.old/UltiSnips/typescriptreact.snippets similarity index 100% rename from nvim/nvim.xdg.symlink/UltiSnips/typescriptreact.snippets rename to nvim/nvim.xdg.symlink.old/UltiSnips/typescriptreact.snippets diff --git a/nvim/nvim.xdg.symlink/after/plugin/animate.vim b/nvim/nvim.xdg.symlink.old/after/plugin/animate.vim similarity index 100% rename from nvim/nvim.xdg.symlink/after/plugin/animate.vim rename to nvim/nvim.xdg.symlink.old/after/plugin/animate.vim diff --git a/nvim/nvim.xdg.symlink/after/plugin/coc.vim b/nvim/nvim.xdg.symlink.old/after/plugin/coc.vim similarity index 100% rename from nvim/nvim.xdg.symlink/after/plugin/coc.vim rename to nvim/nvim.xdg.symlink.old/after/plugin/coc.vim diff --git a/nvim/nvim.xdg.symlink/after/plugin/fzf.vim b/nvim/nvim.xdg.symlink.old/after/plugin/fzf.vim similarity index 100% rename from nvim/nvim.xdg.symlink/after/plugin/fzf.vim rename to nvim/nvim.xdg.symlink.old/after/plugin/fzf.vim diff --git a/nvim/nvim.xdg.symlink/coc-settings.json b/nvim/nvim.xdg.symlink.old/coc-settings.json similarity index 100% rename from nvim/nvim.xdg.symlink/coc-settings.json rename to nvim/nvim.xdg.symlink.old/coc-settings.json diff --git a/nvim/nvim.xdg.symlink/colors/default-light.vim b/nvim/nvim.xdg.symlink.old/colors/default-light.vim similarity index 100% rename from nvim/nvim.xdg.symlink/colors/default-light.vim rename to nvim/nvim.xdg.symlink.old/colors/default-light.vim diff --git a/nvim/nvim.xdg.symlink/colors/dim.vim b/nvim/nvim.xdg.symlink.old/colors/dim.vim similarity index 100% rename from nvim/nvim.xdg.symlink/colors/dim.vim rename to nvim/nvim.xdg.symlink.old/colors/dim.vim diff --git a/nvim/nvim.xdg.symlink/init.vim b/nvim/nvim.xdg.symlink.old/init.vim similarity index 100% rename from nvim/nvim.xdg.symlink/init.vim rename to nvim/nvim.xdg.symlink.old/init.vim diff --git a/nvim/nvim.xdg.symlink/plugin/automkdir.vim b/nvim/nvim.xdg.symlink.old/plugin/automkdir.vim similarity index 100% rename from nvim/nvim.xdg.symlink/plugin/automkdir.vim rename to nvim/nvim.xdg.symlink.old/plugin/automkdir.vim diff --git a/nvim/nvim.xdg.symlink/plugin/fugitive.vim b/nvim/nvim.xdg.symlink.old/plugin/fugitive.vim similarity index 100% rename from nvim/nvim.xdg.symlink/plugin/fugitive.vim rename to nvim/nvim.xdg.symlink.old/plugin/fugitive.vim diff --git a/nvim/nvim.xdg.symlink/plugin/pathviewer.vim b/nvim/nvim.xdg.symlink.old/plugin/pathviewer.vim similarity index 100% rename from nvim/nvim.xdg.symlink/plugin/pathviewer.vim rename to nvim/nvim.xdg.symlink.old/plugin/pathviewer.vim diff --git a/nvim/nvim.xdg.symlink/plugin/startup.vim b/nvim/nvim.xdg.symlink.old/plugin/startup.vim similarity index 100% rename from nvim/nvim.xdg.symlink/plugin/startup.vim rename to nvim/nvim.xdg.symlink.old/plugin/startup.vim diff --git a/nvim/nvim.xdg.symlink/plugin/synstack.vim b/nvim/nvim.xdg.symlink.old/plugin/synstack.vim similarity index 100% rename from nvim/nvim.xdg.symlink/plugin/synstack.vim rename to nvim/nvim.xdg.symlink.old/plugin/synstack.vim diff --git a/nvim/nvim.xdg.symlink/plugin/windowmanagement.vim b/nvim/nvim.xdg.symlink.old/plugin/windowmanagement.vim similarity index 100% rename from nvim/nvim.xdg.symlink/plugin/windowmanagement.vim rename to nvim/nvim.xdg.symlink.old/plugin/windowmanagement.vim diff --git a/nvim/nvim.xdg.symlink/plugin/zoom.vim b/nvim/nvim.xdg.symlink.old/plugin/zoom.vim similarity index 100% rename from nvim/nvim.xdg.symlink/plugin/zoom.vim rename to nvim/nvim.xdg.symlink.old/plugin/zoom.vim diff --git a/nvim/nvim.xdg.symlink/init.lua b/nvim/nvim.xdg.symlink/init.lua new file mode 100644 index 0000000..d111da4 --- /dev/null +++ b/nvim/nvim.xdg.symlink/init.lua @@ -0,0 +1,85 @@ +-------------------------- +-- Vim Functionality Stuff +-------------------------- + +-- Disable creation of swap files +vim.opt.backup = false +vim.opt.writebackup = false +vim.opt.swapfile = false + +-- Set updatetime for showing hints. +-- It's funny, updatetime is used for swap file creation and CursorHold autoevent +-- But we don't use swap files (yet? Maybe we will? +vim.opt.updatetime = 300 + +-- Keep buffers around when they are not visible +vim.opt.hidden = true + +-- Keep buffers up to date with external changes +vim.opt.autoread = true + +-- Show incomplete command outputs in buffer +vim.opt.showcmd = true + +-- Improve searching behaviour +vim.opt.ignorecase = true +vim.opt.smartcase = true + +----------- +-- UI Stuff +----------- + +vim.opt.colorcolumn = "+1" + +-- Status Line +vim.opt.laststatus = 2 -- Always show status line +vim.opt.statusline = "-[%.30t]-%y-" -- filename and filetype + + +-- Invisible characters +vim.opt.list = true +vim.opt.listchars = "tab:‣ ,trail:·,extends:◣,precedes:◢,nbsp:○" +vim.opt.fillchars = "stl:—,stlnc:·,eob: " + +-- Hide :intro +vim.opt.shortmess:append("I") + +-- Disable code folding +vim.opt.foldmethod = "manual" +vim.opt.foldenable = false + +vim.opt.cursorline = true +vim.opt.textwidth = 80 +vim.opt.wrap = true + +vim.opt.number = true +vim.opt.relativenumber = true + +vim.opt.scrolloff = 5 + +vim.opt.splitbelow = true +vim.opt.splitright = true + +------------------ +-- Code Formatting +------------------ + +vim.opt.expandtab = true +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.softtabstop = 4 +vim.autoindent = true + +---------------------- +-- Syntax Highlighting +---------------------- + +vim.cmd("syntax off") +vim.cmd([[ + syntax off + hi LineNr ctermfg=4 + hi CursorLineNr ctermfg=7 ctermbg=0 + hi Search ctermfg=7 ctermbg=8 + + filetype plugin indent on +]]) diff --git a/vim/vim.symlink/colors/mpwb.vim b/vim/vim.symlink/colors/mpwb.vim new file mode 100644 index 0000000..1200f48 --- /dev/null +++ b/vim/vim.symlink/colors/mpwb.vim @@ -0,0 +1,68 @@ +hi clear + +if exists("syntax_on") + syntax reset +endif + +""""""""""""""""""""""""""""" +" +" Terminal colours cheatsheet +" +" 0: foreground +" 1: red +" 2: green +" 3: yellow +" 4: blue +" 5: magenta +" 6: cyan +" 7: background +" +" +8 for bright colours. +" +""""""""""""""""""""""""""""" + +let g:colors_name = "mpwb" + +hi Normal cterm=italic ctermfg=NONE ctermbg=NONE +hi Type cterm=NONE ctermfg=NONE ctermbg=NONE +hi Keyword cterm=NONE ctermfg=NONE ctermbg=NONE +hi Operator cterm=NONE ctermfg=NONE ctermbg=NONE +hi Special cterm=NONE ctermfg=NONE ctermbg=NONE +hi Statement cterm=NONE ctermfg=NONE ctermbg=NONE +hi Identifier cterm=NONE ctermfg=NONE ctermbg=NONE +hi Constant cterm=NONE ctermfg=NONE ctermbg=NONE +hi Define cterm=NONE ctermfg=NONE ctermbg=NONE +hi Include cterm=NONE ctermfg=NONE ctermbg=NONE +hi Macro cterm=NONE ctermfg=NONE ctermbg=NONE + +hi VimHiAttrib cterm=NONE ctermfg=NONE ctermbg=NONE +hi VimOption cterm=NONE ctermfg=NONE ctermbg=NONE + +" Scalars are cyan +hi String cterm=NONE ctermfg=4 ctermbg=NONE +hi Number cterm=NONE ctermfg=4 ctermbg=NONE +hi Boolean cterm=NONE ctermfg=4 ctermbg=NONE + +" Comments are green +hi Comment cterm=NONE ctermfg=2 ctermbg=NONE +hi Todo cterm=bold ctermbg=2 ctermfg=7 + +hi CursorLine cterm=bold + +hi Search ctermfg=0 ctermbg=3 + +hi VertSplit ctermfg=5 ctermbg=NONE cterm=NONE +hi StatusLine ctermfg=5 ctermbg=NONE cterm=bold +hi StatusLineNC ctermfg=5 ctermbg=NONE cterm=NONE + +hi Visual ctermfg=7 ctermbg=0 + +if &background == 'dark' + hi LineNr cterm=NONE ctermfg=15 ctermbg=NONE + hi CursorLineNr cterm=bold ctermfg=15 ctermbg=0 +endif + +if &background == 'light' + hi LineNr cterm=NONE ctermfg=0 ctermbg=NONE + hi CursorLineNr cterm=bold ctermfg=0 ctermbg=NONE +endif diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 8b13789..d2846c5 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -1 +1,182 @@ +set nocompatible +set encoding=utf-8 +scriptencoding utf-8 + +" Syntax and colors and things +filetype plugin indent on +syntax on +syntax manual + +" Disable Swapping +set nobackup nowritebackup noswapfile + +" Statusline +" e.g. - [foobar.rs] - [rust] ---- +set laststatus=2 +set statusline=-[%.30t]-%y- +set fillchars=stl:—,eob:\ +set fillchars+=stlnc:— +set fillchars+=vert:\| + +" Hide intro message +set shortmess+= + +set nowrap + +" Relative numbering with absolute anchor +set number relativenumber + +" Keep buffers open in memory when not visible +set hidden + +" Keep buffers up to date with external changes +set autoread + +set backspace=indent,eol,start + +" Show invisibles +set list +set listchars=tab:‣\ ,trail:·,extends:◣,precedes:◢,nbsp:○ + +" Disable folding +set foldmethod=manual +set nofoldenable + +" Search fixes +set ignorecase smartcase incsearch hlsearch gdefault + +" Show incomplete command-based changes in realtime +set showcmd + +" And breathe... +set scrolloff=5 + +" I think left to write, top to bottom +set splitright splitbelow + + +" Basic whitespace +set nojoinspaces +set expandtab +set shiftwidth=4 +set softtabstop=4 +set autoindent + +" Show me when my lines are too long +" +" I wish to limit my lines to 80 characters long. However, Vim creates +" the n+1th character when you have n characters in a line. Hence, when +" my line is 80 characters long, I see the red line. So, this is set to +" 82, meaning that I only see the line when my lines actually are too long. +call matchadd('ColorColumn', '\%82v', 100) + +" Mappings etc +let mapleader = "\" +let localmapleader = "\\" + +" Use jk to escape back to normal +inoremap jk +tnoremap jk +inoremap + +" Switch between recent buffers +nnoremap + +" Fix shift-semicolon to write +noremap ; : +noremap ;; ; + +" I should map these to something useful +inoremap +inoremap +inoremap +inoremap +noremap +noremap +noremap +noremap + +" Case control +nnoremap u viwU +nnoremap l viwu + +" Pretend ex mode doesn't exist +nnoremap Q + +" Moving lines around +nnoremap - ddp== +nnoremap _ :-1dpk== + +" Quick access vimrc +nnoremap ev :tabedit $MYVIMRC + +augroup updateVimrc + autocmd! + + autocmd BufWritePost $MYVIMRC :source $MYVIMRC +augroup END + +" Pane management +nnoremap +nnoremap +nnoremap +nnoremap + +" Focus mode + +function Zoom() + if exists('g:is_zoomed') + unlet g:is_zoomed + execute "wincmd =" + else + let g:is_zoomed = 'true' + execute "wincmd _" + execute "wincmd \|" + endif +endfunc + +nnoremap z :call Zoom() + +" Show nice things on active pane only +augroup activePaneManagement + autocmd! + + autocmd WinEnter,VimEnter,BufWinEnter * setl rnu cul syntax=ON + autocmd WinLeave,BufWinLeave,BufLeave * setl nornu nocul syntax=OFF +augroup END + +" Make directories in a filename if they don't exist. + +function! EnsureDirExists () + let required_dir = expand("%:h") + if !isdirectory(required_dir) + try + call mkdir( required_dir, 'p' ) + catch + echom "Could not create directory" + exit + endtry + endif +endfunction + +augroup AutoMkdir + autocmd! + autocmd BufNewFile * :call EnsureDirExists() +augroup END + + +" Show syntax highlighting groups for word under cursor +" +" This is useful for finding rogue elements I forgot in my colour +" scheme. +nnoremap \ :call SynStack() +function! SynStack() + if !exists("*synstack") + return + endif + echo map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")') +endfunc + +" Syntax highlighting +colorscheme mpwb diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index 6c5b916..3f7322d 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -114,9 +114,6 @@ ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='none' ZSH_HIGHLIGHT_STYLES[assign]='none' ZSH_HIGHLIGHT_STYLES[default]='none' -# Set editor -export EDITOR="/usr/local/bin/nova" - # Get the first part of the hostname # # Sometimes they have dots in them, I'm not partial to that. @@ -199,10 +196,9 @@ setopt hist_lex_words source /opt/homebrew/share/liquidprompt # Vim! -alias vim=nvim # I made this typo once and never again. -alias vi=nvim -alias v=nvim +alias vi=vim +alias v=vim # Bazel -__- alias bazel='bazelisk' @@ -256,4 +252,3 @@ esac # pnpm end test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" -