-
Notifications
You must be signed in to change notification settings - Fork 0
/
20181211.vimrc
212 lines (188 loc) · 6.18 KB
/
20181211.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
" Thomas Jansson 2018
" VIM PLUG SETUP and some downloads, see http://vimawesome.com/
" Consider installing the following:
" sudo apt install curl vim exuberant-ctags git ack-grep pep8 flake8 pyflakes isort
" sudo pip install pep8 flake8 pyflakes isort yapf build-essential cmake
"
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'scrooloose/syntastic'
Plug 'nvie/vim-flake8'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'ctrlpvim/ctrlp.vim'
"Plug 'FelikZ/ctrlp-py-matcher'
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'godlygeek/tabular'
Plug 'ervandew/supertab'
"Plug 'sirver/ultisnips'
Plug 'honza/vim-snippets'
Plug 'bling/vim-airline'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'jacoborus/tender' " Color
Plug 'flazz/vim-colorschemes' " http://vimcolors.com/?utf8=%E2%9C%93&bg=dark&colors=term&order=newest&page=3
Plug 'lifepillar/vim-solarized8'
Plug 'davidhalter/jedi-vim'
Plug 'sirver/ultisnips'
" Read https://github.com/honza/vim-snippets/blob/master/UltiSnips/tex.snippets
" Read https://github.com/honza/vim-snippets/blob/master/UltiSnips/python.snippets
call plug#end()
" General
let mapleader = ","
set showcmd
set relativenumber
" Colors
" classic solarized settings
let g:rehash256 = 1
"let g:solarized_termcolors=256
set t_Co=256
set background=dark
"colorscheme solarized
" solarized8 settings
let g:solarized_use16 = 1
colorscheme solarized8_flat
set t_BE= "Avoid 0~ and 1~ when copy pasting
" Setup plugins settings
setlocal foldmethod=manual
let g:airline#extensions#tabline#enabled = 1
let g:pymode_rope = 0
syntax enable
syntax on
let python_highlight_all=1
"JEDI - Remember to have a working PYTHONPATH
"let g:jedi#use_tabs_not_buffers = 1
" Snippets
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:ultisnips_python_style=0x3
" CtrlP settings
noremap <C-l> :CtrlP ../<CR>
noremap <C-x> :CtrlP ~/code<CR>
"nnoremap <leader>. :CtrlPTag<cr>
nnoremap <leader>. :Tags<CR>
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-t>'],
\ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
\ }
" PyMatcher for CtrlP
"if !has('python')
" echo 'In order to use pymatcher plugin, you need +python compiled vim'
"else
" let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
"endif
" Set delay to prevent extra search
let g:ctrlp_lazy_update = 350
" Do not clear filenames cache, to improve CtrlP startup
" You can manualy clear it by <F5>
let g:ctrlp_clear_cache_on_exit = 0
" Set no file limit, we are building a big project
let g:ctrlp_max_files = 0
" If ag is available use it as filename list generator instead of 'find'
if executable("ag")
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --ignore ''.git'' --ignore ''.DS_Store'' --ignore ''node_modules'' --hidden -g ""'
endif
"Only tabularize the first =
map <S-F5> :Tabularize /^[^=]*\zs=<cr>
"Align all the , in alist of dicts or tupples
map <S-F6> :Tabularize /,\zs<cr>
"Tabularize elements of a dict
map <S-F7> :Tabularize /:\zs<cr>
"Tabularize elements of a CSV
map <S-F8> :Tabularize /;\zs<cr>
set tabpagemax=50
" Move between tabs
map <F8> :tabp<cr>
map <F9> :tabn<cr>
" NERDtree
map <F3> :NERDTreeToggle<CR>
let g:NERDTreeIgnore = ['\.pyc$', '\.swp$']
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
let g:python_version_2 = 1
" Hide weird ctrl-g icons
augroup my_nerdtree
au!
au FileType nerdtree setl cole=3 cocu+=n
augroup END
let g:NERDTreeNodeDelimiter = "\u00a0"
" Syntastic
let g:syntastic_python_checkers = ['pyflakes']
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_quiet_messages = { "type": "style" }
" Remove trailing whitespaces from all lines
nnoremap <F4> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
nmap <F5> :w<CR> :! ./%<CR>
command! Q quit
command! W write
command! Wq wq
highlight Search term=standout ctermfg=3 cterm=standout
highlight Visual term=standout ctermfg=4 cterm=standout
if v:version > 74338
set breakindent
endif
set hlsearch
set backspace+=start,eol,indent
set backupdir=./.backup,.,/tmp
set directory=.,./.backup,/tmp
set expandtab
set ignorecase
set noerrorbells
set novisualbell
set nowrap
set shiftwidth=4
set showmatch
set smartcase
set smarttab
set softtabstop=4
set tabstop=4
set textwidth=0
set virtualedit=all
set wildignore=*.swp,*.bak,*.pyc,*.class
set ttyfast
set textwidth=120 " Not quite PEP8, but more readable on modern machines.
set colorcolumn=120
"" Filetypes
filetype on
filetype plugin on
filetype indent on
filetype plugin indent on
autocmd BufRead,BufNewFile *.tex set spell
autocmd BufRead,BufNewFile *.tex setlocal spell spelllang=en_us
" Spell checker
highlight clear SpellBad
highlight SpellBad term=standout ctermfg=1 term=underline cterm=underline
highlight clear SpellCap
highlight SpellCap term=underline ctermfg=1 cterm=underline
highlight clear SpellRare
highlight SpellRare term=underline ctermfg=1 cterm=underline
highlight clear SpellLocal
highlight SpellLocal term=underline ctermfg=1 cterm=underline
"switch spellcheck languages
let g:myLang = 0
let g:myLangList = [ "nospell", "en_us", "da" ]
function! MySpellLang() "loop through languages
let g:myLang = g:myLang + 1
if g:myLang >= len(g:myLangList) | let g:myLang = 0 | endif
if g:myLang == 0 | set nospell | endif
if g:myLang == 1 | setlocal spell spelllang=en_us | endif
if g:myLang == 2 | setlocal spell spelllang=da | endif
echo "language:" g:myLangList[g:myLang]
endf
map <F7> :call MySpellLang()<CR>
imap <F7> <C-o>:call MySpellLang()<CR>
" Tell vim to remember certain things when we exit, see http://vim.wikia.com/wiki/VimTip80
set viminfo='20,\"300,:20,%,n~/.viminfo
" when we reload, tell vim to restore the cursor to the saved position
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif