-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
171 lines (136 loc) · 4.25 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
set nocompatible
set runtimepath+=~/.dotfiles/vim
" Disable loading of zip plugin
let g:loaded_zipPlugin= 1
let g:loaded_zip = 1
" Initialize Pathogen
runtime bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect()
map <C-p> :NERDTreeToggle<CR>
let NERDTreeQuitOnOpen=1
autocmd CursorMoved,CursorMovedI * diffupdate
autocmd InsertEnter,InsertLeave * diffupdate
" Enable syntax highlighting
syntax on
" Colorscheme
let g:rehash256 = 1
colorscheme notmolokai
" colorscheme default
" Visual autocomplete for command menu
set wildmenu
" Add line numbers
set number
set ruler
" Set encoding
set encoding=utf-8
" Whitespace stuff
set nowrap
set tabstop=2
set shiftwidth=2
set softtabstop=2
set noexpandtab
filetype plugin indent on
" Show trailing spaces and highlight hard tabs
set list listchars=tab:»·,trail:·
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
map <ESC>b :%!xxd<CR>
map <ESC>B :%!xxd -r<CR>
" Home/End Keys
map <ESC>[H ^
map <ESC>[F $
" Chromebook: Shift + Left/Right as Home/End
map <ESC>[1;2D ^
map <ESC>[1;2C $
" Search related settings
set incsearch
set hlsearch
" Map Ctrl+l to clear highlighted searches
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
set viminfo='20,<1000,s1000
set pastetoggle=<F10>
nnoremap <ESC>Oa :wincmd k<CR>
nnoremap <ESC>Ob :wincmd j<CR>
nnoremap <ESC>[1;5D :wincmd h<CR>
nnoremap <ESC>[1;5C :wincmd l<CR>
nnoremap <ESC>[1;3A :wincmd k<CR>
nnoremap <ESC>[1;3B :wincmd j<CR>
nnoremap <ESC>[1;3D :wincmd h<CR>
nnoremap <ESC>[1;3C :wincmd l<CR>
nnoremap <ESC>q :qa<CR>
nnoremap <ESC>w :wa<CR>
nnoremap <ESC>1 :b1<CR>
nnoremap <ESC>2 :b2<CR>
nnoremap <ESC>3 :b3<CR>
nnoremap <ESC>4 :b4<CR>
nnoremap <ESC>5 :b5<CR>
nnoremap <ESC>6 :b6<CR>
nnoremap <ESC>7 :b7<CR>
nnoremap <ESC>8 :b8<CR>
nnoremap <ESC>9 :b9<CR>
nnoremap <ESC>0 :b10<CR>
nnoremap <ESC>q :qa<CR>
nnoremap <ESC>w :wa<CR>
" Disable code folding
set nofoldenable
" Directories for swp files
set backupdir=~/.vimbackup
set directory=~/.vimbackup
" Additional syntax highlighting
au BufRead,BufNewFile *.rsc set filetype=rsc
au BufNewFile,BufRead PKGBUILD set filetype=PKGBUILD
au BufNewFile,BufRead [Dd]ockerfile,Dockerfile.*,*.Dockerfile set filetype=dockerfile
au BufNewFile,BufRead *.automount set filetype=systemd
au BufNewFile,BufRead *.mount set filetype=systemd
au BufNewFile,BufRead *.path set filetype=systemd
au BufNewFile,BufRead *.service set filetype=systemd
au BufNewFile,BufRead *.socket set filetype=systemd
au BufNewFile,BufRead *.swap set filetype=systemd
au BufNewFile,BufRead *.target set filetype=systemd
au BufNewFile,BufRead *.timer set filetype=systemd
" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
" md, markdown, and mk are markdown and define buffer-local preview
function s:setupMarkup()
map <buffer> <Leader>p :Mm <CR>
endfunction
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
" try to detect indention style
fu Select_tab_style()
if search('^ ', 'n', 150)
set expandtab
en
endf
au BufRead,BufNewFile * call Select_tab_style()
" add json syntax highlighting
au BufNewFile,BufRead *.json set ft=javascript
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" ctrp custom ignores
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$\|\.eunit$',
\ 'file': '\.exe$\|\.so$\|\.dll\|\.beam$\|\.DS_Store$'
\ }
" disable welcome-message
set shortmess+=I
set laststatus=2
if !has('gui_running')
set t_Co=256
endif
let g:lightline = {
\ 'colorscheme': 'notwombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component': {
\ 'readonly': '%{&filetype=="help"?"":&readonly?"RO":""}',
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}',
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
\ },
\ 'component_visible_condition': {
\ 'readonly': '(&filetype!="help"&& &readonly)',
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
\ },
\ }