Skip to content

Instantly share code, notes, and snippets.

@JaySon-Huang
Last active January 22, 2025 03:13
Show Gist options
  • Save JaySon-Huang/7f2190878aa2890cf43e11ac8f654b52 to your computer and use it in GitHub Desktop.
Save JaySon-Huang/7f2190878aa2890cf43e11ac8f654b52 to your computer and use it in GitHub Desktop.
My own oh-my-zsh
# vi: ft=dosini
[main]
# Enables context sensitive auto-completion. If this is disabled the all
# possible completions will be listed.
smart_completion = True
# Multi-line mode allows breaking up the sql statements into multiple lines. If
# this is set to True, then the end of the statements must have a semi-colon.
# If this is set to False then sql statements can't be split into multiple
# lines. End of line (return) is considered as the end of the statement.
multi_line = False
# Destructive warning mode will alert you before executing a sql statement
# that may cause harm to the database such as "drop table", "drop database"
# or "shutdown".
destructive_warning = False
# log_file location.
log_file = ~/.mycli.log
# Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO"
# and "DEBUG". "NONE" disables logging.
log_level = INFO
# Log every query and its results to a file. Enable this by uncommenting the
# line below.
# audit_log = ~/.mycli-audit.log
# Timing of sql statements and table rendering.
timing = True
# Beep after long-running queries are completed; 0 to disable.
beep_after_seconds = 0
# Table format. Possible values: ascii, double, github,
# psql, plain, simple, grid, fancy_grid, pipe, orgtbl, rst, mediawiki, html,
# latex, latex_booktabs, textile, moinmoin, jira, vertical, tsv, csv.
# Recommended: ascii
table_format = ascii
# Syntax coloring style. Possible values (many support the "-dark" suffix):
# manni, igor, xcode, vim, autumn, vs, rrt, native, perldoc, borland, tango, emacs,
# friendly, monokai, paraiso, colorful, murphy, bw, pastie, paraiso, trac, default,
# fruity.
# Screenshots at http://mycli.net/syntax
# Can be further modified in [colors]
syntax_style = default
# Keybindings: Possible values: emacs, vi.
# Emacs mode: Ctrl-A is home, Ctrl-E is end. All emacs keybindings are available in the REPL.
# When Vi mode is enabled you can use modal editing features offered by Vi in the REPL.
key_bindings = emacs
# Enabling this option will show the suggestions in a wider menu. Thus more items are suggested.
wider_completion_menu = False
# MySQL prompt
# \D - The full current date
# \d - Database name
# \h - Hostname of the server
# \m - Minutes of the current time
# \n - Newline
# \P - AM/PM
# \p - Port
# \R - The current time, in 24-hour military time (0-23)
# \r - The current time, standard 12-hour time (1-12)
# \s - Seconds of the current time
# \t - Product type (Percona, MySQL, MariaDB, TiDB)
# \A - DSN alias name (from the [alias_dsn] section)
# \u - Username
# \x1b[...m - insert ANSI escape sequence
prompt = '\t \u@\h:\d> '
prompt_continuation = '->'
# Skip intro info on startup and outro info on exit
less_chatty = False
# Use alias from --login-path instead of host name in prompt
login_path_as_host = False
# Cause result sets to be displayed vertically if they are too wide for the current window,
# and using normal tabular format otherwise. (This applies to statements terminated by ; or \G.)
auto_vertical_output = False
# keyword casing preference. Possible values "lower", "upper", "auto"
keyword_casing = auto
# disabled pager on startup
enable_pager = False
# Choose a specific pager
pager = 'less'
# Custom colors for the completion menu, toolbar, etc.
[colors]
completion-menu.completion.current = 'bg:#ffffff #000000'
completion-menu.completion = 'bg:#008888 #ffffff'
completion-menu.meta.completion.current = 'bg:#44aaaa #000000'
completion-menu.meta.completion = 'bg:#448888 #ffffff'
completion-menu.multi-column-meta = 'bg:#aaffff #000000'
scrollbar.arrow = 'bg:#003333'
scrollbar = 'bg:#00aaaa'
selected = '#ffffff bg:#6666aa'
search = '#ffffff bg:#4444aa'
search.current = '#ffffff bg:#44aa44'
bottom-toolbar = 'bg:#222222 #aaaaaa'
bottom-toolbar.off = 'bg:#222222 #888888'
bottom-toolbar.on = 'bg:#222222 #ffffff'
search-toolbar = 'noinherit bold'
search-toolbar.text = 'nobold'
system-toolbar = 'noinherit bold'
arg-toolbar = 'noinherit bold'
arg-toolbar.text = 'nobold'
bottom-toolbar.transaction.valid = 'bg:#222222 #00ff5f bold'
bottom-toolbar.transaction.failed = 'bg:#222222 #ff005f bold'
# style classes for colored table output
output.header = "#00ff5f bold"
output.odd-row = ""
output.even-row = ""
output.null = "#808080"
# SQL syntax highlighting overrides
# sql.comment = 'italic #408080'
# sql.comment.multi-line = ''
# sql.comment.single-line = ''
# sql.comment.optimizer-hint = ''
# sql.escape = 'border:#FF0000'
# sql.keyword = 'bold #008000'
# sql.datatype = 'nobold #B00040'
# sql.literal = ''
# sql.literal.date = ''
# sql.symbol = ''
# sql.quoted-schema-object = ''
# sql.quoted-schema-object.escape = ''
# sql.constant = '#880000'
# sql.function = '#0000FF'
# sql.variable = '#19177C'
# sql.number = '#666666'
# sql.number.binary = ''
# sql.number.float = ''
# sql.number.hex = ''
# sql.number.integer = ''
# sql.operator = '#666666'
# sql.punctuation = ''
# sql.string = '#BA2121'
# sql.string.double-quouted = ''
# sql.string.escape = 'bold #BB6622'
# sql.string.single-quoted = ''
# sql.whitespace = ''
# Favorite queries.
[favorite_queries]
# Use the -d option to reference a DSN.
# Special characters in passwords and other strings can be escaped with URL encoding.
[alias_dsn]
# example_dsn = mysql://[user[:password]@][host][:port][/dbname]
""""" 文件编码
set fileencodings=utf-8,gbk,gb2312
set termencoding=utf-8
set encoding=utf-8
"""""" 缩进相关
set ts=4 " tabstop 设置tab为4个空格
set sw=4 " shiftwidth 每层缩进4个空格
set expandtab " 输入的tab自动展开为空格. 设置后, 输入TAB, 需要Ctrl-V<TAB>
set softtabstop=4
"set smarttab
"set ai!
"set cindent
"set smartindent
set sm " 输入后括号时, 光标跳回对应的前括号显示匹配情况
"""""" 显示相关
set nu " 显示行号
set ru " 显示屏幕右下角行号, 列号信息
set showtabline=2
set ic " 查找时不考虑大小写
set incsearch " 增量搜索
set hlsearch " 搜索时高亮结果
set cursorline " 显示当前行
set showmode " 显示当前操作模式
"Sets how many lines of history VIM har to remember
set history=400
set nocompatible " 不使用旧的VI兼容模式
"set mouse=a " 鼠标可用
"set mouse=v " 关闭鼠标模式
set autoread " 文件被修改时, 重新加载
" 记录上次打开文件时编辑的位置
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
"解决粘贴时的自动缩进带来的自动注释困扰 (和autoindent互斥, 要粘贴代码时手动输入 :set paste)
"set paste
" 设置vim打开文件之后,页脚的状态栏,包括文件编码,文件类型,光标当前列,当前行,以及总行数等信息
set statusline=%2*%n%m%r%h%w%*\ %f\ %1*[FORMAT=%2*%{&ff}:%{&fenc!=''?&fenc:&enc}%1*]\ [Type=%2*%Y%1*]\ [Column=%2*%v%1*]\ [Line=%2*%l%1*/%3*%L(%p%%)%1*]
set laststatus=2
" Auto add head info
" .py file into add header
function! HeaderPython()
call setline(1, "#!/usr/bin/env python")
call append(1, "#encoding=utf-8")
call append(2, "from __future__ import print_function")
call append(3, "import sys")
call append(4, "")
call append(5, "__doc__= ''' '''")
call append(5, "__author__ = ''")
call append(6, "")
normal G
normal o
endf
autocmd bufnewfile *.py call HeaderPython()
ZSH_THEME="jayson"
# Install some plugins
# https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md
# https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md
plugins=(git
z # jump to workspace
python pip
rust
zsh-autosuggestions zsh-syntax-highlighting
vi-mode # ESC+v to edit current commandline
colored-man-pages # colorful man pages
history # hanful alias for history && search
)
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
# some settings
TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S'
unsetopt share_history
DISABLE_AUTO_TITLE="true"
unset MAILCHECK
# some alias
alias tailf='tail -f'
alias byobu='SHELL=/bin/zsh byobu'
alias bbr='byobu -r'
# jayson.zsh-theme
# Based on gnzh theme
setopt prompt_subst
() {
local PR_USER PR_USER_OP PR_PROMPT PR_HOST
# Check the UID
if [[ $UID -ne 0 ]]; then # normal user
PR_USER='%F{green}%n%f'
PR_USER_OP='%F{green}%#%f'
PR_PROMPT='%f> %f'
else # root
PR_USER='%F{red}%n%f'
PR_USER_OP='%F{red}%#%f'
PR_PROMPT='%F{red}> %f'
fi
# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
PR_HOST='%F{red}%M%f' # SSH
else
PR_HOST='%F{green}%M%f' # no SSH
fi
local return_code="%(?..%F{red}%? ↵%f)"
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
local current_dir="%B%F{blue}%d%f%b"
local rvm_ruby=''
if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation
rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f'
elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation
rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f'
elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management
rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f'
fi
local git_branch='$(git_prompt_info)'
PROMPT="${user_host} ${current_dir}${rvm_ruby} ${git_branch}
$PR_PROMPT "
RPROMPT="${return_code}"
eval my_gray='$FG[246]'
RPS1='$my_gray%D{%Y-%m-%d %H:%M:%S}%{$reset_color%}%'
ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}["
ZSH_THEME_GIT_PROMPT_SUFFIX="]%f"
}
cargo install ripgrep
cargo install --locked zellij
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment