Skip to content

Instantly share code, notes, and snippets.

@mattrasband
Created January 23, 2018 05:56
Show Gist options
  • Save mattrasband/bb67390a591a50428274f0148940beb1 to your computer and use it in GitHub Desktop.
Save mattrasband/bb67390a591a50428274f0148940beb1 to your computer and use it in GitHub Desktop.
dotfiles
-f .git/tags
--recurse=yes
--exclude=.git
--exclude=log
--python-kinds=-iv
--tag-relative
--exclude=node_modules
--languages=-javascript
--langdef=js
--langmap=js:.js
--langmap=js:+.jsx
--regex-js=/[ \t.]([A-Z][A-Z0-9._$]+)[ \t]*[=:][ \t]*([0-9"'\[\{]|null)/\1/n,constant/
--regex-js=/\.([A-Za-z0-9._$]+)[ \t]*=[ \t]*\{/\1/o,object/
--regex-js=/['"]*([A-Za-z0-9_$]+)['"]*[ \t]*:[ \t]*\{/\1/o,object/
--regex-js=/([A-Za-z0-9._$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*\{/\1\.\2/o,object/
--regex-js=/([A-Za-z0-9._$]+)[ \t]*=[ \t]*\(function\(\)/\1/c,class/
--regex-js=/['"]*([A-Za-z0-9_$]+)['"]*:[ \t]*\(function\(\)/\1/c,class/
--regex-js=/class[ \t]+([A-Za-z0-9._$]+)[ \t]*/\1/c,class/
--regex-js=/([A-Za-z$][A-Za-z0-9_$()]+)[ \t]*=[ \t]*[Rr]eact.createClass[ \t]*\(/\1/c,class/
--regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*=[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/
--regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*:[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/
--regex-js=/([A-Za-z$][A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\1/f,function/
--regex-js=/(function)*[ \t]*([A-Za-z$_][A-Za-z0-9_$]+)[ \t]*\([^)]*\)[ \t]*\{/\2/f,function/
--regex-js=/['"]*([A-Za-z$][A-Za-z0-9_$]+)['"]*:[ \t]*function[ \t]*\(/\1/m,method/
--regex-js=/([A-Za-z0-9_$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*function[ \t]*\(/\2/m,method/
set-option -g default-command "reattach-to-user-namespace -l zsh"
set -sg escape-time 0
set -g default-terminal "xterm-256color"
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\ select-pane -l
"""""""""""""""""""""""""""""
" Setup/Prerequisites
"""""""""""""""""""""""""""""
" * use neovim (nvim)
" * setup a virtualenv for each version of python, and install `neovim` in each.
" * recommended at ~/.virtualenvs/neovim{2,3} to work with the default config
" * install vim-plug via https://github.com/junegunn/vim-plug
" * install "the silver searcher"
" * mac: brew install the_silver_searcher
" * install "ctags"
" * mac: brew install ctags
" * install "node"
" * mac: brew install node
" * install "tmux"
" * mac: brew install tmux
"
" Then: nvim +PlugInstall
"""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""
" Plugins & Plugin Config
"""""""""""""""""""""""""""""
call plug#begin('~/.config/nvim/plugged/')
Plug 'airblade/vim-gitgutter'
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm i -g tern' }
Plug 'chemzqm/vim-jsx-improve'
Plug 'christoomey/vim-tmux-navigator'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'edkolev/tmuxline.vim'
Plug 'elmcast/elm-vim'
Plug 'jiangmiao/auto-pairs'
Plug 'luochen1990/rainbow'
let g:rainbow_active=1
Plug 'majutsushi/tagbar'
Plug 'mattn/emmet-vim'
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
Plug 'mileszs/ack.vim'
let g:ackprg='ag --nogroup --nocolor --column'
Plug 'pangloss/vim-javascript'
let g:javascript_plugin_jsdoc=1
Plug 'pbogut/deoplete-elm'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
let g:deoplete#enable_at_startup = 1
let g:deoplete#max_list=15
Plug 'SirVer/ultisnips'
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-markdown'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'vim-airline/vim-airline'
Plug 'vim-syntastic/syntastic'
Plug 'wellle/tmux-complete.vim'
Plug 'yggdroot/indentline'
Plug 'zchee/deoplete-jedi'
let g:deoplete#sources#jedi#show_docstring=1
call plug#end()
"""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""
" Neovim Core config
"""""""""""""""""""""""""""""
let g:python_host_prog = '/Users/matt/.virtualenvs/neovim2/bin/python2'
let g:python3_host_prog = '/Users/matt/.virtualenvs/neovim3/bin/python3'
"""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""
" Userland Config
"""""""""""""""""""""""""""""
" colors!
set background=dark
let g:rehash256=1
set t_Co=256
highlight Comment cterm=italic
highlight htmlArg cterm=italic
highlight CursorLine cterm=none ctermbg=59
" split management
set splitbelow " open windows (including preview) below
set splitright " open vertical splits to the right
set number " show the line number in the left gutter
set relativenumber " but really show offsets from the current...
set colorcolumn=80,100 " 80 chars is best, 100 is max that's reasonable
set cursorline " highlight the line the cursor is on
set showmatch " show matching brackets
" whitespacing
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set autoindent
set smartindent
set smarttab
autocmd Filetype html,javascript,yaml,ruby setlocal ts=2 sw=2 expandtab
autocmd Filetype make setlocal noexpandtab " makefiles require tabs
autocmd BufWritePre * %s/\s\+$//e " trim trailing whitespace on save
set showbreak=↪
set listchars=tab:→\ ,trail:•
" set listchars=tab:→\ ,eol:¬,nbsp:␣,trail:•,extends:⟩,precedes:⟨
set list
set nowrap
set encoding=utf-8
" esc on new macs is hard to use, enable using jk for <esc>
inoremap jk <esc>
" Use `ag` (the silver searcher) for ctrl-p, grep, etc, which
" is blazing fast so caching issues disappear.
" Be sure to install `ag` in the shell (brew install the_silver_searcher)
if executable('ag')
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command='ag %s -l --nocolor -g ""'
let g:ctrlp_use_caching=0
" in normal mode use "K" to search for the word under the cursor
nnoremap K :silent grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
end
" Search tags with ctrl-p
if executable('ctags')
nnoremap <leader>. :CtrlPTag<cr>
if $VIRTUAL_ENV == ""
nnoremap <silent> <leader>t :!ctags .<cr>
else
nnoremap <silent> <leader>t :!ctags -a $VIRTUAL_ENV/lib/* .<cr><cr>
endif
set tags=./.git/tags;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment