My misc dotfiles (will likely dramatically change at random times, so the git history will likely be unclean, nonexistent, or otherwise bad practices). This is mostly for backup and in case anyone's curious
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
5.6 KiB

" x1phosura's .vimrc "
" "
" This is my basic .vimrc. I'm not a power user, but I like settings. "
" "
" note to self: vim navigates logical lines. To navigate a long paragraph up "
" and down when the paragraph is all on one line, use gj and gk. "
" enable truecolors if available
"if has('nvim') || has('termguicolors')
" set termguicolors
" TODO: check _if_ mypeachpuff exists, if not, use peachpuff
" colorscheme mypeachpuff
colorscheme peachpuff
syntax on
set guicursor= "force using block cursor (for neovim)
set hlsearch " highlights search targets
set mouse= " disables mouse support, re-enable by 'set mouse=a'
set colorcolumn=80 " creates vertical line at column 80
set cursorline " underlines currently selected line
" below sets CursorLine colors (233 assumes 256-bit color, more specific black)
hi CursorLine ctermbg=235
hi ColorColumn ctermbg=235
"set number relativenumber " use "hybrid" numbering (both number and relative)
set number " note to self: tun off with 'set nonumber'
set ruler " ???
set shortmess+=I " Don't show splash screen
""" statusline
set noshowmode " don't show vim mode below statusline
set laststatus=2 " set 'laststatus' bar (neovim default)
let g:currentmode={ 'n' : 'Normal ', 'no' : 'N-Operator Pending ',
\ 'v' : 'Visual ', 'V' : 'V-Line ', '^V' : 'V-Block ',
\ 's' : 'Select ', 'S': 'S-Line ', '^S' : 'S-Block ',
\ 'i' : 'Insert ', 'R' : 'Replace ', 'Rv' : 'V-Replace ',
\ 'c' : 'Command ', 'cv' : 'Vim Ex ', 'ce' : 'Ex ',
\ 'r' : 'Prompt ', 'rm' : 'More ', 'r?' : 'Confirm ',
\ '!' : 'Shell ', 't' : 'Terminal '}
" get the current mode for display in vim statusline
function! ModeCurrent() abort
let l:modecurrent = mode()
" use get() -> fails safely, since ^V doesn't seem to register
" 3rd arg is used when return of mode() == 0, which is case with ^V
" thus, ^V fails -> returns 0 -> replaced with 'V Block'
let l:modelist = toupper(get(g:currentmode, l:modecurrent, 'V-Block '))
let l:current_status_mode = l:modelist
return l:current_status_mode
" black on purple
highlight StatusHighlight term=bold ctermfg=0 ctermbg=13
" start building statusline
set statusline=%#StatusHighlight# " change background color to purple
set statusline+=\ %{ModeCurrent()} " put current mode here
set statusline+=%#ColorColumn#\ " change background color to ColorColumn
set statusline+=\ \[%n\] " show which vim buffer
"set statusline+=%* " switch back to normal statusline
set statusline+=\ %.30f " filename (truncate to 30 chars)
set statusline+=\ %m " modified flag
set statusline+=%= " format right side of statusline
set statusline+=\ %{&ff}, " unix or dos
set statusline+=%{&fileencoding?&fileencoding:&encoding}\ " File encoding
"set statusline+=\ %y " show filetype
set statusline+=%#StatusHighlight# " highlight purple
set statusline+=\ %l/%L: " current line/Total lines
set statusline+=%c%V " column number(-virtual column number)
"set statusline+=\ (%p%%) " percentage
set statusline+=%*
let g:netrw_liststyle = 3 " change netrw file manager view style
setlocal ff=unix " Changes file format to unix (changes line endings)
" Indentation settings according to personal preference, including
" settings for using 4 spaces instead of tabs.
" Do not change 'tabstop' from its default value of 8 with this setup.
set shiftwidth=4 " TODO: explain
set softtabstop=4 " TODO: explain
set expandtab " can re-enable typing tabs with 'set noexpandtab' or 'set noet'
set autoindent " should automatically indent
set noeol " make vim _not_ automatically append newline to files after exiting
" makes words not get cut off and split weirdly at end of border
setlocal linebreak
" autocmd stuff (note: 'au' == 'autocmd')
" includes language/filetype-specific settings
if has("autocmd")
" applies columns rule even when vim is resized (caused by terminal resizing)
au VimResized * | set columns=84
" set markdown notes to "wordwrap" kinda
au BufRead,BufNewFile *.md setlocal columns=84
" turns off tabs-to-spaces conversion for makefiles
au FileType make setlocal shiftwidth=8 softtabstop=8 tabstop=8 noexpandtab
au FileType c setlocal shiftwidth=8 softtabstop=8 tabstop=8 noexpandtab
au FileType sh setlocal shiftwidth=4 softtabstop=4 tabstop=4 expandtab
au BufRead,BufNewFile *.rkt,*.rktl set filetype=scheme
au FileType scheme setlocal equalprg=scmindent.rkt " not sure if works
let c_syntax_for_h=1 " assume header files are going to be C, not C++
" maps SHIFT-TAB to insert a real live tab character (in INSERT mode)
:inoremap <S-Tab> <C-V><Tab>
" double-<Esc> clears search highlights
"nnoremap <silent> <Esc><Esc> <Esc>:nohlsearch<CR><Esc>
" makes vim scroll fast (unnecesary for neovim)
set ttyfast