62 lines
1.6 KiB
VimL
62 lines
1.6 KiB
VimL
![]() |
" A few sane defaults for use in ArchLabs
|
||
|
|
||
|
" load Arch Linux defaults
|
||
|
runtime! archlinux.vim
|
||
|
|
||
|
" system clipboard (requires +clipboard)
|
||
|
set clipboard^=unnamedplus
|
||
|
|
||
|
" enable line numbers
|
||
|
set number
|
||
|
|
||
|
" ask confirmation for some things, like save when quiting, etc.
|
||
|
set confirm
|
||
|
|
||
|
" Tab completion menu when using command mode
|
||
|
set wildmenu
|
||
|
|
||
|
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
|
||
|
|
||
|
" 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
|
||
|
|
||
|
" changed default mappings
|
||
|
nnoremap 0 ^
|
||
|
nnoremap Y y$
|
||
|
nnoremap n nzzzv
|
||
|
nnoremap N Nzzzv
|
||
|
nnoremap <Tab> ==j
|
||
|
|
||
|
" gj/k but preserve numbered jumps ie. 12j or 30k
|
||
|
nnoremap <buffer><silent><expr>j v:count ? 'j' : 'gj'
|
||
|
nnoremap <buffer><silent><expr>k v:count ? 'k' : 'gk'
|
||
|
|
||
|
" Reload changes if file changed outside of vim
|
||
|
" requires autoread (enabled by default)
|
||
|
augroup load_changed_file
|
||
|
autocmd!
|
||
|
autocmd FocusGained,BufEnter * if mode() !=? 'c' | checktime | endif
|
||
|
autocmd FileChangedShellPost * echo "Changes loaded from file"
|
||
|
augroup END
|
||
|
|
||
|
" when quitting, save cursor position
|
||
|
augroup save_cursor_position
|
||
|
autocmd!
|
||
|
autocmd BufReadPost * call setpos(".", getpos("'\""))
|
||
|
augroup END
|