Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cmsj
Created October 5, 2016 18:59
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/3a4a1871a7b88767fcbfeac069b5e037 to your computer and use it in GitHub Desktop.
Save cmsj/3a4a1871a7b88767fcbfeac069b5e037 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 'ctrlpvim/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 'vim-airline/vim-airline'
Bundle 'vim-airline/vim-airline-themes'
Bundle 'jnurmine/Zenburn'
Bundle 'greyblake/vim-preview'
Bundle 'darfink/vim-plist'
Bundle 'jamessan/vim-gnupg'
Bundle 'bling/vim-bufferline'
Bundle 'haya14busa/incsearch.vim'
Bundle 't9md/vim-choosewin'
Bundle 'edkolev/promptline.vim'
Bundle 'edkolev/tmuxline.vim'
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
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
let g:zenburn_high_Contrast=1
colorscheme zenburn
" Enable syntax highlighting
syntax on
endif
" Enable indenting
filetype plugin indent on
" Make sure backspace works sanely across autoindents, line breaks and inserts
:set backspace=indent,eol,start
" 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
:set smarttab
" 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
" Disable showing VIM mode in the status line, since Airline is going to show
" it anyway
:set noshowmode
" 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
" Make command-line completion smarter
:set wildmenu
" Show line numbers by default
:set number
" Remember lots of command history
:set history=100
" Auto-reload changed files if VIM contains no changes for them
:set autoread
" 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
" Turn on cursor row/column indicator
:set cursorline
:set cursorcolumn
" 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>
" Remap split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Configure splitting behaviour
:set splitbelow
:set splitright
" 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#extensions#tabline#left_sep = '▶'
let g:airline#extensions#tabline#right_sep = '◀'
let g:airline_symbols.linenr= '␊'
let g:airline_symbols.branch = '⎇ '
let g:airline_theme='luna'
let g:airline#extensions#branch#empty_message = '(no branch)'
let g:airline_inactive_collapse=0
let g:airline_skip_empty_sections = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#show_close_button = 0
" Enable Airline's tabline enhancement
let g:airline#extensions#tabline#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 :TagbarOpenAutoClose<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
" Configure incsearch
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" Configure Choosewin
map <leader>w <Plug>(choosewin)
let g:choosewin_overlay_enable = 1
let g:choosewin_blink_on_land = 0
" Configure PromptLine
" Note, to update ~/.bash_prompt, run:
" :PromptlineSnapshot! ~/.bash_prompt airline
" and then edit ~/.bash_prompt and add '\n$ '
" to the end of the bash PS1 set, near the bottom
let g:promptline_powerline_symbols = 0
let g:promptline_symbols = {
\ 'left' : '▶',
\ 'right' : '◀',
\ 'left_alt' : '>',
\ 'right_alt' : '<',
\ 'dir_sep' : '/',
\ 'truncation' : '…',
\ 'vcs_branch' : '⎇ ',
\ 'battery' : '',
\ 'space' : ' '}
let g:promptline_preset = {
\ 'a' : [ '$USER@$(hostname -s)' ],
\ 'b' : [ promptline#slices#vcs_branch(), promptline#slices#git_status() ],
\ 'c' : [ promptline#slices#cwd() ],
\ 'warn' : [ promptline#slices#last_exit_code() ],
\'options': {
\'left_only_sections' : [ 'a', 'b', 'c', 'warn' ]}}
" Configure tmuxline
let g:tmuxline_powerline_separators = 0
let g:tmuxline_theme = 'airline'
let g:tmuxline_separators = {
\ 'left' : '▶',
\ 'right' : '◀',
\ 'left_alt' : '>',
\ 'right_alt' : '<',
\ 'space' : ' '}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment