2018-05-13 17:21:50 -05:00
|
|
|
" Sane vim defaults for ArchLabs
|
2018-05-01 23:57:34 -05:00
|
|
|
|
2018-05-13 17:21:50 -05:00
|
|
|
" Arch defaults
|
2018-05-01 23:57:34 -05:00
|
|
|
runtime! archlinux.vim
|
|
|
|
|
|
|
|
|
2018-05-13 17:21:50 -05:00
|
|
|
set modeline
|
|
|
|
set clipboard^=unnamedplus " system clipboard (requires +clipboard)
|
|
|
|
set number " enable line numbers
|
|
|
|
set confirm " ask confirmation for some things, like save before quit, etc.
|
|
|
|
set wildmenu " Tab completion menu when using command mode
|
|
|
|
set expandtab " Tab key inserts spaces not tabs
|
|
|
|
set softtabstop=4 " spaces to enter for each tab
|
|
|
|
set shiftwidth=4 " amount of spaces for indentation
|
|
|
|
set shortmess+=aAcIws " Hide or shorten certain messages
|
2018-05-01 23:57:34 -05:00
|
|
|
|
|
|
|
" enable mouse.. sgr is better but not every term supports it
|
|
|
|
set mouse=a
|
|
|
|
if has('mouse_sgr')
|
|
|
|
set ttymouse=sgr
|
|
|
|
endif
|
|
|
|
|
|
|
|
" syntax highlighting with true colors in the terminal
|
|
|
|
syntax enable
|
|
|
|
if has('termguicolors') && $DISPLAY !=? ''
|
|
|
|
set termguicolors
|
|
|
|
endif
|
|
|
|
|
|
|
|
" paste while in insert mode
|
|
|
|
inoremap <silent><C-v> <Esc>:set paste<CR>a<C-r>+<Esc>:set nopaste<CR>a
|
|
|
|
|
2018-05-13 17:21:50 -05:00
|
|
|
" alt defaults
|
2018-05-01 23:57:34 -05:00
|
|
|
nnoremap 0 ^
|
|
|
|
nnoremap Y y$
|
|
|
|
nnoremap n nzzzv
|
|
|
|
nnoremap N Nzzzv
|
|
|
|
nnoremap <Tab> ==j
|
|
|
|
|
2018-06-09 18:51:08 -05:00
|
|
|
" j = gj :: k = gk while preserving numbered jumps ie. 12j or 30k
|
2018-05-01 23:57:34 -05:00
|
|
|
nnoremap <buffer><silent><expr>j v:count ? 'j' : 'gj'
|
|
|
|
nnoremap <buffer><silent><expr>k v:count ? 'k' : 'gk'
|
|
|
|
|
2018-05-13 17:21:50 -05:00
|
|
|
" Reload changes if file changed outside of vim requires autoread
|
2018-05-01 23:57:34 -05:00
|
|
|
augroup load_changed_file
|
|
|
|
autocmd!
|
|
|
|
autocmd FocusGained,BufEnter * if mode() !=? 'c' | checktime | endif
|
|
|
|
autocmd FileChangedShellPost * echo "Changes loaded from file"
|
|
|
|
augroup END
|
|
|
|
|
2018-05-13 17:21:50 -05:00
|
|
|
" when quitting a file, save the cursor position
|
2018-05-01 23:57:34 -05:00
|
|
|
augroup save_cursor_position
|
|
|
|
autocmd!
|
|
|
|
autocmd BufReadPost * call setpos(".", getpos("'\""))
|
|
|
|
augroup END
|