diff --git a/.zshrc b/.zshrc deleted file mode 100644 index 75781cb..0000000 --- a/.zshrc +++ /dev/null @@ -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 diff --git a/git/.gitconfig b/git/.gitconfig index fb93374..da8ae9f 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -38,8 +38,9 @@ ba = branch -a bm = branch --merged bn = branch --no-merged - pl = pull + pu = "!git pull origin $(git rev-parse --abbrev-ref HEAD)" pt = push origin --tags + ph = push origin HEAD merge2 = !sh -c '_CURRENT_BRANCH=$(git symbolic-ref --short HEAD) && git checkout $1 && git merge $_CURRENT_BRANCH && git checkout $_CURRENT_BRANCH' - bg = "!f() { git branch | grep $1; }; f" delbr = "!f(){ git branch -D $(git branch | grep \"\b$1\"); };f" diff --git a/laily.zsh-theme b/laily.zsh-theme deleted file mode 100644 index a522fb5..0000000 --- a/laily.zsh-theme +++ /dev/null @@ -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]%})" diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index d47e1b8..ac0d857 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,72 +1,72 @@ { "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LazyVim": { "branch": "main", "commit": "530e94a9fa19577401e968a9673282c3d79f01e3" }, - "LuaSnip": { "branch": "master", "commit": "b152822e1a4bafb6bdf11a16cc26525cbd95ee00" }, - "SchemaStore.nvim": { "branch": "main", "commit": "8c46453bdf84ad91877effb95e0b6c7b51ea7dda" }, + "LazyVim": { "branch": "main", "commit": "fe72424e77cb9c953084bbcaaa0eb7fe8056dc70" }, + "LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" }, + "SchemaStore.nvim": { "branch": "main", "commit": "9bc9a3a19dc6047d79d6073082f3b0deb7002c99" }, "barbar.nvim": { "branch": "master", "commit": "dd852401ee902745b67fc09a83d113b3fe82a96f" }, - "bufferline.nvim": { "branch": "main", "commit": "73540cb95f8d95aa1af3ed57713c6720c78af915" }, - "catppuccin": { "branch": "main", "commit": "6af91673ceccbd6e073b66c439e7fce239f72d24" }, + "bufferline.nvim": { "branch": "main", "commit": "b15c6daf5a64426c69732b31a951f4e438cb6590" }, + "catppuccin": { "branch": "main", "commit": "c0de3b46811fe1ce3912e2245a9dfbea6b41c300" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" }, + "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "6dc1603ea408f476a57937bbeaf7f86520a21a98" }, - "dashboard-nvim": { "branch": "master", "commit": "a0a78099658c7d4be3714f657b18ca8285d5d106" }, - "dressing.nvim": { "branch": "master", "commit": "5162edb1442a729a885c45455a07e9a89058be2f" }, - "flash.nvim": { "branch": "main", "commit": "7bb4a9c75d1e20cd24185afedeaa11681829ba23" }, - "friendly-snippets": { "branch": "main", "commit": "3e9a3f5a0cfcef1741e352c37bda4e82e5eb846a" }, - "gitsigns.nvim": { "branch": "main", "commit": "805610a9393fa231f2c2b49cb521bfa413fadb3d" }, - "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, - "lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" }, - "lsp_signature.nvim": { "branch": "master", "commit": "c6aeb2f1d2538bbdfdaab1664d9d4c3c75aa9db8" }, - "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "05744f0f1967b5757bd05c08df4271ab8ec990aa" }, + "conform.nvim": { "branch": "master", "commit": "192a6d2ddace343f1840a8f72efe2315bd392243" }, + "dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" }, + "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, + "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, + "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, + "indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" }, + "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, + "lsp_signature.nvim": { "branch": "master", "commit": "fed2c8389c148ff1dfdcdca63c2b48d08a50dea0" }, + "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" }, - "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, - "mini.ai": { "branch": "main", "commit": "55e9b7217f29e62f734e239bfeed5731a065d801" }, + "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, + "mini.ai": { "branch": "main", "commit": "ee9446a17c160aba6a04ff22097389c41872c878" }, "mini.bufremove": { "branch": "main", "commit": "931a3bb514147d9e812767275c4beba6b779b1d3" }, - "mini.comment": { "branch": "main", "commit": "f9f1a646fd3d9df7397aa1b9550a875fe8189eb0" }, - "mini.indentscope": { "branch": "main", "commit": "a8274b6ea2d868198d27bd91a31ed5ea3a6a5744" }, - "mini.pairs": { "branch": "main", "commit": "5c975d8f68dc1e11bf4b20ced71e7987ed782513" }, - "mini.surround": { "branch": "main", "commit": "0f528eb2e1bab420c0569d9e52615144c51db920" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "7aad1bf3f6b849cbf108e02c55ad4d701cb4d33a" }, - "neoconf.nvim": { "branch": "main", "commit": "d4a48c2a6fdeec138605cee4eb6f8c6fafd0b3ed" }, - "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, - "neotest": { "branch": "master", "commit": "5caac5cc235d495a2382bc2980630ef36ac87032" }, - "neotest-go": { "branch": "main", "commit": "27c80deab9cf5cb30b20ee407b3a6c7285518128" }, + "mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" }, + "mini.indentscope": { "branch": "main", "commit": "cf07f19e718ebb0bcc5b00999083ce11c37b8d40" }, + "mini.pairs": { "branch": "main", "commit": "04f58f2545ed80ac3b52dd4826e93f33e15b2af6" }, + "mini.surround": { "branch": "main", "commit": "a1b590cc3b676512de507328d6bbab5e43794720" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "f3941c57ec85d7bdb44fa53fd858fd80f159018f" }, + "neoconf.nvim": { "branch": "main", "commit": "98980b5300e7a5e7f93e8dbf81c98cc3daa55df7" }, + "neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" }, + "neotest": { "branch": "master", "commit": "4440cc2227894c2ae9b0673a30e6cc6f1836e8c2" }, + "neotest-go": { "branch": "main", "commit": "6a2f996d89fe4631942e035b1c114544ee045043" }, "neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" }, - "noice.nvim": { "branch": "main", "commit": "f4decbc7a80229ccc9f86026b74bdcf0c39e38a7" }, - "nui.nvim": { "branch": "main", "commit": "a3597dc88b53489d3fddbddbbd13787355253bb0" }, - "nvim-cmp": { "branch": "main", "commit": "cd2cf0c124d3de577fb5449746568ee8e601afc8" }, + "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, + "nui.nvim": { "branch": "main", "commit": "c3c7fd618dcb5a89e443a2e1033e7d11fdb0596b" }, + "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, "nvim-dap": { "branch": "master", "commit": "5a2f7121869394502521c52b2bc581ab22c69447" }, "nvim-dap-go": { "branch": "main", "commit": "5faf165f5062187320eaf9d177c3c1f647adc22e" }, - "nvim-dap-ui": { "branch": "master", "commit": "334cf3038c4756e6ab999cbac67c847fb654c190" }, + "nvim-dap-ui": { "branch": "master", "commit": "b7267003ba4dd860350be86f75b9d9ea287cedca" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "3e8e207513e6ef520894950acd76b79902714103" }, - "nvim-lint": { "branch": "master", "commit": "861a04313501563bb1b11f125ae9b7237a517b9b" }, - "nvim-lspconfig": { "branch": "master", "commit": "a3d9395455f2b2e3b50a0b0f37b8b4c23683f44a" }, - "nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" }, + "nvim-lint": { "branch": "master", "commit": "4dade85ff26e4bad40f895a6cc6762b7036237f4" }, + "nvim-lspconfig": { "branch": "master", "commit": "9553725789be682ecd945a527ec552e489ea8534" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, - "nvim-spectre": { "branch": "master", "commit": "4651801ba37a9407b7257287aec45b6653ffc5e9" }, - "nvim-tree.lua": { "branch": "master", "commit": "64f61e4c913047a045ff90bd188dd3b54ee443cf" }, - "nvim-treesitter": { "branch": "master", "commit": "3607d9c59cb16ed5368ecfed53e8ca1735bb98fb" }, - "nvim-treesitter-context": { "branch": "master", "commit": "2650e6431f7daba5d9c2c64134fa5eb2312eb3d7" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" }, + "nvim-spectre": { "branch": "master", "commit": "3712ff0cdf4f9f877d9ca708d835a877d9a0abaf" }, + "nvim-tree.lua": { "branch": "master", "commit": "d52fdeb0a300ac42b9cfa65ae0600a299f8e8677" }, + "nvim-treesitter": { "branch": "master", "commit": "4a8901b0d5398b45e075fcdbf9b8fe546349cc14" }, + "nvim-treesitter-context": { "branch": "master", "commit": "b8d1ffe58a88e0356da56b167373e89c4579ce15" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "95933e762e28f9d38b572d65e7e4da9d2f4d90cb" }, "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "0bdccb9c67a42a5e2d99384dc9bfa29b1451528f" }, - "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" }, + "nvim-web-devicons": { "branch": "master", "commit": "0bb67ef952ea3eb7b1bac9c011281471d99a27bc" }, "persistence.nvim": { "branch": "main", "commit": "4982499c1636eac254b72923ab826ee7827b3084" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, - "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, + "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, "symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" }, - "telescope-file-browser.nvim": { "branch": "master", "commit": "4d5fd21bae12ee6e9a79232e1c377f43c419d0c5" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, - "telescope.nvim": { "branch": "master", "commit": "fac83a556e7b710dc31433dec727361ca062dbe9" }, - "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, - "tokyonight.nvim": { "branch": "main", "commit": "67afeaf7fd6ebba000633e89f63c31694057edde" }, - "trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" }, - "vim-illuminate": { "branch": "master", "commit": "e522e0dd742a83506db0a72e1ced68c9c130f185" }, - "vim-startuptime": { "branch": "master", "commit": "ac2cccb5be617672add1f4f3c0a55ce99ba34e01" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "48ffb8de688a22942940f50411d5928631368848" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "master", "commit": "d5c4d9856320a07d04607c9b3a0523bd3f373328" }, + "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, + "tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" }, + "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, + "vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" }, + "vim-startuptime": { "branch": "master", "commit": "308b0088a864c4711a96e45b6734cf9294074f65" }, "vim-vsnip": { "branch": "master", "commit": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9" }, "vim-vsnip-integ": { "branch": "master", "commit": "1914e72cf3de70df7f5dde476cd299aba2440aef" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua index 24ded1b..71bfb77 100644 --- a/nvim/lua/config/options.lua +++ b/nvim/lua/config/options.lua @@ -1,20 +1,20 @@ vim.g.autoformat = true -vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object" -vim.cmd('set shortmess+=c') -- Don't pass messages to |ins-completion-menu|. -vim.cmd('set inccommand=split') -- Make substitution work in realtime +vim.cmd("set iskeyword+=-") -- treat dash separated words as a word text object" +vim.cmd("set shortmess+=c") -- Don't pass messages to |ins-completion-menu|. +vim.cmd("set inccommand=split") -- Make substitution work in realtime vim.opt.hidden = true -- Required to keep multiple buffers open multiple buffers vim.opt.title = true -TERMINAL = vim.fn.expand('$TERMINAL') -vim.cmd('let &titleold="'..TERMINAL..'"') -vim.opt.titlestring="%<%F%=%l/%L - nvim" +TERMINAL = vim.fn.expand("$TERMINAL") +vim.cmd('let &titleold="' .. TERMINAL .. '"') +vim.opt.titlestring = "%<%F%=%l/%L - nvim" vim.wo.wrap = true -- Display long lines as just one line -vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys -vim.cmd('syntax on') -- syntax highlighting +vim.cmd("set whichwrap+=<,>,[,],h,l") -- move to next line with theses keys +vim.cmd("syntax on") -- syntax highlighting vim.opt.pumheight = 10 -- Makes popup menu smaller vim.opt.fileencoding = "utf-8" -- The encoding written to file vim.opt.cmdheight = 2 -- More space for displaying messages -vim.cmd('set colorcolumn=99999') -- fix indentline for now +vim.cmd("set colorcolumn=99999") -- fix indentline for now vim.opt.mouse = "a" -- Enable your mouse vim.opt.splitbelow = true -- Horizontal splits will automatically be below vim.opt.termguicolors = true -- set term gui colors most terminals support this @@ -34,9 +34,9 @@ vim.opt.backup = false -- This is recommended by coc vim.opt.writebackup = false -- This is recommended by coc vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time vim.opt.updatetime = 300 -- Faster completion -vim.opt.timeoutlen = 100 -- By default timeoutlen is 1000 ms +vim.opt.timeoutlen = 500 -- By default timeoutlen is 1000 ms vim.opt.clipboard = "unnamedplus" -- Copy paste between vim and everything else -vim.cmd('filetype plugin on') -- filetype detection +vim.cmd("filetype plugin on") -- filetype detection -- vim.opt.guifont = "JetBrainsMono\\ Nerd\\ Font\\ Mono:h18" -- vim.opt.guifont = "Hack\\ Nerd\\ Font\\ Mono" -- vim.opt.guifont = "SauceCodePro Nerd Font:h17" @@ -45,11 +45,11 @@ vim.opt.guifont = "FiraCode Nerd Font:h17" -- vim.opt.guifont = "JetBrains\\ Mono\\ Regular\\ Nerd\\ Font\\ Complete" vim.g.vim_markdown_folding_disabled = 1 -vim.g.vimspector_enable_mappings = 'HUMAN' -vim.g['test#go#rspec#options'] = { nearest= '--v', suite= '--v' } +vim.g.vimspector_enable_mappings = "HUMAN" +vim.g["test#go#rspec#options"] = { nearest = "--v", suite = "--v" } -- git blame -vim.cmd('highlight default link gitblame SpecialComment') +vim.cmd("highlight default link gitblame SpecialComment") vim.g.gitblame_enabled = 0 -- last position jump diff --git a/nvim/lua/plugins/diffview.lua b/nvim/lua/plugins/diffview.lua new file mode 100644 index 0000000..e4a3402 --- /dev/null +++ b/nvim/lua/plugins/diffview.lua @@ -0,0 +1,3 @@ +return { + "sindrets/diffview.nvim", +} diff --git a/nvim/lua/plugins/gitsigns.lua b/nvim/lua/plugins/gitsigns.lua index f8fb6a9..614d56a 100644 --- a/nvim/lua/plugins/gitsigns.lua +++ b/nvim/lua/plugins/gitsigns.lua @@ -4,25 +4,30 @@ return { opts = { signs = { -- TODO add hl to colorscheme - add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - changedelete = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - }, - numhl = false, - linehl = false, - watch_gitdir = { - interval = 1000 - }, - sign_priority = 6, - update_debounce = 200, - status_formatter = nil, -- Use default + add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, + change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, + delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + changedelete = { + hl = "GitSignsChange", + text = "▎", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + }, + numhl = false, + linehl = false, + watch_gitdir = { + interval = 1000, + }, + sign_priority = 6, + update_debounce = 200, + status_formatter = nil, -- Use default on_attach = function(buffer) local gs = package.loaded.gitsigns - + local function map(mode, l, r, desc) - vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) end -- stylua: ignore start @@ -38,7 +43,8 @@ return { map("n", "ghd", gs.diffthis, "Diff This") map("n", "ghD", function() gs.diffthis("~") end, "Diff This ~") map({ "o", "x" }, "ih", ":Gitsigns select_hunk", "GitSigns Select Hunk") - end, - } - } -} \ No newline at end of file + end, + }, + }, +} + diff --git a/nvim/lua/plugins/mason.lua b/nvim/lua/plugins/mason.lua index 3bf3d96..a8fdddc 100644 --- a/nvim/lua/plugins/mason.lua +++ b/nvim/lua/plugins/mason.lua @@ -6,12 +6,13 @@ return { "stylua", "selene", "luacheck", - "shellcheck", + --"bashls", "shfmt", - "tailwindcss-language-server", - "typescript-language-server", - "css-lsp", + -- "tailwindcss", + -- "tsserver", + "pylyzer", + -- "cssls", }) end, }, -} \ No newline at end of file +} diff --git a/nvim/lua/plugins/nvim-tree.lua b/nvim/lua/plugins/nvim-tree.lua index 0a1d3e1..0dc518f 100644 --- a/nvim/lua/plugins/nvim-tree.lua +++ b/nvim/lua/plugins/nvim-tree.lua @@ -1,38 +1,38 @@ local function my_on_attach(bufnr) - local api = require "nvim-tree.api" + local api = require("nvim-tree.api") - local function opts(desc) - return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } - end - - -- default mappings - api.config.mappings.default_on_attach(bufnr) - - -- custom mappings - vim.keymap.set('n', '', api.tree.change_root_to_parent, opts('Up')) - vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help')) - vim.keymap.set('n', 'l', api.node.open.edit, opts('Edit')) - vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('Parent Close')) - vim.keymap.set('n', 's', api.node.open.horizontal, opts('Horizontal Split')) - vim.keymap.set('n', 'v', api.node.open.vertical, opts('Vertical Split')) + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + -- default mappings + api.config.mappings.default_on_attach(bufnr) + + -- custom mappings + vim.keymap.set("n", "", api.tree.change_root_to_parent, opts("Up")) + vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help")) + vim.keymap.set("n", "l", api.node.open.edit, opts("Edit")) + vim.keymap.set("n", "h", api.node.navigate.parent_close, opts("Parent Close")) + vim.keymap.set("n", "s", api.node.open.horizontal, opts("Horizontal Split")) + vim.keymap.set("n", "v", api.node.open.vertical, opts("Vertical Split")) + vim.keymap.set("n", "", api.tree.reload, opts("Reload")) end vim.g.nvim_tree_indent_markers = 1 -- "0 by default, this option shows indent markers when folders are open -vim.g.nvim_tree_auto_ignore_ft = 'startify' --empty by default, don't auto open tree on specific filetypes. +vim.g.nvim_tree_auto_ignore_ft = "startify" --empty by default, don't auto open tree on specific filetypes. vim.g.nvim_tree_icons = { - default = '', - symlink = '', - git = {unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = ""}, - folder = {default = "", open = "", empty = "", empty_open = "", symlink = ""} + default = "", + symlink = "", + git = { unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = "" }, + folder = { default = "", open = "", empty = "", empty_open = "", symlink = "" }, } - return { { - 'nvim-tree/nvim-tree.lua', + "nvim-tree/nvim-tree.lua", dependencies = { - 'nvim-tree/nvim-web-devicons', -- optional + "nvim-tree/nvim-web-devicons", -- optional }, opts = { on_attach = my_on_attach, @@ -41,7 +41,7 @@ return { --auto_close = false, filters = { dotfiles = false, - custom = {} + custom = {}, }, git = { enable = true, @@ -50,14 +50,15 @@ return { }, update_focused_file = { -- enables the feature - enable = true, + enable = true, -- update the root directory of the tree to the one of the folder containing the file if the file is not under the current root directory -- only relevant when `update_focused_file.enable` is true - update_cwd = false, + update_cwd = false, -- list of buffer names / filetypes that will not update the cwd if the file isn't found under the current root directory -- only relevant when `update_focused_file.update_cwd` is true and `update_focused_file.enable` is true - ignore_list = {} + ignore_list = {}, }, }, }, -} \ No newline at end of file +} + diff --git a/script/fish-init.sh b/script/fish-init.sh index b808f50..19a310f 100755 --- a/script/fish-init.sh +++ b/script/fish-init.sh @@ -2,7 +2,7 @@ echo 'Link fish config file' if [ -f "$HOME/.config/fish/config.fish" ]; then - mv $HOME/.config/fish/config.fish $HOME/.config/fish/config.fish.bak + mv $HOME/.config/fish/config.fish $HOME/.config/fish/config.fish.bak fi ln -s $HOME/.dotfile/fish/config.fish $HOME/.config/fish/config.fish @@ -10,4 +10,3 @@ echo 'Set fish as default shell' fishpath=$(which fish) echo $fishpath | sudo tee -a /etc/shells chsh -s $fishpath - diff --git a/script/tmux-init.sh b/script/tmux-init.sh new file mode 100755 index 0000000..616601b --- /dev/null +++ b/script/tmux-init.sh @@ -0,0 +1,20 @@ +#/bin/bash + +echo 'Init tmux config' +src=$HOME/.tmux.conf +if [ -e $src ]; then + mv $src $src.bak +fi +ln -s $HOME/.dotfile/tmux/.tmux.conf $src + + +echo 'Install tpm' +if [ ! -e ~/.tmux/plugins/tpm ]; then + git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +fi + +echo 'Install tmux plugin by tpm' +$HOME/.tmux/plugins/tpm/bin/install_plugins + +echo 'Reload tmux' +tmux source ~/.tmux.conf \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100755 index 9e749d1..0000000 --- a/setup.py +++ /dev/null @@ -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() diff --git a/.tmux.conf b/tmux/.tmux.conf similarity index 75% rename from .tmux.conf rename to tmux/.tmux.conf index fb37b47..6f0bfb0 100644 --- a/.tmux.conf +++ b/tmux/.tmux.conf @@ -20,8 +20,8 @@ set-option -g mouse on # 绑定hjkl键为面板切换的上下左右键 bind k select-pane -U # 绑定k为↑ bind j select-pane -D # 绑定j为↓ -bind h select-pane -L # 绑定h为← -bind l select-pane -R # 绑定l为→ +#bind h select-pane -L # 绑定h为← +#bind l select-pane -R # 绑定l为→ # 绑定Ctrl+hjkl键为面板上下左右调整边缘的快捷指令 bind -r K resizep -U 10 # 绑定Ctrl+k为往↑调整面板边缘10个单元格 @@ -29,11 +29,13 @@ bind -r J resizep -D 10 # 绑定Ctrl+j为往↓调整面板边缘10个单元格 bind -r H resizep -L 10 # 绑定Ctrl+h为往←调整面板边缘10个单元格 bind -r L resizep -R 10 # 绑定Ctrl+l为往→调整面板边缘10个单元格 +bind -r j select-pane -t .+1 \; resize-pane -Z # prefix + j to switch pane in current window + # 设置tmux的延迟,文档说当有干扰的时候可以设置这个参数,比如影响vim编辑的时候 set -s escape-time 1 # 返回上一个窗口 -bind g last-window +bind L switch-client -l # 设置窗口名为当前目录名 set-option -g status-interval 10 @@ -44,5 +46,11 @@ set-option -g set-titles on #set-option -g set-titles-string "#{session_name} - #{host}" set-option -g set-titles-string "#{session_name}" -# tmux resurrect -run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'junegunn/fzf' +set -g @plugin 'tmux-plugins/tmux-fzf' + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.tmux/plugins/tpm/tpm'