Compare commits
10 commits
7d2785a280
...
add7e7c756
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
add7e7c756 | ||
|
|
ec8b89eee1 | ||
|
|
893d5e96cf | ||
|
|
73b2f6bf60 | ||
|
|
b2800e3156 | ||
|
|
b72add27c2 | ||
|
|
7c7fab4c95 | ||
|
|
55b0d31604 | ||
|
|
a33f99e765 | ||
|
|
090766cab0 |
1743 changed files with 129717 additions and 2454 deletions
|
|
@ -1,9 +0,0 @@
|
||||||
[user]
|
|
||||||
emal = vbarzin@gmail.com
|
|
||||||
name = viktorbarzin
|
|
||||||
email = vbarzin@gmail.com
|
|
||||||
signingkey = 6AF253F1C94B5F00750FBBD40EB088298288D958
|
|
||||||
[push]
|
|
||||||
default = tracking
|
|
||||||
[branch]
|
|
||||||
autosetuprebase = always
|
|
||||||
360
.tmux.conf.local
360
.tmux.conf.local
|
|
@ -1,360 +0,0 @@
|
||||||
# https://github.com/gpakosz/.tmux
|
|
||||||
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
|
|
||||||
# without any warranty.
|
|
||||||
# Copyright 2012— Gregory Pakosz (@gpakosz).
|
|
||||||
|
|
||||||
|
|
||||||
# -- navigation ----------------------------------------------------------------
|
|
||||||
|
|
||||||
# if you're running tmux within iTerm2
|
|
||||||
# - and tmux is 1.9 or 1.9a
|
|
||||||
# - and iTerm2 is configured to let option key act as +Esc
|
|
||||||
# - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys
|
|
||||||
# then uncomment the following line to make Meta + arrow keys mapping work
|
|
||||||
#set -ga terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D"
|
|
||||||
|
|
||||||
|
|
||||||
# -- windows & pane creation ---------------------------------------------------
|
|
||||||
|
|
||||||
# new window retains current path, possible values are:
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
tmux_conf_new_window_retain_current_path=false
|
|
||||||
|
|
||||||
# new pane retains current path, possible values are:
|
|
||||||
# - true (default)
|
|
||||||
# - false
|
|
||||||
tmux_conf_new_pane_retain_current_path=true
|
|
||||||
|
|
||||||
# new pane tries to reconnect ssh sessions (experimental), possible values are:
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
tmux_conf_new_pane_reconnect_ssh=false
|
|
||||||
|
|
||||||
# prompt for session name when creating a new session, possible values are:
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
tmux_conf_new_session_prompt=false
|
|
||||||
|
|
||||||
|
|
||||||
# -- display -------------------------------------------------------------------
|
|
||||||
|
|
||||||
# RGB 24-bit colour support (tmux >= 2.2), possible values are:
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
tmux_conf_theme_24b_colour=false
|
|
||||||
|
|
||||||
# window style
|
|
||||||
tmux_conf_theme_window_fg='default'
|
|
||||||
tmux_conf_theme_window_bg='default'
|
|
||||||
|
|
||||||
# highlight focused pane (tmux >= 2.1), possible values are:
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
tmux_conf_theme_highlight_focused_pane=false
|
|
||||||
|
|
||||||
# focused pane colours:
|
|
||||||
tmux_conf_theme_focused_pane_fg='default'
|
|
||||||
tmux_conf_theme_focused_pane_bg='#0087d7' # light blue
|
|
||||||
|
|
||||||
# pane border style, possible values are:
|
|
||||||
# - thin (default)
|
|
||||||
# - fat
|
|
||||||
tmux_conf_theme_pane_border_style=thin
|
|
||||||
|
|
||||||
# pane borders colours:
|
|
||||||
tmux_conf_theme_pane_border='#444444' # gray
|
|
||||||
tmux_conf_theme_pane_active_border='#00afff' # light blue
|
|
||||||
|
|
||||||
# pane indicator colours
|
|
||||||
tmux_conf_theme_pane_indicator='#00afff' # light blue
|
|
||||||
tmux_conf_theme_pane_active_indicator='#00afff' # light blue
|
|
||||||
|
|
||||||
# status line style
|
|
||||||
tmux_conf_theme_message_fg='#000000' # black
|
|
||||||
tmux_conf_theme_message_bg='#ffff00' # yellow
|
|
||||||
tmux_conf_theme_message_attr='bold'
|
|
||||||
|
|
||||||
# status line command style (<prefix> : Escape)
|
|
||||||
tmux_conf_theme_message_command_fg='#ffff00' # yellow
|
|
||||||
tmux_conf_theme_message_command_bg='#000000' # black
|
|
||||||
tmux_conf_theme_message_command_attr='bold'
|
|
||||||
|
|
||||||
# window modes style
|
|
||||||
tmux_conf_theme_mode_fg='#000000' # black
|
|
||||||
tmux_conf_theme_mode_bg='#ffff00' # yellow
|
|
||||||
tmux_conf_theme_mode_attr='bold'
|
|
||||||
|
|
||||||
# status line style
|
|
||||||
tmux_conf_theme_status_fg='#8a8a8a' # light gray
|
|
||||||
tmux_conf_theme_status_bg='#080808' # dark gray
|
|
||||||
tmux_conf_theme_status_attr='none'
|
|
||||||
|
|
||||||
# terminal title
|
|
||||||
# - built-in variables are:
|
|
||||||
# - #{circled_window_index}
|
|
||||||
# - #{circled_session_name}
|
|
||||||
# - #{hostname}
|
|
||||||
# - #{hostname_ssh}
|
|
||||||
# - #{username}
|
|
||||||
# - #{username_ssh}
|
|
||||||
tmux_conf_theme_terminal_title='#h ❐ #S ● #I #W'
|
|
||||||
|
|
||||||
# window status style
|
|
||||||
# - built-in variables are:
|
|
||||||
# - #{circled_window_index}
|
|
||||||
# - #{circled_session_name}
|
|
||||||
# - #{hostname}
|
|
||||||
# - #{hostname_ssh}
|
|
||||||
# - #{username}
|
|
||||||
# - #{username_ssh}
|
|
||||||
tmux_conf_theme_window_status_fg='#8a8a8a' # light gray
|
|
||||||
tmux_conf_theme_window_status_bg='#080808' # dark gray
|
|
||||||
tmux_conf_theme_window_status_attr='none'
|
|
||||||
tmux_conf_theme_window_status_format='#I #W'
|
|
||||||
#tmux_conf_theme_window_status_format='#{circled_window_index} #W'
|
|
||||||
#tmux_conf_theme_window_status_format='#I #W#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}'
|
|
||||||
|
|
||||||
# window current status style
|
|
||||||
# - built-in variables are:
|
|
||||||
# - #{circled_window_index}
|
|
||||||
# - #{circled_session_name}
|
|
||||||
# - #{hostname}
|
|
||||||
# - #{hostname_ssh}
|
|
||||||
# - #{username}
|
|
||||||
# - #{username_ssh}
|
|
||||||
tmux_conf_theme_window_status_current_fg='#000000' # black
|
|
||||||
tmux_conf_theme_window_status_current_bg='#00afff' # light blue
|
|
||||||
tmux_conf_theme_window_status_current_attr='bold'
|
|
||||||
tmux_conf_theme_window_status_current_format='#I #W'
|
|
||||||
#tmux_conf_theme_window_status_current_format='#{circled_window_index} #W'
|
|
||||||
#tmux_conf_theme_window_status_current_format='#I #W#{?window_zoomed_flag,🔍,}'
|
|
||||||
|
|
||||||
# window activity status style
|
|
||||||
tmux_conf_theme_window_status_activity_fg='default'
|
|
||||||
tmux_conf_theme_window_status_activity_bg='default'
|
|
||||||
tmux_conf_theme_window_status_activity_attr='underscore'
|
|
||||||
|
|
||||||
# window bell status style
|
|
||||||
tmux_conf_theme_window_status_bell_fg='#ffff00' # yellow
|
|
||||||
tmux_conf_theme_window_status_bell_bg='default'
|
|
||||||
tmux_conf_theme_window_status_bell_attr='blink,bold'
|
|
||||||
|
|
||||||
# window last status style
|
|
||||||
tmux_conf_theme_window_status_last_fg='#00afff' # light blue
|
|
||||||
tmux_conf_theme_window_status_last_bg='default'
|
|
||||||
tmux_conf_theme_window_status_last_attr='none'
|
|
||||||
|
|
||||||
# status left/right sections separators
|
|
||||||
# tmux_conf_theme_left_separator_main=''
|
|
||||||
# tmux_conf_theme_left_separator_sub='|'
|
|
||||||
# tmux_conf_theme_right_separator_main=''
|
|
||||||
# tmux_conf_theme_right_separator_sub='|'
|
|
||||||
tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline
|
|
||||||
tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with
|
|
||||||
tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone
|
|
||||||
tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md
|
|
||||||
|
|
||||||
# status left/right content:
|
|
||||||
# - separate main sections with '|'
|
|
||||||
# - separate subsections with ','
|
|
||||||
# - built-in variables are:
|
|
||||||
# - #{battery_bar}
|
|
||||||
# - #{battery_hbar}
|
|
||||||
# - #{battery_percentage}
|
|
||||||
# - #{battery_status}
|
|
||||||
# - #{battery_vbar}
|
|
||||||
# - #{circled_session_name}
|
|
||||||
# - #{hostname_ssh}
|
|
||||||
# - #{hostname}
|
|
||||||
# - #{loadavg}
|
|
||||||
# - #{pairing}
|
|
||||||
# - #{prefix}
|
|
||||||
# - #{root}
|
|
||||||
# - #{synchronized}
|
|
||||||
# - #{uptime_y}
|
|
||||||
# - #{uptime_d} (modulo 365 when #{uptime_y} is used)
|
|
||||||
# - #{uptime_h}
|
|
||||||
# - #{uptime_m}
|
|
||||||
# - #{uptime_s}
|
|
||||||
# - #{username}
|
|
||||||
# - #{username_ssh}
|
|
||||||
|
|
||||||
# CPU info
|
|
||||||
# CPU: #{cpu_icon} #{cpu_percentage} RAM: #{ram_icon} #{ram_percentage} ,
|
|
||||||
|
|
||||||
# #(curl wttr.in/Southampton?format=3) , # - for weather
|
|
||||||
cpu_percentage_format="%3.1f%%" # printf format to use to display percentage
|
|
||||||
tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} '
|
|
||||||
#tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '
|
|
||||||
tmux_conf_theme_status_right=" IP:#(ip route get 8.8.8.8 | head -1 | cut -d' ' -f7) , \
|
|
||||||
DNS:#(echo $(cat /etc/resolv.conf | grep 'nameserver [0-9]' | awk '{print $2}')) , \
|
|
||||||
Gateway:#(echo $(route -n | sed -n '3p' | awk '{print $2}')) #{prefix}#{pairing} #[fg=green]#($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --colors --powerline-right --interval 2) , #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname}"
|
|
||||||
|
|
||||||
|
|
||||||
# status left style
|
|
||||||
tmux_conf_theme_status_left_fg='#000000,#e4e4e4,#e4e4e4' # black, white , white
|
|
||||||
tmux_conf_theme_status_left_bg='#ffff00,#ff00af,#00afff' # yellow, pink, white blue
|
|
||||||
tmux_conf_theme_status_left_attr='bold,none,none'
|
|
||||||
|
|
||||||
# status right style
|
|
||||||
tmux_conf_theme_status_right_fg='#8a8a8a,#e4e4e4,#000000' # light gray, white, black
|
|
||||||
tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4' # dark gray, red, white
|
|
||||||
tmux_conf_theme_status_right_attr='none,none,bold'
|
|
||||||
|
|
||||||
# pairing indicator
|
|
||||||
tmux_conf_theme_pairing='👓 ' # U+1F453
|
|
||||||
tmux_conf_theme_pairing_fg='none'
|
|
||||||
tmux_conf_theme_pairing_bg='none'
|
|
||||||
tmux_conf_theme_pairing_attr='none'
|
|
||||||
|
|
||||||
# prefix indicator
|
|
||||||
tmux_conf_theme_prefix='⌨ ' # U+2328
|
|
||||||
tmux_conf_theme_prefix_fg='none'
|
|
||||||
tmux_conf_theme_prefix_bg='none'
|
|
||||||
tmux_conf_theme_prefix_attr='none'
|
|
||||||
|
|
||||||
# root indicator
|
|
||||||
tmux_conf_theme_root='!'
|
|
||||||
tmux_conf_theme_root_fg='none'
|
|
||||||
tmux_conf_theme_root_bg='none'
|
|
||||||
tmux_conf_theme_root_attr='bold,blink'
|
|
||||||
|
|
||||||
# synchronized indicator
|
|
||||||
tmux_conf_theme_synchronized='🔒' # U+1F512
|
|
||||||
tmux_conf_theme_synchronized_fg='none'
|
|
||||||
tmux_conf_theme_synchronized_bg='none'
|
|
||||||
tmux_conf_theme_synchronized_attr='none'
|
|
||||||
|
|
||||||
# battery bar symbols
|
|
||||||
# tmux_conf_battery_bar_symbol_full='◼'
|
|
||||||
# tmux_conf_battery_bar_symbol_empty='◻'
|
|
||||||
tmux_conf_battery_bar_symbol_full='♥'
|
|
||||||
tmux_conf_battery_bar_symbol_empty='·'
|
|
||||||
|
|
||||||
# battery bar length (in number of symbols), possible values are:
|
|
||||||
# - auto
|
|
||||||
# - a number, e.g. 5
|
|
||||||
tmux_conf_battery_bar_length='auto'
|
|
||||||
|
|
||||||
# battery bar palette, possible values are:
|
|
||||||
# - gradient (default)
|
|
||||||
# - heat
|
|
||||||
# - 'colour_full_fg,colour_empty_fg,colour_bg'
|
|
||||||
tmux_conf_battery_bar_palette='gradient'
|
|
||||||
#tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000' # red, white, black
|
|
||||||
|
|
||||||
# battery hbar palette, possible values are:
|
|
||||||
# - gradient (default)
|
|
||||||
# - heat
|
|
||||||
# - 'colour_low,colour_half,colour_full'
|
|
||||||
tmux_conf_battery_hbar_palette='gradient'
|
|
||||||
#tmux_conf_battery_hbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green
|
|
||||||
|
|
||||||
# battery vbar palette, possible values are:
|
|
||||||
# - gradient (default)
|
|
||||||
# - heat
|
|
||||||
# - 'colour_low,colour_half,colour_full'
|
|
||||||
tmux_conf_battery_vbar_palette='gradient'
|
|
||||||
#tmux_conf_battery_vbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green
|
|
||||||
|
|
||||||
# symbols used to indicate whether battery is charging or discharging
|
|
||||||
# tmux_conf_battery_status_charging='↑' # U+2191
|
|
||||||
# tmux_conf_battery_status_discharging='↓' # U+2193
|
|
||||||
# tmux_conf_battery_status_charging='⚡ ' # U+26A1
|
|
||||||
tmux_conf_battery_status_charging='🔌 ' # U+1F50C # if you can't see this, fonts are not working
|
|
||||||
tmux_conf_battery_status_discharging='🔋 ' # U+1F50B
|
|
||||||
|
|
||||||
# clock style (when you hit <prefix> + t)
|
|
||||||
# you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right
|
|
||||||
tmux_conf_theme_clock_colour='#00afff' # light blue
|
|
||||||
tmux_conf_theme_clock_style='24'
|
|
||||||
|
|
||||||
|
|
||||||
# -- clipboard -----------------------------------------------------------------
|
|
||||||
|
|
||||||
# in copy mode, copying selection also copies to the OS clipboard
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
# on macOS, this requires installing reattach-to-user-namespace, see README.md
|
|
||||||
# on Linux, this requires xsel or xclip
|
|
||||||
tmux_conf_copy_to_os_clipboard=false
|
|
||||||
|
|
||||||
|
|
||||||
# -- user customizations -------------------------------------------------------
|
|
||||||
# this is the place to override or undo settings
|
|
||||||
|
|
||||||
# increase history size
|
|
||||||
#set -g history-limit 10000
|
|
||||||
|
|
||||||
# start with mouse mode enabled
|
|
||||||
#set -g mouse on
|
|
||||||
|
|
||||||
# force Vi mode
|
|
||||||
# really you should export VISUAL or EDITOR environment variable, see manual
|
|
||||||
set -g status-keys vi
|
|
||||||
set -g mode-keys vi
|
|
||||||
|
|
||||||
# replace C-b by C-a instead of using both prefixes
|
|
||||||
set -gu prefix2
|
|
||||||
unbind C-a
|
|
||||||
# unbind C-b
|
|
||||||
# set -g prefix C-a
|
|
||||||
# bind C-a send-prefix
|
|
||||||
set -g prefix M-x
|
|
||||||
bind M-x send-prefix
|
|
||||||
|
|
||||||
# move status line to top
|
|
||||||
#set -g status-position top
|
|
||||||
|
|
||||||
bind \\ split-window -h -c "#{pane_current_path}" # Split panes horizontal
|
|
||||||
bind - split-window -v -c "#{pane_current_path}" # Split panes vertical
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# Use Alt-arrow keys without prefix key to switch panes
|
|
||||||
bind -n M-Left select-pane -L
|
|
||||||
bind -n M-Right select-pane -R
|
|
||||||
bind -n M-Up select-pane -U
|
|
||||||
bind -n M-Down select-pane -D
|
|
||||||
set -g mouse on
|
|
||||||
# to enable mouse scroll, see https://github.com/tmux/tmux/issues/145#issuecomment-150736967
|
|
||||||
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
|
|
||||||
bind j resize-pane -D 5
|
|
||||||
bind k resize-pane -U 5
|
|
||||||
bind l resize-pane -R 5
|
|
||||||
bind h resize-pane -L 5
|
|
||||||
|
|
||||||
# Copy to system clipboard using xlip
|
|
||||||
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
|
||||||
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
|
||||||
|
|
||||||
bind-key s set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
|
|
||||||
|
|
||||||
set-option -g default-shell /bin/zsh
|
|
||||||
|
|
||||||
set-window-option -g aggressive-resize
|
|
||||||
|
|
||||||
# Putting this in .tmux.conf.local does not work :/ 3.0a
|
|
||||||
# Custom added - MUST be in the end
|
|
||||||
# List of plugins
|
|
||||||
set -g @plugin 'tmux-plugins/tpm'
|
|
||||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
|
||||||
|
|
||||||
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|
||||||
set -g @resurrect-processes 'vi vim nvim man less more tail top htop'
|
|
||||||
|
|
||||||
set -g @plugin 'tmux-plugins/tmux-continuum'
|
|
||||||
|
|
||||||
#set -g @continuum-restore 'on'
|
|
||||||
set -g @continuum-restore 'off'
|
|
||||||
|
|
||||||
set -g @plugin 'thewtex/tmux-mem-cpu-load'
|
|
||||||
|
|
||||||
set -g default-command "${SHELL}"
|
|
||||||
|
|
||||||
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
|
||||||
run -b '~/.tmux/plugins/tpm/tpm'
|
|
||||||
486
.vimrc
486
.vimrc
|
|
@ -1,486 +0,0 @@
|
||||||
" Source vimrc on vim startup
|
|
||||||
" autocmd! VimEnter * source ~/.vimrc
|
|
||||||
|
|
||||||
" Load rename plugin
|
|
||||||
" so ~/.vim/Rename.vim
|
|
||||||
|
|
||||||
" let g:EclimCompletionMethod = 'omnifunc'
|
|
||||||
" Java Autocomplete
|
|
||||||
" let g:acp_behaviorJavaEclimLength=3
|
|
||||||
" function MeetsForJavaEclim(context)
|
|
||||||
" return g:acp_behaviorJavaEclimLength >= 0 &&
|
|
||||||
" \ a:context =~ '\k\.\k\{' . g:acp_behaviorJavaEclimLength . ',}$'
|
|
||||||
" endfunction
|
|
||||||
" let g:acp_behavior = {
|
|
||||||
" \ 'java': [{
|
|
||||||
" \ 'command': "\<c-x>\<c-u>",
|
|
||||||
" \ 'completefunc' : 'eclim#java#complete#CodeComplete',
|
|
||||||
" \ 'meets' : 'MeetsForJavaEclim',
|
|
||||||
" \ }]
|
|
||||||
" \ }
|
|
||||||
|
|
||||||
" Rezise splits
|
|
||||||
"nnoremap <C-Left> :vertical resize -20<CR>
|
|
||||||
|
|
||||||
|
|
||||||
" Autoindent html
|
|
||||||
" autocmd BufWritePre *.html :normal gg=G
|
|
||||||
|
|
||||||
" Remove spaces at end of lines
|
|
||||||
autocmd BufWritePre * %s/\s\+$//e
|
|
||||||
|
|
||||||
" Fold all with leader + f
|
|
||||||
nnoremap <Leader>f :call ToggleFold()<CR>
|
|
||||||
|
|
||||||
" Set relative line number and number to see current line number
|
|
||||||
" set rnu
|
|
||||||
set number
|
|
||||||
" Show commands as being written
|
|
||||||
set showcmd
|
|
||||||
|
|
||||||
" Set syntastic settings
|
|
||||||
set statusline+=%#warningmsg#
|
|
||||||
if exists("SyntasticStatuslineFlag")
|
|
||||||
set statusline+=%{SyntasticStatuslineFlag()}
|
|
||||||
endif
|
|
||||||
set statusline+=%*
|
|
||||||
|
|
||||||
" Disables syntastic popup window with messages
|
|
||||||
" Set both to 1 to turn it on
|
|
||||||
let g:syntastic_always_populate_loc_list = 1
|
|
||||||
let g:syntastic_auto_loc_list = 1
|
|
||||||
let g:syntastic_check_on_open = 1
|
|
||||||
let g:syntastic_check_on_wq = 0
|
|
||||||
" 3 errors is more than enough
|
|
||||||
let g:syntastic_loc_list_height=3
|
|
||||||
nnoremap <F10> :SyntasticCheck mypy<CR>
|
|
||||||
" Set xptemplate trigger key to tab
|
|
||||||
" let g:xptemplate_key = '<Tab>'
|
|
||||||
|
|
||||||
" Autocomplete with Tab
|
|
||||||
" inoremap <Tab> <C-x><Space><CR>
|
|
||||||
"inoremap <Caps> <space><space><space><space>
|
|
||||||
|
|
||||||
|
|
||||||
" Rebind <Leader> key
|
|
||||||
" I like to have it here becuase it is easier to reach than the default and
|
|
||||||
" it is next to ``m`` and ``n`` which I use for navigating between tabs.
|
|
||||||
let mapleader = ","
|
|
||||||
|
|
||||||
" Swap lines
|
|
||||||
nnoremap <Leader>k :-1,-1m+0<CR>k
|
|
||||||
nnoremap <Leader>j :+0,+0m+1<CR>
|
|
||||||
vnoremap <Leader>k :m '<-2<CR>gv=gv
|
|
||||||
vnoremap <Leader>j :m '>+1<CR>gv=gv
|
|
||||||
|
|
||||||
" Enable folding with spacebar
|
|
||||||
nnoremap <space> za
|
|
||||||
|
|
||||||
" Make surrounding with various characters easier
|
|
||||||
nmap <Leader>' ysiW'
|
|
||||||
nmap <Leader>" ysiW"
|
|
||||||
nmap <Leader>0 ysiW)
|
|
||||||
|
|
||||||
" Go to normal mode by tapping jk or kj
|
|
||||||
inoremap kj <Esc>
|
|
||||||
inoremap jk <Esc>
|
|
||||||
|
|
||||||
" Easier buffer closing
|
|
||||||
nnoremap <Leader>q :bd<CR>
|
|
||||||
|
|
||||||
" Close splits instead of buffers
|
|
||||||
" nnoremap <Leader>q :<C-w>q<CR>
|
|
||||||
|
|
||||||
" Swap to previous buffer
|
|
||||||
nnoremap <Leader><Tab> :b#<CR>
|
|
||||||
|
|
||||||
" Map backspace to delete
|
|
||||||
nnoremap <BS> h<DEL>
|
|
||||||
vnoremap <BS> d
|
|
||||||
|
|
||||||
" Save with <Leader>s in normal and insert mode
|
|
||||||
noremap <silent> <Leader>s :update<CR>
|
|
||||||
inoremap <silent> <Leader>s <ESC>:update<CR>
|
|
||||||
" Sudo save with <Leader>S
|
|
||||||
noremap <silent> <Leader>S :w !sudo tee % > /dev/null<CR>
|
|
||||||
" map sort function to a key
|
|
||||||
vnoremap <Leader>s :sort<CR>
|
|
||||||
|
|
||||||
" Writes to all buffers when switching to another buffer
|
|
||||||
set autowrite
|
|
||||||
|
|
||||||
" Enable tabs plugin
|
|
||||||
let g:airline#extensions#tabline#enabled = 1
|
|
||||||
let g:airline#extensions#tabline#left_sep = ' '
|
|
||||||
let g:airline#extensions#tabline#left_alt_sep = '|'
|
|
||||||
" let g:airline_left_sep='>'
|
|
||||||
" let g:airline_right_sep='<'
|
|
||||||
" let g:airline_detect_modified=1
|
|
||||||
let g:airline_powerline_fonts=1
|
|
||||||
" let g:airline_section_b = '%{strftime("%c")}'
|
|
||||||
" let g:airline_section_y = 'BN: %{bufnr("%")} FT: %y'
|
|
||||||
let g:airline#extensions#ale#enabled = 1
|
|
||||||
|
|
||||||
" Enable wildmenu which is an enhanced command completion
|
|
||||||
"
|
|
||||||
set wildmenu
|
|
||||||
" Better copy & paste
|
|
||||||
" When you want to paste large blocks of code into vim, press F2 before you
|
|
||||||
" paste. At the bottom you should see ``-- INSERT (paste) --``.
|
|
||||||
|
|
||||||
set pastetoggle=<F2>
|
|
||||||
set clipboard=unnamed
|
|
||||||
|
|
||||||
" Mouse and backspace
|
|
||||||
set mouse=a " on OSX press ALT and click
|
|
||||||
set bs=2 " make backspace behave like normal again
|
|
||||||
|
|
||||||
" Remember the cursor last position
|
|
||||||
if has("autocmd")
|
|
||||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Set VIMHOME
|
|
||||||
if has('win32') || has ('win64')
|
|
||||||
let $VIMHOME = $VIM."/vimfiles"
|
|
||||||
else
|
|
||||||
let $VIMHOME = $HOME."/.vim"
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Bind nohl
|
|
||||||
" Removes highlight of your last search
|
|
||||||
" ``<C>`` stands for ``CTRL`` and therefore ``<C-n>`` stands for ``CTRL+n``
|
|
||||||
noremap <F3> :nohl<CR>
|
|
||||||
vnoremap <F3> :nohl<CR>
|
|
||||||
"inoremap <C-n> :nohl<CR>
|
|
||||||
noremap <F5> :syntax sync fromstart<CR>
|
|
||||||
vnoremap <F5> :syntax sync fromstart<CR>
|
|
||||||
|
|
||||||
" Tab switching
|
|
||||||
noremap<C-tab> :b#
|
|
||||||
vnoremap <C-tab> :b#
|
|
||||||
"inoremap <C-n> :b#
|
|
||||||
|
|
||||||
" Quicksave command
|
|
||||||
" noremap <C-Z> :update<CR>
|
|
||||||
" vnoremap <C-Z> <C-C>:update<CR>
|
|
||||||
" inoremap <C-Z> <C-O>:update<CR>
|
|
||||||
|
|
||||||
" bind Ctrl+<movement> keys to move around the windows, instead of using
|
|
||||||
" Ctrl+w + <movement>
|
|
||||||
" Every unnecessary keystroke that can be saved is good for your health :)
|
|
||||||
"nmap <c-j> :wincmd j
|
|
||||||
map <c-j> <c-w>j
|
|
||||||
map <c-k> <c-w>k
|
|
||||||
map <c-l> <c-w>l
|
|
||||||
map <c-h> <c-w>h
|
|
||||||
|
|
||||||
" easier moving between tabs
|
|
||||||
map <Leader>m <esc>;bn<CR>
|
|
||||||
map <Leader>n <esc>;bp<CR>
|
|
||||||
|
|
||||||
" Create empty buffer and open it
|
|
||||||
map <Leader>t <esc>:enew<CR>
|
|
||||||
|
|
||||||
" easier moving of code blocks
|
|
||||||
" Try to go into visual mode (v), thenselect several lines of code here and
|
|
||||||
" then press `>` several times.
|
|
||||||
vnoremap < <gv " better indentation
|
|
||||||
vnoremap > >gv " better indentation
|
|
||||||
|
|
||||||
" Show whitespace
|
|
||||||
" MUST be inserted BEFORE the colorscheme command
|
|
||||||
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
|
|
||||||
au InsertLeave * match ExtraWhitespace /\s\+$/
|
|
||||||
|
|
||||||
" Color scheme
|
|
||||||
" mkdir -p ~/.vim/colors && cd ~/.vim/colors
|
|
||||||
" wget -O wombat256mod.vim
|
|
||||||
" http://www.vim.org/scripts/download_script.php?src_id=13400
|
|
||||||
set t_Co=256
|
|
||||||
color wombat256mod
|
|
||||||
" color ronakg
|
|
||||||
" color mayansmoke
|
|
||||||
" color github
|
|
||||||
|
|
||||||
" Spelling
|
|
||||||
" set spell
|
|
||||||
" set complete+=kpspell
|
|
||||||
|
|
||||||
" Enable syntax highlighting
|
|
||||||
" You need to reload this file for the change to apply
|
|
||||||
filetype off
|
|
||||||
filetype plugin indent on
|
|
||||||
syntax on
|
|
||||||
|
|
||||||
" In visual mode searches for the selected word
|
|
||||||
vnoremap // y/<C-R>"<CR>
|
|
||||||
|
|
||||||
" Showing line numbers and length
|
|
||||||
set tw=0 " width of document (used by gd)
|
|
||||||
" set tw=120 " width of document (used by gd)
|
|
||||||
set nowrap " don't automatically wrap on load
|
|
||||||
set fo-=t " don't automatically wrap text when typing
|
|
||||||
" set colorcolumn=80
|
|
||||||
set colorcolumn=0
|
|
||||||
" highlight ColorColumn ctermbg=233
|
|
||||||
highlight ColorColumn ctermbg=001
|
|
||||||
|
|
||||||
|
|
||||||
" Useful settings
|
|
||||||
set history=700
|
|
||||||
set undolevels=700
|
|
||||||
|
|
||||||
" Real programmers don't use TABs but spaces
|
|
||||||
set tabstop=4
|
|
||||||
set softtabstop=4
|
|
||||||
set shiftwidth=4
|
|
||||||
set shiftround
|
|
||||||
set expandtab
|
|
||||||
|
|
||||||
" Make search case insensitive
|
|
||||||
set hlsearch
|
|
||||||
set incsearch
|
|
||||||
set ignorecase
|
|
||||||
set smartcase
|
|
||||||
|
|
||||||
" Disable stupid backup and swap files - they trigger too many events
|
|
||||||
" for file system watchers
|
|
||||||
"set nobackup
|
|
||||||
"set nowritebackup
|
|
||||||
"set noswapfile
|
|
||||||
|
|
||||||
" Backup files are great so lets keep them in 1 place
|
|
||||||
" Make sure you have ~/vimtmp/ folder. In the future will
|
|
||||||
" move /vimtmp/ in $VIMHOME
|
|
||||||
set backupdir=~/.vim/tmp//,.
|
|
||||||
set directory=~/.vim/tmp//,.
|
|
||||||
set dir=~/.vim/tmp//,.
|
|
||||||
set undodir=~/.vim/tmp/undo//
|
|
||||||
|
|
||||||
" Setup Pathogen to manage your plugins
|
|
||||||
" mkdir -p ~/.vim/autoload ~/.vim/bundle
|
|
||||||
" curl -so ~/.vim/autoload/pathogen.vim
|
|
||||||
" https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim
|
|
||||||
" Now you can install any plugin into a .vim/bundle/plugin-name/ folder
|
|
||||||
|
|
||||||
" Pathogen does not work in combatability mode so disable
|
|
||||||
set nocp
|
|
||||||
" let g:pathogen_disabled = ["syntastic"]
|
|
||||||
call pathogen#infect()
|
|
||||||
|
|
||||||
|
|
||||||
" Settings for vim-powerline
|
|
||||||
" cd ~/.vim/bundle
|
|
||||||
" git clone git://github.com/Lokaltog/vim-powerline.git
|
|
||||||
set laststatus=2
|
|
||||||
|
|
||||||
" Settings for ctrlp
|
|
||||||
" cd ~/.vim/bundle
|
|
||||||
" git clone https://github.com/kien/ctrlp.vim.git
|
|
||||||
let g:ctrlp_max_height = 30
|
|
||||||
let g:ctrlp_working_path_mode = 'ar'
|
|
||||||
set wildignore+=*.pyc
|
|
||||||
set wildignore+=*_build/*
|
|
||||||
set wildignore+=*/coverage/*
|
|
||||||
|
|
||||||
" Settings for python-mode
|
|
||||||
" Note: I'm no longer using this. Leave this commented out
|
|
||||||
" and uncomment the part about jedi-vim instead
|
|
||||||
" cd ~/.vim/bundle
|
|
||||||
" git clone https://github.com/klen/python-mode
|
|
||||||
"" map <Leader>g :call RopeGotoDefinition()<CR>
|
|
||||||
"" let ropevim_enable_shortcuts = 1
|
|
||||||
"" let g:pymode_rope_goto_def_newwin = "vnew"
|
|
||||||
" let g:pymode_rope_extended_complete = 1
|
|
||||||
"" let g:pymode_breakpoint = 0
|
|
||||||
"" let g:pymode_syntax = 1
|
|
||||||
"" let g:pymode_syntax_builtin_objs = 0
|
|
||||||
"" let g:pymode_syntax_builtin_funcs = 0
|
|
||||||
"" map <Leader>b Oimport ipdb; ipdb.set_trace() # BREAKPOINT<C-c>
|
|
||||||
" let g:SuperTabDefaultCompletionType = "<c-p>"
|
|
||||||
" Settings for jedi-vim
|
|
||||||
" cd ~/.vim/bundle
|
|
||||||
" git clone git://github.com/davidhalter/jedi-vim.git
|
|
||||||
" let g:jedi#usages_command = "<leader>z"
|
|
||||||
" let g:jedi#popup_on_dot = 1
|
|
||||||
" let g:jedi#popup_select_first = 0
|
|
||||||
" let g:jedi#force_py_version = 3
|
|
||||||
" let g:jedi#completions_command = '.'
|
|
||||||
" let g:jedi#show_call_signatures = 1
|
|
||||||
" map <Leader>b Oimport ipdb; ipdb.set_trace() # BREAKPOINT<C-c>
|
|
||||||
|
|
||||||
" Map C-a to select entire file
|
|
||||||
"nnoremap <C-a> ggVG
|
|
||||||
|
|
||||||
" Real vimmers dont use those
|
|
||||||
noremap <Up> <NOP>
|
|
||||||
noremap <Down> <NOP>
|
|
||||||
noremap <Left> <NOP>
|
|
||||||
noremap <Right> <NOP>
|
|
||||||
|
|
||||||
" Do splits with Leader-\ and Leader--
|
|
||||||
" nnoremap <silent> <C-Right> :vsp<CR>
|
|
||||||
" nnoremap <silent> <C-Up> :sp<CR>
|
|
||||||
noremap <leader>\ :vsp<CR>
|
|
||||||
noremap <leader>- :sp<CR>
|
|
||||||
|
|
||||||
" NERDTree settings
|
|
||||||
" Open NERDTree by default
|
|
||||||
"autocmd VimEnter * NERDTree
|
|
||||||
"autocmd VimEnter * wincmd p
|
|
||||||
" Toggle NEDRTree plugin
|
|
||||||
noremap <C-b> :NERDTreeToggle<CR>
|
|
||||||
let NERDTreeIgnore = ['\.pyc$', '__pycache__', '.mypy_cache', '.pytest_cache']
|
|
||||||
let NERDTreeShowHidden=1
|
|
||||||
|
|
||||||
" Better navigating through omnicomplete option list
|
|
||||||
" See
|
|
||||||
"http://stackoverflow.com/questions/2170023/how-to-map-keys-for-popup-menu-in-vim
|
|
||||||
set completeopt=longest,menuone
|
|
||||||
function! OmniPopup(action)
|
|
||||||
if pumvisible()
|
|
||||||
if a:action == 'j'
|
|
||||||
return "\<C-N>"
|
|
||||||
elseif a:action == 'k'
|
|
||||||
return "\<C-P>"
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
return a:action
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Python folding
|
|
||||||
" mkdir -p ~/.vim/ftplugin
|
|
||||||
" wget -O ~/.vim/ftplugin/python_editing.vim
|
|
||||||
"http://www.vim.org/scripts/download_script.php?src_id=5492
|
|
||||||
set foldenable
|
|
||||||
|
|
||||||
" Keep undo history even after closing file
|
|
||||||
set undofile
|
|
||||||
|
|
||||||
" Setups template files (more on this - https://shapeshed.com/vim-templates/)
|
|
||||||
if has("autocmd")
|
|
||||||
augroup templates
|
|
||||||
autocmd BufNewFile *.py 0r ~/.vim/templates/skeleton.py
|
|
||||||
autocmd BufNewFile *.sh 0r ~/.vim/templates/skeleton.sh
|
|
||||||
augroup END
|
|
||||||
endif
|
|
||||||
|
|
||||||
" comment out highlighted lines according to file type
|
|
||||||
" put a line like the following in your ~/.vim/filetype.vim file
|
|
||||||
" and remember to turn on filetype detection: filetype on
|
|
||||||
" au! BufRead,BufNewFile *.sh,*.tcl,*.php,*.pl let Comment="#"
|
|
||||||
" if the comment character for a given filetype happens to be @
|
|
||||||
" then use let Comment="\@" to avoid problems...
|
|
||||||
" function! CommentLines()
|
|
||||||
" "let Comment="#" " shell, tcl, php, perl
|
|
||||||
" exe ":s@^@".g:Comment."@g"
|
|
||||||
" exe ":s@$@".g:EndComment."@g"
|
|
||||||
" endfunction
|
|
||||||
" " map visual mode keycombo 'co' to this function
|
|
||||||
" vmap co :call CommentLines()<CR>
|
|
||||||
|
|
||||||
" Encryption algo (vim -x file)
|
|
||||||
set cm=blowfish2
|
|
||||||
|
|
||||||
" Improve perfomance with long lines
|
|
||||||
set synmaxcol=200
|
|
||||||
|
|
||||||
set autoread
|
|
||||||
|
|
||||||
" Autosave
|
|
||||||
" augroup autoSaveAndRead
|
|
||||||
" autocmd!
|
|
||||||
" autocmd TextChanged,InsertLeave,FocusLost * silent! wall
|
|
||||||
" autocmd CursorHold * silent! checktime
|
|
||||||
" augroup END
|
|
||||||
|
|
||||||
" Lion alignment operator config (see https://github.com/tommcdo/vim-lion)
|
|
||||||
let b:lion_squeeze_spaces = 1
|
|
||||||
|
|
||||||
set showmatch
|
|
||||||
set matchtime=3
|
|
||||||
|
|
||||||
" Fold functions in bash
|
|
||||||
let g:sh_fold_enabled=3
|
|
||||||
|
|
||||||
" Recompute syntax highlighting
|
|
||||||
nnoremap <silent> <F4> :syntax sync fromstart<CR>
|
|
||||||
|
|
||||||
autocmd FileType markdown syntax sync fromstart
|
|
||||||
|
|
||||||
set cursorline
|
|
||||||
" Minimal number of lines before scrolling
|
|
||||||
set scrolloff=3
|
|
||||||
set sidescrolloff=3
|
|
||||||
|
|
||||||
" Easier line joining
|
|
||||||
if v:version > 703 || v:version == 703 && has('patch541')
|
|
||||||
set formatoptions+=j
|
|
||||||
endif
|
|
||||||
|
|
||||||
set relativenumber
|
|
||||||
|
|
||||||
" nnoremap <leader>Q :qa<CR>
|
|
||||||
|
|
||||||
" Remap ; to be : - save 1 key press :P
|
|
||||||
nnoremap ; :
|
|
||||||
nnoremap : ;
|
|
||||||
|
|
||||||
" Gundo docs https://sjl.bitbucket.io/gundo.vim/
|
|
||||||
let g:gundo_prefer_python3 = 1
|
|
||||||
nnoremap <F6> :GundoToggle<CR>
|
|
||||||
|
|
||||||
" Auto encrypt files related to courseworks at uni
|
|
||||||
augroup encrypted
|
|
||||||
autocmd BufNewFile */soton/*/coursework* :X
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
" SEttings for Go
|
|
||||||
let g:neocomplete#enable_at_startup = 1 " DO NOT MOVE in another file
|
|
||||||
let g:xptemplate_key = '<Space><Space>'
|
|
||||||
|
|
||||||
" Put these lines at the very end of your vimrc file.
|
|
||||||
|
|
||||||
" Load all plugins now.
|
|
||||||
" Plugins need to be added to runtimepath before helptags can be generated.
|
|
||||||
packloadall
|
|
||||||
" Load all of the helptags now, after plugins have been loaded.
|
|
||||||
" All messages and errors will be ignored.
|
|
||||||
silent! helptags ALL
|
|
||||||
|
|
||||||
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
|
|
||||||
|
|
||||||
au BufNewFile,BufRead,BufReadPost *.thrift set syntax=thrift
|
|
||||||
|
|
||||||
" Autosave sessions
|
|
||||||
fu! SaveSess()
|
|
||||||
execute 'mksession! ' . '~/.vim/tmp/sessions/' . substitute(getcwd(), "/", '!', "g"). '.session.vim'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
fu! RestoreSess()
|
|
||||||
let l:name = expand('~/.vim/tmp/sessions/') . substitute(getcwd(), "/", '!', "g") . '.session.vim'
|
|
||||||
if filereadable(l:name)
|
|
||||||
execute 'so ' . l:name
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
autocmd VimLeave,BufWritePost * call SaveSess()
|
|
||||||
" autocmd VimEnter * nested call RestoreSess()
|
|
||||||
nnoremap <leader>r :call RestoreSess()<CR>
|
|
||||||
|
|
||||||
set updatetime=100
|
|
||||||
|
|
||||||
" highlight GitGutterDelete guifg=#990000 ctermfg=1
|
|
||||||
" highlight GitGutterAdd guifg=#009900 ctermfg=2
|
|
||||||
" highlight GitGutterChange guifg=#997c00 ctermfg=3
|
|
||||||
|
|
||||||
" Move up and down in autocomplete with <c-j> and <c-k>
|
|
||||||
" inoremap <expr> <c-j> ("\<C-n>")
|
|
||||||
" inoremap <expr> <c-k> ("\<C-p>")
|
|
||||||
" inoremap <expr> <TAB> pumvisible() ? '<C-n>' : <TAB> " pumvisible is slow
|
|
||||||
" inoremap <expr> k pumvisible() ? '<C-p>' : 'k'
|
|
||||||
"
|
|
||||||
" inoremap <expr> <TAB> '<C-n>'
|
|
||||||
" inoremap <expr> <S-TAB> '<C-p>'
|
|
||||||
" let g:pymode=0
|
|
||||||
File diff suppressed because it is too large
Load diff
17
.zshenv
17
.zshenv
|
|
@ -1,17 +0,0 @@
|
||||||
# export PYENV_ROOT="$HOME/.pyenv"
|
|
||||||
# export PATH="$PYENV_ROOT/bin:$PATH"
|
|
||||||
# eval "$(pyenv init -)"
|
|
||||||
|
|
||||||
#export PATH="/home/viktor/.pyenv/bin:$PATH"
|
|
||||||
#eval "$(pyenv init -)"
|
|
||||||
#eval "$(pyenv virtualenv-init -)"
|
|
||||||
|
|
||||||
|
|
||||||
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
|
|
||||||
export VIRTUALENV_PYTHON=python3
|
|
||||||
export WORKON_HOME=$HOME/.virtualenvs
|
|
||||||
# export VIRTUALENV_PYTHON=python
|
|
||||||
|
|
||||||
if [ -f $HOME/.virtualenvwrapper.sh ]; then
|
|
||||||
source $HOME/.virtualenvwrapper.sh
|
|
||||||
fi
|
|
||||||
175
.zshrc
175
.zshrc
|
|
@ -1,175 +0,0 @@
|
||||||
zmodload zsh/zprof
|
|
||||||
#[[ $TERM != "screen" ]] && exec tmux
|
|
||||||
# If you come from bash you might have to change your $PATH.
|
|
||||||
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
|
||||||
|
|
||||||
# Path to your oh-my-zsh installation.
|
|
||||||
export ZSH=~/.oh-my-zsh
|
|
||||||
# unset LD_PRELOAD
|
|
||||||
|
|
||||||
# Set name of the theme to load. Optionally, if you set this to "random"
|
|
||||||
# it'll load a random theme each time that oh-my-zsh is loaded.
|
|
||||||
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
|
|
||||||
ZSH_THEME="bira"
|
|
||||||
# ZSH_THEME="adben"
|
|
||||||
|
|
||||||
# Uncomment the following line to use case-sensitive completion.
|
|
||||||
# CASE_SENSITIVE="true"
|
|
||||||
#
|
|
||||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
|
||||||
|
|
||||||
HISTSIZE=9000
|
|
||||||
HISTFILESIZE=9000
|
|
||||||
#HISTFILE="~/.bash_history"
|
|
||||||
|
|
||||||
# Uncomment the following line to use hyphen-insensitive completion. Case
|
|
||||||
# sensitive completion must be off. _ and - will be interchangeable.
|
|
||||||
HYPHEN_INSENSITIVE="true"
|
|
||||||
|
|
||||||
# Uncomment the following line to disable bi-weekly auto-update checks.
|
|
||||||
DISABLE_AUTO_UPDATE="true"
|
|
||||||
|
|
||||||
# Uncomment the following line to change how often to auto-update (in days).
|
|
||||||
# export UPDATE_ZSH_DAYS=13
|
|
||||||
|
|
||||||
# Uncomment the following line to disable colors in ls.
|
|
||||||
# DISABLE_LS_COLORS="true"
|
|
||||||
|
|
||||||
# Uncomment the following line to disable auto-setting terminal title.
|
|
||||||
# DISABLE_AUTO_TITLE="true"
|
|
||||||
|
|
||||||
# Uncomment the following line to enable command auto-correction.
|
|
||||||
# ENABLE_CORRECTION="true"
|
|
||||||
|
|
||||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
|
||||||
COMPLETION_WAITING_DOTS="true"
|
|
||||||
|
|
||||||
# Uncomment the following line if you want to disable marking untracked files
|
|
||||||
# under VCS as dirty. This makes repository status check for large repositories
|
|
||||||
# much, much faster.
|
|
||||||
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
|
||||||
|
|
||||||
# Uncomment the following line if you want to change the command execution time
|
|
||||||
# stamp shown in the history command output.
|
|
||||||
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
|
||||||
HIST_STAMPS="dd.mm.yyyy"
|
|
||||||
|
|
||||||
# Would you like to use another custom folder than $ZSH/custom?
|
|
||||||
# ZSH_CUSTOM=/path/to/new-custom-folder
|
|
||||||
|
|
||||||
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
|
||||||
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
|
||||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
|
||||||
# Add wisely, as too many plugins slow down shell startup.
|
|
||||||
plugins=(encode64 gitignore zsh-z)
|
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
|
||||||
# Update PROMPT to include current time
|
|
||||||
local time='%{$terminfo[bold]$fg[red]%}%*%{$reset_color%}'
|
|
||||||
PROMPT="╭─${user_host}${time}${current_dir}${rvm_ruby}${git_branch}${venv_prompt}
|
|
||||||
╰─%B${user_symbol}%b "
|
|
||||||
# tmux source-file /home/viktor/.tmux.conf
|
|
||||||
|
|
||||||
# User configuration
|
|
||||||
|
|
||||||
# export MANPATH="/usr/local/man:$MANPATH"
|
|
||||||
|
|
||||||
# You may need to manually set your language environment
|
|
||||||
# export LANG=en_US.UTF-8
|
|
||||||
|
|
||||||
# Preferred editor for local and remote sessions
|
|
||||||
if [[ -n $SSH_CONNECTION ]]; then
|
|
||||||
export EDITOR='vim'
|
|
||||||
else
|
|
||||||
# export EDITOR='mvim'
|
|
||||||
export EDITOR='vim'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Compilation flags
|
|
||||||
# export ARCHFLAGS="-arch x86_64"
|
|
||||||
|
|
||||||
# ssh
|
|
||||||
# export SSH_KEY_PATH="~/.ssh/rsa_id"
|
|
||||||
|
|
||||||
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
|
||||||
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
|
||||||
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
|
||||||
# For a full list of active aliases, run `alias`.
|
|
||||||
#
|
|
||||||
# Example aliases
|
|
||||||
# alias zshconfig="mate ~/.zshrc"
|
|
||||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
|
||||||
#eval "$(jump shell)"
|
|
||||||
|
|
||||||
# Load aliases
|
|
||||||
. ~/.bash_aliases
|
|
||||||
|
|
||||||
# . ~/.bash_completion
|
|
||||||
|
|
||||||
# Locale settings for perl
|
|
||||||
#export LC_CTYPE=en_US.UTF-8
|
|
||||||
#export LC_ALL=C
|
|
||||||
#export LC_ALL=en_US.UTF-8
|
|
||||||
|
|
||||||
# Defined in ~/.zshenv
|
|
||||||
# PYENV_ROOT="$HOME/.pyenv"
|
|
||||||
# PATH="$PYENV_ROOT/bin:$PATH"
|
|
||||||
#eval "$(pyenv init -)"
|
|
||||||
|
|
||||||
# source /usr/local/bin/virtualenvwrapper.sh
|
|
||||||
# eval ssh-agent > /dev/null
|
|
||||||
# VIRTUALENVWRAPPER_PYTHON=python3
|
|
||||||
export PYTHONBREAKPOINT=ipdb.set_trace
|
|
||||||
source ~/.zshenv
|
|
||||||
|
|
||||||
# Color man pages
|
|
||||||
export LESS_TERMCAP_mb=$'\e[1;32m'
|
|
||||||
export LESS_TERMCAP_md=$'\e[1;32m'
|
|
||||||
export LESS_TERMCAP_me=$'\e[0m'
|
|
||||||
export LESS_TERMCAP_se=$'\e[0m'
|
|
||||||
export LESS_TERMCAP_so=$'\e[01;33m'
|
|
||||||
export LESS_TERMCAP_ue=$'\e[0m'
|
|
||||||
export LESS_TERMCAP_us=$'\e[1;4;31m'
|
|
||||||
|
|
||||||
# Enable extended glob
|
|
||||||
setopt extendedglob
|
|
||||||
|
|
||||||
# Enable Ctrl-x-e to edit command line
|
|
||||||
autoload -U edit-command-line
|
|
||||||
# Emacs style
|
|
||||||
zle -N edit-command-line
|
|
||||||
bindkey '^xe' edit-command-line
|
|
||||||
bindkey '^x^e' edit-command-line
|
|
||||||
# Vi style:
|
|
||||||
# zle -N edit-command-line
|
|
||||||
# bindkey -M vicmd v edit-command-line
|
|
||||||
|
|
||||||
# add GO to path
|
|
||||||
export PATH="/home/viktor/go/bin:$PATH"
|
|
||||||
#export GO111MODULE=on
|
|
||||||
export GOPATH="/home/$USER/go"
|
|
||||||
|
|
||||||
# add JDK 12 go path
|
|
||||||
export PATH="/opt/jdk-12.0.1/bin:$PATH"
|
|
||||||
|
|
||||||
# add azure core tools to path
|
|
||||||
# export PATH="/opt/azure/:$PATH"
|
|
||||||
|
|
||||||
unset command_not_found_handle
|
|
||||||
|
|
||||||
# Load nvm
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"# This loads nvm
|
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"# This loads nvm bash_completion
|
|
||||||
|
|
||||||
export PATH="/home/viktor/.local/bin:$PATH"
|
|
||||||
|
|
||||||
# Load Z to jump around recent dirs
|
|
||||||
#. ~/z.sh
|
|
||||||
|
|
||||||
compinit
|
|
||||||
|
|
||||||
# add k8s autocompletion, must be after compinit!
|
|
||||||
if which kubectl >/dev/null 2>/dev/null; then
|
|
||||||
source <(kubectl completion zsh)
|
|
||||||
fi
|
|
||||||
|
|
@ -12,7 +12,7 @@ alias pmm='python manage.py migrate'
|
||||||
alias pmmm='python manage.py makemigrations'
|
alias pmmm='python manage.py makemigrations'
|
||||||
|
|
||||||
# Start vim with system clipboard
|
# Start vim with system clipboard
|
||||||
alias vim="vimx" # don't alias this - make symlink instead
|
#alias vim="vimx" # don't alias this - make symlink instead
|
||||||
alias vi="vim"
|
alias vi="vim"
|
||||||
alias vimdiff="vim -d"
|
alias vimdiff="vim -d"
|
||||||
|
|
||||||
|
|
@ -22,6 +22,7 @@ alias gs='git status'
|
||||||
alias ga='git add'
|
alias ga='git add'
|
||||||
alias gc='git commit -S'
|
alias gc='git commit -S'
|
||||||
alias gp='git push origin master'
|
alias gp='git push origin master'
|
||||||
|
alias gpf='git push -u forgejo master'
|
||||||
# alias gp='for r in $(git remote); do echo "Pushing to $r" && git push $r master; done'
|
# alias gp='for r in $(git remote); do echo "Pushing to $r" && git push $r master; done'
|
||||||
alias gpull='git pull --rebase origin master'
|
alias gpull='git pull --rebase origin master'
|
||||||
alias gl="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
|
alias gl="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
|
||||||
|
|
@ -509,7 +510,8 @@ alias kbpo="kubectl get pods -o wide"
|
||||||
alias kbs="kubectl get svc"
|
alias kbs="kubectl get svc"
|
||||||
alias kbn="kubectl get nodes -o wide"
|
alias kbn="kubectl get nodes -o wide"
|
||||||
alias kbd="kubectl describe pods"
|
alias kbd="kubectl describe pods"
|
||||||
alias kbf="kubectl logs --all-containers --max-log-requests 50 -f"
|
alias kbf="kubectl logs --all-containers --max-log-requests 50 -f --since=5m"
|
||||||
|
alias kbe='kubectl exec -it $(kbp | tail -n 1 | awk "{print \$1}") -- sh'
|
||||||
alias kn="kubens"
|
alias kn="kubens"
|
||||||
function cephpw() {
|
function cephpw() {
|
||||||
kubectl -n rook-ceph get secret rook-ceph-dashboard-password -o yaml | grep "password:" | grep -v '{}'| awk '{print $2}' | base64 --decode
|
kubectl -n rook-ceph get secret rook-ceph-dashboard-password -o yaml | grep "password:" | grep -v '{}'| awk '{print $2}' | base64 --decode
|
||||||
|
|
@ -550,6 +552,7 @@ function wgs() {
|
||||||
alias wg="sudo wg"
|
alias wg="sudo wg"
|
||||||
alias svm="et -c 'tmux new -A -s main' 10.0.10.104:2022"
|
alias svm="et -c 'tmux new -A -s main' 10.0.10.104:2022"
|
||||||
alias calicoctl="kubectl exec -i -n kube-system calicoctl -- /calicoctl"
|
alias calicoctl="kubectl exec -i -n kube-system calicoctl -- /calicoctl"
|
||||||
alias ipcalc="ipcalc --no-decorate"
|
#alias ipcalc="ipcalc --no-decorate"
|
||||||
alias ss-tunnel="snap run shadowsocks-libev.ss-tunnel"
|
alias ss-tunnel="snap run shadowsocks-libev.ss-tunnel"
|
||||||
alias ss-local="snap run shadowsocks-libev.ss-local"
|
alias ss-local="snap run shadowsocks-libev.ss-local"
|
||||||
|
alias cr="cargo run"
|
||||||
92
dot_kube/encrypted_config.asc
Normal file
92
dot_kube/encrypted_config.asc
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
-----BEGIN PGP MESSAGE-----
|
||||||
|
|
||||||
|
hQEMA2I9C9ArYorXAQgAkZnwPvE+yFlVHr0gwpyfMnUf/TBGUw95V7zm/mbm5Z8v
|
||||||
|
fKEiYAkhrwwHS5LsbWhA15FpJQ/7r/rCI8YdlDPokB7v6AKedWEyaVW3Q20VZTh+
|
||||||
|
ziWzeePRmXv4MiOHOcYjG3lK+HTurmMcRCgDLSCrW1XH/uZikoJ9NhUdD8db3yiE
|
||||||
|
lF8+Z0hulxxoGt1gWXC3Da4/G/R9a76abiN6Ulw0Rpb9p1H953tXF8wM7bk45jHh
|
||||||
|
7JLT+BCKbzYBQaUlsbbSuvNdnq1EHgCLn03x4Vl6NxsmLLST70GBY3IMgZiV1aAh
|
||||||
|
9lbmhQYqKwNghXF6TdzTgbJuljevb73pPiVo647d8tLqAdj9JsSaqVAyPr1OJnlW
|
||||||
|
TyoPi658wME7ii/e8C4pOzrn24T0XniXYNJznkYjmMGO5IE99JYN1Be/q+1Ux+2G
|
||||||
|
398B8uxY4RPj2lTSRRH7T4QBbYGPT4uUMB9o4N/XLj0cvTiX63T7QftI7u3nZLBd
|
||||||
|
Rcg6wu7QMIiNQ3W2gG1uUMki2Wu+2g4WLYkh5liwdl5PPDpZH9H6RRblz1ZsyakV
|
||||||
|
V1h5l1sl9KZtZ8a5HUy7yjDFjCbCj9bbcGmPV/bRQB3LhqQoLA331AYo6HRo39u8
|
||||||
|
RPySDhko4xe3EZay0pPELEvnwrKQhxJ0UaY5BFdTNDAA5AuyJulURINLpMnU1jFZ
|
||||||
|
2iDRmZArZFNlhFTSzipuZVgAiPmAF0+K+pc6tYn3xz/TsqbQTHF8KyEao3q+V+vr
|
||||||
|
he/dDbvUAhJf9Tbdtwj2OVM8r9qcsLxIhH7CXnsx6+6slBdphF1t0Jgwmuw991bX
|
||||||
|
2hOdgUiYiYtHK3UYgd0Mus3TKH6hELcNGG0i2IbQWFtUL05qiw20p6MfcyUvomKh
|
||||||
|
JKrzZkpP9MKk1TdfRzD4Yi2+y3a6NJyPFQCe4v+DJs0PZ6gz1MrWcKrK8KidN6iU
|
||||||
|
Fiqmu+CFfnWGRaM8vC3MPHwe/qxAYNOkPf73YATXFfD87UggLUg2XSnURYpM6Xcd
|
||||||
|
dzhz5AxSf414c2XRTSJwhF1UwdGHGJNi00sTX34X2NQ0GCC2UBU9YJwcJasLc+Yp
|
||||||
|
qAFIxcKjf3RjvOQK6qM1L6kWWduA9HfX1316CpY52UYdJZnDmUJL3lHQJG0rJ2UM
|
||||||
|
ZlDnyYL4z4TrApo1HbJZct9znqf7bOzT7qjy/qBXXC0dnrafC/4qNolGsae4wDpm
|
||||||
|
giqFz5soREGTr3yrMuIa5rdrFanh1smFr6KJDwazegzySoGsRZW5qPtB+SS5MVq3
|
||||||
|
c1oUR+y7knmJHTctVWr6BMNuWJnodN8AkaKwONw/3isGCCsKO1qe41rzefiBp2eA
|
||||||
|
bk95YJ7a8qCUZVh16Vod5z0/BFo8QkTkvDPOe0iy78eBhWUn+tQZ4BR8qoww86gO
|
||||||
|
tl4GFHYWtjNzTtFYkavCSaAdLXJDeZ9PiIBzaaRva16XTUfkBoiNoN54fzz+Gzie
|
||||||
|
rs+9amgo2WkauGR/UoZ4a1Nph7pBQopSzx+GZWXKxCzL4S7LqV9cNs6An3DC8zPA
|
||||||
|
7g9kFi4ZuGOa/5/6vdZiglpLujJ3kSJBhVVCS23EbMYE3HtXIYfL2DmF2BWpVz7a
|
||||||
|
ClNH/BeXJssOxpoaY9vg/cU+WqM5Hl7wPfxaunUjnSNc8wWci3WEOmyZOKIjYm+H
|
||||||
|
aCd8mxO8d7JwQEEQUzcoin5HLLVlm/1Qx/ZUDqxGQ3SPqEK6OvS4/VzHA/n5LXMa
|
||||||
|
1eo9YnQbR83UyFoKR/+9USgIs/x9PTcJa3aHq+2CO8TETQspUMy84tFbPk5h3yKi
|
||||||
|
ENhnrOW8z6B3SbE2wZ4rZqNKuUxcDenOgcJW9kxWBPRpeDk2OfT9ozltzhUkrZ++
|
||||||
|
+GjhlEL/sWypDo8h+whWrVSfL8zZsQB9M3goXIjNJT+o2TLz805VOijLqQEyr3Th
|
||||||
|
02CB5IIlgbnurjZ+qLorBLUxU1PEkPDjA/hOL5lgiA4pdplmh803VFGIHE7LaECG
|
||||||
|
vo39pV47LLNdiyDNUxVOYnE/WkOapXI0NXsIaTz5jl+dK5NJhTb79E4C5LeNwjjg
|
||||||
|
USL5iC44jZO4JbghxeLHpL+biEOOISFYQSmam7cKUaVORzHH/td8x5yDoX4gfJN2
|
||||||
|
uJ5v3ukKBluxvXmndsZdSir8G+0fbCbaob/s93U3oLPNWkIIie/xjTwF8ymA9xNB
|
||||||
|
sB7H0WGiB4BD2XrsZk2XLNmUlZfoyefwKb965xJL5FDee+gZAVNTtI1B4COblj15
|
||||||
|
8aH0hqoGPKlq55Q+GZsASRASJx0HbAOHnNItQTwRn+fiTjo+9rKp2ME86LCMZNcT
|
||||||
|
a3FwaupFapL1s5nDR6TZak3S5QZJiNI95oBxbToKdjMBtQpd4pOR0ez6S0JnBuBk
|
||||||
|
0p1c1xX3cio4IgOTOcDDf3LhTYKkA2BlRqygejQxzUDCbSjKB6NpSw3ivx5zt8dU
|
||||||
|
aD6joywM+apHVXrIdxy7KsSYRgiZ2oQyBwT2RVseKDSbtRkZ00KiKVSoP2eZfTpt
|
||||||
|
sUXDwSfLmhed29iKqZxK6PEaUDaG+sF+6YclmXBZT/CWze+DqOwNs26UZ7NfJDeI
|
||||||
|
j5uSmU2cfacZRFOYr+71IfcKLiEX1dCYA6GQUKjQDA3lDLNeDHlgxaa9+gSuPQLn
|
||||||
|
e0kE42eoesQ3s+9GpTz5gukT726fiRsxmId41NjjVehSLxdiNMJViKEYoKdPKS28
|
||||||
|
iSWKS2Y85EO1Q5IPFq3SvRT97E2fH9sTTRW8px7MWfwbxSIAEjyhEars0KFb+8d8
|
||||||
|
J64ymn+PtGYllRtlyly7S2eC9KNgROwI+CeFAhhTy7mFP6NOUCiyMNcol+7aqaGb
|
||||||
|
EI30tT35r118eWQ/+OHydm5w6rxvhRdQcb2J3CUlb9SltH6RqQ9yO1loi1ufstQ8
|
||||||
|
WFd/pov4lI77WiP/eNcwc7u8kZBcUGDNPzbWp5B5yh9vsBv1/LzosyG6mifUPdhO
|
||||||
|
dtcQ9auJGO/7Ec6TDRneLYuT97eoV38+Sc4zIMlumsXSgJ+IT19ETdaaDXCDoeJS
|
||||||
|
32dYVaZqxZbI5jd8Xu7KK7M0/JSCHd5i5mA3z2IiHrr5o+THDN2oZCu2HJF7rH/6
|
||||||
|
AaJM3anCDjSy16l+oTbTpOqe6lQodZRQu8Wpz/wed3GuhSbOkxMwvJGH+VrFFarr
|
||||||
|
3xP9GpC7GMuwF5euveh2IvSiakswCQLV4G7RwO8cwccBxllgD0aJaxIGVNmBaFhJ
|
||||||
|
Uimp7mCBevmj244aqBm1kPI0cB9BRxqeLtvODWMKqF0mhzWWtwLullfE6EC9s5+f
|
||||||
|
efCYLR7xXyGVr+iBW3lAQW1eLqXDxesP4afJrfY69gY6Y7+MwN8vtkMOakVbitry
|
||||||
|
pJfrAKIIu3EiJPw5xF0hklQ+V+wYc+nSHDzO1kPzRBK2tIYUvKe0RvU8Ht+QQGuj
|
||||||
|
dXM96E6AVyhBFyZXtPB5egcfkW8kWwL59jr3PtIpWYxe3l44Pahdc4dxwtIsYDUG
|
||||||
|
QjsCcj+GENN0YBjHfTWJIE4njfzRk59pVr7zJPZ9wWQjXLkPA2FTP3aDWk3rvs8Z
|
||||||
|
9hkhwKw0ch7hfxNPUAXo1WFJofLkX85APTKmlXE9ho+7PqHrd2BDz/6hMY9lzRXh
|
||||||
|
s+HRUlgqN/JJfnUu2mMCRH/4CzVdkJuOfpLsTlxetqmBSi+uyt3IMe9lyha1+anp
|
||||||
|
YwQz9uz5i4gj/FylZfD/lddRrX2gIWK4uZsPttyx4SAXDyEe0wehvpGIebHGJwi/
|
||||||
|
DXMKKoqcXsToiGpezM2az8Xj/xMJjLpKPtKaNm6V3gW3o3EkwFEKtAfu/N+ngm2E
|
||||||
|
d0o05ciXp+k5Tn7WjLpyJRYvemqj+sRgBKXF8oZ/cJjvQfWS7FIkNXOgQUa0DJyG
|
||||||
|
RtLiJFfV0uKEZPMpGvcxx5T3oHBloYMFiVItiOn2nNIDp2GRh8f0bpwjdA24S9uJ
|
||||||
|
rfp43/eE67GD22c/vQTxWOJk51lWsEZjvzVlzJ10WWAtIvEMWDxEy9+B6QYoNyFV
|
||||||
|
9bvTgG7PCqGj0nkhoqPxVKFZscl5UOe/Lg/xmUtJNGMLlLTkiwrrVui39FqmyTt0
|
||||||
|
A/+lKvWFG92SAx3rdHQpA4WP412ADZ7X9bxfkgsFRS8NZ8077p6kwrg2CP5bI6HI
|
||||||
|
rhJ43iFGQjOMiVuYqlBuf8xiJvtPwdsJ3NWiQFOSh3ANXg9r+OPIz0nZ5XUpVPqu
|
||||||
|
FVj/gpyIqyyzmG+Rt7b9IzWgge70L5HfdvAoYhpw7Hm4eKtgUKcBu5sgZ3pOiIlz
|
||||||
|
mxzN77tc15rgkJY8Ia+J/RezGhBqoWRPCFeX3B6C5kS91/Y6y3CzBDDnDsg/S4ID
|
||||||
|
neEBO6dfLasMJ8jnRn+rpwvMwD5v+LmUdC5zo8HA+yNkFNiBPPM6/cw+M4j5cZct
|
||||||
|
ut+Udw0RM7jEd0p94dRLWUgCGetpM2lrEt2kChnQ1jkPlrShUIJkLUaLWHXSWu3p
|
||||||
|
Rd0jZ1KwFzqCRYZGYhWry6vtOn2e+F1vE7fEmOAi0AipvF7piKmJsfdWNew6UhKb
|
||||||
|
q87vtXQUtBUBCpvJ1Yfv+wYvUnadp7d/kMk+ySFaNjOKqfjudeXuPT/KixKK731u
|
||||||
|
UfxfVCOlEaNH0ohZEf/Ervm3WO1DG4TGzgYBCsmpIqBp+wi5ilC76pFq7flL4QfY
|
||||||
|
zgtjUBfZ/yTsloGcsPIBFoXIoe5veREPiUXEzNwdAbo+9WKdzCvCX4vZ/E7u5nnf
|
||||||
|
CU8HiLx9YsS7XpFw+brzSgOnCUQtbCAATLJ4sRKWwPIAcRT4wmXgQMnDENpWTQts
|
||||||
|
03MIpu+x1KSS+Xr6xCPUIkDXwaGP2naxZx+WXO7T5l2hmFxedeP+d7TxSLK7u2xl
|
||||||
|
JTIWO681yLv2YrM/YBghePc+lcZPH8Tjzvw/2U7YDrKWsOHlim3983IZwrW39SzT
|
||||||
|
iZHxbikkqKORrdtrSVoHN8MDftAB3AEEADSUpXp41lzY1KCsMYPG9avuL4WD/YbC
|
||||||
|
2YOM+8olBV0FWQJSWf09frmTx9nLZVTigqOG8E65cQElb4N2D23AZon4QYFvpG7t
|
||||||
|
zyglVhMbuaDEkCI6xZEZc9xQ9zdMVTK7ualI7S8w8rWBlzdDHbrzL1rMlEu+EilV
|
||||||
|
lyyKJRcP3dB18dgpfUgsob64ndEi9IV2kjGt8ecEvbQ6udeqsJPi4MhAqBedJD1i
|
||||||
|
ibZTTwfO0D3J1weEwa0ZozNnZG7AkwysyHMvzncY+WKfRnj3amPdqAhlqN3hHw+P
|
||||||
|
Ui202nejg0BribFIwXh3OrL9gbf8+zXYnBE2B29E8cBNK+qRd+Hfkr4y3p8t6k+i
|
||||||
|
P/dLDxwQ2BqD9j2l0kbEaBF2G0QO7vm7WVG9mM0+2gB0/wF0Hvx5IHL/2IYx7ZVt
|
||||||
|
kfVXJlmovmFNRB2Qj1tCEQOHgl76tovccfsLmdOPVvLt3H0KuC8yKVdN5wKCclbz
|
||||||
|
BRvI84FQWz9DwGGyQ8zkk6O70DlPb0f03UPLfLjcx5z2Iha2A2UgoBwq8vR361LQ
|
||||||
|
ayKw1sh/jmkFpLAY4YPnxXlJm4VKGNsQjfRIa/FRyi+TLtnI7YyBeBrojLu81nIK
|
||||||
|
6l67GVdbZ4uiugtlc6G1HYgS/wy+TJDHbgbSjl/0MAeJjm3dVnaB474Giyy0wEbC
|
||||||
|
75ZnrJ3RYIsPn6a3+H0UTk2TbD7JKPt6GQ==
|
||||||
|
=Oojc
|
||||||
|
-----END PGP MESSAGE-----
|
||||||
1
dot_kube/kubens/kubernetes-admin@kubernetes
Normal file
1
dot_kube/kubens/kubernetes-admin@kubernetes
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
kyverno
|
||||||
76
dot_oh-my-zsh/CODE_OF_CONDUCT.md
Normal file
76
dot_oh-my-zsh/CODE_OF_CONDUCT.md
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to making participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||||
|
level of experience, education, socio-economic status, nationality, personal
|
||||||
|
appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all project spaces, and it also applies when
|
||||||
|
an individual is representing the project or its community in public spaces.
|
||||||
|
Examples of representing a project or community include using an official
|
||||||
|
project e-mail address, posting via an official social media account, or acting
|
||||||
|
as an appointed representative at an online or offline event. Representation of
|
||||||
|
a project may be further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at ohmyzsh@planetargon.com. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see
|
||||||
|
https://www.contributor-covenant.org/faq
|
||||||
245
dot_oh-my-zsh/CONTRIBUTING.md
Normal file
245
dot_oh-my-zsh/CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,245 @@
|
||||||
|
# CONTRIBUTING GUIDELINES
|
||||||
|
|
||||||
|
Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged, and appreciated.
|
||||||
|
It is also essential for the development of the project.
|
||||||
|
|
||||||
|
First, please take a moment to review our [code of conduct](CODE_OF_CONDUCT.md).
|
||||||
|
|
||||||
|
These guidelines are an attempt at better addressing the huge amount of pending
|
||||||
|
issues and pull requests. Please read them closely.
|
||||||
|
|
||||||
|
Foremost, be so kind as to [search](#use-the-search-luke). This ensures any contribution
|
||||||
|
you would make is not already covered.
|
||||||
|
|
||||||
|
<!-- TOC updateonsave:true depthfrom:2 -->
|
||||||
|
|
||||||
|
- [Reporting Issues](#reporting-issues)
|
||||||
|
- [You have a problem](#you-have-a-problem)
|
||||||
|
- [You have a suggestion](#you-have-a-suggestion)
|
||||||
|
- [Submitting Pull Requests](#submitting-pull-requests)
|
||||||
|
- [Getting started](#getting-started)
|
||||||
|
- [You have a solution](#you-have-a-solution)
|
||||||
|
- [You have an addition](#you-have-an-addition)
|
||||||
|
- [Use the Search, Luke](#use-the-search-luke)
|
||||||
|
- [Commit Guidelines](#commit-guidelines)
|
||||||
|
- [Format](#format)
|
||||||
|
- [Style](#style)
|
||||||
|
- [Volunteer](#volunteer)
|
||||||
|
|
||||||
|
<!-- /TOC -->
|
||||||
|
|
||||||
|
## Reporting Issues
|
||||||
|
|
||||||
|
### You have a problem
|
||||||
|
|
||||||
|
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
|
||||||
|
your problem.
|
||||||
|
|
||||||
|
If you find one, comment on it, so we know more people are experiencing it.
|
||||||
|
|
||||||
|
If not, look at the [Troubleshooting](https://github.com/ohmyzsh/ohmyzsh/wiki/Troubleshooting)
|
||||||
|
page for instructions on how to gather data to better debug your problem.
|
||||||
|
|
||||||
|
Then, you can go ahead and create an issue with as much detail as you can provide.
|
||||||
|
It should include the data gathered as indicated above, along with the following:
|
||||||
|
|
||||||
|
1. How to reproduce the problem
|
||||||
|
2. What the correct behavior should be
|
||||||
|
3. What the actual behavior is
|
||||||
|
|
||||||
|
Please copy to anyone relevant (e.g. plugin maintainers) by mentioning their GitHub handle
|
||||||
|
(starting with `@`) in your message.
|
||||||
|
|
||||||
|
We will do our very best to help you.
|
||||||
|
|
||||||
|
### You have a suggestion
|
||||||
|
|
||||||
|
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
|
||||||
|
your suggestion.
|
||||||
|
|
||||||
|
If you find one, comment on it, so we know more people are supporting it.
|
||||||
|
|
||||||
|
If not, you can go ahead and create an issue. Please copy to anyone relevant (e.g. plugin
|
||||||
|
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
|
||||||
|
|
||||||
|
## Submitting Pull Requests
|
||||||
|
|
||||||
|
### Getting started
|
||||||
|
|
||||||
|
You should be familiar with the basics of
|
||||||
|
[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork
|
||||||
|
[properly set up](https://github.com/ohmyzsh/ohmyzsh/wiki/Contribution-Technical-Practices).
|
||||||
|
|
||||||
|
You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree.
|
||||||
|
|
||||||
|
If you create your own PR, please make sure you do it right. Also be so kind as to reference
|
||||||
|
any issue that would be solved in the PR description body,
|
||||||
|
[for instance](https://help.github.com/articles/closing-issues-via-commit-messages/)
|
||||||
|
_"Fixes #XXXX"_ for issue number XXXX.
|
||||||
|
|
||||||
|
### You have a solution
|
||||||
|
|
||||||
|
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
|
||||||
|
your [problem](#you-have-a-problem), and any pending/merged/rejected PR covering your solution.
|
||||||
|
|
||||||
|
If the solution is already reported, try it out and +1 the pull request if the
|
||||||
|
solution works ok. On the other hand, if you think your solution is better, post
|
||||||
|
it with reference to the other one so we can have both solutions to compare.
|
||||||
|
|
||||||
|
If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin
|
||||||
|
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
|
||||||
|
|
||||||
|
### You have an addition
|
||||||
|
|
||||||
|
Please [do not](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#dont-send-us-your-theme-for-now)
|
||||||
|
send themes for now.
|
||||||
|
|
||||||
|
Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests
|
||||||
|
covering or related to what you want to add.
|
||||||
|
|
||||||
|
If you find one, try it out and work with the author on a common solution.
|
||||||
|
|
||||||
|
If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin
|
||||||
|
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
|
||||||
|
|
||||||
|
For any extensive change, such as a new plugin, you will have to find testers to +1 your PR.
|
||||||
|
|
||||||
|
### New plugin aliases
|
||||||
|
|
||||||
|
We acknowledge that aliases are a core part of Oh My Zsh. There are plugins that have +100 aliases!
|
||||||
|
|
||||||
|
This has become an issue for two opposing reasons:
|
||||||
|
|
||||||
|
- Some users want to have their personal aliases in Oh My Zsh.
|
||||||
|
- Some users don't want any aliases at all and feel that there are too many.
|
||||||
|
|
||||||
|
Because of this, from now on, we require that new aliases follow these conditions:
|
||||||
|
|
||||||
|
1. They will be used by many people, not just a few.
|
||||||
|
2. The aliases will be used many times and for common tasks.
|
||||||
|
3. Prefer one generic alias over many specific ones.
|
||||||
|
4. When justifying the need for an alias, talk about workflows where you'll use it,
|
||||||
|
preferably in combination with other aliases.
|
||||||
|
5. If a command with the same name exists, look for a different alias name.
|
||||||
|
|
||||||
|
This list is not exhaustive! Please remember that your alias will be in the machines of many people,
|
||||||
|
so it should be justified why they should have it.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## Use the Search, Luke
|
||||||
|
|
||||||
|
_May the Force (of past experiences) be with you_
|
||||||
|
|
||||||
|
GitHub offers [many search features](https://help.github.com/articles/searching-github/)
|
||||||
|
to help you check whether a similar contribution to yours already exists. Please search
|
||||||
|
before making any contribution, it avoids duplicates and eases maintenance. Trust me,
|
||||||
|
that works 90% of the time.
|
||||||
|
|
||||||
|
You can also take a look at the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ)
|
||||||
|
to be sure your contribution has not already come up.
|
||||||
|
|
||||||
|
If all fails, your thing has probably not been reported yet, so you can go ahead
|
||||||
|
and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-requests).
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## Commit Guidelines
|
||||||
|
|
||||||
|
Oh My Zsh uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
|
||||||
|
specification. The automatic changelog tool uses these to automatically generate
|
||||||
|
a changelog based on the commit messages. Here's a guide to writing a commit message
|
||||||
|
to allow this:
|
||||||
|
|
||||||
|
### Format
|
||||||
|
|
||||||
|
```
|
||||||
|
type(scope)!: subject
|
||||||
|
```
|
||||||
|
|
||||||
|
- `type`: the type of the commit is one of the following:
|
||||||
|
|
||||||
|
- `feat`: new features.
|
||||||
|
- `fix`: bug fixes.
|
||||||
|
- `docs`: documentation changes.
|
||||||
|
- `refactor`: refactor of a particular code section without introducing
|
||||||
|
new features or bug fixes.
|
||||||
|
- `style`: code style improvements.
|
||||||
|
- `perf`: performance improvements.
|
||||||
|
- `test`: changes to the test suite.
|
||||||
|
- `ci`: changes to the CI system.
|
||||||
|
- `build`: changes to the build system (we don't yet have one so this shouldn't apply).
|
||||||
|
- `chore`: for other changes that don't match previous types. This doesn't appear
|
||||||
|
in the changelog.
|
||||||
|
|
||||||
|
- `scope`: section of the codebase that the commit makes changes to. If it makes changes to
|
||||||
|
many sections, or if no section in particular is modified, leave blank without the parentheses.
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
- Commit that changes the `git` plugin:
|
||||||
|
```
|
||||||
|
feat(git): add alias for `git commit`
|
||||||
|
```
|
||||||
|
|
||||||
|
- Commit that changes many plugins:
|
||||||
|
```
|
||||||
|
style: fix inline declaration of arrays
|
||||||
|
```
|
||||||
|
|
||||||
|
For changes to plugins or themes, the scope should be the plugin or theme name:
|
||||||
|
|
||||||
|
- ✅ `fix(agnoster): commit subject`
|
||||||
|
- ❌ `fix(theme/agnoster): commit subject`
|
||||||
|
|
||||||
|
- `!`: this goes after the `scope` (or the `type` if scope is empty), to indicate that the commit
|
||||||
|
introduces breaking changes.
|
||||||
|
|
||||||
|
Optionally, you can specify a message that the changelog tool will display to the user to indicate
|
||||||
|
what's changed and what they can do to deal with it. You can use multiple lines to type this message;
|
||||||
|
the changelog parser will keep reading until the end of the commit message or until it finds an empty
|
||||||
|
line.
|
||||||
|
|
||||||
|
Example (made up):
|
||||||
|
|
||||||
|
```
|
||||||
|
style(agnoster)!: change dirty git repo glyph
|
||||||
|
|
||||||
|
BREAKING CHANGE: the glyph to indicate when a git repository is dirty has
|
||||||
|
changed from a Powerline character to a standard UTF-8 emoji. You can
|
||||||
|
change it back by setting `ZSH_THEME_DIRTY_GLYPH`.
|
||||||
|
|
||||||
|
Fixes #420
|
||||||
|
|
||||||
|
Co-authored-by: Username <email>
|
||||||
|
```
|
||||||
|
|
||||||
|
- `subject`: a brief description of the changes. This will be displayed in the changelog. If you need
|
||||||
|
to specify other details, you can use the commit body, but it won't be visible.
|
||||||
|
|
||||||
|
Formatting tricks: the commit subject may contain:
|
||||||
|
|
||||||
|
- Links to related issues or PRs by writing `#issue`. This will be highlighted by the changelog tool:
|
||||||
|
```
|
||||||
|
feat(archlinux): add support for aura AUR helper (#9467)
|
||||||
|
```
|
||||||
|
|
||||||
|
- Formatted inline code by using backticks: the text between backticks will also be highlighted by
|
||||||
|
the changelog tool:
|
||||||
|
```
|
||||||
|
feat(shell-proxy): enable unexported `DEFAULT_PROXY` setting (#9774)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Style
|
||||||
|
|
||||||
|
Try to keep the first commit line short. It's harder to do using this commit style but try to be
|
||||||
|
concise, and if you need more space, you can use the commit body. Try to make sure that the commit
|
||||||
|
subject is clear and precise enough that users will know what changed by just looking at the changelog.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## Volunteer
|
||||||
|
|
||||||
|
Very nice!! :)
|
||||||
|
|
||||||
|
Please have a look at the [Volunteer](https://github.com/ohmyzsh/ohmyzsh/wiki/Volunteers)
|
||||||
|
page for instructions on where to start and more.
|
||||||
21
dot_oh-my-zsh/LICENSE.txt
Normal file
21
dot_oh-my-zsh/LICENSE.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2009-2022 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
377
dot_oh-my-zsh/README.md
Normal file
377
dot_oh-my-zsh/README.md
Normal file
|
|
@ -0,0 +1,377 @@
|
||||||
|
<p align="center"><img src="https://ohmyzsh.s3.amazonaws.com/omz-ansi-github.png" alt="Oh My Zsh"></p>
|
||||||
|
|
||||||
|
Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration.
|
||||||
|
|
||||||
|
Sounds boring. Let's try again.
|
||||||
|
|
||||||
|
**Oh My Zsh will not make you a 10x developer...but you may feel like one.**
|
||||||
|
|
||||||
|
Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_
|
||||||
|
|
||||||
|
Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬
|
||||||
|
|
||||||
|
To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and join us on [Discord](https://discord.gg/ohmyzsh).
|
||||||
|
|
||||||
|
[](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI)
|
||||||
|
[](https://twitter.com/intent/follow?screen_name=ohmyzsh)
|
||||||
|
[](https://discord.gg/ohmyzsh)
|
||||||
|
[](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh)
|
||||||
|
[](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh)
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Table of Contents</summary>
|
||||||
|
|
||||||
|
- [Getting Started](#getting-started)
|
||||||
|
- [Prerequisites](#prerequisites)
|
||||||
|
- [Basic Installation](#basic-installation)
|
||||||
|
- [Manual inspection](#manual-inspection)
|
||||||
|
- [Using Oh My Zsh](#using-oh-my-zsh)
|
||||||
|
- [Plugins](#plugins)
|
||||||
|
- [Enabling Plugins](#enabling-plugins)
|
||||||
|
- [Using Plugins](#using-plugins)
|
||||||
|
- [Themes](#themes)
|
||||||
|
- [Selecting a Theme](#selecting-a-theme)
|
||||||
|
- [FAQ](#faq)
|
||||||
|
- [Advanced Topics](#advanced-topics)
|
||||||
|
- [Advanced Installation](#advanced-installation)
|
||||||
|
- [Custom Directory](#custom-directory)
|
||||||
|
- [Unattended install](#unattended-install)
|
||||||
|
- [Installing from a forked repository](#installing-from-a-forked-repository)
|
||||||
|
- [Manual Installation](#manual-installation)
|
||||||
|
- [Installation Problems](#installation-problems)
|
||||||
|
- [Custom Plugins and Themes](#custom-plugins-and-themes)
|
||||||
|
- [Getting Updates](#getting-updates)
|
||||||
|
- [Manual Updates](#manual-updates)
|
||||||
|
- [Uninstalling Oh My Zsh](#uninstalling-oh-my-zsh)
|
||||||
|
- [How do I contribute to Oh My Zsh?](#how-do-i-contribute-to-oh-my-zsh)
|
||||||
|
- [Do NOT send us themes](#do-not-send-us-themes)
|
||||||
|
- [Contributors](#contributors)
|
||||||
|
- [Follow Us](#follow-us)
|
||||||
|
- [Merchandise](#merchandise)
|
||||||
|
- [License](#license)
|
||||||
|
- [About Planet Argon](#about-planet-argon)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL2 is preferred, but cygwin or msys also mostly work.
|
||||||
|
- [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent is fine but we prefer 5.0.8 and newer). If not pre-installed (run `zsh --version` to confirm), check the following wiki instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
|
||||||
|
- `curl` or `wget` should be installed
|
||||||
|
- `git` should be installed (recommended v2.4.11 or higher)
|
||||||
|
|
||||||
|
### Basic Installation
|
||||||
|
|
||||||
|
Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either `curl`, `wget` or another similar tool.
|
||||||
|
|
||||||
|
| Method | Command |
|
||||||
|
| :-------- | :------------------------------------------------------------------------------------------------ |
|
||||||
|
| **curl** | `sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
||||||
|
| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
||||||
|
| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
||||||
|
|
||||||
|
_Note that any previous `.zshrc` will be renamed to `.zshrc.pre-oh-my-zsh`. After installation, you can move the configuration you want to preserve into the new `.zshrc`._
|
||||||
|
|
||||||
|
#### Manual inspection
|
||||||
|
|
||||||
|
It's a good idea to inspect the install script from projects you don't yet know. You can do
|
||||||
|
that by downloading the install script first, looking through it so everything looks normal,
|
||||||
|
then running it:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||||
|
sh install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Using Oh My Zsh
|
||||||
|
|
||||||
|
### Plugins
|
||||||
|
|
||||||
|
Oh My Zsh comes with a shitload of plugins for you to take advantage of. You can take a look in the [plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) directory and/or the [wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) to see what's currently available.
|
||||||
|
|
||||||
|
#### Enabling Plugins
|
||||||
|
|
||||||
|
Once you spot a plugin (or several) that you'd like to use with Oh My Zsh, you'll need to enable them in the `.zshrc` file. You'll find the zshrc file in your `$HOME` directory. Open it with your favorite text editor and you'll see a spot to list all the plugins you want to load.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
vi ~/.zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
For example, this might begin to look like this:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
plugins=(
|
||||||
|
git
|
||||||
|
bundler
|
||||||
|
dotenv
|
||||||
|
macos
|
||||||
|
rake
|
||||||
|
rbenv
|
||||||
|
ruby
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
_Note that the plugins are separated by whitespace (spaces, tabs, new lines...). **Do not** use commas between them or it will break._
|
||||||
|
|
||||||
|
#### Using Plugins
|
||||||
|
|
||||||
|
Each built-in plugin includes a **README**, documenting it. This README should show the aliases (if the plugin adds any) and extra goodies that are included in that particular plugin.
|
||||||
|
|
||||||
|
### Themes
|
||||||
|
|
||||||
|
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred and fifty themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!). Check them out!
|
||||||
|
|
||||||
|
#### Selecting a Theme
|
||||||
|
|
||||||
|
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._
|
||||||
|
|
||||||
|
Once you find a theme that you'd like to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ZSH_THEME="robbyrussell"
|
||||||
|
```
|
||||||
|
|
||||||
|
To use a different theme, simply change the value to match the name of your desired theme. For example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ZSH_THEME="agnoster" # (this is one of the fancy ones)
|
||||||
|
# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster
|
||||||
|
```
|
||||||
|
|
||||||
|
_Note: many themes require installing a [Powerline Font](https://github.com/powerline/fonts) or a [Nerd Font](https://github.com/ryanoasis/nerd-fonts) in order to render properly. Without them, these themes will render [weird prompt symbols](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-have-a-weird-character-in-my-prompt)_
|
||||||
|
|
||||||
|
Open up a new terminal window and your prompt should look something like this:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes).
|
||||||
|
|
||||||
|
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ZSH_THEME="random" # (...please let it be pie... please be some pie..)
|
||||||
|
```
|
||||||
|
|
||||||
|
And if you want to pick random theme from a list of your favorite themes:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ZSH_THEME_RANDOM_CANDIDATES=(
|
||||||
|
"robbyrussell"
|
||||||
|
"agnoster"
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
If you only know which themes you don't like, you can add them similarly to an ignored list:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)
|
||||||
|
```
|
||||||
|
|
||||||
|
### FAQ
|
||||||
|
|
||||||
|
If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).
|
||||||
|
|
||||||
|
## Advanced Topics
|
||||||
|
|
||||||
|
If you're the type that likes to get their hands dirty, these sections might resonate.
|
||||||
|
|
||||||
|
### Advanced Installation
|
||||||
|
|
||||||
|
Some users may want to manually install Oh My Zsh, or change the default path or other settings that
|
||||||
|
the installer accepts (these settings are also documented at the top of the install script).
|
||||||
|
|
||||||
|
#### Custom Directory
|
||||||
|
|
||||||
|
The default location is `~/.oh-my-zsh` (hidden in your home directory, you can access it with `cd ~/.oh-my-zsh`)
|
||||||
|
|
||||||
|
If you'd like to change the install directory with the `ZSH` environment variable, either by running
|
||||||
|
`export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline
|
||||||
|
like this:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Unattended install
|
||||||
|
|
||||||
|
If you're running the Oh My Zsh install script as part of an automated install, you can pass the `--unattended`
|
||||||
|
flag to the `install.sh` script. This will have the effect of not trying to change
|
||||||
|
the default shell, and it also won't run `zsh` when the installation has finished.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Installing from a forked repository
|
||||||
|
|
||||||
|
The install script also accepts these variables to allow installation of a different repository:
|
||||||
|
|
||||||
|
- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set
|
||||||
|
this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`.
|
||||||
|
|
||||||
|
- `REMOTE` (default: `https://github.com/${REPO}.git`): this is the full URL of the git repository
|
||||||
|
clone. You can use this setting if you want to install from a fork that is not on GitHub (GitLab,
|
||||||
|
Bitbucket...) or if you want to clone with SSH instead of HTTPS (`git@github.com:user/project.git`).
|
||||||
|
|
||||||
|
_NOTE: it's incompatible with setting the `REPO` variable. This setting will take precedence._
|
||||||
|
|
||||||
|
- `BRANCH` (default: `master`): you can use this setting if you want to change the default branch to be
|
||||||
|
checked out when cloning the repository. This might be useful for testing a Pull Request, or if you
|
||||||
|
want to use a branch other than `master`.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Manual Installation
|
||||||
|
|
||||||
|
##### 1. Clone the repository <!-- omit in toc -->
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
##### 2. _Optionally_, backup your existing `~/.zshrc` file <!-- omit in toc -->
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cp ~/.zshrc ~/.zshrc.orig
|
||||||
|
```
|
||||||
|
|
||||||
|
##### 3. Create a new zsh configuration file <!-- omit in toc -->
|
||||||
|
|
||||||
|
You can create a new zsh config file by copying the template that we have included for you.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
##### 4. Change your default shell <!-- omit in toc -->
|
||||||
|
|
||||||
|
```sh
|
||||||
|
chsh -s $(which zsh)
|
||||||
|
```
|
||||||
|
|
||||||
|
You must log out from your user session and log back in to see this change.
|
||||||
|
|
||||||
|
##### 5. Initialize your new zsh configuration <!-- omit in toc -->
|
||||||
|
|
||||||
|
Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration.
|
||||||
|
|
||||||
|
### Installation Problems
|
||||||
|
|
||||||
|
If you have any hiccups installing, here are a few common fixes.
|
||||||
|
|
||||||
|
- You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`.
|
||||||
|
- If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`.
|
||||||
|
|
||||||
|
### Custom Plugins and Themes
|
||||||
|
|
||||||
|
If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory.
|
||||||
|
|
||||||
|
If you have many functions that go well together, you can put them as a `XYZ.plugin.zsh` file in the `custom/plugins/` directory and then enable this plugin.
|
||||||
|
|
||||||
|
If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`.
|
||||||
|
|
||||||
|
### Remove directories aliases
|
||||||
|
|
||||||
|
If you want to skip ohmyzsh default
|
||||||
|
[directories aliases](https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/directories.zsh) you can add the
|
||||||
|
following snippet to your `zshrc`, before loading `oh-my-zsh.sh` script:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:directories' aliases no
|
||||||
|
```
|
||||||
|
|
||||||
|
## Getting Updates
|
||||||
|
|
||||||
|
By default, you will be prompted to check for updates every 2 weeks. You can choose other update modes by adding a line to your `~/.zshrc` file, **before Oh My Zsh is loaded**:
|
||||||
|
|
||||||
|
1. Automatic update without confirmation prompt:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zstyle ':omz:update' mode auto
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Just offer a reminder every few days, if there are updates available:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zstyle ':omz:update' mode reminder
|
||||||
|
```
|
||||||
|
|
||||||
|
3. To disable automatic updates entirely:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zstyle ':omz:update' mode disabled
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: you can control how often Oh My Zsh checks for updates with the following setting:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# This will check for updates every 7 days
|
||||||
|
zstyle ':omz:update' frequency 7
|
||||||
|
# This will check for updates every time you open the terminal (not recommended)
|
||||||
|
zstyle ':omz:update' frequency 0
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manual Updates
|
||||||
|
|
||||||
|
If you'd like to update at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
omz update
|
||||||
|
```
|
||||||
|
|
||||||
|
Magic! 🎉
|
||||||
|
|
||||||
|
## Uninstalling Oh My Zsh
|
||||||
|
|
||||||
|
Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup.
|
||||||
|
|
||||||
|
If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration.
|
||||||
|
|
||||||
|
## How do I contribute to Oh My Zsh?
|
||||||
|
|
||||||
|
Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md).
|
||||||
|
|
||||||
|
I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
|
||||||
|
|
||||||
|
We also need people to test out pull requests. So take a look through [the open issues](https://github.com/ohmyzsh/ohmyzsh/issues) and help where you can.
|
||||||
|
|
||||||
|
See [Contributing](CONTRIBUTING.md) for more details.
|
||||||
|
|
||||||
|
### Do NOT send us themes
|
||||||
|
|
||||||
|
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page.
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
Oh My Zsh has a vibrant community of happy users and delightful contributors. Without all the time and help from our contributors, it wouldn't be so awesome.
|
||||||
|
|
||||||
|
Thank you so much!
|
||||||
|
|
||||||
|
## Follow Us
|
||||||
|
|
||||||
|
We're on social media:
|
||||||
|
|
||||||
|
- [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it.
|
||||||
|
- [Facebook](https://www.facebook.com/Oh-My-Zsh-296616263819290/) poke us.
|
||||||
|
- [Instagram](https://www.instagram.com/_ohmyzsh/) tag us in your post showing Oh My Zsh!
|
||||||
|
- [Discord](https://discord.gg/ohmyzsh) to chat with us!
|
||||||
|
|
||||||
|
## Merchandise
|
||||||
|
|
||||||
|
We have [stickers, shirts, and coffee mugs available](https://shop.planetargon.com/collections/oh-my-zsh?utm_source=github) for you to show off your love of Oh My Zsh. Again, you will become the talk of the town!
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Oh My Zsh is released under the [MIT license](LICENSE.txt).
|
||||||
|
|
||||||
|
## About Planet Argon
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](http://www.planetargon.com/services/ruby-on-rails-development?utm_source=github). Check out our [other open source projects](https://www.planetargon.com/open-source?utm_source=github).
|
||||||
24
dot_oh-my-zsh/SECURITY.md
Normal file
24
dot_oh-my-zsh/SECURITY.md
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
At the moment Oh My Zsh only considers the very latest commit to be supported.
|
||||||
|
We combine that with our fast response to incidents and the automated updates
|
||||||
|
to minimize the time between vulnerability publication and patch release.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
|:-------------- |:------------------ |
|
||||||
|
| master | :white_check_mark: |
|
||||||
|
| other commits | :x: |
|
||||||
|
|
||||||
|
In the near future we will introduce versioning, so expect this section to change.
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
**Do not submit an issue or pull request**: this might reveal the vulnerability.
|
||||||
|
|
||||||
|
Instead, you should email the maintainers directly at: [**security@ohmyz.sh**](mailto:security@ohmyz.sh).
|
||||||
|
|
||||||
|
We will deal with the vulnerability privately and submit a patch as soon as possible.
|
||||||
|
|
||||||
|
You can also submit your vulnerability report to [huntr.dev](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh) and see if you can get a bounty reward.
|
||||||
4
dot_oh-my-zsh/cache/SYS_ALL_UNITS--system
vendored
Normal file
4
dot_oh-my-zsh/cache/SYS_ALL_UNITS--system
vendored
Normal file
File diff suppressed because one or more lines are too long
4
dot_oh-my-zsh/cache/SYS_REALLY_ALL_UNITS--system
vendored
Normal file
4
dot_oh-my-zsh/cache/SYS_REALLY_ALL_UNITS--system
vendored
Normal file
File diff suppressed because one or more lines are too long
0
dot_oh-my-zsh/cache/completions/.keep
vendored
Normal file
0
dot_oh-my-zsh/cache/completions/.keep
vendored
Normal file
1
dot_oh-my-zsh/cache/docker_hide_legacy_commands
vendored
Normal file
1
dot_oh-my-zsh/cache/docker_hide_legacy_commands
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
_docker_hide_legacy_commands=''
|
||||||
4
dot_oh-my-zsh/cache/docker_subcommands
vendored
Normal file
4
dot_oh-my-zsh/cache/docker_subcommands
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
_docker_subcommands=( ${(Q)"${(z)$(<<\EO:_docker_subcommands
|
||||||
|
'run:Create and run a new container from an image' 'exec:Execute a command in a running container' 'ps:List containers' 'build:Build an image from a Dockerfile' 'pull:Download an image from a registry' 'push:Upload an image to a registry' 'images:List images' 'login:Log in to a registry' 'logout:Log out from a registry' 'search:Search Docker Hub for images' 'version:Show the Docker version information' 'info:Display system-wide information' 'builder:Manage builds' 'container:Manage containers' 'context:Manage contexts' 'image:Manage images' 'manifest:Manage Docker image manifests and manifest lists' 'network:Manage networks' 'plugin:Manage plugins' 'system:Manage Docker' 'trust:Manage trust on Docker images' 'volume:Manage volumes' 'swarm:Manage Swarm' 'attach:Attach local standard input, output, and error streams to a running container' 'commit:Create a new image from a container'\''s changes' 'cp:Copy files/folders between a container and the local filesystem' 'create:Create a new container' 'diff:Inspect changes to files or directories on a container'\''s filesystem' 'events:Get real time events from the server' 'export:Export a container'\''s filesystem as a tar archive' 'history:Show the history of an image' 'import:Import the contents from a tarball to create a filesystem image' 'inspect:Return low-level information on Docker objects' 'kill:Kill one or more running containers' 'load:Load an image from a tar archive or STDIN' 'logs:Fetch the logs of a container' 'pause:Pause all processes within one or more containers' 'port:List port mappings or a specific mapping for the container' 'rename:Rename a container' 'restart:Restart one or more containers' 'rm:Remove one or more containers' 'rmi:Remove one or more images' 'save:Save one or more images to a tar archive (streamed to STDOUT by default)' 'start:Start one or more stopped containers' 'stats:Display a live stream of container(s) resource usage statistics' 'stop:Stop one or more running containers' 'tag:Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE' 'top:Display the running processes of a container' 'unpause:Unpause all processes within one or more containers' 'update:Update configuration of one or more containers' 'wait:Block until one or more containers stop, then print their exit codes' '--config:string Location of client config files (default' '"/home/wizard/.docker")' '-c,:--context string Name of the context to use to connect to the' 'daemon:(overrides DOCKER_HOST env var and' 'default:context set with "docker context use")' '-D,:--debug Enable debug mode' '-H,:--host list Daemon socket to connect to' '-l,:--log-level string Set the logging level ("debug", "info",' '"warn",:"error", "fatal") (default "info")' '--tls:Use TLS; implied by --tlsverify' '--tlscacert:string Trust certs signed only by this CA (default' '"/home/wizard/.docker/ca.pem")' '--tlscert:string Path to TLS certificate file (default' '"/home/wizard/.docker/cert.pem")' '--tlskey:string Path to TLS key file (default' '"/home/wizard/.docker/key.pem")' '--tlsverify:Use TLS and verify the remote' '-v,:--version Print version information and quit' 'daemon:Enable daemon mode' 'help:Show help for a command'
|
||||||
|
EO:_docker_subcommands
|
||||||
|
)}"} )
|
||||||
0
dot_oh-my-zsh/cache/empty_dot_gitkeep
vendored
Normal file
0
dot_oh-my-zsh/cache/empty_dot_gitkeep
vendored
Normal file
3
dot_oh-my-zsh/cache/grep-alias
vendored
Normal file
3
dot_oh-my-zsh/cache/grep-alias
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
alias grep='grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}'
|
||||||
|
alias egrep='grep -E --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}'
|
||||||
|
alias fgrep='grep -F --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}'
|
||||||
154
dot_oh-my-zsh/custom/aliases.zsh
Normal file
154
dot_oh-my-zsh/custom/aliases.zsh
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
# Aliases - organized by category
|
||||||
|
# Auto-loaded by oh-my-zsh from $ZSH_CUSTOM/
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Basic utilities
|
||||||
|
# ============================================================================
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
alias sl=ls
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
|
||||||
|
alias vi="vim"
|
||||||
|
alias vimdiff="vim -d"
|
||||||
|
alias vix="vim -X" # Fast vim startup without X (no system clipboard)
|
||||||
|
alias vimrc="vim ~/.vimrc"
|
||||||
|
alias zshrc="vim ~/.zshrc"
|
||||||
|
|
||||||
|
alias sizeof='du -sh'
|
||||||
|
alias mkdir="mkdir -pv"
|
||||||
|
alias f="free -h"
|
||||||
|
alias h="sudo htop"
|
||||||
|
alias a="sudo atop"
|
||||||
|
alias e="exa -bghHliS"
|
||||||
|
alias n="sudo nethogs"
|
||||||
|
alias i="sudo iotop"
|
||||||
|
alias hosts="sudo vim /etc/hosts"
|
||||||
|
alias root="sudo su -"
|
||||||
|
alias xo="xdg-open"
|
||||||
|
alias time='"time"' # Disable bash builtin
|
||||||
|
alias toclip="xclip -selection clipboard"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Python
|
||||||
|
# ============================================================================
|
||||||
|
alias py='python3'
|
||||||
|
alias ipy='ipython3'
|
||||||
|
alias pmr='python manage.py runserver'
|
||||||
|
alias nopmr="ps auxw | grep runserver | awk '{print \$2}' | xargs kill"
|
||||||
|
alias pmm='python manage.py migrate'
|
||||||
|
alias pmmm='python manage.py makemigrations'
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Git
|
||||||
|
# ============================================================================
|
||||||
|
alias g='git'
|
||||||
|
alias gs='git status'
|
||||||
|
alias ga='git add'
|
||||||
|
alias gc='git commit -S'
|
||||||
|
alias gp='git push origin master'
|
||||||
|
alias gpf='git push -u forgejo master'
|
||||||
|
alias gpull='git pull --rebase origin master'
|
||||||
|
alias gl="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
|
||||||
|
alias gd="git diff"
|
||||||
|
alias gds="git diff --staged"
|
||||||
|
alias gb="git branch"
|
||||||
|
alias gpp='git push production master'
|
||||||
|
alias git-pull-branches='git branch -r | grep -v "\->" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done'
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Docker
|
||||||
|
# ============================================================================
|
||||||
|
alias dk="docker"
|
||||||
|
alias dsl="docker swarm leave --force"
|
||||||
|
alias dkon="sudo systemctl start docker"
|
||||||
|
alias dkoff="sudo systemctl stop docker"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Kubernetes
|
||||||
|
# ============================================================================
|
||||||
|
alias kb="kubectl"
|
||||||
|
alias kbp="kubectl get pods"
|
||||||
|
alias kbpo="kubectl get pods -o wide"
|
||||||
|
alias kbs="kubectl get svc"
|
||||||
|
alias kbn="kubectl get nodes -o wide"
|
||||||
|
alias kbd="kubectl describe pods"
|
||||||
|
alias kbf="kubectl logs --all-containers --max-log-requests 50 -f --since=5m"
|
||||||
|
alias kbe='kubectl exec -it $(kbp | tail -n 1 | awk "{print \$1}") -- sh'
|
||||||
|
alias kn="kubens"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Terraform
|
||||||
|
# ============================================================================
|
||||||
|
alias tf="terraform"
|
||||||
|
alias tfa="tf apply"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Network
|
||||||
|
# ============================================================================
|
||||||
|
alias s="ssh"
|
||||||
|
alias myip="curl https://icanhazip.com"
|
||||||
|
alias ifl="ifconfig|less"
|
||||||
|
alias whatisopen='sudo netstat -pnlt'
|
||||||
|
alias speedtest="curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -"
|
||||||
|
alias wg="sudo wg"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# System
|
||||||
|
# ============================================================================
|
||||||
|
alias omg="sudo systemctl restart NetworkManager"
|
||||||
|
alias omg1.1="sudo rmmod iwlmvm && sudo rmmod iwlwifi; sudo modprobe iwlwifi"
|
||||||
|
alias omg2="kwin --replace &"
|
||||||
|
alias omg2.1="kquitapp5 plasmashell && kstart5 plasmashell"
|
||||||
|
|
||||||
|
alias battery="upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E 'time to empty|state|to\ full|percentage'"
|
||||||
|
alias bye="sudo systemctl suspend"
|
||||||
|
alias hib="sudo systemctl hibernate"
|
||||||
|
alias gg="xset dpms force off"
|
||||||
|
alias wa="watch sensors"
|
||||||
|
alias gtop="sudo intel_gpu_top"
|
||||||
|
|
||||||
|
alias vmon="sudo systemctl start vmware"
|
||||||
|
alias vmoff="sudo systemctl stop vmware"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Misc tools
|
||||||
|
# ============================================================================
|
||||||
|
alias aliases="vim ~/.oh-my-zsh/custom/aliases.zsh && source ~/.zshrc"
|
||||||
|
alias rmswp="find ~/.vim/tmp/ -iname \"*swp\" -delete"
|
||||||
|
alias clearsessions="rm -rf ~/.vim/tmp/sessions/*"
|
||||||
|
alias zsh_fix="mv ~/.zsh_history ~/.zsh_history_bad; strings ~/.zsh_history_bad > ~/.zsh_history; fc -R ~/.zsh_history; rm ~/.zsh_history_bad"
|
||||||
|
alias server="/opt/miniserve-linux"
|
||||||
|
alias gr="go run ."
|
||||||
|
alias hg="hugo -D server --bind 0.0.0.0"
|
||||||
|
alias cr="cargo run"
|
||||||
|
alias tricks="vi ~/tricks/tricks.txt"
|
||||||
|
alias logout="qdbus org.kde.ksmserver /KSMServer logout 0 0 0"
|
||||||
|
|
||||||
|
# Shadowsocks
|
||||||
|
alias ss-tunnel="snap run shadowsocks-libev.ss-tunnel"
|
||||||
|
alias ss-local="snap run shadowsocks-libev.ss-local"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Package manager detection (for update/install aliases)
|
||||||
|
# ============================================================================
|
||||||
|
typeset -A osInfo
|
||||||
|
osInfo[/etc/redhat-release]=dnf
|
||||||
|
osInfo[/etc/arch-release]=pacman
|
||||||
|
osInfo[/etc/gentoo-release]=emerge
|
||||||
|
osInfo[/etc/SuSE-release]=zypp
|
||||||
|
osInfo[/etc/debian_version]=apt-get
|
||||||
|
|
||||||
|
for f in "${(@k)osInfo}"; do
|
||||||
|
if [[ -f $f ]]; then
|
||||||
|
pm=${osInfo[$f]}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
alias update="sudo $pm update"
|
||||||
|
alias u="update"
|
||||||
|
alias upgrade="sudo $pm upgrade"
|
||||||
|
alias install="sudo $pm install"
|
||||||
|
alias remove="sudo $pm remove"
|
||||||
|
alias reinstall="sudo $pm reinstall"
|
||||||
16
dot_oh-my-zsh/custom/encrypted_secrets.zsh.asc
Normal file
16
dot_oh-my-zsh/custom/encrypted_secrets.zsh.asc
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
-----BEGIN PGP MESSAGE-----
|
||||||
|
|
||||||
|
hQEMA2I9C9ArYorXAQf+KmFU7iBMZrTGNainUiimvCBcuzbUdvI5wrDi7OHmSL2D
|
||||||
|
0kjRTA6AZHzAUBE7xM6/HLi/dkf0JjhTO/K6VToh9M0VsCMLbPHsk4msqmoE8bGj
|
||||||
|
Fcz0r6FyxMPHBPBZiZ3WGaTS2NkqS5+ry7Uwl/a4aaKB44Dy0T8tDHFkKUxbKnx+
|
||||||
|
HGAhS5P/jm1w8NWwgxlJMzSpMJTGdGzcj3cVDqrQAVVTNvFQhN0mlyLIImLtzCC1
|
||||||
|
8qhelRLDBC7TsaaJmg2Hpo4fV4FyVLnOltwytjXw0zFzy6KQu+IpS++tWeHZ25ze
|
||||||
|
psGjXa3C7e6y+aLtyKh7jK/Luj9SqT5lRj0SAZT7xNLAbAGI1fH+1unZyXQSm0Zd
|
||||||
|
ezKgje0SZug6ZNfz4m+SbNDw9XO84EudX/vxpt8yQpB1NH4Li7OLiPovl+LMwtk+
|
||||||
|
xK1gzEw0JSXDnr2YSgvQ4Tc0BCXTZnwX74PQp4YIfm8+mBuVeeYtQgRWhczoL3CR
|
||||||
|
KQ1A3gY+yuZeWyCggiiJMwny82ovP2if7qxzBoJVy0ysnz1LpcwlyZO35Cm59LN7
|
||||||
|
Qv8xp5fnMl5NPUhVlNkPr62MRTFhsgOQ7ZlfKBRlydPHe2Z2nBLbHyQTvlqK+Kj9
|
||||||
|
3A6XdAvJiT5Cu63VM7OEeslDxJ88WIjbYV3ep4FkmrbC9JP9+ze938A6CfGqXA7O
|
||||||
|
XAVtTuPNBn58BF1hv8NMT79iIrdhhJXtPCzx+toea7IfMzjjZPE47pcPj+2/Aw==
|
||||||
|
=ocDl
|
||||||
|
-----END PGP MESSAGE-----
|
||||||
10
dot_oh-my-zsh/custom/example.zsh
Normal file
10
dot_oh-my-zsh/custom/example.zsh
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# You can put files here to add functionality separated per file, which
|
||||||
|
# will be ignored by git.
|
||||||
|
# Files on the custom/ directory will be automatically loaded by the init
|
||||||
|
# script, in alphabetical order.
|
||||||
|
|
||||||
|
# For example: add yourself some shortcuts to projects you often work on.
|
||||||
|
#
|
||||||
|
# brainstormr=~/Projects/development/planetargon/brainstormr
|
||||||
|
# cd $brainstormr
|
||||||
|
#
|
||||||
167
dot_oh-my-zsh/custom/functions.zsh
Normal file
167
dot_oh-my-zsh/custom/functions.zsh
Normal file
|
|
@ -0,0 +1,167 @@
|
||||||
|
# Shell functions
|
||||||
|
# Auto-loaded by oh-my-zsh from $ZSH_CUSTOM/
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Git functions
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
# Useful for daily stand-up
|
||||||
|
git-standup() {
|
||||||
|
AUTHOR=${AUTHOR:="$(git config user.name)"}
|
||||||
|
since=yesterday
|
||||||
|
if [[ $(date +%u) == 1 ]]; then
|
||||||
|
since="2 days ago"
|
||||||
|
fi
|
||||||
|
git log --all --since "$since" --oneline --author="$AUTHOR"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Network functions
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
netok() {
|
||||||
|
echo 'Testing DNS settings.'
|
||||||
|
timeout 1 ping google.com -W 1 -c 1 &>> /dev/null
|
||||||
|
if (( $? == 0 )); then
|
||||||
|
echo 'Internet is up.'
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo 'Pinging 8.8.8.8'
|
||||||
|
ping 8.8.8.8 -W 1 -c 1 &>> /dev/null
|
||||||
|
if (( $? == 0 )); then
|
||||||
|
echo 'Issue spotted in DNS settings'
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
gateway=$(echo $(route -n | sed -n '3p' | awk '{print $2}'))
|
||||||
|
echo 'Pinging ' $gateway
|
||||||
|
ping $gateway -W 1 -c 2 &>> /dev/null
|
||||||
|
if (($? == 0 )); then
|
||||||
|
echo 'Gateway connectivity issues or being firewalled.'
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo 'Cannot reach default gateway.'
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
certinfo() {
|
||||||
|
curl --insecure -v https://"$1" 2>&1 | awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ { if (cert) print }'
|
||||||
|
}
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Wireguard VPN
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
wgon() {
|
||||||
|
wg-quick up ~/vpn-certs/viktor.conf
|
||||||
|
# Add ipv4 precedence because vpn is v4 only for now
|
||||||
|
bash -c "grep -qxF 'precedence ::ffff:0:0/96 100' /etc/gai.conf || echo 'precedence ::ffff:0:0/96 100' | sudo tee -a /etc/gai.conf"
|
||||||
|
# Add dns if missing
|
||||||
|
ns_str="nameserver 10.0.20.1 # Added by wgon function"
|
||||||
|
search_str="search viktorbarzin.lan # Added by wgon function"
|
||||||
|
resolv_conf="/etc/resolv.conf"
|
||||||
|
bash -c "grep -qxF '$search_str' $resolv_conf || echo '$search_str' | sudo tee -a $resolv_conf"
|
||||||
|
bash -c "grep -qxF '$ns_str' $resolv_conf || echo '$ns_str' | sudo sed -i -e '1i $ns_str' $resolv_conf"
|
||||||
|
}
|
||||||
|
|
||||||
|
wgoff() {
|
||||||
|
wg-quick down ~/vpn-certs/viktor.conf
|
||||||
|
ns_str="nameserver 10.0.20.1 # Added by wgon function"
|
||||||
|
search_str="search viktorbarzin.lan # Added by wgon function"
|
||||||
|
resolv_conf="/etc/resolv.conf"
|
||||||
|
sudo sed -i '/precedence ::ffff:0:0\/96 100/d' /etc/gai.conf
|
||||||
|
sudo sed -i "/$search_str/d" $resolv_conf
|
||||||
|
sudo sed -i "/$ns_str/d" $resolv_conf
|
||||||
|
}
|
||||||
|
|
||||||
|
wgs() {
|
||||||
|
kubectl scale -n wireguard deployment wireguard --replicas=$1
|
||||||
|
}
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Kubernetes
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
cephpw() {
|
||||||
|
kubectl -n rook-ceph get secret rook-ceph-dashboard-password -o yaml | grep "password:" | grep -v '{}' | awk '{print $2}' | base64 --decode
|
||||||
|
}
|
||||||
|
|
||||||
|
kbop() {
|
||||||
|
kb -n rook-ceph delete pods $(kbp | grep opera | awk '{print $1}')
|
||||||
|
kb -n rook-ceph logs -f $(kbp | grep operator | awk '{print $1}')
|
||||||
|
}
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Compilation / Development
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
c() {
|
||||||
|
# Pass any arguments to gcc and afterwards run executable
|
||||||
|
gcc "$@" && ./a.out
|
||||||
|
}
|
||||||
|
|
||||||
|
dang_gcc() {
|
||||||
|
gcc "$@" -fno-stack-protector -z execstack
|
||||||
|
}
|
||||||
|
|
||||||
|
make_tags() {
|
||||||
|
avr-gcc -M $* | sed -e 's/[\\ ]/\n/g' | \
|
||||||
|
sed -e '/^$/d' -e '/\.o:[ \t]*$/d' | ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q
|
||||||
|
}
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# File encryption
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
encrypt() {
|
||||||
|
tar -czvf $1.tar.gz $1 && \
|
||||||
|
gpg --symmetric --armor $1.tar.gz && \
|
||||||
|
echo "Deleting $1 and $1.tar.gz" && \
|
||||||
|
rm -rf $1 $1.tar.gz
|
||||||
|
}
|
||||||
|
|
||||||
|
decrypt() {
|
||||||
|
gpg --decrypt $1 | tar xzvf -
|
||||||
|
}
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Utilities
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
camelcase() {
|
||||||
|
perl -pe 's#(_|^)(.)#\u$2#g'
|
||||||
|
}
|
||||||
|
|
||||||
|
waitfor() {
|
||||||
|
while pidof $1 > /dev/null; do sleep 2; done
|
||||||
|
}
|
||||||
|
|
||||||
|
b64() {
|
||||||
|
echo $1 | base64 -d
|
||||||
|
}
|
||||||
|
|
||||||
|
# Include helper - source file if it exists
|
||||||
|
include() {
|
||||||
|
[[ -f "$1" ]] && source "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Download GitHub folder using svn
|
||||||
|
download_github_folder() {
|
||||||
|
svn checkout $(echo $1 | sed "s/\/tree\/[a-zA-Z]\+/\/trunk/")
|
||||||
|
}
|
||||||
|
alias svali_papka=download_github_folder
|
||||||
|
|
||||||
|
# Snapper wrapper for btrfs snapshots
|
||||||
|
snp() {
|
||||||
|
cmd="$@"
|
||||||
|
snapshot_nbr=$(snapper -c home create --type=pre --cleanup-algorithm=number --print-number --description="${cmd}")
|
||||||
|
eval "$cmd"
|
||||||
|
snapshot_nbr=$(snapper -c home create --type=post --cleanup-algorithm=number --print-number --pre-number="$snapshot_nbr")
|
||||||
|
}
|
||||||
|
|
||||||
|
alias sp="snapper -c home"
|
||||||
|
|
||||||
|
# YouTube playlist player
|
||||||
|
ytplaylist() {
|
||||||
|
youtube-dl -o - -f best $@ | vlc -
|
||||||
|
}
|
||||||
13
dot_oh-my-zsh/custom/keybindings.zsh
Normal file
13
dot_oh-my-zsh/custom/keybindings.zsh
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Key bindings
|
||||||
|
# Auto-loaded by oh-my-zsh from $ZSH_CUSTOM/
|
||||||
|
|
||||||
|
# Enable Ctrl-x-e to edit command line in $EDITOR
|
||||||
|
autoload -U edit-command-line
|
||||||
|
zle -N edit-command-line
|
||||||
|
bindkey '^xe' edit-command-line
|
||||||
|
bindkey '^x^e' edit-command-line
|
||||||
|
|
||||||
|
# Zsh autosuggestions (if plugin is installed)
|
||||||
|
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||||
|
bindkey '^[0' autosuggest-accept
|
||||||
|
bindkey '^[9' autosuggest-fetch
|
||||||
18
dot_oh-my-zsh/custom/path.zsh
Normal file
18
dot_oh-my-zsh/custom/path.zsh
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# PATH modifications
|
||||||
|
# Auto-loaded by oh-my-zsh from $ZSH_CUSTOM/
|
||||||
|
|
||||||
|
# Go
|
||||||
|
export GOPATH="$HOME/go"
|
||||||
|
export PATH="$HOME/go/bin:$PATH"
|
||||||
|
|
||||||
|
# Local bin
|
||||||
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
|
||||||
|
# JDK (if installed)
|
||||||
|
[[ -d /opt/jdk-12.0.1/bin ]] && export PATH="/opt/jdk-12.0.1/bin:$PATH"
|
||||||
|
|
||||||
|
# Krew (kubectl plugin manager)
|
||||||
|
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
||||||
|
|
||||||
|
# Add custom zsh functions
|
||||||
|
fpath+=~/.zfunc
|
||||||
2
dot_oh-my-zsh/custom/plugins/example/example.plugin.zsh
Normal file
2
dot_oh-my-zsh/custom/plugins/example/example.plugin.zsh
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
# Add your own custom plugins in the custom/plugins directory. Plugins placed
|
||||||
|
# here will override ones with the same name in the main plugins directory.
|
||||||
36
dot_oh-my-zsh/custom/themes/bira-time.zsh-theme
Normal file
36
dot_oh-my-zsh/custom/themes/bira-time.zsh-theme
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
# bira-time theme - bira with timestamp
|
||||||
|
# Based on bira theme, adds current time to prompt
|
||||||
|
|
||||||
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
local user_host="%B%(!.%{$fg[red]%}.%{$fg[green]%})%n@%m%{$reset_color%} "
|
||||||
|
local user_symbol='%(!.#.$)'
|
||||||
|
local current_dir="%B%{$fg[blue]%}%~ %{$reset_color%}"
|
||||||
|
local current_time="%{$fg_bold[red]%}%*%{$reset_color%} "
|
||||||
|
|
||||||
|
local vcs_branch='$(git_prompt_info)$(hg_prompt_info)'
|
||||||
|
local rvm_ruby='$(ruby_prompt_info)'
|
||||||
|
local venv_prompt='$(virtualenv_prompt_info)'
|
||||||
|
|
||||||
|
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
|
||||||
|
|
||||||
|
PROMPT="╭─${user_host}${current_time}${current_dir}${rvm_ruby}${vcs_branch}${venv_prompt}
|
||||||
|
╰─%B${user_symbol}%b "
|
||||||
|
RPROMPT="%B${return_code}%b"
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[yellow]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[yellow]%}"
|
||||||
|
|
||||||
|
ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX"
|
||||||
|
ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||||
|
ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||||
|
ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||||
|
|
||||||
|
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
|
||||||
|
ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"
|
||||||
|
|
||||||
|
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
|
||||||
|
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
|
||||||
|
ZSH_THEME_VIRTUALENV_PREFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX"
|
||||||
|
ZSH_THEME_VIRTUALENV_SUFFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX"
|
||||||
4
dot_oh-my-zsh/custom/themes/example.zsh-theme
Normal file
4
dot_oh-my-zsh/custom/themes/example.zsh-theme
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Put your custom themes in this folder.
|
||||||
|
# Example:
|
||||||
|
|
||||||
|
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
|
||||||
6
dot_oh-my-zsh/custom/tools/kubectl.zsh
Normal file
6
dot_oh-my-zsh/custom/tools/kubectl.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Kubectl configuration
|
||||||
|
# Auto-loaded by oh-my-zsh from $ZSH_CUSTOM/tools/
|
||||||
|
# Note: Completions are handled by the kubectl plugin in .zshrc
|
||||||
|
|
||||||
|
# Load golang path if exists
|
||||||
|
[[ -f /etc/profile.d/golang_path.sh ]] && source /etc/profile.d/golang_path.sh
|
||||||
6
dot_oh-my-zsh/custom/tools/nvm.zsh
Normal file
6
dot_oh-my-zsh/custom/tools/nvm.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# NVM (Node Version Manager) configuration
|
||||||
|
# Auto-loaded by oh-my-zsh from $ZSH_CUSTOM/tools/
|
||||||
|
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||||
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
||||||
23
dot_oh-my-zsh/custom/tools/pyenv.zsh
Normal file
23
dot_oh-my-zsh/custom/tools/pyenv.zsh
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Pyenv configuration
|
||||||
|
# Auto-loaded by oh-my-zsh from $ZSH_CUSTOM/tools/
|
||||||
|
|
||||||
|
export PYENV_ROOT="$HOME/.pyenv"
|
||||||
|
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
||||||
|
|
||||||
|
if command -v pyenv >/dev/null 2>&1; then
|
||||||
|
eval "$(pyenv init - zsh)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Virtualenvwrapper
|
||||||
|
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
|
||||||
|
export VIRTUALENV_PYTHON=python3
|
||||||
|
export WORKON_HOME=$HOME/.virtualenvs
|
||||||
|
|
||||||
|
if [[ -f /usr/local/bin/virtualenvwrapper.sh ]]; then
|
||||||
|
source /usr/local/bin/virtualenvwrapper.sh
|
||||||
|
elif [[ -f $HOME/.virtualenvwrapper.sh ]]; then
|
||||||
|
source $HOME/.virtualenvwrapper.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Python debugging
|
||||||
|
export PYTHONBREAKPOINT=ipdb.set_trace
|
||||||
8
dot_oh-my-zsh/dot_editorconfig
Normal file
8
dot_oh-my-zsh/dot_editorconfig
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
charset = utf-8
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
1
dot_oh-my-zsh/dot_git/FETCH_HEAD
Normal file
1
dot_oh-my-zsh/dot_git/FETCH_HEAD
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
72732a224e886933df6b64a49ec6f5e94c884612 not-for-merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
|
||||||
1
dot_oh-my-zsh/dot_git/HEAD
Normal file
1
dot_oh-my-zsh/dot_git/HEAD
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
ref: refs/heads/master
|
||||||
0
dot_oh-my-zsh/dot_git/branches/.keep
Normal file
0
dot_oh-my-zsh/dot_git/branches/.keep
Normal file
22
dot_oh-my-zsh/dot_git/config
Normal file
22
dot_oh-my-zsh/dot_git/config
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
[core]
|
||||||
|
repositoryformatversion = 0
|
||||||
|
filemode = true
|
||||||
|
bare = false
|
||||||
|
logallrefupdates = true
|
||||||
|
eol = lf
|
||||||
|
autocrlf = false
|
||||||
|
[fsck]
|
||||||
|
zeroPaddedFilemode = ignore
|
||||||
|
[fetch "fsck"]
|
||||||
|
zeroPaddedFilemode = ignore
|
||||||
|
[receive "fsck"]
|
||||||
|
zeroPaddedFilemode = ignore
|
||||||
|
[oh-my-zsh]
|
||||||
|
remote = origin
|
||||||
|
branch = master
|
||||||
|
[remote "origin"]
|
||||||
|
url = https://github.com/ohmyzsh/ohmyzsh.git
|
||||||
|
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||||
|
[branch "master"]
|
||||||
|
remote = origin
|
||||||
|
merge = refs/heads/master
|
||||||
1
dot_oh-my-zsh/dot_git/description
Normal file
1
dot_oh-my-zsh/dot_git/description
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Unnamed repository; edit this file 'description' to name the repository.
|
||||||
15
dot_oh-my-zsh/dot_git/hooks/executable_applypatch-msg.sample
Normal file
15
dot_oh-my-zsh/dot_git/hooks/executable_applypatch-msg.sample
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to check the commit log message taken by
|
||||||
|
# applypatch from an e-mail message.
|
||||||
|
#
|
||||||
|
# The hook should exit with non-zero status after issuing an
|
||||||
|
# appropriate message if it wants to stop the commit. The hook is
|
||||||
|
# allowed to edit the commit message file.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "applypatch-msg".
|
||||||
|
|
||||||
|
. git-sh-setup
|
||||||
|
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
|
||||||
|
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
|
||||||
|
:
|
||||||
24
dot_oh-my-zsh/dot_git/hooks/executable_commit-msg.sample
Normal file
24
dot_oh-my-zsh/dot_git/hooks/executable_commit-msg.sample
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to check the commit log message.
|
||||||
|
# Called by "git commit" with one argument, the name of the file
|
||||||
|
# that has the commit message. The hook should exit with non-zero
|
||||||
|
# status after issuing an appropriate message if it wants to stop the
|
||||||
|
# commit. The hook is allowed to edit the commit message file.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "commit-msg".
|
||||||
|
|
||||||
|
# Uncomment the below to add a Signed-off-by line to the message.
|
||||||
|
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
||||||
|
# hook is more suited to it.
|
||||||
|
#
|
||||||
|
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||||
|
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
||||||
|
|
||||||
|
# This example catches duplicate Signed-off-by lines.
|
||||||
|
|
||||||
|
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
||||||
|
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
||||||
|
echo >&2 Duplicate Signed-off-by lines.
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
173
dot_oh-my-zsh/dot_git/hooks/executable_fsmonitor-watchman.sample
Normal file
173
dot_oh-my-zsh/dot_git/hooks/executable_fsmonitor-watchman.sample
Normal file
|
|
@ -0,0 +1,173 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use IPC::Open2;
|
||||||
|
|
||||||
|
# An example hook script to integrate Watchman
|
||||||
|
# (https://facebook.github.io/watchman/) with git to speed up detecting
|
||||||
|
# new and modified files.
|
||||||
|
#
|
||||||
|
# The hook is passed a version (currently 2) and last update token
|
||||||
|
# formatted as a string and outputs to stdout a new update token and
|
||||||
|
# all files that have been modified since the update token. Paths must
|
||||||
|
# be relative to the root of the working tree and separated by a single NUL.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "query-watchman" and set
|
||||||
|
# 'git config core.fsmonitor .git/hooks/query-watchman'
|
||||||
|
#
|
||||||
|
my ($version, $last_update_token) = @ARGV;
|
||||||
|
|
||||||
|
# Uncomment for debugging
|
||||||
|
# print STDERR "$0 $version $last_update_token\n";
|
||||||
|
|
||||||
|
# Check the hook interface version
|
||||||
|
if ($version ne 2) {
|
||||||
|
die "Unsupported query-fsmonitor hook version '$version'.\n" .
|
||||||
|
"Falling back to scanning...\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $git_work_tree = get_working_dir();
|
||||||
|
|
||||||
|
my $retry = 1;
|
||||||
|
|
||||||
|
my $json_pkg;
|
||||||
|
eval {
|
||||||
|
require JSON::XS;
|
||||||
|
$json_pkg = "JSON::XS";
|
||||||
|
1;
|
||||||
|
} or do {
|
||||||
|
require JSON::PP;
|
||||||
|
$json_pkg = "JSON::PP";
|
||||||
|
};
|
||||||
|
|
||||||
|
launch_watchman();
|
||||||
|
|
||||||
|
sub launch_watchman {
|
||||||
|
my $o = watchman_query();
|
||||||
|
if (is_work_tree_watched($o)) {
|
||||||
|
output_result($o->{clock}, @{$o->{files}});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub output_result {
|
||||||
|
my ($clockid, @files) = @_;
|
||||||
|
|
||||||
|
# Uncomment for debugging watchman output
|
||||||
|
# open (my $fh, ">", ".git/watchman-output.out");
|
||||||
|
# binmode $fh, ":utf8";
|
||||||
|
# print $fh "$clockid\n@files\n";
|
||||||
|
# close $fh;
|
||||||
|
|
||||||
|
binmode STDOUT, ":utf8";
|
||||||
|
print $clockid;
|
||||||
|
print "\0";
|
||||||
|
local $, = "\0";
|
||||||
|
print @files;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub watchman_clock {
|
||||||
|
my $response = qx/watchman clock "$git_work_tree"/;
|
||||||
|
die "Failed to get clock id on '$git_work_tree'.\n" .
|
||||||
|
"Falling back to scanning...\n" if $? != 0;
|
||||||
|
|
||||||
|
return $json_pkg->new->utf8->decode($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub watchman_query {
|
||||||
|
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
|
||||||
|
or die "open2() failed: $!\n" .
|
||||||
|
"Falling back to scanning...\n";
|
||||||
|
|
||||||
|
# In the query expression below we're asking for names of files that
|
||||||
|
# changed since $last_update_token but not from the .git folder.
|
||||||
|
#
|
||||||
|
# To accomplish this, we're using the "since" generator to use the
|
||||||
|
# recency index to select candidate nodes and "fields" to limit the
|
||||||
|
# output to file names only. Then we're using the "expression" term to
|
||||||
|
# further constrain the results.
|
||||||
|
if (substr($last_update_token, 0, 1) eq "c") {
|
||||||
|
$last_update_token = "\"$last_update_token\"";
|
||||||
|
}
|
||||||
|
my $query = <<" END";
|
||||||
|
["query", "$git_work_tree", {
|
||||||
|
"since": $last_update_token,
|
||||||
|
"fields": ["name"],
|
||||||
|
"expression": ["not", ["dirname", ".git"]]
|
||||||
|
}]
|
||||||
|
END
|
||||||
|
|
||||||
|
# Uncomment for debugging the watchman query
|
||||||
|
# open (my $fh, ">", ".git/watchman-query.json");
|
||||||
|
# print $fh $query;
|
||||||
|
# close $fh;
|
||||||
|
|
||||||
|
print CHLD_IN $query;
|
||||||
|
close CHLD_IN;
|
||||||
|
my $response = do {local $/; <CHLD_OUT>};
|
||||||
|
|
||||||
|
# Uncomment for debugging the watch response
|
||||||
|
# open ($fh, ">", ".git/watchman-response.json");
|
||||||
|
# print $fh $response;
|
||||||
|
# close $fh;
|
||||||
|
|
||||||
|
die "Watchman: command returned no output.\n" .
|
||||||
|
"Falling back to scanning...\n" if $response eq "";
|
||||||
|
die "Watchman: command returned invalid output: $response\n" .
|
||||||
|
"Falling back to scanning...\n" unless $response =~ /^\{/;
|
||||||
|
|
||||||
|
return $json_pkg->new->utf8->decode($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub is_work_tree_watched {
|
||||||
|
my ($output) = @_;
|
||||||
|
my $error = $output->{error};
|
||||||
|
if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
|
||||||
|
$retry--;
|
||||||
|
my $response = qx/watchman watch "$git_work_tree"/;
|
||||||
|
die "Failed to make watchman watch '$git_work_tree'.\n" .
|
||||||
|
"Falling back to scanning...\n" if $? != 0;
|
||||||
|
$output = $json_pkg->new->utf8->decode($response);
|
||||||
|
$error = $output->{error};
|
||||||
|
die "Watchman: $error.\n" .
|
||||||
|
"Falling back to scanning...\n" if $error;
|
||||||
|
|
||||||
|
# Uncomment for debugging watchman output
|
||||||
|
# open (my $fh, ">", ".git/watchman-output.out");
|
||||||
|
# close $fh;
|
||||||
|
|
||||||
|
# Watchman will always return all files on the first query so
|
||||||
|
# return the fast "everything is dirty" flag to git and do the
|
||||||
|
# Watchman query just to get it over with now so we won't pay
|
||||||
|
# the cost in git to look up each individual file.
|
||||||
|
my $o = watchman_clock();
|
||||||
|
$error = $output->{error};
|
||||||
|
|
||||||
|
die "Watchman: $error.\n" .
|
||||||
|
"Falling back to scanning...\n" if $error;
|
||||||
|
|
||||||
|
output_result($o->{clock}, ("/"));
|
||||||
|
$last_update_token = $o->{clock};
|
||||||
|
|
||||||
|
eval { launch_watchman() };
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
die "Watchman: $error.\n" .
|
||||||
|
"Falling back to scanning...\n" if $error;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_working_dir {
|
||||||
|
my $working_dir;
|
||||||
|
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
|
||||||
|
$working_dir = Win32::GetCwd();
|
||||||
|
$working_dir =~ tr/\\/\//;
|
||||||
|
} else {
|
||||||
|
require Cwd;
|
||||||
|
$working_dir = Cwd::cwd();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $working_dir;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to prepare a packed repository for use over
|
||||||
|
# dumb transports.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "post-update".
|
||||||
|
|
||||||
|
exec git update-server-info
|
||||||
14
dot_oh-my-zsh/dot_git/hooks/executable_pre-applypatch.sample
Normal file
14
dot_oh-my-zsh/dot_git/hooks/executable_pre-applypatch.sample
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to verify what is about to be committed
|
||||||
|
# by applypatch from an e-mail message.
|
||||||
|
#
|
||||||
|
# The hook should exit with non-zero status after issuing an
|
||||||
|
# appropriate message if it wants to stop the commit.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "pre-applypatch".
|
||||||
|
|
||||||
|
. git-sh-setup
|
||||||
|
precommit="$(git rev-parse --git-path hooks/pre-commit)"
|
||||||
|
test -x "$precommit" && exec "$precommit" ${1+"$@"}
|
||||||
|
:
|
||||||
49
dot_oh-my-zsh/dot_git/hooks/executable_pre-commit.sample
Normal file
49
dot_oh-my-zsh/dot_git/hooks/executable_pre-commit.sample
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to verify what is about to be committed.
|
||||||
|
# Called by "git commit" with no arguments. The hook should
|
||||||
|
# exit with non-zero status after issuing an appropriate message if
|
||||||
|
# it wants to stop the commit.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "pre-commit".
|
||||||
|
|
||||||
|
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
against=HEAD
|
||||||
|
else
|
||||||
|
# Initial commit: diff against an empty tree object
|
||||||
|
against=$(git hash-object -t tree /dev/null)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If you want to allow non-ASCII filenames set this variable to true.
|
||||||
|
allownonascii=$(git config --type=bool hooks.allownonascii)
|
||||||
|
|
||||||
|
# Redirect output to stderr.
|
||||||
|
exec 1>&2
|
||||||
|
|
||||||
|
# Cross platform projects tend to avoid non-ASCII filenames; prevent
|
||||||
|
# them from being added to the repository. We exploit the fact that the
|
||||||
|
# printable range starts at the space character and ends with tilde.
|
||||||
|
if [ "$allownonascii" != "true" ] &&
|
||||||
|
# Note that the use of brackets around a tr range is ok here, (it's
|
||||||
|
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
||||||
|
# the square bracket bytes happen to fall in the designated range.
|
||||||
|
test $(git diff --cached --name-only --diff-filter=A -z $against |
|
||||||
|
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
|
||||||
|
then
|
||||||
|
cat <<\EOF
|
||||||
|
Error: Attempt to add a non-ASCII file name.
|
||||||
|
|
||||||
|
This can cause problems if you want to work with people on other platforms.
|
||||||
|
|
||||||
|
To be portable it is advisable to rename the file.
|
||||||
|
|
||||||
|
If you know what you are doing you can disable this check using:
|
||||||
|
|
||||||
|
git config hooks.allownonascii true
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If there are whitespace errors, print the offending file names and fail.
|
||||||
|
exec git diff-index --check --cached $against --
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to verify what is about to be committed.
|
||||||
|
# Called by "git merge" with no arguments. The hook should
|
||||||
|
# exit with non-zero status after issuing an appropriate message to
|
||||||
|
# stderr if it wants to stop the merge commit.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "pre-merge-commit".
|
||||||
|
|
||||||
|
. git-sh-setup
|
||||||
|
test -x "$GIT_DIR/hooks/pre-commit" &&
|
||||||
|
exec "$GIT_DIR/hooks/pre-commit"
|
||||||
|
:
|
||||||
53
dot_oh-my-zsh/dot_git/hooks/executable_pre-push.sample
Normal file
53
dot_oh-my-zsh/dot_git/hooks/executable_pre-push.sample
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# An example hook script to verify what is about to be pushed. Called by "git
|
||||||
|
# push" after it has checked the remote status, but before anything has been
|
||||||
|
# pushed. If this script exits with a non-zero status nothing will be pushed.
|
||||||
|
#
|
||||||
|
# This hook is called with the following parameters:
|
||||||
|
#
|
||||||
|
# $1 -- Name of the remote to which the push is being done
|
||||||
|
# $2 -- URL to which the push is being done
|
||||||
|
#
|
||||||
|
# If pushing without using a named remote those arguments will be equal.
|
||||||
|
#
|
||||||
|
# Information about the commits which are being pushed is supplied as lines to
|
||||||
|
# the standard input in the form:
|
||||||
|
#
|
||||||
|
# <local ref> <local oid> <remote ref> <remote oid>
|
||||||
|
#
|
||||||
|
# This sample shows how to prevent push of commits where the log message starts
|
||||||
|
# with "WIP" (work in progress).
|
||||||
|
|
||||||
|
remote="$1"
|
||||||
|
url="$2"
|
||||||
|
|
||||||
|
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
|
||||||
|
|
||||||
|
while read local_ref local_oid remote_ref remote_oid
|
||||||
|
do
|
||||||
|
if test "$local_oid" = "$zero"
|
||||||
|
then
|
||||||
|
# Handle delete
|
||||||
|
:
|
||||||
|
else
|
||||||
|
if test "$remote_oid" = "$zero"
|
||||||
|
then
|
||||||
|
# New branch, examine all commits
|
||||||
|
range="$local_oid"
|
||||||
|
else
|
||||||
|
# Update to existing branch, examine new commits
|
||||||
|
range="$remote_oid..$local_oid"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for WIP commit
|
||||||
|
commit=$(git rev-list -n 1 --grep '^WIP' "$range")
|
||||||
|
if test -n "$commit"
|
||||||
|
then
|
||||||
|
echo >&2 "Found WIP commit in $local_ref, not pushing"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
169
dot_oh-my-zsh/dot_git/hooks/executable_pre-rebase.sample
Normal file
169
dot_oh-my-zsh/dot_git/hooks/executable_pre-rebase.sample
Normal file
|
|
@ -0,0 +1,169 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006, 2008 Junio C Hamano
|
||||||
|
#
|
||||||
|
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
||||||
|
# its job, and can prevent the command from running by exiting with
|
||||||
|
# non-zero status.
|
||||||
|
#
|
||||||
|
# The hook is called with the following parameters:
|
||||||
|
#
|
||||||
|
# $1 -- the upstream the series was forked from.
|
||||||
|
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
||||||
|
#
|
||||||
|
# This sample shows how to prevent topic branches that are already
|
||||||
|
# merged to 'next' branch from getting rebased, because allowing it
|
||||||
|
# would result in rebasing already published history.
|
||||||
|
|
||||||
|
publish=next
|
||||||
|
basebranch="$1"
|
||||||
|
if test "$#" = 2
|
||||||
|
then
|
||||||
|
topic="refs/heads/$2"
|
||||||
|
else
|
||||||
|
topic=`git symbolic-ref HEAD` ||
|
||||||
|
exit 0 ;# we do not interrupt rebasing detached HEAD
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$topic" in
|
||||||
|
refs/heads/??/*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 0 ;# we do not interrupt others.
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Now we are dealing with a topic branch being rebased
|
||||||
|
# on top of master. Is it OK to rebase it?
|
||||||
|
|
||||||
|
# Does the topic really exist?
|
||||||
|
git show-ref -q "$topic" || {
|
||||||
|
echo >&2 "No such branch $topic"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Is topic fully merged to master?
|
||||||
|
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
||||||
|
if test -z "$not_in_master"
|
||||||
|
then
|
||||||
|
echo >&2 "$topic is fully merged to master; better remove it."
|
||||||
|
exit 1 ;# we could allow it, but there is no point.
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Is topic ever merged to next? If so you should not be rebasing it.
|
||||||
|
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
||||||
|
only_next_2=`git rev-list ^master ${publish} | sort`
|
||||||
|
if test "$only_next_1" = "$only_next_2"
|
||||||
|
then
|
||||||
|
not_in_topic=`git rev-list "^$topic" master`
|
||||||
|
if test -z "$not_in_topic"
|
||||||
|
then
|
||||||
|
echo >&2 "$topic is already up to date with master"
|
||||||
|
exit 1 ;# we could allow it, but there is no point.
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
||||||
|
/usr/bin/perl -e '
|
||||||
|
my $topic = $ARGV[0];
|
||||||
|
my $msg = "* $topic has commits already merged to public branch:\n";
|
||||||
|
my (%not_in_next) = map {
|
||||||
|
/^([0-9a-f]+) /;
|
||||||
|
($1 => 1);
|
||||||
|
} split(/\n/, $ARGV[1]);
|
||||||
|
for my $elem (map {
|
||||||
|
/^([0-9a-f]+) (.*)$/;
|
||||||
|
[$1 => $2];
|
||||||
|
} split(/\n/, $ARGV[2])) {
|
||||||
|
if (!exists $not_in_next{$elem->[0]}) {
|
||||||
|
if ($msg) {
|
||||||
|
print STDERR $msg;
|
||||||
|
undef $msg;
|
||||||
|
}
|
||||||
|
print STDERR " $elem->[1]\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' "$topic" "$not_in_next" "$not_in_master"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
<<\DOC_END
|
||||||
|
|
||||||
|
This sample hook safeguards topic branches that have been
|
||||||
|
published from being rewound.
|
||||||
|
|
||||||
|
The workflow assumed here is:
|
||||||
|
|
||||||
|
* Once a topic branch forks from "master", "master" is never
|
||||||
|
merged into it again (either directly or indirectly).
|
||||||
|
|
||||||
|
* Once a topic branch is fully cooked and merged into "master",
|
||||||
|
it is deleted. If you need to build on top of it to correct
|
||||||
|
earlier mistakes, a new topic branch is created by forking at
|
||||||
|
the tip of the "master". This is not strictly necessary, but
|
||||||
|
it makes it easier to keep your history simple.
|
||||||
|
|
||||||
|
* Whenever you need to test or publish your changes to topic
|
||||||
|
branches, merge them into "next" branch.
|
||||||
|
|
||||||
|
The script, being an example, hardcodes the publish branch name
|
||||||
|
to be "next", but it is trivial to make it configurable via
|
||||||
|
$GIT_DIR/config mechanism.
|
||||||
|
|
||||||
|
With this workflow, you would want to know:
|
||||||
|
|
||||||
|
(1) ... if a topic branch has ever been merged to "next". Young
|
||||||
|
topic branches can have stupid mistakes you would rather
|
||||||
|
clean up before publishing, and things that have not been
|
||||||
|
merged into other branches can be easily rebased without
|
||||||
|
affecting other people. But once it is published, you would
|
||||||
|
not want to rewind it.
|
||||||
|
|
||||||
|
(2) ... if a topic branch has been fully merged to "master".
|
||||||
|
Then you can delete it. More importantly, you should not
|
||||||
|
build on top of it -- other people may already want to
|
||||||
|
change things related to the topic as patches against your
|
||||||
|
"master", so if you need further changes, it is better to
|
||||||
|
fork the topic (perhaps with the same name) afresh from the
|
||||||
|
tip of "master".
|
||||||
|
|
||||||
|
Let's look at this example:
|
||||||
|
|
||||||
|
o---o---o---o---o---o---o---o---o---o "next"
|
||||||
|
/ / / /
|
||||||
|
/ a---a---b A / /
|
||||||
|
/ / / /
|
||||||
|
/ / c---c---c---c B /
|
||||||
|
/ / / \ /
|
||||||
|
/ / / b---b C \ /
|
||||||
|
/ / / / \ /
|
||||||
|
---o---o---o---o---o---o---o---o---o---o---o "master"
|
||||||
|
|
||||||
|
|
||||||
|
A, B and C are topic branches.
|
||||||
|
|
||||||
|
* A has one fix since it was merged up to "next".
|
||||||
|
|
||||||
|
* B has finished. It has been fully merged up to "master" and "next",
|
||||||
|
and is ready to be deleted.
|
||||||
|
|
||||||
|
* C has not merged to "next" at all.
|
||||||
|
|
||||||
|
We would want to allow C to be rebased, refuse A, and encourage
|
||||||
|
B to be deleted.
|
||||||
|
|
||||||
|
To compute (1):
|
||||||
|
|
||||||
|
git rev-list ^master ^topic next
|
||||||
|
git rev-list ^master next
|
||||||
|
|
||||||
|
if these match, topic has not merged in next at all.
|
||||||
|
|
||||||
|
To compute (2):
|
||||||
|
|
||||||
|
git rev-list master..topic
|
||||||
|
|
||||||
|
if this is empty, it is fully merged to "master".
|
||||||
|
|
||||||
|
DOC_END
|
||||||
24
dot_oh-my-zsh/dot_git/hooks/executable_pre-receive.sample
Normal file
24
dot_oh-my-zsh/dot_git/hooks/executable_pre-receive.sample
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to make use of push options.
|
||||||
|
# The example simply echoes all push options that start with 'echoback='
|
||||||
|
# and rejects all pushes when the "reject" push option is used.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "pre-receive".
|
||||||
|
|
||||||
|
if test -n "$GIT_PUSH_OPTION_COUNT"
|
||||||
|
then
|
||||||
|
i=0
|
||||||
|
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
|
||||||
|
do
|
||||||
|
eval "value=\$GIT_PUSH_OPTION_$i"
|
||||||
|
case "$value" in
|
||||||
|
echoback=*)
|
||||||
|
echo "echo from the pre-receive-hook: ${value#*=}" >&2
|
||||||
|
;;
|
||||||
|
reject)
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to prepare the commit log message.
|
||||||
|
# Called by "git commit" with the name of the file that has the
|
||||||
|
# commit message, followed by the description of the commit
|
||||||
|
# message's source. The hook's purpose is to edit the commit
|
||||||
|
# message file. If the hook fails with a non-zero status,
|
||||||
|
# the commit is aborted.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "prepare-commit-msg".
|
||||||
|
|
||||||
|
# This hook includes three examples. The first one removes the
|
||||||
|
# "# Please enter the commit message..." help message.
|
||||||
|
#
|
||||||
|
# The second includes the output of "git diff --name-status -r"
|
||||||
|
# into the message, just before the "git status" output. It is
|
||||||
|
# commented because it doesn't cope with --amend or with squashed
|
||||||
|
# commits.
|
||||||
|
#
|
||||||
|
# The third example adds a Signed-off-by line to the message, that can
|
||||||
|
# still be edited. This is rarely a good idea.
|
||||||
|
|
||||||
|
COMMIT_MSG_FILE=$1
|
||||||
|
COMMIT_SOURCE=$2
|
||||||
|
SHA1=$3
|
||||||
|
|
||||||
|
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
|
||||||
|
|
||||||
|
# case "$COMMIT_SOURCE,$SHA1" in
|
||||||
|
# ,|template,)
|
||||||
|
# /usr/bin/perl -i.bak -pe '
|
||||||
|
# print "\n" . `git diff --cached --name-status -r`
|
||||||
|
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
|
||||||
|
# *) ;;
|
||||||
|
# esac
|
||||||
|
|
||||||
|
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||||
|
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
|
||||||
|
# if test -z "$COMMIT_SOURCE"
|
||||||
|
# then
|
||||||
|
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
|
||||||
|
# fi
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# An example hook script to update a checked-out tree on a git push.
|
||||||
|
#
|
||||||
|
# This hook is invoked by git-receive-pack(1) when it reacts to git
|
||||||
|
# push and updates reference(s) in its repository, and when the push
|
||||||
|
# tries to update the branch that is currently checked out and the
|
||||||
|
# receive.denyCurrentBranch configuration variable is set to
|
||||||
|
# updateInstead.
|
||||||
|
#
|
||||||
|
# By default, such a push is refused if the working tree and the index
|
||||||
|
# of the remote repository has any difference from the currently
|
||||||
|
# checked out commit; when both the working tree and the index match
|
||||||
|
# the current commit, they are updated to match the newly pushed tip
|
||||||
|
# of the branch. This hook is to be used to override the default
|
||||||
|
# behaviour; however the code below reimplements the default behaviour
|
||||||
|
# as a starting point for convenient modification.
|
||||||
|
#
|
||||||
|
# The hook receives the commit with which the tip of the current
|
||||||
|
# branch is going to be updated:
|
||||||
|
commit=$1
|
||||||
|
|
||||||
|
# It can exit with a non-zero status to refuse the push (when it does
|
||||||
|
# so, it must not modify the index or the working tree).
|
||||||
|
die () {
|
||||||
|
echo >&2 "$*"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Or it can make any necessary changes to the working tree and to the
|
||||||
|
# index to bring them to the desired state when the tip of the current
|
||||||
|
# branch is updated to the new commit, and exit with a zero status.
|
||||||
|
#
|
||||||
|
# For example, the hook can simply run git read-tree -u -m HEAD "$1"
|
||||||
|
# in order to emulate git fetch that is run in the reverse direction
|
||||||
|
# with git push, as the two-tree form of git read-tree -u -m is
|
||||||
|
# essentially the same as git switch or git checkout that switches
|
||||||
|
# branches while keeping the local changes in the working tree that do
|
||||||
|
# not interfere with the difference between the branches.
|
||||||
|
|
||||||
|
# The below is a more-or-less exact translation to shell of the C code
|
||||||
|
# for the default behaviour for git's push-to-checkout hook defined in
|
||||||
|
# the push_to_deploy() function in builtin/receive-pack.c.
|
||||||
|
#
|
||||||
|
# Note that the hook will be executed from the repository directory,
|
||||||
|
# not from the working tree, so if you want to perform operations on
|
||||||
|
# the working tree, you will have to adapt your code accordingly, e.g.
|
||||||
|
# by adding "cd .." or using relative paths.
|
||||||
|
|
||||||
|
if ! git update-index -q --ignore-submodules --refresh
|
||||||
|
then
|
||||||
|
die "Up-to-date check failed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git diff-files --quiet --ignore-submodules --
|
||||||
|
then
|
||||||
|
die "Working directory has unstaged changes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This is a rough translation of:
|
||||||
|
#
|
||||||
|
# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
|
||||||
|
if git cat-file -e HEAD 2>/dev/null
|
||||||
|
then
|
||||||
|
head=HEAD
|
||||||
|
else
|
||||||
|
head=$(git hash-object -t tree --stdin </dev/null)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git diff-index --quiet --cached --ignore-submodules $head --
|
||||||
|
then
|
||||||
|
die "Working directory has staged changes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git read-tree -u -m "$commit"
|
||||||
|
then
|
||||||
|
die "Could not update working tree to new HEAD"
|
||||||
|
fi
|
||||||
128
dot_oh-my-zsh/dot_git/hooks/executable_update.sample
Normal file
128
dot_oh-my-zsh/dot_git/hooks/executable_update.sample
Normal file
|
|
@ -0,0 +1,128 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to block unannotated tags from entering.
|
||||||
|
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "update".
|
||||||
|
#
|
||||||
|
# Config
|
||||||
|
# ------
|
||||||
|
# hooks.allowunannotated
|
||||||
|
# This boolean sets whether unannotated tags will be allowed into the
|
||||||
|
# repository. By default they won't be.
|
||||||
|
# hooks.allowdeletetag
|
||||||
|
# This boolean sets whether deleting tags will be allowed in the
|
||||||
|
# repository. By default they won't be.
|
||||||
|
# hooks.allowmodifytag
|
||||||
|
# This boolean sets whether a tag may be modified after creation. By default
|
||||||
|
# it won't be.
|
||||||
|
# hooks.allowdeletebranch
|
||||||
|
# This boolean sets whether deleting branches will be allowed in the
|
||||||
|
# repository. By default they won't be.
|
||||||
|
# hooks.denycreatebranch
|
||||||
|
# This boolean sets whether remotely creating branches will be denied
|
||||||
|
# in the repository. By default this is allowed.
|
||||||
|
#
|
||||||
|
|
||||||
|
# --- Command line
|
||||||
|
refname="$1"
|
||||||
|
oldrev="$2"
|
||||||
|
newrev="$3"
|
||||||
|
|
||||||
|
# --- Safety check
|
||||||
|
if [ -z "$GIT_DIR" ]; then
|
||||||
|
echo "Don't run this script from the command line." >&2
|
||||||
|
echo " (if you want, you could supply GIT_DIR then run" >&2
|
||||||
|
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
||||||
|
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Config
|
||||||
|
allowunannotated=$(git config --type=bool hooks.allowunannotated)
|
||||||
|
allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
|
||||||
|
denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
|
||||||
|
allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
|
||||||
|
allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
|
||||||
|
|
||||||
|
# check for no description
|
||||||
|
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
||||||
|
case "$projectdesc" in
|
||||||
|
"Unnamed repository"* | "")
|
||||||
|
echo "*** Project description file hasn't been set" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# --- Check types
|
||||||
|
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
||||||
|
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
|
||||||
|
if [ "$newrev" = "$zero" ]; then
|
||||||
|
newrev_type=delete
|
||||||
|
else
|
||||||
|
newrev_type=$(git cat-file -t $newrev)
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$refname","$newrev_type" in
|
||||||
|
refs/tags/*,commit)
|
||||||
|
# un-annotated tag
|
||||||
|
short_refname=${refname##refs/tags/}
|
||||||
|
if [ "$allowunannotated" != "true" ]; then
|
||||||
|
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
||||||
|
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
refs/tags/*,delete)
|
||||||
|
# delete tag
|
||||||
|
if [ "$allowdeletetag" != "true" ]; then
|
||||||
|
echo "*** Deleting a tag is not allowed in this repository" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
refs/tags/*,tag)
|
||||||
|
# annotated tag
|
||||||
|
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
echo "*** Tag '$refname' already exists." >&2
|
||||||
|
echo "*** Modifying a tag is not allowed in this repository." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
refs/heads/*,commit)
|
||||||
|
# branch
|
||||||
|
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
||||||
|
echo "*** Creating a branch is not allowed in this repository" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
refs/heads/*,delete)
|
||||||
|
# delete branch
|
||||||
|
if [ "$allowdeletebranch" != "true" ]; then
|
||||||
|
echo "*** Deleting a branch is not allowed in this repository" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
refs/remotes/*,commit)
|
||||||
|
# tracking branch
|
||||||
|
;;
|
||||||
|
refs/remotes/*,delete)
|
||||||
|
# delete tracking branch
|
||||||
|
if [ "$allowdeletebranch" != "true" ]; then
|
||||||
|
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Anything else (is there anything else?)
|
||||||
|
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# --- Finished
|
||||||
|
exit 0
|
||||||
BIN
dot_oh-my-zsh/dot_git/index
Normal file
BIN
dot_oh-my-zsh/dot_git/index
Normal file
Binary file not shown.
6
dot_oh-my-zsh/dot_git/info/exclude
Normal file
6
dot_oh-my-zsh/dot_git/info/exclude
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# git ls-files --others --exclude-from=.git/info/exclude
|
||||||
|
# Lines that start with '#' are comments.
|
||||||
|
# For a project mostly in C, the following would be a good set of
|
||||||
|
# exclude patterns (uncomment them if you want to use them):
|
||||||
|
# *.[oa]
|
||||||
|
# *~
|
||||||
2
dot_oh-my-zsh/dot_git/logs/HEAD
Normal file
2
dot_oh-my-zsh/dot_git/logs/HEAD
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
0000000000000000000000000000000000000000 72732a224e886933df6b64a49ec6f5e94c884612 wizard <wizard@devvm.(none)> 1678899257 +0000 branch: Created from origin/master
|
||||||
|
72732a224e886933df6b64a49ec6f5e94c884612 72732a224e886933df6b64a49ec6f5e94c884612 wizard <wizard@devvm.(none)> 1678899257 +0000 checkout: moving from master to master
|
||||||
1
dot_oh-my-zsh/dot_git/logs/refs/heads/master
Normal file
1
dot_oh-my-zsh/dot_git/logs/refs/heads/master
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
0000000000000000000000000000000000000000 72732a224e886933df6b64a49ec6f5e94c884612 wizard <wizard@devvm.(none)> 1678899257 +0000 branch: Created from origin/master
|
||||||
1
dot_oh-my-zsh/dot_git/logs/refs/remotes/origin/master
Normal file
1
dot_oh-my-zsh/dot_git/logs/refs/remotes/origin/master
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
0000000000000000000000000000000000000000 72732a224e886933df6b64a49ec6f5e94c884612 wizard <wizard@devvm.(none)> 1678899257 +0000 fetch --depth=1 origin: storing head
|
||||||
0
dot_oh-my-zsh/dot_git/objects/info/.keep
Normal file
0
dot_oh-my-zsh/dot_git/objects/info/.keep
Normal file
Binary file not shown.
Binary file not shown.
1
dot_oh-my-zsh/dot_git/refs/heads/master
Normal file
1
dot_oh-my-zsh/dot_git/refs/heads/master
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
72732a224e886933df6b64a49ec6f5e94c884612
|
||||||
1
dot_oh-my-zsh/dot_git/refs/remotes/origin/master
Normal file
1
dot_oh-my-zsh/dot_git/refs/remotes/origin/master
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
72732a224e886933df6b64a49ec6f5e94c884612
|
||||||
0
dot_oh-my-zsh/dot_git/refs/tags/.keep
Normal file
0
dot_oh-my-zsh/dot_git/refs/tags/.keep
Normal file
1
dot_oh-my-zsh/dot_git/shallow
Normal file
1
dot_oh-my-zsh/dot_git/shallow
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
72732a224e886933df6b64a49ec6f5e94c884612
|
||||||
11
dot_oh-my-zsh/dot_github/CODEOWNERS
Normal file
11
dot_oh-my-zsh/dot_github/CODEOWNERS
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Plugin owners
|
||||||
|
plugins/archlinux/ @ratijas
|
||||||
|
plugins/genpass/ @atoponce
|
||||||
|
plugins/git-lfs/ @hellovietduc
|
||||||
|
plugins/gitfast/ @felipec
|
||||||
|
plugins/react-native @esthor
|
||||||
|
plugins/sdk/ @rgoldberg
|
||||||
|
plugins/shell-proxy/ @septs
|
||||||
|
plugins/universalarchive/ @Konfekt
|
||||||
|
plugins/wp-cli/ @joshmedeski
|
||||||
|
plugins/zoxide/ @ajeetdsouza
|
||||||
2
dot_oh-my-zsh/dot_github/FUNDING.yml
Normal file
2
dot_oh-my-zsh/dot_github/FUNDING.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
github: [ohmyzsh, robbyrussell, mcornella, larson-carter, carlosala]
|
||||||
|
open_collective: ohmyzsh
|
||||||
68
dot_oh-my-zsh/dot_github/ISSUE_TEMPLATE/bug_report.yml
Normal file
68
dot_oh-my-zsh/dot_github/ISSUE_TEMPLATE/bug_report.yml
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
name: Report a bug
|
||||||
|
description: Report a bug that isn't caused by Oh My Zsh. If unsure, use this form
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
## Self Check
|
||||||
|
- Look for similar errors in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed).
|
||||||
|
- Try reaching out on the [Discord server](https://discord.gg/ohmyzsh) for help.
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Describe the bug
|
||||||
|
description: A clear description of what the bug is.
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
description: |
|
||||||
|
Steps to reproduce the problem.
|
||||||
|
placeholder: |
|
||||||
|
For example:
|
||||||
|
1. Enable plugin '...'
|
||||||
|
2. Run command '...' or try to complete command '...'
|
||||||
|
3. See error
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Expected behavior
|
||||||
|
description: A brief description of what should happen.
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Screenshots and recordings
|
||||||
|
description: |
|
||||||
|
If applicable, add screenshots to help explain your problem. You can also record an asciinema session: https://asciinema.org/
|
||||||
|
- type: input
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: OS / Linux distribution
|
||||||
|
placeholder: Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15...
|
||||||
|
- type: input
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Zsh version
|
||||||
|
description: Run `echo $ZSH_VERSION` to check.
|
||||||
|
placeholder: "5.6"
|
||||||
|
- type: input
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Terminal emulator
|
||||||
|
placeholder: iTerm2, GNOME Terminal, Terminal.app...
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: If using WSL on Windows, which version of WSL
|
||||||
|
description: Run `wsl -l -v` to check.
|
||||||
|
options:
|
||||||
|
- WSL1
|
||||||
|
- WSL2
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Additional context
|
||||||
|
description: Add any other context about the problem here. This can be themes, plugins, custom settings...
|
||||||
77
dot_oh-my-zsh/dot_github/ISSUE_TEMPLATE/bug_report_omz.yml
Normal file
77
dot_oh-my-zsh/dot_github/ISSUE_TEMPLATE/bug_report_omz.yml
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
name: Report a bug in Oh My Zsh
|
||||||
|
description: Create a report to help us improve Oh My Zsh
|
||||||
|
labels: ['Bug']
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
## Self Check
|
||||||
|
- **Make sure this bug only happens with Oh My Zsh enabled**.
|
||||||
|
- Look for similar errors in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed).
|
||||||
|
- Try reaching out on the [Discord server](https://discord.gg/ohmyzsh) for help.
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Describe the bug
|
||||||
|
description: A clear description of what the bug is.
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
description: |
|
||||||
|
Steps to reproduce the problem.
|
||||||
|
placeholder: |
|
||||||
|
For example:
|
||||||
|
1. Enable plugin '...'
|
||||||
|
2. Run command '...' or try to complete command '...'
|
||||||
|
3. See error
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Expected behavior
|
||||||
|
description: A brief description of what should happen.
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Screenshots and recordings
|
||||||
|
description: |
|
||||||
|
If applicable, add screenshots to help explain your problem. You can also record an asciinema session: https://asciinema.org/
|
||||||
|
- type: input
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: OS / Linux distribution
|
||||||
|
placeholder: Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15...
|
||||||
|
- type: input
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Zsh version
|
||||||
|
description: Run `echo $ZSH_VERSION` to check.
|
||||||
|
placeholder: "5.6"
|
||||||
|
- type: input
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Oh My Zsh version
|
||||||
|
description: Run `omz version` to check.
|
||||||
|
placeholder: master (bf303965)
|
||||||
|
- type: input
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Terminal emulator
|
||||||
|
placeholder: iTerm2, GNOME Terminal, Terminal.app...
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: If using WSL on Windows, which version of WSL
|
||||||
|
description: Run `wsl -l -v` to check.
|
||||||
|
options:
|
||||||
|
- WSL1
|
||||||
|
- WSL2
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Additional context
|
||||||
|
description: Add any other context about the problem here. This can be themes, plugins, custom settings...
|
||||||
8
dot_oh-my-zsh/dot_github/ISSUE_TEMPLATE/config.yml
Normal file
8
dot_oh-my-zsh/dot_github/ISSUE_TEMPLATE/config.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
blank_issues_enabled: true
|
||||||
|
contact_links:
|
||||||
|
- name: Support
|
||||||
|
url: https://github.com/ohmyzsh/ohmyzsh/discussions
|
||||||
|
about: Ask the community for support
|
||||||
|
- name: Get help on Discord
|
||||||
|
url: https://discord.gg/ohmyzsh
|
||||||
|
about: Have a quick question? Join the Discord server and ask on the appropriate channel.
|
||||||
37
dot_oh-my-zsh/dot_github/ISSUE_TEMPLATE/feature_request.yml
Normal file
37
dot_oh-my-zsh/dot_github/ISSUE_TEMPLATE/feature_request.yml
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
name: Feature request
|
||||||
|
description: Suggest a feature for Oh My Zsh
|
||||||
|
labels: ["Feature"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
## Self Check
|
||||||
|
- Look for similar features in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed).
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: If the feature request is for a plugin or theme, specify it here.
|
||||||
|
description: The name of the plugin or theme that you would like us to improve.
|
||||||
|
placeholder: e.g. Git plugin, Agnoster theme
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: If the feature solves a problem you have, specify it here.
|
||||||
|
description: A description of what the problem is.
|
||||||
|
placeholder: Ex. I'm always frustrated when...
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Describe the proposed feature.
|
||||||
|
description: A description of what you want to happen. Be as specific as possible.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Describe alternatives you've considered
|
||||||
|
description: A description of any alternative solutions or features you've considered. This can also include other plugins or themes.
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Additional context
|
||||||
|
description: Add any other context, screenshots or Discord conversations about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at.
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Related Issues
|
||||||
|
description: Is there any open or closed issues that is related to this feature request? If so please link them below!
|
||||||
20
dot_oh-my-zsh/dot_github/PULL_REQUEST_TEMPLATE.md
Normal file
20
dot_oh-my-zsh/dot_github/PULL_REQUEST_TEMPLATE.md
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
## Standards checklist:
|
||||||
|
|
||||||
|
<!-- Fill with an x the ones that apply. Example: [x] -->
|
||||||
|
|
||||||
|
- [ ] The PR title is descriptive.
|
||||||
|
- [ ] The PR doesn't replicate another PR which is already open.
|
||||||
|
- [ ] I have read the contribution guide and followed all the instructions.
|
||||||
|
- [ ] The code follows the code style guide detailed in the wiki.
|
||||||
|
- [ ] The code is mine or it's from somewhere with an MIT-compatible license.
|
||||||
|
- [ ] The code is efficient, to the best of my ability, and does not waste computer resources.
|
||||||
|
- [ ] The code is stable and I have tested it myself, to the best of my abilities.
|
||||||
|
- [ ] If the code introduces new aliases, I provide a valid use case for all plugin users down below.
|
||||||
|
|
||||||
|
## Changes:
|
||||||
|
|
||||||
|
- [...]
|
||||||
|
|
||||||
|
## Other comments:
|
||||||
|
|
||||||
|
...
|
||||||
44
dot_oh-my-zsh/dot_github/workflows/main.yml
Normal file
44
dot_oh-my-zsh/dot_github/workflows/main.yml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
name: Run tests
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
steps:
|
||||||
|
- name: Set up git repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install zsh
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
run: sudo apt-get update; sudo apt-get install zsh
|
||||||
|
- name: Test installer
|
||||||
|
run: sh ./tools/install.sh
|
||||||
|
- name: Check syntax
|
||||||
|
run: |
|
||||||
|
for file in ./oh-my-zsh.sh \
|
||||||
|
./lib/*.zsh \
|
||||||
|
./plugins/*/*.plugin.zsh \
|
||||||
|
./plugins/*/_* \
|
||||||
|
./themes/*.zsh-theme; do
|
||||||
|
zsh -n "$file" || return 1
|
||||||
|
done
|
||||||
140
dot_oh-my-zsh/dot_github/workflows/project.yml
Normal file
140
dot_oh-my-zsh/dot_github/workflows/project.yml
Normal file
|
|
@ -0,0 +1,140 @@
|
||||||
|
name: Project tracking
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened, reopened]
|
||||||
|
pull_request_target:
|
||||||
|
types: [opened, reopened, synchronize]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
jobs:
|
||||||
|
add-to-project:
|
||||||
|
name: Add to project
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.PROJECT_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- name: Read project data
|
||||||
|
env:
|
||||||
|
ORGANIZATION: ohmyzsh
|
||||||
|
PROJECT_NUMBER: "1"
|
||||||
|
run: |
|
||||||
|
# Get Project data
|
||||||
|
gh api graphql -f query='
|
||||||
|
query($org: String!, $number: Int!) {
|
||||||
|
organization(login: $org){
|
||||||
|
projectV2(number: $number) {
|
||||||
|
id
|
||||||
|
fields(first:20) {
|
||||||
|
nodes {
|
||||||
|
... on ProjectV2Field {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
|
||||||
|
|
||||||
|
# Parse project data
|
||||||
|
cat >> $GITHUB_ENV <<EOF
|
||||||
|
PROJECT_ID=$(jq '.data.organization.projectV2.id' project_data.json)
|
||||||
|
PLUGIN_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json)
|
||||||
|
THEME_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Theme") | .id' project_data.json)
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Add to project
|
||||||
|
env:
|
||||||
|
ISSUE_OR_PR_ID: ${{ github.event.issue.node_id || github.event.pull_request.node_id }}
|
||||||
|
run: |
|
||||||
|
item_id="$(gh api graphql -f query='
|
||||||
|
mutation($project: ID!, $content: ID!) {
|
||||||
|
addProjectV2ItemById(input: {projectId: $project, contentId: $content}) {
|
||||||
|
item {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' -f project=$PROJECT_ID -f content=$ISSUE_OR_PR_ID --jq '.data.addProjectV2ItemById.item.id')"
|
||||||
|
|
||||||
|
echo "ITEM_ID=$item_id" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Classify Pull Request
|
||||||
|
if: github.event_name == 'pull_request_target'
|
||||||
|
run: |
|
||||||
|
touch plugins.list themes.list
|
||||||
|
|
||||||
|
gh pr view ${{ github.event.pull_request.number }} \
|
||||||
|
--repo ${{ github.repository }} \
|
||||||
|
--json files --jq '.files.[].path' | awk -F/ '
|
||||||
|
/^plugins\// {
|
||||||
|
plugins[$2] = 1
|
||||||
|
}
|
||||||
|
/^themes\// {
|
||||||
|
gsub(/\.zsh-theme$/, "", $2)
|
||||||
|
themes[$2] = 1
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
for (plugin in plugins) {
|
||||||
|
print plugin >> "plugins.list"
|
||||||
|
}
|
||||||
|
for (theme in themes) {
|
||||||
|
print theme >> "themes.list"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'
|
||||||
|
# If only one plugin is modified, add it to the plugin field
|
||||||
|
if [[ $(wc -l < plugins.list) = 1 ]]; then
|
||||||
|
echo "PLUGIN=$(cat plugins.list)" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
# If only one theme is modified, add it to the theme field
|
||||||
|
if [[ $(wc -l < themes.list) = 1 ]]; then
|
||||||
|
echo "THEME=$(cat themes.list)" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Fill Pull Request fields in project
|
||||||
|
if: github.event_name == 'pull_request_target'
|
||||||
|
run: |
|
||||||
|
gh api graphql -f query='
|
||||||
|
mutation (
|
||||||
|
$project: ID!
|
||||||
|
$item: ID!
|
||||||
|
$plugin_field: ID!
|
||||||
|
$plugin_value: String!
|
||||||
|
$theme_field: ID!
|
||||||
|
$theme_value: String!
|
||||||
|
) {
|
||||||
|
set_plugin: updateProjectV2ItemFieldValue(input: {
|
||||||
|
projectId: $project
|
||||||
|
itemId: $item
|
||||||
|
fieldId: $plugin_field
|
||||||
|
value: {
|
||||||
|
text: $plugin_value
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
projectV2Item {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set_theme: updateProjectV2ItemFieldValue(input: {
|
||||||
|
projectId: $project
|
||||||
|
itemId: $item
|
||||||
|
fieldId: $theme_field
|
||||||
|
value: {
|
||||||
|
text: $theme_value
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
projectV2Item {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' -f project=$PROJECT_ID -f item=$ITEM_ID \
|
||||||
|
-f plugin_field=$PLUGIN_FIELD_ID -f plugin_value=$PLUGIN \
|
||||||
|
-f theme_field=$THEME_FIELD_ID -f theme_value=$THEME \
|
||||||
|
--silent
|
||||||
12
dot_oh-my-zsh/dot_gitignore
Normal file
12
dot_oh-my-zsh/dot_gitignore
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# custom files
|
||||||
|
custom/
|
||||||
|
|
||||||
|
# temp files directories
|
||||||
|
cache/
|
||||||
|
log/
|
||||||
|
*.swp
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# editor configs
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
5
dot_oh-my-zsh/dot_gitpod.Dockerfile
Normal file
5
dot_oh-my-zsh/dot_gitpod.Dockerfile
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
FROM gitpod/workspace-full
|
||||||
|
|
||||||
|
RUN sudo apt-get update && \
|
||||||
|
sudo apt-get install -y zsh && \
|
||||||
|
sudo rm -rf /var/lib/apt/lists/*
|
||||||
9
dot_oh-my-zsh/dot_gitpod.yml
Normal file
9
dot_oh-my-zsh/dot_gitpod.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
image:
|
||||||
|
file: .gitpod.Dockerfile
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- init: |
|
||||||
|
export EDITOR="command gp open -w" VISUAL="command gp open -w"
|
||||||
|
cp -f /workspace/ohmyzsh/templates/zshrc.zsh-template ~/.zshrc
|
||||||
|
ln -sf /workspace/ohmyzsh ~/.oh-my-zsh
|
||||||
|
command: exec zsh
|
||||||
4
dot_oh-my-zsh/dot_prettierrc
Normal file
4
dot_oh-my-zsh/dot_prettierrc
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"printWidth": 110,
|
||||||
|
"proseWrap": "always"
|
||||||
|
}
|
||||||
10
dot_oh-my-zsh/lib/bzr.zsh
Normal file
10
dot_oh-my-zsh/lib/bzr.zsh
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
## Bazaar integration
|
||||||
|
## Just works with the GIT integration just add $(bzr_prompt_info) to the PROMPT
|
||||||
|
function bzr_prompt_info() {
|
||||||
|
BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'`
|
||||||
|
if [ -n "$BZR_CB" ]; then
|
||||||
|
BZR_DIRTY=""
|
||||||
|
[[ -n `bzr status` ]] && BZR_DIRTY=" %{$fg[red]%} * %{$fg[green]%}"
|
||||||
|
echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||||
|
fi
|
||||||
|
}
|
||||||
820
dot_oh-my-zsh/lib/cli.zsh
Normal file
820
dot_oh-my-zsh/lib/cli.zsh
Normal file
|
|
@ -0,0 +1,820 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
function omz {
|
||||||
|
[[ $# -gt 0 ]] || {
|
||||||
|
_omz::help
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
local command="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
# Subcommand functions start with _ so that they don't
|
||||||
|
# appear as completion entries when looking for `omz`
|
||||||
|
(( $+functions[_omz::$command] )) || {
|
||||||
|
_omz::help
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_omz::$command "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz {
|
||||||
|
local -a cmds subcmds
|
||||||
|
cmds=(
|
||||||
|
'changelog:Print the changelog'
|
||||||
|
'help:Usage information'
|
||||||
|
'plugin:Manage plugins'
|
||||||
|
'pr:Manage Oh My Zsh Pull Requests'
|
||||||
|
'reload:Reload the current zsh session'
|
||||||
|
'theme:Manage themes'
|
||||||
|
'update:Update Oh My Zsh'
|
||||||
|
'version:Show the version'
|
||||||
|
)
|
||||||
|
|
||||||
|
if (( CURRENT == 2 )); then
|
||||||
|
_describe 'command' cmds
|
||||||
|
elif (( CURRENT == 3 )); then
|
||||||
|
case "$words[2]" in
|
||||||
|
changelog) local -a refs
|
||||||
|
refs=("${(@f)$(builtin cd -q "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
|
||||||
|
_describe 'command' refs ;;
|
||||||
|
plugin) subcmds=(
|
||||||
|
'disable:Disable plugin(s)'
|
||||||
|
'enable:Enable plugin(s)'
|
||||||
|
'info:Get plugin information'
|
||||||
|
'list:List plugins'
|
||||||
|
'load:Load plugin(s)'
|
||||||
|
)
|
||||||
|
_describe 'command' subcmds ;;
|
||||||
|
pr) subcmds=('clean:Delete all Pull Request branches' 'test:Test a Pull Request')
|
||||||
|
_describe 'command' subcmds ;;
|
||||||
|
theme) subcmds=('list:List themes' 'set:Set a theme in your .zshrc file' 'use:Load a theme')
|
||||||
|
_describe 'command' subcmds ;;
|
||||||
|
esac
|
||||||
|
elif (( CURRENT == 4 )); then
|
||||||
|
case "${words[2]}::${words[3]}" in
|
||||||
|
plugin::(disable|enable|load))
|
||||||
|
local -aU valid_plugins
|
||||||
|
|
||||||
|
if [[ "${words[3]}" = disable ]]; then
|
||||||
|
# if command is "disable", only offer already enabled plugins
|
||||||
|
valid_plugins=($plugins)
|
||||||
|
else
|
||||||
|
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
|
||||||
|
# if command is "enable", remove already enabled plugins
|
||||||
|
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
|
||||||
|
fi
|
||||||
|
|
||||||
|
_describe 'plugin' valid_plugins ;;
|
||||||
|
plugin::info)
|
||||||
|
local -aU plugins
|
||||||
|
plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
|
||||||
|
_describe 'plugin' plugins ;;
|
||||||
|
theme::(set|use))
|
||||||
|
local -aU themes
|
||||||
|
themes=("$ZSH"/themes/*.zsh-theme(-.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(-.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
|
||||||
|
_describe 'theme' themes ;;
|
||||||
|
esac
|
||||||
|
elif (( CURRENT > 4 )); then
|
||||||
|
case "${words[2]}::${words[3]}" in
|
||||||
|
plugin::(enable|disable|load))
|
||||||
|
local -aU valid_plugins
|
||||||
|
|
||||||
|
if [[ "${words[3]}" = disable ]]; then
|
||||||
|
# if command is "disable", only offer already enabled plugins
|
||||||
|
valid_plugins=($plugins)
|
||||||
|
else
|
||||||
|
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
|
||||||
|
# if command is "enable", remove already enabled plugins
|
||||||
|
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove plugins already passed as arguments
|
||||||
|
# NOTE: $(( CURRENT - 1 )) is the last plugin argument completely passed, i.e. that which
|
||||||
|
# has a space after them. This is to avoid removing plugins partially passed, which makes
|
||||||
|
# the completion not add a space after the completed plugin.
|
||||||
|
local -a args
|
||||||
|
args=(${words[4,$(( CURRENT - 1))]})
|
||||||
|
valid_plugins=(${valid_plugins:|args})
|
||||||
|
|
||||||
|
_describe 'plugin' valid_plugins ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# If run from a script, do not set the completion function
|
||||||
|
if (( ${+functions[compdef]} )); then
|
||||||
|
compdef _omz omz
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Utility functions
|
||||||
|
|
||||||
|
function _omz::confirm {
|
||||||
|
# If question supplied, ask it before reading the answer
|
||||||
|
# NOTE: uses the logname of the caller function
|
||||||
|
if [[ -n "$1" ]]; then
|
||||||
|
_omz::log prompt "$1" "${${functrace[1]#_}%:*}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Read one character
|
||||||
|
read -r -k 1
|
||||||
|
|
||||||
|
# If no newline entered, add a newline
|
||||||
|
if [[ "$REPLY" != $'\n' ]]; then
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::log {
|
||||||
|
# if promptsubst is set, a message with `` or $()
|
||||||
|
# will be run even if quoted due to `print -P`
|
||||||
|
setopt localoptions nopromptsubst
|
||||||
|
|
||||||
|
# $1 = info|warn|error|debug
|
||||||
|
# $2 = text
|
||||||
|
# $3 = (optional) name of the logger
|
||||||
|
|
||||||
|
local logtype=$1
|
||||||
|
local logname=${3:-${${functrace[1]#_}%:*}}
|
||||||
|
|
||||||
|
# Don't print anything if debug is not active
|
||||||
|
if [[ $logtype = debug && -z $_OMZ_DEBUG ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Choose coloring based on log type
|
||||||
|
case "$logtype" in
|
||||||
|
prompt) print -Pn "%S%F{blue}$logname%f%s: $2" ;;
|
||||||
|
debug) print -P "%F{white}$logname%f: $2" ;;
|
||||||
|
info) print -P "%F{green}$logname%f: $2" ;;
|
||||||
|
warn) print -P "%S%F{yellow}$logname%f%s: $2" ;;
|
||||||
|
error) print -P "%S%F{red}$logname%f%s: $2" ;;
|
||||||
|
esac >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
## User-facing commands
|
||||||
|
|
||||||
|
function _omz::help {
|
||||||
|
cat >&2 <<EOF
|
||||||
|
Usage: omz <command> [options]
|
||||||
|
|
||||||
|
Available commands:
|
||||||
|
|
||||||
|
help Print this help message
|
||||||
|
changelog Print the changelog
|
||||||
|
plugin <command> Manage plugins
|
||||||
|
pr <command> Manage Oh My Zsh Pull Requests
|
||||||
|
reload Reload the current zsh session
|
||||||
|
theme <command> Manage themes
|
||||||
|
update Update Oh My Zsh
|
||||||
|
version Show the version
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::changelog {
|
||||||
|
local version=${1:-HEAD} format=${3:-"--text"}
|
||||||
|
|
||||||
|
if (
|
||||||
|
builtin cd -q "$ZSH"
|
||||||
|
! command git show-ref --verify refs/heads/$version && \
|
||||||
|
! command git show-ref --verify refs/tags/$version && \
|
||||||
|
! command git rev-parse --verify "${version}^{commit}"
|
||||||
|
) &>/dev/null; then
|
||||||
|
cat >&2 <<EOF
|
||||||
|
Usage: ${(j: :)${(s.::.)0#_}} [version]
|
||||||
|
|
||||||
|
NOTE: <version> must be a valid branch, tag or commit.
|
||||||
|
EOF
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$ZSH/tools/changelog.sh" "$version" "${2:-}" "$format"
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::plugin {
|
||||||
|
(( $# > 0 && $+functions[$0::$1] )) || {
|
||||||
|
cat >&2 <<EOF
|
||||||
|
Usage: ${(j: :)${(s.::.)0#_}} <command> [options]
|
||||||
|
|
||||||
|
Available commands:
|
||||||
|
|
||||||
|
disable <plugin> Disable plugin(s)
|
||||||
|
enable <plugin> Enable plugin(s)
|
||||||
|
info <plugin> Get information of a plugin
|
||||||
|
list List all available Oh My Zsh plugins
|
||||||
|
load <plugin> Load plugin(s)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
local command="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
$0::$command "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::plugin::disable {
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <plugin> [...]"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that plugin is in $plugins
|
||||||
|
local -a dis_plugins
|
||||||
|
for plugin in "$@"; do
|
||||||
|
if [[ ${plugins[(Ie)$plugin]} -eq 0 ]]; then
|
||||||
|
_omz::log warn "plugin '$plugin' is not enabled."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
dis_plugins+=("$plugin")
|
||||||
|
done
|
||||||
|
|
||||||
|
# Exit if there are no enabled plugins to disable
|
||||||
|
if [[ ${#dis_plugins} -eq 0 ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove plugins substitution awk script
|
||||||
|
local awk_subst_plugins="\
|
||||||
|
gsub(/[ \t]+(${(j:|:)dis_plugins})/, \"\") # with spaces before
|
||||||
|
gsub(/(${(j:|:)dis_plugins})[ \t]+/, \"\") # with spaces after
|
||||||
|
gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin)
|
||||||
|
"
|
||||||
|
# Disable plugins awk script
|
||||||
|
local awk_script="
|
||||||
|
# if plugins=() is in oneline form, substitute disabled plugins and go to next line
|
||||||
|
/^[ \t]*plugins=\([^#]+\).*\$/ {
|
||||||
|
$awk_subst_plugins
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
# if plugins=() is in multiline form, enable multi flag and disable plugins if they're there
|
||||||
|
/^[ \t]*plugins=\(/ {
|
||||||
|
multi=1
|
||||||
|
$awk_subst_plugins
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
# if multi flag is enabled and we find a valid closing parenthesis, remove plugins and disable multi flag
|
||||||
|
multi == 1 && /^[^#]*\)/ {
|
||||||
|
multi=0
|
||||||
|
$awk_subst_plugins
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
multi == 1 && length(\$0) > 0 {
|
||||||
|
$awk_subst_plugins
|
||||||
|
if (length(\$0) > 0) print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
{ print \$0 }
|
||||||
|
"
|
||||||
|
|
||||||
|
local zdot="${ZDOTDIR:-$HOME}"
|
||||||
|
local zshrc="${${:-"${zdot}/.zshrc"}:A}"
|
||||||
|
awk "$awk_script" "$zshrc" > "$zdot/.zshrc.new" \
|
||||||
|
&& command cp -f "$zshrc" "$zdot/.zshrc.bck" \
|
||||||
|
&& command mv -f "$zdot/.zshrc.new" "$zshrc"
|
||||||
|
|
||||||
|
# Exit if the new .zshrc file wasn't created correctly
|
||||||
|
[[ $? -eq 0 ]] || {
|
||||||
|
local ret=$?
|
||||||
|
_omz::log error "error disabling plugins."
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
# Exit if the new .zshrc file has syntax errors
|
||||||
|
if ! command zsh -n "$zdot/.zshrc"; then
|
||||||
|
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
|
||||||
|
command mv -f "$zdot/.zshrc.bck" "$zshrc"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restart the zsh session if there were no errors
|
||||||
|
_omz::log info "plugins disabled: ${(j:, :)dis_plugins}."
|
||||||
|
|
||||||
|
# Only reload zsh if run in an interactive session
|
||||||
|
[[ ! -o interactive ]] || _omz::reload
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::plugin::enable {
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <plugin> [...]"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that plugin is not in $plugins
|
||||||
|
local -a add_plugins
|
||||||
|
for plugin in "$@"; do
|
||||||
|
if [[ ${plugins[(Ie)$plugin]} -ne 0 ]]; then
|
||||||
|
_omz::log warn "plugin '$plugin' is already enabled."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
add_plugins+=("$plugin")
|
||||||
|
done
|
||||||
|
|
||||||
|
# Exit if there are no plugins to enable
|
||||||
|
if [[ ${#add_plugins} -eq 0 ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable plugins awk script
|
||||||
|
local awk_script="
|
||||||
|
# if plugins=() is in oneline form, substitute ) with new plugins and go to the next line
|
||||||
|
/^[ \t]*plugins=\([^#]+\).*\$/ {
|
||||||
|
sub(/\)/, \" $add_plugins&\")
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
# if plugins=() is in multiline form, enable multi flag
|
||||||
|
/^[ \t]*plugins=\(/ {
|
||||||
|
multi=1
|
||||||
|
}
|
||||||
|
|
||||||
|
# if multi flag is enabled and we find a valid closing parenthesis,
|
||||||
|
# add new plugins and disable multi flag
|
||||||
|
multi == 1 && /^[^#]*\)/ {
|
||||||
|
multi=0
|
||||||
|
sub(/\)/, \" $add_plugins&\")
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
{ print \$0 }
|
||||||
|
"
|
||||||
|
|
||||||
|
local zdot="${ZDOTDIR:-$HOME}"
|
||||||
|
local zshrc="${${:-"${zdot}/.zshrc"}:A}"
|
||||||
|
awk "$awk_script" "$zshrc" > "$zdot/.zshrc.new" \
|
||||||
|
&& command cp -f "$zshrc" "$zdot/.zshrc.bck" \
|
||||||
|
&& command mv -f "$zdot/.zshrc.new" "$zshrc"
|
||||||
|
|
||||||
|
# Exit if the new .zshrc file wasn't created correctly
|
||||||
|
[[ $? -eq 0 ]] || {
|
||||||
|
local ret=$?
|
||||||
|
_omz::log error "error enabling plugins."
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
# Exit if the new .zshrc file has syntax errors
|
||||||
|
if ! command zsh -n "$zdot/.zshrc"; then
|
||||||
|
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
|
||||||
|
command mv -f "$zdot/.zshrc.bck" "$zshrc"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restart the zsh session if there were no errors
|
||||||
|
_omz::log info "plugins enabled: ${(j:, :)add_plugins}."
|
||||||
|
|
||||||
|
# Only reload zsh if run in an interactive session
|
||||||
|
[[ ! -o interactive ]] || _omz::reload
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::plugin::info {
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <plugin>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local readme
|
||||||
|
for readme in "$ZSH_CUSTOM/plugins/$1/README.md" "$ZSH/plugins/$1/README.md"; do
|
||||||
|
if [[ -f "$readme" ]]; then
|
||||||
|
(( ${+commands[less]} )) && less "$readme" || cat "$readme"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -d "$ZSH_CUSTOM/plugins/$1" || -d "$ZSH/plugins/$1" ]]; then
|
||||||
|
_omz::log error "the '$1' plugin doesn't have a README file"
|
||||||
|
else
|
||||||
|
_omz::log error "'$1' plugin not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::plugin::list {
|
||||||
|
local -a custom_plugins builtin_plugins
|
||||||
|
custom_plugins=("$ZSH_CUSTOM"/plugins/*(-/N:t))
|
||||||
|
builtin_plugins=("$ZSH"/plugins/*(-/N:t))
|
||||||
|
|
||||||
|
# If the command is being piped, print all found line by line
|
||||||
|
if [[ ! -t 1 ]]; then
|
||||||
|
print -l ${(q-)custom_plugins} ${(q-)builtin_plugins}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( ${#custom_plugins} )); then
|
||||||
|
print -P "%U%BCustom plugins%b%u:"
|
||||||
|
print -lac ${(q-)custom_plugins}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( ${#builtin_plugins} )); then
|
||||||
|
(( ${#custom_plugins} )) && echo # add a line of separation
|
||||||
|
|
||||||
|
print -P "%U%BBuilt-in plugins%b%u:"
|
||||||
|
print -lac ${(q-)builtin_plugins}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::plugin::load {
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <plugin> [...]"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local plugin base has_completion=0
|
||||||
|
for plugin in "$@"; do
|
||||||
|
if [[ -d "$ZSH_CUSTOM/plugins/$plugin" ]]; then
|
||||||
|
base="$ZSH_CUSTOM/plugins/$plugin"
|
||||||
|
elif [[ -d "$ZSH/plugins/$plugin" ]]; then
|
||||||
|
base="$ZSH/plugins/$plugin"
|
||||||
|
else
|
||||||
|
_omz::log warn "plugin '$plugin' not found"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if its a valid plugin
|
||||||
|
if [[ ! -f "$base/_$plugin" && ! -f "$base/$plugin.plugin.zsh" ]]; then
|
||||||
|
_omz::log warn "'$plugin' is not a valid plugin"
|
||||||
|
continue
|
||||||
|
# It it is a valid plugin, add its directory to $fpath unless it is already there
|
||||||
|
elif (( ! ${fpath[(Ie)$base]} )); then
|
||||||
|
fpath=("$base" $fpath)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if it has completion to reload compinit
|
||||||
|
local -a comp_files
|
||||||
|
comp_files=($base/_*(N))
|
||||||
|
has_completion=$(( $#comp_files > 0 ))
|
||||||
|
|
||||||
|
# Load the plugin
|
||||||
|
if [[ -f "$base/$plugin.plugin.zsh" ]]; then
|
||||||
|
source "$base/$plugin.plugin.zsh"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# If we have completion, we need to reload the completion
|
||||||
|
# We pass -D to avoid generating a new dump file, which would overwrite our
|
||||||
|
# current one for the next session (and we don't want that because we're not
|
||||||
|
# actually enabling the plugins for the next session).
|
||||||
|
# Note that we still have to pass -d "$_comp_dumpfile", so that compinit
|
||||||
|
# doesn't use the default zcompdump location (${ZDOTDIR:-$HOME}/.zcompdump).
|
||||||
|
if (( has_completion )); then
|
||||||
|
compinit -D -d "$_comp_dumpfile"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::pr {
|
||||||
|
(( $# > 0 && $+functions[$0::$1] )) || {
|
||||||
|
cat >&2 <<EOF
|
||||||
|
Usage: ${(j: :)${(s.::.)0#_}} <command> [options]
|
||||||
|
|
||||||
|
Available commands:
|
||||||
|
|
||||||
|
clean Delete all PR branches (ohmyzsh/pull-*)
|
||||||
|
test <PR_number_or_URL> Fetch PR #NUMBER and rebase against master
|
||||||
|
|
||||||
|
EOF
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
local command="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
$0::$command "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::pr::clean {
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
builtin cd -q "$ZSH"
|
||||||
|
|
||||||
|
# Check if there are PR branches
|
||||||
|
local fmt branches
|
||||||
|
fmt="%(color:bold blue)%(align:18,right)%(refname:short)%(end)%(color:reset) %(color:dim bold red)%(objectname:short)%(color:reset) %(color:yellow)%(contents:subject)"
|
||||||
|
branches="$(command git for-each-ref --sort=-committerdate --color --format="$fmt" "refs/heads/ohmyzsh/pull-*")"
|
||||||
|
|
||||||
|
# Exit if there are no PR branches
|
||||||
|
if [[ -z "$branches" ]]; then
|
||||||
|
_omz::log info "there are no Pull Request branches to remove."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print found PR branches
|
||||||
|
echo "$branches\n"
|
||||||
|
# Confirm before removing the branches
|
||||||
|
_omz::confirm "do you want remove these Pull Request branches? [Y/n] "
|
||||||
|
# Only proceed if the answer is a valid yes option
|
||||||
|
[[ "$REPLY" != [yY$'\n'] ]] && return
|
||||||
|
|
||||||
|
_omz::log info "removing all Oh My Zsh Pull Request branches..."
|
||||||
|
command git branch --list 'ohmyzsh/pull-*' | while read branch; do
|
||||||
|
command git branch -D "$branch"
|
||||||
|
done
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::pr::test {
|
||||||
|
# Allow $1 to be a URL to the pull request
|
||||||
|
if [[ "$1" = https://* ]]; then
|
||||||
|
1="${1:t}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check the input
|
||||||
|
if ! [[ -n "$1" && "$1" =~ ^[[:digit:]]+$ ]]; then
|
||||||
|
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <PR_NUMBER_or_URL>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Save current git HEAD
|
||||||
|
local branch
|
||||||
|
branch=$(builtin cd -q "$ZSH"; git symbolic-ref --short HEAD) || {
|
||||||
|
_omz::log error "error when getting the current git branch. Aborting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Fetch PR onto ohmyzsh/pull-<PR_NUMBER> branch and rebase against master
|
||||||
|
# If any of these operations fail, undo the changes made
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
builtin cd -q "$ZSH"
|
||||||
|
|
||||||
|
# Get the ohmyzsh git remote
|
||||||
|
command git remote -v | while read remote url _; do
|
||||||
|
case "$url" in
|
||||||
|
https://github.com/ohmyzsh/ohmyzsh(|.git)) found=1; break ;;
|
||||||
|
git@github.com:ohmyzsh/ohmyzsh(|.git)) found=1; break ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
(( $found )) || {
|
||||||
|
_omz::log error "could not found the ohmyzsh git remote. Aborting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fetch pull request head
|
||||||
|
_omz::log info "fetching PR #$1 to ohmyzsh/pull-$1..."
|
||||||
|
command git fetch -f "$remote" refs/pull/$1/head:ohmyzsh/pull-$1 || {
|
||||||
|
_omz::log error "error when trying to fetch PR #$1."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Rebase pull request branch against the current master
|
||||||
|
_omz::log info "rebasing PR #$1..."
|
||||||
|
local ret gpgsign
|
||||||
|
{
|
||||||
|
# Back up commit.gpgsign setting: use --local to get the current repository
|
||||||
|
# setting, not the global one. If --local is not a known option, it will
|
||||||
|
# exit with a 129 status code.
|
||||||
|
gpgsign=$(command git config --local commit.gpgsign 2>/dev/null) || ret=$?
|
||||||
|
[[ $ret -ne 129 ]] || gpgsign=$(command git config commit.gpgsign 2>/dev/null)
|
||||||
|
command git config commit.gpgsign false
|
||||||
|
|
||||||
|
command git rebase master ohmyzsh/pull-$1 || {
|
||||||
|
command git rebase --abort &>/dev/null
|
||||||
|
_omz::log warn "could not rebase PR #$1 on top of master."
|
||||||
|
_omz::log warn "you might not see the latest stable changes."
|
||||||
|
_omz::log info "run \`zsh\` to test the changes."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
} always {
|
||||||
|
case "$gpgsign" in
|
||||||
|
"") command git config --unset commit.gpgsign ;;
|
||||||
|
*) command git config commit.gpgsign "$gpgsign" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_omz::log info "fetch of PR #${1} successful."
|
||||||
|
)
|
||||||
|
|
||||||
|
# If there was an error, abort running zsh to test the PR
|
||||||
|
[[ $? -eq 0 ]] || return 1
|
||||||
|
|
||||||
|
# Run zsh to test the changes
|
||||||
|
_omz::log info "running \`zsh\` to test the changes. Run \`exit\` to go back."
|
||||||
|
command zsh -l
|
||||||
|
|
||||||
|
# After testing, go back to the previous HEAD if the user wants
|
||||||
|
_omz::confirm "do you want to go back to the previous branch? [Y/n] "
|
||||||
|
# Only proceed if the answer is a valid yes option
|
||||||
|
[[ "$REPLY" != [yY$'\n'] ]] && return
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
builtin cd -q "$ZSH"
|
||||||
|
|
||||||
|
command git checkout "$branch" -- || {
|
||||||
|
_omz::log error "could not go back to the previous branch ('$branch')."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::reload {
|
||||||
|
# Delete current completion cache
|
||||||
|
command rm -f $_comp_dumpfile $ZSH_COMPDUMP
|
||||||
|
|
||||||
|
# Old zsh versions don't have ZSH_ARGZERO
|
||||||
|
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
||||||
|
# Check whether to run a login shell
|
||||||
|
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::theme {
|
||||||
|
(( $# > 0 && $+functions[$0::$1] )) || {
|
||||||
|
cat >&2 <<EOF
|
||||||
|
Usage: ${(j: :)${(s.::.)0#_}} <command> [options]
|
||||||
|
|
||||||
|
Available commands:
|
||||||
|
|
||||||
|
list List all available Oh My Zsh themes
|
||||||
|
set <theme> Set a theme in your .zshrc file
|
||||||
|
use <theme> Load a theme
|
||||||
|
|
||||||
|
EOF
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
local command="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
$0::$command "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::theme::list {
|
||||||
|
local -a custom_themes builtin_themes
|
||||||
|
custom_themes=("$ZSH_CUSTOM"/**/*.zsh-theme(-.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
|
||||||
|
builtin_themes=("$ZSH"/themes/*.zsh-theme(-.N:t:r))
|
||||||
|
|
||||||
|
# If the command is being piped, print all found line by line
|
||||||
|
if [[ ! -t 1 ]]; then
|
||||||
|
print -l ${(q-)custom_themes} ${(q-)builtin_themes}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print theme in use
|
||||||
|
if [[ -n "$ZSH_THEME" ]]; then
|
||||||
|
print -Pn "%U%BCurrent theme%b%u: "
|
||||||
|
[[ $ZSH_THEME = random ]] && echo "$RANDOM_THEME (via random)" || echo "$ZSH_THEME"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print custom themes if there are any
|
||||||
|
if (( ${#custom_themes} )); then
|
||||||
|
print -P "%U%BCustom themes%b%u:"
|
||||||
|
print -lac ${(q-)custom_themes}
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print built-in themes
|
||||||
|
print -P "%U%BBuilt-in themes%b%u:"
|
||||||
|
print -lac ${(q-)builtin_themes}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::theme::set {
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <theme>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that theme exists
|
||||||
|
if [[ ! -f "$ZSH_CUSTOM/$1.zsh-theme" ]] \
|
||||||
|
&& [[ ! -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]] \
|
||||||
|
&& [[ ! -f "$ZSH/themes/$1.zsh-theme" ]]; then
|
||||||
|
_omz::log error "%B$1%b theme not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable theme in .zshrc
|
||||||
|
local awk_script='
|
||||||
|
!set && /^[ \t]*ZSH_THEME=[^#]+.*$/ {
|
||||||
|
set=1
|
||||||
|
sub(/^[ \t]*ZSH_THEME=[^#]+.*$/, "ZSH_THEME=\"'$1'\" # set by `omz`")
|
||||||
|
print $0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
{ print $0 }
|
||||||
|
|
||||||
|
END {
|
||||||
|
# If no ZSH_THEME= line was found, return an error
|
||||||
|
if (!set) exit 1
|
||||||
|
}
|
||||||
|
'
|
||||||
|
|
||||||
|
local zdot="${ZDOTDIR:-$HOME}"
|
||||||
|
local zshrc="${${:-"${zdot}/.zshrc"}:A}"
|
||||||
|
awk "$awk_script" "$zshrc" > "$zdot/.zshrc.new" \
|
||||||
|
|| {
|
||||||
|
# Prepend ZSH_THEME= line to .zshrc if it doesn't exist
|
||||||
|
cat <<EOF
|
||||||
|
ZSH_THEME="$1" # set by \`omz\`
|
||||||
|
|
||||||
|
EOF
|
||||||
|
cat "$zdot/.zshrc"
|
||||||
|
} > "$zdot/.zshrc.new" \
|
||||||
|
&& command cp -f "$zshrc" "$zdot/.zshrc.bck" \
|
||||||
|
&& command mv -f "$zdot/.zshrc.new" "$zshrc"
|
||||||
|
|
||||||
|
# Exit if the new .zshrc file wasn't created correctly
|
||||||
|
[[ $? -eq 0 ]] || {
|
||||||
|
local ret=$?
|
||||||
|
_omz::log error "error setting theme."
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
# Exit if the new .zshrc file has syntax errors
|
||||||
|
if ! command zsh -n "$zdot/.zshrc"; then
|
||||||
|
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
|
||||||
|
command mv -f "$zdot/.zshrc.bck" "$zshrc"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restart the zsh session if there were no errors
|
||||||
|
_omz::log info "'$1' theme set correctly."
|
||||||
|
|
||||||
|
# Only reload zsh if run in an interactive session
|
||||||
|
[[ ! -o interactive ]] || _omz::reload
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::theme::use {
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <theme>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Respect compatibility with old lookup order
|
||||||
|
if [[ -f "$ZSH_CUSTOM/$1.zsh-theme" ]]; then
|
||||||
|
source "$ZSH_CUSTOM/$1.zsh-theme"
|
||||||
|
elif [[ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]]; then
|
||||||
|
source "$ZSH_CUSTOM/themes/$1.zsh-theme"
|
||||||
|
elif [[ -f "$ZSH/themes/$1.zsh-theme" ]]; then
|
||||||
|
source "$ZSH/themes/$1.zsh-theme"
|
||||||
|
else
|
||||||
|
_omz::log error "%B$1%b theme not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update theme settings
|
||||||
|
ZSH_THEME="$1"
|
||||||
|
[[ $1 = random ]] || unset RANDOM_THEME
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::update {
|
||||||
|
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD)
|
||||||
|
|
||||||
|
# Run update script
|
||||||
|
if [[ "$1" != --unattended ]]; then
|
||||||
|
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" --interactive || return $?
|
||||||
|
else
|
||||||
|
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" || return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update last updated file
|
||||||
|
zmodload zsh/datetime
|
||||||
|
echo "LAST_EPOCH=$(( EPOCHSECONDS / 60 / 60 / 24 ))" >! "${ZSH_CACHE_DIR}/.zsh-update"
|
||||||
|
# Remove update lock if it exists
|
||||||
|
command rm -rf "$ZSH/log/update.lock"
|
||||||
|
|
||||||
|
# Restart the zsh session if there were changes
|
||||||
|
if [[ "$1" != --unattended && "$(builtin cd -q "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
|
||||||
|
# Old zsh versions don't have ZSH_ARGZERO
|
||||||
|
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
||||||
|
# Check whether to run a login shell
|
||||||
|
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz::version {
|
||||||
|
(
|
||||||
|
builtin cd -q "$ZSH"
|
||||||
|
|
||||||
|
# Get the version name:
|
||||||
|
# 1) try tag-like version
|
||||||
|
# 2) try branch name
|
||||||
|
# 3) try name-rev (tag~<rev> or branch~<rev>)
|
||||||
|
local version
|
||||||
|
version=$(command git describe --tags HEAD 2>/dev/null) \
|
||||||
|
|| version=$(command git symbolic-ref --quiet --short HEAD 2>/dev/null) \
|
||||||
|
|| version=$(command git name-rev --no-undefined --name-only --exclude="remotes/*" HEAD 2>/dev/null) \
|
||||||
|
|| version="<detached>"
|
||||||
|
|
||||||
|
# Get short hash for the current HEAD
|
||||||
|
local commit=$(command git rev-parse --short HEAD 2>/dev/null)
|
||||||
|
|
||||||
|
# Show version and commit hash
|
||||||
|
printf "%s (%s)\n" "$version" "$commit"
|
||||||
|
)
|
||||||
|
}
|
||||||
107
dot_oh-my-zsh/lib/clipboard.zsh
Normal file
107
dot_oh-my-zsh/lib/clipboard.zsh
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
# System clipboard integration
|
||||||
|
#
|
||||||
|
# This file has support for doing system clipboard copy and paste operations
|
||||||
|
# from the command line in a generic cross-platform fashion.
|
||||||
|
#
|
||||||
|
# This is uses essentially the same heuristic as neovim, with the additional
|
||||||
|
# special support for Cygwin.
|
||||||
|
# See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121
|
||||||
|
#
|
||||||
|
# - pbcopy, pbpaste (macOS)
|
||||||
|
# - cygwin (Windows running Cygwin)
|
||||||
|
# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
|
||||||
|
# - xsel (if $DISPLAY is set)
|
||||||
|
# - xclip (if $DISPLAY is set)
|
||||||
|
# - lemonade (for SSH) https://github.com/pocke/lemonade
|
||||||
|
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
|
||||||
|
# - win32yank (Windows)
|
||||||
|
# - tmux (if $TMUX is set)
|
||||||
|
#
|
||||||
|
# Defines two functions, clipcopy and clippaste, based on the detected platform.
|
||||||
|
##
|
||||||
|
#
|
||||||
|
# clipcopy - Copy data to clipboard
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# <command> | clipcopy - copies stdin to clipboard
|
||||||
|
#
|
||||||
|
# clipcopy <file> - copies a file's contents to clipboard
|
||||||
|
#
|
||||||
|
##
|
||||||
|
#
|
||||||
|
# clippaste - "Paste" data from clipboard to stdout
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# clippaste - writes clipboard's contents to stdout
|
||||||
|
#
|
||||||
|
# clippaste | <command> - pastes contents and pipes it to another process
|
||||||
|
#
|
||||||
|
# clippaste > <file> - paste contents to a file
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
#
|
||||||
|
# # Pipe to another process
|
||||||
|
# clippaste | grep foo
|
||||||
|
#
|
||||||
|
# # Paste to a file
|
||||||
|
# clippaste > file.txt
|
||||||
|
#
|
||||||
|
function detect-clipboard() {
|
||||||
|
emulate -L zsh
|
||||||
|
|
||||||
|
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | pbcopy; }
|
||||||
|
function clippaste() { pbpaste; }
|
||||||
|
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
|
||||||
|
function clippaste() { cat /dev/clipboard; }
|
||||||
|
elif (( $+commands[clip.exe] )) && (( $+commands[powershell.exe] )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; }
|
||||||
|
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
|
||||||
|
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
|
||||||
|
function clippaste() { wl-paste; }
|
||||||
|
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; }
|
||||||
|
function clippaste() { xsel --clipboard --output; }
|
||||||
|
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | xclip -selection clipboard -in &>/dev/null &|; }
|
||||||
|
function clippaste() { xclip -out -selection clipboard; }
|
||||||
|
elif (( ${+commands[lemonade]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | lemonade copy; }
|
||||||
|
function clippaste() { lemonade paste; }
|
||||||
|
elif (( ${+commands[doitclient]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | doitclient wclip; }
|
||||||
|
function clippaste() { doitclient wclip -r; }
|
||||||
|
elif (( ${+commands[win32yank]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | win32yank -i; }
|
||||||
|
function clippaste() { win32yank -o; }
|
||||||
|
elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | termux-clipboard-set; }
|
||||||
|
function clippaste() { termux-clipboard-get; }
|
||||||
|
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
|
||||||
|
function clipcopy() { tmux load-buffer "${1:--}"; }
|
||||||
|
function clippaste() { tmux save-buffer -; }
|
||||||
|
else
|
||||||
|
function _retry_clipboard_detection_or_fail() {
|
||||||
|
local clipcmd="${1}"; shift
|
||||||
|
if detect-clipboard; then
|
||||||
|
"${clipcmd}" "$@"
|
||||||
|
else
|
||||||
|
print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; }
|
||||||
|
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Detect at startup. A non-zero exit here indicates that the dummy clipboards were set,
|
||||||
|
# which is not really an error. If the user calls them, they will attempt to redetect
|
||||||
|
# (for example, perhaps the user has now installed xclip) and then either print an error
|
||||||
|
# or proceed successfully.
|
||||||
|
detect-clipboard || true
|
||||||
44
dot_oh-my-zsh/lib/compfix.zsh
Normal file
44
dot_oh-my-zsh/lib/compfix.zsh
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
# Handle completions insecurities (i.e., completion-dependent directories with
|
||||||
|
# insecure ownership or permissions) by:
|
||||||
|
#
|
||||||
|
# * Human-readably notifying the user of these insecurities.
|
||||||
|
function handle_completion_insecurities() {
|
||||||
|
# List of the absolute paths of all unique insecure directories, split on
|
||||||
|
# newline from compaudit()'s output resembling:
|
||||||
|
#
|
||||||
|
# There are insecure directories:
|
||||||
|
# /usr/share/zsh/site-functions
|
||||||
|
# /usr/share/zsh/5.0.6/functions
|
||||||
|
# /usr/share/zsh
|
||||||
|
# /usr/share/zsh/5.0.6
|
||||||
|
#
|
||||||
|
# Since the ignorable first line is printed to stderr and thus not captured,
|
||||||
|
# stderr is squelched to prevent this output from leaking to the user.
|
||||||
|
local -aU insecure_dirs
|
||||||
|
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
|
||||||
|
|
||||||
|
# If no such directories exist, get us out of here.
|
||||||
|
[[ -z "${insecure_dirs}" ]] && return
|
||||||
|
|
||||||
|
# List ownership and permissions of all insecure directories.
|
||||||
|
print "[oh-my-zsh] Insecure completion-dependent directories detected:"
|
||||||
|
ls -ld "${(@)insecure_dirs}"
|
||||||
|
|
||||||
|
cat <<EOD
|
||||||
|
|
||||||
|
[oh-my-zsh] For safety, we will not load completions from these directories until
|
||||||
|
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
|
||||||
|
[oh-my-zsh] See the above list for directories with group or other writability.
|
||||||
|
|
||||||
|
[oh-my-zsh] To fix your permissions you can do so by disabling
|
||||||
|
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
|
||||||
|
[oh-my-zsh] owner of these directories is either root or your current user.
|
||||||
|
[oh-my-zsh] The following command may help:
|
||||||
|
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
|
||||||
|
|
||||||
|
[oh-my-zsh] If the above didn't help or you want to skip the verification of
|
||||||
|
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
|
||||||
|
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
|
||||||
|
|
||||||
|
EOD
|
||||||
|
}
|
||||||
78
dot_oh-my-zsh/lib/completion.zsh
Normal file
78
dot_oh-my-zsh/lib/completion.zsh
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
# fixme - the load process here seems a bit bizarre
|
||||||
|
zmodload -i zsh/complist
|
||||||
|
|
||||||
|
WORDCHARS=''
|
||||||
|
|
||||||
|
unsetopt menu_complete # do not autoselect the first completion entry
|
||||||
|
unsetopt flowcontrol
|
||||||
|
setopt auto_menu # show completion menu on successive tab press
|
||||||
|
setopt complete_in_word
|
||||||
|
setopt always_to_end
|
||||||
|
|
||||||
|
# should this be in keybindings?
|
||||||
|
bindkey -M menuselect '^o' accept-and-infer-next-history
|
||||||
|
zstyle ':completion:*:*:*:*:*' menu select
|
||||||
|
|
||||||
|
# case insensitive (all), partial-word and substring completion
|
||||||
|
if [[ "$CASE_SENSITIVE" = true ]]; then
|
||||||
|
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
|
||||||
|
else
|
||||||
|
if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
|
||||||
|
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]-_}={[:upper:][:lower:]_-}' 'r:|=*' 'l:|=* r:|=*'
|
||||||
|
else
|
||||||
|
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|=*' 'l:|=* r:|=*'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset CASE_SENSITIVE HYPHEN_INSENSITIVE
|
||||||
|
|
||||||
|
# Complete . and .. special directories
|
||||||
|
zstyle ':completion:*' special-dirs true
|
||||||
|
|
||||||
|
zstyle ':completion:*' list-colors ''
|
||||||
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||||
|
|
||||||
|
if [[ "$OSTYPE" = solaris* ]]; then
|
||||||
|
zstyle ':completion:*:*:*:*:processes' command "ps -u $USERNAME -o pid,user,comm"
|
||||||
|
else
|
||||||
|
zstyle ':completion:*:*:*:*:processes' command "ps -u $USERNAME -o pid,user,comm -w -w"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# disable named-directories autocompletion
|
||||||
|
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
||||||
|
|
||||||
|
# Use caching so that commands like apt and dpkg complete are useable
|
||||||
|
zstyle ':completion:*' use-cache yes
|
||||||
|
zstyle ':completion:*' cache-path $ZSH_CACHE_DIR
|
||||||
|
|
||||||
|
# Don't complete uninteresting users
|
||||||
|
zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||||
|
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
|
||||||
|
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
|
||||||
|
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
|
||||||
|
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
|
||||||
|
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
|
||||||
|
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
|
||||||
|
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
|
||||||
|
usbmux uucp vcsa wwwrun xfs '_*'
|
||||||
|
|
||||||
|
# ... unless we really want to.
|
||||||
|
zstyle '*' single-ignored show
|
||||||
|
|
||||||
|
if [[ ${COMPLETION_WAITING_DOTS:-false} != false ]]; then
|
||||||
|
expand-or-complete-with-dots() {
|
||||||
|
# use $COMPLETION_WAITING_DOTS either as toggle or as the sequence to show
|
||||||
|
[[ $COMPLETION_WAITING_DOTS = true ]] && COMPLETION_WAITING_DOTS="%F{red}…%f"
|
||||||
|
# turn off line wrapping and print prompt-expanded "dot" sequence
|
||||||
|
printf '\e[?7l%s\e[?7h' "${(%)COMPLETION_WAITING_DOTS}"
|
||||||
|
zle expand-or-complete
|
||||||
|
zle redisplay
|
||||||
|
}
|
||||||
|
zle -N expand-or-complete-with-dots
|
||||||
|
# Set the function as the default tab completion widget
|
||||||
|
bindkey -M emacs "^I" expand-or-complete-with-dots
|
||||||
|
bindkey -M viins "^I" expand-or-complete-with-dots
|
||||||
|
bindkey -M vicmd "^I" expand-or-complete-with-dots
|
||||||
|
fi
|
||||||
|
|
||||||
|
# automatically load bash completion functions
|
||||||
|
autoload -U +X bashcompinit && bashcompinit
|
||||||
10
dot_oh-my-zsh/lib/correction.zsh
Normal file
10
dot_oh-my-zsh/lib/correction.zsh
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
if [[ "$ENABLE_CORRECTION" == "true" ]]; then
|
||||||
|
alias cp='nocorrect cp'
|
||||||
|
alias man='nocorrect man'
|
||||||
|
alias mkdir='nocorrect mkdir'
|
||||||
|
alias mv='nocorrect mv'
|
||||||
|
alias sudo='nocorrect sudo'
|
||||||
|
alias su='nocorrect su'
|
||||||
|
|
||||||
|
setopt correct_all
|
||||||
|
fi
|
||||||
353
dot_oh-my-zsh/lib/diagnostics.zsh
Normal file
353
dot_oh-my-zsh/lib/diagnostics.zsh
Normal file
|
|
@ -0,0 +1,353 @@
|
||||||
|
# diagnostics.zsh
|
||||||
|
#
|
||||||
|
# Diagnostic and debugging support for oh-my-zsh
|
||||||
|
|
||||||
|
# omz_diagnostic_dump()
|
||||||
|
#
|
||||||
|
# Author: Andrew Janke <andrew@apjanke.net>
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# omz_diagnostic_dump [-v] [-V] [file]
|
||||||
|
#
|
||||||
|
# NOTE: This is a work in progress. Its interface and behavior are going to change,
|
||||||
|
# and probably in non-back-compatible ways.
|
||||||
|
#
|
||||||
|
# Outputs a bunch of information about the state and configuration of
|
||||||
|
# oh-my-zsh, zsh, and the user's system. This is intended to provide a
|
||||||
|
# bunch of context for diagnosing your own or a third party's problems, and to
|
||||||
|
# be suitable for posting to public bug reports.
|
||||||
|
#
|
||||||
|
# The output is human-readable and its format may change over time. It is not
|
||||||
|
# suitable for parsing. All the output is in one single file so it can be posted
|
||||||
|
# as a gist or bug comment on GitHub. GitHub doesn't support attaching tarballs
|
||||||
|
# or other files to bugs; otherwise, this would probably have an option to produce
|
||||||
|
# tarballs that contain copies of the config and customization files instead of
|
||||||
|
# catting them all in to one file.
|
||||||
|
#
|
||||||
|
# This is intended to be widely portable, and run anywhere that oh-my-zsh does.
|
||||||
|
# Feel free to report any portability issues as bugs.
|
||||||
|
#
|
||||||
|
# This is written in a defensive style so it still works (and can detect) cases when
|
||||||
|
# basic functionality like echo and which have been redefined. In particular, almost
|
||||||
|
# everything is invoked with "builtin" or "command", to work in the face of user
|
||||||
|
# redefinitions.
|
||||||
|
#
|
||||||
|
# OPTIONS
|
||||||
|
#
|
||||||
|
# [file] Specifies the output file. If not given, a file in the current directory
|
||||||
|
# is selected automatically.
|
||||||
|
#
|
||||||
|
# -v Increase the verbosity of the dump output. May be specified multiple times.
|
||||||
|
# Verbosity levels:
|
||||||
|
# 0 - Basic info, shell state, omz configuration, git state
|
||||||
|
# 1 - (default) Adds key binding info and configuration file contents
|
||||||
|
# 2 - Adds zcompdump file contents
|
||||||
|
#
|
||||||
|
# -V Reduce the verbosity of the dump output. May be specified multiple times.
|
||||||
|
#
|
||||||
|
# TODO:
|
||||||
|
# * Multi-file capture
|
||||||
|
# * Add automatic gist uploading
|
||||||
|
# * Consider whether to move default output file location to TMPDIR. More robust
|
||||||
|
# but less user friendly.
|
||||||
|
#
|
||||||
|
|
||||||
|
autoload -Uz is-at-least
|
||||||
|
|
||||||
|
function omz_diagnostic_dump() {
|
||||||
|
emulate -L zsh
|
||||||
|
|
||||||
|
builtin echo "Generating diagnostic dump; please be patient..."
|
||||||
|
|
||||||
|
local thisfcn=omz_diagnostic_dump
|
||||||
|
local -A opts
|
||||||
|
local opt_verbose opt_noverbose opt_outfile
|
||||||
|
local timestamp=$(date +%Y%m%d-%H%M%S)
|
||||||
|
local outfile=omz_diagdump_$timestamp.txt
|
||||||
|
builtin zparseopts -A opts -D -- "v+=opt_verbose" "V+=opt_noverbose"
|
||||||
|
local verbose n_verbose=${#opt_verbose} n_noverbose=${#opt_noverbose}
|
||||||
|
(( verbose = 1 + n_verbose - n_noverbose ))
|
||||||
|
|
||||||
|
if [[ ${#*} > 0 ]]; then
|
||||||
|
opt_outfile=$1
|
||||||
|
fi
|
||||||
|
if [[ ${#*} > 1 ]]; then
|
||||||
|
builtin echo "$thisfcn: error: too many arguments" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [[ -n "$opt_outfile" ]]; then
|
||||||
|
outfile="$opt_outfile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Always write directly to a file so terminal escape sequences are
|
||||||
|
# captured cleanly
|
||||||
|
_omz_diag_dump_one_big_text &> "$outfile"
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
builtin echo "$thisfcn: error while creating diagnostic dump; see $outfile for details"
|
||||||
|
fi
|
||||||
|
|
||||||
|
builtin echo
|
||||||
|
builtin echo Diagnostic dump file created at: "$outfile"
|
||||||
|
builtin echo
|
||||||
|
builtin echo To share this with OMZ developers, post it as a gist on GitHub
|
||||||
|
builtin echo at "https://gist.github.com" and share the link to the gist.
|
||||||
|
builtin echo
|
||||||
|
builtin echo "WARNING: This dump file contains all your zsh and omz configuration files,"
|
||||||
|
builtin echo "so don't share it publicly if there's sensitive information in them."
|
||||||
|
builtin echo
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz_diag_dump_one_big_text() {
|
||||||
|
local program programs progfile md5
|
||||||
|
|
||||||
|
builtin echo oh-my-zsh diagnostic dump
|
||||||
|
builtin echo
|
||||||
|
builtin echo $outfile
|
||||||
|
builtin echo
|
||||||
|
|
||||||
|
# Basic system and zsh information
|
||||||
|
command date
|
||||||
|
command uname -a
|
||||||
|
builtin echo OSTYPE=$OSTYPE
|
||||||
|
builtin echo ZSH_VERSION=$ZSH_VERSION
|
||||||
|
builtin echo User: $USERNAME
|
||||||
|
builtin echo umask: $(umask)
|
||||||
|
builtin echo
|
||||||
|
_omz_diag_dump_os_specific_version
|
||||||
|
builtin echo
|
||||||
|
|
||||||
|
# Installed programs
|
||||||
|
programs=(sh zsh ksh bash sed cat grep ls find git posh)
|
||||||
|
local progfile="" extra_str="" sha_str=""
|
||||||
|
for program in $programs; do
|
||||||
|
extra_str="" sha_str=""
|
||||||
|
progfile=$(builtin which $program)
|
||||||
|
if [[ $? == 0 ]]; then
|
||||||
|
if [[ -e $progfile ]]; then
|
||||||
|
if builtin whence shasum &>/dev/null; then
|
||||||
|
sha_str=($(command shasum $progfile))
|
||||||
|
sha_str=$sha_str[1]
|
||||||
|
extra_str+=" SHA $sha_str"
|
||||||
|
fi
|
||||||
|
if [[ -h "$progfile" ]]; then
|
||||||
|
extra_str+=" ( -> ${progfile:A} )"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
builtin printf '%-9s %-20s %s\n' "$program is" "$progfile" "$extra_str"
|
||||||
|
else
|
||||||
|
builtin echo "$program: not found"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
builtin echo
|
||||||
|
builtin echo Command Versions:
|
||||||
|
builtin echo "zsh: $(zsh --version)"
|
||||||
|
builtin echo "this zsh session: $ZSH_VERSION"
|
||||||
|
builtin echo "bash: $(bash --version | command grep bash)"
|
||||||
|
builtin echo "git: $(git --version)"
|
||||||
|
builtin echo "grep: $(grep --version)"
|
||||||
|
builtin echo
|
||||||
|
|
||||||
|
# Core command definitions
|
||||||
|
_omz_diag_dump_check_core_commands || return 1
|
||||||
|
builtin echo
|
||||||
|
|
||||||
|
# ZSH Process state
|
||||||
|
builtin echo Process state:
|
||||||
|
builtin echo pwd: $PWD
|
||||||
|
if builtin whence pstree &>/dev/null; then
|
||||||
|
builtin echo Process tree for this shell:
|
||||||
|
pstree -p $$
|
||||||
|
else
|
||||||
|
ps -fT
|
||||||
|
fi
|
||||||
|
builtin set | command grep -a '^\(ZSH\|plugins\|TERM\|LC_\|LANG\|precmd\|chpwd\|preexec\|FPATH\|TTY\|DISPLAY\|PATH\)\|OMZ'
|
||||||
|
builtin echo
|
||||||
|
#TODO: Should this include `env` instead of or in addition to `export`?
|
||||||
|
builtin echo Exported:
|
||||||
|
builtin echo $(builtin export | command sed 's/=.*//')
|
||||||
|
builtin echo
|
||||||
|
builtin echo Locale:
|
||||||
|
command locale
|
||||||
|
builtin echo
|
||||||
|
|
||||||
|
# Zsh installation and configuration
|
||||||
|
builtin echo Zsh configuration:
|
||||||
|
builtin echo setopt: $(builtin setopt)
|
||||||
|
builtin echo
|
||||||
|
builtin echo zstyle:
|
||||||
|
builtin zstyle
|
||||||
|
builtin echo
|
||||||
|
builtin echo 'compaudit output:'
|
||||||
|
compaudit
|
||||||
|
builtin echo
|
||||||
|
builtin echo '$fpath directories:'
|
||||||
|
command ls -lad $fpath
|
||||||
|
builtin echo
|
||||||
|
|
||||||
|
# Oh-my-zsh installation
|
||||||
|
builtin echo oh-my-zsh installation:
|
||||||
|
command ls -ld ~/.z*
|
||||||
|
command ls -ld ~/.oh*
|
||||||
|
builtin echo
|
||||||
|
builtin echo oh-my-zsh git state:
|
||||||
|
(builtin cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
|
||||||
|
if [[ $verbose -ge 1 ]]; then
|
||||||
|
(builtin cd $ZSH && git reflog --date=default | command grep pull)
|
||||||
|
fi
|
||||||
|
builtin echo
|
||||||
|
if [[ -e $ZSH_CUSTOM ]]; then
|
||||||
|
local custom_dir=$ZSH_CUSTOM
|
||||||
|
if [[ -h $custom_dir ]]; then
|
||||||
|
custom_dir=$(builtin cd $custom_dir && pwd -P)
|
||||||
|
fi
|
||||||
|
builtin echo "oh-my-zsh custom dir:"
|
||||||
|
builtin echo " $ZSH_CUSTOM ($custom_dir)"
|
||||||
|
(builtin cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
|
||||||
|
builtin echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Key binding and terminal info
|
||||||
|
if [[ $verbose -ge 1 ]]; then
|
||||||
|
builtin echo "bindkey:"
|
||||||
|
builtin bindkey
|
||||||
|
builtin echo
|
||||||
|
builtin echo "infocmp:"
|
||||||
|
command infocmp -L
|
||||||
|
builtin echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configuration file info
|
||||||
|
local zdotdir=${ZDOTDIR:-$HOME}
|
||||||
|
builtin echo "Zsh configuration files:"
|
||||||
|
local cfgfile cfgfiles
|
||||||
|
# Some files for bash that zsh does not use are intentionally included
|
||||||
|
# to help with diagnosing behavior differences between bash and zsh
|
||||||
|
cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout
|
||||||
|
$zdotdir/.zshenv $zdotdir/.zprofile $zdotdir/.zshrc $zdotdir/.zlogin $zdotdir/.zlogout
|
||||||
|
~/.zsh.pre-oh-my-zsh
|
||||||
|
/etc/bashrc /etc/profile ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_logout )
|
||||||
|
command ls -lad $cfgfiles 2>&1
|
||||||
|
builtin echo
|
||||||
|
if [[ $verbose -ge 1 ]]; then
|
||||||
|
for cfgfile in $cfgfiles; do
|
||||||
|
_omz_diag_dump_echo_file_w_header $cfgfile
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
builtin echo
|
||||||
|
builtin echo "Zsh compdump files:"
|
||||||
|
local dumpfile dumpfiles
|
||||||
|
command ls -lad $zdotdir/.zcompdump*
|
||||||
|
dumpfiles=( $zdotdir/.zcompdump*(N) )
|
||||||
|
if [[ $verbose -ge 2 ]]; then
|
||||||
|
for dumpfile in $dumpfiles; do
|
||||||
|
_omz_diag_dump_echo_file_w_header $dumpfile
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz_diag_dump_check_core_commands() {
|
||||||
|
builtin echo "Core command check:"
|
||||||
|
local redefined name builtins externals reserved_words
|
||||||
|
redefined=()
|
||||||
|
# All the zsh non-module builtin commands
|
||||||
|
# These are taken from the zsh reference manual for 5.0.2
|
||||||
|
# Commands from modules should not be included.
|
||||||
|
# (For back-compatibility, if any of these are newish, they should be removed,
|
||||||
|
# or at least made conditional on the version of the current running zsh.)
|
||||||
|
# "history" is also excluded because OMZ is known to redefine that
|
||||||
|
reserved_words=( do done esac then elif else fi for case if while function
|
||||||
|
repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
|
||||||
|
)
|
||||||
|
builtins=( alias autoload bg bindkey break builtin bye cd chdir command
|
||||||
|
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
|
||||||
|
comptry compvalues continue dirs disable disown echo echotc echoti emulate
|
||||||
|
enable eval exec exit false fc fg functions getln getopts hash
|
||||||
|
jobs kill let limit log logout noglob popd print printf
|
||||||
|
pushd pushln pwd r read rehash return sched set setopt shift
|
||||||
|
source suspend test times trap true ttyctl type ulimit umask unalias
|
||||||
|
unfunction unhash unlimit unset unsetopt vared wait whence where which zcompile
|
||||||
|
zle zmodload zparseopts zregexparse zstyle )
|
||||||
|
if is-at-least 5.1; then
|
||||||
|
reserved_word+=( declare export integer float local readonly typeset )
|
||||||
|
else
|
||||||
|
builtins+=( declare export integer float local readonly typeset )
|
||||||
|
fi
|
||||||
|
builtins_fatal=( builtin command local )
|
||||||
|
externals=( zsh )
|
||||||
|
for name in $reserved_words; do
|
||||||
|
if [[ $(builtin whence -w $name) != "$name: reserved" ]]; then
|
||||||
|
builtin echo "reserved word '$name' has been redefined"
|
||||||
|
builtin which $name
|
||||||
|
redefined+=$name
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for name in $builtins; do
|
||||||
|
if [[ $(builtin whence -w $name) != "$name: builtin" ]]; then
|
||||||
|
builtin echo "builtin '$name' has been redefined"
|
||||||
|
builtin which $name
|
||||||
|
redefined+=$name
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for name in $externals; do
|
||||||
|
if [[ $(builtin whence -w $name) != "$name: command" ]]; then
|
||||||
|
builtin echo "command '$name' has been redefined"
|
||||||
|
builtin which $name
|
||||||
|
redefined+=$name
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -n "$redefined" ]]; then
|
||||||
|
builtin echo "SOME CORE COMMANDS HAVE BEEN REDEFINED: $redefined"
|
||||||
|
else
|
||||||
|
builtin echo "All core commands are defined normally"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz_diag_dump_echo_file_w_header() {
|
||||||
|
local file=$1
|
||||||
|
if [[ ( -f $file || -h $file ) ]]; then
|
||||||
|
builtin echo "========== $file =========="
|
||||||
|
if [[ -h $file ]]; then
|
||||||
|
builtin echo "========== ( => ${file:A} ) =========="
|
||||||
|
fi
|
||||||
|
command cat $file
|
||||||
|
builtin echo "========== end $file =========="
|
||||||
|
builtin echo
|
||||||
|
elif [[ -d $file ]]; then
|
||||||
|
builtin echo "File '$file' is a directory"
|
||||||
|
elif [[ ! -e $file ]]; then
|
||||||
|
builtin echo "File '$file' does not exist"
|
||||||
|
else
|
||||||
|
command ls -lad "$file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function _omz_diag_dump_os_specific_version() {
|
||||||
|
local osname osver version_file version_files
|
||||||
|
case "$OSTYPE" in
|
||||||
|
darwin*)
|
||||||
|
osname=$(command sw_vers -productName)
|
||||||
|
osver=$(command sw_vers -productVersion)
|
||||||
|
builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)"
|
||||||
|
;;
|
||||||
|
cygwin)
|
||||||
|
command systeminfo | command head -n 4 | command tail -n 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if builtin which lsb_release >/dev/null; then
|
||||||
|
builtin echo "OS Release: $(command lsb_release -s -d)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
version_files=( /etc/*-release(N) /etc/*-version(N) /etc/*_version(N) )
|
||||||
|
for version_file in $version_files; do
|
||||||
|
builtin echo "$version_file:"
|
||||||
|
command cat "$version_file"
|
||||||
|
builtin echo
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
46
dot_oh-my-zsh/lib/directories.zsh
Normal file
46
dot_oh-my-zsh/lib/directories.zsh
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
# Changing/making/removing directory
|
||||||
|
setopt auto_cd
|
||||||
|
setopt auto_pushd
|
||||||
|
setopt pushd_ignore_dups
|
||||||
|
setopt pushdminus
|
||||||
|
|
||||||
|
# add (uncommented):
|
||||||
|
# zstyle ':omz:directories' aliases no
|
||||||
|
# to your `zshrc` before loading `oh-my-zsh.sh`
|
||||||
|
# to disable the following aliases and functions
|
||||||
|
|
||||||
|
zstyle -T ':omz:directories' aliases || return 0
|
||||||
|
|
||||||
|
alias -g ...='../..'
|
||||||
|
alias -g ....='../../..'
|
||||||
|
alias -g .....='../../../..'
|
||||||
|
alias -g ......='../../../../..'
|
||||||
|
|
||||||
|
alias -- -='cd -'
|
||||||
|
alias 1='cd -1'
|
||||||
|
alias 2='cd -2'
|
||||||
|
alias 3='cd -3'
|
||||||
|
alias 4='cd -4'
|
||||||
|
alias 5='cd -5'
|
||||||
|
alias 6='cd -6'
|
||||||
|
alias 7='cd -7'
|
||||||
|
alias 8='cd -8'
|
||||||
|
alias 9='cd -9'
|
||||||
|
|
||||||
|
alias md='mkdir -p'
|
||||||
|
alias rd=rmdir
|
||||||
|
|
||||||
|
function d () {
|
||||||
|
if [[ -n $1 ]]; then
|
||||||
|
dirs "$@"
|
||||||
|
else
|
||||||
|
dirs -v | head -n 10
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
compdef _dirs d
|
||||||
|
|
||||||
|
# List directory contents
|
||||||
|
alias lsa='ls -lah'
|
||||||
|
alias l='ls -lah'
|
||||||
|
alias ll='ls -lh'
|
||||||
|
alias la='ls -lAh'
|
||||||
262
dot_oh-my-zsh/lib/functions.zsh
Normal file
262
dot_oh-my-zsh/lib/functions.zsh
Normal file
|
|
@ -0,0 +1,262 @@
|
||||||
|
function zsh_stats() {
|
||||||
|
fc -l 1 \
|
||||||
|
| awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' \
|
||||||
|
| grep -v "./" | sort -nr | head -n 20 | column -c3 -s " " -t | nl
|
||||||
|
}
|
||||||
|
|
||||||
|
function uninstall_oh_my_zsh() {
|
||||||
|
env ZSH="$ZSH" sh "$ZSH/tools/uninstall.sh"
|
||||||
|
}
|
||||||
|
|
||||||
|
function upgrade_oh_my_zsh() {
|
||||||
|
echo >&2 "${fg[yellow]}Note: \`$0\` is deprecated. Use \`omz update\` instead.$reset_color"
|
||||||
|
omz update
|
||||||
|
}
|
||||||
|
|
||||||
|
function open_command() {
|
||||||
|
local open_cmd
|
||||||
|
|
||||||
|
# define the open command
|
||||||
|
case "$OSTYPE" in
|
||||||
|
darwin*) open_cmd='open' ;;
|
||||||
|
cygwin*) open_cmd='cygstart' ;;
|
||||||
|
linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
|
||||||
|
open_cmd='cmd.exe /c start ""'
|
||||||
|
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
|
||||||
|
} ;;
|
||||||
|
msys*) open_cmd='start ""' ;;
|
||||||
|
*) echo "Platform $OSTYPE not supported"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# If a URL is passed, $BROWSER might be set to a local browser within SSH.
|
||||||
|
# See https://github.com/ohmyzsh/ohmyzsh/issues/11098
|
||||||
|
if [[ -n "$BROWSER" && "$1" = (http|https)://* ]]; then
|
||||||
|
"$BROWSER" "$@"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
${=open_cmd} "$@" &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# take functions
|
||||||
|
|
||||||
|
# mkcd is equivalent to takedir
|
||||||
|
function mkcd takedir() {
|
||||||
|
mkdir -p $@ && cd ${@:$#}
|
||||||
|
}
|
||||||
|
|
||||||
|
function takeurl() {
|
||||||
|
local data thedir
|
||||||
|
data="$(mktemp)"
|
||||||
|
curl -L "$1" > "$data"
|
||||||
|
tar xf "$data"
|
||||||
|
thedir="$(tar tf "$data" | head -n 1)"
|
||||||
|
rm "$data"
|
||||||
|
cd "$thedir"
|
||||||
|
}
|
||||||
|
|
||||||
|
function takegit() {
|
||||||
|
git clone "$1"
|
||||||
|
cd "$(basename ${1%%.git})"
|
||||||
|
}
|
||||||
|
|
||||||
|
function take() {
|
||||||
|
if [[ $1 =~ ^(https?|ftp).*\.(tar\.(gz|bz2|xz)|tgz)$ ]]; then
|
||||||
|
takeurl "$1"
|
||||||
|
elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then
|
||||||
|
takegit "$1"
|
||||||
|
else
|
||||||
|
takedir "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Get the value of an alias.
|
||||||
|
#
|
||||||
|
# Arguments:
|
||||||
|
# 1. alias - The alias to get its value from
|
||||||
|
# STDOUT:
|
||||||
|
# The value of alias $1 (if it has one).
|
||||||
|
# Return value:
|
||||||
|
# 0 if the alias was found,
|
||||||
|
# 1 if it does not exist
|
||||||
|
#
|
||||||
|
function alias_value() {
|
||||||
|
(( $+aliases[$1] )) && echo $aliases[$1]
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Try to get the value of an alias,
|
||||||
|
# otherwise return the input.
|
||||||
|
#
|
||||||
|
# Arguments:
|
||||||
|
# 1. alias - The alias to get its value from
|
||||||
|
# STDOUT:
|
||||||
|
# The value of alias $1, or $1 if there is no alias $1.
|
||||||
|
# Return value:
|
||||||
|
# Always 0
|
||||||
|
#
|
||||||
|
function try_alias_value() {
|
||||||
|
alias_value "$1" || echo "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set variable "$1" to default value "$2" if "$1" is not yet defined.
|
||||||
|
#
|
||||||
|
# Arguments:
|
||||||
|
# 1. name - The variable to set
|
||||||
|
# 2. val - The default value
|
||||||
|
# Return value:
|
||||||
|
# 0 if the variable exists, 3 if it was set
|
||||||
|
#
|
||||||
|
function default() {
|
||||||
|
(( $+parameters[$1] )) && return 0
|
||||||
|
typeset -g "$1"="$2" && return 3
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set environment variable "$1" to default value "$2" if "$1" is not yet defined.
|
||||||
|
#
|
||||||
|
# Arguments:
|
||||||
|
# 1. name - The env variable to set
|
||||||
|
# 2. val - The default value
|
||||||
|
# Return value:
|
||||||
|
# 0 if the env variable exists, 3 if it was set
|
||||||
|
#
|
||||||
|
function env_default() {
|
||||||
|
[[ ${parameters[$1]} = *-export* ]] && return 0
|
||||||
|
export "$1=$2" && return 3
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Required for $langinfo
|
||||||
|
zmodload zsh/langinfo
|
||||||
|
|
||||||
|
# URL-encode a string
|
||||||
|
#
|
||||||
|
# Encodes a string using RFC 2396 URL-encoding (%-escaped).
|
||||||
|
# See: https://www.ietf.org/rfc/rfc2396.txt
|
||||||
|
#
|
||||||
|
# By default, reserved characters and unreserved "mark" characters are
|
||||||
|
# not escaped by this function. This allows the common usage of passing
|
||||||
|
# an entire URL in, and encoding just special characters in it, with
|
||||||
|
# the expectation that reserved and mark characters are used appropriately.
|
||||||
|
# The -r and -m options turn on escaping of the reserved and mark characters,
|
||||||
|
# respectively, which allows arbitrary strings to be fully escaped for
|
||||||
|
# embedding inside URLs, where reserved characters might be misinterpreted.
|
||||||
|
#
|
||||||
|
# Prints the encoded string on stdout.
|
||||||
|
# Returns nonzero if encoding failed.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# omz_urlencode [-r] [-m] [-P] <string> [<string> ...]
|
||||||
|
#
|
||||||
|
# -r causes reserved characters (;/?:@&=+$,) to be escaped
|
||||||
|
#
|
||||||
|
# -m causes "mark" characters (_.!~*''()-) to be escaped
|
||||||
|
#
|
||||||
|
# -P causes spaces to be encoded as '%20' instead of '+'
|
||||||
|
function omz_urlencode() {
|
||||||
|
emulate -L zsh
|
||||||
|
local -a opts
|
||||||
|
zparseopts -D -E -a opts r m P
|
||||||
|
|
||||||
|
local in_str="$@"
|
||||||
|
local url_str=""
|
||||||
|
local spaces_as_plus
|
||||||
|
if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi
|
||||||
|
local str="$in_str"
|
||||||
|
|
||||||
|
# URLs must use UTF-8 encoding; convert str to UTF-8 if required
|
||||||
|
local encoding=$langinfo[CODESET]
|
||||||
|
local safe_encodings
|
||||||
|
safe_encodings=(UTF-8 utf8 US-ASCII)
|
||||||
|
if [[ -z ${safe_encodings[(r)$encoding]} ]]; then
|
||||||
|
str=$(echo -E "$str" | iconv -f $encoding -t UTF-8)
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
echo "Error converting string from $encoding to UTF-8" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use LC_CTYPE=C to process text byte-by-byte
|
||||||
|
local i byte ord LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
local reserved=';/?:@&=+$,'
|
||||||
|
local mark='_.!~*''()-'
|
||||||
|
local dont_escape="[A-Za-z0-9"
|
||||||
|
if [[ -z $opts[(r)-r] ]]; then
|
||||||
|
dont_escape+=$reserved
|
||||||
|
fi
|
||||||
|
# $mark must be last because of the "-"
|
||||||
|
if [[ -z $opts[(r)-m] ]]; then
|
||||||
|
dont_escape+=$mark
|
||||||
|
fi
|
||||||
|
dont_escape+="]"
|
||||||
|
|
||||||
|
# Implemented to use a single printf call and avoid subshells in the loop,
|
||||||
|
# for performance (primarily on Windows).
|
||||||
|
local url_str=""
|
||||||
|
for (( i = 1; i <= ${#str}; ++i )); do
|
||||||
|
byte="$str[i]"
|
||||||
|
if [[ "$byte" =~ "$dont_escape" ]]; then
|
||||||
|
url_str+="$byte"
|
||||||
|
else
|
||||||
|
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||||
|
url_str+="+"
|
||||||
|
else
|
||||||
|
ord=$(( [##16] #byte ))
|
||||||
|
url_str+="%$ord"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo -E "$url_str"
|
||||||
|
}
|
||||||
|
|
||||||
|
# URL-decode a string
|
||||||
|
#
|
||||||
|
# Decodes a RFC 2396 URL-encoded (%-escaped) string.
|
||||||
|
# This decodes the '+' and '%' escapes in the input string, and leaves
|
||||||
|
# other characters unchanged. Does not enforce that the input is a
|
||||||
|
# valid URL-encoded string. This is a convenience to allow callers to
|
||||||
|
# pass in a full URL or similar strings and decode them for human
|
||||||
|
# presentation.
|
||||||
|
#
|
||||||
|
# Outputs the encoded string on stdout.
|
||||||
|
# Returns nonzero if encoding failed.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# omz_urldecode <urlstring> - prints decoded string followed by a newline
|
||||||
|
function omz_urldecode {
|
||||||
|
emulate -L zsh
|
||||||
|
local encoded_url=$1
|
||||||
|
|
||||||
|
# Work bytewise, since URLs escape UTF-8 octets
|
||||||
|
local caller_encoding=$langinfo[CODESET]
|
||||||
|
local LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
|
||||||
|
# Change + back to ' '
|
||||||
|
local tmp=${encoded_url:gs/+/ /}
|
||||||
|
# Protect other escapes to pass through the printf unchanged
|
||||||
|
tmp=${tmp:gs/\\/\\\\/}
|
||||||
|
# Handle %-escapes by turning them into `\xXX` printf escapes
|
||||||
|
tmp=${tmp:gs/%/\\x/}
|
||||||
|
local decoded="$(printf -- "$tmp")"
|
||||||
|
|
||||||
|
# Now we have a UTF-8 encoded string in the variable. We need to re-encode
|
||||||
|
# it if caller is in a non-UTF-8 locale.
|
||||||
|
local -a safe_encodings
|
||||||
|
safe_encodings=(UTF-8 utf8 US-ASCII)
|
||||||
|
if [[ -z ${safe_encodings[(r)$caller_encoding]} ]]; then
|
||||||
|
decoded=$(echo -E "$decoded" | iconv -f UTF-8 -t $caller_encoding)
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
echo "Error converting string from UTF-8 to $caller_encoding" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -E "$decoded"
|
||||||
|
}
|
||||||
282
dot_oh-my-zsh/lib/git.zsh
Normal file
282
dot_oh-my-zsh/lib/git.zsh
Normal file
|
|
@ -0,0 +1,282 @@
|
||||||
|
# The git prompt's git commands are read-only and should not interfere with
|
||||||
|
# other processes. This environment variable is equivalent to running with `git
|
||||||
|
# --no-optional-locks`, but falls back gracefully for older versions of git.
|
||||||
|
# See git(1) for and git-status(1) for a description of that flag.
|
||||||
|
#
|
||||||
|
# We wrap in a local function instead of exporting the variable directly in
|
||||||
|
# order to avoid interfering with manually-run git commands by the user.
|
||||||
|
function __git_prompt_git() {
|
||||||
|
GIT_OPTIONAL_LOCKS=0 command git "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_info() {
|
||||||
|
# If we are on a folder not tracked by git, get out.
|
||||||
|
# Otherwise, check for hide-info at global and local repository level
|
||||||
|
if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
|
||||||
|
|| [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local ref
|
||||||
|
ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
|
||||||
|
|| ref=$(__git_prompt_git describe --tags --exact-match HEAD 2> /dev/null) \
|
||||||
|
|| ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) \
|
||||||
|
|| return 0
|
||||||
|
|
||||||
|
# Use global ZSH_THEME_GIT_SHOW_UPSTREAM=1 for including upstream remote info
|
||||||
|
local upstream
|
||||||
|
if (( ${+ZSH_THEME_GIT_SHOW_UPSTREAM} )); then
|
||||||
|
upstream=$(__git_prompt_git rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" 2>/dev/null) \
|
||||||
|
&& upstream=" -> ${upstream}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Checks if working tree is dirty
|
||||||
|
function parse_git_dirty() {
|
||||||
|
local STATUS
|
||||||
|
local -a FLAGS
|
||||||
|
FLAGS=('--porcelain')
|
||||||
|
if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
|
||||||
|
if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
|
||||||
|
FLAGS+='--untracked-files=no'
|
||||||
|
fi
|
||||||
|
case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
|
||||||
|
git)
|
||||||
|
# let git decide (this respects per-repo config in .gitmodules)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# if unset: ignore dirty submodules
|
||||||
|
# other values are passed to --ignore-submodules
|
||||||
|
FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1)
|
||||||
|
fi
|
||||||
|
if [[ -n $STATUS ]]; then
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||||
|
else
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Gets the difference between the local and remote branches
|
||||||
|
function git_remote_status() {
|
||||||
|
local remote ahead behind git_remote_status git_remote_status_detailed
|
||||||
|
remote=${$(__git_prompt_git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
|
||||||
|
if [[ -n ${remote} ]]; then
|
||||||
|
ahead=$(__git_prompt_git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||||
|
behind=$(__git_prompt_git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||||
|
|
||||||
|
if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then
|
||||||
|
git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
|
||||||
|
elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then
|
||||||
|
git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
|
||||||
|
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
|
||||||
|
elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then
|
||||||
|
git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
|
||||||
|
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
|
||||||
|
elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then
|
||||||
|
git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
|
||||||
|
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
|
||||||
|
git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX${remote:gs/%/%%}$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $git_remote_status
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Outputs the name of the current branch
|
||||||
|
# Usage example: git pull origin $(git_current_branch)
|
||||||
|
# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if
|
||||||
|
# it's not a symbolic ref, but in a Git repo.
|
||||||
|
function git_current_branch() {
|
||||||
|
local ref
|
||||||
|
ref=$(__git_prompt_git symbolic-ref --quiet HEAD 2> /dev/null)
|
||||||
|
local ret=$?
|
||||||
|
if [[ $ret != 0 ]]; then
|
||||||
|
[[ $ret == 128 ]] && return # no git repo.
|
||||||
|
ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return
|
||||||
|
fi
|
||||||
|
echo ${ref#refs/heads/}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Gets the number of commits ahead from remote
|
||||||
|
function git_commits_ahead() {
|
||||||
|
if __git_prompt_git rev-parse --git-dir &>/dev/null; then
|
||||||
|
local commits="$(__git_prompt_git rev-list --count @{upstream}..HEAD 2>/dev/null)"
|
||||||
|
if [[ -n "$commits" && "$commits" != 0 ]]; then
|
||||||
|
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Gets the number of commits behind remote
|
||||||
|
function git_commits_behind() {
|
||||||
|
if __git_prompt_git rev-parse --git-dir &>/dev/null; then
|
||||||
|
local commits="$(__git_prompt_git rev-list --count HEAD..@{upstream} 2>/dev/null)"
|
||||||
|
if [[ -n "$commits" && "$commits" != 0 ]]; then
|
||||||
|
echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Outputs if current branch is ahead of remote
|
||||||
|
function git_prompt_ahead() {
|
||||||
|
if [[ -n "$(__git_prompt_git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Outputs if current branch is behind remote
|
||||||
|
function git_prompt_behind() {
|
||||||
|
if [[ -n "$(__git_prompt_git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_BEHIND"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Outputs if current branch exists on remote or not
|
||||||
|
function git_prompt_remote() {
|
||||||
|
if [[ -n "$(__git_prompt_git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS"
|
||||||
|
else
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Formats prompt string for current git commit short SHA
|
||||||
|
function git_prompt_short_sha() {
|
||||||
|
local SHA
|
||||||
|
SHA=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Formats prompt string for current git commit long SHA
|
||||||
|
function git_prompt_long_sha() {
|
||||||
|
local SHA
|
||||||
|
SHA=$(__git_prompt_git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_status() {
|
||||||
|
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
|
||||||
|
|
||||||
|
# Maps a git status prefix to an internal constant
|
||||||
|
# This cannot use the prompt constants, as they may be empty
|
||||||
|
local -A prefix_constant_map
|
||||||
|
prefix_constant_map=(
|
||||||
|
'\?\? ' 'UNTRACKED'
|
||||||
|
'A ' 'ADDED'
|
||||||
|
'M ' 'ADDED'
|
||||||
|
'MM ' 'MODIFIED'
|
||||||
|
' M ' 'MODIFIED'
|
||||||
|
'AM ' 'MODIFIED'
|
||||||
|
' T ' 'MODIFIED'
|
||||||
|
'R ' 'RENAMED'
|
||||||
|
' D ' 'DELETED'
|
||||||
|
'D ' 'DELETED'
|
||||||
|
'UU ' 'UNMERGED'
|
||||||
|
'ahead' 'AHEAD'
|
||||||
|
'behind' 'BEHIND'
|
||||||
|
'diverged' 'DIVERGED'
|
||||||
|
'stashed' 'STASHED'
|
||||||
|
)
|
||||||
|
|
||||||
|
# Maps the internal constant to the prompt theme
|
||||||
|
local -A constant_prompt_map
|
||||||
|
constant_prompt_map=(
|
||||||
|
'UNTRACKED' "$ZSH_THEME_GIT_PROMPT_UNTRACKED"
|
||||||
|
'ADDED' "$ZSH_THEME_GIT_PROMPT_ADDED"
|
||||||
|
'MODIFIED' "$ZSH_THEME_GIT_PROMPT_MODIFIED"
|
||||||
|
'RENAMED' "$ZSH_THEME_GIT_PROMPT_RENAMED"
|
||||||
|
'DELETED' "$ZSH_THEME_GIT_PROMPT_DELETED"
|
||||||
|
'UNMERGED' "$ZSH_THEME_GIT_PROMPT_UNMERGED"
|
||||||
|
'AHEAD' "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||||
|
'BEHIND' "$ZSH_THEME_GIT_PROMPT_BEHIND"
|
||||||
|
'DIVERGED' "$ZSH_THEME_GIT_PROMPT_DIVERGED"
|
||||||
|
'STASHED' "$ZSH_THEME_GIT_PROMPT_STASHED"
|
||||||
|
)
|
||||||
|
|
||||||
|
# The order that the prompt displays should be added to the prompt
|
||||||
|
local status_constants
|
||||||
|
status_constants=(
|
||||||
|
UNTRACKED ADDED MODIFIED RENAMED DELETED
|
||||||
|
STASHED UNMERGED AHEAD BEHIND DIVERGED
|
||||||
|
)
|
||||||
|
|
||||||
|
local status_text
|
||||||
|
status_text="$(__git_prompt_git status --porcelain -b 2> /dev/null)"
|
||||||
|
|
||||||
|
# Don't continue on a catastrophic failure
|
||||||
|
if [[ $? -eq 128 ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# A lookup table of each git status encountered
|
||||||
|
local -A statuses_seen
|
||||||
|
|
||||||
|
if __git_prompt_git rev-parse --verify refs/stash &>/dev/null; then
|
||||||
|
statuses_seen[STASHED]=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local status_lines
|
||||||
|
status_lines=("${(@f)${status_text}}")
|
||||||
|
|
||||||
|
# If the tracking line exists, get and parse it
|
||||||
|
if [[ "$status_lines[1]" =~ "^## [^ ]+ \[(.*)\]" ]]; then
|
||||||
|
local branch_statuses
|
||||||
|
branch_statuses=("${(@s/,/)match}")
|
||||||
|
for branch_status in $branch_statuses; do
|
||||||
|
if [[ ! $branch_status =~ "(behind|diverged|ahead) ([0-9]+)?" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
local last_parsed_status=$prefix_constant_map[$match[1]]
|
||||||
|
statuses_seen[$last_parsed_status]=$match[2]
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For each status prefix, do a regex comparison
|
||||||
|
for status_prefix in ${(k)prefix_constant_map}; do
|
||||||
|
local status_constant="${prefix_constant_map[$status_prefix]}"
|
||||||
|
local status_regex=$'(^|\n)'"$status_prefix"
|
||||||
|
|
||||||
|
if [[ "$status_text" =~ $status_regex ]]; then
|
||||||
|
statuses_seen[$status_constant]=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Display the seen statuses in the order specified
|
||||||
|
local status_prompt
|
||||||
|
for status_constant in $status_constants; do
|
||||||
|
if (( ${+statuses_seen[$status_constant]} )); then
|
||||||
|
local next_display=$constant_prompt_map[$status_constant]
|
||||||
|
status_prompt="$next_display$status_prompt"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $status_prompt
|
||||||
|
}
|
||||||
|
|
||||||
|
# Outputs the name of the current user
|
||||||
|
# Usage example: $(git_current_user_name)
|
||||||
|
function git_current_user_name() {
|
||||||
|
__git_prompt_git config user.name 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Outputs the email of the current user
|
||||||
|
# Usage example: $(git_current_user_email)
|
||||||
|
function git_current_user_email() {
|
||||||
|
__git_prompt_git config user.email 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Output the name of the root directory of the git repository
|
||||||
|
# Usage example: $(git_repo_name)
|
||||||
|
function git_repo_name() {
|
||||||
|
local repo_path
|
||||||
|
if repo_path="$(__git_prompt_git rev-parse --show-toplevel 2>/dev/null)" && [[ -n "$repo_path" ]]; then
|
||||||
|
echo ${repo_path:t}
|
||||||
|
fi
|
||||||
|
}
|
||||||
41
dot_oh-my-zsh/lib/grep.zsh
Normal file
41
dot_oh-my-zsh/lib/grep.zsh
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
__GREP_CACHE_FILE="$ZSH_CACHE_DIR"/grep-alias
|
||||||
|
|
||||||
|
# See if there's a cache file modified in the last day
|
||||||
|
__GREP_ALIAS_CACHES=("$__GREP_CACHE_FILE"(Nm-1))
|
||||||
|
if [[ -n "$__GREP_ALIAS_CACHES" ]]; then
|
||||||
|
source "$__GREP_CACHE_FILE"
|
||||||
|
else
|
||||||
|
grep-flags-available() {
|
||||||
|
command grep "$@" "" &>/dev/null <<< ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ignore these folders (if the necessary grep flags are available)
|
||||||
|
EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox}"
|
||||||
|
|
||||||
|
# Check for --exclude-dir, otherwise check for --exclude. If --exclude
|
||||||
|
# isn't available, --color won't be either (they were released at the same
|
||||||
|
# time (v2.5): https://git.savannah.gnu.org/cgit/grep.git/tree/NEWS?id=1236f007
|
||||||
|
if grep-flags-available --color=auto --exclude-dir=.cvs; then
|
||||||
|
GREP_OPTIONS="--color=auto --exclude-dir=$EXC_FOLDERS"
|
||||||
|
elif grep-flags-available --color=auto --exclude=.cvs; then
|
||||||
|
GREP_OPTIONS="--color=auto --exclude=$EXC_FOLDERS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$GREP_OPTIONS" ]]; then
|
||||||
|
# export grep, egrep and fgrep settings
|
||||||
|
alias grep="grep $GREP_OPTIONS"
|
||||||
|
alias egrep="grep -E $GREP_OPTIONS"
|
||||||
|
alias fgrep="grep -F $GREP_OPTIONS"
|
||||||
|
|
||||||
|
# write to cache file if cache directory is writable
|
||||||
|
if [[ -w "$ZSH_CACHE_DIR" ]]; then
|
||||||
|
alias -L grep egrep fgrep >| "$__GREP_CACHE_FILE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
unset GREP_OPTIONS EXC_FOLDERS
|
||||||
|
unfunction grep-flags-available
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset __GREP_CACHE_FILE __GREP_ALIAS_CACHES
|
||||||
40
dot_oh-my-zsh/lib/history.zsh
Normal file
40
dot_oh-my-zsh/lib/history.zsh
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
## History wrapper
|
||||||
|
function omz_history {
|
||||||
|
local clear list
|
||||||
|
zparseopts -E c=clear l=list
|
||||||
|
|
||||||
|
if [[ -n "$clear" ]]; then
|
||||||
|
# if -c provided, clobber the history file
|
||||||
|
echo -n >| "$HISTFILE"
|
||||||
|
fc -p "$HISTFILE"
|
||||||
|
echo >&2 History file deleted.
|
||||||
|
elif [[ -n "$list" ]]; then
|
||||||
|
# if -l provided, run as if calling `fc' directly
|
||||||
|
builtin fc "$@"
|
||||||
|
else
|
||||||
|
# unless a number is provided, show all history events (starting from 1)
|
||||||
|
[[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Timestamp format
|
||||||
|
case ${HIST_STAMPS-} in
|
||||||
|
"mm/dd/yyyy") alias history='omz_history -f' ;;
|
||||||
|
"dd.mm.yyyy") alias history='omz_history -E' ;;
|
||||||
|
"yyyy-mm-dd") alias history='omz_history -i' ;;
|
||||||
|
"") alias history='omz_history' ;;
|
||||||
|
*) alias history="omz_history -t '$HIST_STAMPS'" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
## History file configuration
|
||||||
|
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
|
||||||
|
[ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
|
||||||
|
[ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
|
||||||
|
|
||||||
|
## History command configuration
|
||||||
|
setopt extended_history # record timestamp of command in HISTFILE
|
||||||
|
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||||
|
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||||
|
setopt hist_ignore_space # ignore commands that start with space
|
||||||
|
setopt hist_verify # show command with history expansion to user before running it
|
||||||
|
setopt share_history # share command history data
|
||||||
138
dot_oh-my-zsh/lib/key-bindings.zsh
Normal file
138
dot_oh-my-zsh/lib/key-bindings.zsh
Normal file
|
|
@ -0,0 +1,138 @@
|
||||||
|
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html
|
||||||
|
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins
|
||||||
|
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets
|
||||||
|
|
||||||
|
# Make sure that the terminal is in application mode when zle is active, since
|
||||||
|
# only then values from $terminfo are valid
|
||||||
|
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
||||||
|
function zle-line-init() {
|
||||||
|
echoti smkx
|
||||||
|
}
|
||||||
|
function zle-line-finish() {
|
||||||
|
echoti rmkx
|
||||||
|
}
|
||||||
|
zle -N zle-line-init
|
||||||
|
zle -N zle-line-finish
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use emacs key bindings
|
||||||
|
bindkey -e
|
||||||
|
|
||||||
|
# [PageUp] - Up a line of history
|
||||||
|
if [[ -n "${terminfo[kpp]}" ]]; then
|
||||||
|
bindkey -M emacs "${terminfo[kpp]}" up-line-or-history
|
||||||
|
bindkey -M viins "${terminfo[kpp]}" up-line-or-history
|
||||||
|
bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history
|
||||||
|
fi
|
||||||
|
# [PageDown] - Down a line of history
|
||||||
|
if [[ -n "${terminfo[knp]}" ]]; then
|
||||||
|
bindkey -M emacs "${terminfo[knp]}" down-line-or-history
|
||||||
|
bindkey -M viins "${terminfo[knp]}" down-line-or-history
|
||||||
|
bindkey -M vicmd "${terminfo[knp]}" down-line-or-history
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start typing + [Up-Arrow] - fuzzy find history forward
|
||||||
|
if [[ -n "${terminfo[kcuu1]}" ]]; then
|
||||||
|
autoload -U up-line-or-beginning-search
|
||||||
|
zle -N up-line-or-beginning-search
|
||||||
|
|
||||||
|
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||||
|
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||||
|
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||||
|
fi
|
||||||
|
# Start typing + [Down-Arrow] - fuzzy find history backward
|
||||||
|
if [[ -n "${terminfo[kcud1]}" ]]; then
|
||||||
|
autoload -U down-line-or-beginning-search
|
||||||
|
zle -N down-line-or-beginning-search
|
||||||
|
|
||||||
|
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||||
|
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||||
|
bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||||
|
fi
|
||||||
|
|
||||||
|
# [Home] - Go to beginning of line
|
||||||
|
if [[ -n "${terminfo[khome]}" ]]; then
|
||||||
|
bindkey -M emacs "${terminfo[khome]}" beginning-of-line
|
||||||
|
bindkey -M viins "${terminfo[khome]}" beginning-of-line
|
||||||
|
bindkey -M vicmd "${terminfo[khome]}" beginning-of-line
|
||||||
|
fi
|
||||||
|
# [End] - Go to end of line
|
||||||
|
if [[ -n "${terminfo[kend]}" ]]; then
|
||||||
|
bindkey -M emacs "${terminfo[kend]}" end-of-line
|
||||||
|
bindkey -M viins "${terminfo[kend]}" end-of-line
|
||||||
|
bindkey -M vicmd "${terminfo[kend]}" end-of-line
|
||||||
|
fi
|
||||||
|
|
||||||
|
# [Shift-Tab] - move through the completion menu backwards
|
||||||
|
if [[ -n "${terminfo[kcbt]}" ]]; then
|
||||||
|
bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete
|
||||||
|
bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete
|
||||||
|
bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete
|
||||||
|
fi
|
||||||
|
|
||||||
|
# [Backspace] - delete backward
|
||||||
|
bindkey -M emacs '^?' backward-delete-char
|
||||||
|
bindkey -M viins '^?' backward-delete-char
|
||||||
|
bindkey -M vicmd '^?' backward-delete-char
|
||||||
|
# [Delete] - delete forward
|
||||||
|
if [[ -n "${terminfo[kdch1]}" ]]; then
|
||||||
|
bindkey -M emacs "${terminfo[kdch1]}" delete-char
|
||||||
|
bindkey -M viins "${terminfo[kdch1]}" delete-char
|
||||||
|
bindkey -M vicmd "${terminfo[kdch1]}" delete-char
|
||||||
|
else
|
||||||
|
bindkey -M emacs "^[[3~" delete-char
|
||||||
|
bindkey -M viins "^[[3~" delete-char
|
||||||
|
bindkey -M vicmd "^[[3~" delete-char
|
||||||
|
|
||||||
|
bindkey -M emacs "^[3;5~" delete-char
|
||||||
|
bindkey -M viins "^[3;5~" delete-char
|
||||||
|
bindkey -M vicmd "^[3;5~" delete-char
|
||||||
|
fi
|
||||||
|
|
||||||
|
# [Ctrl-Delete] - delete whole forward-word
|
||||||
|
bindkey -M emacs '^[[3;5~' kill-word
|
||||||
|
bindkey -M viins '^[[3;5~' kill-word
|
||||||
|
bindkey -M vicmd '^[[3;5~' kill-word
|
||||||
|
|
||||||
|
# [Ctrl-RightArrow] - move forward one word
|
||||||
|
bindkey -M emacs '^[[1;5C' forward-word
|
||||||
|
bindkey -M viins '^[[1;5C' forward-word
|
||||||
|
bindkey -M vicmd '^[[1;5C' forward-word
|
||||||
|
# [Ctrl-LeftArrow] - move backward one word
|
||||||
|
bindkey -M emacs '^[[1;5D' backward-word
|
||||||
|
bindkey -M viins '^[[1;5D' backward-word
|
||||||
|
bindkey -M vicmd '^[[1;5D' backward-word
|
||||||
|
|
||||||
|
|
||||||
|
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
|
||||||
|
bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
|
||||||
|
bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
|
||||||
|
bindkey ' ' magic-space # [Space] - don't do history expansion
|
||||||
|
|
||||||
|
|
||||||
|
# Edit the current command line in $EDITOR
|
||||||
|
autoload -U edit-command-line
|
||||||
|
zle -N edit-command-line
|
||||||
|
bindkey '\C-x\C-e' edit-command-line
|
||||||
|
|
||||||
|
# file rename magick
|
||||||
|
bindkey "^[m" copy-prev-shell-word
|
||||||
|
|
||||||
|
# consider emacs keybindings:
|
||||||
|
|
||||||
|
#bindkey -e ## emacs key bindings
|
||||||
|
#
|
||||||
|
#bindkey '^[[A' up-line-or-search
|
||||||
|
#bindkey '^[[B' down-line-or-search
|
||||||
|
#bindkey '^[^[[C' emacs-forward-word
|
||||||
|
#bindkey '^[^[[D' emacs-backward-word
|
||||||
|
#
|
||||||
|
#bindkey -s '^X^Z' '%-^M'
|
||||||
|
#bindkey '^[e' expand-cmd-path
|
||||||
|
#bindkey '^[^I' reverse-menu-complete
|
||||||
|
#bindkey '^X^N' accept-and-infer-next-history
|
||||||
|
#bindkey '^W' kill-region
|
||||||
|
#bindkey '^I' complete-word
|
||||||
|
## Fix weird sequence that rxvt produces
|
||||||
|
#bindkey -s '^[[Z' '\t'
|
||||||
|
#
|
||||||
33
dot_oh-my-zsh/lib/misc.zsh
Normal file
33
dot_oh-my-zsh/lib/misc.zsh
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
autoload -Uz is-at-least
|
||||||
|
|
||||||
|
# *-magic is known buggy in some versions; disable if so
|
||||||
|
if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then
|
||||||
|
for d in $fpath; do
|
||||||
|
if [[ -e "$d/url-quote-magic" ]]; then
|
||||||
|
if is-at-least 5.1; then
|
||||||
|
autoload -Uz bracketed-paste-magic
|
||||||
|
zle -N bracketed-paste bracketed-paste-magic
|
||||||
|
fi
|
||||||
|
autoload -Uz url-quote-magic
|
||||||
|
zle -N self-insert url-quote-magic
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
setopt multios # enable redirect to multiple streams: echo >file1 >file2
|
||||||
|
setopt long_list_jobs # show long list format job notifications
|
||||||
|
setopt interactivecomments # recognize comments
|
||||||
|
|
||||||
|
env_default 'PAGER' 'less'
|
||||||
|
env_default 'LESS' '-R'
|
||||||
|
|
||||||
|
## super user alias
|
||||||
|
alias _='sudo '
|
||||||
|
|
||||||
|
## more intelligent acking for ubuntu users and no alias for users without ack
|
||||||
|
if (( $+commands[ack-grep] )); then
|
||||||
|
alias afind='ack-grep -il'
|
||||||
|
elif (( $+commands[ack] )); then
|
||||||
|
alias afind='ack -il'
|
||||||
|
fi
|
||||||
6
dot_oh-my-zsh/lib/nvm.zsh
Normal file
6
dot_oh-my-zsh/lib/nvm.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# get the nvm-controlled node.js version
|
||||||
|
function nvm_prompt_info() {
|
||||||
|
which nvm &>/dev/null || return
|
||||||
|
local nvm_prompt=${$(nvm current)#v}
|
||||||
|
echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt:gs/%/%%}${ZSH_THEME_NVM_PROMPT_SUFFIX}"
|
||||||
|
}
|
||||||
44
dot_oh-my-zsh/lib/prompt_info_functions.zsh
Normal file
44
dot_oh-my-zsh/lib/prompt_info_functions.zsh
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
# *_prompt_info functions for usage in your prompt
|
||||||
|
#
|
||||||
|
# Plugin creators, please add your *_prompt_info function to the list
|
||||||
|
# of dummy implementations to help theme creators not receiving errors
|
||||||
|
# without the need of implementing conditional clauses.
|
||||||
|
#
|
||||||
|
# See also lib/bzr.zsh, lib/git.zsh and lib/nvm.zsh for
|
||||||
|
# git_prompt_info, bzr_prompt_info and nvm_prompt_info
|
||||||
|
|
||||||
|
# Dummy implementations that return false to prevent command_not_found
|
||||||
|
# errors with themes, that implement these functions
|
||||||
|
# Real implementations will be used when the respective plugins are loaded
|
||||||
|
function chruby_prompt_info \
|
||||||
|
rbenv_prompt_info \
|
||||||
|
hg_prompt_info \
|
||||||
|
pyenv_prompt_info \
|
||||||
|
svn_prompt_info \
|
||||||
|
vi_mode_prompt_info \
|
||||||
|
virtualenv_prompt_info \
|
||||||
|
jenv_prompt_info \
|
||||||
|
azure_prompt_info \
|
||||||
|
tf_prompt_info \
|
||||||
|
{
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# oh-my-zsh supports an rvm prompt by default
|
||||||
|
# get the name of the rvm ruby version
|
||||||
|
function rvm_prompt_info() {
|
||||||
|
[ -f $HOME/.rvm/bin/rvm-prompt ] || return 1
|
||||||
|
local rvm_prompt
|
||||||
|
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
|
||||||
|
[[ -z "${rvm_prompt}" ]] && return 1
|
||||||
|
echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt:gs/%/%%}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
||||||
|
}
|
||||||
|
|
||||||
|
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
|
||||||
|
|
||||||
|
|
||||||
|
# use this to enable users to see their ruby version, no matter which
|
||||||
|
# version management system they use
|
||||||
|
function ruby_prompt_info() {
|
||||||
|
echo $(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info)
|
||||||
|
}
|
||||||
37
dot_oh-my-zsh/lib/spectrum.zsh
Normal file
37
dot_oh-my-zsh/lib/spectrum.zsh
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# A script to make using 256 colors in zsh less painful.
|
||||||
|
# P.C. Shyamshankar <sykora@lucentbeing.com>
|
||||||
|
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
|
||||||
|
|
||||||
|
typeset -AHg FX FG BG
|
||||||
|
|
||||||
|
FX=(
|
||||||
|
reset "%{[00m%}"
|
||||||
|
bold "%{[01m%}" no-bold "%{[22m%}"
|
||||||
|
italic "%{[03m%}" no-italic "%{[23m%}"
|
||||||
|
underline "%{[04m%}" no-underline "%{[24m%}"
|
||||||
|
blink "%{[05m%}" no-blink "%{[25m%}"
|
||||||
|
reverse "%{[07m%}" no-reverse "%{[27m%}"
|
||||||
|
)
|
||||||
|
|
||||||
|
for color in {000..255}; do
|
||||||
|
FG[$color]="%{[38;5;${color}m%}"
|
||||||
|
BG[$color]="%{[48;5;${color}m%}"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Show all 256 colors with color number
|
||||||
|
function spectrum_ls() {
|
||||||
|
setopt localoptions nopromptsubst
|
||||||
|
local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
|
||||||
|
for code in {000..255}; do
|
||||||
|
print -P -- "$code: ${FG[$code]}${ZSH_SPECTRUM_TEXT}%{$reset_color%}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Show all 256 colors where the background is set to specific color
|
||||||
|
function spectrum_bls() {
|
||||||
|
setopt localoptions nopromptsubst
|
||||||
|
local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
|
||||||
|
for code in {000..255}; do
|
||||||
|
print -P -- "$code: ${BG[$code]}${ZSH_SPECTRUM_TEXT}%{$reset_color%}"
|
||||||
|
done
|
||||||
|
}
|
||||||
136
dot_oh-my-zsh/lib/termsupport.zsh
Normal file
136
dot_oh-my-zsh/lib/termsupport.zsh
Normal file
|
|
@ -0,0 +1,136 @@
|
||||||
|
# Set terminal window and tab/icon title
|
||||||
|
#
|
||||||
|
# usage: title short_tab_title [long_window_title]
|
||||||
|
#
|
||||||
|
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
|
||||||
|
# Fully supports screen, iterm, and probably most modern xterm and rxvt
|
||||||
|
# (In screen, only short_tab_title is used)
|
||||||
|
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
|
||||||
|
function title {
|
||||||
|
setopt localoptions nopromptsubst
|
||||||
|
|
||||||
|
# Don't set the title if inside emacs, unless using vterm
|
||||||
|
[[ -n "${INSIDE_EMACS:-}" && "$INSIDE_EMACS" != vterm ]] && return
|
||||||
|
|
||||||
|
# if $2 is unset use $1 as default
|
||||||
|
# if it is set and empty, leave it as is
|
||||||
|
: ${2=$1}
|
||||||
|
|
||||||
|
case "$TERM" in
|
||||||
|
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*|foot)
|
||||||
|
print -Pn "\e]2;${2:q}\a" # set window name
|
||||||
|
print -Pn "\e]1;${1:q}\a" # set tab name
|
||||||
|
;;
|
||||||
|
screen*|tmux*)
|
||||||
|
print -Pn "\ek${1:q}\e\\" # set screen hardstatus
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||||
|
print -Pn "\e]2;${2:q}\a" # set window name
|
||||||
|
print -Pn "\e]1;${1:q}\a" # set tab name
|
||||||
|
else
|
||||||
|
# Try to use terminfo to set the title if the feature is available
|
||||||
|
if (( ${+terminfo[fsl]} && ${+terminfo[tsl]} )); then
|
||||||
|
print -Pn "${terminfo[tsl]}$1${terminfo[fsl]}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
|
||||||
|
ZSH_THEME_TERM_TITLE_IDLE="%n@%m:%~"
|
||||||
|
# Avoid duplication of directory in terminals with independent dir display
|
||||||
|
if [[ "$TERM_PROGRAM" == Apple_Terminal ]]; then
|
||||||
|
ZSH_THEME_TERM_TITLE_IDLE="%n@%m"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Runs before showing the prompt
|
||||||
|
function omz_termsupport_precmd {
|
||||||
|
[[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return
|
||||||
|
title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Runs before executing the command
|
||||||
|
function omz_termsupport_preexec {
|
||||||
|
[[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return
|
||||||
|
|
||||||
|
emulate -L zsh
|
||||||
|
setopt extended_glob
|
||||||
|
|
||||||
|
# split command into array of arguments
|
||||||
|
local -a cmdargs
|
||||||
|
cmdargs=("${(z)2}")
|
||||||
|
# if running fg, extract the command from the job description
|
||||||
|
if [[ "${cmdargs[1]}" = fg ]]; then
|
||||||
|
# get the job id from the first argument passed to the fg command
|
||||||
|
local job_id jobspec="${cmdargs[2]#%}"
|
||||||
|
# logic based on jobs arguments:
|
||||||
|
# http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs
|
||||||
|
# https://www.zsh.org/mla/users/2007/msg00704.html
|
||||||
|
case "$jobspec" in
|
||||||
|
<->) # %number argument:
|
||||||
|
# use the same <number> passed as an argument
|
||||||
|
job_id=${jobspec} ;;
|
||||||
|
""|%|+) # empty, %% or %+ argument:
|
||||||
|
# use the current job, which appears with a + in $jobstates:
|
||||||
|
# suspended:+:5071=suspended (tty output)
|
||||||
|
job_id=${(k)jobstates[(r)*:+:*]} ;;
|
||||||
|
-) # %- argument:
|
||||||
|
# use the previous job, which appears with a - in $jobstates:
|
||||||
|
# suspended:-:6493=suspended (signal)
|
||||||
|
job_id=${(k)jobstates[(r)*:-:*]} ;;
|
||||||
|
[?]*) # %?string argument:
|
||||||
|
# use $jobtexts to match for a job whose command *contains* <string>
|
||||||
|
job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;;
|
||||||
|
*) # %string argument:
|
||||||
|
# use $jobtexts to match for a job whose command *starts with* <string>
|
||||||
|
job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# override preexec function arguments with job command
|
||||||
|
if [[ -n "${jobtexts[$job_id]}" ]]; then
|
||||||
|
1="${jobtexts[$job_id]}"
|
||||||
|
2="${jobtexts[$job_id]}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cmd name only, or if this is sudo or ssh, the next cmd
|
||||||
|
local CMD="${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}"
|
||||||
|
local LINE="${2:gs/%/%%}"
|
||||||
|
|
||||||
|
title "$CMD" "%100>...>${LINE}%<<"
|
||||||
|
}
|
||||||
|
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
|
if [[ -z "$INSIDE_EMACS" || "$INSIDE_EMACS" = vterm ]]; then
|
||||||
|
add-zsh-hook precmd omz_termsupport_precmd
|
||||||
|
add-zsh-hook preexec omz_termsupport_preexec
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Keep Apple Terminal.app's current working directory updated
|
||||||
|
# Based on this answer: https://superuser.com/a/315029
|
||||||
|
# With extra fixes to handle multibyte chars and non-UTF-8 locales
|
||||||
|
|
||||||
|
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||||
|
# Emits the control sequence to notify Terminal.app of the cwd
|
||||||
|
# Identifies the directory using a file: URI scheme, including
|
||||||
|
# the host name to disambiguate local vs. remote paths.
|
||||||
|
function update_terminalapp_cwd() {
|
||||||
|
emulate -L zsh
|
||||||
|
|
||||||
|
# Percent-encode the host and path names.
|
||||||
|
local URL_HOST URL_PATH
|
||||||
|
URL_HOST="$(omz_urlencode -P $HOST)" || return 1
|
||||||
|
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
|
||||||
|
|
||||||
|
# Undocumented Terminal.app-specific control sequence
|
||||||
|
printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
|
||||||
|
add-zsh-hook precmd update_terminalapp_cwd
|
||||||
|
# Run once to get initial cwd set
|
||||||
|
update_terminalapp_cwd
|
||||||
|
fi
|
||||||
83
dot_oh-my-zsh/lib/theme-and-appearance.zsh
Normal file
83
dot_oh-my-zsh/lib/theme-and-appearance.zsh
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
# Sets color variable such as $fg, $bg, $color and $reset_color
|
||||||
|
autoload -U colors && colors
|
||||||
|
|
||||||
|
# Expand variables and commands in PROMPT variables
|
||||||
|
setopt prompt_subst
|
||||||
|
|
||||||
|
# Prompt function theming defaults
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Beginning of the git prompt, before the branch name
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # End of the git prompt
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
|
||||||
|
ZSH_THEME_RUBY_PROMPT_PREFIX="("
|
||||||
|
ZSH_THEME_RUBY_PROMPT_SUFFIX=")"
|
||||||
|
|
||||||
|
|
||||||
|
# Use diff --color if available
|
||||||
|
if command diff --color /dev/null{,} &>/dev/null; then
|
||||||
|
function diff {
|
||||||
|
command diff --color "$@"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Don't set ls coloring if disabled
|
||||||
|
[[ "$DISABLE_LS_COLORS" != true ]] || return 0
|
||||||
|
|
||||||
|
function test-ls-args {
|
||||||
|
local cmd="$1" # ls, gls, colorls, ...
|
||||||
|
local args="${@[2,-1]}" # arguments except the first one
|
||||||
|
command "$cmd" "$args" /dev/null &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Find the option for using colors in ls, depending on the version
|
||||||
|
case "$OSTYPE" in
|
||||||
|
netbsd*)
|
||||||
|
# On NetBSD, test if `gls` (GNU ls) is installed (this one supports colors);
|
||||||
|
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
|
||||||
|
test-ls-args gls --color && alias ls='gls --color=tty'
|
||||||
|
;;
|
||||||
|
openbsd*)
|
||||||
|
# On OpenBSD, `gls` (ls from GNU coreutils) and `colorls` (ls from base,
|
||||||
|
# with color and multibyte support) are available from ports.
|
||||||
|
# `colorls` will be installed on purpose and can't be pulled in by installing
|
||||||
|
# coreutils (which might be installed for ), so prefer it to `gls`.
|
||||||
|
test-ls-args gls --color && alias ls='gls --color=tty'
|
||||||
|
test-ls-args colorls -G && alias ls='colorls -G'
|
||||||
|
;;
|
||||||
|
(darwin|freebsd)*)
|
||||||
|
# This alias works by default just using $LSCOLORS
|
||||||
|
test-ls-args ls -G && alias ls='ls -G'
|
||||||
|
# Only use GNU ls if installed and there are user defaults for $LS_COLORS,
|
||||||
|
# as the default coloring scheme is not very pretty
|
||||||
|
[[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] \
|
||||||
|
&& test-ls-args gls --color \
|
||||||
|
&& alias ls='gls --color=tty'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if test-ls-args ls --color; then
|
||||||
|
alias ls='ls --color=tty'
|
||||||
|
elif test-ls-args ls -G; then
|
||||||
|
alias ls='ls -G'
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
unfunction test-ls-args
|
||||||
|
|
||||||
|
|
||||||
|
# Default coloring for BSD-based ls
|
||||||
|
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||||
|
|
||||||
|
# Default coloring for GNU-based ls
|
||||||
|
if [[ -z "$LS_COLORS" ]]; then
|
||||||
|
# Define LS_COLORS via dircolors if available. Otherwise, set a default
|
||||||
|
# equivalent to LSCOLORS (generated via https://geoff.greer.fm/lscolors)
|
||||||
|
if (( $+commands[dircolors] )); then
|
||||||
|
[[ -f "$HOME/.dircolors" ]] \
|
||||||
|
&& source <(dircolors -b "$HOME/.dircolors") \
|
||||||
|
|| source <(dircolors -b)
|
||||||
|
else
|
||||||
|
export LS_COLORS="di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
53
dot_oh-my-zsh/lib/vcs_info.zsh
Normal file
53
dot_oh-my-zsh/lib/vcs_info.zsh
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
# Don't skip this file until a Zsh release does the necessary quoting.
|
||||||
|
# This is because even though 5.8.1 undid recursive prompt_subst inside
|
||||||
|
# prompt sequences, % characters in relevant fields will still be rendered
|
||||||
|
# incorrectly in vcs_info, on all Zsh releases up to writing this.
|
||||||
|
#
|
||||||
|
# There is no release yet that does this right, since it requires changing
|
||||||
|
# how what vcs_info hooks expect to receive. Even so, I'd rather be correct
|
||||||
|
# and break custom vcs_info hooks than have a broken prompt.
|
||||||
|
|
||||||
|
# Quote necessary $hook_com[<field>] items just before they are used
|
||||||
|
# in the line "VCS_INFO_hook 'post-backend'" of the VCS_INFO_formats
|
||||||
|
# function, where <field> is:
|
||||||
|
#
|
||||||
|
# base: the full path of the repository's root directory.
|
||||||
|
# base-name: the name of the repository's root directory.
|
||||||
|
# branch: the name of the currently checked out branch.
|
||||||
|
# misc: a string that may contain anything the vcs_info backend wants.
|
||||||
|
# revision: an identifier of the currently checked out revision.
|
||||||
|
# subdir: the path of the current directory relative to the
|
||||||
|
# repository's root directory.
|
||||||
|
#
|
||||||
|
# This patch %-quotes these fields previous to their use in vcs_info hooks and
|
||||||
|
# the zformat call and, eventually, when they get expanded in the prompt.
|
||||||
|
# It's important to quote these here, and not later after hooks have modified the
|
||||||
|
# fields, because then we could be quoting % characters from valid prompt sequences,
|
||||||
|
# like %F{color}, %B, etc.
|
||||||
|
#
|
||||||
|
# 32 │ hook_com[subdir]="$(VCS_INFO_reposub ${hook_com[base]})"
|
||||||
|
# 33 │ hook_com[subdir_orig]="${hook_com[subdir]}"
|
||||||
|
# 34 │
|
||||||
|
# 35 + │ for tmp in base base-name branch misc revision subdir; do
|
||||||
|
# 36 + │ hook_com[$tmp]="${hook_com[$tmp]//\%/%%}"
|
||||||
|
# 37 + │ done
|
||||||
|
# 38 + │
|
||||||
|
# 39 │ VCS_INFO_hook 'post-backend'
|
||||||
|
#
|
||||||
|
# This is especially important so that no command substitution is performed
|
||||||
|
# due to malicious input as a consequence of CVE-2021-45444, which affects
|
||||||
|
# zsh versions from 5.0.3 to 5.8.
|
||||||
|
#
|
||||||
|
autoload -Uz +X regexp-replace VCS_INFO_formats 2>/dev/null || return 0
|
||||||
|
|
||||||
|
# We use $tmp here because it's already a local variable in VCS_INFO_formats
|
||||||
|
typeset PATCH='for tmp (base base-name branch misc revision subdir) hook_com[$tmp]="${hook_com[$tmp]//\%/%%}"'
|
||||||
|
# Unique string to avoid reapplying the patch if this code gets called twice
|
||||||
|
typeset PATCH_ID=vcs_info-patch-9b9840f2-91e5-4471-af84-9e9a0dc68c1b
|
||||||
|
# Only patch the VCS_INFO_formats function if not already patched
|
||||||
|
if [[ "$functions[VCS_INFO_formats]" != *$PATCH_ID* ]]; then
|
||||||
|
regexp-replace 'functions[VCS_INFO_formats]' \
|
||||||
|
"VCS_INFO_hook 'post-backend'" \
|
||||||
|
': ${PATCH_ID}; ${PATCH}; ${MATCH}'
|
||||||
|
fi
|
||||||
|
unset PATCH PATCH_ID
|
||||||
0
dot_oh-my-zsh/log/empty_dot_gitkeep
Normal file
0
dot_oh-my-zsh/log/empty_dot_gitkeep
Normal file
194
dot_oh-my-zsh/oh-my-zsh.sh
Normal file
194
dot_oh-my-zsh/oh-my-zsh.sh
Normal file
|
|
@ -0,0 +1,194 @@
|
||||||
|
# Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here)
|
||||||
|
[ -n "$ZSH_VERSION" ] || {
|
||||||
|
# ANSI formatting function (\033[<code>m)
|
||||||
|
# 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow
|
||||||
|
omz_f() {
|
||||||
|
[ $# -gt 0 ] || return
|
||||||
|
IFS=";" printf "\033[%sm" $*
|
||||||
|
}
|
||||||
|
# If stdout is not a terminal ignore all formatting
|
||||||
|
[ -t 1 ] || omz_f() { :; }
|
||||||
|
|
||||||
|
omz_ptree() {
|
||||||
|
# Get process tree of the current process
|
||||||
|
pid=$$; pids="$pid"
|
||||||
|
while [ ${pid-0} -ne 1 ] && ppid=$(ps -e -o pid,ppid | awk "\$1 == $pid { print \$2 }"); do
|
||||||
|
pids="$pids $pid"; pid=$ppid
|
||||||
|
done
|
||||||
|
|
||||||
|
# Show process tree
|
||||||
|
case "$(uname)" in
|
||||||
|
Linux) ps -o ppid,pid,command -f -p $pids 2>/dev/null ;;
|
||||||
|
Darwin|*) ps -o ppid,pid,command -p $pids 2>/dev/null ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# If ps command failed, try Busybox ps
|
||||||
|
[ $? -eq 0 ] || ps -o ppid,pid,comm | awk "NR == 1 || index(\"$pids\", \$2) != 0"
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
shell=$(ps -o pid,comm | awk "\$1 == $$ { print \$2 }")
|
||||||
|
printf "$(omz_f 1 31)Error:$(omz_f 22) Oh My Zsh can't be loaded from: $(omz_f 1)${shell}$(omz_f 22). "
|
||||||
|
printf "You need to run $(omz_f 1)zsh$(omz_f 22) instead.$(omz_f 0)\n"
|
||||||
|
printf "$(omz_f 33)Here's the process tree:$(omz_f 22)\n\n"
|
||||||
|
omz_ptree
|
||||||
|
printf "$(omz_f 0)\n"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# If ZSH is not defined, use the current script's directory.
|
||||||
|
[[ -z "$ZSH" ]] && export ZSH="${${(%):-%x}:a:h}"
|
||||||
|
|
||||||
|
# Set ZSH_CACHE_DIR to the path where cache files should be created
|
||||||
|
# or else we will use the default cache/
|
||||||
|
if [[ -z "$ZSH_CACHE_DIR" ]]; then
|
||||||
|
ZSH_CACHE_DIR="$ZSH/cache"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure $ZSH_CACHE_DIR is writable, otherwise use a directory in $HOME
|
||||||
|
if [[ ! -w "$ZSH_CACHE_DIR" ]]; then
|
||||||
|
ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create cache and completions dir and add to $fpath
|
||||||
|
mkdir -p "$ZSH_CACHE_DIR/completions"
|
||||||
|
(( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
|
||||||
|
|
||||||
|
# Check for updates on initial load...
|
||||||
|
source "$ZSH/tools/check_for_upgrade.sh"
|
||||||
|
|
||||||
|
# Initializes Oh My Zsh
|
||||||
|
|
||||||
|
# add a function path
|
||||||
|
fpath=("$ZSH/functions" "$ZSH/completions" $fpath)
|
||||||
|
|
||||||
|
# Load all stock functions (from $fpath files) called below.
|
||||||
|
autoload -U compaudit compinit zrecompile
|
||||||
|
|
||||||
|
# Set ZSH_CUSTOM to the path where your custom config files
|
||||||
|
# and plugins exists, or else we will use the default custom/
|
||||||
|
if [[ -z "$ZSH_CUSTOM" ]]; then
|
||||||
|
ZSH_CUSTOM="$ZSH/custom"
|
||||||
|
fi
|
||||||
|
|
||||||
|
is_plugin() {
|
||||||
|
local base_dir=$1
|
||||||
|
local name=$2
|
||||||
|
builtin test -f $base_dir/plugins/$name/$name.plugin.zsh \
|
||||||
|
|| builtin test -f $base_dir/plugins/$name/_$name
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add all defined plugins to fpath. This must be done
|
||||||
|
# before running compinit.
|
||||||
|
for plugin ($plugins); do
|
||||||
|
if is_plugin "$ZSH_CUSTOM" "$plugin"; then
|
||||||
|
fpath=("$ZSH_CUSTOM/plugins/$plugin" $fpath)
|
||||||
|
elif is_plugin "$ZSH" "$plugin"; then
|
||||||
|
fpath=("$ZSH/plugins/$plugin" $fpath)
|
||||||
|
else
|
||||||
|
echo "[oh-my-zsh] plugin '$plugin' not found"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Figure out the SHORT hostname
|
||||||
|
if [[ "$OSTYPE" = darwin* ]]; then
|
||||||
|
# macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
||||||
|
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST="${HOST/.*/}"
|
||||||
|
else
|
||||||
|
SHORT_HOST="${HOST/.*/}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Save the location of the current completion dump file.
|
||||||
|
if [[ -z "$ZSH_COMPDUMP" ]]; then
|
||||||
|
ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Construct zcompdump OMZ metadata
|
||||||
|
zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
|
||||||
|
zcompdump_fpath="#omz fpath: $fpath"
|
||||||
|
|
||||||
|
# Delete the zcompdump file if OMZ zcompdump metadata changed
|
||||||
|
if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null \
|
||||||
|
|| ! command grep -q -Fx "$zcompdump_fpath" "$ZSH_COMPDUMP" 2>/dev/null; then
|
||||||
|
command rm -f "$ZSH_COMPDUMP"
|
||||||
|
zcompdump_refresh=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$ZSH_DISABLE_COMPFIX" != true ]]; then
|
||||||
|
source "$ZSH/lib/compfix.zsh"
|
||||||
|
# Load only from secure directories
|
||||||
|
compinit -i -d "$ZSH_COMPDUMP"
|
||||||
|
# If completion insecurities exist, warn the user
|
||||||
|
handle_completion_insecurities &|
|
||||||
|
else
|
||||||
|
# If the user wants it, load from all found directories
|
||||||
|
compinit -u -d "$ZSH_COMPDUMP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Append zcompdump metadata if missing
|
||||||
|
if (( $zcompdump_refresh )) \
|
||||||
|
|| ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null; then
|
||||||
|
# Use `tee` in case the $ZSH_COMPDUMP filename is invalid, to silence the error
|
||||||
|
# See https://github.com/ohmyzsh/ohmyzsh/commit/dd1a7269#commitcomment-39003489
|
||||||
|
tee -a "$ZSH_COMPDUMP" &>/dev/null <<EOF
|
||||||
|
|
||||||
|
$zcompdump_revision
|
||||||
|
$zcompdump_fpath
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
unset zcompdump_revision zcompdump_fpath zcompdump_refresh
|
||||||
|
|
||||||
|
# zcompile the completion dump file if the .zwc is older or missing.
|
||||||
|
if command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then
|
||||||
|
zrecompile -q -p "$ZSH_COMPDUMP"
|
||||||
|
command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
||||||
|
# TIP: Add files you don't want in git to .gitignore
|
||||||
|
for config_file ("$ZSH"/lib/*.zsh); do
|
||||||
|
custom_config_file="$ZSH_CUSTOM/lib/${config_file:t}"
|
||||||
|
[[ -f "$custom_config_file" ]] && config_file="$custom_config_file"
|
||||||
|
source "$config_file"
|
||||||
|
done
|
||||||
|
unset custom_config_file
|
||||||
|
|
||||||
|
# Load all of the plugins that were defined in ~/.zshrc
|
||||||
|
for plugin ($plugins); do
|
||||||
|
if [[ -f "$ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh" ]]; then
|
||||||
|
source "$ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh"
|
||||||
|
elif [[ -f "$ZSH/plugins/$plugin/$plugin.plugin.zsh" ]]; then
|
||||||
|
source "$ZSH/plugins/$plugin/$plugin.plugin.zsh"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset plugin
|
||||||
|
|
||||||
|
# Load all of your custom configurations from custom/
|
||||||
|
for config_file ("$ZSH_CUSTOM"/*.zsh(N)); do
|
||||||
|
source "$config_file"
|
||||||
|
done
|
||||||
|
unset config_file
|
||||||
|
|
||||||
|
# Load the theme
|
||||||
|
is_theme() {
|
||||||
|
local base_dir=$1
|
||||||
|
local name=$2
|
||||||
|
builtin test -f $base_dir/$name.zsh-theme
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -n "$ZSH_THEME" ]]; then
|
||||||
|
if is_theme "$ZSH_CUSTOM" "$ZSH_THEME"; then
|
||||||
|
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
|
||||||
|
elif is_theme "$ZSH_CUSTOM/themes" "$ZSH_THEME"; then
|
||||||
|
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
|
||||||
|
elif is_theme "$ZSH/themes" "$ZSH_THEME"; then
|
||||||
|
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
||||||
|
else
|
||||||
|
echo "[oh-my-zsh] theme '$ZSH_THEME' not found"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set completion colors to be the same as `ls`, after theme has been loaded
|
||||||
|
[[ -z "$LS_COLORS" ]] || zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||||
9
dot_oh-my-zsh/plugins/1password/1password.plugin.zsh
Normal file
9
dot_oh-my-zsh/plugins/1password/1password.plugin.zsh
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Do nothing if op is not installed
|
||||||
|
(( ${+commands[op]} )) || return
|
||||||
|
|
||||||
|
# Load op completion
|
||||||
|
eval "$(op completion zsh)"
|
||||||
|
compdef _op op
|
||||||
|
|
||||||
|
# Load opswd function
|
||||||
|
autoload -Uz opswd
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue