forked from IntuitiveWebSolutions/VimConf
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
executable file
·227 lines (219 loc) · 9.88 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
" Notes {
" Ben Hayden, Scott Blevins, Matt Thompson, et al. Public Domain.
" https://github.com/beardedprojamz/VimConf
"}
" Basics {
set nocompatible " explicitly get out of vi-compatible mode
syntax on " syntax highlighting on
runtime bundle/vim-pathogen/autoload/pathogen.vim " Enable pathogen for fancy plugin management
call pathogen#infect() " Append .vim/bundles apps
colorscheme blayden " set our customized colorscheme
set background=dark
let g:solarized_termtrans=1
let g:solarized_contrast="high"
" }
" General {
filetype plugin indent on " load filetype plugins/indent settings
set backspace=indent,eol,start " make backspace a more flexible
set backup " make backup files
set backupdir=~/.vim/backup " where to put backup files
set directory=~/.vim/tmp " directory to place swap files in
set fileformats=unix,mac,dos " support all three, in this order
set hidden " you can change buffers without saving
if has("mouse")
set mouse=a " use mouse everywhere
endif
set noerrorbells " don't make noise when something errors
if has("persistent_undo")
set undofile " enable file undoing
set undodir=~/.vim/undo " where to put undo files
endif
set whichwrap=b,s,h,l,<,>,~,[,] " everything wraps
" | | | | | | | | |
" | | | | | | | | +-- "]" Insert and Replace
" | | | | | | | +-- "[" Insert and Replace
" | | | | | | +-- "~" Normal
" | | | | | +-- <Right> Normal and Visual
" | | | | +-- <Left> Normal and Visual
" | | | +-- "l" Normal and Visual (not recommended)
" | | +-- "h" Normal and Visual (not recommended)
" | +-- <Space> Normal and Visual
" +-- <BS> Normal and Visual
set wildmenu " turn on command line completion wild style
" ignore these list file extensions
set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc,
\*.jpg,*.gif,*.png
set wildmode=list:longest " turn on wild mode huge list
" Re-open VIM to the last spot you had open.
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
" Jump to the top of git COMMIT_EDITMSG files.
au BufReadPost COMMIT_EDITMSG
\ exe "normal! gg"
endif
" CtrlP finds a versioned working directory
let g:ctrlp_working_path_mode = 2
" Ignore uploads directory in projects for CtrlP
let g:ctrlp_custom_ignore = '\.git$\|\.svn$\|\uploads$'
au BufNewFile,BufRead *.save set filetype=sql
" }
" Vim UI {
set cursorline " highlight current line
set hlsearch " highlight searched for phrases
set incsearch " highlight as you type you
" search phrase
set laststatus=2 " always show the status line
set lazyredraw " do not redraw while running macros
set linespace=0 " don't insert any extra pixel lines
" betweens rows
au FileType python set list " we do what to show tabs, to ensure we get them
" out of my files
set listchars=tab:>-,trail:- " show tabs and trailing
set matchtime=5 " how many tenths of a second to blink
" matching brackets for
set nostartofline " leave my cursor where it was
set number " turn on line numbers
set numberwidth=5 " We are good up to 99999 lines
set report=0 " tell us when anything is changed via :...
set ruler " Always show current positions along the bottom
set scrolloff=10 " Keep 10 lines (top/bottom) for scope
set shortmess=aOstT " shortens messages to avoid
" 'press a key' prompt
set showcmd " show the command being typed
set showmatch " show matching brackets
set sidescrolloff=10 " Keep 5 lines at the size
set statusline= " clear the statusline for when vimrc is reloaded
set statusline+=%-3.3n\ " buffer number
set statusline+=%<%.99f\ " file name up to 99 chars
set statusline+=%h%m%r%w " flags
set statusline+=%{fugitive#statusline()} " Git fugitive status line
set statusline+=[%{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding
set statusline+=%{&fileformat}] " file format
set statusline+=%= " right align
set statusline+=%b,0x%-8B\ " current char
set statusline+=%-14.(%l,%c%V%)\ %<%P " offset
set statusline+=%#syntodo#%{SyntasticStatuslineFlag()} " Add syntastic status line
" }
" Text Formatting/Layout {
au FileType python set expandtab " no real tabs please!
set formatoptions=rq " Automatically insert comment leader on return,
" and let gq format comments
set ignorecase " case insensitive by default
set infercase " case inferred by default
set nowrap " do not wrap line
set shiftround " when at 3 spaces, and I hit > ... go to 4, not 5
set smartcase " if there are caps, go case-sensitive
set shiftwidth=4 " auto-indent amount when using cindent,
" >>, << and stuff like that
au FileType python set softtabstop=4 " when hitting tab or backspace, how many spaces
"should a tab be (see expandtab)
au BufNewFile,BufReadPost *.coffee setl shiftwidth=2 softtabstop=2 " For CoffeeScript
set tabstop=8 " real tabs should be 8, and they will show with
" set list on
" }
" Mappings {
let mapleader = ","
" Mapping ropevim commands
nnoremap <Leader>g :call RopeGotoDefinition()<return>
nnoremap <Leader>d :call RopeShowDoc()<return>
nnoremap <Leader>f :call RopeFindOccurrences()<return>
nnoremap <Leader>j :call RopeJumpToGlobal()<return>
" Mapping tab commands
nnoremap <Leader>tc :tabc<return>
nnoremap <Leader>tn :tabn<return>
nnoremap <Leader>tp :tabp<return>
nnoremap <Leader>te :tabe<space>
" Mapping Plugin commands
nnoremap <Leader>nt :NERDTreeToggle<return>
nnoremap <Leader>tb :TagbarToggle<return>
nnoremap <Leader>e :Errors<return>
nnoremap <Leader>en :lnext<return>
nnoremap <Leader>ep :lprev<return>
" Adding Toggle Comment
nnoremap <Leader><Leader> :call NERDComment("n", "Toggle")<return>
vnoremap <Leader><Leader> :call NERDComment("v", "Toggle")<return>
" Add 'Sign' shortcut
nnoremap <Leader>si :exec "normal A".system("echo -n ' -- '$(git config --global --get user.name) $(date +\%D)")<return>
" Map Paste / No Number for copy, paste, etc. in Vim without X.
nnoremap <Leader>p :set paste nonumber<return>
nnoremap <Leader>np :set nopaste number<return>
" Set buffergator key (<Leader>b is slow because of other b* maps)
noremap <Leader>l :BuffergatorToggle<return>
" X System Clipboard copy, cut, & paste shortcuts.
noremap <Leader>xp "+gP<return>
noremap <Leader>xy "+y<return>
noremap <Leader>xx "+x<return>
" Spell Checking
nnoremap <Leader>sp :setlocal spell spelllang=en_us<return>
nnoremap <Leader>nsp :setlocal spell spelllang=<return>
" Set up Bash / Python Emulator Splits
nnoremap <Leader>sh :ConqueTermVSplit bash<return>
nnoremap <Leader>bp :ConqueTermVSplit bpython<return>
nnoremap <Leader>ip :ConqueTermVSplit ipython<return>
" Write and Write & Quit shortcuts
nnoremap <Leader>s :w<return>
nnoremap <Leader>q :wq<return>
" Start vertical split command with space character.
nnoremap <Leader>v :vsp<space>
" Start horizontal split command with space character.
nnoremap <Leader>h :sp<space>
" Close window
nnoremap <Leader>cw :close<return>
" Close buffer
nnoremap <Leader>bd :bd<return>
" Clear highlighting
nnoremap <Leader>ch :noh<return>
" Insert a line above or below cursor without insert mode.
nnoremap <Leader>O O<Esc>
nnoremap <Leader>o o<Esc>
" Make arrow keys jump by 10 lines
nnoremap <S-Down> 10j
nnoremap <S-Up> 10k
imap <S-Down> <Esc>10ji
imap <S-Up> <Esc>10ki
vmap <S-Down> 10j
vmap <S-Up> 10k
" Send the selected hunk to Matt's hastebin
vmap <Leader>hb <esc>:'<,'>:w !work_haste<CR>
" Jump easily between open windows
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Refresh syntax highlighting
nnoremap <Leader>r :syntax off<return>:syntax on<return>
" Fix all the whitespace in a file. Re-tabs and removes trailing whitespace.
" Usage: ,ws
nnoremap <Leader>ws :TrimWS<return>:retab<return>
" Insert a single character of your choosing and return to the right spot.
" Usage: ,[spacebar][character]
nnoremap <Leader><space> :exec "normal i".nr2char(getchar())."\e"<return>
nnoremap <Leader>a :exec "normal a".nr2char(getchar())."\e"<return>
" Write as super user
command! W w !sudo tee % > /dev/null
" Trim trailing whitespace
command TrimWS %s/\s*$//g | noh
" Visual Selection Search using * and #
function! s:VSetSearch()
let temp = @@
norm! gvy
let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
let @@ = temp
endfunction
vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR>
vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR>
" Plugin Boolean settings for Programming Languages
let coffee_compile_vert=1 " When compiling CoffeeScript, throw output into vertical split
let g:syntastic_check_on_open=1 " Run Syntastic when opening files
let g:pymode_folding=0 " Turn off python-mode folding
let g:pymode_lint_write = 0 " we have two lint plugins...
let g:pymode_utils_whitespaces = 0 " don't molest whitespace
let NERDSpaceDelims=1 " Add space delimiters
" }
" Include custom configurations via the .vimrc_custom file
" which is included here:
if filereadable($HOME."/.vimrc_custom")
source $HOME/.vimrc_custom
endif