Skip to content

Instantly share code, notes, and snippets.

@AbleCoder
Last active December 19, 2015 21:49
Show Gist options
  • Save AbleCoder/6022743 to your computer and use it in GitHub Desktop.
Save AbleCoder/6022743 to your computer and use it in GitHub Desktop.
current vimrc
"-------------------------------------------------------------------------------
" vim initial setup
"-------------------------------------------------------------------------------
" init vim-pathogen
execute pathogen#infect()
set nocompatible
filetype off
" whitespace stuff
set nowrap
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set number
" store swap/backup files in one folder
set backupdir=~/.vim/.backup,/tmp
set directory=~/.vim/.backup,/tmp
filetype plugin indent on " required!
" replace default leader backslash with comma
let mapleader = ","
"-------------------------------------------------------------------------------
" color scheme & syntax highlighting
"-------------------------------------------------------------------------------
set background=dark
colorscheme base16-default
syntax on
"-------------------------------------------------------------------------------
" customizations
"-------------------------------------------------------------------------------
" disable arrow keys in normal mode
noremap <up> <nop>
noremap <down> <nop>
noremap <left> <nop>
noremap <right> <nop>
" navigate splits with the arrow keys
nnoremap <right> <c-w>l
nnoremap <left> <c-w>h
nnoremap <up> <c-w>k
nnoremap <down> <c-w>j
" highlight trailing spaces
set list listchars=tab:\ \ ,trail:·
" split-it mapping
nmap <leader>- :new<cr>
nmap <leader>\| :vnew<cr>
nmap <leader>\ :rightbelow vnew<cr>
nmap <leader>_ :rightbelow new<cr>
" fix tmux arrow key mappings
if &term =~ '^screen'
" tmux will send xterm-style keys when its xterm-keys option is on
execute "set <xup>=\e[1;*a"
execute "set <xdown>=\e[1;*b"
execute "set <xright>=\e[1;*c"
execute "set <xleft>=\e[1;*d"
endif
" resize split w/ shift+arrow
nmap <silent> <s-down> :resize -5<cr>
nmap <silent> <s-up> :resize +5<cr>
nmap <silent> <s-left> :vertical resize -5<cr>
nmap <silent> <s-right> :vertical resize +5<cr>
" allow backspace to delete end-of-line in insert mode
set backspace=indent,eol,start
"-------------------------------------------------------------------------------
" plugin configs
"-------------------------------------------------------------------------------
" ctrlp
""""""""
" open buffer list on
nnoremap <c-b> :ctrlpbuffer<cr>
" clear ctrlp cache then open ctrlp
nnoremap <silent> <c-l> :clearctrlpcache<cr>\|:ctrlp<cr>
" search .* files/folders
let g:ctrlp_show_hidden = 1
" custom file/folder ignores
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll|pyc)$',
\ 'link': 'some_bad_symbolic_links',
\ }
" add wildignores for python projects
set wildignore+=*/.ve/*,*/.venv/*
set wildignore+=*/*.egg-info/*,*/.tox/*
" easymotion
"""""""""""""
let g:easymotion_leader_key = '<leader>'
" nerdtree
"""""""""""
map <leader>n :nerdtreetoggle<cr>
let nerdtreeshowhidden=1
let nerdtreeignore = ['\.pyc$']
" powerline
""""""""""""
let g:powerline_symbols = 'fancy'
set laststatus=2 " always show the statusline
set encoding=utf-8 " necessary to show unicode glyphs
" zoomwin
""""""""""
"map <leader>\ <c-w>o
map <leader><leader> <c-w>o
" tabularize
"""""""""""""
nmap <leader>a+ :tabularize /=<cr>
vmap <leader>a+ :tabularize /=<cr>
nmap <leader>a= :tabularize /^[^=]*\zs=/<cr>
vmap <leader>a= :tabularize /^[^=]*\zs=/<cr>
nmap <leader>a; :tabularize /:<cr>
vmap <leader>a; :tabularize /:<cr>
nmap <leader>a: :tabularize /:\s*\zs/l0r1<cr>
vmap <leader>a: :tabularize /:\s*\zs/l0r1<cr>
nmap <leader>ap :tabularize /import<cr>
vmap <leader>ap :tabularize /import<cr>
"-------------------------------------------------------------------------------
" custom filetype settings
"-------------------------------------------------------------------------------
" coffeescript, html, htmldjango, jade, less, stylus
au filetype coffee,html,htmldjango,jade,less,stylus,json
\ set shiftwidth=2 softtabstop=2 tabstop=2 textwidth=239
"-------------------------------------------------------------------------------
" load os specific config files
"-------------------------------------------------------------------------------
if has('win32')
source ~/.vim/.vimrc.win
elseif has('mac')
source ~/.vim/.vimrc.osx
elseif has('unix')
source ~/.vim/.vimrc.linux
endif
"-------------------------------------------------------------------------------
" OSX SPECIFIC VIM SETTINGS
"-------------------------------------------------------------------------------
" enable system clipboard
set clipboard=unnamed
" make keypad work in vim with iTerm
map <Esc>Oq 1
map <Esc>Or 2
map <Esc>Os 3
map <Esc>Ot 4
map <Esc>Ou 5
map <Esc>Ov 6
map <Esc>Ow 7
map <Esc>Ox 8
map <Esc>Oy 9
map <Esc>Op 0
map <Esc>On .
map <Esc>OQ /
map <Esc>OR *
map <kPlus> +
map <Esc>OS -
map! <Esc>Oq 1
map! <Esc>Or 2
map! <Esc>Os 3
map! <Esc>Ot 4
map! <Esc>Ou 5
map! <Esc>Ov 6
map! <Esc>Ow 7
map! <Esc>Ox 8
map! <Esc>Oy 9
map! <Esc>Op 0
map! <Esc>On .
map! <Esc>OQ /
map! <Esc>OR *
map! <kPlus> +
map! <Esc>OS -
class people::ablecoder::applications::vim (
$my_sourcedir = $people::ablecoder::params::my_sourcedir,
$my_homedir = $people::ablecoder::params::my_homedir,
$my_username = $people::ablecoder::params::my_username
) {
include ::vim
# Vim Bundles
#-----------------------------------------------------------------------------
# code comment
vim::bundle { 'tomtom/tcomment_vim': }
# color scheme
vim::bundle { 'godlygeek/csapprox': }
vim::bundle { 'chriskempson/base16-vim': }
# git
vim::bundle { 'tpope/vim-fugitive': }
# file/buffer navigation
vim::bundle { 'scrooloose/nerdtree': }
vim::bundle { 'kien/ctrlp.vim': }
vim::bundle { 'vim-scripts/ZoomWin': }
vim::bundle { 'rking/ag.vim': }
# text object plugins
vim::bundle { 'tpope/vim-surround': }
vim::bundle { 'vim-scripts/argtextobj.vim': }
vim::bundle { 'michaeljsmith/vim-indent-object': }
# automated alignment
vim::bundle { 'godlygeek/tabular': }
# language support/syntax/highlighting
vim::bundle { 'ap/vim-css-color': }
vim::bundle { 'avakhov/vim-yaml': }
vim::bundle { 'digitaltoad/vim-jade': }
vim::bundle { 'helino/vim-json': }
vim::bundle { 'kchmck/vim-coffee-script': }
#vim::bundle { 'klen/python-mode': }
vim::bundle { 'rodjek/vim-puppet': }
vim::bundle { 'vim-ruby/vim-ruby': }
vim::bundle { 'vim-scripts/bash-support.vim': }
vim::bundle { 'wavded/vim-stylus': }
vim::bundle { 'aliva/vim-fish': }
vim::bundle { 'Glench/Vim-Jinja2-Syntax': }
vim::bundle { 'groenewege/vim-less': }
# tab/auto complete
vim::bundle { 'ervandew/supertab': }
# visualization/notification
vim::bundle { 'Lokaltog/vim-powerline': }
# Vim Config
#-----------------------------------------------------------------------------
file { "${my_homedir}/.vim/.backup":
ensure => directory,
mode => 750,
require => File["${my_homedir}/.vim"],
}
file { "${my_homedir}/.vimrc":
ensure => link,
mode => 644,
target => "${my_sourcedir}/config/dotfiles/vim/.vimrc",
require => [File["${my_homedir}/.vim"],
Repository["${my_sourcedir}/config/dotfiles"]],
}
file { "${my_homedir}/.vim/.vimrc.osx":
ensure => link,
target => "${my_sourcedir}/config/dotfiles/vim/.vim/.vimrc.osx",
require => [File["${my_homedir}/.vim"],
Repository["${my_sourcedir}/config/dotfiles"]],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment