Skip to content

Instantly share code, notes, and snippets.

@Linell
Created May 9, 2018 21:00
Show Gist options
  • Save Linell/23058c6e93c907b7a96e68be67507738 to your computer and use it in GitHub Desktop.
Save Linell/23058c6e93c907b7a96e68be67507738 to your computer and use it in GitHub Desktop.
filetype plugin on
filetype plugin indent on
syntax on
filetype indent on
set autoindent
set autoread
set backspace=2
set clipboard=unnamed
set cursorline
set expandtab
set foldmethod=marker
set laststatus=2
set noinsertmode
set number
set printfont=Iosevka:h20
set ruler
set showcmd
set smartindent
set smarttab
set t_Co=256
set tags+=gems.tags
set vb
" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
nnoremap <leader><space> :nohlsearch<CR>
nnoremap <CR> :noh<CR><CR>
" Pathogen
execute pathogen#infect()
execute pathogen#helptags()
" Color columns after 93 chars
set colorcolumn=93
" Make code tabbing more sane
set tabstop=2
set shiftwidth=2
" Persistent undo
set undodir=~/.vim/undodir
set undofile
" Better backups
set backupdir=~/.vim/sessions
set dir=~/.vim/sessions
" Session
set ssop-=options
" NERDTree
let NERDTreeIgnore = ['\.tags$', '^tags$']
let NERDTreeShowBookmarks=1
let NERDTreeChDirMode=2
let NerdTreeMinimalUI=1
noremap <leader>d :NERDTreeToggle<CR>
" TagBar
noremap <leader>g :TagbarOpenAutoClose<CR>
let g:tagbar_usearrows = 1
let g:tagbar_autofocus = 1
let g:TagmaBufMgrLocation = 'R'
let g:TagmaBufMgrWidth = 20
let g:tagbar_compact = 1
let g:tagbar_indent = 2
let g:tagbar_iconchars = ['▸', '▾']
let g:tagbar_type_ruby = {
\ 'kinds' : [
\ 'm:modules',
\ 'c:classes',
\ 'd:describes',
\ 'C:contexts',
\ 'f:methods',
\ 'b:filters',
\ 'p:routes',
\ 'F:singleton methods'
\ ]
\ }
" ctrlp
let g:ctrlp_dont_split = 'nerdtree'
nmap <leader>F :CtrlPClearAllCaches<CR>
nnoremap <C-]> :CtrlPtjump<cr>
nmap , :Ag<space>
" Syntastic
let g:syntastic_enable_balloons = 0
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='→'
let g:syntastic_ignore_files=['\c\.erb$']
let g:syntastic_stl_format='%E{💀 %fe (%e) ⮃}%W{ 💡 %fw (%w) }'
let g:syntastic_ruby_exec='~/.rvm/rubies/ruby-2.1.5/bin/ruby'
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_eslint_exe = 'yarn run lint --'
" GitGutters
let g:gitgutter_sign_column_always = 1
let g:gitgutter_eager = 0
let g:gitgutter_realtime = 0
let g:gitgutter_sign_added = '│'
let g:gitgutter_sign_modified = '│'
let g:gitgutter_sign_modified_removed = '│'
let g:gitgutter_sign_removed = '│'
" Comment Header Line
function! CommentHeader()
let times = 82 - col(".")
let line = getline(".")
let space = " "
exe ":normal A" . space . repeat("-", times)
endfunction
nnoremap <leader>- :call CommentHeader()<CR>o
" Indent Guides
let g:indent_guides_size = 1
" Unite
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
call unite#custom#source('file_rec,file_rec/async,file_mru,file,buffer,grep',
\ 'ignore_pattern', join([
\ '\.git/',
\ '\.bundle/',
\ '\.yardoc/',
\ 'nodejs/*/node_modules/',
\ 'nodejs/',
\ 'git5/.*/review/',
\ 'google/obj/',
\ 'tmp/',
\ 'deprecated/',
\ 'nodejs/node_modules/',
\ 'assets/components/',
\ '.sass-cache',
\ 'node_modules/*'
\ ], '\|'))
let g:unite_source_history_yank_enable = 1
function! s:unite_settings()
nmap <buffer> <ESC> <plug>(unite_exit)
imap <buffer> <ESC> <plug>(unite_exit)
nmap <buffer> <C-r> <Plug>(unite_redraw)
imap <buffer> <C-r> <Plug>(unite_redraw)
endfunction
autocmd FileType unite call s:unite_settings()
nmap <leader>bl :<C-u>Unite -no-split -start-insert -buffer-name=buffer buffer<CR>
nmap <leader>y :<C-u>Unite -direction=botright -prompt-direction=top -winheight=10 -buffer-name=yank history/yank<CR>
nmap <leader>h :Unite -start-insert -winheight=10 -buffer-name=help help<CR>
nmap ; :<C-u>Unite -direction=botright -prompt-direction=top -winheight=10 -start-insert -buffer-name=files file_rec/async<CR>
" Fast saving
nnoremap <leader>w :w<CR>
inoremap <c-w> <esc>:w<CR>i
" Speedy terminal
set ttyfast
set notimeout
set ttimeout
set ttimeoutlen=100
syntax sync minlines=256
set synmaxcol=500
" Make some stuff look cool
let g:javascript_conceal = 0
" syntax keyword Statement lambda conceal cchar=λ
" hi! link Conceal Statement
set conceallevel=2
" Better text folding
set fillchars=fold:\∙
function! NeatFoldText()
let line = ' ' . substitute(getline(v:foldstart), '^\s*\("\|#\|//\|/\)\?\s*\|\s*\("\|#\)\?\s*{{' . '{\d*\s*', '', 'g') . ' '
let lines_count = v:foldend - v:foldstart + 1
let lines_count_text = '│ ' . printf("%10s", lines_count . ' lines') . ' │'
let foldchar = matchstr(&fillchars, 'fold:\zs.')
let foldtextstart = strpart('∙' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3)
let foldtextend = lines_count_text . repeat(foldchar, 8)
let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn
return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend
endfunction
set foldtext=NeatFoldText()
" Easy Align
vnoremap <silent> <Enter> :EasyAlign<Enter>
function! g:UltiSnips_Complete()
call UltiSnips#ExpandSnippet()
if g:ulti_expand_res == 0
if pumvisible()
return "\<C-n>"
else
call UltiSnips#JumpForwards()
if g:ulti_jump_forwards_res == 0
return "\<TAB>"
endif
endif
endif
return ""
endfunction
au BufEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
" Gist-VIM
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
let g:gist_show_privates = 1
let g:gist_post_privates = 1
" CoffeeScript Junk
hi link coffeeSpaceError NONE
hi link coffeeSemicolonError NONE
" JBuilder Syntax Highlighting
au BufNewFile,BufRead *.json.jbuilder set ft=ruby
au BufNewFile,BufRead *.jbuilder set ft=ruby
" Remove Trailing Whitespace
autocmd FileType c,ruby,coffee,css,slim,scss,html,xml autocmd BufWritePre <buffer> :%s/\s\+$//e
" Colorscheme
set background=dark
colorscheme base16-dphase
" My Macros
nnoremap <leader>lb i Linell Bonnette ([email protected])
nnoremap <silent><leader>T :e /Users/linell/Documents/TODO.md<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment