-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
186 lines (149 loc) · 6.03 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
" ============================================================
" ============================================================
" SETUP FILE VARIABLES, VUNDLE, AND LIST PLUGINS TO BE INSTALLED
" ============================================================
" ============================================================
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Colorscheme
Plugin 'reewr/vim-monokai-phoenix'
Plugin 'acevery/snipmate-plus'
Plugin 'scrooloose/nerdtree'
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'sjl/gundo.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'othree/html5.vim'
Plugin 'ag.vim'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'mxw/vim-jsx'
" Plugin 'SirVer/ultisnips'
" Plugin 'honza/vim-snippets'
call vundle#end()
" ============================================================
" Donielle Config
" ============================================================
" Create custom alias with this guy
let mapleader = ','
" VISUAL STUFF
set title " Sets the title at top of tab to be the filename if "titlestring" isn't defined
set laststatus=1 " Has to do with the status bar at the bottom. Check :help laststatus
set number " Line numbers on the left hand side
set visualbell " That bell is the worst sound. Shut it the fuck off.
syntax enable " Sets syntax highlighting on because what is this notepad
filetype plugin indent on " This gets vim to automatically load filetype specific options for plugins and indentation
" hi LineNr ctermfg=gray ctermbg=NONE
" "hi htmlTagName ctermfg=black ctermbg=NONE
" BASIC FUNCTIONALITY
set encoding=utf-8 " Duh
set history=5112 " Default is 20, I'd rather set this to infinity
set viminfo='1000,<500,:500,/500
set nofoldenable " Don't fold shit because it's the worst.
set ignorecase smartcase
set iskeyword+=- " Make hypenated words considered one tab stop
" Swap file stuff.
set noswapfile
set hidden
set undofile
set undodir=~/.vim/undo
" Formatting
set smartindent
set tabstop=2
set shiftwidth=2
set expandtab
"autocmd BufWritePre * :%s/\s\+$//e " Remove trailing whitespace on save
" Fix indenting for css style things (sass, css)
au BufEnter *.css set nocindent
au BufLeave *.css set cindent
au BufEnter *.scss set nocindent
au BufLeave *.scss set cindent
au BufEnter *.sass set nocindent
au BufLeave *.sass set cindent
au BufEnter *.less set nocindent
au BufLeave *.less set cindent
autocmd BufNewFile,BufRead *.scss set ft=scss.css "Sets filetype of scss to be css. Helps with plugins.
autocmd BufNewFile,BufRead *.less set ft=less.css "Sets filetype of less to be css. Helps with plugins.
" Enter newlines without entering insert mode
" http://vim.wikia.com/wiki/Insert_newline_without_entering_insert_mode
nnoremap <CR> o<Esc>k
" Local list nav
nnoremap fj :execute "noautocmd vimgrep /" . expand("<cword>") . "/j **" <Bar> cnext<CR>
nnoremap cn :cn<CR>
nnoremap cp :cp<CR>
"nnoremap -- :GundoToggle<CR>
" CtrlP customizations
nnoremap ff :CtrlP<CR>
let g:ctrlp_custom_ignore = '\v[\/](\.(git|hg|svn)|node_modules\|build\|dist\|lib)$'
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
let g:jsx_ext_required = 0 " Allow JSX in normal JS files
inoremap ;d :r !date -u <CR>
"
nnoremap <leader>v :e $MYVIMRC<CR>
nnoremap <leader>gx :Gbrowse<CR>
nnoremap <leader>g :Gstatus<CR>
nnoremap <leader>gc :Gcommit<CR>
nnoremap <leader>c :ccl<CR>
nnoremap <leader>o :copen<CR>
map <Esc><Esc> :w<CR>
set wildignore=node_modules/*,*.jpg,*.png,*.gif,*.woff,node_modules " See :help wildignore
autocmd FileType css set omnifunc=csscomplete#CompleteCSS " Gives css auto completion to files using filetype=css
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" Escape/unescape & < > HTML entities in range (default current line).
function! HtmlEntities(line1, line2, action)
let search = @/
let range = 'silent ' . a:line1 . ',' . a:line2
if a:action == 0 " must convert & last
execute range . 'sno/</</eg'
execute range . 'sno/>/>/eg'
execute range . 'sno/&/&/eg'
else " must convert & first
execute range . 'sno/&/&/eg'
execute range . 'sno/</</eg'
execute range . 'sno/>/>/eg'
endif
nohl
let @/ = search
endfunction
command! -range -nargs=1 Entities call HtmlEntities(<line1>, <line2>, <args>)
noremap <silent> \h :Entities 0<CR>
noremap <silent> \H :Entities 1<CR>
" ============================================================
" Layout & Mouse Functionality
" resize splits with mouse
set mouse+=a
if &term =~ '^screen'
" tmux knows the extended mouse mode
set ttymouse=xterm2
endif
" VIM WINDOW LAYOUT AND NAVIGATION
" Jumping between split windows, instead of ctrl-w-w just do ctrl-j to jump
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Copy and Paste from OSX clipboard
vmap <Leader>y y:call system("pbcopy", getreg("\""))<CR>
nmap <Leader>p :call setreg("\"",system("pbpaste"))<CR>p
" open current file in browser
nnoremap <Leader>ob :!open %<Enter>
" Auto close brackets and use control-j to escape out after done typing inside
imap <C-j> <Esc>:exec "normal f" . leavechar<CR>a
inoremap ( ()<Esc>:let leavechar=")"<CR>i
inoremap [ []<Esc>:let leavechar="]"<CR>i
inoremap { {}<Esc>:let leavechar="}"<CR>i
inoremap ' ''<Esc>:let leavechar="'"<CR>i
inoremap " ""<Esc>:let leavechar='"'<CR>i
" Nerdtree plugin - shortcut to open/close nerdtree side panel
map <Leader> :NERDTreeToggle<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" eslint and jsx
let g:syntastic_javascript_checkers=['eslint']
let g:syntastic_javascript_eslint_exe='$(npm bin)/eslint' " use local npm eslint instead of global