commit cb82a724ac8d27e34b35b4db48e9bd87e754261b Author: Chun Li Date: Mon Sep 3 16:30:01 2018 -0400 Initial commit. diff --git a/agignore b/agignore new file mode 100644 index 0000000..b506684 --- /dev/null +++ b/agignore @@ -0,0 +1,4 @@ +*.class +tmp/ +*.o +View diff --git a/config/config b/config/config new file mode 120000 index 0000000..b9b9c47 --- /dev/null +++ b/config/config @@ -0,0 +1 @@ +/Users/chun/dotfiles/config \ No newline at end of file diff --git a/config/fish/config.fish b/config/fish/config.fish new file mode 100644 index 0000000..816ca74 --- /dev/null +++ b/config/fish/config.fish @@ -0,0 +1,3 @@ +function fish_greeting + echo "Hello World" +end diff --git a/config/fish/fishd.6c4008c0f732 b/config/fish/fishd.6c4008c0f732 new file mode 100644 index 0000000..93eb0b8 --- /dev/null +++ b/config/fish/fishd.6c4008c0f732 @@ -0,0 +1,31 @@ +# This file is automatically generated by the fish. +# Do NOT edit it directly, your changes will be overwritten. +SET __fish_init_2_39_8:\x1d +SET __fish_init_2_3_0:\x1d +SET fish_color_autosuggestion:555\x1ebrblack +SET fish_color_cancel:\x2dr +SET fish_color_command:\x2d\x2dbold +SET fish_color_comment:red +SET fish_color_cwd:green +SET fish_color_cwd_root:red +SET fish_color_end:brmagenta +SET fish_color_error:brred +SET fish_color_escape:bryellow\x1e\x2d\x2dbold +SET fish_color_history_current:\x2d\x2dbold +SET fish_color_host:normal +SET fish_color_match:\x2d\x2dbackground\x3dbrblue +SET fish_color_normal:normal +SET fish_color_operator:bryellow +SET fish_color_param:cyan +SET fish_color_quote:yellow +SET fish_color_redirection:brblue +SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack +SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SET fish_color_user:brgreen +SET fish_color_valid_path:\x2d\x2dunderline +SET fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell +SET fish_key_bindings:fish_default_key_bindings +SET fish_pager_color_completion:\x1d +SET fish_pager_color_description:B3A06D\x1eyellow +SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan diff --git a/config/nvim/init.vim b/config/nvim/init.vim new file mode 120000 index 0000000..90f52f0 --- /dev/null +++ b/config/nvim/init.vim @@ -0,0 +1 @@ +../../vimrc \ No newline at end of file diff --git a/gitconfig b/gitconfig new file mode 100644 index 0000000..ed68a4b --- /dev/null +++ b/gitconfig @@ -0,0 +1,55 @@ +[user] + name = Chun Li + email = chunli.developer@gmail.com + +[alias] + hist = log --pretty=oneline --graph --decorate --all --abbrev-commit + diff = --ignore-space-change + pretty = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit + st = status + ci = commit + br = branch -v + co = checkout + df = diff + ds = diff --staged + lg = log -p + lol = log --graph --decorate --pretty=oneline --abbrev-commit + lola = log --graph --decorate --pretty=oneline --abbrev-commit --all --date=local + ls = ls-files + unstage = reset HEAD + out = "!git log origin/master..$(git rev-parse --abbrev-ref HEAD)" + in = "!git log $(git rev-parse --abbrev-ref HEAD)..origin/master" + pull = pull --ff-only + merge = merge --ff-only + + # Show files ignored by git: + ign = ls-files -o -i --exclude-standard + +[color] + branch = auto + diff = auto + interactive = auto + status = auto + +[core] + editor = /usr/bin/vim + precomposeunicode = true + +[merge] + tool = Opendiff +[mergetool] + keepBackup = false + prompt = false +[mergetool "Opendiff"] + cmd = opendiff \"$LOCAL\" \"$REMOTE\" --merge \"$MERGED\" + trustexitcode = true +[diff] + tool = Opendiff +[pull] + ff = only +[push] + default = simple +[difftool] + prompt = false +[difftool "Opendiff"] + cmd = opendiff \"$LOCAL\" \"$REMOTE\" diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..aa1e7d3 --- /dev/null +++ b/install.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +DOTFILES=$(pwd) +ln -si $DOTFILES/vimrc ~/.vimrc +ln -si $DOTFILES/agignore ~/.agignore +ln -si $DOTFILES/gitconfig ~/.gitconfig +ln -si $DOTFILES/profile ~/.profile +ln -si $DOTFILES/vimrc.bundles ~/.vimrc.bundles +ln -si $DOTFILES/tmux.conf ~/.tmux.conf +ln -si $DOTFILES/config ~/.config diff --git a/profile b/profile new file mode 100644 index 0000000..621c2f5 --- /dev/null +++ b/profile @@ -0,0 +1,3 @@ +[ -n "$PROFILE" ] && return || readonly PROFILE=1 + +export PATH="$HOME/.cargo/bin:$PATH" diff --git a/tmux.conf b/tmux.conf new file mode 100644 index 0000000..ea59260 --- /dev/null +++ b/tmux.conf @@ -0,0 +1,99 @@ +# use C-a, since it's on the home row and easier to hit than C-b +set-option -g prefix C-a +unbind-key C-a +bind-key C-a send-prefix +set -g base-index 1 + +# Easy config reload +bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded." + +# vi is good +set-window-option -g mode-keys vi +# set copy hotkeys +bind-key -T copy-mode-vi 'v' send -X begin-selection +bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel + +# mouse behavior +set -g mouse on + +set-option -g default-terminal screen-256color + +bind-key : command-prompt +bind-key r refresh-client +bind-key L clear-history + +bind-key space next-window +bind-key bspace previous-window +bind-key enter next-layout + +# use vim-like keys for splits and windows +bind-key v split-window -h -c "#{pane_current_path}" +bind-key s split-window -v -c "#{pane_current_path}" +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R + +# uncomment below stanza to enable smart pane switching with awareness of vim splits +# bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L" +# bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux select-pane -D" +# bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux select-pane -U" +# bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux select-pane -R" +# bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys 'C-\\') || tmux select-pane -l" +# bind C-l send-keys 'C-l' + +bind-key C-o rotate-window + +bind-key + select-layout main-horizontal +bind-key = select-layout main-vertical +set-window-option -g other-pane-height 25 +set-window-option -g other-pane-width 80 + +bind-key a last-pane +bind-key q display-panes +bind-key c new-window +bind-key t next-window +bind-key T previous-window + +bind-key [ copy-mode +bind-key ] paste-buffer + +set-window-option -g display-panes-time 1500 + +# Status Bar +set-option -g status-interval 1 +set-option -g status-left '' +set-option -g status-right '%l:%M%p' +set-window-option -g window-status-current-fg magenta +set-option -g status-fg default + +# Status Bar solarized-dark (default) +set-option -g status-bg black +set-option -g pane-active-border-fg black +set-option -g pane-border-fg black + +# Status Bar solarized-light +if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g status-bg white" +if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-active-border-fg white" +if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-border-fg white" + +# Set window notifications +setw -g monitor-activity on +set -g visual-activity on + +# Enable native Mac OS X copy/paste +set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace $SHELL -l || exec $SHELL -l'" + +# Allow the arrow key to be used immediately after changing windows +set-option -g repeat-time 0 + +# Fix to allow mousewheel/trackpad scrolling in tmux 2.1 +bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M" +bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M" + +# Disable assume-paste-time, so that iTerm2's "Send Hex Codes" feature works +# with tmux 2.1. This is backwards-compatible with earlier versions of tmux, +# AFAICT. +set-option -g assume-paste-time 0 + +source-file ~/.tmux.conf.local diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..f7b7703 --- /dev/null +++ b/vimrc @@ -0,0 +1,117 @@ +""" vim config +""" Author: Chun Li + + +""" PLUGINS +call plug#begin('~/.local/share/nvim/plugged') +if filereadable(expand("~/.vimrc.bundles")) + source ~/.vimrc.bundles +endif +call plug#end() + +" Plugin settings +let g:ctrlp_match_window = 'order:ttb,max:20' +let g:NERDSpaceDelims=1 +let g:gitgutter_enabled = 0 + +" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher +if executable('ag') + " Use Ag over Grep + set grepprg=ag\ --nogroup\ --nocolor + + " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore + let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' +endif + + +""" SET CONFIGS +" enable syntax highlighting +syntax enable +filetype plugin indent on +set autoindent +set autoread " reload files when changed on disk, i.e. via `git checkout` +set backspace=2 " Fix broken backspace in some setups +set backupcopy=yes " see :help crontab +set cc=100 " color column +set clipboard=unnamed " yank and paste with the system clipboard +set directory-=. " don't store swapfiles in the current directory +set encoding=utf-8 +set expandtab " expand tabs to spaces +set hlsearch " set highlight search +set ignorecase " case-insensitive search +set incsearch " search as you type +set laststatus=2 " always show statusline +set list " show trailing whitespace +set listchars=tab:▸\ ,trail:▫ +set mouse=a " Enable basic mouse behavior such as resizing buffers. +set nocompatible " don't bother with vi compatibility +set number " show line numbers +set ruler " show where you are +set scrolloff=3 " show context above/below cursorline +set shiftwidth=4 " normal mode indentation commands use 4 spaces +set showcmd +set smartcase " case-sensitive search if any caps +set softtabstop=4 " insert mode tab and backspace use 4 spaces +set tabstop=4 " actual tabs occupy 4 characters +set wildignore=log/**,node_modules/**,target/**,tmp/**,*.rbc +set wildmenu " show a navigable menu for tab completion +set wildmode=longest,list,full + + +""" MAPPINGS +" keyboard shortcuts +let mapleader = ',' +" buffer navigation +noremap h +noremap j +noremap k +noremap l +" plugins +nnoremap a :Ag +nnoremap b :CtrlPBuffer +nnoremap d :NERDTreeToggle +nnoremap f :NERDTreeFind +nnoremap t :CtrlP +nnoremap T :CtrlPClearCache:CtrlP +nnoremap ] :TagbarToggle +nnoremap :call whitespace#strip_trailing() +nnoremap g :GitGutterToggle +noremap :set list! +noremap V :source ~/.vimrc:filetype detect:exe ":echo 'vimrc reloaded'" +" tab creation +:map :tabe +:imap :tabe +:vmap :tabe +" tabbing +:nmap >> +:nmap << +:vmap > +:vmap < +" in case you forgot to sudo +cnoremap w!! %!sudo tee > /dev/null % + + +""" FILETYPES +" fdoc is yaml +autocmd BufRead,BufNewFile *.fdoc set filetype=yaml +" md is markdown +autocmd BufRead,BufNewFile *.md set filetype=markdown +autocmd BufRead,BufNewFile *.md set spell + + +""" FIXES +" automatically rebalance windows on vim resize +autocmd VimResized * :wincmd = +if exists('$TMUX') " Support resizing in tmux + set ttymouse=xterm2 +endif +" Fix Cursor in TMUX +if exists('$TMUX') + let &t_SI = "\Ptmux;\\]50;CursorShape=1\x7\\\" + let &t_EI = "\Ptmux;\\]50;CursorShape=0\x7\\\" +else + let &t_SI = "\]50;CursorShape=1\x7" + let &t_EI = "\]50;CursorShape=0\x7" +endif +" Don't copy the contents of an overwritten selection. +vnoremap p "_dP diff --git a/vimrc.bundles b/vimrc.bundles new file mode 100644 index 0000000..5e5557d --- /dev/null +++ b/vimrc.bundles @@ -0,0 +1,10 @@ +Plug 'airblade/vim-gitgutter' +Plug 'ctrlpvim/ctrlp.vim' +Plug 'flazz/vim-colorschemes' +Plug 'majutsushi/tagbar' +Plug 'rking/ag.vim' +Plug 'scrooloose/nerdtree' +Plug 'tpope/vim-sensible' +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-fugitive' +Plug 'vim-airline/vim-airline'