-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
164 lines (157 loc) · 4.32 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
" VIMRC by Curtis Matz
" Vundle Wrapper {{{
set nocompatible " be iMproved, required
filetype off " required
scriptencoding utf-8
set encoding=utf-8
" set the runtime path to include Vundle and initialize
" work sometimes sets $HOME to my network home drive so force local
if has('win32') || has('win64')
set rtp+=$USERPROFILE/vimfiles/bundle/Vundle.vim
call vundle#begin('$USERPROFILE/vimfiles/bundle/')
else
set rtp+=$HOME/.vim/bundle/Vundle.vim
call vundle#begin()
endif
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-abolish'
Plugin 'tpope/vim-repeat'
" Plugin 'unite.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'altercation/vim-colors-solarized'
Plugin 'godlygeek/tabular'
Plugin 'scrooloose/syntastic'
call vundle#end() " required
filetype plugin indent on " required
" }}}
" Imports {{{
if has('win32') || has('win64')
source $VIMRUNTIME/mswin.vim
" elseif has('mac')
" source $VIMRUNTIME/macmap.vim
endif
" }}}
" Grep {{{
if executable('ag')
set grepprg=ag\ --vimgrep\ $*
set grepformat=%f:%l:%c:%m
elseif executable('findstr')
set grepprg=findstr\ /sn\ $*
set grepformat=%f:%l:%m
endif
" }}}
" Colors {{{
if has('gui_running')
let g:solarized_termcolors=256
let g:solarized_diffmode="high" "default value is normal
set background=dark
colorscheme solarized
if has('win32') || has('win64')
set guifont=Consolas:h10:b:cANSI
endif
else
colorscheme default
endif
syntax enable
" }}}
" Folding {{{
set foldenable
set foldlevelstart=10
set foldnestmax=10
set foldmethod=indent
set modelines=1
" }}}
" Backup {{{
set nobackup " DON'T keep a backup file
set directory=$TEMP//,$TMP//,.
" }}}
" Leader {{{
let mapleader = ";"
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <silent> <leader>sv :source $MYVIMRC<cr>:noh<CR>
imap jk <esc>
nnoremap , <C-w>
nnoremap ,, <C-w>w
" Shortcut to rapidly toggle `set list`
nnoremap <leader>l :set list!<CR>
" Delete extra white space at end of line
nnoremap <leader>dws :%s/\s\+$<cr>
" Double quote the word
nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel
" Run python with current file
nnoremap <leader>g :!python %<CR>
" Run cscript with current file
nnoremap <leader>v :!cscript %<CR>
" SQL string formatting
nnoremap <silent> <leader>, :%s/\n/,/g<CR>$x0:noh<CR>
nnoremap <silent> <leader>' :%s/\n/','/g<CR>I'<esc>$xx0:noh<CR>
" }}}
" Unite Plugin {{{
nnoremap <leader>uf :Unite file<CR>
nnoremap <leader>ub :Unite buffer<CR>
" }}}
" Vim-Airline Plugin {{{
set laststatus=2 " used in vim_airline
set ttimeoutlen=50 " used in vim airline
" }}}
" Editor {{{
set path+=**
set backspace=indent,eol,start
set ts=4 sts=4 sw=4 expandtab
set number
set relativenumber
set showcmd
set wildmenu
set lazyredraw
set hidden
set mouse=a " use mouse in xterm to scroll
set completeopt=menu,longest,preview
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,trail:·,eol:¬
" }}}
" Searching {{{
set showmatch
set incsearch
set hlsearch
set ignorecase
set smartcase
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
" }}}
" Diff {{{
" ignore whitespace and end of lines for diff as well as do a veritical diff
set diffopt+=iwhite,vertical
" }}}
" Syntastic Plugin {{{
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" }}}
" Autocmd {{{
if has("autocmd")
" Enable file type detection
filetype on
" Syntax of these languages is fussy over tabs Vs spaces
autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Customisations based on house-style (arbitrary)
autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType javascript setlocal ts=4 sts=4 sw=4 noexpandtab
" Treat .rss files as XML
autocmd BufNewFile,BufRead *.rss setfiletype xml
" SQL language
autocmd filetype sql setlocal commentstring=--\ %s
" Auto source vimrc
" VB Language
autocmd filetype vb setlocal commentstring='\ %s
endif
" }}}
" vim:foldmethod=marker:foldlevel=0