Skip to content

Instantly share code, notes, and snippets.

@tiagoboldt
Created April 10, 2015 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiagoboldt/eb5111bf8455da7b5e98 to your computer and use it in GitHub Desktop.
Save tiagoboldt/eb5111bf8455da7b5e98 to your computer and use it in GitHub Desktop.
" NeoBundle Scripts
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=/Users/tiagoboldt/.vim/bundle/neobundle.vim/
endif
let g:neobundle#types#git#clone_depth=1
" Required:
call neobundle#begin(expand('/Users/tiagoboldt/.vim/bundle'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'Lokaltog/vim-powerline'
NeoBundle 'Raimondi/delimitMate'
NeoBundle 'altercation/vim-colors-solarized'
NeoBundle 'ddollar/nerdcommenter'
NeoBundle 'ervandew/supertab'
NeoBundle 'wincent/command-t'
NeoBundle 'majutsushi/tagbar'
NeoBundle 'mattn/gist-vim'
NeoBundle 'mattn/webapi-vim'
NeoBundle 'nathanaelkane/vim-indent-guides'
NeoBundle 'rking/ag.vim'
NeoBundle 'sjl/gundo.vim'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'tpope/vim-repeat'
NeoBundle 'tpope/vim-surround'
NeoBundle 'vim-scripts/TaskList.vim'
NeoBundle 'vim-scripts/The-NERD-tree'
NeoBundle 'vim-scripts/YankRing.vim'
NeoBundle 'vim-scripts/closetag.vim'
NeoBundle 'airblade/vim-gitgutter'
NeoBundle 'derekwyatt/vim-scala'
" Languages and Syntax
NeoBundle 'pangloss/vim-javascript'
NeoBundle 'plasticboy/vim-markdown'
NeoBundle 'vim-scripts/Color-Sampler-Pack'
NeoBundle 'LaTeX-Box-Team/LaTeX-Box'
NeoBundle 'klen/python-mode'
" Required:
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
" ==========================================================
" Basic Settings
" ==========================================================
" Color scheme (terminal)
syntax enable
set background=light
colorscheme solarized
call togglebg#map("<F5>")
hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white
hi LineNr ctermfg=NONE ctermbg=black ctermfg=darkred
" Security
set modelines=0
" Tabs/spaces
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" Basic options
set encoding=utf-8
set scrolloff=3
set autoindent
set showmode
set showcmd
set hidden
set visualbell
set cursorline
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2
set number
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set scrolloff=25 " always leave 5 lines after/before cursor
set relativenumber " relative line numbers
" Tab completion
set wildmenu
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,*.jar,.git,*.rbc,*.class,.svn,vendor/gems/*,*.pyc,*aux,*blg,*toc,*.fdb_latexmk,*lof,*gz,*fls,*log,*pdf,*out,*pyg,*bbl,**/bower_components/*,venv,node_modules
" Insert completion
set completeopt=menuone,longest,preview
set pumheight=6 " Keep a small completion window
" Status line
set statusline=%f%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)
" Disable Backups
set nobackup
set noswapfile
" Leader
" let mapleader = "ç"
" Make Y not dumb
nnoremap Y y$
" Searching
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set incsearch
set showmatch
set hlsearch
set gdefault
nmap <tab> %
vmap <tab> %
nnoremap <esc> :noh<return><esc>
" Soft/hard wrapping
set wrap
set textwidth=79
set formatoptions=qrn1
set colorcolumn=85
set whichwrap+=<,>,h,l,[,] "switch line at line end/start
map Q {jgq}
" Use F2 to enable paste mode
set pastetoggle=<F2>
" Seriously, I keep fucking this up. It's not like :W is bound to anything anyway.
command! W :w
" Display trailing whitespace
set list
set listchars=tab:\ \ ,trail:·
" And delete trailling whitespaces
autocmd BufWritePre * :%s/\s\+$//e
" Yank text to the OS X clipboard
noremap <leader>y "*y
noremap <leader>yy "*Y
" Preserve indentation while pasting text from the OS X clipboard
noremap <leader>p :set paste<CR>:put *<CR>:set nopaste<CR>
" Make j and k keys work properly.
nnoremap j gj
nnoremap k gk
noremap <Up> gk
noremap <Down> gj
" Easy buffer navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" disable arrow keys!!
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" lets make these all work in insert mode too
imap <C-W> <C-O><C-W>
" Create vertical window split
map <leader>= <C-w>v<C-w>l
map <leader>- <C-w>s<C-w>l
" Folding
" set foldlevel=99
" set foldmethod=indent
" nnoremap <Space> za
" vnoremap <Space> za
" noremap <leader>ft Vatzf
" let g:vim_markdown_folding_disabled=1
" start unfolded
" au BufRead * normal zR
set nofoldenable " disable folding
" Sudo to write
cmap w!! w !sudo tee % >/dev/null
" Remove trailing whitespace on this line with <leader>s
nnoremap <leader>s :s/\s\+$//<cr>:let @/=''<CR>
" Restore position on file re-open
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" ==========================================================
" Plugin Configuration
" ==========================================================
" Command-T bindings
map <leader>o <Esc>:CommandT<cr>
map <leader>O <Esc>:CommandTFlush<cr>
map <leader>m <Esc>:CommandTBuffer<cr>
let g:CommandTMaxHeight = 15
" Git Gutter configs
highlight clear SignColumn
highlight clear SignColumn
highlight GitGutterAdd ctermfg=green guifg=green
highlight GitGutterChange ctermfg=yellow guifg=yellow
highlight GitGutterDelete ctermfg=red guifg=red
highlight GitGutterChangeDelete ctermfg=yellow guifg=yellow
" Gist plugin
let g:gist_post_anonymous = 0
" ==========================================================
" Filetypes
" ==========================================================
" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
" add json syntax highlighting
au BufNewFile,BufRead *.json set ft=javascript
" set conf for tex files
autocmd BufNewFile,BufRead *.tex set spell
autocmd BufNewFile,BufRead *.tex set noai nocin nosi inde=
autocmd BufNewFile,BufRead *.tex set formatoptions+=t
autocmd BufNewFile,BufRead *.tex map <leader>T :LatexTOC<CR>
let g:LatexBox_viewer = 'open'
let g:LatexBox_split_side = 'rightbelow'
let g:LatexBox_split_width = 40
" ==========================================================
" Plugins
" ==========================================================
" NERD Tree
map <leader>t :NERDTreeToggle<cr>
let NERDTreeIgnore=['.vim$', '\~$', '.*\.pyc$', 'pip-log\.txt$', '\.rbc$']
" NERD Commenter
map <leader>c <plug>NERDCommenterToggle
map <leader>cs <plug>NERDCommenterSexy
" YankRing
nnoremap <silent> <F3> :YRShow<cr>
inoremap <silent> <F3> <ESC>:YRShow<cr>
set directory=/tmp
let g:yankring_history_dir=&directory
" DelimitMate - Less annoying delimiters
let delimitMate_smart_quotes = 1
let delimitMate_visual_leader = ","
" Closetag on html/xml files
autocmd FileType html,xhtml,xml,htmldjango,jinjahtml,eruby,mako source ~/.vim/bundle/closetag.vim/plugin/closetag.vim
" SuperTab
let g:SuperTabDefaultCompletionType = "context"
" Ctags
map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
map <C-\> :tnext<CR>
" remap tag command
nnoremap <leader>f <C-]>
" Tagbar
let g:tagbar_usearrows = 1
let g:tagbar_sort = 0
let g:tagbar_compact = 1
" PyFlakes
let g:pyflakes_use_quickfix = 0
" PEP8
" let g:pep8_map="<leader>8"
" TaskList
map <leader>v <Plug>TaskList
" Gundo
map <leader>g :GundoToggle<CR>
" Ack
nmap <leader>a <Esc>:Ack!
" Indent-guides
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
" Easymotion
nmap s <Plug>(easymotion-s)
" Python mode
let g:pymode_rope = 1
" Documentation
let g:pymode_doc = 1
let g:pymode_doc_key = 'K'
"Linting
let g:pymode_lint = 1
let g:pymode_lint_checker = "pyflakes,pep8"
" Auto check on save
let g:pymode_lint_write = 1
" Support virtualenv
let g:pymode_virtualenv = 1
" Enable breakpoints plugin
let g:pymode_breakpoint = 1
let g:pymode_breakpoint_key = '<leader>b'
" syntax highlighting
let g:pymode_syntax = 1
let g:pymode_syntax_all = 1
let g:pymode_syntax_indent_errors = g:pymode_syntax_all
let g:pymode_syntax_space_errors = g:pymode_syntax_all
" Don't autofold code
let g:pymode_folding = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment