Skip to content

Instantly share code, notes, and snippets.

@rixx rixx/vimrc
Last active Aug 29, 2015

Embed
What would you like to do?
"""""""""""""""""""""""""""""""""""""""""""""
"" General Settings ""
"""""""""""""""""""""""""""""""""""""""""""""
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
"" set history size
set history=1000
"" enable filetype plugins
filetype indent on
filetype plugin on
"" set to auto read when a file is changed from the outside
set autoread
"" set the map leader to ','
let mapleader = ","
let g:mapleader = ","
"" fast saving
nmap <leader>w :w!<cr>
"" don't keep a backup file in version control directories
if has("vms")
set nobackup
else
set backup
endif
"" display incomplete commands
set showcmd
"" set 7 lines to the cursor
set so=7
"" turn on the WiLd menu
set wildmenu
set wildmode=longest:full,full
set wildignore=*.o,*~,*.pyc
"" show current position
set ruler
"" hide abandoned buffers
set hid
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set whichwrap+=<,>,h,l
"" ignore case when searching, but be smart about it
set ignorecase
set smartcase
"" highlight search results, behave like in a browser
set hlsearch
set incsearch
"" regex
set magic
"" highlight matching brackets and blink shortly
set showmatch
set mat=2
"" intendation
set autoindent
set smartindent
set wrap
set nofoldenable
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Remember info about open buffers on close
set viminfo='100,%,s100,<1000,h,r/temp
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" visual stuff ""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set background=dark
syntax on
set number
set foldcolumn=3
"" cursor config
set cursorline
set cursorcolumn
"" mouse integration
if has('mouse')
set mouse=a
set mousehide
endif
"" set utf8 as standard encoding and unix as file type
set encoding=utf8
set ffs=unix,dos,mac
"" spell check with ,ss
set spelllang=en
map <leader>ss :setlocal spell!<cr>
"" always show status line
set laststatus=2
"" enable reading config off modified file
set modeline
" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <silent> <C-l> :noh<CR><C-l>
set ts=4
set tabstop=4
set expandtab
set backupdir=~/.vim/backup
"" call pathogen and use solarized
call pathogen#infect()
let g:solarized_termtrans=1
colorscheme solarized
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Python specific configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd FileType python setlocal tabstop=4
autocmd FileType python setlocal expandtab
autocmd FileType python setlocal shiftwidth=4
autocmd FileType python setlocal softtabstop=4
autocmd FileType python setlocal shiftround
autocmd FileType python setlocal nospell
autocmd FileType python match DiffChange '\%>79v.\+'
"" Key bindings
""" Execute or compile:
autocmd FileType python map <F5> :w<CR>:silent !echo "\n\x1b[7mpython %\x1b[0m"<CR>:!time python "%"<CR>
autocmd FileType python imap <F5> <ESC><F5>
autocmd FileType python map <C-F5> :w<CR>:!time pycompile *<CR>
autocmd FileType python imap <C-F5> <ESC><C-F5>
""" Execute doctest
autocmd FileType python map <F6> :w<CR>:silent !python -m doctest "%" \| less<CR>:redraw!<CR>
autocmd FileType python imap <F6> <ESC><F6>
autocmd FileType python map <C-F6> :w<CR>:silent !python -m doctest -v "%" \| less<CR>:redraw!<CR>
autocmd FileType python imap <C-F6> <ESC><C-F6>
""" Execute pylint
autocmd FileType python map <F7> :w<CR>:silent !pylint "%" \| less -R<CR>:redraw!<CR>
autocmd FileType python imap <F7> <ESC><F7>
autocmd FileType python map <C-F7> :w<CR>:silent !pylint *.py \| less -R<CR>:redraw!<CR>
autocmd FileType python imap <C-F7> <ESC><C-F7>
""" Execute pep8
autocmd FileType python map <F8> :w<CR>:silent !pep8 -v --statistics --benchmark "%" \| less<CR>:redraw!<CR>
autocmd FileType python imap <F8> <ESC><F8>
autocmd FileType python map <C-F8> :w<CR>:silent !pep8 -v --statistics --benchmark . \| less<CR>:redraw!<CR>
""" Some bracket completions and other useful completions
autocmd FileType python imap <C-F8> <ESC><C-F8>
autocmd FileType python inoremap ' ''<left>
autocmd FileType python inoremap " ""<left>
autocmd FileType python inoremap "" """"""<left><left><left>
autocmd FileType python inoremap """ """"""<left><left><left>
autocmd FileType python inoremap """<CR> """<CR>"""<left><left><left><ESC>O
autocmd FileType python inoremap ( ()<left>
autocmd FileType python inoremap () ()<left>
autocmd FileType python inoremap [ []<left>
autocmd FileType python inoremap [] []<left>
autocmd FileType python inoremap { {}<left>
autocmd FileType python inoremap {} {}<left>
autocmd FileType python inoremap , ,<space>
autocmd FileType python inoremap ,<space> ,<space>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" plugin python-mode configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let pymode_lint_onfly = 1
let pymode_lint_checker = "pylint,pyflakes,pep8,mccabe"
let pymode_lint_hold = 0
let pymode_lint_jump = 0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Load machine specific configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:pathogen_disabled = []
if filereadable($HOME."/.vimrc.local")
source ~/.vimrc.local
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.