-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
166 lines (130 loc) · 3.78 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
" Automatic reloading of .vimrc
" let g:miniBufExplMapCTabSwitchBufs = 1
autocmd! bufwritepost .vimrc source %
" Set colour scheme
syntax enable
set background=dark
colorscheme solarized
" Better copy & paste
set pastetoggle=<F2>
set clipboard=unnamed
" Mouse and backspace
set mouse=a
set bs=2 "backspace working as normal
set encoding=utf-8
set nocompatible
set showmode
set showcmd
set wildmode=longest,list
:set cursorline
" Tabs as spaces
set tabstop=4
set softtabstop=4
set shiftwidth=4
set shiftround
set expandtab
set nolinebreak
" Remove trailing whitespaces on save
autocmd BufWritePre * :%s/\s\+$//e
"set list listchars=tab:>-,trail:.,extends:>
" Line numbers and length
set number
set tw=79 " width of the document
set fo-=t " don't wrap text when typing
set nowrap " don't wrap on load
set colorcolumn=80
" Search
set hlsearch " highlight all matches
set ignorecase " case insensitive
set incsearch
set smartcase " case insensitive
" No backups or swaps of file
set nobackup
set nowritebackup
set noswapfile
set autoindent
"set spelllang=en
"set spell
"set wildmenu
filetype off
filetype plugin indent on
"autocmd FileType python set omnifunc=pythoncomplete#Complete
"set ofu=syntaxcomplete#Complete
syntax on
" Remember position of the cursor in the file after reopening
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" New files opened in insert mode (conflicts with quick doc of YCM)
" autocmd BufNewFile * startinsert
" Don't allow modification of readonly files
au BufReadPost * :call CheckReadonly()
function! CheckReadonly()
if version >= 600
if &readonly
setlocal nomodifiable
endif
endif
endfunction
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplModSelTarget = 1
" Key remappings
" Rebind <Leader> key
let mapleader = ","
" Don't loose selection of code after shift right or left
vnoremap < <gv
vnoremap > >gv
" Setup Pathogen to manage your plugins
" mkdir -p ~/.vim/autoload ~/.vim/bundle
" curl -so ~/.vim/autoload/pathogen.vim
" https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim
call pathogen#infect()
" ============================================================================
" Python IDE Setup
" ============================================================================
" Settings for vim-powerline
" cd ~/.vim/bundle
" git clone git://github.com/Lokaltog/vim-powerline.git
set laststatus=2
" Settings for ctrlp
" cd ~/.vim/bundle
" git clone https://github.com/kien/ctrlp.vim.git
let g:ctrlp_max_height = 30
set wildignore+=*.pyc
set wildignore+=*_build/*
set wildignore+=*/coverage/*
" Settings for jedi-vim
" cd ~/.vim/bundle
" git clone git://github.com/davidhalter/jedi-vim.git
let g:jedi#usages_command = "<leader>z"
let g:jedi#popup_on_dot = 0
let g:jedi#popup_select_first = 0
let g:jedi#documentation_command = "<leader>q"
let g:jedi#usages_command = "<leader>n"
map <Leader>b Oimport ipdb; ipdb.set_trace() # BREAKPOINT<C-c>
" Better navigating through omnicomplete option list
" See
" http://stackoverflow.com/questions/2170023/how-to-map-keys-for-popup-menu-in-vim
set completeopt=longest,menuone
function! OmniPopup(action)
if pumvisible()
if a:action == 'j'
return "\<C-N>"
elseif a:action == 'k'
return "\<C-P>"
endif
endif
return a:action
endfunction
inoremap <silent><C-j> <C-R>=OmniPopup('j')<CR>
inoremap <silent><C-k> <C-R>=OmniPopup('k')<CR>
" Python folding
" mkdir -p ~/.vim/ftplugin
" wget -O ~/.vim/ftplugin/python_editing.vim
" http://www.vim.org/scripts/download_script.php?src_id=5492
"" set nofoldenable
map <Leader>n <plug>NERDTreeTabsToggle<CR>
let g:nerdtree_tabs_open_on_console_startup=1