You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
336 lines
10 KiB
336 lines
10 KiB
" ---------------------------------------------------------------------- |
|
" This is basically a copy of the starting vimrc, just to make sure I |
|
" have all the cool things enabled |
|
" ---------------------------------------------------------------------- |
|
|
|
set encoding=utf-8 |
|
|
|
" Use Vim settings, rather then Vi settings (much better!). |
|
" This must be first, because it changes other options as a side effect. |
|
set nocompatible |
|
|
|
" allow backspacing over everything in insert mode |
|
set backspace=indent,eol,start |
|
|
|
" Don't use Ex mode, use Q for formatting |
|
map Q gq |
|
|
|
" Map Y to do the same (well, almost) as the D command |
|
map Y y$ |
|
|
|
" This is an alternative that also works in block mode, but the deleted |
|
" text is lost and it only works for putting the current register. |
|
|
|
" Switch syntax highlighting on, when the terminal has colors |
|
" Also switch on highlighting the last used search pattern. |
|
if &t_Co > 2 || has("gui_running") |
|
syntax on |
|
set hlsearch |
|
endif |
|
|
|
" ---------------------------------------------------------------------- |
|
" Those are my settings |
|
" ---------------------------------------------------------------------- |
|
|
|
set tabstop=4 " tabs are displayed as 4 spaces |
|
set shiftwidth=4 " by default, when auto-identing, add 4 spaces (or 1 tabstop) |
|
set foldmethod=marker " fold on markers |
|
set scrolloff=1 " always show one line around the cursor |
|
set laststatus=2 " always show the status bar ('cause I like to see the line and column, always) |
|
set showtabline=2 " always show the tabline |
|
set showmatch " show matching bracket |
|
set noerrorbells " no error bells |
|
set autowrite " write the file when switching between files or something |
|
set nowrap " do not wrap long lines |
|
set nobackup " do not keep a backup file, use versions instead |
|
set history=50 " keep 50 lines of command line history |
|
set ruler " show the cursor position all the time |
|
set showcmd " display incomplete commands |
|
set incsearch " do incremental searching |
|
set formatoptions=tcq " wrap with textwidth, wrap comments, insert commend leader (twice), format comments |
|
set smartindent " smart identation |
|
set number " show line numbers |
|
set wim=longest,list " file auto-completion |
|
set background=dark " to follow most of the colorschemes I use |
|
set vb t_vb= " convert bells to visual bells and do nothing as visual bell |
|
|
|
set t_Co=256 " 256 color terminals |
|
|
|
syntax sync minlines=1500 " increases the number of lines to find the proper syntax |
|
|
|
let mapleader="," " use comma to start user-defined (in plugins) functions |
|
|
|
" Only do this part when compiled with support for autocommands. |
|
if has("autocmd") |
|
" Enable file type detection. |
|
" Use the default filetype settings, so that mail gets 'tw' set to 72, |
|
" 'cindent' is on in C files, etc. |
|
" Also load indent files, to automatically do language-dependent indenting. |
|
filetype plugin indent on |
|
|
|
" Put these in an autocmd group, so that we can delete them easily. |
|
augroup vimrcEx |
|
au! |
|
|
|
" For all text files set 'textwidth' to 78 characters. |
|
autocmd FileType text setlocal textwidth=78 |
|
|
|
" When editing a file, always jump to the last known cursor position. |
|
" Don't do it when the position is invalid or when inside an event handler |
|
" (happens when dropping a file on gvim). |
|
autocmd BufReadPost * |
|
\ if line("'\"") > 0 && line("'\"") <= line("$") | |
|
\ exe "normal g`\"" | |
|
\ endif |
|
|
|
augroup END |
|
|
|
" Python files should not have empty lines |
|
autocmd FileType python autocmd BufWritePre <buffer> :%s/\s\+$//e |
|
|
|
|
|
" omni completion |
|
au FileType python setlocal ofu=pythoncomplete#Complete |
|
au FileType javascript setlocal ofu=javascriptcomplete#CompleteJS |
|
au FileType html setlocal ofu=htmlcomplete#CompleteTags |
|
au FileType css setlocal ofu=csscomplete#CompleteCSS |
|
au FileType xml setlocal ofu=xmlcomplete#CompleteTags |
|
au FileType php setlocal ofu=phpcomplete#CompletePHP |
|
|
|
set completeopt-=preview |
|
|
|
" ---------------------------------------------------------------------- |
|
" Auto-commands |
|
" ---------------------------------------------------------------------- |
|
|
|
" default python style |
|
" (use spaces instead of tabs (expandtab), uses 4 spaces for tabs (tabstop), |
|
" when auto-indenting, also use 4 spaces (shiftwidth), when deleting text, 4 |
|
" spaces are a tab (softtabstop) and break the line at column 78 (textwidth)) |
|
au FileType python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 textwidth=78 colorcolumn=79 |
|
|
|
" reStructured files follow python closely, but use 3 tab stops instead of 4 |
|
au FileType rst setlocal expandtab tabstop=3 sw=3 sts=3 textwidth=78 |
|
|
|
" templates (Jinja2 in this case) will use tabs instead (to reduce file size) |
|
au FileType htmldjango setlocal noet tabstop=4 shiftwidth=4 softtabstop=4 textwidth=0 |
|
au FileType jinja setlocal noet tabstop=4 shiftwidth=4 softtabstop=4 textwidth=0 |
|
|
|
" the smarty filetypes doesn't have any sort of indentation, so we set it to |
|
" auto |
|
au FileType smarty setlocal ai |
|
|
|
" PHP break lines at column 79, like Python |
|
au FileType php setlocal textwidth=79 |
|
|
|
" svn (when editing svn commit messages, break lines at |
|
" column 70) |
|
au FileType svn setlocal tw=70 |
|
|
|
" email (mostly mutt stuff) |
|
au FileType mail setlocal spell spelllang=en |
|
|
|
" JavaScript (who though those were "good" defaults?) |
|
au FileType javascript setlocal expandtab tabstop=2 sw=2 sts=2 textwidth=0 |
|
else |
|
set autoindent " always set autoindenting on |
|
endif " has("autocmd") |
|
|
|
" ---------------------------------------------------------------------- |
|
" mapings |
|
" ---------------------------------------------------------------------- |
|
|
|
" Easy switching between tabs (just use Alt+<tab number>) |
|
if has('mac') |
|
map <D-1> :tabn 1<CR> |
|
map <D-2> :tabn 2<CR> |
|
map <D-3> :tabn 3<CR> |
|
map <D-4> :tabn 4<CR> |
|
map <D-5> :tabn 5<CR> |
|
map <D-6> :tabn 6<CR> |
|
map <D-7> :tabn 7<CR> |
|
map <D-8> :tabn 8<CR> |
|
map <D-9> :tabn 9<CR> |
|
map <D-0> :tabn 10<CR> |
|
|
|
imap <D-1> <ESC>:tabn 1<CR>a |
|
imap <D-2> <ESC>:tabn 2<CR>a |
|
imap <D-3> <ESC>:tabn 3<CR>a |
|
imap <D-4> <ESC>:tabn 4<CR>a |
|
imap <D-5> <ESC>:tabn 5<CR>a |
|
imap <D-6> <ESC>:tabn 6<CR>a |
|
imap <D-7> <ESC>:tabn 7<CR>a |
|
imap <D-8> <ESC>:tabn 8<CR>a |
|
imap <D-9> <ESC>:tabn 9<CR>a |
|
imap <D-0> <ESC>:tabn 10<CR>a |
|
else |
|
map <M-1> :tabn 1<CR> |
|
map <M-2> :tabn 2<CR> |
|
map <M-3> :tabn 3<CR> |
|
map <M-4> :tabn 4<CR> |
|
map <M-5> :tabn 5<CR> |
|
map <M-6> :tabn 6<CR> |
|
map <M-7> :tabn 7<CR> |
|
map <M-8> :tabn 8<CR> |
|
map <M-9> :tabn 9<CR> |
|
map <M-0> :tabn 10<CR> |
|
|
|
imap <M-1> <ESC>:tabn 1<CR>a |
|
imap <M-2> <ESC>:tabn 2<CR>a |
|
imap <M-3> <ESC>:tabn 3<CR>a |
|
imap <M-4> <ESC>:tabn 4<CR>a |
|
imap <M-5> <ESC>:tabn 5<CR>a |
|
imap <M-6> <ESC>:tabn 6<CR>a |
|
imap <M-7> <ESC>:tabn 7<CR>a |
|
imap <M-8> <ESC>:tabn 8<CR>a |
|
imap <M-9> <ESC>:tabn 9<CR>a |
|
imap <M-0> <ESC>:tabn 10<CR>a |
|
endif |
|
|
|
" custom PHP syntax file configuration |
|
let php_smart_members=1 |
|
|
|
" Vundle stuff starts here |
|
set rtp+=~/.vim/bundle/vundle/ |
|
call vundle#rc() |
|
|
|
" ---------------------------------------------------------------------- |
|
" Bundles |
|
" ---------------------------------------------------------------------- |
|
" Vundle itself! |
|
Bundle 'gmarik/vundle' |
|
|
|
" status line |
|
" Bundle "Lokaltog/powerline" |
|
Bundle "bling/vim-airline" |
|
|
|
" git support |
|
Bundle 'tpope/vim-fugitive' |
|
|
|
" comment code with keys |
|
Bundle 'tpope/vim-commentary' |
|
|
|
" align things |
|
Bundle 'godlygeek/tabular' |
|
|
|
" close pairs |
|
Bundle 'jiangmiao/auto-pairs' |
|
" Bundle 'Townk/vim-autoclose' |
|
|
|
" python |
|
" Bundle 'nvie/vim-flake8' |
|
" Bundle 'klen/python-mode' |
|
Bundle 'scrooloose/syntastic' |
|
|
|
" snippets |
|
" Bundle 'msanders/snipmate.vim' |
|
Bundle "MarcWeber/vim-addon-mw-utils" |
|
Bundle "tomtom/tlib_vim" |
|
Bundle "garbas/vim-snipmate" |
|
|
|
" fuzzy file open |
|
Bundle 'kien/ctrlp.vim' |
|
" Bundle "unite.vim" |
|
|
|
" fuzzy function search (based on ctrlp) |
|
Bundle 'tacahiroy/ctrlp-funky' |
|
|
|
" select multiple strings at the same time |
|
Bundle 'terryma/vim-multiple-cursors' |
|
|
|
" colorscheme |
|
Bundle 'croaker/mustang-vim' |
|
" Bundle 'altercation/vim-colors-solarized' |
|
color mustang " looks awesome on gvim, looks alright in vim if you have 256 color support |
|
|
|
" Autocomplete |
|
" Bundle 'ervandew/supertab' |
|
|
|
" Improved syntax files |
|
Bundle 'Glench/Vim-Jinja2-Syntax' |
|
|
|
" auto-pair settings |
|
let g:AutoPairsMapCR = 1 |
|
|
|
" ---------------------------------------------------------------------- |
|
" my fancy tabline (to follow Powerline color scheme) |
|
" ---------------------------------------------------------------------- |
|
|
|
function PowerTabLine() |
|
let line = '' |
|
let currenttab = tabpagenr() |
|
|
|
for i in range(tabpagenr('$')) |
|
let i += 1 |
|
" highlight |
|
if i == currenttab |
|
let line .= '%#TabLineSel#' |
|
else |
|
let line .= '%#TabLine#' |
|
endif |
|
|
|
" special separator |
|
if i > 1 |
|
if i == currenttab |
|
" one before the selected buffer |
|
let selBg = synIDattr(synIDtrans(hlID("TabLineSel")), "ctermbg") |
|
let normBg = synIDattr(synIDtrans(hlID("TabLine")), "ctermbg") |
|
|
|
" new color: selBg as fg, normBg as bg |
|
" let line .= nr2char(0x2b82) " filled < |
|
endif |
|
endif |
|
|
|
" buffer name |
|
let buflist = tabpagebuflist(i) |
|
let winnr = tabpagewinnr(i) |
|
let name = bufname(buflist[winnr - 1]) |
|
if name == '' |
|
if &buftype == 'quickfix' |
|
let line .= ' [Quickfix List] ' |
|
else |
|
let line .= ' [No name] ' |
|
endif |
|
else |
|
let line .= ' ' . fnamemodify(name, ':t') . ' ' |
|
endif |
|
endfor |
|
|
|
" after the last tab fill with TabLineFill and reset tab page nr |
|
let line .= '%#TabLineFill#%T' |
|
|
|
return line |
|
endfunction |
|
|
|
set tabline=%!PowerTabLine() |
|
|
|
" ---------------------------------------------------------------------- |
|
" Powerline settings |
|
" ---------------------------------------------------------------------- |
|
|
|
" python from powerline.vim import setup as powerline_setup |
|
" python powerline_setup() |
|
" python del powerline_setup |
|
" let g:Powerline_symbols = 'unicode' |
|
|
|
" ---------------------------------------------------------------------- |
|
" Airline configuration |
|
" ---------------------------------------------------------------------- |
|
let g:airline_powerline_fonts = 1 |
|
let g:airline_theme = 'powerlineish' |
|
let g:airline_detect_whitespace=0 "disabled |
|
let g:airline_enable_branch = 1 |
|
let g:airline_enable_syntastic = 1 |
|
|
|
" ---------------------------------------------------------------------- |
|
" Unite configuration (disabled) |
|
" ---------------------------------------------------------------------- |
|
" let g:unite_split_rule = "bottomleft" |
|
let g:unite_winheight = 10 |
|
|
|
" ---------------------------------------------------------------------- |
|
" CtrlP and extensions configuration |
|
" ---------------------------------------------------------------------- |
|
set wildignore+=*/build/*,*.egginfo,*.pyc,*.mo |
|
let g:ctrlp_extensions = ['funky'] |
|
nnoremap <C-O> :CtrlPFunky<CR>
|
|
|