forked from sontek/homies
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path_vimrc
More file actions
207 lines (171 loc) · 7.23 KB
/
Copy path_vimrc
File metadata and controls
207 lines (171 loc) · 7.23 KB
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
" Load pathogen from bundle directory
runtime bundle/vim-pathogen/autoload/pathogen.vim
" =========
" Shortcuts
" =========
let mapleader="," " change leader to comma instead of back-slash
set nocompatible " Disable vi compatible mode
let g:pep8_map='<leader>8' " run pep8
command! W :w
" Write file with sudo
cmap W! w !sudo tee % >/dev/null
" Jump to the definition of whatever the cursor is on
map <leader>j :RopeGotoDefinition<CR>
" Rename whatever the cursor is on (including references to it)
map <leader>r :RopeRename<CR>
" ================================
" Load plugins managed by Pathogen
" ================================
filetype off
" To disable a plugin, add it's bundle name to the following list
let g:pathogen_disabled = []
if v:version < '702' || !has('python')
call add(g:pathogen_disabled, 'pyflakes')
endif
if v:version < '702'
call add(g:pathogen_disabled, 'acp')
endif
call pathogen#infect()
call pathogen#helptags()
filetype plugin indent on " enable loading indent and plugin file for filetype
syntax on " enable syntax highlighting
" ==============
" Basic settings
" ==============
""" Insert completion
" don't select first item, follow typing in autocomplete
set completeopt=menuone,longest,preview
set pumheight=6 " Keep a small completion window
set wildignore+=*.o,*.obj,.git,*.pyc " ignore these files when completing
" show a line at column 79
if exists("&colorcolumn")
set colorcolumn=79
endif
" displays tabs with :set list & displays when a line runs off-screen
set listchars=tab:>-,eol:$,trail:-,precedes:<,extends:>
" Color settings
set t_Co=256 " Enable 256 colors
set background=dark " dark background in use
" colorscheme solarized " use colorscheme
colorscheme wombat " use colorscheme
" Line numbers
set number " display line numbers
set numberwidth=1 " use only one column when possible
" Search
set incsearch " do incremental search
set hlsearch " highlight search value
set wrapscan " wrap around to the beginning of file on search if end is reached
set ignorecase " case-insensitive search
set smartcase " if a pattern contains an uppercase letter, it is case sensitive
" Indentation
set autoindent " always enable autoindenting
set smartindent " use smart indent if there is no indent file
" Misc
set title " show title in console title bar
set showmatch " show matching brackets
set matchpairs+=<:>,":" " comma-separated list of characters that form pairs
set wildmenu " menu completion on <TAB> in command mode
set wildmode=list:longest,full " cycle between all matches
set ruler " display cursor position
set tabstop=4 " <TAB> inserts four spaces
set shiftwidth=4 " indent level is 4 spaces wide
set softtabstop=4 " <BS> over an autoindent deletes both spaces
set expandtab " use spaces for autoindent/tab
set smarttab " Handle tabs more intelligently
set noautowrite " write only on request
set noautowriteall " write in all cases on request only
set noautoread " don't re-read changed files automatically
set nobackup " Turn backups off, since most stuff is in $VCS
set nowritebackup " No backup before overwriting a file
set nowrap " don't wrap text
set modeline " allow vim options to be embedded in files
set modelines=5 " they must be within the first or last 5 lines
set ffs=unix,dos,mac " try recognizing unix, dos and mac line endings
set laststatus=2 " always show statusline
"set statusline=[%l,%v\ %P%M]\ %f\ %r%h%w\ (%{&ff})\ %{fugitive#statusline()}
set statusline=[%l,%v\ %p%%]\ %F%m%r%h%w\ %=%03.b,0x%B\ %{fugitive#statusline()}\ [%{&ff}]\ %y\ [len:%L]
set cursorline " highlight the line containing the cursor
set showcmd " show incomplete commands
set nostartofline " try to preserve column where cursor is positioned
set shiftround " indent/outdent to nearest tabstops
set backspace=2 " Allow backspacing over autoindent, EOL, and BOL
set scrolloff=3 " Keep 3 context lines above and below the cursor
set virtualedit=block " Let cursor move past the last char in <C-v> mode
set linebreak " don't wrap text in the middle of a word
set confirm " raise a dialog because of unsaved changes
set report=0 " always display changed line count
set shortmess+=a " Use [+]/[RO]/[w] for modified/readonly/written.
set foldmethod=indent " Lines with equal indent form a fold.
set foldlevel=99 " don't fold by default
"set foldcolumn=1 " show the fold column
set noerrorbells " don't bell
set novisualbell t_vb=
" Jump to the last position when reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" Remove trailing whitespace on <leader>S
nnoremap <leader>S :%s/\s\+$//<cr>:let @/=''<CR>
" don't outdent hashes
inoremap # #
" Resize splits when window is resized
au VimResized * exe "normal! \<c-w>="
augroup gzip
autocmd!
autocmd BufReadPre,FileReadPre *.gz,*.Z,*.bz2 set bin
autocmd BufReadPost,FileReadPost *.gz,*.Z '[,']!gunzip
autocmd BufReadPost,FileReadPost *.bz2 '[,']!bunzip2
autocmd BufReadPost,FileReadPost *.gz,*.Z,*.bz2 set nobin
autocmd BufReadPost,FileReadPost *.gz,*.Z,*.bz2 execute ":doautocmd BufReadPost " . expand("%:r")
autocmd BufWritePost,FileWritePost *.gz,*.Z,*.bz2 !mv <afile> <afile>:r
autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r
autocmd BufWritePost,FileWritePost *.bz2 !bzip2 <afile>:r
autocmd BufWritePost,FileWritePost *.Z !compress <afile>:r
autocmd FileAppendPre *.gz,*.Z !gunzip <afile>
autocmd FileAppendPre *.bz2 !bunzip2 <afile>
autocmd FileAppendPre *.gz,*.Z,*.bz2 !mv <afile>:r <afile>
autocmd FileAppendPost *.gz,*.Z,*.bz2 !mv <afile> <afile>:r
autocmd FileAppendPost *.gz !gzip <afile>:r
autocmd FileAppendPost *.bz2 !bzip2 <afile>:r
autocmd FileAppendPost *.Z !compress <afile>:r
augroup END
"""""""""""""""""""""""""""""""""
" FILE TYPE SYNTAX "
"""""""""""""""""""""""""""""""""
au BufRead /etc/network/interfaces :set syntax=interfaces
"""""""""""""""""""""""""""""""""
" KEY MAPPING "
"""""""""""""""""""""""""""""""""
"
" taglist
nnoremap <silent> <F8> :TlistToggle<CR>
" <leader>V reloads it (remember to save file first)
map <silent> <leader>V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
" Run django tests
map <leader>dt :set makeprg=python\ manage.py\ test\|:call MakeGreen()<CR>
" run py.test's
nmap <silent><Leader>tf <Esc>:Pytest file<CR>
nmap <silent><Leader>tc <Esc>:Pytest class<CR>
nmap <silent><Leader>tm <Esc>:Pytest method<CR>
nmap <silent><Leader>tn <Esc>:Pytest next<CR>
nmap <silent><Leader>tp <Esc>:Pytest previous<CR>
nmap <silent><Leader>te <Esc>:Pytest error<CR>
" F11 to toggle paste mode
map <F11> :set invpaste<CR>
set pastetoggle=<F11>
map <leader>n :NERDTreeToggle<CR> " Open NERDTree
map <leader>g :GundoToggle<CR> " Open Gundo window
map <leader>t <Plug>TaskList " toggle tasklist
map <leader>v :sp ~/.vimrc<CR><C-W> " open .vimrc
" F3 to toggle numbers
nnoremap <F3> :NumbersToggle<CR>
"""""""""""""""""""""""""""""""""
" PLUGIN CONFIGURATION "
"""""""""""""""""""""""""""""""""
"
" taglist
"
" Close VIM if taglist is the only window
let Tlist_Exit_OnlyWindow = 1
" Display taglist window on the right
let Tlist_Use_Right_Window = 1