Skip to content

Instantly share code, notes, and snippets.

@zenbrent
Created August 26, 2015 17:12
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 zenbrent/19c4345674c7b4954ee2 to your computer and use it in GitHub Desktop.
Save zenbrent/19c4345674c7b4954ee2 to your computer and use it in GitHub Desktop.
" Custom color profiles!
" http://bytefluent.com/vivify/
" http://vim.wikia.com/wiki/Keep_your_vimrc_file_clean
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.nvim/bundle/Vundle.vim
" alternatively, pass a path where Vundle should install plugins
call vundle#begin('~/.nvim/bundle/')
" call vundle#begin()
" Set the leader to , instead of \
let mapleader=","
map ; :
" Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
nmap <silent> <leader>nt :NERDTree<CR>
"---------------------------------------------+
" My Plugins |
"---------------------------------------------+
" original repos on github
" Example of options.. Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
""" Plugins I'd like to learn to use:
" " Regex dev & learning tool:
" Plugin 'Raimondi/VimRegEx.vim'
" Plugin 'vimoutliner/vimoutliner'
" " Collaborative editing for vim:
" Plugin 'FredKSchott/CoVim'
" " Tools for editing vimscripts:
" Plugin 'tpope/vim-scriptease'
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Vim git client
Plugin 'tpope/vim-fugitive'
" Shell
" Install manually, some versions are missing files:
Plugin 'Conque-Shell'
" Syntax checker:
Plugin 'scrooloose/syntastic'
let g:syntastic_javascript_checkers = ['jshint']
let g:syntastic_scss_checkers = ['scss_lint']
Plugin 'majutsushi/tagbar'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'Emmet.vim'
Plugin 'tpope/vim-commentary'
" Like command-t/ctrl-p but better!
Plugin 'Shougo/unite.vim'
Plugin 'Chiel92/vim-autoformat'
" Ag search tool for vim -- learn it!
Plugin 'ggreer/the_silver_searcher'
" Mostly nodejs stuff
Plugin 'raichoo/purescript-vim'
Plugin 'jsx/jsx.vim'
Plugin 'digitaltoad/vim-jade'
Plugin 'jimmyhchan/dustjs.vim'
Plugin 'groenewege/vim-less'
Plugin 'heartsentwined/vim-emblem'
" Plugin 'lukaszkorecki/CoffeeTags'
Plugin 'kchmck/vim-coffee-script'
" hi link coffeeSpaceError NONE
" hi link coffeeSemicolonError NONE
" Try multiple cursors -- it uses <C-n> as it's default key, and some other overlaps...
" Plugin 'terryma/vim-multiple-cursors'
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-surround'
Plugin 'pangloss/vim-javascript'
Plugin 'einars/js-beautify'
" Plugin 'marijnh/tern_for_vim'
Plugin 'Keithbsmiley/swift.vim'
Plugin 'ashisha/image.vim'
" Plugin 'Raimondi/delimitMate'
Plugin 'mattn/webapi-vim'
Plugin 'mattn/gist-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'nono/vim-handlebars'
Plugin 'wavded/vim-stylus'
Plugin 'cakebaker/scss-syntax.vim'
" Plugin 'vim-scripts/VimClojure'
Plugin 'guns/vim-clojure-static'
Plugin 'tpope/vim-fireplace'
Plugin 'tpope/vim-classpath'
Plugin 'kien/rainbow_parentheses.vim'
" .net stuff
let g:Omnisharp_start_server = 0
Plugin 'OmniSharp/omnisharp-vim'
Plugin 'OrangeT/vim-csharp'
" Write HTML fast - e.g.:
" #header > ul > li < p{Footer}
Plugin 'rstacruz/sparkup'
" Plugin 'jpalardy/vim-slime'
" Use tmux with slime
Plugin 'epeli/slimux'
" let g:slime_target = "tmux"
Plugin 'tpope/vim-markdown'
Plugin 'tpope/vim-repeat'
" Plugin 'NagatoPain/indentLine'
" Plugin 'Yggdroot/indentLine'
Plugin 'tejr/vim-tmux'
" Code autocompletion -- learn it!!
" YCM is currently breaking..
" Plugin 'Valloric/YouCompleteMe'
" Plugin "teramako/jscomplete-vim"
" let g:jscomplete_use = ['dom']
" Plugin 'tpope/vim-rails'
" Plugin 'tpope/vim-rake'
" Local vimrc files - make a .lvimrc file
" Plugin 'localrc.vim'
" a color scheme
Plugin 'Lokaltog/vim-distinguished'
Plugin 'guns/xterm-color-table.vim'
Plugin 'molokai'
Plugin 'powerline/powerline'
" source ~/.vim/bundle/powerline/ext/vim/powerline.vim
set laststatus=2
" Plugin 'vim-scripts/octave.vim--'
" vim-scripts repos
Plugin 'paredit.vim'
Plugin 'javacomplete'
Plugin 'L9'
Plugin 'FuzzyFinder'
Plugin 'taglist.vim'
Plugin 'Align'
Plugin 'DrawIt'
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-session'
Plugin 'katono/rogue.vim'
let g:session_autoload = 'no'
let g:session_autosave = 'no'
" Orgmode stuff:
" Plugin 'vim-orgmode'
" Suggested for orgmode
" Plugin 'chrisbra/NrrwRgn'
" required for orgmode
" Plugin 'utl.vim'
" Most recently used - file history
Plugin 'mru.vim'
call vundle#end()
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
filetype on
filetype plugin indent on
filetype plugin on
" Always show current position
set ruler
" Height of the command bar
set cmdheight=1
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Search while you type
set incsearch
" Highlight all matches
set hlsearch
nmap <silent> <C-n> :silent noh<CR>
" Show matching brackets when text indicator is over them
set showmatch
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Enable syntax highlighting
syntax enable
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git etc. anyway...
set nobackup
set nowb
" From http://nvie.com/posts/how-i-boosted-my-vim/ :
" If you care about recovering after a Vim or terminal emulator crash, or you
" often load huge files into memory, do not disable the swapfile.
set noswapfile
" set undofile
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set smarttab
" Use spaces as tabs:
" 1 tab == 2 spaces
set expandtab
set tabstop=4 shiftwidth=4 softtabstop=4
" set tabstop=2 shiftwidth=2 softtabstop=2
" Use tabs as tabs:
" set autoindent noexpandtab tabstop=4 shiftwidth=4
autocmd Filetype coffee setlocal ts=2 sts=2 sw=2
autocmd Filetype stylus setlocal ts=2 sts=2 sw=2
autocmd Filetype scss setlocal autoindent noexpandtab tabstop=4 shiftwidth=4
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
""""""""""""""""""""""""""""""
" => Visual mode related
""""""""""""""""""""""""""""""
" Visual mode pressing * or # searches for the current selection
" Super useful! From an idea by Michael Naumann
vnoremap <silent> * :call VisualSelection('f')<CR>
vnoremap <silent> # :call VisualSelection('b')<CR>
set number
" debug for fixing autocommands
" set verbose=9
if !exists("autocommands_loaded")
let autocommands_loaded = 1
""""""""""""""""""""""""""""""
" => Folding
""""""""""""""""""""""""""""""
augroup vimrc
" Folding for coffeescript
au BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable filetype=coffee
au BufNewFile,BufReadPost *.es6 setl foldmethod=indent nofoldenable filetype=javascript
" Manual folding too!
au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
augroup END
au BufWinEnter,BufRead,BufNewFile *.json set filetype=javascript
" lisp and others
" au BufWinEnter,BufRead,BufNewFile *.ls set filetype=lisp
au BufWinEnter,BufRead,BufNewFile *.ust set filetype=html
" au BufRead,BufNewFile *.shen set ft=clojure
endif
au BufNewFile,BufReadPost *.styl setl foldmethod=indent nofoldenable filetype=stylus
au BufNewFile,BufReadPost *.jade setl foldmethod=indent nofoldenable filetype=jade
" In normal mode, press Space to toggle the current fold open/closed. However,
" if the cursor is not in a fold, move to the right (the default behavior). In
" addition, with the manual fold method, you can create a fold by visually
" selecting some lines, then pressing Space.
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
nnoremap <silent> <S-Space> zd
vnoremap <Space> zf
" Hide buffers instead of closing them:
set hidden
" Tab to autocomplete. List and full are supposed to do other stuff, but it
" seems like they don't... :( ??? see
" http://stackoverflow.com/questions/526858/how-do-i-make-vim-do-normal-bash-like-tab-completion-for-file-names
set wildmode=longest,list,full
set wildmenu
" set wildignore+=node_modules,*.o,*.obj
set wrap
set linebreak
set nolist " list disables linebreak
set textwidth=0
set wrapmargin=0
set formatoptions+=l
set history=5000
set whichwrap=b,s,h,l,<,>,[,] " backspace and cursor keys wrap to
set scrolljump=5 " lines to scroll when cursor leaves screen
set scrolloff=2 " minimum lines to keep above and below cursor
" ctrl-navkeys to swtich windows. Add <C-W>_ (e.g. map <C-J> <C-W>j<C-W>_) to
" move and make that page full screen.
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
map <C-H> <C-W>h
" So ss doesn't automatically reload shit..
set nowritebackup
" Make vim popup behave more like an IDE popup - from .vimrc on tablet
set completeopt=longest,menuone
cnoremap :mkdir !mkdir -p <c-r>=expand("%:h")<cr>/
" Mostly so I can scroll.
set mouse=a
" Opens an edit command with the path of the currently edited file filled in
" Normal mode: <Leader>e
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
" Mappings for slimux
map <Leader>s :SlimuxREPLSendLine<cr>
vmap <Leader>s :SlimuxREPLSendSelection<cr>
map <Leader>a :SlimuxShellLast<cr>
" Ignores the case when searching, unless you use a cap, then it is case
" sensitive.
set ignorecase
set smartcase
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Rainbow parentheses!!!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" let g:rbpt_colorpairs = [
" \ ['brown', 'RoyalBlue3'],
" \ ['Darkblue', 'SeaGreen3'],
" \ ['darkgray', 'DarkOrchid3'],
" \ ['darkgreen', 'firebrick3'],
" \ ['darkcyan', 'RoyalBlue3'],
" \ ['darkred', 'SeaGreen3'],
" \ ['darkmagenta', 'DarkOrchid3'],
" \ ['brown', 'firebrick3'],
" \ ['gray', 'RoyalBlue3'],
" \ ['black', 'SeaGreen3'],
" \ ['darkmagenta', 'DarkOrchid3'],
" \ ['Darkblue', 'firebrick3'],
" \ ['darkgreen', 'RoyalBlue3'],
" \ ['darkcyan', 'SeaGreen3'],
" \ ['darkred', 'DarkOrchid3'],
" \ ['red', 'firebrick3'],
" \ ]
" au VimEnter * RainbowParenthesesActivate
" au Syntax * RainbowParenthesesLoadRound
" au Syntax * RainbowParenthesesLoadSquare
" au Syntax * RainbowParenthesesLoadBraces
" syntax keyword javascript not conceal cchar=¬
" syntax keyword javascript function conceal cchar=λ
" syntax match javascript 'function' contained conceal cchar=λ
" syntax keyword kjkjhlhl conceal cchar=YES
set conceallevel=2
" To make tabs more readable, the label only contains the tail of the file
" name and the buffer modified flag.
set guitablabel=%M%t
" Send print jobs to Preview.app. This does not delete the temporary ps file
" that is generated by :hardcopy.
set printexpr=system('open\ -a\ Preview\ '.v:fname_in)\ +\ v:shell_error
" Something messes up the colors of popup menus so they're unreadable. The fix:
highlight Pmenu ctermbg=250 ctermfg=0
highlight PmenuSel ctermbg=255 ctermfg=8
" Change the horzontal and vertical split colors
highlight VertSplit ctermbg=8 ctermfg=15
highlight StatusLine cterm=italic ctermbg=249 ctermfg=0
highlight StatusLineNC cterm=italic ctermbg=245 ctermfg=264
" highlight VertSplit ctermbg=8 ctermfg=0
" highlight StatusLine cterm=italic ctermbg=235 ctermfg=247
" highlight StatusLineNC cterm=italic ctermbg=234 ctermfg=240
" tab pages line, active tab page label
highlight TabLineSel cterm=NONE ctermbg=249 ctermfg=0
" highlight TabLineSel cterm=NONE ctermbg=235 ctermfg=249
" labels for inactive tabs
highlight TabLine cterm=NONE ctermbg=245 ctermfg=264
" highlight TabLine cterm=NONE ctermbg=233 ctermfg=240
" the rest of the tab line
highlight TabLineFill ctermbg=0 ctermfg=245
" highlight TabLineFill ctermbg=0 ctermfg=234
" titles for output from ":set all", ":autocmd" etc.
highlight Title ctermbg=15 ctermfg=8
highlight Visual ctermbg=250 ctermfg=0
" highlight Title ctermbg=233 ctermfg=248
" highlight Visual ctermbg=250 ctermfg=235
" Italicize comments.
highlight Comment cterm=italic
" highlight CursorLine cterm=NONE ctermbg=NONE ctermfg=NONE guibg=NONE guifg=NONE
" highlight CursorLine cterm=underline ctermbg=NONE ctermfg=NONE guibg=darkred guifg=white
" highlight CursorColumn cterm=NONE ctermbg=234 ctermfg=NONE guibg=darkred guifg=white
highlight CursorColumn cterm=NONE ctermbg=255 ctermfg=NONE guibg=darkred guifg=white
au WinLeave * set nocursorcolumn
au WinEnter * set cursorcolumn
" au WinLeave * set nocursorline nocursorcolumn
" au WinEnter * set cursorline cursorcolumn
set cursorcolumn
" set cursorline cursorcolumn
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Autoformatting options
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
" csharp
let g:formatprg_cs = "astyle"
let g:formatprg_args_expr_cs = '"--mode=cs --style=attach --indent-namespaces -pcH".(&expandtab ? "s".&shiftwidth : "t")'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use w!! to edit a file with root access.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
cmap w!! w !sudo tee % >/dev/null
if executable('coffeetags')
let g:tagbar_type_coffee = {
\ 'ctagsbin' : 'coffeetags',
\ 'ctagsargs' : '--include-vars',
\ 'kinds' : [
\ 'f:functions',
\ 'o:object',
\ ],
\ 'sro' : ".",
\ 'kind2scope' : {
\ 'f' : 'object',
\ 'o' : 'object',
\ }
\ }
endif
" Unite
let g:unite_source_history_yank_enable = 1
call unite#filters#matcher_default#use(['matcher_fuzzy'])
nnoremap <leader>t :<C-u>Unite -no-split -buffer-name=files -start-insert file_rec/async:!<cr>
nnoremap <leader>f :<C-u>Unite -no-split -buffer-name=files -start-insert file<cr>
nnoremap <leader>r :<C-u>Unite -no-split -buffer-name=mru -start-insert file_mru<cr>
nnoremap <leader>o :<C-u>Unite -no-split -buffer-name=outline -start-insert outline<cr>
nnoremap <leader>y :<C-u>Unite -no-split -buffer-name=yank history/yank<cr>
nnoremap <leader>e :<C-u>Unite -no-split -buffer-name=buffer buffer<cr>
map <C-p> :Unite<CR>
" Custom mappings for the unite buffer
autocmd FileType unite call s:unite_settings()
function! s:unite_settings()
" Play nice with supertab
" let b:SuperTabDisabled=1
" Enable navigation with control-j and control-k in insert mode
imap <buffer> <C-j> <Plug>(unite_select_next_line)
imap <buffer> <C-k> <Plug>(unite_select_previous_line)
endfunction
" autocmd FileType javascript nnoremap gd :TernDef<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment