fix: remove useless code

This commit is contained in:
2024-06-28 15:33:38 +08:00
parent 0247a4c2a0
commit dc376f31e3
5 changed files with 3 additions and 263 deletions
-153
View File
@@ -1,153 +0,0 @@
# 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=$HOME/.oh-my-zsh
# 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="laily"
# Set list of themes to load
# Setting this variable when ZSH_THEME=random
# cause zsh load theme from this variable instead of
# looking in ~/.oh-my-zsh/themes/
# An empty array have no effect
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# 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="mm/dd/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=(
git
extract
docker
docker-compose
)
source $ZSH/oh-my-zsh.sh
# 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'
# 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"
# Ctrl+b/f 向后/前移动一个词
bindkey "^b" backward-word
bindkey "^f" forward-word
# Turn off all beeps
unsetopt BEEP
# Turn off autocomplete beeps
# unsetopt LIST_BEEP
# brew
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
# git
export REVIEW_BASE="master"
# go
export GOPATH=$HOME/go:$HOME/workrepo/go
export PATH=$PATH:$HOME/go/bin
export GOPROXY=goproxy.cn
export GOSUMDB="sum.golang.google.cn"
[ -f ~/.zprofile ] && source ~/.zprofile
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
test -e /home/linuxbrew/.linuxbrew/ && export PATH=$PATH:/home/linuxbrew/.linuxbrew/bin
test -e ~/.pri_scripts && export PATH=$PATH:~/.pri_scripts
# add z
if command -v lua >/dev/null; then
eval "$(lua /usr/local/z.lua/z.lua --init zsh)"
fi
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
# add nvim
export PATH=$PATH:/usr/local/nvim/bin:/usr/local/osx-64/nvim/bin
# for terminal notify
# https://github.com/julienXX/terminal-notifier
alias alert='terminal-notifier -title "Terminal" -message "Done with task! Exit status: $?"' -activate com.apple.Terminal
# git
alias gitb="git branch --show-current | tr -d '\n' | pbcopy"
alias gci="golangci-lint run -c=~/.dotfile/.golangci.yml ./..."
alias gmt="go mod tidy"
alias gtc="go test -gcflags=all=-l -cover ./..."
alias swg="swag init -o docs -g "
alias sws="swagger serve -F=swagger"
function gtr(){
go test -gcflags=all=-l -v -run="$1"
}
fpath+=${ZDOTDIR:-~}/.zsh_functions
-7
View File
@@ -1,7 +0,0 @@
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT='%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m ${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
+2 -2
View File
@@ -4,7 +4,7 @@
"lazyvim.plugins.extras.lang.go"
],
"news": {
"NEWS.md": "2123"
"NEWS.md": "3314"
},
"version": 2
"version": 3
}
+1 -2
View File
@@ -6,7 +6,7 @@ return {
"stylua",
"selene",
"luacheck",
"bashls",
--"bashls",
"shfmt",
"tailwindcss",
"tsserver",
@@ -16,4 +16,3 @@ return {
end,
},
}
-99
View File
@@ -1,99 +0,0 @@
#!/usr/bin/env python3
import subprocess
import os
import argparse
home_dir = os.getenv("HOME")
dotfile_dir = home_dir+"/.dotfile"
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--init", help="init tools", type=str)
args = parser.parse_args()
installer = Installer()
installer.doInit(args.init)
class Base(object):
def cmd_exist(self, name):
from shutil import which
return which(name) is not None
def check_link(self, name: str, target: str):
if os.path.islink(name):
t = os.readlink(name)
if t == target:
print("path is right: %s" % name)
return
if os.path.exists(name):
run("mv %s %s.bak" % (name, name))
run("ln -s %s %s" % (target, name))
def brew_install(self, name: str):
if not self.cmd_exist(name):
run("brew install "+name)
class Installer(Base):
def doInit(self, val: str):
if val == "":
print("install value is empty")
exit()
install_map = {
"brew": self.install_brew,
"neovim": self.install_neovim,
"nvim": self.install_neovim,
"z": self.install_z,
"git": self.install_git,
"go": self.install_go,
"tmux": self.init_tmux,
}
if val in install_map:
install_map.get(val)()
else:
print("cmd not support, install: "+val)
# install neovim
def install_neovim(self):
self.brew_install("neovim")
self.check_link(home_dir+"/.config/nvim", dotfile_dir+"/nvim")
def install_z(self):
if not os.path.exists("/usr/local/z.lua"):
run("git clone --depth=1 https://github.com/skywind3000/z.lua.git /usr/local/z.lua")
def install_git(self):
self.brew_install("git")
self.check_link(home_dir+"/.gitconfig", home_dir +
"/.dotfile/git/.gitconfig")
def install_go(self):
self.brew_install("go")
cwd = os.getcwd()
os.chdir("/usr/local")
if os.path.exists("/usr/local/opt/go/libexec"):
run("sudo mv go go_old")
run("sudo ln -s /usr/local/opt/go/libexec /usr/local/go")
os.chdir(cwd)
self.brew_install("gopls")
self.brew_install("golanglint-ci")
def install_brew(self):
run("/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"")
def init_tmux(self):
self.brew_install("git")
self.check_link(home_dir+"/.tmux.conf",
home_dir+"/.dotfile/.tmux.conf")
if not os.path.exists(home_dir+"/.tmux/plugins/tmux-resurrect"):
run("git clone --depth=1 https://github.com/tmux-plugins/tmux-resurrect %s/.tmux/plugins/tmux-resurrect" % (home_dir))
def run(cmd: str):
subprocess.run(cmd.split())
if __name__ == '__main__':
main()