Skip to content

Instantly share code, notes, and snippets.

@cmsj
Created November 23, 2015 21:05
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 cmsj/f2806b37484c08ae4edb to your computer and use it in GitHub Desktop.
Save cmsj/f2806b37484c08ae4edb to your computer and use it in GitHub Desktop.
" Be iMproved
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
" Bundles
Bundle 'gmarik/vundle'
Bundle 'kien/ctrlp.vim'
Bundle 'tpope/vim-fugitive'
Bundle 'mattn/gist-vim'
Bundle 'airblade/vim-gitgutter'
Bundle 'sjl/gundo.vim'
Bundle 'davidhalter/jedi-vim'
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/syntastic'
Bundle 'majutsushi/tagbar'
Bundle 'mattn/webapi-vim'
Bundle 'vim-scripts/YankRing.vim'
Bundle 'bling/vim-airline'
Bundle 'jnurmine/Zenburn'
Bundle 'greyblake/vim-preview'
Bundle 'darfink/vim-plist'
Bundle 'jamessan/vim-gnupg'
Bundle 'bling/vim-bufferline'
filetype plugin indent on
" Detect the system
let os=substitute(system('uname'), '\n', '', '')
if os == 'Darwin' || os == 'Mac'
let platform='mac'
elseif os == 'Linux'
let platform='linux'
else
let platform='unknown'
endif
" Enable 256 colours if we can
" FIXME: This should go away in favour of us setting TERM properly in
" Terminator1.0
if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal"
set t_Co=256
endif
" If we have colour support, take advantage of it
if &t_Co > 2 || has("gui_running")
" Load that colourscheme we like
colorscheme zenburn
" Enable syntax highlighting
syntax on
endif
" Enable indenting
filetype plugin indent on
" Be sure that VIM knows we want Unicode
:set encoding=utf-8
" Set our default preferred tab/space behaviours
:set expandtab tabstop=4 shiftwidth=4 softtabstop=4
" Add a paste toggle that works in normal/insert modes
:set pastetoggle=<F9>
" Show enough of a status line for Airline to appear
:set laststatus=2
" Search as you type
:set incsearch
" Ignore case when searching
:set ignorecase
" Don't ignore case when searching if upper case characters are used
:set smartcase
" Highlight search matches
:set hlsearch
" Show line numbers by default
:set number
" Remember lots of command history
:set history=100
" Configure our mapleader
:let mapleader="\<Space>"
" Enable persistent undo
:set undodir=~/.cache/vim/undodir
:set undofile
:set undolevels=1000
:set undoreload=10000
" Show whitespace characters (except an actual space)
:set listchars=eol:¶,tab:»-,trail:·
:set list
" Keep some scroll offset
:set scrolloff=5
" Turn off the top-of-window tab bar
:set showtabline=0
" Toggle line numbers and whitespace markers
:nmap <leader>l :setlocal number!<CR>:set list!<CR>
" Toggle paste mode
:nmap <leader>p :set paste!<CR>
" Remap macro recording away from q, to <leader>q
nnoremap <leader>q q
nnoremap q <Nop>
" Remap save file
nnoremap <leader>w :w<CR>
nnoremap <leader>q :q<CR>
" Configure Airline's look
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep='▶'
let g:airline_right_sep='◀'
let g:airline_symbols.linenr= '␊ '
let g:airline_symbols.branch = '⎇ '
let g:airline_theme='dark'
" Integrate Airline with other plugins
let g:airline#extensions#branch#enabled=1
let g:airline#extensions#syntastic#enabled=1
" NOTE: There is no more specific python syntax/linting because syntastic can
" do it if you pip install flake8
" Make syntastic check when opening a file
:let g:syntastic_check_on_open=1
" Fancy syntastic error/warning symbols
let g:syntastic_enable_signs=1
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
" Limit syntastic location list window height
let g:syntastic_loc_list_height=4
" Configure syntastic for Lua
let g:syntastic_lua_checkers = ["luac", "luacheck"]
let g:syntastic_lua_luacheck_args = "--no-unused-args"
" Configure syntastic to use clang for ObjC
let g:syntastic_objc_checker = 'clang'
" Make NERDTree close when we open a file
let g:NERDTreeQuitOnOpen=1
" Open NERDTree to browse for files
:nmap <leader>e :NERDTreeToggle<CR>
" Open NERDTree if there are no files open
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Open Tagbar
:nmap <leader>x :TagbarToggle<CR>
" Open CtrlP
let g:ctrlp_map='<leader>o'
" Show the Buffer browser by default
let g:ctrlp_cmd='CtrlPBuffer'
" Configure Gist platform integration
if platform == 'mac'
let g:gist_clip_command='pbcopy'
let g:gist_browser_command='open %URL%'
elseif platform == 'linux'
let g:gist_clip_command='xclip -selection clipboard'
let g:gist_browser_command='x-www-browser %URL%'
endif
" Detect Gist filetypes
let g:gist_detect_filetype=1
" Open Gist in a browser after posting
let g:gist_open_browser_after_post=1
" Include private Gists in list
let g:gist_show_privates=1
" Post private Gists by default
let g:gist_post_private=1
" Map a shortcut to open the Gundo browser
noremap <leader>u :GundoToggle<CR>
" Show gundo on the right
let g:gundo_right=1
" Configure bindings for fugitive
map <leader>gd :Gdiff<CR>
map <leader>gs :Gstatus<CR>
map <leader>gb :Gblame<CR>
map <leader>gc :Gcommit<CR>
map <leader>gca :Gcommit -a<CR>
" Configure bindings for YankRing
map <leader>y :YRShow<CR>
let g:yankring_history_file = '.vim/yankring_history'
" Configure bindings for Preview
map <leader>h :Preview<CR>
" Configure vim-gnupg
let g:GPGUsePipes = 1
let g:GPGPreferSign = 1
let g:GPGExecutable = 'gpg'
let g:GPGPreferSymmetric = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment