-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
160 lines (120 loc) · 3.54 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
call pathogen#infect()
syntax enable
colorscheme wombat256
if has("gui_running")
set guioptions=egmrt
" Move a line of text using (on Mac)
" http://vimbits.com/bits/283
nmap <D-j> mz:m+<cr>`z
nmap <D-k> mz:m-2<cr>`z
vmap <D-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <D-k> :m'<-2<cr>`>my`<mzgv`yo`z
endif
set number
set backspace=2 " fixing backspace because vim is dumb
set incsearch "find the next match as we type the search
set hlsearch "hilight searches by default
set ignorecase " ignore case when searching
set autoread " Update open files when changed externally
set encoding=utf-8
set autoindent
set smartindent
set showmode
set noshowcmd
set wrap
set showmatch " brackets/braces that is
set mat=3 " duration to show matching brace (1/10 sec)
set shiftwidth=2
set tabstop=2
set nosmarttab
set expandtab
" Reselect visual block after indent/outdent
" http://www.vimbits.com/bits/20
vnoremap < <gv
vnoremap > >gv
" Clear search highlights
" http://www.vimbits.com/bits/21
" nnoremap <silent><Leader>/ :nohls<CR>
nnoremap <silent><Leader>h :nohls<CR>
" nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
" Backups {{{
set undodir=~/.vim/tmp/undo// " undo files
set backupdir=~/.vim/tmp/backup// " backups
set directory=~/.vim/tmp/swap// " swap files
set nobackup " enable backups
set nowritebackup
set noswapfile " It's 2012, Vim.
" }}}
" Leader {{{
let mapleader = ","
" }}}
" Time out on key codes but not mappings.
" Basically this makes terminal Vim work sanely.
set notimeout
set ttimeout
set ttimeoutlen=10
" Make Vim able to edit crontab files again.
set backupskip=/tmp/*,/private/tmp/*"
" Better Completion
set completeopt=longest,menuone,preview
" Line Return {{{
" Make sure Vim returns to the same line when you reopen a file.
" Thanks, Amit
" augroup line_return
" au!
" au BufReadPost *
" \ if line("'\"") > 0 && line("'\"") <= line("$") |
" \ execute 'normal! g`"zvzz' |
" \ endif
" augroup END
" }}}
" Highlight VCS conflict markers
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
" }}}
" Keep search matches in the middle of the window.
nnoremap n nzzzv
nnoremap N Nzzzv
" NERD Tree {{{
noremap <leader>n :NERDTreeToggle<CR>
inoremap <leader>n <esc>:NERDTreeToggle<CR>
let NERDTreeShowBookmarks=1
augroup ps_nerdtree
au!
au Filetype nerdtree setlocal nolist
au Filetype nerdtree nnoremap <buffer> K :q<cr>
augroup END
let NERDTreeHighlightCursorline = 1
let NERDTreeIgnore = ['.vim$', '\~$', '.*\.pyc$', 'pip-log\.txt$', 'whoosh_index',
\ 'xapian_index', '.*.pid', 'monitor.py', '.*-fixtures-.*.json',
\ '.*\.o$', 'db.db', 'tags.bak']
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let g:NERDTreeMouseMode = 2
" }}}
" Powerline {{{
"let g:Powerline_symbols = 'fancy'
let g:Powerline_cache_enabled = 1
" }}}
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
map <C-n> :call NumberToggle()<CR>
map <leader>r :call NumberToggle()<CR>
nnoremap <silent><C-l> :bn<CR>
"nnoremap <silent><C-Right> :bn<CR>
nnoremap <silent><C-h> :bp<CR>
"nnoremap <silent><C-Left> :bp<CR>
map <silent><leader>d <leader>bd<CR>
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
" Disable paste mode when leaving Insert Mode
" http://www.vimbits.com/bits/170
au InsertLeave * set nopaste
" Insert blank lines without going into insert mode
" http://www.vimbits.com/bits/176
nmap t o<ESC>k
nmap T O<ESC>j