Skip to content

Instantly share code, notes, and snippets.

@andreypopp
Created September 15, 2012 05:29
Show Gist options
  • Save andreypopp/3726452 to your computer and use it in GitHub Desktop.
Save andreypopp/3726452 to your computer and use it in GitHub Desktop.
"" We don't like plain vi
set nocompatible
filetype off
"" Initialize pathogen
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
"" Preferences
let mapleader=","
set hidden
set wrap " wrap lines
set softtabstop=4
set tabstop=4 " a tab is four spaces
set backspace=indent,eol,start
set expandtab
set nofoldenable
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set sw=2 ts=2 sts=2 " number of spaces to use for autoindenting
set textwidth=80
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch " set show matching parenthesis
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set virtualedit=block
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
set scrolloff=4 " keep 4 lines off the edges of the screen when scrolling
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class,*.egg-info,.git,.svn,.hg,.bzr
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
set vb t_vb=
set tildeop " make tilde (flip case) an operator
set nobackup
set noswapfile
set wildmenu " tab completion in ex mode
set wildmode=longest,list
set showcmd " display the number of chars in v-mode
set shortmess=atI
set display=lastline,uhex
set mouse=a
set confirm
set ttimeoutlen=100
set clipboard+=unnamed
set fileencodings=ucs-bom,utf-8,latin1,default
set pastetoggle=<F3>
set completeopt-=preview
if has('statusline')
set laststatus=2
" Broken down into easily includeable segments
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
set statusline+=\ [%{&ff}/%Y] " filetype
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
endif
"" Activate filetype
filetype on
filetype plugin on
filetype plugin indent on
"" Maps
nnoremap ; :
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
nmap <silent> <leader>/ :nohlsearch<CR>
" space inserts char
nmap <space> i_<esc>r
" split line (opposite to J)
nmap K i<cr><esc>0
nmap s :w <enter>
" w!! saves file under sudo
cmap w!! w !sudo tee % >/dev/null
" Key mapping for Russian QWERTY keyboard in UTF-8
map й q
map ц w
map у e
map к r
map е t
map н y
map г u
map ш i
map щ o
map з p
map х [
map ъ ]
map ф a
map ы s
map в d
map а f
map п g
map р h
map о j
map л k
map д l
map ж ;
map э '
map я z
map ч x
map с c
map м v
map и b
map т n
map ь m
map б ,
map ю .
map Ж :
" Do not use arrows
inoremap <Up> <nop>
inoremap <Down> <nop>
inoremap <Left> <nop>
inoremap <Right> <nop>
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
" Reselect visual block after indent/outdent
vnoremap < <gv
vnoremap > >gv
map Y y$
" Easy split navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
map <CR> i<CR><Esc>
imap <C-l> </<C-x><C-o>
"" ctags
set tags+=.tags,./.tags
"" Appearance
if has("gui_running")
set guioptions=aegimLt
set go-=M
set go-=m
set go-=L
set number
set cursorline
endif
set t_Co=256
set background=light
let g:solarized_termcolors=256
let g:solarized_termtrans=1
let g:solarized_contrast="high"
let g:solarized_visibility="high"
colorscheme solarized
if &t_Co > 2 || has("gui_running")
" switch syntax highlighting on, when the terminal has colors
syntax on
endif
if filereadable($HOME.'/.vimrc.local')
" source local vim customization
source ~/.vimrc.local
endif
" Show trailing whitespace:
:highlight ExtraWhitespace ctermbg=red guibg=red
:match ExtraWhitespace /\s\+\%#\@<!$/
" neocomplcache
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_disable_auto_complete = 1
" CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 0
nnoremap <C-l> <Esc>:CtrlPBuffer<CR>
" Scala
au BufWritePre *.scala :%s/\s\+$//e
au FileType scala nnoremap <F5> :EnsimeTypecheckFile<CR>
au FileType scala nnoremap <leader>, :EnsimeTypeAtPoint<CR>
" Racket
au BufReadPost *.rkt,*.rktl set filetype=racket
au filetype racket set lisp
au filetype racket set autoindent
" Python
au FileType python compiler pylint
au FileType python nnoremap <F7> :Pylint<CR>
au FileType python setl sw=4 sts=4 ts=4 et
au BufWritePre *.py :%s/\s\+$//e
au BufEnter **/tests/*.txt set ft=doctest
let g:virtualenv_directory = '~/.virtualenvs'
let g:pylint_onwrite = 0
let g:pylint_warning = 0
let g:pylint_conventions = 0
let g:pylint_show_rate = 0
" Gundo
nnoremap <F5> :GundoToggle<CR>
let g:gundo_preview_bottom = 1
" Haskell
au BufEnter *.hs compiler ghc
au BufWritePre *.hs :%s/\s\+$//e
let g:haddock_browser="open"
" Gist
let g:gist_clip_command = 'pbcopy'
let g:gist_private = 1
" Tagbar
nmap <silent> <leader>m :TagbarOpenAutoClose<CR>
let g:tagbar_width = 9999
" JS/CSS/HTML
au FileType javascript setlocal noexpandtab
au BufEnter *.less setlocal ft=less
au BufEnter *.jinja setlocal ft=jinja
au BufEnter *.jinja2 setlocal ft=jinja
" Other
au BufEnter *.md set ft=markdown
let g:netrw_list_hide = '.*\.swp$,.*\.pyc$,\.svn$,^\.[A-Za-z].*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment