-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.vimrc
More file actions
207 lines (170 loc) · 6.68 KB
/
.vimrc
File metadata and controls
207 lines (170 loc) · 6.68 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
"turn on pathogen
call pathogen#incubate()
call pathogen#helptags()
set nocompatible "Default to act like vim, not vi
set nowrap "don't wrap lines
set background=dark "colorscheme
colorscheme solarized
set number "Turn on line numbers
set numberwidth=4
set backspace=indent,eol,start "Allow backspace in insert mode
set showcmd "Show incomplete cmds down the bottom
set showmode "Show current mode down the bottom
set hidden "Allow current buffer to be put in background
"without being written to disk
set autoread "reload files changed outside of vim
set encoding=utf8 "utf8 incoding
set smartindent "smart indentation overriden by individual filetype settings
set showmatch "show matching braces, brackets and such
" command timeout settings
set ttimeout
set ttimeoutlen=50
set vb t_vb= "Turn off beeping and visual bells
set incsearch "incremental search
set ls=2 "show status line even when only one window is shown.
set ruler "show the current position (line+col) and percentage in buffer
set ignorecase "don't distinguish between caps in search
set title "set window title
set ttyfast "fast terminal connection
set list "turn on list characters
set history=1000 "keep an extra long history
"set up tabs and indentation, default to 4 space tabs. We don't actually use
"tabs here. This is overwritten in individual syntax files
set shiftwidth=4
set tabstop=4
syntax on "syntax highlighting
"store temp files in non-annoying place
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set backup " enable backups
"filebased undo across sesions
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
set colorcolumn=81 "to help us keep our lines under 80 chars
set cursorline
setlocal hlsearch "When there is a previous search pattern, highlight all its matches
setlocal incsearch "While typing a search command, show where the pattern matches
set pastetoggle=<F2> "Map set paste to pastetoggle
" Enable file type detection
filetype plugin indent on
" Syntax of these languages are fussy over tabs Vs spaces
au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
"Customisations based on personal preferences
au FileType html setlocal ts=2 sts=2 sw=2 noexpandtab
au FileType css setlocal ts=2 sts=2 sw=2 noexpandtab
au FileType javascript setlocal ts=4 sts=4 sw=4 noexpandtab
autocmd FileType python set ft=python.django " For SnipMate
autocmd FileType html set ft=htmldjango.html " For SnipMate
" Treat .rss files as XML
au BufNewFile,BufRead *.rss setfiletype xml
"delete all trailing whitespace on save
au BufWritePre * :%s/\s\+$//e
"Autocomplete
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif " automatically close autocompletition window
autocmd InsertLeave * if pumvisible() == 0|pclose|endif"
let g:acp_behaviorHtmlOmniLength = -1 " no html autocompletition
let g:acp_behaviorXmlOmniLength = -1 " no xml autocompletition
"python autocomplete
au FileType python set omnifunc=pythoncomplete#Complete
set completeopt=menuone,longest,preview
au FileType javascript set omnifunc=javascriptcomplete#CompleteJS
au FileType html set omnifunc=htmlcomplete#CompleteTags
au FileType css set omnifunc=csscomplete#CompleteCSS
"enable django template syntax highlighting automatically
au BufRead,BufNewFile *.html setlocal filetype=htmldjango
au FileType htmldjango setlocal ts=2 sts=2 sw=2 noexpandtab
au BufNewFile,BufRead *.j2 setlocal filetype=htmljinja
"everytime I save, source the vimrc
"au bufwritepost .vimrc source $MYVIMRC
" NERD_tree config
let NERDTreeChDirMode=2
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$', '\.swp$']
let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
let NERDTreeShowBookmarks=1
let NERDTreeWinSize=25
"autocmd vimenter * NERDTree
"autocmd vimenter * if !argc() | NERDTree | endif
" Python.vim config
let python_highlight_all = 1
let python_slow_sync = 1
"status line
set laststatus=2
set statusline=%{fugitive#statusline()}\ %F%m%r%h%w\ [fmt=%{&ff}]\ [type=%Y]\ [pos=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
" Turn off file characters on statusline
let g:Powerline_symbols = 'fancy'
let g:html_indent_tags = 'li\|p'
set laststatus=2 " Always display the statusline in all windows
set noshowmode " Hide the default mode text
set rtp+=/Library/Python/2.7/site-packages/powerline/bindings/vim/
if ! has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
endif
"CtrlP Settings
" Set the max files
let g:ctrlp_max_files = 10000
" Find nearest ancestor that contains source control files.
let g:ctrlp_working_path_mode = 2
let g:ctrlp_root_markers = ['.git/']
" Optimize file searching
if has("unix")
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git/', 'cd %s && git ls-files']
\ },
\ 'fallback': 'find %s -type f | head -' . g:ctrlp_max_files
\ }
endif
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,.git,.hg/,.svn/
let g:gitgutter_enabled = 0
" Fix Cursor in TMUX
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
" Enable basic mouse behavior such as resizing buffers.
set mouse=a
if exists('$TMUX') " Support resizing in tmux
set ttymouse=xterm2
endif
" Python mode settings
" Skip errors and warnings
let g:pymode_lint_ignore = "E501,C0110,C1001"
"mappings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"map <leader>
let mapleader = ","
"control up down to change between buffers
noremap <C-Down> <C-W>j
noremap <C-Up> <C-W>k
"changes the buffer in the current window to the next or the previous one
noremap <C-right> <ESC>:bn<CR>
noremap <C-left> <ESC>:bp<CR>
"oops? forgot to sudo? w!!
cmap w!! w !sudo tee %
"<Esc> to jj
imap jj <Esc>
noremap <leader><space> :noh<cr>:call clearmatches()<cr>
nmap <leader>l :set list!<CR>
nmap <leader>a <Esc>:Ack!
nmap <leader>cb :CtrlPBuffer<CR>
nmap <leader>nd :NERDTreeToggle<CR>
nmap <leader>gg :GitGutterToggle<CR>
nmap <leader>pd :setlocal ft=python.django<CR>
nmap <leader>hd :setlocal ft=htmldjango<CR>
nmap <Leader>f <Esc>:Pytest file<CR>
nmap <leader>j :RopeGotoDefinition<CR>
nmap <leader>r :RopeRename<CR>
nmap <silent><Leader>c <Esc>:Pytest class<CR>
nmap <silent><Leader>m <Esc>:Pytest method<CR>
set shell=bash