-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.local
146 lines (115 loc) · 3.89 KB
/
vimrc.local
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
" Basic look 'n feel
syntax enable
set background=dark
if !has('gui_running')
" fixes colors over ssh ¯\_(ツ)_/¯
" https://github.com/altercation/solarized/issues/107
let g:solarized_termtrans=1
endif
colorscheme solarized
set cursorline
set scrolloff=3
set relativenumber
set noshowmode " since we're using the lightline plugin
" Use the mouse
set mouse+=a
if &term =~ '^screen'
set ttymouse=xterm2
endif
" Use the same clipboard for vim and the OS
set clipboard=unnamed
" Case insensitive search by default, except when a capital letter is entered
set ignorecase
set smartcase
" Emacs shortcuts for moving to beginning/end of line
inoremap <C-a> <Home>
inoremap <C-e> <End>
" Speed up switching back to normal mode
set timeoutlen=1000 ttimeoutlen=0
" Speed up ALE linting for large files
let g:ale_cache_executable_check_failures = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_insert_leave = 0
" Change cursor in insert mode
" (assumes iTerm2 on OS X):
" http://vim.wikia.com/wiki/Change_cursor_shape_in_different_modes
if system("if [ $TMUX ]; then echo 1; else echo 0; fi")
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_SR = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
" Status bar
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly', 'relativepath', 'modified' ] ]
\ },
\ 'inactive': {
\ 'left': [ ['relativepath', 'modified' ] ]
\ },
\ 'component': {
\ 'readonly': '%{&filetype=="help"?"":&readonly?"⭤":""}',
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}',
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
\ },
\ 'component_visible_condition': {
\ 'readonly': '(&filetype!="help"&& &readonly)',
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
\ },
\ }
" New hotness for fuzzy finding files
let g:fzf_command_prefix = 'Fzf'
nnoremap <Leader>fe :FzfFiles<CR>
nnoremap <Leader>fb :FzfBuffers<CR>
nnoremap <Leader>ft :FzfTags<CR>
nnoremap <Leader>p :echoe "Use <Leader>fe"<CR>
nnoremap <Leader>pe :echoe "Use <Leader>fe"<CR>
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" Git
nnoremap <Leader>g :G<CR>
nnoremap <Leader>gb :Git blame<CR>
nnoremap <Leader>ga :Gwrite<CR>
nnoremap <Leader>gc :Gcommit -v<CR>
nnoremap <Leader>gd :Gdiff<CR>
" Grep stuff from https://robots.thoughtbot.com/faster-grepping-in-vim
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
nnoremap <Leader>k :Ag<SPACE>
" RSpec runner customization
let test#ruby#rspec#options = {
\ 'nearest': '--format documentation',
\ 'file': '--format documentation',
\ 'suite': '--fail-fast',
\}
augroup vimrc.localEx
autocmd!
" Set syntax highlighting for BDT PRISM letters
" autocmd BufRead,BufNewFile *.ltr set filetype=ruby
" Make it more obvious which split you're in
autocmd WinEnter * call WinEnterHighlight()
autocmd WinLeave * call WinLeaveUnHighlight()
function WinEnterHighlight()
" set relativenumber
set cursorline
endfunction
function WinLeaveUnHighlight()
" set norelativenumber
set nocursorline
endfunction
augroup END