Initial commit.

This commit is contained in:
2018-09-03 16:30:01 -04:00
commit cb82a724ac
11 changed files with 334 additions and 0 deletions

4
agignore Normal file
View File

@@ -0,0 +1,4 @@
*.class
tmp/
*.o
View

1
config/config Symbolic link
View File

@@ -0,0 +1 @@
/Users/chun/dotfiles/config

3
config/fish/config.fish Normal file
View File

@@ -0,0 +1,3 @@
function fish_greeting
echo "Hello World"
end

View File

@@ -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

1
config/nvim/init.vim Symbolic link
View File

@@ -0,0 +1 @@
../../vimrc

55
gitconfig Normal file
View File

@@ -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\"

10
install.sh Executable file
View File

@@ -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

3
profile Normal file
View File

@@ -0,0 +1,3 @@
[ -n "$PROFILE" ] && return || readonly PROFILE=1
export PATH="$HOME/.cargo/bin:$PATH"

99
tmux.conf Normal file
View File

@@ -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

117
vimrc Normal file
View File

@@ -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 <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
" plugins
nnoremap <leader>a :Ag<space>
nnoremap <leader>b :CtrlPBuffer<CR>
nnoremap <leader>d :NERDTreeToggle<CR>
nnoremap <leader>f :NERDTreeFind<CR>
nnoremap <leader>t :CtrlP<CR>
nnoremap <leader>T :CtrlPClearCache<CR>:CtrlP<CR>
nnoremap <leader>] :TagbarToggle<CR>
nnoremap <leader><space> :call whitespace#strip_trailing()<CR>
nnoremap <leader>g :GitGutterToggle<CR>
noremap <leader><tab> :set list!<CR>
noremap <silent> <leader>V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
" tab creation
:map <C-t> :tabe<CR>
:imap <C-t> <ESC>:tabe<CR>
:vmap <C-t> <ESC>:tabe<CR>
" tabbing
:nmap <tab> >>
:nmap <S-tab> <<
:vmap <tab> >
:vmap <S-tab> <
" 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 = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
" Don't copy the contents of an overwritten selection.
vnoremap p "_dP

10
vimrc.bundles Normal file
View File

@@ -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'