-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_vimrc
189 lines (163 loc) · 4.94 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
set nocompatible " Use Vim settings, rather then Vi settings
filetype off " Required for Vundle setup
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" General devlopement
Bundle 'steffanc/ack.vim'
Bundle 'vim-airline/vim-airline'
Bundle 'vim-airline/vim-airline-themes'
Bundle 'tpope/vim-fugitive'
Bundle 'kien/ctrlp.vim'
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/nerdtree'
Bundle 'flazz/vim-colorschemes'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
set autoindent
set autoread
set background=dark
set backspace=indent,eol,start
set binary
set cursorline cursorcolumn
set expandtab
set formatoptions-=t
set hidden
set hlsearch
set history=1000
set ignorecase
set incsearch
if has('statusline')
set laststatus=2
endif
set lazyredraw " redraw only when we need to.
set nobackup
set nomodeline
set noswapfile
set nowritebackup
set number
set pastetoggle=<F2> " pastetoggle (sane indentation on pastes)
if has('cmdline_info')
set ruler " Show the ruler
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids
" Selected characters/lines in visual mode
endif
set shiftround
set shiftwidth=4
set shortmess+=r
set showmode
set smartcase
set smartindent
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
set tabstop=4
set tags=./.tags;/
set textwidth=120
set wildmenu " Show list instead of just completing
set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
if exists('+undodir')
set undodir=$HOME/.vim/undodir
set undofile
endif
set wrap
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
if has('gui_running')
set vb
set guioptions-=T
set guioptions-=r
set go-=L
set guifont=Source\ Code\ Pro\ for\ Powerline:h12
endif
" Remove trailing whitespace
nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>:retab<CR>
" Syntax and colours
syntax enable
if $TERM == "xterm-256color"
set t_Co=256
colorscheme wombat256mod
else
colorscheme solarized
endif
" Leader tricks
let mapleader=','
nnoremap <Leader>w :w<cr>
nnoremap <Leader>q :q<cr>
nnoremap <Leader>d :sh<cr>
" Find merge conflict markers
map <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
" For when you forget to sudo.. Really Write the file.
cmap w!! w !sudo tee % >/dev/null
" breakpoints
nnoremap <Leader>b Oimport ipdb; ipdb.set_trace()<esc>
" Quickly edit/reload the vimrc file
nnoremap <silent> <Leader>ve :vsp $MYVIMRC<CR>
nnoremap <silent> <Leader>vs :source $MYVIMRC<CR>
" Search helpers
map <space> /
map <c-space> ?
"search current selection
:vmap / y/<C-R>"<CR>
" Move between windows easily
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" ctags commands
nnoremap <Leader>st :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
nnoremap <Leader>sv :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
nnoremap <Leader>sh :sp <CR>:exec("tag ".expand("<cword>"))<CR>
nnoremap <Leader>sr :!ctags -R --c++-kinds=+p --fields=+iaS -f .tags --extra=+q .; cscope -bR;<cr><cr>
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Remember info about open buffers on close
set viminfo^=%
" Remap VIM 0 to first non-blank character
map 0 ^
" PLUGINS
" Ack plugin
" Use Ag (https://github.com/ggreer/the_silver_searcher) instead of ACK if we
" have it if we have it
if executable("ag")
let g:ackprg = 'ag --nogroup --nocolor --column --smart-case'
endif
nnoremap <Leader>ff :Ack!
nnoremap <Leader>fw #*:AckFromSearch!<CR>
" search selection
vmap <Leader>ff /##*:AckFromSearch!<CR>
" Airline plugin
let g:airline_theme='badwolf'
let g:airline_detect_modified=1
let g:airline_powerline_fonts=1
"let g:airline#extensions#tabline#enabled = 1
let g:airline_section_x = airline#section#create([])
let g:airline_section_y = airline#section#create([])
" Ctrl-P
let g:ctrlp_map = '<c-p>'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_use_caching = 1
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll|pyc|os|swp|orig|out|bak)$'}
if executable("ag")
let g:ctrlp_user_command = 'ag %s -l --nocolor -g "" --smart-case'
endif
" Fugitive
nnoremap <Leader>gb :Gblame<cr>
nnoremap <Leader>ge :Gedit<cr>
nnoremap <Leader>gd :Gdiff<cr>
nnoremap <Leader>gw :Gbrowse<cr>
nnoremap <Leader>gs :Gstatus<cr>
nnoremap <Leader>gl :Glog<cr>
" NERD Tree
nnoremap <Leader>r :NERDTreeToggle<cr>
let NERDTreeIgnore=['\.os$', '\.o$', '\.pyc$','\~$']