Skip to content

Instantly share code, notes, and snippets.

@regedarek
Created June 27, 2015 12:31
Show Gist options
  • Save regedarek/f41cb2f00830f8271e68 to your computer and use it in GitHub Desktop.
Save regedarek/f41cb2f00830f8271e68 to your computer and use it in GitHub Desktop.
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'chriskempson/base16-vim'
Plugin 'itchyny/lightline.vim'
Plugin 'maxbrunsfeld/vim-yankstack'
Plugin 'kien/ctrlp.vim'
Plugin 'FelikZ/ctrlp-py-matcher'
Plugin 'rking/ag.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'duff/vim-bufonly'
Plugin 'regedarek/vim-bufexplorer'
Plugin 'vim-scripts/bufkill.vim'
Plugin 'jiangmiao/auto-pairs'
Plugin 'tpope/vim-surround'
Plugin 'mattn/webapi-vim'
Plugin 'mattn/gist-vim'
call vundle#end()
filetype plugin indent on
colorscheme base16-railscasts
syntax enable
set clipboard=unnamed
set noswapfile
set autoread
set switchbuf=useopen
set winwidth=79
set t_ti= t_te=
set scrolloff=3
set expandtab shiftwidth=2
set softtabstop=2 tabstop=2
set autoindent
set showmatch
set noesckeys " ?
set nofoldenable
set number
set laststatus=2
set noshowmode
set t_Co=256
set background=dark
set incsearch
set hlsearch
set ttimeout " ?
set backspace=indent,eol,start " ?
set ignorecase smartcase
set wildignore+=*.o,*.png,*.gif,*.obj
set wildignore+=.git,*/public/*,*/tmp/*,*/log/*
set wildignore+=*.so,*.swp,*.zip
" General
let mapleader=','
" Ag
let g:ackprg = 'ag --nogroup --nocolor --column --smart-case'
" Lightline
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'modified', 'filename'] ],
\ 'right': [ [ 'lineinfo' ], ['filetype' ] ]
\ },
\ 'component': {
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}',
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
\ },
\ 'component_visible_condition': {
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
\ }
\ }
" CtrlP
let g:ctrlp_custom_ignore = {
\ 'file': '\v\.(exe|dat|so|dll|log|gif|jpg|jpeg|png)$'
\ }
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
let g:ctrlp_map = '<c-p>'
let g:ctrlp_mruf_relative = 1
let g:ctrlp_mruf_exclude = '\v\.git/(MERGE_MSG|rebase-merge|COMMIT_EDITMSG|PULLREQ_EDITMSG|index)'
let g:ctrlp_working_path_mode = 0
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_mruf_last_entered = 1
let g:ctrlp_prompt_mappings = {
\ 'PrtSelectMove("j")': ['<s-j>', '<down>'],
\ 'PrtSelectMove("k")': ['<s-k>', '<up>'],
\ 'CreateNewFile()': ['<s-n>'],
\ 'ToggleFocus()': ['<tab>'],
\ 'ToggleByFname()': ['<c-d>'],
\ 'ToggleType(1)': ['<c-f>', '<c-j>', '<c-up>'],
\ 'ToggleType(-1)': ['<c-b>', '<c-k>', '<c-down>'],
\ 'MarkToOpen()': ['<s-l>'],
\ 'OpenMulti()': ['<s-D>'],
\ }
let g:ctrlp_extensions = ['tag']
let g:ctrlp_open_new_file = 0
let g:ctrlp_open_multi = 'vr'
let g:ctrlp_arg_map = 0
let g:ctrlp_jump_to_buffer = 1
let g:ctrlp_dotfiles = 0
let g:ctrlp_match_window_reversed = 0
let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden
\ --ignore .git
\ --ignore .svn
\ --ignore .hg
\ --ignore .DS_Store
\ --ignore "**/*.pyc"
\ -g ""'
" Keys maps
map <silent> <F1> :BufExplorer<CR>
map <silent> <F2> :Gstatus<CR>
map <silent> <F7> :s/:\([^ ]*\)\(\s*\)=>/\1:/g<CR>
imap jj <Esc>
nmap zz v$h
nmap <silent> <leader>b :Gbrowse<CR>
nmap <silent> <leader>d :BufOnly<CR>
nmap <silent> ff :BD<CR>
nmap <S-j> <<
nmap <S-k> >>
vnoremap < <gv
vnoremap > >gv
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
nnoremap <CR> :nohlsearch<CR>
imap <c-c> <esc>
cnoremap %% <C-R>=expand('%:h').'/'<cr>
" Custom Autocommands
augroup vimrcEx
autocmd!
autocmd FileType text setlocal textwidth=78
" Jump to last cursor position unless it's invalid or in an event handler
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Unbind <enter> nohl behaviour on quickfix
autocmd BufReadPost quickfix nnoremap <buffer> <CR> <CR>
autocmd CmdwinEnter * nnoremap <buffer> <CR> <CR>
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment