-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
80 lines (63 loc) · 1.57 KB
/
vimrc
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
"Set leader key
let mapleader = " "
" Allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" Key mappings
" Ctrl-C -> escape
:ino <C-C> <Esc>
" Indentation and spacing
set smartindent
set tabstop=2
set shiftwidth=2
set expandtab
" " Line numbers
set number
set relativenumber
if filereadable(expand("~/.vim/vimrc.plugins"))
source ~/.vim/vimrc.plugins
endif
" FZF
let $FZF_DEFAULT_COMMAND = 'ag -l -g ""'
map <C-p> :Files<CR>
" File behavior
let &backupdir = $HOME . "/.vim/backups"
let &undodir = $HOME . "/vim/undofiles"
function! EnsureDirExists(dir)
if !isdirectory(a:dir)
if exists("*mkdir")
call mkdir(a:dir,'p')
echo "SUCCESS" . a:dir
else
echo "WARNING: Unable to create directory" . a:dir
endif
endif
endfunction
call EnsureDirExists(&backupdir)
call EnsureDirExists(&undodir)
" Crosshair (CursorColumn)
set nocursorcolumn
set nocursorline
" Misc
set colorcolumn=80
set noswapfile
" NOTE: This should be at the bottom
" Colors
set t_Co=256
set background=dark
colorscheme PaperColor
" Search options
" Highlight search
set hlsearch
" Vim test bindings
nmap <silent> <leader>t :TestNearest<CR>
nmap <silent> <leader>T :TestFile<CR>
" Always start at top of file in commit message editor
autocmd FileType gitcommit call setpos('.', [0, 1, 1, 0])
" Move line
nnoremap <S-Up> :m-2<CR>
nnoremap <S-Down> :m+<CR>
inoremap <S-Up> <Esc>:m-2<CR>
inoremap <S-Down> <Esc>:m+<CR>