Skip to content

Instantly share code, notes, and snippets.

@carlosrocha
Last active July 8, 2017 01:11
Show Gist options
  • Select an option

  • Save carlosrocha/1475431 to your computer and use it in GitHub Desktop.

Select an option

Save carlosrocha/1475431 to your computer and use it in GitHub Desktop.
My vimrc file
unbind C-b
set -g prefix C-a
set -g default-terminal "screen-256color"
set -g default-command "reattach-to-user-namespace -l $SHELL"
set-window-option -g mode-keys vi
# Setup 'v' to begin selection as in Vim
#bind-key -t vi-copy v begin-selection
#bind-key -t vi-copy y copy-pipe "pbcopy"
set -g set-titles on
set -g set-titles-string "#T"
set -g bell-action any
set -g mouse on
set -s escape-time 0
source-file ~/.tmux/themes/lightline.conf
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
run '~/.tmux/plugins/tpm/tpm'
nnoremap <silent> <leader>p :Files<CR>
nnoremap <silent> <leader>o :Buffers<CR>
nnoremap <silent> <leader>A :Windows<CR>
nnoremap <silent> <leader>; :BLines<CR>
nnoremap <silent> <leader>. :Lines<CR>
nnoremap <silent> <leader>O :Tags<CR>
nnoremap <silent> <leader>C :Colors<CR>
nnoremap <silent> <leader>? :History<CR>
" Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <c-x><c-l> <plug>(fzf-complete-line)
nnoremap <silent> <leader>k :call SearchWordWithAg()<CR>
vnoremap <silent> <leader>k :call SearchVisualSelectionWithAg()<CR>
function! SearchWordWithAg()
execute 'Ag' expand('<cword>')
endfunction
function! SearchVisualSelectionWithAg() range
let old_reg = getreg('"')
let old_regtype = getregtype('"')
let old_clipboard = &clipboard
set clipboard&
normal! ""gvy
let selection = getreg('"')
call setreg('"', old_reg, old_regtype)
let &clipboard = old_clipboard
execute 'Ag' selection
endfunction
autocmd VimEnter * command! -bang -nargs=* Ag
\ call fzf#vim#ag(<q-args>,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
let g:mapleader = ' '
call plug#begin('~/.local/share/nvim/plugged')
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-tbone'
Plug 'flazz/vim-colorschemes'
Plug 'edkolev/tmuxline.vim'
Plug 'kshenoy/vim-signature'
Plug 'sbdchd/neoformat'
augroup fmt
autocmd!
autocmd BufWritePre * Neoformat
augroup END
let g:neoformat_reason_refmt = {
\ 'exe': 'refmt',
\ 'args': ['--parse re'],
\ 'stdin': 1,
\ }
let g:neoformat_enabled_reason = ['refmt']
Plug 'junegunn/limelight.vim'
Plug 'junegunn/goyo.vim'
function! s:goyo_enter()
silent !tmux set status off
silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z
set noshowmode
set noshowcmd
set scrolloff=999
Limelight
endfunction
function! s:goyo_leave()
silent !tmux set status on
silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
set showmode
set showcmd
set scrolloff=5
Limelight!
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
nmap <silent> gl :Goyo<CR>
Plug 'itchyny/lightline.vim'
source ~/.config/nvim/lightlineconf.vim
autocmd FileType javascript setlocal formatprg=prettier\ --stdin\ --parser\ flow\ --single-quote\ --trailing-comma\ es5
" Use formatprg when available
let g:neoformat_try_formatprg = 1
Plug 'gavocanov/vim-js-indent'
Plug 'pangloss/vim-javascript'
let g:javascript_plugin_flow = 1
Plug 'flowtype/vim-flow'
let g:flow#enable = 0
au FileType javascript nnoremap <c-]> :FlowJumpToDef<cr>
Plug '~/Development/vim/vim-flow-plus'
au FileType javascript nnoremap <silent> <m-o> :FlowCoverageToggle<cr>
au FileType javascript nnoremap <silent> <m-[> :FlowPrevRef<cr>
au FileType javascript nnoremap <silent> <m-]> :FlowNextRef<cr>
au FileType javascript nnoremap <silent> <m-i> :FlowTypeAtPos<cr>
au FileType javascript nnoremap <silent> <m-l> :FlowGetDef<cr>
Plug 'mxw/vim-jsx'
let g:jsx_ext_required = 0
Plug 'steelsojka/deoplete-flow'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
let g:deoplete#enable_at_startup = 1
let g:deoplete#omni_patterns = {}
let g:deoplete#omni_patterns.reason = '[^. *\t]\.\w*'
let g:deoplete#omni_patterns.ocaml = '\.'
Plug 'vim-syntastic/syntastic'
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_enable_highlighting = 0
let g:syntastic_mode_map = {
\ "mode": "passive",
\ "active_filetypes": ['reason', 'ocaml'],
\ "passive_filetypes": [],
\ }
let g:syntastic_javascript_checkers = [ 'eslint', 'flow' ]
Plug 'neomake/neomake'
autocmd! BufWritePost * Neomake
let g:neomake_javascript_enabled_makers = ['eslint', 'flow']
let g:neomake_jsx_enabled_makers = ['eslint', 'flow']
Plug 'airblade/vim-gitgutter'
let g:gitgutter_sign_column_always = 1
Plug 'SirVer/ultisnips'
let g:UltiSnipsExpandTrigger = '<tab>'
" OCaml
let g:opamshare = substitute(system('opam config var share'), '\n$', '', '''')
Plug g:opamshare . '/ocp-indent/vim'
Plug 'rgrinberg/vim-ocaml'
Plug 'def-lkb/ocp-indent-vim'
let g:merlin_split_method = 'never'
au FileType ocaml nnoremap <silent> <c-]> :MerlinLocate<cr>
Plug 'reasonml/vim-reason-loader'
au FileType reason map <buffer> <leader>m :ReasonPrettyPrint<cr>
au FileType reason map <buffer> <m-M> :ReasonPrettyPrint<Cr>
au FileType reason setl colorcolumn=90
Plug 'MartinLafreniere/vim-PairTools'
au FileType reason let g:pairtools_reason_pairclamp = 1
au FileType reason let g:pairtools_reason_tagwrench = 0
au FileType reason let g:pairtools_reason_jigsaw = 1
au FileType reason let g:pairtools_reason_autoclose = 1
au FileType reason let g:pairtools_reason_forcepairs = 0
au FileType reason let g:pairtools_reason_closepairs = "(:),[:],{:}" . ',":"'
au FileType reason let g:pairtools_reason_smartclose = 1
au FileType reason let g:pairtools_reason_smartcloserules = '\w,(,&,\*'
au FileType reason let g:pairtools_reason_antimagic = 1
au FileType reason let g:pairtools_reason_antimagicfield = "Comment,String,Special"
au FileType reason let g:pairtools_reason_pcexpander = 1
au FileType reason let g:pairtools_reason_pceraser = 1
au FileType reason let g:pairtools_reason_tagwrenchhook = 'tagwrench#BuiltinNoHook'
au FileType reason let g:pairtools_reason_twexpander = 0
au FileType reason let g:pairtools_reason_tweraser = 0
au FileType reason let g:pairtools_reason_apostrophe = 0
au FileType ocaml let g:pairtools_ocaml_pairclamp = 1
au FileType ocaml let g:pairtools_ocaml_tagwrench = 0
au FileType ocaml let g:pairtools_ocaml_jigsaw = 1
au FileType ocaml let g:pairtools_ocaml_autoclose = 1
au FileType ocaml let g:pairtools_ocaml_forcepairs = 0
au FileType ocaml let g:pairtools_ocaml_closepairs = "(:),[:],{:},':'" . ',":"'
au FileType ocaml let g:pairtools_ocaml_smartclose = 1
au FileType ocaml let g:pairtools_ocaml_smartcloserules = '\w,(,&,\*'
au FileType ocaml let g:pairtools_ocaml_antimagic = 1
au FileType ocaml let g:pairtools_ocaml_antimagicfield = "Comment,String,Special"
au FileType ocaml let g:pairtools_ocaml_pcexpander = 1
au FileType ocaml let g:pairtools_ocaml_pceraser = 1
au FileType ocaml let g:pairtools_ocaml_tagwrenchhook = 'tagwrench#BuiltinNoHook'
au FileType ocaml let g:pairtools_ocaml_twexpander = 0
au FileType ocaml let g:pairtools_ocaml_tweraser = 0
au FileType ocaml let g:pairtools_ocaml_apostrophe = 0
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
source ~/.config/nvim/fzfconf.vim
call plug#end()
nnoremap <silent> <leader>q :bd<CR>
au FileType javascript nnoremap <leader>e :w !node<CR>
set mouse=a
set scrolloff=5
set shell=/usr/local/bin/zsh
set relativenumber
set number
set hidden
set colorcolumn=80
set visualbell
set nowrap
set smartcase
set incsearch
set laststatus=2
set ruler
set showcmd
set wildmenu
set list
set listchars=tab:•·,trail:·,extends:❯,precedes:❮,nbsp:×
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set shiftround
set wildignore+=node_modules
set display+=lastline
set background=dark
colorscheme seoul256
highlight clear SignColumn
let g:lightline = {
\ 'colorscheme': 'seoul256',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitgutter', 'filename' ] ],
\ 'right': [ [ 'percent', 'lineinfo' ],
\ [ 'syntastic', 'flow' ],
\ [ 'fileformat', 'fileencoding', 'filetype' ] ],
\ },
\ 'component_function': {
\ 'modified': 'LightlineModified',
\ 'readonly': 'LightlineReadonly',
\ 'flow': 'LightlineFlowCoverage',
\ 'gitgutter': 'LightlineGitGutter',
\ 'filename': 'LightlineFilename',
\ 'fileformat': 'LightlineFileformat',
\ 'filetype': 'LightlineFiletype',
\ 'fileencoding': 'LightlineFileencoding',
\ 'mode': 'LightlineMode',
\ 'syntastic': 'SyntasticStatuslineFlag',
\ },
\ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
\ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" },
\ }
function! LightlineModified()
return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! LightlineReadonly()
return &ft !~? 'help' && &readonly ? "\ue0a2" : ''
endfunction
function! LightlineFilename()
let ro = LightlineReadonly()
let modified = LightlineModified()
let filename = expand('%')
return (ro != '' ? ro . ' ' : '') .
\ (filename != '' ? filename : '[No Name]') .
\ (modified != '' ? ' ' . modified : '')
endfunction
function! LightlineFlowCoverage()
if exists('b:flow_coverage_status')
return b:flow_coverage_status
endif
return ''
endfunction
function! LightlineGitGutter()
if !exists('*GitGutterGetHunkSummary')
\ || !get(g:, 'gitgutter_enabled', 0)
\ || winwidth(0) <= 90
return ''
endif
let symbols = [ '+', '~', '-' ]
let hunks = GitGutterGetHunkSummary()
let ret = []
for i in range(0, 2)
if hunks[i] > 0
call add(ret, symbols[i] . hunks[i])
endif
endfor
return join(ret, ' ')
endfunction
function! LightlineFileformat()
if &fileformat == 'unix'
return ''
endif
return winwidth(0) > 90 ? &fileformat : ''
endfunction
function! LightlineFiletype()
if &filetype == 'javascript.jsx'
return ''
endif
return winwidth(0) > 90 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
endfunction
function! LightlineFileencoding()
if &fenc == 'utf-8'
return ''
endif
return winwidth(0) > 90 ? (&fenc !=# '' ? &fenc : &enc) : ''
endfunction
function! LightlineMode()
return winwidth(0) > 60 ? lightline#mode() : ''
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment