-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
162 lines (117 loc) · 3.77 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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
"Run Pathogen
execute pathogen#infect()
execute pathogen#helptags()
" Set coloring and formatting of source files
syntax on
filetype plugin indent on
" Set 256 color
set t_Co=256
" Set vim mode
set nocompatible
" Set leader
let mapleader=","
" Set the timeout length
set timeoutlen=250
" General code style
set tw=80
set tabstop=2
set shiftwidth=2
set expandtab
set autoread
" Backspace settings
set backspace=indent,eol,start
" See where the cursor is in the file numerically
set ruler
" With 7.4, the current line number can be bumped out
set number
" Relative numbers for easy jumping
set relativenumber
" highlight search results
set hlsearch
" Map <Tab> to highlight indentation
nnoremap <Tab> /^ \+<CR>
" Code Folding
set fdm=indent
set foldlevelstart=999
set foldenable
"Start in no-paste mode
set nopaste
" Map space to help with code folding
nnoremap <Space> za
" Setup colors
set background=dark
colorscheme base16-tomorrow
" Configure :set spell highlighting
hi clear SpellBad
hi SpellBad ctermbg=red
" Configure RNU/NU coloring
hi CursorLineNr cterm=bold ctermbg=0 ctermfg=15
" Map Leader G to toggle cursor line and column
" G - grid
nnoremap <silent> <Leader>g :set cursorcolumn! cursorline!<CR>
" Map Leader F to search for and count occurrences of the current word
nnoremap <silent> <Leader>f :%s/<C-r><C-w>//ng<CR>
" Map Leader X to clear the current search
nnoremap <silent> <Leader>x :let @/ = ""<CR>
" Map Leader TS to opening a tool-sharpening list in a split
nnoremap <Leader>ts :split ~/tool-sharpening.txt<CR>
" Map Leader VR to opening my vimrc in a vertical split
nnoremap <Leader>vr :vsplit ~/.vimrc <CR>
"Map Leader v to toggling between paste modes
nnoremap <silent> <Leader>v :set paste!<CR>
"Map Leader TT to run the current spec file
nnoremap <silent> <Leader>tt :call RunCurrentSpecFile()<CR>
"Map Leader NT to run the nearest spec
nnoremap <silent> <Leader>nt :call RunNearestSpec()<CR>
"Map F7 to toggle spell checking
nnoremap <F7> :set spell!<CR>
" Map C-n to opening a new tab
nnoremap <silent> <C-n> :tabnew<CR>
" Map C-x to closing a tab
nnoremap <silent> <C-x> :tabclose<CR>
" Map clipboard copy on yank
nnoremap <silent> <Leader>y "*y
nnoremap <silent> <Leader>Y "*Y
" Map clipboard paste on put
nnoremap <silent> <Leader>p "*p
nnoremap <silent> <Leader>P "*P
"config.ru is a ruby file
autocmd BufNewFile,BufRead config.ru set ft=ruby
"Gemfile is a ruby file
autocmd BufNewFile,BufRead Gemfile,Gemfile.lock set ft=ruby
"Vagrantfile is a ruby file
autocmd BufNewFile,BufRead Vagrantfile,VagrantFile set ft=ruby
" My alias and funcion files are shell files
autocmd BufNewFile,BufRead {,.}{aliases,functions} set ft=sh
" When entering and leaving windows, clear and restore cursorcolumn/line
" Useful when multiple windows are open and you would like to see where you are
autocmd WinEnter * call LoadCursorColumnLineState()
autocmd WinLeave * call SaveCursorColumnLineState()
" Closing the command t window
let g:CommandTCancelMap='<C-x>'
" Configure vim-multiple-cursors
let g:multi_cursor_next_key='<C-a>'
let g:multi_cursor_prev_key='<C-s>'
let g:multi_cursor_skip_key='<C-q>'
" Configure ctrlp.vim
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 %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
function SaveCursorColumnLineState()
let w:columnstate = &cursorcolumn
let w:linestate = &cursorline
set nocursorcolumn
set nocursorline
endfunction
function LoadCursorColumnLineState()
if exists('w:columnstate') && exists('w:linestate')
let &cursorcolumn = w:columnstate
let &cursorline = w:linestate
endif
endfunction
let g:jsx_ext_required = 0