Skip to content

Instantly share code, notes, and snippets.

@amacfie
Created December 8, 2015 15:29
Show Gist options
  • Save amacfie/4b068a7e0a2a18327ef9 to your computer and use it in GitHub Desktop.
Save amacfie/4b068a7e0a2a18327ef9 to your computer and use it in GitHub Desktop.
.vimrc snapshot at 2015.Dec.8
" <neobundle>
" Note: Skip initialization for vim-tiny or vim-small.
if 0 | endif
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
NeoBundle 'airblade/vim-gitgutter'
NeoBundle 'altercation/vim-colors-solarized'
NeoBundle 'ctrlpvim/ctrlp.vim'
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlPMixed'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.(git|hg|svn)|\_site)$',
\ 'file': '\v\.(exe|so|pdf|dll|class|png|jpg|jpeg)$',
\}
nmap <leader>b :CtrlPMRU<cr>
" http://stackoverflow.com/a/22784889/371334
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'
if executable('ag')
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
endif
NeoBundle 'dhruvasagar/vim-vinegar', {
\ 'depends': 'scrooloose/nerdtree',
\ }
NeoBundle 'easymotion/vim-easymotion'
map <Space> <Plug>(easymotion-prefix)
NeoBundle 'embear/vim-localvimrc'
let g:localvimrc_event=[ "BufReadPost" ]
let g:localvimrc_persistent=1
NeoBundle 'fisadev/vim-ctrlp-cmdpalette', {
\ 'depends': 'ctrlpvim/ctrlp.vim',
\ }
" \p runs CtrlP for ex commands
map <Leader>p :CtrlPCmdPalette<CR>
NeoBundle 'godlygeek/tabular'
NeoBundle 'kana/vim-arpeggio'
" loaded below
" example:
" Arpeggio inoremap jk <Esc>
NeoBundle 'kana/vim-textobj-function', {
\ 'depends': 'kana/vim-textobj-user',
\ }
NeoBundle 'kana/vim-textobj-line', {
\ 'depends': 'kana/vim-textobj-user',
\ }
NeoBundle 'kana/vim-textobj-user'
NeoBundle 'jiangmiao/auto-pairs'
NeoBundle 'honza/vim-snippets', {
\ 'depends': 'SirVer/ultisnips',
\ }
NeoBundle 'plasticboy/vim-markdown'
let g:vim_markdown_initial_foldlevel=1
NeoBundle 'rking/ag.vim'
NeoBundle 'rsmenon/vim-mathematica'
let filetype_m = "mma"
let g:mma_highlight_option = "solarized"
NeoBundle 'scrooloose/nerdtree'
" http://vimcasts.org/blog/2013/01/oil-and-vinegar-split-windows-and-project-drawer/
let NERDTreeHijackNetrw=1
NeoBundle 'scrooloose/syntastic'
NeoBundle 'SirVer/ultisnips'
let g:UltiSnipsExpandTrigger = '<c-s>'
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'linux' : 'make',
\ 'unix' : 'gmake',
\ },
\ }
NeoBundle 'sjl/gundo.vim'
NeoBundle 'terryma/vim-expand-region'
vmap v <Plug>(expand_region_expand)
" TODO: make work with lines and functions
NeoBundle 'tpope/vim-fugitive'
" https://github.com/tpope/vim-fugitive/issues/536
let g:netrw_browsex_viewer = "gnome-open-fixed"
NeoBundle 'tpope/vim-repeat'
NeoBundle 'tpope/vim-surround'
" https://github.com/rkitover/vimpager/issues/76
if exists("vimpager")
let g:loaded_surround = 1
endif
NeoBundle 'Valloric/YouCompleteMe'
let g:ycm_key_list_select_completion = ['<C-n>']
let g:ycm_key_list_previous_completion = ['<C-p>']
"NeoBundle 'vimwiki/vimwiki'
" just use custom folds
let g:vimwiki_folding=''
NeoBundle 'Yggdroot/indentLine'
let g:indentLine_char = '│'
let g:indentLine_color_term = 239
let g:indentLine_fileTypeExclude = ['help']
nnoremap <leader>i :IndentLinesToggle<cr>
" https://github.com/Yggdroot/indentLine/issues/109
let g:indentLine_noConcealCursor = 1
" Filetype-specific plugins
" python
NeoBundleLazy 'davidhalter/jedi-vim', {
\ 'autoload': {
\ 'filetypes': 'python',
\ },
\ }
" JS
NeoBundle 'heavenshell/vim-jsdoc'
let g:jsdoc_allow_input_prompt = 1
let g:jsdoc_default_mapping=0
NeoBundle 'jelera/vim-javascript-syntax'
NeoBundleLazy 'marijnh/tern_for_vim', {
\ 'autoload': {
\ 'filetypes': 'javascript',
\ },
\ }
NeoBundle 'othree/javascript-libraries-syntax.vim'
let g:used_javascript_libs = ''
"NeoBundle 'pangloss/vim-javascript'
NeoBundle 'thinca/vim-textobj-function-javascript', {
\ 'depends': 'kana/vim-textobj-function',
\ }
" ng
NeoBundleLazy 'matthewsimo/angular-vim-snippets'
" HTML
NeoBundle 'mattn/emmet-vim'
let g:user_emmet_leader_key='<c-s>'
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
" </neobundle>
" https://github.com/kana/vim-arpeggio/issues/7
call arpeggio#load()
" vimwiki bs
let g:vimwiki_list = [{'maxhi': 0, 'css_name': 'style.css', 'auto_export': 0, 'diary_index': 'diary', 'template_default': 'def_template', 'nested_syntaxes': {}, 'diary_sort': 'desc', 'path': '/home/amacfie/vimwiki/', 'diary_link_fmt': '%Y-%m-%d', 'template_ext': '.html', 'syntax': 'default', 'custom_wiki2html': '', 'index': 'index', 'diary_header': 'Diary', 'ext': '.wiki', 'path_html': '/home/amacfie/vimwiki_html/', 'temp': 0, 'template_path': '~/vimwiki_html/templates/', 'list_margin': -1, 'diary_rel_path': 'diary/'}]
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a single file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
" line numbers
set number
" 80-char line
set colorcolumn=80
hi ColorColumn ctermbg=black
" http://www.johnhawthorn.com/2012/09/vi-escape-delays/
set noesckeys
" https://powerline.readthedocs.org/en/latest/tipstricks.html#vim
if !has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
endif
set incsearch
set ignorecase
set smartcase
set autoindent
set background=dark
" http://stackoverflow.com/a/234578/371334
set tabstop=2
set shiftwidth=2
set expandtab
" Use 256 colours (Use this setting only if your terminal supports 256 colours)
set t_Co=256
" \h toggles search highlighting
map <Leader>h :set hlsearch!<CR>
" statusline
set noruler
set laststatus=2
set statusline=
set statusline +=%<%F "full path
set statusline +=\ %m "modified flag
set statusline +=\ %{fugitive\#statusline()} " Git Hotness
set statusline +=%=Buf\ %n/%{bufnr('$')} "buffer number
set statusline +=\ \ \ Line\ %l "current line
set statusline +=/%L "total lines
set showmode
set showcmd
set clipboard-=autoselect
" disable line wrapping
set nowrap
" http://vim.wikia.com/wiki/Highlight_current_line
set cursorline
hi CursorLine cterm=NONE ctermbg=black
" https://wiki.archlinux.org/index.php/mutt#Mutt_and_Vim
augroup filetypedetect
" Mail
autocmd BufRead,BufNewFile *mutt-* setfiletype mail
augroup END
" http://ebonhand.wordpress.com/2011/03/30/automatically-save-and-load-vim-views-folds/
" to save view, files must be "saved" even if there are no unsaved changes to
" the file
" Alternative: https://github.com/kopischke/vim-stay
set viewoptions-=options
augroup vimrc
autocmd BufWritePost *
\ if expand('%') != '' && &buftype !~ 'nofile'
\| mkview
\| endif
autocmd BufRead *
\ if expand('%') != '' && &buftype !~ 'nofile'
\| silent loadview
\| endif
augroup END
" save some state across sessions
set viminfo='1000,f1,:1000,/100,%,!
" http://stackoverflow.com/a/4255960/371334
if v:version >= 700
au BufLeave * let b:winview = winsaveview()
au BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif
endif
set hidden
" http://stackoverflow.com/a/4789615/371334
" screws up vimwiki folding
"set foldmethod=syntax
"set foldlevelstart=1
"set foldnestmax=2
" http://www.vim.org/scripts/script.php?script_id=2226
"syntax enable
syntax on
colorscheme solarized
set backspace=indent,eol,start
" Show trailing whitespace and spaces before a tab
" In general not wanted in read-only files such as in vimpager
if !exists("vimpager")
match ErrorMsg /\s\+$\| \+\ze\t/
endif
"<Enter> and <Shift><Enter> insert lines without going into insert mode
" this screws up things that listen for <Enter>
"map <Enter> o<ESC>
"map <S-Enter> O<ESC>
" insert date
" TODO: replace with snippet
function! Wd()
.-1read !date +\%Y.\%b.\%d
normal o
" needed because `normal` aborts insert mode
startinsert
endfunction
command! Wd call Wd()
" runs jek command
function! Jek()
w
silent !pkill ruby; bundle exec jekyll serve --baseurl ''&; sleep 2; cat ~/code/reloadLocalhostTabs.js | nc localhost 4242
redraw!
endfunction
map <Leader>j :call Jek()<CR>
" omnicompletion behavior
set completeopt=longest,menuone,preview
"inoremap <Nul> <C-x><C-o><down>
" http://stackoverflow.com/a/11733518/371334
"autocmd CursorMovedI * if pumvisible() == 0|silent! pclose|endif
"autocmd CursorMoved * if pumvisible() == 0|silent! pclose|endif
"autocmd InsertLeave * if pumvisible() == 0|silent! pclose|endif
set pumheight=5
" https://github.com/rkitover/vimpager#description
let g:vimpager_less_mode = 0
" Filetype-specific config
" JS
"http://stackoverflow.com/a/6133388/371334
autocmd filetype javascript nmap <silent> gd :TernDef<CR>
autocmd filetype javascript nmap <silent> gD :TernDef<CR>
autocmd filetype javascript nmap <silent> K :TernDoc<CR>
"http://usevim.com/2013/05/24/tern/
let g:tern_show_argument_hints='on_hold'
" this creates folds in a buffer
au FileType javascript call JavaScriptFold()
" python
let g:jedi#completions_command = ""
let g:jedi#use_tabs_not_buffers = 0
" HTML
"au FileType html setl sw=2 ts=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment