-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
202 lines (161 loc) · 5.16 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
" Set up powerline functionality
python3 from powerline.vim import setup as powerline_setup
python3 powerline_setup()
python3 del powerline_setup
" Dumb fix
" set timeoutlen=30 ttimeoutlen=0
" Assistance config for powerline
set noshowmode
set laststatus=2
" vim-plug
call plug#begin()
" Chris Kempson's Base-16 theme
Plug 'chriskempson/base16-vim'
Plug 'terlar/base16-vim-powerline'
" Autocompletion
" Plug 'Valloric/YouCompleteMe'
" FileFinding
Plug 'scrooloose/nerdtree'
Plug 'kien/ctrlp.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" I don't type so good
Plug 'Chiel92/vim-autoformat'
Plug 'google/vim-maktaba'
Plug 'google/vim-codefmt'
Plug 'tpope/vim-commentary'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'w0rp/ale'
" Webdev
Plug 'tpope/vim-surround'
Plug 'mattn/emmet-vim'
Plug 'chrisbra/Colorizer'
" Django
Plug 'tweekmonster/django-plus.vim'
" Version Control
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
" Python
Plug 'davidhalter/jedi-vim', { 'for': ['python'] }
Plug 'mgedmin/python-imports.vim'
Plug 'avakhov/vim-yaml'
" Rust
Plug 'cespare/vim-toml'
" Go
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
" Notetaking
Plug 'xolox/vim-notes'
Plug 'xolox/vim-misc'
" A Vim Plugin for Lively Previewing LaTeX PDF Output
Plug 'xuhdev/vim-latex-live-preview'
" MIPS
Plug 'harenome/vim-mipssyntax'
" JSX Stuff
Plug 'mxw/vim-jsx'
call plug#end()
" Change the colorscheme
colorscheme base16-default-dark
let base16colorspace=256 " Access colors present in 256 colorspace
set termguicolors
let g:Powerline_colorscheme = 'base16'
" Relative line numbering
set number relativenumber
" YCM Settings
let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
let g:ycm_complete_in_comments = 1 " Completion in comments
let g:ycm_complete_in_strings = 1 " Completion in string
if &term =~ '256color'
" Disable Background Color Erase (BCE) so that color schemes
" work properly when Vim is used inside tmux and GNU screen.
set t_ut=
endif
let &t_ut=''
" Keybinds
noremap <F9> :Autoformat<CR>
noremap <F10> :FormatCode<CR>
map <F7> :w<CR> :b#<CR>
noremap <F5> :ImportName<CR>
noremap <M-g> :Gwrite
noremap <M-p> :Git push
noremap <M-c> :Gcommit
" I like my indents small
set tabstop=4
" HTMLDjango Indent Fix
au FileType htmldjango setl sw=2 sts=2 et
" NERDTree thinks it deserves all that room? Hah!
:let g:NERDTreeWinSize=50
" Python
" let g:pymode_python = 'python3'
" let g:pymode_rope = 1
" let g:pymode_rope_autoimport = 1
" let g:ropevim_autoimport_modules = ["os.*","traceback","django.*","typings"]
" let g:pymode_rope_autoimport_modules = ["os.*","traceback","django.*", "typings"]
" let g:pymode_lint_cwindow = 0
" Git
set diffopt+=vertical
" UltiSnips settings
let g:UltiSnipsExpandTrigger="<c-l>"
let g:UltiSnipsJumpForwardTrigger="<Right>"
let g:UltiSnipsJumpBackwardTrigger="<Left>"
" Possibly the coolest Django mapping ever
let g:last_relative_dir = ''
nnoremap \1 :call RelatedFile ("models.py")<cr>
nnoremap \2 :call RelatedFile ("views.py")<cr>
nnoremap \3 :call RelatedFile ("urls.py")<cr>
nnoremap \4 :call RelatedFile ("admin.py")<cr>
nnoremap \5 :call RelatedFile ("tests.py")<cr>
nnoremap \6 :call RelatedFile ( "templates/" )<cr>
nnoremap \7 :call RelatedFile ( "templatetags/" )<cr>
nnoremap \8 :call RelatedFile ( "management/" )<cr>
nnoremap \0 :e settings.py<cr>
nnoremap \9 :e urls.py<cr>
fun! RelatedFile(file)
" This is to check that the directory looks djangoish
if filereadable(expand("%:h"). '/models.py') || isdirectory(expand("%:h") . "/templatetags/")
exec "edit %:h/" . a:file
let g:last_relative_dir = expand("%:h") . '/'
return ''
endif
if g:last_relative_dir != ''
exec "edit " . g:last_relative_dir . a:file
return ''
endif
echo "Cant determine where relative file is : " . a:file
return ''
endfun
fun SetAppDir()
if filereadable(expand("%:h"). '/models.py') || isdirectory(expand("%:h") . "/templatetags/")
let g:last_relative_dir = expand("%:h") . '/'
return ''
endif
endfun
autocmd BufEnter *.py call SetAppDir()
set expandtab ts=4 sw=4 ai
" Underline settings
let &t_Cs = "\e[4:3m"
let &t_Ce = "\e[4:0m"
" Linter settings
let g:ale_sign_error = '✖'
let g:ale_sign_warning = '●'
let g:ale_sign_column_always = 1
let g:ale_python_pylint_options = "--load-plugins=pylint_django --max-line-length=100"
hi ALEError gui=undercurl guisp=red cterm=undercurl
hi ALEWarning gui=undercurl guisp=red cterm=undercurl
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|www'
set tags=tags
set spell
hi clear SpellBad
hi SpellBad cterm=underline ctermfg=203
" LaTeX Settings
autocmd Filetype tex setl updatetime=1000
let g:livepreview_previewer = 'evince'
let g:livepreview_engine = 'pdflatex' . ' -shell-escape -interaction=nonstopmode $*'
augroup FiletypeGroup
autocmd!
au BufNewFile,BufRead *.jsx set filetype=javascript.jsx
augroup END
let g:ale_linters = {'jsx': ['stylelint', 'eslint']}
let g:ale_linter_aliases = {'jsx': 'css'}