-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
87 lines (67 loc) · 1.79 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
81
82
83
84
85
86
87
source ~/.vimrc-plugins
set encoding=utf-8
scriptencoding utf-8
" Config
set autoread
set nobackup
" UI
set number
set relativenumber
filetype indent on
set colorcolumn=120
set visualbell
colorscheme gruvbox
set cursorline
" automatically rebalance windows on vim resize
autocmd VimResized * :wincmd =
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab
" Better search
set ignorecase
set smartcase
set hlsearch
set showmatch
set incsearch
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag -Q -l --nocolor --hidden -g "" %s'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" Strip all trailing whitespace everytime you save the file: ntpeters/vim-better-whitespace
autocmd BufWritePre * StripWhitespace
" Enable matchit plugin
runtime macros/matchit.vim
" Mappings
let mapleader = ','
" Indent file
map <Leader>i mmgg=G`m
" Switch between the last two files
nnoremap <leader><leader> <c-^>
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" shortcuts for clipboard copy/paste
vmap <Leader>y "*y
nmap <Leader>y "*y
nmap <Leader>p "*p
nmap <Leader>P "*P
vmap <Leader>p "*p
vmap <Leader>P "*P
" Vim Tmux Runner + Vim Rspec
let g:rspec_command = "VtrSendCommandToRunner! docker-compose run --rm development bash -c 'rspec {spec}'"
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
" Move between open buffers.
nmap <C-n> :bnext<CR>
nmap <C-N> :bprev<CR>