forked from carmensea/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
257 lines (213 loc) · 7.43 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
set nocompatible " be iproved
filetype off " required!
"esc is far away, let's try ;; to get us out of insert mode
imap ;; <esc>
:nmap ; :
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"set rtp+=~/.local/lib/python2.7/site-packages/powerline/bindings/vim
set clipboard=unnamedplus
nmap <F9> :vs ~/devbootcamp/notes
Plugin 'tpope/vim-endwise'
"Manage Plugins
Plugin 'gmarik/vundle' "Vim plugin manager
"Autocomplete Plugins
Plugin 'alvan/vim-closetag'
Plugin 'tpope/vim-surround' "Adds 'cs' command to change pair characters
Plugin 'Townk/vim-autoclose' "Adds closing pairs
Plugin 'Raimondi/delimitMate'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'mattn/emmet-vim'
Plugin 'mattn/webapi-vim'
"Plugin 'Valloric/YouCompleteMe'
"Navigation Plugins
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter' "Adds easy comment and uncomment
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'majutsushi/tagbar'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'easymotion/vim-easymotion'
"Functional Plugins
Plugin 'itchyny/calendar.vim'
Plugin 'esneider/YUNOcommit.vim'
Plugin 'bling/vim-airline'
Plugin 'wincent/command-t'
Plugin 'thoughtbot/vim-rspec'
"Git Plugins
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive' "Adds git commands like :Gdiff, :Gstatus
"Search Plugins
Plugin 'tpope/vim-unimpaired'
Plugin 'msanders/snipmate.vim'
Plugin 'ctrlp/ctrlp.vim'
Plugin 'mileszs/ack.vim'
"Syntax Highlighting Plugins
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-rails' "Syntax + error highlight for rails
Plugin 'tpope/vim-haml' "Syntax highlight for haml
Plugin 'pangloss/vim-javascript'
Plugin 'kchmck/vim-coffee-script'
Plugin 'vim-ruby/vim-ruby'
Plugin 'leafgarland/typescript-vim'
call vundle#end()
filetype plugin indent on "req
"Vim Multiple Cursors Bindings
let g:multi_cursor_use_default_mapping=0
" Default mapping
"let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_next_key='<C-x>'
let g:multi_cursor_prev_key='<C-p>'
"let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
"6 characters before you complete me kicks in
let g:ycm_min_num_of_chars_for_completion = 6
"python from powerline.bindings.vim impor 'source_plugin; source_plugin()
let g:nerdtree_tabs_open_on_console_startup=0
"colorscheme solarized
let g:closetag_filenames = "*.html,*.xhtml,*.phtml"
let g:closetag_emptyTags_caseSensitive = 1
set background=dark
if has('gui_running')
set guifont=Inconsolata\ 13 " set fonts for gui vim
set guioptions=egmrt " hide the gui menubar
endif
" ARROW KEYS ARE UNACCEPTABLE
" map <Left> :echo "no!"<cr>
" map <Right> :echo "no!"<cr>
" map <Up> :echo "no!"<cr>
" map <Down> :echo "no!"<cr>
" Pretty obvious defaults if you ask me...
command! W :w
command! Q :q
command! Wq :wq
command! WQ :wq
" Map ctrl-movement keys to window switching
map <C-k> <C-w><Up>
map <C-j> <C-w><Down>
map <C-l> <C-w><Right>
map <C-h> <C-w><Left>
map <C-n> <plug>NERDTreeTabsToggle<CR>
map <C-m> :TagbarToggle<CR>
nnoremap <C-p> "+gP"
vmap <C-t> "*y
cmap w!! %!sudo tee > /dev/null/ %
set backspace=indent,eol,start
set history=100
set number " Show line numbers
set nowrap " Turn off Text Wrap
set scrolloff=3 " Keep more context when scrolling off the end of a buffer
set ruler " show the cursor position all the time
set wildmenu " Make tab completion for files/buffers act like bash
set showcmd " display incomplete commands
set hidden " keep undo history for background buffers
set autoread " autoamically read the file again when it is changed externally
set showtabline=2 " always show tab bar
set term=cons25 " fix issue with arrow keys
" Editting configuration
syntax enable
set pastetoggle=<F2>
set term=screen-256color
set ts=2
set smarttab
set showmatch
set encoding=utf-8
set noshowmode
set backup
set backupdir=~/.vim/backups
set directory=~/.vim/tmp
set noerrorbells
set belloff=all
set timeoutlen=350
"set mousehide
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
set smartindent
"enable fold based on indent with max level of 10
set foldmethod=indent
set foldnestmax=2
set foldlevel=100
set foldenable
set undofile "allow per file undo persistance
set undoreload=10000
set undodir=~/.vim/tmp/undo// "undo dir
set backupdir=~/.vim/tmp/backups// "backup dir -- // saves full filepath with % as folder delimeter
set directory=~/.vim/tmp/swap// "temporary dir for swap files
set backup "file backups enabled
set writebackup "enabling backups
set noswapfile "disable swaps - were using backups in 2017
" if undo and backup directories do not exist, make them
if !isdirectory(expand(&undodir))
call mkdir(expand(&undodir), "p")
endif
if !isdirectory(expand(&backupdir))
call mkdir(expand(&backupdir), "p")
endif
set listchars=tab:▸\ ,eol:¬,extends:❯,precedes:❮ "show unicode characters for tab,eol,and with wrap on
set showbreak=↪
if !isdirectory(expand(&directory))
call mkdir(expand(&directory), "p")
endif
nnoremap <leader>ww mz:%s/\s\+$//<cr>:let @/=''<cr>`z
"clears eol whitespace
nmap <f3> :TagbarToggle<CR>
" set smartindent
set laststatus=2
set statusline=%<%f\ (%{&ft})\ %-4(%m%)%=%-19(%3l,%02c%03V%)
"Search Stuff
set hlsearch " highlight previous search matches
set incsearch " search as you type
" Make searches case-sensitive only if they contain upper-case characters
set ignorecase
set smartcase
"pressing enter key in command mode removes search highlighting
nnoremap <CR> :nohlsearch <CR>
nnoremap Q <nop>
"set mouse=a
"Highlight trailing whitespace in red
:highlight ExtraWhitespace ctermbg=red guibg=red
:au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
:au InsertLeave * match ExtraWhitespace /\s\+$/
:match ExtraWhitespace /\s\+$/ " Show trailing whitespace
:match ExtraWhitespace /\s\+$\| \+\ze\t/ " Show trailing whitespace and spaces before a tab
:match ExtraWhitespace /[^\t]\zs\t\+/ " Show tabs that are not at the start of a line
cnoreabbrev td tab drop
" RSpec.vim mappings
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>g :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
"Spring rspec
"let g:rspec_command = '!spring rspec {spec}'
let g:rspec_command = '!RAILS_ENV=test bundle exec rspec {spec} --color --profile'
let g:calendar_google_calendar = 1
let g:calendar_google_task = 1
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
:nnoremap <LeftMouse> m'<LeftMouse>
:nnoremap <LeftRelease> <LeftRelease>g``
"use ag for ack.vim
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
"do not have ack jump to first response
cnoreabbrev Ack Ack!
"ack for the current word under cursor
nnoremap <Leader>a :Ack!<Space><C-R><C-W>
set mouse+=a
if &term =~ '^screen'
" tmux knows the extended mouse mode
set ttymouse=xterm2
endif
" tmux knows the extended mouse mode
nnoremap <leader>. :CtrlPTag<cr>
" Auto open tagbar
"autocmd VimEnter * nested :call tagbar#autoopen(1)
nmap <F8> :TagbarToggle<CR>
nmap <F12> :vs ~/github.com/carmensea/dotfiles/Sharpen.md
"Emmet Plugin
let g:user_emmet_settings = webapi#json#decode(join(readfile(expand('~/.snippets.json')), "\n"))
map <F10> :set invnumber
vnoremap <C-p> "+gP"