We are back with Vim, everybody
This commit is contained in:
parent
a7a5399121
commit
be0a5b31ee
21 changed files with 336 additions and 7 deletions
85
nvim/nvim.xdg.symlink/init.lua
Normal file
85
nvim/nvim.xdg.symlink/init.lua
Normal file
|
@ -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
|
||||||
|
]])
|
68
vim/vim.symlink/colors/mpwb.vim
Normal file
68
vim/vim.symlink/colors/mpwb.vim
Normal file
|
@ -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
|
|
@ -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 = "\<space>"
|
||||||
|
let localmapleader = "\\"
|
||||||
|
|
||||||
|
" Use jk to escape back to normal
|
||||||
|
inoremap jk <esc>
|
||||||
|
tnoremap jk <C-\><C-n>
|
||||||
|
inoremap <esc> <nop>
|
||||||
|
|
||||||
|
" Switch between recent buffers
|
||||||
|
nnoremap <leader><leader> <c-^>
|
||||||
|
|
||||||
|
" Fix shift-semicolon to write
|
||||||
|
noremap ; :
|
||||||
|
noremap ;; ;
|
||||||
|
|
||||||
|
" I should map these to something useful
|
||||||
|
inoremap <up> <nop>
|
||||||
|
inoremap <down> <nop>
|
||||||
|
inoremap <left> <nop>
|
||||||
|
inoremap <right> <nop>
|
||||||
|
noremap <up> <nop>
|
||||||
|
noremap <down> <nop>
|
||||||
|
noremap <left> <nop>
|
||||||
|
noremap <right> <nop>
|
||||||
|
|
||||||
|
" Case control
|
||||||
|
nnoremap <leader>u viwU
|
||||||
|
nnoremap <leader>l viwu
|
||||||
|
|
||||||
|
" Pretend ex mode doesn't exist
|
||||||
|
nnoremap Q <nop>
|
||||||
|
|
||||||
|
" Moving lines around
|
||||||
|
nnoremap - ddp==
|
||||||
|
nnoremap _ :-1d<cr>pk==
|
||||||
|
|
||||||
|
" Quick access vimrc
|
||||||
|
nnoremap <leader>ev :tabedit $MYVIMRC<cr>
|
||||||
|
|
||||||
|
augroup updateVimrc
|
||||||
|
autocmd!
|
||||||
|
|
||||||
|
autocmd BufWritePost $MYVIMRC :source $MYVIMRC<cr>
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" Pane management
|
||||||
|
nnoremap <c-j> <c-w><c-j>
|
||||||
|
nnoremap <c-k> <c-w><c-k>
|
||||||
|
nnoremap <c-h> <c-w><c-h>
|
||||||
|
nnoremap <c-l> <c-w><c-l>
|
||||||
|
|
||||||
|
" 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 <leader>z :call Zoom()<cr>
|
||||||
|
|
||||||
|
" 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 <leader>\ :call <SID>SynStack()<CR>
|
||||||
|
function! <SID>SynStack()
|
||||||
|
if !exists("*synstack")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" Syntax highlighting
|
||||||
|
colorscheme mpwb
|
||||||
|
|
|
@ -114,9 +114,6 @@ ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='none'
|
||||||
ZSH_HIGHLIGHT_STYLES[assign]='none'
|
ZSH_HIGHLIGHT_STYLES[assign]='none'
|
||||||
ZSH_HIGHLIGHT_STYLES[default]='none'
|
ZSH_HIGHLIGHT_STYLES[default]='none'
|
||||||
|
|
||||||
# Set editor
|
|
||||||
export EDITOR="/usr/local/bin/nova"
|
|
||||||
|
|
||||||
# Get the first part of the hostname
|
# Get the first part of the hostname
|
||||||
#
|
#
|
||||||
# Sometimes they have dots in them, I'm not partial to that.
|
# 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
|
source /opt/homebrew/share/liquidprompt
|
||||||
|
|
||||||
# Vim!
|
# Vim!
|
||||||
alias vim=nvim
|
|
||||||
# I made this typo once and never again.
|
# I made this typo once and never again.
|
||||||
alias vi=nvim
|
alias vi=vim
|
||||||
alias v=nvim
|
alias v=vim
|
||||||
|
|
||||||
# Bazel -__-
|
# Bazel -__-
|
||||||
alias bazel='bazelisk'
|
alias bazel='bazelisk'
|
||||||
|
@ -256,4 +252,3 @@ esac
|
||||||
# pnpm end
|
# pnpm end
|
||||||
|
|
||||||
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
|
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue