forked from charleschen/dotvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
184 lines (173 loc) · 5.65 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:foldmethod=marker
syntax enable
filetype indent plugin on
set ofu=syntaxcomplete#Complete
set backspace=indent,eol,start
set nocompatible " sets all config to default ones whether is vi or vim
""" Vundle Stuff: """
" Vundle setup {{{
set rtp+=~/.vim/vundle/
call vundle#rc()
" }}}
" Bundle installed by Vundle {{{
Bundle "gmarik/vundle"
Bundle "charleschen/Pychimp-vim"
Bundle "chmllr/vim-colorscheme-elrodeo"
Bundle "git://git.wincent.com/command-t.git"
Bundle "tpope/vim-fugitive"
Bundle "Lokaltog/vim-powerline"
Bundle "mileszs/ack.vim"
Bundle "duganchen/vim-soy"
Bundle "sjl/clam.vim"
Bundle "kien/tabman.vim"
Bundle "scrooloose/nerdtree"
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "honza/vim-snippets"
Bundle "charleschen/vim-snipmate"
Bundle "tpope/vim-surround"
Bundle "mattn/zencoding-vim"
Bundle "orestis/pysmell"
Bundle "charleschen/minibufexpl.vim"
Bundle "AndrewRadev/switch.vim"
Bundle "zeekay/python.vim"
Bundle "nvie/vim-flake8"
Bundle "majutsushi/tagbar"
Bundle "maxbrunsfeld/vim-yankstack"
Bundle "vim-scripts/vimwiki"
Bundle "Valloric/YouCompleteMe"
Bundle "vim-scripts/rdark"
Bundle "mhinz/vim-signify"
Bundle "lepture/vim-jinja"
Bundle "vim-javascript"
" }}}
" Key Mappings: {{{
let mapleader = ","
let g:mapleader = ","
" Quickly access and refresh vim config:
nmap <silent> <leader>ev :e $MYVIMRC<cr>
nmap <silent> <leader>sv :so $MYVIMRC<cr>
" Smart way to move btw. windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" }}}
" Indentation/wrap customization {{{
set ai " sets autoindent on
set si " sets smartindent on
set expandtab
set smarttab
set tabstop=4 shiftwidth=4
set wrap " wraps lines longer than the window
set backspace=eol,start,indent
set whichwrap+=<,>,h,l " allow specified keys to move the cursor move to the next line
set lbr
" }}}
" Vim user interface {{{
set t_Co=256
set number " turns on line numbers
set colorcolumn=100
set laststatus=2 " always shows status line for the last window
set gfn=Menlo:h12
set shell=/bin/bash
set history=700
set wildmenu " invokes tab completion for command-line
set showmatch " jump to matching bracket
set mat=2 " sets the match time for brackets
set scrolloff=7
set cmdheight=2 " set command line height
set hid " hides buffers when abandoned
set nolazyredraw
set encoding=utf8 " sets encoding of vim
set splitbelow splitright " splits new verticle split to the right and new horizontal to the bottom
try
lang en_US " tries to set language
catch
endtry
" }}}
" Search Configuration {{{
set ignorecase " case is ignored when searching lower case
set smartcase " uses case to search when there is something upper case
set hlsearch
set incsearch " high search term as you type
set magic " characters are taken literally (ex: . matches any character, not \.)
" }}}
" Vim file system configuration {{{
set ffs=unix,dos,mac
set nowb
set noswapfile
set tw=500 " max with of text that is being inserted
set autoread " auto reread file openned in vim that is modified outside of vim
try
set undodir=~/.vim/undodir
set undofile
catch
endtry
" }}}
""" Language Related Stuff: """
" Soy Section {{{
au BufRead,BufNewFile *.soy set filetype=soy
au FileType soy setlocal sw=2 sts=2 et
" }}}
" HTML Section {{{
au FileType html setlocal sw=2 sts=2 et
" }}}
" Python Section {{{
let python_highlight_all = 1
au FileType python syn keyword pythonDecorator True None False self
au BufNewFile,BufRead *.jinja set ft=jinja
au BufNewFile,BufRead *.mako set ft=mako
au FileType python inoremap <buffer> $r return
au FileType python inoremap <buffer> $i import
au FileType python inoremap <buffer> $p print
au FileType python inoremap <buffer> $f #--- PH ----------------------------------------------<esc>FP2xi
au FileType python map <buffer> <leader>1 /class
au FileType python map <buffer> <leader>2 /def
au FileType python map <buffer> <leader>C ?class
au FileType python map <buffer> <leader>D ?def
" Run current program
au FileType python map <f9> :w<CR>:!python %<CR>
" Python Mode Stuff
let g:pymode_lint_ignore = ""
" }}}
" JavaScript section {{{
au FileType javascript setlocal sw=2 sts=2 et
au FileType javascript call JavaScriptFold()
au FileType javascript setl fen
au FileType javascript setl nocindent
au FileType javascript imap <c-t> AJS.log();<esc>hi
au FileType javascript imap <c-a> alert();<esc>hi
au FileType javascript inoremap <buffer> $r return
au FileType javascript inoremap <buffer> $f //--- PH ----------------------------------------------<esc>FP2xi
function! JavaScriptFold()
setl foldmethod=syntax
setl foldlevelstart=1
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
function! FoldText()
return substitute(getline(v:foldstart), '{.*', '{...}', '')
endfunction
setl foldtext=FoldText()
endfunction
" }}}
""" Cool Configurations/shortcuts: """
" Deleting Trailing White Spaces {{{
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite {*.py,*.json} :call DeleteTrailingWS()
" }}}
" paste {{{
function! HasPaste()
if &paste
return 'PASTE MODE'
else
return ''
endif
endfunction
" }}}
""" Loading seperate vim configs: {{{
exe "source" "~/.vim/vimrc.$USER"
" }}}