diff --git a/README.md b/README.md index 9f5fdbfc..09f74223 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ - Extensions: [Bluetooth quick connect](https://github.com/bjarosze/gnome-bluetooth-quick-connect), [Pano - Next-gen Clipboard Manager](https://github.com/oae/gnome-shell-pano), [Rounded Window Corners](https://github.com/yilozt/rounded-window-corners) - [Foot terminal](./foot/foot.ini) - [Tmux](./tmux/tmux.conf) -- [Bash shell](./bashrc) +- [Fish shell](./fish/config.fish) - [Neovim](./nvim/) - init.lua.minimal: no plugin, no LSP. - init.lua: the main one using [LazyVim](https://www.lazyvim.org/), plugin add-ons([vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator), [nvim-highlight-colors](https://github.com/brenoprata10/nvim-highlight-colors), [Rose pine](https://github.com/rose-pine/neovim)) diff --git a/bashrc b/bashrc deleted file mode 100644 index 525ccb0e..00000000 --- a/bashrc +++ /dev/null @@ -1,397 +0,0 @@ -#!/usr/bin/env bash - -if command -v tmux &>/dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then - exec tmux -fi - -export PATH="$HOME/.gem/ruby/2.7.0/bin:$PATH" -export PATH="$HOME/.local/share/gem/ruby/3.0.0/bin:$PATH" -export PATH="$HOME/gems/bin:$PATH" -export PATH=$PATH:$HOME/.local/bin -export PATH=$PATH:$HOME/bin -export PATH=$PATH:$HOME/dotfiles/personal_bin/ -export PATH=$PATH:$HOME/.cargo/bin -export PATH=$PATH:/usr/local/go/bin -export PATH=$PATH:$HOME/go/bin -export PATH="$HOME/.npm/bin:$PATH" -export PATH="$(yarn global bin):$PATH" -export GEM_HOME="$HOME/gems" -export RIPGREP_CONFIG_PATH="$HOME/.ripgreprc" -export DENO_INSTALL="$HOME/.deno" -export PATH="$DENO_INSTALL/bin:$PATH" -export VISUAL="nvim" -export EDITOR=$VISUAL -export MANPAGER="nvim +Man!" -export EDITOR="nvim" -export FZF_DEFAULT_COMMAND="fd --type f --follow --exclude .git --exclude undodir --exclude gems --exclude node_modules --exclude go --exclude app --exclude gems" -export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" -export FZF_ALT_C_COMMAND="fd -t d" -export PNPM_HOME="/home/master/.local/share/pnpm" -export PATH="$PNPM_HOME:$PATH" - -HISTCONTROL=ignoreboth -HISTSIZE= -HISTFILESIZE= -shopt -s histappend -shopt -s checkwinsize - -bind 'set completion-ignore-case on' - -set -o vi - -stty time 0 - -[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && - . /usr/share/bash-completion/bash_completion - -eval "$(gh completion -s bash)" - -source $HOME/.local/share/fzf-bash-completion.sh -bind -x '"\t": fzf_bash_completion' -source $HOME/.local/share/completion.bash -source $HOME/.local/share/key-bindings.bash - -eval "$(starship init bash)" - -network_status() { - ping -c 1 google.com - local NETWORK_STATUS=$? - local NETWORK_ERROR_CODE=2 - - if [[ "$NETWORK_STATUS" == "$NETWORK_ERROR_CODE" ]]; then - NETWORK="offline" - else - NETWORK="online" - fi -} - -alias fzf_down='fzf --height 50% --min-height 20 --reverse' - -alias reload='source ~/.bashrc ; tmux source-file ~/.tmux.conf' -alias t='trash' -alias q='exit' -alias owa='code .' -alias x='chmod +x' -alias st='git status -sb' -alias cat='bat --theme=GitHub' -alias vi='nvim' -alias vim='nvim' - -alias ls='exa --long --all --icons' -alias l='ls' -alias sl='ls' -alias ll='ls' -alias la='exa --all --icons' -alias al='la' -alias ..='cd .. ; l' -alias ...='cd .. ; cd .. ; l' -alias dow='cd ~/Downloads ; l' -alias doc='cd ~/Documents ; l' -alias tmp='cd /tmp' -alias changeDirToUsbFolder='cd /run/media/master/ ; ls' - -alias ins='sudo dnf install -y' -alias uins='sudo dnf remove -y' - -browser_daily() { - xdg-open "https://feeder.co/reader" - xdg-open "https://mail.google.com/mail/u/0/#inbox" - xdg-open "https://mail.google.com/mail/u/1/#inbox" - xdg-open "https://www.youtube.com/feed/subscriptions" - xdg-open "https://github.com" -} - -# TODO: update_music checking playlist to update change -sync_music() { - network_status &>/dev/null - - if [[ "$NETWORK" == "online" ]]; then - CURRENT_DIR=$(pwd) - MUSIC_DIR=$HOME/Music/music_i_like/ - - rm -rf "$MUSIC_DIR" - mkdir -p "$MUSIC_DIR" - cd $MUSIC_DIR - - yt-dlp -f "bestaudio" --continue --no-overwrites --ignore-errors --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" "https://www.youtube.com/playlist?list=PLcazFfFZIFPld2xu_nAgmbgj5QldQOpUB" - - cd CURRENT_DIR - else - echo "Check your internet connection and try again" - fi -} - -update() { - network_status &>/dev/null - - if [[ "$NETWORK" == "online" ]]; then - CURRENT_DIR=$(pwd) - - pnpm add -g pnpm & - dnf makecache & - deno upgrade & - tldr --update & - ~/.tmux/plugins/tpm/bin/update_plugins all & - - cd ~/.local/share/ - wget https://raw.githubusercontent.com/lincheney/fzf-tab-completion/master/bash/fzf-bash-completion.sh & - wget https://raw.githubusercontent.com/junegunn/fzf/master/shell/completion.bash & - wget https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.bash & - - cd ~/dotfiles/ - nvim --headless "+Lazy! sync" +qa - git add nvim/lazy-lock.json - git commit -m "chore: lazy.nvim" - - cd $CURRENT_DIR - else - echo "Check your internet connection for online update and try again" - fi -} - -hi() { - browser_daily -} - -make_dir() { - if [ -z "$1" ]; then - echo -n "πŸ‘‰ Enter a directory name" - read -r DIR_NAME - mkdir -p "$DIR_NAME" - cd $DIR_NAME - elif [ -d "$1" ]; then - echo -e "πŸ‘‰ $1 already exists" - cd $1 - else - mkdir -p "$1" - cd $1 - fi -} -alias mk="make_dir" - -start_browser_sync() { - SERVER_IP=$(hostname -I) - browser-sync start --server --files . --no-notify --host "$SERVER_IP" --port 9000 -} -alias ser='start_browser_sync' - -change_dir_to_git_root() { - cd $(git rev-parse --show-toplevel) - ls -} -alias cdr='change_dir_to_git_root' - -yo() { - if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) ]]; then - if [[ $(git status --porcelain) ]]; then - git diff - git status -sb - echo -e '\n\e[1m\e[34mCommmit message\e[0m' - echo -en '\e[1m\e[32m❯\e[0m ' - read -r commit_message - git add --all - git commit -m "$commit_message" - else - echo "😏 No change" - fi - fi -} - -auto_commit() { - if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) ]]; then - if [[ $(git status --porcelain) ]]; then - git add --all - git commit -m "[πŸ‘ŒAuto commit]" - git pull - git push - else - echo "😏 No change" - fi - fi -} -alias ok='auto_commit' - -clone_change_dir_to_repo() { - GIT_DIR="$(basename "$1" .git)" - GIT_DIR_RESOLVED=${2:-$GIT_DIR} - git clone "$@" && cd "$GIT_DIR_RESOLVED" -} -alias gc='clone_change_dir_to_repo' - -sync_repo() { - network_status &>/dev/null - - if [[ "$NETWORK" == "online" ]]; then - CURRENT_DIR=$(pwd) - - repos=( - ~/repos/thuanowa/ok - ~/repos/thuanowa/obs-studio - ~/repos/thuanowa/note - ) - - for repo in ${repos[*]}; do - cd "$repo" - echo -e "\e[1m\e[36m$(pwd)\e[0m" - ok - done - - cd $CURRENT_DIR - else - echo "Check your internet connection and try again" - fi -} - -update_repo() { - network_status &>/dev/null - - if [[ "$NETWORK" == "online" ]]; then - CURRENT_DIR=$(pwd) - - repo_main=( - ~/repos/thuanowa/* - ~/repos/OngDev/* - ~/repos/isekaiSystem/* - ~/repos/from-design-to-website/* - ~/repos/when-will-i-die/* - ) - - repo_extra=( - ~/repos/rose-pine/surfingkeys/ - ~/repos/OngDev/.github/ - ~/repos/isekaiSystem/.github/ - ~/dotfiles/ - ) - - repos=("${repo_main[@]}" "${repo_extra[@]}") - - for repo in ${repos[*]}; do - cd "$repo" - echo -e "\e[1m\e[36m$(pwd)\e[0m" - git pull - git push - done - - cd $CURRENT_DIR - else - echo "Check your internet connection and try again" - fi -} - -clone_all_users_repo() { - CURRENT_DIR=$(pwd) - - REPOS_PATH=~/repos/ - mkdir $REPOS_PATH 2>/dev/null - cd $REPOS_PATH - - github_usernames=( - thuanowa - OngDev - isekaiSystem - from-design-to-website - when-will-i-die - ) - - for user in ${github_usernames[*]}; do - mkdir "$user" 2>/dev/null - cd "$user" - echo -e "\e[1m\e[36m$user\e[0m" - - gh repo list "$user" --limit 10000 | awk '{print $1}' | while read -r repo_name; do - gh repo clone "$repo_name" - done - - cd $REPOS_PATH - done - - cd $CURRENT_DIR -} - -emoji() { - if hash emoji-fzf 2>/dev/null; then - emoji-fzf preview --prepend | - fzf_down | - awk '{ print $1 }' | tr -d "\n" | wl-copy - else - pip install emoji-fzf - emoji-fzf preview --prepend | - fzf_down | - awk '{ print $1 }' | - tr -d "\n" | - wl-copy - fi -} -alias ej="emoji" - -find_file_edit_in_nvim() { - if [ -z "$1" ]; then - FILE=$(fd . -t f --exclude .git --exclude undodir --exclude gems --exclude node_modules --exclude go --exclude app --exclude gems | fzf_down --preview 'bat --theme=GitHub --color=always --style=numbers --line-range=:500 {}') - - if [ -n "$FILE" ]; then - nvim "$FILE" - fi - else - nvim "$1" - fi -} -alias f='find_file_edit_in_nvim' -alias e='find_file_edit_in_nvim' -alias v='find_file_edit_in_nvim' - -open_file() { - FILE=$(fd . --exclude .git --exclude undodir --exclude gems --exclude node_modules --exclude go --exclude app --exclude gems | fzf_down --preview 'bat --theme=GitHub --color=always --style=numbers --line-range=:500 {}') - if [ -n "$FILE" ]; then - xdg-open "$FILE" - fi -} -alias o='open_file' - -change_dir() { - DIR=$1 - - fzf_dir() { - DIR=$(fd -t d . --exclude .git --exclude undodir --exclude gems --exclude node_modules --exclude go --exclude app --exclude gems | fzf_down --preview $'echo {} | tr -d \'()\' | awk \'{printf "%s ", $2} {print $1}\' | xargs -r tree -C -L 2') - cd "$DIR" - } - - if [[ -n $DIR ]]; then - cd $DIR &>/dev/null - ERROR=$? - - if [[ ERROR -eq 1 ]]; then - echo "\"$1\" directory does not exist" - fzf_dir - fi - else - fzf_dir - fi - - ls -} -alias c='change_dir' -alias cc='cd ; change_dir' - -kill_all_unname_tmux_session() { - cd /tmp/ - tmux ls | awk '{print $1}' | grep -o '[0-9]\+' >/tmp/killAllUnnameTmuxSessionOutput.sh - sed -i 's/^/tmux kill-session -t /' killAllUnnameTmuxSessionOutput.sh - chmod +x killAllUnnameTmuxSessionOutput.sh - ./killAllUnnameTmuxSessionOutput.sh - cd - -} - -alias clear='kill_all_unname_tmux_session ; clear -x' -alias cler='clear' -alias clea='clear' - -yt() { - yt-dlp -f bestvideo+bestaudio -o "%(title)s.%(ext)s" "$1" -} - -yta() { - yt-dlp -f "bestaudio" --continue --no-overwrites --ignore-errors --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" "$1" -} - -alias play_music='mpv --shuffle --loop-playlist *' -alias m='play_music' diff --git a/crontab/crontab_config b/crontab/crontab_config deleted file mode 100644 index ea3125bd..00000000 --- a/crontab/crontab_config +++ /dev/null @@ -1,9 +0,0 @@ -# @hourly bash /home/master/dotfiles/crontab/crontab_hourly - -# daily 5pm - -0 17 * * * bash /home/master/dotfiles/crontab/crontab_daily - -# weekly at 5pm sunday - -0 17 * * 0 /home/master/dotfiles/crontab/crontab_weekly diff --git a/crontab/crontab_daily b/crontab/crontab_daily deleted file mode 100755 index 9f45eb7e..00000000 --- a/crontab/crontab_daily +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -source ~/dotfiles/bashrc - -update - -update_repo - -sync_repo - -clone_all_users_repo diff --git a/crontab/crontab_hourly b/crontab/crontab_hourly deleted file mode 100755 index 180b0a2b..00000000 --- a/crontab/crontab_hourly +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -source ~/dotfiles/bashrc diff --git a/crontab/crontab_weekly b/crontab/crontab_weekly deleted file mode 100644 index 72720693..00000000 --- a/crontab/crontab_weekly +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -source ~/dotfiles/bashrc - -sync_music diff --git a/crontab/tempCodeRunnerFile.shellscript b/crontab/tempCodeRunnerFile.shellscript deleted file mode 100644 index 62351638..00000000 --- a/crontab/tempCodeRunnerFile.shellscript +++ /dev/null @@ -1 +0,0 @@ -update_bash_functions \ No newline at end of file diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 00000000..34bed266 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,38 @@ +if status is-interactive + and not set -q TMUX + if tmux has-session -t inbox + exec tmux attach-session -t inbox + else + tmux new-session -s inbox + end +end + +set -U fish_greeting + +set -gx DENO_INSTALL $HOME/.deno +set -gx RIPGREP_CONFIG_PATH $HOME/.ripgreprc +set -gx GEM_HOME $HOME/gems +set -gx PNPM_HOME $HOME/.local/share/pnpm + +set -gx EDITOR nvim +set -gx VISUAL $EDITOR +set -gx MANPAGER $EDITOR +Man! + +set -gx PATH $(yarn global bin) $DENO_INSTALL/bin $PNPM_HOME $HOME/.npm/bin $HOME/.cargo/bin $HOME/go/bin /usr/local/go/bin $HOME/.local/bin $HOME/bin $HOME/dotfiles/personal_bin $HOME/.local/share/gem/ruby/2.7/bin $HOME/gems/bin $PATH + +function fish_user_key_bindings + fish_default_key_bindings -M insert + fish_vi_key_bindings --no-erase insert +end + +set fish_cursor_default block +set fish_cursor_insert line +set fish_cursor_replace_one underscore +set fish_cursor_visual block + +alias clear='clear -x' +alias q='exit' +alias e='nvim' + +zoxide init fish | source +starship init fish | source diff --git a/fish/fish_variables b/fish/fish_variables new file mode 100644 index 00000000..f6880474 --- /dev/null +++ b/fish/fish_variables @@ -0,0 +1,44 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR EDITOR:nvim +SETUVAR __fish_initialized:3400 +SETUVAR fish_color_autosuggestion:8e908c +SETUVAR fish_color_cancel:\x2d\x2dreverse +SETUVAR fish_color_command:8959a8 +SETUVAR fish_color_comment:eab700 +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:8959a8 +SETUVAR fish_color_error:c82829 +SETUVAR fish_color_escape:00a6b2 +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:\x1d +SETUVAR fish_color_keyword:\x1d +SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:00a6b2 +SETUVAR fish_color_option:\x1d +SETUVAR fish_color_param:4271ae +SETUVAR fish_color_quote:718c00 +SETUVAR fish_color_redirection:3e999f +SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_status:red +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_greeting:\x1d +SETUVAR fish_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_background:\x1d +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:B3A06D +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_pager_color_secondary_background:\x1d +SETUVAR fish_pager_color_secondary_completion:\x1d +SETUVAR fish_pager_color_secondary_description:\x1d +SETUVAR fish_pager_color_secondary_prefix:\x1d +SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dbrblack +SETUVAR fish_pager_color_selected_completion:\x1d +SETUVAR fish_pager_color_selected_description:\x1d +SETUVAR fish_pager_color_selected_prefix:\x1d diff --git a/fish/functions/cdr.fish b/fish/functions/cdr.fish new file mode 100644 index 00000000..1f25ba02 --- /dev/null +++ b/fish/functions/cdr.fish @@ -0,0 +1,3 @@ +function cdr --description 'change dir to git root dir' + cd (git rev-parse --show-toplevel) +end diff --git a/fish/functions/ej.fish b/fish/functions/ej.fish new file mode 100644 index 00000000..df3f8c03 --- /dev/null +++ b/fish/functions/ej.fish @@ -0,0 +1,8 @@ +function ej --description 'emoji selection' + if type -q emoji-fzf + emoji-fzf preview --prepend | fzf | awk '{ print $1 }' | tr -d "\n" | wl-copy + else + pip install emoji-fzf + emoji-fzf preview --prepend | fzf | awk '{ print $1 }' | tr -d "\n" | wl-copy + end +end diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish new file mode 100644 index 00000000..d58bf640 --- /dev/null +++ b/fish/functions/fish_prompt.fish @@ -0,0 +1,30 @@ +function fish_prompt --description 'Write out the prompt' + set -l last_status $status + set -l normal (set_color normal) + set -l status_color (set_color brgreen) + set -l cwd_color (set_color $fish_color_cwd) + set -l vcs_color (set_color brpurple) + set -l prompt_status "" + + # Since we display the prompt on a new line allow the directory names to be longer. + set -q fish_prompt_pwd_dir_length + or set -lx fish_prompt_pwd_dir_length 0 + + # Color the prompt differently when we're root + set -l suffix '❯' + if functions -q fish_is_root_user; and fish_is_root_user + if set -q fish_color_cwd_root + set cwd_color (set_color $fish_color_cwd_root) + end + set suffix '#' + end + + # Color the prompt in red on error + if test $last_status -ne 0 + set status_color (set_color $fish_color_error) + set prompt_status $status_color "[" $last_status "]" $normal + end + + echo -s (prompt_login) ' ' $cwd_color (prompt_pwd) $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status + echo -n -s $status_color $suffix ' ' $normal +end diff --git a/fish/functions/h b/fish/functions/h new file mode 100644 index 00000000..3dbf8969 --- /dev/null +++ b/fish/functions/h @@ -0,0 +1,88 @@ +───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + β”‚ File: /home/master/.local/share/tmux/resurrect/restore/pane_contents//pane-dotfiles:2.1 +───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + 1 β”‚ β–Ž  8 function auto_commit --description 'auto commit and push to git server'  +  β”‚   + 2 β”‚ β–Ž  7 β”‚ β”‚ git add --all  +  β”‚   + 3 β”‚ β–Ž  6 β”‚ β”‚ git commit -m "[πŸ‘ŒAuto commit]"  +  β”‚   + 4 β”‚ β–Ž  5 β”‚ β”‚ git pull  +  β”‚   + 5 β”‚ β–Ž  4 β”‚ β”‚ git push  +  β”‚   + 6 β”‚ β–Ž  3 end  +  β”‚   + 7 β”‚ β–Ž  2   +  β”‚   + 8 β”‚ β–Ž  1 function ok --description 'auto commit and push to git server'  +  β”‚   + 9 β”‚ β–Ž 9 β”‚-β”‚-  +  β”‚   + 10 β”‚ β–Ž  1 end  +  β”‚   + 11 β”‚ ~  +  β”‚   + 12 β”‚ ~  +  β”‚   + 13 β”‚ ~  +  β”‚   + 14 β”‚ ~  +  β”‚   + 15 β”‚ ~  +  β”‚   + 16 β”‚ ~  +  β”‚   + 17 β”‚ ~  +  β”‚   + 18 β”‚ ~  +  β”‚   + 19 β”‚ ~  +  β”‚   + 20 β”‚ ~  +  β”‚   + 21 β”‚ ~  +  β”‚   + 22 β”‚ ~  +  β”‚   + 23 β”‚ ~  +  β”‚   + 24 β”‚ ~  +  β”‚   + 25 β”‚ ~  +  β”‚   + 26 β”‚ ~  +  β”‚   + 27 β”‚ ~  +  β”‚   + 28 β”‚ ~  +  β”‚   + 29 β”‚ ~  +  β”‚   + 30 β”‚ ~  +  β”‚   + 31 β”‚ ~  +  β”‚   + 32 β”‚ ~  +  β”‚   + 33 β”‚ ~  +  β”‚   + 34 β”‚ ~  +  β”‚   + 35 β”‚ ~  +  β”‚   + 36 β”‚ ~  +  β”‚   + 37 β”‚ ~  +  β”‚   + 38 β”‚ ~  +  β”‚   + 39 β”‚ ~  +  β”‚   + 40 β”‚ ~  +  β”‚   + 41 β”‚ ~  +  β”‚   + 42 β”‚  INSERT ξ‚° ξ‚  main ξ‚° ξž• ok.fish οƒΆ  c$ ξ‚² 90% 9:5 ξ‚² +  β”‚   15:38  +───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── diff --git a/fish/functions/hi.fish b/fish/functions/hi.fish new file mode 100644 index 00000000..be3e2cd4 --- /dev/null +++ b/fish/functions/hi.fish @@ -0,0 +1,22 @@ +function hi --description 'daily jobs' + xdg-open "https://feeder.co/reader" + xdg-open "https://mail.google.com/mail/u/0/#inbox" + xdg-open "https://mail.google.com/mail/u/1/#inbox" + xdg-open "https://www.youtube.com/feed/subscriptions" + xdg-open "https://github.com" + + set -l current_dir (pwd) + + pnpm add -g pnpm + dnf makecache + deno upgrade + tldr --update + $HOME/.tmux/plugins/tpm/bin/update_plugins all + + cd $HOME/dotfiles/ + nvim --headless "+Lazy! sync" +qa + git add nvim/lazy-lock.json + git commit -m "chore: lazy.nvim" + + cd $current_dir +end diff --git a/fish/functions/ok.fish b/fish/functions/ok.fish new file mode 100644 index 00000000..f4a91854 --- /dev/null +++ b/fish/functions/ok.fish @@ -0,0 +1,6 @@ +function ok --description 'auto commit and push to git server' + git add --all + git commit -m "[πŸ‘ŒAuto commit]" + git pull + git push +end diff --git a/fish/functions/reload.fish b/fish/functions/reload.fish new file mode 100644 index 00000000..cbdeefe9 --- /dev/null +++ b/fish/functions/reload.fish @@ -0,0 +1,4 @@ +function reload --description 'reload fish config file' + source $HOME/.config/fish/config.fish + tmux source-file $HOME/.tmux.conf +end diff --git a/fish/functions/ser.fish b/fish/functions/ser.fish new file mode 100644 index 00000000..ab29bcc3 --- /dev/null +++ b/fish/functions/ser.fish @@ -0,0 +1,4 @@ +function ser --description 'browser sync start server' + set -l SERVER_IP (hostname -I) + browser-sync start --server --files . --no-notify --host "$SERVER_IP" --port 9000 +end diff --git a/fish/functions/sync_music.fish b/fish/functions/sync_music.fish new file mode 100644 index 00000000..67a86d5a --- /dev/null +++ b/fish/functions/sync_music.fish @@ -0,0 +1,12 @@ +function sync_music --description 'sync music playlist on Youtube' + set -l current_dir (pwd) + set -l music_dir $HOME/Music/music_i_like/ + + rm -rf "$music_dir" + mkdir -p "$music_dir" + cd $music_dir + + yt-dlp -f bestaudio --continue --no-overwrites --ignore-errors --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" "https://www.youtube.com/playlist?list=PLcazFfFZIFPld2xu_nAgmbgj5QldQOpUB" + + cd $current_dir +end diff --git a/fish/functions/yt.fish b/fish/functions/yt.fish new file mode 100644 index 00000000..bfa332f9 --- /dev/null +++ b/fish/functions/yt.fish @@ -0,0 +1,3 @@ +function yt --description 'youtube download video' + yt-dlp -f bestvideo+bestaudio -o "%(title)s.%(ext)s" $argv +end diff --git a/fish/functions/yta.fish b/fish/functions/yta.fish new file mode 100644 index 00000000..4aa18b11 --- /dev/null +++ b/fish/functions/yta.fish @@ -0,0 +1,3 @@ +function yta --description 'youtube download audio' + yt-dlp -f bestaudio --continue --no-overwrites --ignore-errors --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" $argv +end diff --git a/install.sh b/install.sh index c6669a08..510f2b52 100755 --- a/install.sh +++ b/install.sh @@ -28,7 +28,7 @@ sudo dnf config-manager \ --add-repo \ https://download.docker.com/linux/fedora/docker-ce.repo -sudo dnf install -y tmux curl wget git neofetch htop gnome-tweaks trash-cli python3-pip tldr net-tools speedtest-cli neovim python3-neovim fd-find aria2 tree cowsay fzf npm ffmpeg youtube-dl mpv ripgrep unrar moreutils foliate util-linux-user zsh cronie git-delta wl-clipboard java-devel git-clang-format rust cargo go gtk-v4l ruby ruby-devel gcc-c++ ibus-bamboo collectd-sensors obs-studio dconf-editor sqlite shfmt v4l-utils google-noto-emoji-color-fonts cmake kdenlive starship glib2-static libgda libgda-sqlite exa bat libsqlite3x-devel yt-dlp ddcutil code docker-ce docker-ce-cli containerd.io docker-compose-plugin foot celluloid +sudo dnf install -y tmux curl wget git neofetch htop gnome-tweaks trash-cli python3-pip tldr net-tools speedtest-cli neovim python3-neovim fd-find aria2 tree cowsay fzf npm ffmpeg youtube-dl mpv ripgrep unrar moreutils foliate util-linux-user zsh cronie git-delta wl-clipboard java-devel git-clang-format rust cargo go gtk-v4l ruby ruby-devel gcc-c++ ibus-bamboo collectd-sensors obs-studio dconf-editor sqlite shfmt v4l-utils google-noto-emoji-color-fonts cmake kdenlive starship glib2-static libgda libgda-sqlite bat libsqlite3x-devel yt-dlp ddcutil code docker-ce docker-ce-cli containerd.io docker-compose-plugin foot celluloid zoxide sudo systemctl start docker @@ -84,14 +84,12 @@ mkdir ~/.config/lazygit ln -sf ~/dotfiles/git/lazygit_config.yml ~/.config/lazygit/config.yml ln -sf ~/dotfiles/.selected_editor ~/.selected_editor ln -sf ~/dotfiles/.ripgreprc ~/ -ln -sf ~/dotfiles/bashrc ~/.bashrc rm -rf ~/.config/input-remapper/ ln -sf ~/dotfiles/input-remapper/ ~/.config/ ln -sf ~/repos/thuanowa/obs-studio/ ~/.config/ -rm -rf ~/.config/kitty -ln -sf ~/dotfiles/kitty ~/.config/ rm -rf ~/.config/foot ln -sf ~/dotfiles/foot ~/.config/ +ln -sf ~/dotfiles/fish ~/.config/ mkdir ~/repos/thuanowa/ cd ~/repos/thuanowa/ @@ -107,34 +105,25 @@ docker run hello-world sudo systemctl enable docker.service sudo systemctl enable containerd.service -# setup gnome-display-brightness-ddcutil: https://github.com/daitj/gnome-display-brightness-ddcutil -# change shortcut to `alt + brightness up/down` -modprobe i2c-dev -ddcutil capabilities | grep "Feature: 10" -sudo cp /usr/share/ddcutil/data/45-ddcutil-i2c.rules /etc/udev/rules.d -sudo groupadd --system i2c -sudo usermod "$USER" -aG i2c -touch /etc/modules-load.d/i2c.conf -sudo sh -c "echo 'i2c-dev' >> /etc/modules-load.d/i2c.conf" - REPOS_PATH=~/repos/ -mkdir $REPOS_PATH +mkdir $REPOS_PATH 2>/dev/null cd $REPOS_PATH -github_username=( +github_usernames=( thuanowa - ongdev + OngDev isekaiSystem from-design-to-website when-will-i-die ) -for i in ${github_username[*]}; do - mkdir "$i" - cd "$i" +for user in ${github_usernames[*]}; do + mkdir "$user" 2>/dev/null + cd "$user" + echo -e "\e[1m\e[36m$user\e[0m" - gh repo list "$i" --limit 10000 | awk '{print $1}' | while read -r repo; do - gh repo clone "$repo" + gh repo list "$user" --limit 10000 | awk '{print $1}' | while read -r repo_name; do + gh repo clone "$repo_name" done cd $REPOS_PATH diff --git a/nvim/lua/plugins/null-ls.lua b/nvim/lua/plugins/null-ls.lua index 185045c8..e02017ff 100644 --- a/nvim/lua/plugins/null-ls.lua +++ b/nvim/lua/plugins/null-ls.lua @@ -7,8 +7,10 @@ return { sources = { nls.builtins.formatting.prettierd, nls.builtins.formatting.shfmt, + nls.builtins.formatting.fish_indent, nls.builtins.diagnostics.eslint, nls.builtins.diagnostics.write_good, + nls.builtins.diagnostics.fish, }, } end, diff --git a/personal_bin/run b/personal_bin/run deleted file mode 100755 index 8c5bba28..00000000 --- a/personal_bin/run +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -file_name=$1 -file_name_without_extension=$(echo "$file_name" | cut -f 1 -d '.') - -if [ -f $file_name ]; then - if hash cowsay 2>/dev/null; then - cowsay "πŸ‘‹Hey, I will run $file_name for you." - cowsay "Result" - else - echo "πŸ‘‹Hey, I will run $file_name for you." - echo "==========" - echo "==Result==" - echo "==========" - fi - echo "" - case $file_name in - *.cpp) - g++ $file_name - ./a.out - rm a.out - ;; - *.c) - gcc $file_name - ./a.out - rm a.out - ;; - *.html) brave-browser --new-window $file_name ;; - *.js) node $file_name ;; - *.ts) deno $file_name ;; - *.py) python $file_name ;; - *.go) go run $file_name ;; - *.cs) - csc $file_name - mono "${file_name_without_extension}.exe" - rm -rf "${file_name_without_extension}.exe" - ;; - *.java) - javac $file_name - java $file_name_without_extension - rm -rf "${file_name_without_extension}.class" - ;; - *.php) php $file_name ;; - *.sh) - chmod +x $file_name - ./$file_name - ;; - *) if hash cowsay 2>/dev/null; then - cowthink -d "I guess, you don't type right the file name. 🀣 Try again." - else - echo "I guess, you don't type right the file name. 🀣 Try again." - fi ;; - esac -fi diff --git a/personal_bin/test_true_color b/personal_bin/test_true_color index f407258f..2599822a 100755 --- a/personal_bin/test_true_color +++ b/personal_bin/test_true_color @@ -8,15 +8,13 @@ # range from 0 to 255 inclusive. # The escape sequence ^[0m returns output to default -setBackgroundColor() -{ - #printf '\x1bPtmux;\x1b\x1b[48;2;%s;%s;%sm' $1 $2 $3 - printf '\x1b[48;2;%s;%s;%sm' $1 $2 $3 +setBackgroundColor() { + #printf '\x1bPtmux;\x1b\x1b[48;2;%s;%s;%sm' $1 $2 $3 + printf '\x1b[48;2;%s;%s;%sm' $1 $2 $3 } -resetOutput() -{ - echo -en "\x1b[0m\n" +resetOutput() { + echo -en "\x1b[0m\n" } # Gives a color $1/255 % along HSV @@ -24,77 +22,70 @@ resetOutput() # Echoes "$red $green $blue" where # $red $green and $blue are integers # ranging between 0 and 255 inclusive -rainbowColor() -{ - let h=$1/43 - let f=$1-43*$h - let t=$f*255/43 - let q=255-t +rainbowColor() { + let h=$1/43 + let f=$1-43*$h + let t=$f*255/43 + let q=255-t - if [ $h -eq 0 ] - then - echo "255 $t 0" - elif [ $h -eq 1 ] - then - echo "$q 255 0" - elif [ $h -eq 2 ] - then - echo "0 255 $t" - elif [ $h -eq 3 ] - then - echo "0 $q 255" - elif [ $h -eq 4 ] - then - echo "$t 0 255" - elif [ $h -eq 5 ] - then - echo "255 0 $q" - else - # execution should never reach here - echo "0 0 0" - fi + if [ $h -eq 0 ]; then + echo "255 $t 0" + elif [ $h -eq 1 ]; then + echo "$q 255 0" + elif [ $h -eq 2 ]; then + echo "0 255 $t" + elif [ $h -eq 3 ]; then + echo "0 $q 255" + elif [ $h -eq 4 ]; then + echo "$t 0 255" + elif [ $h -eq 5 ]; then + echo "255 0 $q" + else + # execution should never reach here + echo "0 0 0" + fi } -for i in `seq 0 127`; do - setBackgroundColor $i 0 0 - echo -en " " +for i in $(seq 0 127); do + setBackgroundColor $i 0 0 + echo -en " " done resetOutput -for i in `seq 255 -1 128`; do - setBackgroundColor $i 0 0 - echo -en " " +for i in $(seq 255 -1 128); do + setBackgroundColor $i 0 0 + echo -en " " done resetOutput -for i in `seq 0 127`; do - setBackgroundColor 0 $i 0 - echo -n " " +for i in $(seq 0 127); do + setBackgroundColor 0 $i 0 + echo -n " " done resetOutput -for i in `seq 255 -1 128`; do - setBackgroundColor 0 $i 0 - echo -n " " +for i in $(seq 255 -1 128); do + setBackgroundColor 0 $i 0 + echo -n " " done resetOutput -for i in `seq 0 127`; do - setBackgroundColor 0 0 $i - echo -n " " +for i in $(seq 0 127); do + setBackgroundColor 0 0 $i + echo -n " " done resetOutput -for i in `seq 255 -1 128`; do - setBackgroundColor 0 0 $i - echo -n " " +for i in $(seq 255 -1 128); do + setBackgroundColor 0 0 $i + echo -n " " done resetOutput -for i in `seq 0 127`; do - setBackgroundColor `rainbowColor $i` - echo -n " " +for i in $(seq 0 127); do + setBackgroundColor $(rainbowColor $i) + echo -n " " done resetOutput -for i in `seq 255 -1 128`; do - setBackgroundColor `rainbowColor $i` - echo -n " " +for i in $(seq 255 -1 128); do + setBackgroundColor $(rainbowColor $i) + echo -n " " done resetOutput diff --git a/personal_bin/u b/personal_bin/u deleted file mode 100755 index c611cfdb..00000000 --- a/personal_bin/u +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -if [ -f "$1" ]; then - case "$1" in - *.tar.bz2) tar -jxvf "$1" ;; - *.tar.gz) tar -zxvf "$1" ;; - *.bz2) bunzip2 "$1" ;; - *.dmg) hdiutil mount "$1" ;; - *.gz) gunzip "$1" ;; - *.tar) tar -xvf "$1" ;; - *.tar.xz) tar -xvf "$1" ;; - *.tbz2) tar -jxvf "$1" ;; - *.tgz) tar -zxvf "$1" ;; - *.txz) tar -zxvf "$1" ;; - *.zip) unzip "$1" ;; - *.ZIP) unzip "$1" ;; - *.pax) cat "$1" | pax -r ;; - *.pax.Z) uncompress "$1" --stdout | pax -r ;; - *.rar) unrar x "$1" ;; - *.Z) uncompress "$1" ;; - *.7z) 7z x $1 ;; - *) echo "'"$1"' cannot be extracted/mounted via extract()" ;; - esac -else - echo "'$1' is not a valid file" -fi diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 516e8077..845bc53e 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -25,8 +25,8 @@ bind j select-pane -D bind k select-pane -U bind l select-pane -R -bind -n Left previous-window -bind -n Right next-window +bind -n C-Left previous-window +bind -n C-Right next-window bind-key -T copy-mode-vi 'v' send -X begin-selection bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'wl-copy' @@ -38,14 +38,14 @@ bind-key r rotate-window bind-key + select-layout main-horizontal bind-key = select-layout main-vertical -unbind -n C-Left -unbind -n C-Down -unbind -n C-Up -unbind -n C-Right -bind -n C-Left resize-pane -L 10 -bind -n C-Right resize-pane -R 10 -bind -n C-Down resize-pane -D 5 -bind -n C-Up resize-pane -U 5 +unbind -n C-S-Left +unbind -n C-S-Down +unbind -n C-S-Up +unbind -n C-S-Right +bind -n C-S-Left resize-pane -L 10 +bind -n C-S-Right resize-pane -R 10 +bind -n C-S-Down resize-pane -D 5 +bind -n C-S-Up resize-pane -U 5 set -g status-interval 2 set -g base-index 1