-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimrc
181 lines (147 loc) · 4.69 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
" Ian's .vimrc file. If you're not using VIM, you should be. "
set nocompatible
" Pathogen stuff
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
" Security
set modelines=0
" Tabs
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" Basic options
set autoindent
set smartindent
set ruler
set nohls
set scrolloff=3
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest
set ttyfast
set laststatus=2
set backspace=indent,eol,start
"set backspace=2
"set encoding=utf-8
"set visualbell
filetype plugin on
" Relative numbering only supported in 7.3+
if v:version >= 703
set relativenumber
else
set number
endif
" Make the status line more useful
set statusline= " clear the statusline for when vimrc is reloaded
set statusline+=%-3.3n\ " buffer number
set statusline+=%f\ " file name
set statusline+=%h%m%r%w " flags
set statusline+=[%{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding
set statusline+=%{&fileformat}] " file format
set statusline+=%= " right align
set statusline+=%{synIDattr(synID(line('.'),col('.'),1),'name')}\ " highlight
set statusline+=%b,0x%-8B\ " current char
set statusline+=%l,%c%V\ (%P) " offset
" Show hidden whitespace characters
set list listchars=tab:▷⋅,trail:⋅,nbsp:⋅
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
" Set the colors if the terminal supports it
if &term =~? 'mlterm\|xterm'
set t_Co=256
endif
" Color scheme
syntax on
set background=dark
colorscheme molokai/colors/molokai
" Mode-specific status line color
function! InsertStatuslineColor(mode)
if a:mode == 'i'
hi statusline guifg=#F92672
elseif a:mode == 'r'
hi statusline guifg=#66D9EF guibg=#080808
else
hi statusline guifg=#AE81FF
endif
endfunction
autocmd InsertEnter * call InsertStatuslineColor(v:insertmode)
autocmd InsertLeave * hi statusline guifg=#455354 guibg=fg
" Makefile sanity
autocmd FileType make set noet ts=8 sw=8 sts=8
autocmd FileType py set textwidth=79 " PEP-8
autocmd FileType markdown set textwidth=79 " Personal preference
autocmd FileType c,cpp setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd Filetype gitcommit set textwidth=72
autocmd FileType yaml set ts=2 sw=2 sts=2
if exists('+colorcolumn')
set colorcolumn=80
endif
"Set up home and end keys"
map OH 0
map OF $
"Set up page up and page down keys"
map [5~
map [6~
"Set up graphical options"
"set guifont=-b&h-lucidatypewriter-medium-r-normal-*-*-100-*-*-m-*-iso8859-1
if has("gui_macvim")
set guifont=Menlo\ Bold:h12
else
set guifont=bitstream\ vera\ sans\ mono\ 10
endif
" The default methods for highlighting. Can be overridden later.
" There should be only six of these, because many terminals can only use
" six different colors (plus black and white). It doesn't look nice with
" too many colors too.
"highlight Comment term=bold ctermfg=6 guifg=Blue
"highlight Constant ctermfg=2 guifg=Red gui=NONE
"highlight Identifier ctermfg=2 guifg=DarkCyan
"highlight Statement term=bold cterm=bold ctermfg=5 gui=bold guifg=Brown
"highlight PreProc ctermfg=4 guifg=Purple
"highlight Type ctermfg=2 guifg=SeaGreen gui=bold
"highlight Special term=bold ctermfg=6 guifg=SlateBlue
" These two change the background
"highlight Error term=reverse ctermbg=1 guibg=Orange
"highlight Todo term=standout ctermbg=3 guifg=Blue guibg=Yellow
" Leader
let mapleader = ","
" Make
nmap <leader>m :make<cr>
" NERDTree
map <F2> :NERDTreeToggle<cr>
" GUI-specific settings
if has('gui_running')
set go-=T " Disable toolbar
set go-=l " Disable left scroll
set go-=L " Disable left scroll in vertical split
set go-=r " Disable right scroll
set go-=R " Disable right scroll in vertical split
set go-=m " Disable menu
set cursorline
endif
" Window splits
nmap <leader>sw<left> :topleft vnew<CR>
nmap <leader>sw<right> :botright vnew<CR>
nmap <leader>sw<up> :topleft new<CR>
nmap <leader>sw<down> :botright new<CR>
" Buffer splits
nmap <leader>s<left> :leftabove vnew<CR>
nmap <leader>s<right> :rightbelow vnew<CR>
nmap <leader>s<up> :leftabove new<CR>
nmap <leader>s<down> :rightbelow new<CR>
" Save
noremap <C-s> :w<CR>
" Paste toggling
set pastetoggle=<leader>p
" Tagbar
nmap <leader>c :TagbarToggle<CR>
" Airline
let g:airline#extensions#tabline#enabled = 1
nnoremap <silent> <tab> :if &modifiable && !&readonly && &modified <CR> :write<CR> :endif<CR>:bnext<CR>
nnoremap <silent> <s-tab> :if &modifiable && !&readonly && &modified <CR> :write<CR> :endif<CR>:bprevious<CR>
" Close a buffer without losing the split
nnoremap <C-c> :bp\|bd #<CR>