Compare commits
2 Commits
d40e536ed5
...
0719d9cedb
Author | SHA1 | Date |
---|---|---|
Ambrose Chua | 0719d9cedb | |
Ambrose Chua | 27bb0fe5ea |
|
@ -1,3 +1,11 @@
|
||||||
|
"
|
||||||
|
" Tips:
|
||||||
|
"
|
||||||
|
" - :noh to clear highlighting
|
||||||
|
" - gd to go to definition
|
||||||
|
" - g* to search for current word
|
||||||
|
"
|
||||||
|
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
|
|
||||||
" rust
|
" rust
|
||||||
|
@ -26,13 +34,13 @@ let g:go_highlight_generate_tags = 1
|
||||||
let g:go_metalinter_autosave = 1
|
let g:go_metalinter_autosave = 1
|
||||||
let g:go_fmt_command = "goimports"
|
let g:go_fmt_command = "goimports"
|
||||||
let g:go_list_type_commands = {"GoMetaLinterAutoSave": "quickfix"}
|
let g:go_list_type_commands = {"GoMetaLinterAutoSave": "quickfix"}
|
||||||
|
autocmd FileType go nmap <leader>a <Plug>(go-alternate-edit)
|
||||||
autocmd FileType go nmap <leader>t <Plug>(go-test)
|
autocmd FileType go nmap <leader>t <Plug>(go-test)
|
||||||
autocmd FileType go nmap <Leader>c <Plug>(go-coverage-toggle)
|
autocmd FileType go nmap <Leader>c <Plug>(go-coverage-toggle)
|
||||||
autocmd FileType go nmap <leader>b <Plug>(go-build)
|
autocmd FileType go nmap <leader>b <Plug>(go-build)
|
||||||
autocmd FileType go nmap <leader>r <Plug>(go-run)
|
autocmd FileType go nmap <leader>r <Plug>(go-run)
|
||||||
" K -> :GoDoc
|
" K -> :GoDoc
|
||||||
|
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
" theme
|
" theme
|
||||||
|
|
99
.zshrc
99
.zshrc
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
# basic settings
|
# basic settings
|
||||||
|
|
||||||
HISTSIZE=10000
|
HISTSIZE=5000
|
||||||
SAVEHIST=50000
|
SAVEHIST=5000
|
||||||
HISTFILE=~/.zsh_history
|
HISTFILE=~/.zsh_history
|
||||||
setopt append_history
|
setopt append_history
|
||||||
setopt extended_history
|
setopt extended_history
|
||||||
|
@ -24,6 +24,33 @@ bindkey "^R" history-incremental-pattern-search-backward
|
||||||
alias vim=nvim
|
alias vim=nvim
|
||||||
export EDITOR=nvim
|
export EDITOR=nvim
|
||||||
|
|
||||||
|
# speed
|
||||||
|
|
||||||
|
slower_functions=()
|
||||||
|
load_slower() {
|
||||||
|
for func in $slower_functions; do
|
||||||
|
$func
|
||||||
|
done
|
||||||
|
}
|
||||||
|
slowest_functions=()
|
||||||
|
load_slowest() {
|
||||||
|
for func in $slowest_functions; do
|
||||||
|
$func
|
||||||
|
done
|
||||||
|
}
|
||||||
|
prompt_run_count=0
|
||||||
|
on_second_prompt() {
|
||||||
|
if [[ "$prompt_run_count" == 1 ]]; then
|
||||||
|
#zmodload zsh/zprof
|
||||||
|
prompt_use_italic=true
|
||||||
|
load_slower
|
||||||
|
#load_slowest
|
||||||
|
#zprof
|
||||||
|
fi
|
||||||
|
(( prompt_run_count = prompt_run_count + 1 ))
|
||||||
|
}
|
||||||
|
precmd_functions+=( on_second_prompt )
|
||||||
|
|
||||||
# executables
|
# executables
|
||||||
|
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
@ -31,7 +58,7 @@ if [[ -f "$HOME/.deno" ]]; then
|
||||||
export DENO_INSTALL="$HOME/.deno"
|
export DENO_INSTALL="$HOME/.deno"
|
||||||
export PATH="$DENO_INSTALL/bin:$PATH"
|
export PATH="$DENO_INSTALL/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
if [[ -f "$(which go 2>/dev/null)" ]]; then
|
if [[ -f "$(which ruby 2>/dev/null)" ]]; then
|
||||||
export PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH"
|
export PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
if [[ -f "$(which go 2>/dev/null)" ]]; then
|
if [[ -f "$(which go 2>/dev/null)" ]]; then
|
||||||
|
@ -41,24 +68,6 @@ if [[ -f "$(which cargo 2>/dev/null)" ]]; then
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# completion
|
|
||||||
|
|
||||||
setup_completion() {
|
|
||||||
autoload -U compinit; compinit
|
|
||||||
autoload -U +X bashcompinit && bashcompinit
|
|
||||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
|
||||||
|
|
||||||
if [[ -f "$(which mc 2>/dev/null)" ]]; then
|
|
||||||
complete -o nospace -C mc mc
|
|
||||||
fi
|
|
||||||
if [[ -f "$(which kubectl 2>/dev/null)" ]]; then
|
|
||||||
source <(kubectl completion zsh)
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
if [[ $SLOW == true ]]; then
|
|
||||||
setup_completion
|
|
||||||
fi
|
|
||||||
|
|
||||||
# platform specific
|
# platform specific
|
||||||
|
|
||||||
case "$(uname -s)" in
|
case "$(uname -s)" in
|
||||||
|
@ -85,9 +94,24 @@ if [[ "$TERM" == "xterm-kitty" ]]; then
|
||||||
alias icat="kitty +kitten icat"
|
alias icat="kitty +kitten icat"
|
||||||
alias ssh="kitty +kitten ssh"
|
alias ssh="kitty +kitten ssh"
|
||||||
fi
|
fi
|
||||||
if [[ $FAST != true ]]; then
|
setup_term_integration
|
||||||
setup_term_integration
|
#slower_functions+=( setup_term_integration )
|
||||||
fi
|
|
||||||
|
# completion
|
||||||
|
|
||||||
|
setup_completion() {
|
||||||
|
autoload -U compinit; compinit
|
||||||
|
autoload -U +X bashcompinit && bashcompinit
|
||||||
|
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||||
|
|
||||||
|
if [[ -f "$(which mc 2>/dev/null)" ]]; then
|
||||||
|
complete -o nospace -C mc mc
|
||||||
|
fi
|
||||||
|
if [[ -f "$(which kubectl 2>/dev/null)" ]]; then
|
||||||
|
source <(kubectl completion zsh)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
slowest_functions+=( setup_completion )
|
||||||
|
|
||||||
# directory listings
|
# directory listings
|
||||||
|
|
||||||
|
@ -111,12 +135,7 @@ setup_prompt_vcs() {
|
||||||
zstyle ':vcs_info:*' check-for-changes true
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
prompt_vcs_enabled=false
|
prompt_vcs_enabled=false
|
||||||
precmd_vcs_info() {
|
precmd_vcs_info() {
|
||||||
if [[ $prompt_vcs_enabled == true ]]; then
|
vcs_info
|
||||||
vcs_info
|
|
||||||
elif [[ -d ".git" ]]; then
|
|
||||||
prompt_vcs_enabled=true
|
|
||||||
vcs_info
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
format_vcs_info() {
|
format_vcs_info() {
|
||||||
|
@ -132,9 +151,7 @@ format_vcs_info() {
|
||||||
echo "$text"
|
echo "$text"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
if [[ $FAST != true ]]; then
|
slower_functions+=( setup_prompt_vcs )
|
||||||
setup_prompt_vcs
|
|
||||||
fi
|
|
||||||
# prompt: return code
|
# prompt: return code
|
||||||
format_return_code() {
|
format_return_code() {
|
||||||
return_code_=$1
|
return_code_=$1
|
||||||
|
@ -222,8 +239,10 @@ setup_prompt() {
|
||||||
if [[ ! -z "$SSH_CLIENT" ]]; then
|
if [[ ! -z "$SSH_CLIENT" ]]; then
|
||||||
PROMPT_USER_MACHINE=$'@%m'
|
PROMPT_USER_MACHINE=$'@%m'
|
||||||
fi
|
fi
|
||||||
PROMPT_FMT_ITALIC=$(tput sitm)
|
if [[ $prompt_use_italic == true ]]; then
|
||||||
PROMPT_FMT_RESET=$(tput sgr 0)
|
PROMPT_FMT_ITALIC=$(tput sitm)
|
||||||
|
PROMPT_FMT_RESET=$(tput sgr0)
|
||||||
|
fi
|
||||||
|
|
||||||
PROMPT_USER=$'%{'"$PROMPT_FMT_ITALIC"$'%}%F{'"$PROMPT_COLOR_ALWAYS_BASE3"$'}%(!.%K{'"$PROMPT_COLOR_ORANGE"$'}.%K{'"$PROMPT_COLOR_BLUE"$'}) %n'"$PROMPT_USER_MACHINE"$' %k%f%{'"$PROMPT_FMT_RESET"$'%}'
|
PROMPT_USER=$'%{'"$PROMPT_FMT_ITALIC"$'%}%F{'"$PROMPT_COLOR_ALWAYS_BASE3"$'}%(!.%K{'"$PROMPT_COLOR_ORANGE"$'}.%K{'"$PROMPT_COLOR_BLUE"$'}) %n'"$PROMPT_USER_MACHINE"$' %k%f%{'"$PROMPT_FMT_RESET"$'%}'
|
||||||
PROMPT_HISTORY=$'%F{'"$PROMPT_COLOR_BASE01"$'} %h %f'
|
PROMPT_HISTORY=$'%F{'"$PROMPT_COLOR_BASE01"$'} %h %f'
|
||||||
|
@ -234,7 +253,9 @@ setup_prompt() {
|
||||||
RPROMPT="$PROMPT_HISTORY$PROMPT_USER"
|
RPROMPT="$PROMPT_HISTORY$PROMPT_USER"
|
||||||
PROMPT="$PROMPT_VI$PROMPT_VCS$PROMPT_DIRECTORY "
|
PROMPT="$PROMPT_VI$PROMPT_VCS$PROMPT_DIRECTORY "
|
||||||
}
|
}
|
||||||
|
prompt_use_italic=false
|
||||||
setup_prompt
|
setup_prompt
|
||||||
|
slower_functions+=( setup_prompt )
|
||||||
|
|
||||||
# command entry plugins
|
# command entry plugins
|
||||||
|
|
||||||
|
@ -256,17 +277,13 @@ setup_assistance() {
|
||||||
source "$zsh_plugin_path"
|
source "$zsh_plugin_path"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
if [[ $FAST != true ]]; then
|
slower_functions+=( setup_assistance )
|
||||||
setup_assistance
|
|
||||||
fi
|
|
||||||
setup_nope() {
|
setup_nope() {
|
||||||
if [[ -f "$(which thefuck 2>/dev/null)" ]]; then
|
if [[ -f "$(which thefuck 2>/dev/null)" ]]; then
|
||||||
eval $(thefuck --alias nope)
|
eval $(thefuck --alias nope)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
if [[ $SLOW == true ]]; then
|
slowest_functions+=( setup_nope )
|
||||||
setup_nope
|
|
||||||
fi
|
|
||||||
|
|
||||||
# helper scripts
|
# helper scripts
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue