-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
190 lines (158 loc) · 4.86 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
scriptencoding utf-8
" Vundle
filetype off
set runtimepath+=~/.vim/bundle/vundle
call vundle#rc()
Bundle 'altercation/vim-colors-solarized'
Bundle 'bling/vim-airline'
Bundle 'git://git.wincent.com/command-t.git'
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-repeat'
Bundle 'Valloric/YouCompleteMe'
" Still need to learn how to use.
Bundle 'Lokaltog/vim-easymotion'
Bundle 'tpope/vim-surround'
Bundle 'majutsushi/tagbar'
Bundle 'tpope/vim-fugitive'
Bundle 'vim-scripts/EasyGrep'
filetype plugin indent on
" Encoding
set encoding=utf-8
" Setup
set nocompatible " Disable vi compatibility.
set history=256 " Number of things to remember in history.
set timeoutlen=250 " Time to wait after ESC
set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors
" Formatting
set formatoptions=qn1 " TODO(mike): Figure out what I want to do here.
set formatoptions+=o "Automatically insert the comment leader after 'o' or 'O' in normal
set formatoptions-=r "Do not automatically insert a comment leader after an enter.
set formatoptions-=t " Do no auto-wrap text using textwidth (does not apply to comments)
" Autocommands.
autocmd FileType python setlocal shiftwidth=2 softtabstop=4
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd Filetype gitcommit setlocal spell textwidth=72
autocmd FileType crontab set nobackup nowritebackup
autocmd BufWrite * :%s/\s\+$//e
autocmd FocusLost * :wa " Save when losing focus.
autocmd VimResized * :wincmd = " Rebalance windows on vim resize.
" Indenting
set autoindent
set smartindent
" Scrollbars
set sidescrolloff=2
set scrolloff=3 " show context above/below cursorline.
" Wildmenu
set wildmenu
set wildmode=list:longest
set wildignore+=*.pyc,*.zip,*.gz,*.bz,*.tar,*.jpg,*.png,*.gif,*.avi,*.wmv,*.ogg,*.mp3,*.mov,*.class
set wildignore+=/Users/mike/src/tellapart/third_party/tungsten/*
set wildignore+=/Users/mike/src/tellapart/eye/*
" Windows
set splitbelow splitright
:noremap ,v :vsp^M^W^W<cr>
:noremap ,h :split^M^W^W<cr>
" Cursor
" set cursorline
" Search
nnoremap / /\v
vnoremap / /\v
set hlsearch " Highlighting search.
set incsearch " Incremental search.
set ignorecase " Ignore case when searching.
set smartcase " Be case sensitive when there's a capital letter.
set gdefault
set showmatch " Show matching brackets.
nnoremap <leader><space> :noh<cr>
nnoremap <tab> %
vnoremap <tab> %
" Colors
set background=dark
colorscheme solarized
syntax enable
" Leader
let mapleader = ","
" Status
set showcmd " Display an incomplete command in the lower right of the window.
set showmode
set ruler " Show ruler.
set colorcolumn=80
" Line Wrapping
set nowrap
" set textwidth=79
" set linebreak
" Mappings
" imap jj <Esc>
" imap uu _
" imap hh =>
" imap aa @
" nnoremap ; :
" nnoremap <leader>a :Ack
" #Reminder#
" <leader>c<space> = comment!"
" Leader Mappings
nnoremap <leader>w <C-w>v<C-w>l
" Insert New Line
map <S-Enter> O<ESC>
map <Enter> o<ESC>
" Sessions
set sessionoptions=blank,buffers,curdir,folds,help,resize,tabpages,winsize
" Misc
set autoread " Refresh files if they've changed outside of vim.
set autowrite " Writes on make/shell commands, next buffer, etc.
set backspace=indent,eol,start
set clipboard=unnamed "Regular vim yanking will copy to OS clipboard.
set history=50 " keep 50 lines of command history
set laststatus=2 " Always show status line.
set matchpairs+=<:>
set noerrorbells " No noise.
set novisualbell " No blinking.
set number
set shortmess=atI "Shortens messages.
set ttyfast
set vb t_vb= " Disable any beeps or flashes on error.
set viminfo='20,\"500 " Keep a .viminfo file.
" Invisible Chars.
set listchars=tab:▸\ ,eol:¬
set list
:noremap ,i :set list!<CR>
" Cursor Movement.
map k gk
map j gj
" Tabs
set smarttab " Smarter tab levels.
set softtabstop=2
set shiftwidth=2 " Default shiftwidth for indents.
set tabstop=8 " Default tabstop.
set expandtab " Makes tabs into spaces (set by tabstop)
set shiftround
" Undo.
set undofile
set undodir=~/.vim/undo
" Plugin shortcuts/configuration.
" CommandT
let g:CommandTMaxFiles = 15000
noremap <leader>f <Esc>:CommandTFlush<CR> " Flush CommandT Buffer
" Python autocomplete
set omnifunc=syntaxcomplete#Complete
set completeopt=longest,menuone
" YouCompleteMe
let g:ycm_complete_in_comments = 1
nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
" Vim-airline
" let g:airline#extensions#tabline#enabled = 1
" TagBar
nmap <F8> :TagbarToggle<CR>
nmap <F7> :TagbarOpen j<CR>
nmap <F6> :TagbarTogglePause<CR>
" Syntastic
" let g:syntastic_python_checkers=['python', 'pyflakes', 'pylint', 'pep8',
" \'flake8', 'py3kwarn']
let g:syntastic_python_checkers=['python', 'pyflakes', 'pep8',]
let g:syntastic_python_pylint_args="--errors-only -f parseable -r n -i y"
let g:syntastic_python_pep8_args="--ignore=E111,E12,E501,E302"
let g:syntastic_loc_list_height=5
" Use local vimrc file if available.
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif