Skip to content

Instantly share code, notes, and snippets.

@tuancode
Last active January 8, 2020 21:59
Show Gist options
  • Save tuancode/22c36dc75ae6ac5380cf0434ab8bac01 to your computer and use it in GitHub Desktop.
Save tuancode/22c36dc75ae6ac5380cf0434ab8bac01 to your computer and use it in GitHub Desktop.
dotfiles
# php xdebug
alias php-debug='php -d xdebug.remote_autostart=1'
# Composer applications bin path
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
# Hide computer name in bash
export PS1="\W \$"
# PHPStorm starting path
export PATH="$PATH:/opt/phpstorm/bin"
# set terminal title
function set-title() {
if [[ -z "$ORIG" ]]; then
ORIG=$PS1
fi
TITLE="\[\e]2;$*\a\]"
PS1=${ORIG}${TITLE}
}
# load fzf search
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
export FZF_DEFAULT_OPTS='--height 40% --reverse --border'
# overload system default 256-color palette with precise gruvbox colors
source "$HOME/.vim/plugged/gruvbox/gruvbox_256palette.sh"
[user]
email = tuancode@icloud.com
name = Tuan Vu
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lg-all = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all
lg-date = log --graph --abbrev-commit --decorate --format=format:'%C(red)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(green)(%ar)%C(reset)%C(yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %C(bold blue)<%an>%C(reset)'
lg-date-all = log --graph --abbrev-commit --decorate --format=format:'%C(red)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(green)(%ar)%C(reset)%C(yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %C(bold blue)<%an>%C(reset)' --all
colorscheme:symfony
cs_re:cyan:^\[....-..-.. ..:..:..\]
cs_re:blue:[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}
cs_re:green,,bold:INFO
cs_re:yellow,,bold:(WARN|NOTICE)
cs_re:blue,,bold:DEBUG
cs_re:red,,bold:(ERROR|CRITICAL)
cs_re:green:^.*INFO.*$
cs_re:yellow:.*\.(WARN|NOTICE).*
cs_re:blue:^.*DEBUG.*$
cs_re_s:white,red:.*\.(ERROR|CRITICAL).*
cs_re:red:.*
[mysql]
pager = less -SFX
#========================
# Key map
#------------------------
# C-a: Ctrl + a
# M-a: Alt + a
# -n: No prefix
#========================
# Use Alt-vim keys without prefix key to switch panes
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
# Switch windows alt+number
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
# Enable copy-paste for macos
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe 'reattach-to-user-namespace pbcopy' \; send -X clear-selection
# Reload tmux config
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# Synchronize panes
bind a set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
#========================
# Configuration
#========================
# Set base index value to one (as apposed to zero)
set -g base-index 1
setw -g pane-base-index 1
set-option -g allow-rename off
# Ensure tmux load bash config
set-option -g default-shell "/bin/bash"
# Ensure terminal starts with its own colour scheme (helps Vim/Neovim themes to not break)
set -g default-terminal "screen-256color"
# Use Vi style key bindings to move around copy mode
setw -g mode-keys vi
set-window-option -g mode-keys vi
# Make sure messages (using display-message) are displayed for long enough to read
set-option -g display-time 2000
# Remove delay when pressing esc in Vim
set -sg escape-time 0
# Stop rename tab and window automatically
set-option -g allow-rename off
# Increase scrollback lines
set -g history-limit 30000
# Activity monitoring
setw -g monitor-activity on
set -g visual-activity on
# Mouse mode
set -g mouse on
#========================
# Theme
#========================
set -g @themepack 'powerline/double/yellow'
#========================
# Plugins
#------------------------
# C-b + I to install
# C-b + U to uninstall
#========================
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'jimeh/tmux-themepack'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
filetype plugin indent on
" do not worry about trying to support old school Vi features
set nocompatible
" switch syntax highlighting on, when the terminal has colors
syntax on
" turn on relative line number
set relativenumber
" tab to space and 4 size
set tabstop=4
set shiftwidth=4
set expandtab
" allow backspace to delete end of line, indent and start of line characters
set backspace=indent,eol,start
" margin line right
set colorcolumn=120
" map leader key
let mapleader = ","
" no back up file
set noswapfile
set nobackup
set nowritebackup
" display status bar
set laststatus=2
" clipboard sharing
set clipboard=unnamed,unnamedplus
" highlight the current line
set cursorline
" highlight a matching [{()}] when cursor is placed on start/end character
set showmatch
" highlight tailing whitespace
set list listchars=tab:\ \ ,trail:·
" autoload files that have changed outside of vim
set autoread
" buffer configuration
set hidden
nnoremap <S-h> :bp<CR>
nnoremap <S-l> :bn<CR>
nnoremap <leader>w :bp <BAR> bd #<CR>
nnoremap <Leader>1 :1b<CR>
nnoremap <Leader>2 :2b<CR>
nnoremap <Leader>3 :3b<CR>
nnoremap <Leader>4 :4b<CR>
nnoremap <Leader>5 :5b<CR>
nnoremap <Leader>6 :6b<CR>
nnoremap <Leader>7 :7b<CR>
nnoremap <Leader>8 :8b<CR>
nnoremap <Leader>9 :9b<CR>
nnoremap <Leader>0 :10b<CR>
" Ngb to jump to buffer number N
let c = 1
while c <= 99
execute "nnoremap " . c . "gb :" . c . "b\<CR>"
let c += 1
endwhile
" key-map
imap jj <Esc>
nnoremap <leader>q :q<CR>
nnoremap <leader>s :w<CR>
imap <Char-1> <Char-15>:normal 0<Char-13>
imap <Char-5> <Char-15>:normal $<Char-13>
" provide hjkl movements in Insert mode via the <Ctrl> modifier key
inoremap <C-h> <C-o>h
inoremap <C-j> <C-o>j
inoremap <C-k> <C-o>k
inoremap <C-l> <C-o>l
" vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'morhetz/gruvbox'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'vim-airline/vim-airline'
Plug 'Yggdroot/indentLine'
Plug 'haya14busa/incsearch.vim'
Plug 'francoiscabrol/ranger.vim'
Plug 'airblade/vim-gitgutter'
call plug#end()
" morhetz/gruvbox
if !empty(glob('~/.vim/plugged/gruvbox/'))
colorscheme gruvbox
set background=dark
endif
" vim-airline/vim-airline
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#buffer_nr_show = 1
" Yggdroot/indentLine
let g:indentLine_color_term = 239
let g:indentLine_char = '|'
let g:indentLine_leadingSpaceChar = '-'
let g:indentLine_leadingSpaceEnabled = 1
" junegunn/fzf.vim
nnoremap <leader>r :Files<CR> | " open search file
" haya14busa/incsearch.vim
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" ggreer/the_silver_searcher
nnoremap <leader>h :Ag<CR>
" francoiscabrol/ranger.vim
let g:ranger_map_keys = 0
map <leader>f :Ranger<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment