-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
184 lines (155 loc) · 5.06 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
" VIM 8.0 vimrc file
" configure vundle
set nocompatible
filetype off
set runtimepath+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'acarapetis/vim-colors-github'
Plugin 'airblade/vim-gitgutter'
Plugin 'altercation/vim-colors-solarized'
Plugin 'cespare/vim-toml'
Plugin 'chrisbra/csv.vim'
Plugin 'dense-analysis/ale'
Plugin 'honza/vim-snippets'
Plugin 'jiangmiao/auto-pairs'
Plugin 'JuliaEditorSupport/julia-vim'
Plugin 'jpo/vim-railscasts-theme'
Plugin 'keith/swift.vim'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'preservim/tagbar'
Plugin 'maksimr/vim-jsbeautify'
Plugin 'Mebus/jellybeans.vim'
Plugin 'peterhoeg/vim-qml'
Plugin 'PProvost/vim-ps1'
Plugin 'romainl/Apprentice'
Plugin 'rust-lang/rust.vim'
Plugin 'preservim/nerdtree'
Plugin 'sjl/badwolf'
Plugin 'tikhomirov/vim-glsl'
Plugin 'tomtom/tlib_vim'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-airline/vim-airline'
Plugin 'VundleVim/Vundle.vim'
call vundle#end()
behave xterm
filetype plugin indent on
syntax on
set autoread lazyredraw
set incsearch ignorecase hlsearch
set noswapfile
set encoding=utf-8
set fileformats=unix,dos,mac fileformat=unix
set number " show line numbers
set ruler " Always show current position
set magic " For regex turn magic on
set scrolloff=999 " keep cursor centered on screen
set showmatch matchtime=2
set t_Co=256
let g:solarized_termcolors=256
set background=light
colorscheme badwolf
if has("win32")
set guifont=Consolas:h11
else
set guifont=Hack\ 13
endif
set guioptions+=ae
set guioptions-=t
set splitright
set nobomb
set viminfo+=n~/.viminfo " for windows (i really hate _viminfo)
if has('gui_running') | set columns=95 lines=28 | endif
set colorcolumn=80 textwidth=80
set autoindent smartindent
set expandtab smarttab nojoinspaces
set shiftwidth=4
set softtabstop=4 " number of spaces in tab when editing
set list listchars=tab:>·,trail:·,nbsp:. " for indentation convenience
set wildmenu wildmode=list:longest,full
set wildignore=*.a,*.o,*.pyc,*.pyo,*.git " don't search compiled files
set pastetoggle=<F3> " F3 enters paste mode (solves indenting)
"set clipboard=unnamedplus " use system clipboard
set showcmd " show command in bottom bar
set showmode " show if in insert, visual or replace mode
set cursorline " highlight current line
set ttyfast mouse=a " enable mouse in terminal
set backspace=indent,eol,start
set laststatus=2 " show statusline
set tabpagemax=75 " let there be more than 10 tabs open at once
" control line break / wrapping behavior
set linebreak
set breakat-=.
set breakat-=-
" auto save on change of file
"autocmd TextChanged,TextChangedI <buffer> silent write
" make sure that commit messages wrap at 72 characters
autocmd Filetype gitcommit setlocal spell textwidth=72
"set foldenable " enable folding
"set foldlevelstart=10 " open most folds by default
"set foldmethod=indent " fold based on indent level
""" keymaps start here
" don't dedent comments
inoremap # X<BS>#
" tab navigation
map <C-Tab> :tabnext<CR>
map <C-S-Tab> :tabprevious<CR>
map <C-t> :tabnew<CR>
" scroll through split windows
nmap <C-h> :wincmd h<CR>
nmap <C-j> :wincmd j<CR>
nmap <C-k> :wincmd k<CR>
nmap <C-l> :wincmd l<CR>
" cut/copy/paste from and to global buffer
inoremap <C-v> <C-r>+
vnoremap <C-c> "+y
vnoremap <C-x> "+x
" make scrolling through wrapped lines easier
nmap j gj
nmap k gk
vmap j gj
vmap k gk
" make ^S save
nnoremap <silent> <C-s> :update<CR>
inoremap <silent> <C-s> <Esc>:update<CR>a
autocmd Filetype css,html,json setlocal softtabstop=2 shiftwidth=2
autocmd Filetype javascript,fortran setlocal softtabstop=2 shiftwidth=2
autocmd Filetype php,ruby,sh,vim setlocal softtabstop=2 shiftwidth=2
autocmd Filetype text,xhtml,xml setlocal softtabstop=2 shiftwidth=2
" delete trailing white space on save, useful for python and coffeescript
function! StripTrailingSpace()
execute "normal mz"
%substitute/\s\+$//ge
execute "normal `z"
endfunction
function! StripLeadingSpace()
execute "normal mz"
%substitute/^\s\+//ge
execute "normal `z"
endfunction
function! SrtToVtt() " i like screwing with captions
call append(0, ["WEBVTT", ""])
global/^\d\+$/d
%substitute/\v(\d\d:\d\d:\d\d),(\d\d\d)/\1.\2/g
set nobomb fileformat=unix fileencoding=utf-8
call StripTrailingSpace()
call StripLeadingSpace()
endfunction
autocmd BufWrite *.py :call StripTrailingSpace()
autocmd BufWrite *.coffee :call StripTrailingSpace()
" see https://vi.stackexchange.com/questions/3455
autocmd BufRead * let &l:modifiable = !&readonly
"""" plugin configurations start here
" NERDtree config
let NERDTreeChDirMode=2
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$', '\.swp$', '\.bak$', '\.pyo$',
\'\.o$', '\.a$', '\.so$', '__pycache__', '\.dll$', '\.lib$']
let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\~$']
let NERDTreeShowBookmarks=1
map <silent> <F2> :NERDTreeToggle<CR>
map <silent> <F12> :TagbarToggle<CR>
" indent fortran do loops properly
let fortran_do_enddo=1
" make airline have that nice streamline
" needs to have required powerline fonts installed
" works just as well without it
"let g:airline_powerline_fonts=1