all repos — dotfiles-base @ 4143f443190bce542a389f280c2dd6d5b328560c

base important configs that can safely be used almost anywhere

.config/nvim/vimrc.vim

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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
"endif

set background=dark
"colorscheme ron
"colorscheme lunaperche
colorscheme wildcharm    " TODO manually copy over to nvim colors dir
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
endfunction

" 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,go 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
endif

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