Skip to content

Instantly share code, notes, and snippets.

@LiuJi-Jim
Created March 7, 2018 03:25
Show Gist options
  • Save LiuJi-Jim/35dd1d9faead850dfa00f92fb8001bfc to your computer and use it in GitHub Desktop.
Save LiuJi-Jim/35dd1d9faead850dfa00f92fb8001bfc to your computer and use it in GitHub Desktop.
my terminal profile
# coding PATH
CODING_DIR=$HOME/coding
export PATH=$CODING_DIR/app/bin:$PATH
export PATH=$CODING_DIR/tools/bin:$PATH
# PS1
export PS1="[\u@\H:\[\e[0;34m\]\W\[\e[0;0m\]]\$ "
# git
source $CODING_DIR/tools/git-completion.bash
# shortcuts
alias ll='ls -l'
alias la='ls -a'
# options
export SVN_EDITOR="vim"
export GREP_OPTIONS="--color=auto --exclude-dir=\.svn"
#up and down key cmd partial match binding
bind '"\x1b\x5b\x41":history-search-backward'
bind '"\x1b\x5b\x42":history-search-forward'
shell -$SHELL
#se the startup message
startup_message off
#term xterm
term xterm-256color
#term screen-256color
attrcolor b ".I" # allow bold colors - necessary for some reason
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' # tell screen how to set colors. AB = background, AF=foreground
defbce on # use current bg color for erased chars
##use ` as the Global Key
## escape ``
escape ^Zz
#使用 X 滚动机制
#滚动缓存可以用 C-a [ 来查看。但是这很不方便。要使用滚动条,如 xterm 或 konsole,将下面这行加入 ~/.screenrc:
termcapinfo xterm* ti@:te@
#when using iTerm
#Save lines to scrollback when app status bar is present
#Unlimited scrollback (optional)
##set a biger buffer
defscrollback 1024
#消除残余的编辑文本
#当你在 screen 内打开文本编辑器再关掉它,文本内容仍然会在终端上显示。
altscreen on
#shelltitle ""
shelltitle "$ |bash"
#设置状态栏
hardstatus on
hardstatus alwayslastline
#hardstatus string '%{= kG}[ %{G}%c:%s %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][ %{C}(F1)New (F2)Rename (F3)Monitor (F4)Slience %{g}][%{kB} %d/%m %{w}%c %{g}]'
#hardstatus string '%{= kG}[ %{G}%Y/%m/%d %c:%s %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][ %{G}%H %{g}][ %{C}(F1-F4)Select (F12)Detach %{g}]'
#hardstatus string '%{= kG}[ %{G}%Y/%m/%d %c:%s %{g}][%= %{= kw} %-w%{= bW}%n %t%{-}%+w %= %{g}][ %{G}%H %{g}][ %{C}(F1-F5)Select (F12)Detach %{g}]'
#以前用的这个
#hardstatus string '%{= kG}[ %{G}%Y/%m/%d %c %{g}][%= %{= kw} %-w%{= bW}%n[%t]%{-}%+w %= %{g}][ %{G}%H %{g}][ %{C}(F12)Detach %{g}]'
#稍加简化的
#hardstatus string '%{= kG}[ %{G}%Y/%m/%d %c %{g}][%= %{= kw} %-w%{= bW}%n[%t]%{-}%+w %= %{g}][ %{G}%H %{g}]'
#hardstatus string "%{.bW}%-w%{.rY}%n %t%{-}%+w %=%{..G} %H(%l) %{..Y} %Y/%m/%d %c:%s "
#hardstatus string '%-w%{= BW}%50>%n %t%{-}%+w%<'
hardstatus string '%-w%{= bW}%50>%n %t%{-}%+w%<'
#比较精简的
# hardstatus string '%{= kG}%= %{= kw} %-w%{= bW}%n[%t]%{-}%+w %= %{g}'
##shutdown the noise
vbell off
## w to show the window list
#bind w windowlist -b
#bind ^w windowlist -b
##initial apps to run
# screen
# screen
# screen
# screen
# screen
select 0
#进行快捷键的绑定
#bindkey -k k1 select 0
#bindkey -k k2 select 1
#bindkey -k k3 select 2
#bindkey -k k4 select 3
#bindkey -k k5 select 4
#bindkey -k k5 detach
#bindkey -k k6 split
#bindkey -k k; focus
#bindkey -k k7 focus
#bindkey -k k8 only
#bindkey -k k9 detach
#bindkey -k F1 prev
bindkey -k k1 prev
bindkey -k k2 next
bindkey -k k3 screen
bindkey -k k4 kill
bindkey -k k5 title
#bindkey -k k7 split
#bindkey -k k9 remove
bindkey -k F1 windowlist
bindkey -k F2 detach
register r "^z:source $HOME/.screenrc^M"
bind l windowlist -b
bind r eval 'fit' 'process r'
attrcolor u "-u B"
sessionname liuji
autodetach on
set -g default-terminal "xterm-256color"
set -g prefix C-x
unbind C-b
bind r source-file ~/.tmux.conf \; display "reload"
unbind '"'
unbind %
unbind s
unbind q
bind q killp
bind s split-window -v
bind S split-window -v -l 40
bind v split-window -h
bind V split-window -h -l 120
bind-key k select-pane -U
bind-key j select-pane -D
bind-key h select-pane -L
bind-key l select-pane -R
bind-key C-l select-window -l
setw -g mode-keys vi
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection
bind -n F1 previous-window
bind -n F2 next-window
bind -n F3 new-window
bind -n F4 confirm-before -p "kill-window #W? (y/n)" kill-window
bind -n F12 detach-client
set nu
" GLOBAL SETTINGS
set ignorecase smartcase
set cursorline
" Write contents of the file, if it has been modified, on buffer exit
set autowrite
set autoread
set ffs=unix,dos,mac
" cmd line auto complete
set wildmode=list:longest,full
" Allow backspacing over everything
set backspace=indent,eol,start
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb2312,gbk,gb18030,big5,euc-jp,euc-kr,latin1
set termencoding=utf-8
set nobomb
set wrap
set nowritebackup
set nobackup
set helplang=zh
" Enable incremental search
set incsearch
" Always show status line, even for one window
set laststatus=2
set statusline=%F%*\ %y[%{&fenc}][%{&enc}]\ %2*%r%m%*\ %l,%c\ %=%l/%L\ (%p%%)%*\%{strftime('%Y-%m-%d-%H:%M')}
" Don't highlight results of a search
set hlsearch
" Show line, column number, and relative position within a file in the status line
set ruler
" Scroll when cursor gets within 3 characters of top/bottom edge
set scrolloff=7
" Sound indent to multiple of 'shiftwidth' for > and < commands
set shiftround
" Show (partial) commands (or size of selection in Visual mode) in the status line
set showcmd
" When a bracket is inserted, briefly jump to a matching one
set showmatch
" Jump to matching bracket for 2/10th of a second (works with showmatch)
set matchtime=2
" Use 2 spaces for <Tab> and :retab
" Use 2 spaces for (auto)indent
set tabstop=2
set softtabstop=2
set shiftwidth=2
set autoindent
" Use smart indentation
set smartindent
" Use spaces for all tabs
set expandtab
" Write swap file to disk after every 50 characters
set updatecount=50
" Remember things between sessions
"
" '20 - remember marks for 20 previous files
" \"50 - save 50 lines for each register
" :20 - remember 20 items in command-line history
" % - remember the buffer list (if vim started without a file arg)
" n - set name of viminfo file
set viminfo='20,\"50,:20,%,n~/.viminfo
set expandtab
" MAPPINGS
" save changes
map ,s :w<CR>
" exit vim without saving any changes
map ,w :q<CR>
map ,q :q!<CR>
" use CTRL-F for omni completion
" use <F6> to toggle line numbers
nmap <silent> <F6> :set number!<CR>
" use <F8> to toggle line wrap
nmap <silent> <F8> :set nowrap!<CR>
" Use F10 to toggle 'paste' mode
set pastetoggle=<F10>
" Ctrl+g to open file in new tab, gf to open file in current tab
nmap <C-G> :tabnew %:p:h/<cfile><CR>
nmap gf :e %:p:h/<cfile><CR>
" visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
" set colorscheme
syntax on
set background=dark
"let g:molokai_original = 1
"let g:rehash256 = 1
"colorscheme molokai
"let g:solarized_visibility="high"
"let g:solarized_contrast="high"
"let g:solarized_termcolors=256
let g:solarized_termtrans=1
colorscheme solarized
" colorscheme Tomorrow-Night
set foldmethod=marker
set guifont=YaHei\ Consolas\ Hybrid\ 12
set formatoptions+=tcrqvmMB
nmap <HOME> ^i<ESC>l
imap <HOME> <ESC>^i
nmap << <Esc>:tabprevious<CR>
nmap >> <Esc>:tabnext<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment