99 lines
4.9 KiB
VimL
99 lines
4.9 KiB
VimL
" ==============================================================================
|
|
" vimrc file for niblock :: Use `:so %` to re-source after changes
|
|
" ==============================================================================
|
|
" ==============================================================================
|
|
" General Settings
|
|
" ==============================================================================
|
|
set nocompatible " Why? (https://goo.gl/2RiJoo)
|
|
|
|
if !exists('g:syntax_on')
|
|
syntax enable " Syntax hilighting
|
|
endif
|
|
|
|
filetype plugin indent on " Enable filetype/indent/plugins
|
|
set encoding=utf-8 " Character encoding
|
|
set spelllang=en_us " Set default dictionary
|
|
set autoread " Auto-reload modified files
|
|
set hidden " Allow for un-saved buffers
|
|
set autochdir " Change directory automatically
|
|
|
|
set clipboard+=unnamed " Include the global buffer
|
|
|
|
set autoindent " Enable auto-indentation
|
|
set expandtab " Spaces for tab
|
|
set shiftwidth=2 " Spaces per shift
|
|
set softtabstop=2 " Spaces to use when editing
|
|
set listchars=tab:>-,trail:· " Show me tabs and spaces
|
|
|
|
set number " Enable line numbers
|
|
set wrap " Wrap text
|
|
set textwidth=80 " How long a line is
|
|
set winwidth=90 " Minimum width of a window
|
|
set scrolloff=5 " 5 line scroll buffer
|
|
|
|
set foldmethod=indent " Fold on indent
|
|
set foldlevelstart=99 " No default folding
|
|
|
|
set path+=** " Recursive filename completion
|
|
set wildmenu " Enable wildmenu
|
|
set wildmode=list:longest:full " Configure wildmenu
|
|
set wildignorecase " Ignore case for wildmenu
|
|
set ignorecase smartcase " Ignore case, unless it matters
|
|
set incsearch " Zoom to results as I search
|
|
set nohlsearch " Disable search highlighting
|
|
|
|
let g:netrw_liststyle=3 " Netrw Tree list style
|
|
let g:netrw_banner=0 " Disable the netrw banner
|
|
" ==============================================================================
|
|
" Colors [VIM Only]
|
|
" ==============================================================================
|
|
if !has('nvim')
|
|
set termguicolors " Enable fancy colors
|
|
|
|
if filereadable(expand('~/.config/vim/colors/catppuccin_frappe.vim'))
|
|
colorscheme catppuccin_frappe " Set colorscheme, if available
|
|
endif
|
|
|
|
hi link User1 Directory " Set User statusline colors
|
|
hi link User2 Title " Used as '%n*', n = 1..6
|
|
hi link User3 SpellBad " See :hi for colors
|
|
hi link User4 Added
|
|
hi link User5 Changed
|
|
hi link User6 Removed
|
|
endif
|
|
" ==============================================================================
|
|
" Status Line [VIM Only]
|
|
" ==============================================================================
|
|
if !has('nvim')
|
|
set laststatus=2 " Enable the statusline
|
|
set statusline=%!SLine() " Style it
|
|
|
|
function! SLine() abort
|
|
let sline="" " Initialize it
|
|
let sline.="%3*%m" " Modified flag
|
|
let sline.="%1*%{expand('%:p:h')}/" " Full-path to current buffer
|
|
let sline.="%2*%t" " File name
|
|
let sline.="%=" " Switch to right-side
|
|
let sline.="%4*%y\ " " Filetype
|
|
let sline.="%5*%{&spell?'[SPELL]':''}" " Spell flag
|
|
let sline.="%6*%r" " Read-only flag
|
|
let sline.="%1*\|%4l\:%2c\|" " Line and column
|
|
return sline
|
|
endfunction
|
|
endif
|
|
" ==============================================================================
|
|
" Mappings
|
|
" ==============================================================================
|
|
let mapleader = ','
|
|
" Make moving up/down work on wrapped lines of text
|
|
nnoremap <silent> j gj
|
|
nnoremap <silent> k gk
|
|
nnoremap <silent> ^ g^
|
|
nnoremap <silent> $ g$
|
|
" Allow saving of files as sudo when I forgot to start vim using sudo.
|
|
cmap w!! w !sudo tee > /dev/null %
|
|
" Remove Trailing Whitespaace
|
|
nnoremap <silent> <leader>rtw :<C-u>%s/\s\+$//e<CR>
|
|
" Emulate vim-vinegar
|
|
nnoremap <silent> - :silent edit <C-R>=empty(expand('%')) ? '.' :
|
|
\ expand('%:p:h')<CR><CR>
|