forked from dogeared/MicahVimFiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
200 lines (172 loc) · 4.69 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
set nocompatible
filetype plugin indent on
syntax on
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
set laststatus=2
" Vundle bundle manager
Bundle 'gmarik/vundle'
" After Command-T installs, make sure you run:
" cd ~/.vim/"Bundle/Command-T/ruby/command-t/
" ruby extconf.rb
" make
Bundle 'Command-T'
" EasyMotion
Bundle 'EasyMotion'
" Buffer explorer
Bundle 'bufexplorer.zip'
" Most recently used buffer
Bundle 'bufmru.vim'
" Change surrounding characters
Bundle 'surround.vim'
" Text alignment
Bundle 'Tabular'
" Code snipets
Bundle 'snipMate'
" Fast code commenting
Bundle 'The-NERD-Commenter'
" Project folder
Bundle 'The-NERD-tree'
" Stylus
Bundle 'vim-stylus'
" list functions
Bundle 'functionlist.vim'
" JSHint
Bundle 'walm/jshint.vim.git'
" DeleteTrailingWhitespace
Bundle 'vim-scripts/DeleteTrailingWhitespace.git'
" Lightline status bar
"Bundle 'itchyny/lightline.vim'
" Git Gutter
Bundle 'airblade/vim-gitgutter'
" Airline status bar
Bundle 'bling/vim-airline'
" Trailing Whitespace
Bundle 'bronson/vim-trailing-whitespace'
" -------- Syntax Coloring and indents -------
" Javascript text hilighting
Bundle 'pangloss/vim-javascript.git'
" Cucumber
Bundle 'cucumber.zip'
" Jade
Bundle 'digitaltoad/vim-jade.git'
" SnipMate
Bundle 'garbas/vim-snipmate'
set ar
set expandtab
set hid
set hlsearch
set incsearch
set nobackup
set noswapfile
set nu
set shiftwidth=2
set tabstop=2
set softtabstop=2
set wildignore+=.git,.svn,**/node_modules/*,DS_Store,*.log,*.sock
set wildignore+=*.png,*.gif,*.jpg,*.jpeg,*.class,nohup.out,*.swp
set wildignore+=*.tmproj,*.pid,**/tmp/*
set wildmenu
set wildmode=list:longest,full
set wrap
" functions
" Align Fit Tables
function! s:alignFitTables()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
command! -nargs=0 AlignFitTables call s:alignFitTables()
function! s:SetTestFile()
let g:CurrentTestFile = expand("%")
let g:CurrentTestExt = expand("%:e")
endfunction
command! -nargs=0 SetTestFile call s:SetTestFile()
function! s:RunTestFile()
:w
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
if !exists("g:CurrentTestFile")
let g:CurrentTestFile = expand("%")
let g:CurrentTestExt = expand("%:e")
endif
if g:CurrentTestExt == "js"
execute "w\|!TEST=true NODE_ENV=test ./node_modules/.bin/mocha --reporter spec
\ " . g:CurrentTestFile
elseif g:CurrentTestExt == "clj"
execute "w\|!echo \"I can't do this yet\""
endif
endfunction
command! -nargs=0 RunTestFile call s:RunTestFile()
let mapleader = ","
let maplocalleader = ","
cnoremap %% <C-R>=expand('%:h').'/'<cr>
nnoremap <leader>ev <C-w><C-v><C-l>:e ~/.vimrc<cr>
map <Leader>ga :CommandTFlush<CR>\|:CommandT<CR>
map <Leader>gf :CommandTFlush<CR>\|:CommandT %%<CR>
map <Leader>gl :CommandTFlush<CR>\|:CommandT lib<CR>
map <Leader>h :set invhls<CR>
noremap <Leader>i :set list!<CR>
imap jj <c-c>
nmap k gk
nmap j gj
"noremap <Up> <nop>
"noremap <Down> <nop>
"noremap <Left> <nop>
"noremap <Right> <nop>
map <Leader>r :RunTestFile<CR>
map <Leader>sv :so ~/.vimrc<CR>
map <Leader>; :SetTestFile<CR>
noremap <Leader>at :AlignFitTables<CR>
noremap <Leader>n :NERDTreeToggle<CR>
" bufexplorer
let g:bufExplorerDefaultHelp=1
let g:bufExplorerShowDirectories=0
let g:bufExplorerShowRelativePath=1
" command-t
let g:CommandTMaxFiles=10000
" Gui Setup *******************************************************************
if has("gui_running")
if has("gui_gnome")
set term=gnome-256color
set guifont=Inconsolata\ 16
set guioptions-=T
set guioptions-=m
set guioptions+=c
set guioptions-=rL
set lines=100
set columns=185
else
set guitablabel=%M%t
set lines=100
set columns=185
endif
if has("gui_mac") || has("gui_macvim")
set guifont=Inconsolata:h22
set fuoptions=maxvert,maxhorz
set guioptions-=T
set guioptions-=m
set guioptions+=c
set guioptions-=rL
" set colorcolumn=81
colorscheme jellybeans
endif
endif
if !has('gui_running')
set t_Co=256
endif
" NERDTree ********************************************************************
" User instead of Netrw when doing an edit /foobar
let NERDTreeHijackNetrw=1
" Single click for everything
let NERDTreeMouseMode=1
" Ignore
let NERDTreeIgnore=['\.git','\.DS_Store','\.pdf','\.png','\.jpg','\.gif']
" Quit on open
let NERDTreeQuitOnOpen=1
" Airline tabline stuff
let g:airline#extensions#tabline#enabled = 1