From b0b1f60d6d9e7530bd86d37a4a5227ecf41bdf08 Mon Sep 17 00:00:00 2001 From: subcrip Date: Thu, 25 Jul 2024 13:20:58 +0800 Subject: [PATCH] backup --- .npmrc | 1 + .p10k.zsh | 199 ++++++++++++++++++++++++++++++++++++++++++ .tmux.conf | 2 +- .zshrc | 23 +++-- contour.yml | 2 +- dotback | 7 ++ home-manager/home.nix | 7 ++ hypr/hyprland.conf | 4 +- kitty.conf | 2 +- nvim/lazy-lock.json | 10 ++- nvim/lua/config.lua | 7 ++ 11 files changed, 249 insertions(+), 15 deletions(-) create mode 100644 .npmrc create mode 100644 .p10k.zsh diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..dc3f6fb --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +prefix = ${HOME}/.npm-packages diff --git a/.p10k.zsh b/.p10k.zsh new file mode 100644 index 0000000..6a1a8c6 --- /dev/null +++ b/.p10k.zsh @@ -0,0 +1,199 @@ +# Generated by Powerlevel10k configuration wizard on 2024-07-25 at 13:16 CST. +# Based on romkatv/powerlevel10k/config/p10k-pure.zsh, checksum 07533. +# Wizard options: nerdfont-v3 + powerline, large icons, pure, snazzy, 24h time, 2 lines, +# sparse, transient_prompt, instant_prompt=verbose. +# Type `p10k configure` to generate another config. +# +# Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure). +# +# Differences from Pure: +# +# - Git: +# - `@c4d3ec2c` instead of something like `v1.4.0~11` when in detached HEAD state. +# - No automatic `git fetch` (the same as in Pure with `PURE_GIT_PULL=0`). +# +# Apart from the differences listed above, the replication of Pure prompt is exact. This includes +# even the questionable parts. For example, just like in Pure, there is no indication of Git status +# being stale; prompt symbol is the same in command, visual and overwrite vi modes; when prompt +# doesn't fit on one line, it wraps around with no attempt to shorten it. +# +# If you like the general style of Pure but not particularly attached to all its quirks, type +# `p10k configure` and pick "Lean" style. This will give you slick minimalist prompt while taking +# advantage of Powerlevel10k features that aren't present in Pure. + +# Temporarily change options. +'builtin' 'local' '-a' 'p10k_config_opts' +[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') +[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') +[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') +'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' + +() { + emulate -L zsh -o extended_glob + + # Unset all configuration options. + unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' + + # Zsh >= 5.1 is required. + [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return + + # Prompt colors. + local grey='242' + local red='#FF5C57' + local yellow='#F3F99D' + local blue='#57C7FF' + local magenta='#FF6AC1' + local cyan='#9AEDFE' + local white='#F1F1F0' + + # Left prompt segments. + typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( + # =========================[ Line #1 ]========================= + context # user@host + dir # current directory + vcs # git status + command_execution_time # previous command duration + # =========================[ Line #2 ]========================= + newline # \n + virtualenv # python virtual environment + prompt_char # prompt symbol + ) + + # Right prompt segments. + typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( + # =========================[ Line #1 ]========================= + # command_execution_time # previous command duration + # virtualenv # python virtual environment + # context # user@host + time # current time + # =========================[ Line #2 ]========================= + newline # \n + ) + + # Basic style options that define the overall prompt look. + typeset -g POWERLEVEL9K_BACKGROUND= # transparent background + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol + typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons + + # Add an empty line before each prompt except the first. This doesn't emulate the bug + # in Pure that makes prompt drift down whenever you use the Alt-C binding from fzf or similar. + typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true + + # Magenta prompt symbol if the last command succeeded. + typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta + # Red prompt symbol if the last command failed. + typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red + # Default prompt symbol. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' + # Prompt symbol in command vi mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' + # Prompt symbol in visual vi mode is the same as in command mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='❮' + # Prompt symbol in overwrite vi mode is the same as in command mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false + + # Grey Python Virtual Environment. + typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey + # Don't show Python version. + typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false + typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= + + # Blue current directory. + typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue + + # Context format when root: user@host. The first part white, the rest grey. + typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f" + # Context format when not root: user@host. The whole thing grey. + typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f" + # Don't show context unless root or in SSH. + typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION= + + # Show previous command duration only if it's >= 5s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5 + # Don't show fractional seconds. Thus, 7s rather than 7.3s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 + # Duration format: 1d 2h 3m 4s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' + # Yellow previous command duration. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow + + # Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones. + typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey + + # Disable async loading indicator to make directories that aren't Git repositories + # indistinguishable from large Git repositories without known state. + typeset -g POWERLEVEL9K_VCS_LOADING_TEXT= + + # Don't wait for Git status even for a millisecond, so that prompt always updates + # asynchronously when Git state changes. + typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0 + + # Cyan ahead/behind arrows. + typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=$cyan + # Don't show remote branch, current tag or stashes. + typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind) + # Don't show the branch icon. + typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= + # When in detached HEAD state, show @commit where branch normally goes. + typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@' + # Don't show staged, unstaged, untracked indicators. + typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED}_ICON= + # Show '*' when there are staged, unstaged or untracked files. + typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*' + # Show '⇣' if local branch is behind remote. + typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=':⇣' + # Show '⇡' if local branch is ahead of remote. + typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=':⇡' + # Don't show the number of commits next to the ahead/behind arrows. + typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1 + # Remove space between '⇣' and '⇡' and all trailing spaces. + typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }' + + # Grey current time. + typeset -g POWERLEVEL9K_TIME_FOREGROUND=$grey + # Format for the current time: 09:51:02. See `man 3 strftime`. + typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' + # If set to true, time will update when you hit enter. This way prompts for the past + # commands will contain the start times of their commands rather than the end times of + # their preceding commands. + typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false + + # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt + # when accepting a command line. Supported values: + # + # - off: Don't change prompt when accepting a command line. + # - always: Trim down prompt when accepting a command line. + # - same-dir: Trim down prompt when accepting a command line unless this is the first command + # typed after changing current working directory. + typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always + + # Instant prompt mode. + # + # - off: Disable instant prompt. Choose this if you've tried instant prompt and found + # it incompatible with your zsh configuration files. + # - quiet: Enable instant prompt and don't print warnings when detecting console output + # during zsh initialization. Choose this if you've read and understood + # https://github.com/romkatv/powerlevel10k#instant-prompt. + # - verbose: Enable instant prompt and print a warning when detecting console output during + # zsh initialization. Choose this if you've never tried instant prompt, haven't + # seen the warning, or if you are unsure what this all means. + typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose + + # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. + # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload + # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you + # really need it. + typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true + + # If p10k is already loaded, reload configuration. + # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true. + (( ! $+functions[p10k] )) || p10k reload +} + +# Tell `p10k configure` which file it should overwrite. +typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a} + +(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} +'builtin' 'unset' 'p10k_config_opts' diff --git a/.tmux.conf b/.tmux.conf index 7878ef0..90d4c0b 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -6,7 +6,7 @@ # set -ga terminal-overrides ",*256col*:Tc" set -ga terminal-overrides ",xterm-256color:Tc" set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' -set-option -g default-shell /home/linuxbrew/.linuxbrew/bin/zsh +set-option -g default-shell "/usr/bin/zsh" setw -g mode-keys vi # underscore colours - needs tmux-3.0 diff --git a/.zshrc b/.zshrc index 3d40f03..e30891f 100644 --- a/.zshrc +++ b/.zshrc @@ -1,3 +1,10 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + # Path to your oh-my-zsh installation. export ZSH="$HOME/.oh-my-zsh" @@ -62,6 +69,9 @@ zstyle ':omz:update' mode auto # update automatically without asking # Would you like to use another custom folder than $ZSH/custom? # ZSH_CUSTOM=/path/to/new-custom-folder +ZSH_TMUX_AUTOSTART=true +ZSH_TMUX_AUTOCONNECT=false + # Which plugins would you like to load? # Standard plugins can be found in $ZSH/plugins/ # Custom plugins may be added to $ZSH_CUSTOM/plugins/ @@ -69,6 +79,7 @@ zstyle ':omz:update' mode auto # update automatically without asking # Add wisely, as too many plugins slow down shell startup. plugins=( git + tmux zsh-syntax-highlighting zsh-autosuggestions ) @@ -106,9 +117,9 @@ alias pip3="python3 -m pip" alias pip="python -m pip" alias comp="cd ~/RustIsBestLang/src/bin && nvim" alias backup="git add . && git commit -S -m 'backup' && git push" -alias leetcode="nvim leetcode.nvim" -export LD_LIBRARY_PATH=/usr/lib:/usr/local/cuda/lib65:$LD_LIBRARY_PATH -export PATH=/usr/local/cuda/bin:$PATH +# export LD_LIBRARY_PATH=/usr/lib:/usr/local/cuda/lib65:$LD_LIBRARY_PATH +export PATH=/home/user/.cabal/bin:/home/user/.ghcup/bin:/home/linuxbrew/.linuxbrew/bin:/home/user/.cargo/bin:/home/user/.local/bin:/usr/local/cuda/bin:$PATH +export PAGER=less me () { md "$@" && cd "$@" @@ -136,9 +147,9 @@ emptytrash () { ghclone () { git clone "https://github.com/arielherself/$@" } -# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" +source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme -eval "$(oh-my-posh init zsh)" -eval "$(oh-my-posh init zsh --config ~/omp-themes/atomic.omp.json)" +# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh diff --git a/contour.yml b/contour.yml index cfcd01c..39db4ed 100644 --- a/contour.yml +++ b/contour.yml @@ -523,7 +523,7 @@ profiles: normal: dotted hover: underline my_profile: - shell: "/home/linuxbrew/.linuxbrew/bin/zsh" + shell: "zsh" escape_sandbox: true # Advanced value that is useful when CopyPreviousMarkRange is used diff --git a/dotback b/dotback index 92b236a..1b18d07 100755 --- a/dotback +++ b/dotback @@ -14,9 +14,16 @@ cp $HOME/.config/kitty/kitty.conf . cp $HOME/.config/alacritty/alacritty.toml . cp $HOME/.var/app/org.contourterminal.Contour/config/contour/contour.yml . +# Zsh +cp $HOME/.zshrc . +cp $HOME/.p10k.zsh . + # Tmux cp $HOME/.tmux.conf . cp $HOME/.config/tmux-powerline . -r # Nix cp $HOME/.config/home-manager . -r + +# NPM +cp $HOME/.npmrc . diff --git a/home-manager/home.nix b/home-manager/home.nix index e629f94..a1ce83b 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -21,6 +21,13 @@ pkgs.mtr pkgs.neovim pkgs.htop + pkgs.python3 + pkgs.pyright + pkgs.nodejs_22 + pkgs.pipx + pkgs.fx + pkgs.gdb + pkgs.lua-language-server # # It is sometimes useful to fine-tune packages, for example, by applying # # overrides. You can do that directly here, just don't forget the diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 96653b3..140a522 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -226,7 +226,7 @@ bind = $mainMod, Z, exec, cd /home/user/RustIsBestLang/src/bin && /home/user/.lo bind = $mainMod, O, exec, obsidian bind = $mainMod, V, togglefloating, bind = $mainMod, R, exec, $menu -bind = $mainMod, P, pseudo, # dwindle +# bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, J, togglesplit, # dwindle bind = $mainMod, M, fullscreen, 1 bind = $mainMod, F, fullscreen, 0 @@ -319,7 +319,7 @@ windowrulev2 = suppressevent maximize, class:^(xwaylandvideobridge) # You'll pro misc { force_default_wallpaper=true, - disable_hyprland_logo=false + disable_hyprland_logo=true } debug { diff --git a/kitty.conf b/kitty.conf index 7809283..09b2dd5 100644 --- a/kitty.conf +++ b/kitty.conf @@ -1,4 +1,4 @@ -shell /home/linuxbrew/.linuxbrew/bin/zsh +# shell /home/linuxbrew/.linuxbrew/bin/zsh # font_family Berkeley Mono Regular # italic_font Berkeley Mono Italic diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 41dd569..b926272 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -23,7 +23,7 @@ "eslint.nvim": { "branch": "main", "commit": "158f2289907d377018752fcfe0d61b746dc11767" }, "feline.nvim": { "branch": "master", "commit": "3587f57480b88e8009df7b36dc84e9c7ff8f2c49" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, - "fzf-lua": { "branch": "main", "commit": "6b5c48fe40695c0b1df61c1bbf7fdcfca04c7e16" }, + "fzf-lua": { "branch": "main", "commit": "fb058bd718aabe9a5abb3e9df3d5c1023d06cdae" }, "git-conflict.nvim": { "branch": "main", "commit": "bfd9fe6fba9a161fc199771d85996236a0d0faad" }, "gitsigns.nvim": { "branch": "main", "commit": "f4928ba14eb6c667786ac7d69927f6aee6719f1e" }, "goto-preview": { "branch": "main", "commit": "1519ea3512828c944eed5b2bbb66a8f8deb92447" }, @@ -46,9 +46,10 @@ "mason-lspconfig.nvim": { "branch": "main", "commit": "58bc9119ca273c0ce5a66fad1927ef0f617bd81b" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "melange-nvim": { "branch": "master", "commit": "800490ee87ce3e1b4afe751ff81f2864cb01937d" }, + "mini.nvim": { "branch": "main", "commit": "23669ab7abc2cd10f9a5166de07400bb34eaecda" }, "modicator.nvim": { "branch": "main", "commit": "d1d327fd4bdfc3af4cfdf83b85c2eaefa71de7a8" }, "neogit": { "branch": "master", "commit": "af1d8d88f426a4da63c913f3b81a37350dbe8d02" }, - "none-ls.nvim": { "branch": "main", "commit": "4c6605b2ec5dfe4c9694ade0c730c234d1039019" }, + "none-ls.nvim": { "branch": "main", "commit": "2cde745aadc2c36f6860a77a556494870675771a" }, "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, "nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" }, "nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" }, @@ -60,7 +61,7 @@ "nvim-numbertoggle": { "branch": "main", "commit": "c5827153f8a955886f1b38eaea6998c067d2992f" }, "nvim-origami": { "branch": "main", "commit": "5d6b63bab5406e439937b04fc4ead201ba8dc88f" }, "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, - "nvim-treesitter": { "branch": "master", "commit": "d9ea5035d4138e49ccd08a9480882dcb94ea164d" }, + "nvim-treesitter": { "branch": "master", "commit": "4e387dd47833c1bb8c8df6c3a7cab0d4c55583f3" }, "nvim-treesitter-context": { "branch": "master", "commit": "2aba92ceb1479485953007f4d5adf34d0b66917e" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" }, "nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" }, @@ -70,6 +71,7 @@ "outline.nvim": { "branch": "main", "commit": "2175b6da5b7b5be9de14fd3f54383a17f5e4609c" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "prettier.nvim": { "branch": "main", "commit": "d98e732cb73690b07c00c839c924be1d1d9ac5c2" }, + "render-markdown": { "branch": "main", "commit": "5e4e33102b784353998c83d57dbacea4db71d55b" }, "search.nvim": { "branch": "main", "commit": "27191f6c10a13c8018136b2490342d35960ed0ab" }, "sg.nvim": { "branch": "master", "commit": "8bdd4d19da2268072708d5fe18fda9c23e16509d" }, "smart-open.nvim": { "branch": "0.2.x", "commit": "87626ee8748b9bba22093adec7bb58c63e7214f0" }, @@ -92,6 +94,6 @@ "vim-prosession": { "branch": "master", "commit": "4b8323d4e9b74afe9132a34b2d7ea6cfa9461550" }, "vim-visual-multi": { "branch": "master", "commit": "38b0e8d94a5499ccc17d6159763d32c79f53417b" }, "vim-vsnip": { "branch": "master", "commit": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9" }, - "vim-wakatime": { "branch": "master", "commit": "3cb40867cb5a3120f9bef76eff88edc7f1dc1a23" }, + "vim-wakatime": { "branch": "master", "commit": "d72aac70fcee172413f89621b65b5383bd845e4b" }, "which-key.nvim": { "branch": "main", "commit": "6e61b0904e9c038b6c511c43591ae2d811b4975e" } } diff --git a/nvim/lua/config.lua b/nvim/lua/config.lua index 7ad4f5d..e834677 100644 --- a/nvim/lua/config.lua +++ b/nvim/lua/config.lua @@ -458,6 +458,13 @@ local plugins = { -- configuration goes here }, }, + { + 'MeanderingProgrammer/markdown.nvim', + main = "render-markdown", + opts = {}, + name = 'render-markdown', -- Only needed if you have another plugin named markdown.nvim + dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite + }, } require("lazy").setup(plugins, {})