-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.vim
More file actions
227 lines (223 loc) · 6.21 KB
/
init.vim
File metadata and controls
227 lines (223 loc) · 6.21 KB
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
set nocompatible
filetype off
call plug#begin('~/.config/nvim/plugged')
Plug 'tpope/vim-fugitive'
Plug 'mattn/emmet-vim'
Plug 'kien/ctrlp.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-markdown'
Plug 'tpope/vim-surround'
Plug 'airblade/vim-gitgutter'
Plug 'mustache/vim-mustache-handlebars'
Plug 'scrooloose/nerdtree'
Plug 'tomasr/molokai'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'mxw/vim-jsx'
Plug 'lifepillar/vim-solarized8'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'godlygeek/tabular'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'zchee/deoplete-jedi'
call plug#end()
filetype plugin indent on
syntax on
set relativenumber
set nu
set smartindent
set termguicolors
color solarized8
let g:airline_theme='solarized'
" change color background based on time of day
let hr = (strftime('%H'))
if hr >= 19
set background=dark
let g:airline_solarized_bg='dark'
elseif hr >= 8
set background=light
let g:airline_solarized_bg='light'
elseif hr >= 0
set background=dark
let g:airline_solarized_bg='dark'
endif
let g:gruvbox_contrast="hard"
set shiftwidth=2
set tabstop=2
set expandtab
map <Up> <NOP>
map <Down> <NOP>
map <Left> <NOP>
map <Right> <NOP>
imap <Up> <NOP>
imap <Down> <NOP>
imap <Left> <NOP>
imap <Right> <NOP>
nnoremap <CR> G
nnoremap <BS> gg
nmap H 0
nmap L $
vmap H 0
vmap L $
imap fd <Esc>
map j gj
map k gk
set backspace=indent,eol,start
set smartindent
set autoindent
let mapleader = "\<Space>"
nnoremap <Leader>x :x<CR>
nnoremap <Leader>q :q!<CR>
nnoremap <Leader>gs :Gstatus<CR>
nnoremap <Leader>gc :Gcommit<CR>
nnoremap <Leader>gp :Gpush<CR>
nnoremap <Leader>gpl :Gpull<CR>
nnoremap <Leader>gd :Gdiff<CR>
nnoremap <Leader>w :w!<CR>
nnoremap <Leader>nt :NERDTree<CR>
nnoremap <Leader>sr :SyntasticReset<CR>
au FileType clojure nnoremap <Leader>e :Eval<CR>
" leader mappings for testing
nmap <silent> <leader>T :TestNearest<CR>
nmap <silent> <leader>t :TestFile<CR>
nmap <silent> <leader>a :TestSuite<CR>
nmap <silent> <leader>l :TestLast<CR>
nmap <silent> <leader>g :TestVisit<CR>
inoremap {<cr> {<cr>}<c-o>O
inoremap [<cr> [<cr>]<c-o>O
inoremap (<cr> (<cr>)<c-o>O
" leader mappings for copy and paste
vmap <Leader>y "+y
vmap <Leader>d "+d
nmap <Leader>p "+p
nmap <Leader>P "+P
vmap <Leader>p "+p
vmap <Leader>P "+P
" function for html cursor positioning
function! Expander()
let line = getline(".")
let col = col(".")
let first = line[col-2]
let second = line[col-1]
let third = line[col]
if first ==# ">"
if second ==# "<" && third ==# "/"
return "\<CR>\<C-o>==\<C-o>O"
else
return "\<CR>"
endif
else
return "\<CR>"
endif
endfunction
inoremap <expr> <CR> Expander()
" disabling rope
let g:pymode_rope=0
" disabling automatic comment insertion
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" emmet stuff
let g:user_emmet_install_global = 0
au FileType html,css EmmetInstall
" all my file/language specific settings
au FileType html imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")
au FileType html imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")
au FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr>
au FileType css noremap <buffer> <c-f> :call CSSBeautify()<cr>
au FileType scss noremap <buffer> <c-f> :call CSSBeautify()<cr>
au FileType javascript noremap <buffer> <c-f> :call JsBeautify()<cr>
au FileType java inoremap {<cr> {<cr>}<c-o>O<tab>
au FileType clojure let b:AutoPairs = {'(':')', '[':']', '{':'}', '"': '"', '`':'`'}
au FileType c setlocal tabstop=4 shiftwidth=4
" more javascript config
let g:used_javascript_libs = 'underscore,jquery,react,flux,jasmine,chai'
" no swap
set noswapfile
" Prevent replacing paste buffer on paste
function! RestoreRegister()
let @" = s:restore_reg
return ''
endfunction
function! s:Repl()
let s:restore_reg = @"
return "p@=RestoreRegister()\<cr>"
endfunction
vmap <silent> <expr> p <sid>Repl()
set wrap
set nofoldenable
" Show matching brackets
set showmatch
" Ignore case when searching
set ignorecase
" Look for uppercase when searched
set smartcase
" highlight all search results
set hlsearch
set linebreak
set wrap
" setting ignores for ctrlp
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|bower_components'
" whitespace stuff
autocmd BufWritePre * :%s/\s\+$//e
" quick command to create a new file
command -nargs=1 E execute('silent! !mkdir -p "$(dirname "<args>")"') <Bar> e <args>
" function for switching line number mode
function! NumberToggle()
if(&relativenumber == 1)
set norelativenumber
set number
else
set nonumber
set relativenumber
endif
endfunc
nnoremap <Leader>nu :call NumberToggle()<CR>
map <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
let g:python_host_prog='/Users/jake/.pyenv/versions/neovim2/bin/python'
let g:python3_host_prog='/Users/jake/.pyenv/versions/neovim3/bin/python'
" test stuff
let test#strategy = 'neoterm'
" terminal stuff
set shell=/usr/local/bin/zsh
tnoremap <Leader>ee <C-\><C-n>
" more leaders
nnoremap <Leader>te <C-w>s <C-w><C-w> :resize 15<CR> :term<CR>
nnoremap <Leader>v :vertical resize -5<CR>
nnoremap <Leader>npm :T npm install<CR>
nnoremap <Leader>h :resize -5<CR>
nnoremap <Leader>qt <C-w><C-w> :q!<CR>
nnoremap <Leader>rc :e ~/.nvim/init.vim<CR>
nnoremap <Leader>rct :tabe ~/.nvimrc<CR>
" airline config
set laststatus=2
let g:airline_powerline_fonts=1
let python_highlight_all = 1
function! SwitchBackground()
if(&bg == "dark")
set background=light
else
set background=dark
endif
endfunction
nnoremap <Leader>sl :call SwitchBackground()<CR>
let g:python_host_prog = "/usr/local/bin/python2"
" code folding stuff
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=1
" deoplete stuff
let g:deoplete#enable_at_startup = 1
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
endfunction
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" tags stuff
set tags=./tags,tags;$HOME
" extra python syntax stuff
augroup python
autocmd!
autocmd FileType python
\ syn keyword pythonFunction self
augroup end