-
Notifications
You must be signed in to change notification settings - Fork 6
/
.vimrc
165 lines (147 loc) · 4.8 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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" plugin for perl syntax, template toolkit
Plugin 'vim-perl/vim-perl'
" plugin for javascript syntax
Plugin 'pangloss/vim-javascript'
" plugin for json syntax
Plugin 'elzr/vim-json'
" plugin to easy find file
Plugin 'kien/ctrlp.vim'
" tree explorer
Plugin 'scrooloose/nerdtree'
" Status line
Plugin 'vim-airline/vim-airline'
" HTML Syntax
Plugin 'othree/html5.vim'
" Mojo html.ep
Plugin 'yko/mojo.vim'
" Markdown highlighter
Plugin 'plasticboy/vim-markdown'
" Code tags
Plugin 'majutsushi/tagbar'
map <Leader>t :CtrlPBuffer<CR>
let g:ctrlp_map = '<C-p>'
let g:ctrlp_working_path_mode = 0 " don’t manage working directory.
let g:ctrlp_use_caching = 1
let g:ctrlp_custom_ignore = {
\ 'dir': '\v\c\.(git|svn)$|cgi/t/sandbox|cover_db',
\ 'file': '\v\c\.(swf|bak|png|gif|js|mov|ico|jpg|pdf|jrxml)$'
\ }
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
set autoindent
set backspace=indent,eol,start
set cindent " set smartindent
set cmdheight=2
set cursorcolumn
set cursorline
set errorformat=\"../../%f\"\\,%*[^0-9]%l:\ %m
set expandtab
set hidden
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set list
set listchars=tab:>-,trail:-
set mouse=c
set nowrap
set ruler
set scrolloff=5
set shiftwidth=4
set showcmd
set showmatch
set smarttab
"set statusline=%F%m%r%h%w\ [%{&ff}]\ %y\ [CHR=%b/0x%B]\ [POS=%04l,%03c(%03v)]\ [%p%%]\ [LEN=%L]\ %{fugitive#statusline()}
set t_Co=256
set tags=tags;/
set virtualedit=block
set wrap
"set nu
"set spell spelllang=en_us
set colorcolumn=80
syntax on
colorscheme desert
highlight CursorColumn term=NONE cterm=none ctermbg=232
highlight CursorLine term=NONE cterm=bold ctermbg=8
highlight FoldColumn ctermbg=8 ctermfg=14
highlight Folded ctermbg=8 ctermfg=14
highlight Search term=reverse cterm=bold ctermbg=11 ctermfg=0
highlight Visual term=NONE cterm=bold ctermbg=10 ctermfg=8
highlight ColorColumn ctermbg=8
"" makes Omni Completion less pinky :P
highlight Pmenu ctermbg=2 ctermfg=0
highlight PmenuSel ctermbg=7 ctermfg=0
highlight PmenuSbar ctermbg=0 ctermfg=7
highlight PmenuThumb ctermbg=7 ctermfg=0
" :help last-position-jump
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
nnoremap <C-L> :noh<CR><C-L>
inoremap jj <Esc>
nnoremap <Leader>r :source ~/.vimrc<CR>
nnoremap <Leader><Leader>r :e ~/.vimrc<CR>
map <Leader>gs :Gstatus<CR>
map <Leader>gc :Gcommit<CR>
map <Leader>gm :Gcommit --amend<CR>
map <Leader>gll :Git log<CR>
map <Leader>glp :Git log -p<CR>
map <Leader>gb :Gblame<CR>
map <Leader>gdd :Git diff<CR>
map <Leader>gdm :Git diff %<CR>
map <Leader>gdf :Gdiff<CR>
map <Leader>gg :Git
map <Leader>] :wa<bar><UP><CR>
nmap <F1> <Esc>
imap <F1> <Esc>
autocmd FileType gitcommit autocmd! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
" navigate display line when wrap is set
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
map <F5> :NERDTreeToggle<CR>
nmap <F8> :TagbarToggle<CR>
function! Preserve(command)
" Preparation: save window state
let l:saved_winview = winsaveview()
" Run the command:
execute a:command
" Clean up: restore previous window position
call winrestview(l:saved_winview)
endfunction
nnoremap <F6> :call Preserve("%s/\\s\\+$//e")<CR>