diff options
Diffstat (limited to 'home/xyz')
-rw-r--r-- | home/xyz/.bashrc | 56 | ||||
-rw-r--r-- | home/xyz/.config/htop/htoprc | 43 | ||||
-rw-r--r-- | home/xyz/.config/nvim/init.vim | 63 | ||||
-rw-r--r-- | home/xyz/.config/systemd/user/ssh-agent.service | 2 | ||||
-rwxr-xr-x | home/xyz/.local/bin/cfg | 1 | ||||
-rwxr-xr-x | home/xyz/.local/bin/gita | 2 | ||||
-rwxr-xr-x | home/xyz/.local/bin/gitfork | 8 | ||||
-rwxr-xr-x | home/xyz/.local/bin/gitpu | 19 | ||||
-rwxr-xr-x | home/xyz/.local/bin/gitsetup | 6 | ||||
-rwxr-xr-x | home/xyz/.local/bin/mmi | 2 | ||||
-rwxr-xr-x | home/xyz/.local/bin/mvln | 3 | ||||
-rwxr-xr-x | home/xyz/.local/bin/mvtr | 3 | ||||
-rwxr-xr-x | home/xyz/.local/bin/o | 2 | ||||
-rwxr-xr-x | home/xyz/.local/bin/time-uuid (renamed from home/xyz/.local/bin/time.uuid) | 2 | ||||
-rwxr-xr-x | home/xyz/.local/bin/upd | 99 | ||||
-rwxr-xr-x | home/xyz/.local/bin/wh | 2 | ||||
-rw-r--r-- | home/xyz/.profile | 60 |
17 files changed, 146 insertions, 227 deletions
diff --git a/home/xyz/.bashrc b/home/xyz/.bashrc index 4597afb4..be28f908 100644 --- a/home/xyz/.bashrc +++ b/home/xyz/.bashrc @@ -32,17 +32,22 @@ esac PS1="\[$(tput setaf 2)\][\u@\h \W]\$ \[$(tput sgr0)\]" # https://github.com/LukeSmithxyz/voidrice/blob/master/.config/shell/aliasrc -for cmd in iotop nethogs hardcode-fixer ventoy du units_cur fbgrab powertop nft rpi-imager fdisk; do +for cmd in hardcode-fixer ventoy du units_cur fbgrab powertop nft rpi-imager fdisk dmesg; do alias $cmd="sudo $cmd" done -for cmd in pacdiff 'tree -a'; do - alias ${cmd%% *}="sudo -E $cmd" +for cmd in pacdiff visudo; do + alias $cmd="sudo -E $cmd" +done +for cmd in loop o 'watch -c'; do + alias ${cmd%% *}="$cmd " done unset cmd # same name alias absolutely-proprietary='echo n | absolutely-proprietary -f' alias alsamixer='alsamixer -V all' +# I can't find a quick and easy way to temperory disable cloc config file except to change config file. Using an alias can disable --vcs with just \cloc. +alias cloc='cloc --vcs auto' alias diff='diff --color=auto' alias grep='grep --color=auto' #alias info='info --vi-keys' @@ -53,38 +58,57 @@ alias remind='remind -@' alias rm='rm -I' alias sdcv='sdcv --color' alias shellcheck='shellcheck -x' +alias tree='tree -aC | "$PAGER"' alias uname='uname -a' -alias watch='watch -c' # different name +alias a=alarm # /dev/ttyACM0 can be in config file, or as environmantal variable, see /usr/share/doc/adafruit-ampy/README.md -alias ap='sudo ampy -p /dev/ttyACM0' +#alias ap='ampy -p /dev/ttyACM0' +alias b='lsblk -o NAME,FSTYPE,FSVER,LABEL,UUID,FSAVAIL,FSUSED,FSUSE%,MOUNTPOINTS' alias c=cfg +#alias cr=curl +alias cri='curl -Is' +alias crig='curl -Is www.google.com' alias d='\sdcv --color' +alias e='"$PAGER"' +# https://superuser.com/a/1202867 +alias fdu="find . -maxdepth 1 -execdir du -sh '{}' \+ | sort -h" alias g=git +alias gcd='git clone --depth=1' +alias gr='\grep --color=auto -i' +alias grr='\grep --color=auto -iIR' +alias h=htop alias l='\ls --color=auto -A --group-directories-first' alias ll='\ls --color=auto -lAh --group-directories-first' +#alias lo=loop +alias lop='loop ping' +alias lopd='loop ping 9.9.9.9' alias m=man alias p=pacman alias pt=pactree alias pu=paru alias qre='qrencode -t utf8i -m 1' -alias r='rem -c+2 -@' -alias s='sudo ' # https://askubuntu.com/a/22043 +alias r='rem -cu+2 -@' +# https://askubuntu.com/a/22043 +alias s='sudo ' alias se='sudo -E ' +alias ska='ssh ka' +alias sp='ssh pp' alias spd='speedtest; librespeed-cli' alias sv=sudoedit alias sy=systemctl -alias tp='sudo tio /dev/ttyACM0' -alias v='$EDITOR' -alias va='$EDITOR "$XDG_DOCUMENTS_DIR/notes/computer/arch_install.md"' -alias vc='$EDITOR "$XDG_DOCUMENTS_DIR/notes/computer/cli_notes.md"' -alias vq='$EDITOR "$XDG_DOCUMENTS_DIR/notes/others/questions_ideas_tips.md"' -alias vr='$EDITOR "$DOTREMINDERS"' -alias vvrc='$EDITOR +e\ \$MYVIMRC' +alias syd='systemctl list-dependencies --all' +alias sydr='systemctl list-dependencies --all --reverse' +alias sye='systemctl list-unit-files --state=enabled' +alias sys='systemctl status' +alias syu='systemctl --user' +alias syue='systemctl --user list-unit-files --state=enabled' +alias syus='systemctl --user status' +alias v='"$EDITOR"' +alias vd='vidir2 --linktargets' +alias vrc='"$EDITOR" +e\ \$MYVIMRC' alias za='zoxide add' - -# almost never use #alias zq='zoxide query' #alias zqi='zoxide query -i' diff --git a/home/xyz/.config/htop/htoprc b/home/xyz/.config/htop/htoprc index 48d07e69..cb80a1bc 100644 --- a/home/xyz/.config/htop/htoprc +++ b/home/xyz/.config/htop/htoprc @@ -1,12 +1,8 @@ # Beware! This file is rewritten by htop when settings are changed in the interface. # The parser is also very primitive, and not human-friendly. -htop_version=3.1.0 -config_reader_min_version=2 +htop_version=3.2.0 +config_reader_min_version=3 fields=0 48 17 18 38 39 40 2 46 47 49 1 -sort_key=46 -sort_direction=-1 -tree_sort_key=0 -tree_sort_direction=1 hide_kernel_threads=1 hide_userland_threads=1 shadow_other_users=0 @@ -21,10 +17,8 @@ highlight_changes_delay_secs=5 find_comm_in_cmdline=1 strip_exe_from_cmdline=1 show_merged_command=0 -tree_view=0 -tree_view_always_by_pid=0 -all_branches_collapsed=0 header_margin=1 +screen_tabs=1 detailed_cpu_time=0 cpu_count_from_one=0 show_cpu_usage=1 @@ -38,7 +32,30 @@ enable_mouse=1 delay=15 hide_function_bar=0 header_layout=two_50_50 -column_meters_0=AllCPUs Memory Swap -column_meter_modes_0=1 1 1 -column_meters_1=Tasks LoadAverage DiskIO NetworkIO -column_meter_modes_1=2 2 2 2 +column_meters_0=LeftCPUs Memory Uptime LoadAverage Systemd +column_meter_modes_0=1 1 2 2 2 +column_meters_1=RightCPUs Swap Tasks DiskIO NetworkIO +column_meter_modes_1=1 1 2 2 2 +tree_view=0 +sort_key=46 +tree_sort_key=0 +sort_direction=-1 +tree_sort_direction=1 +tree_view_always_by_pid=0 +all_branches_collapsed=0 +screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command +.sort_key=PERCENT_CPU +.tree_sort_key=PID +.tree_view=0 +.tree_view_always_by_pid=0 +.sort_direction=-1 +.tree_sort_direction=1 +.all_branches_collapsed=0 +screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE PERCENT_SWAP_DELAY PERCENT_IO_DELAY Command +.sort_key=IO_RATE +.tree_sort_key=PID +.tree_view=0 +.tree_view_always_by_pid=0 +.sort_direction=-1 +.tree_sort_direction=1 +.all_branches_collapsed=0 diff --git a/home/xyz/.config/nvim/init.vim b/home/xyz/.config/nvim/init.vim index b08d967d..d73e0ba0 100644 --- a/home/xyz/.config/nvim/init.vim +++ b/home/xyz/.config/nvim/init.vim @@ -8,18 +8,19 @@ call plug#begin() "Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } "Plug 'junegunn/fzf.vim' "Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' } -Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } +"Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } " chriskempson/base16-vim doesn't do bold/italic for markdown syntax, and not maintained -" fnune/base16-vim and RRethy/nvim-base16 seem both work, both support tree-sitter -Plug 'fnune/base16-vim' +" tinted-theming/base16-vim and RRethy/nvim-base16 seem both work, both support tree-sitter +" I prefer tinted-theming/base16-vim in the past because of darker status bar color? +Plug 'tinted-theming/base16-vim' " nvim-treesitter does not support markdown right now, so wait "Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update " use latest vim-markdown Plug 'tpope/vim-markdown' " alternatives: h-hg/fcitx.nvim, rlue/vim-barbaric, lilydjwg/fcitx.vim -Plug 'rlue/vim-barbaric' +"Plug 'rlue/vim-barbaric' " alternatives: 'thinca/vim-ref' with 'eiiches/vim-ref-info', 'HiPhish/info.vim', 'alx741/vinfo' -Plug 'HiPhish/info.vim' +Plug 'https://gitlab.com/HiPhish/info.vim.git' call plug#end() " next line must put below `Plug 'glacambre/firenvim'`, else if click github issue textarea, then click elsewhere, then click textarea, textarea will not be selected (no cursor in it), not sure why @@ -57,7 +58,8 @@ augroup END " :h markdown, for vim default tpope/vim-markdown "let g:markdown_folding = 1 -let g:markdown_minlines = 500 +" g:markdown_minlines before nvim 0.8, 500 works well; version 0.8 makes even 400 noticeable slow when keep pressing gk +let g:markdown_minlines = 350 "let g:markdown_fenced_languages = ['python', 'sh', 'vim', 'c', 'cpp'] " netrw-p preview vertial split @@ -68,7 +70,7 @@ let g:netrw_winsize = 20 filetype plugin on " fold is slow and buggy, at least for different kinds of vim-markdown, disable it, not sure if works or not -set nofoldenable +"set nofoldenable language en_US set number relativenumber @@ -80,9 +82,6 @@ colorscheme base16-tomorrow-night " set dir to current editing file's dir set autochdir -" always use system for ALL instead of use + and * operator? -"set clipboard+=unnamedplus - " Spaces & Tabs set tabstop=4 " number of visual spaces per TAB set softtabstop=4 " number of spaces in tab when editing @@ -90,24 +89,30 @@ set shiftwidth=4 " number of spaces to use for autoindent "set expandtab " tabs are space " https://www.zhihu.com/question/22363620/answer/21199296 -" last line seems is default to neovim but not vim -set fileencodings=ucs-bom,utf-8,utf-16,gbk,big5,gb18030,latin1 +" euc-cn=gb2312, cp936=gbk +" it is recommended by `:h fileencodings` to put ucs-bom at first and latin1 at last +" based on my experience, if put utf-16 in front of euc-cn, euc-cn will have mojibake +" based on my experience, if put big5 in front of euc-cn and cp936, euc-cn will have mojibake +" according to zhihu comment, if put gb18030 in front of big5 , big5 will have mojibake +" according to wikipedia articles, euc-cn is preceded by cp936 which is preceded by gb18030, gb18030 is backward compatible with cp936 which seems is backward compatible with euc-cn +set fileencodings=ucs-bom,utf-8,euc-cn,cp936,big5,gb18030,utf-16,latin1 +" seems is default to neovim but not vim set encoding=utf-8 " some file on win10 display as unix but is dos -"if has('win32') -" set fileformats=dos -" " windows 10 bug, need this to change cursor back to vertical bar after leaving neovim -" " the number after ver seems no effects, maybe because neovim is exited -" " https://github.com/alacritty/alacritty/issues/2839#issuecomment-766421840 -" " use of ! after autocmd see youtube video above, not fully understood -" autocmd! VimLeave * set guicursor=a:ver25 -"endif - -" don't generate those three types of files -set nobackup -set noswapfile -set noundofile +if has('win32') + set fileformats=dos + " windows 10 bug, need this to change cursor back to vertical bar after leaving neovim + " the number after ver seems no effects, maybe because neovim is exited + " https://github.com/alacritty/alacritty/issues/2839#issuecomment-766421840 + " use of ! after autocmd see youtube video above, not fully understood + autocmd! VimLeave * set guicursor=a:ver25 +endif + +" if don't want to generate swap file +"set noswapfile +" nvim backup file defualt off, see `:h nobackup` `:set backup?` +" nvim undo file default off, see `:h noundofile` `:set undofile?` " gg=G work for .xml files now,:h matchit-activate " https://stackoverflow.com/questions/21408222/vim-indent-xml-file/28365920#28365920 @@ -117,6 +122,10 @@ packadd! matchit set ignorecase set smartcase +" disable mouse support +" :h disable-mouse +set mouse= + " map ctrl+h/j/k/l to move between split windows map <C-h> <C-w>h map <C-j> <C-w>j @@ -124,8 +133,8 @@ map <C-k> <C-w>k map <C-l> <C-w>l " moving in long line -nnoremap k gk -nnoremap j gj +"nnoremap k gk +"nnoremap j gj nnoremap o o<Esc> nnoremap O O<Esc> diff --git a/home/xyz/.config/systemd/user/ssh-agent.service b/home/xyz/.config/systemd/user/ssh-agent.service index 66fa63ef..e867c4b1 100644 --- a/home/xyz/.config/systemd/user/ssh-agent.service +++ b/home/xyz/.config/systemd/user/ssh-agent.service @@ -11,7 +11,7 @@ Type=simple Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket # DISPLAY required for ssh-askpass to work Environment=DISPLAY=:0 -ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK +ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK -t 3600 # github White-Oak approach # https://github.com/White-Oak/arch-setup-for-dummies/blob/master/setting-up-ssh-agent.md diff --git a/home/xyz/.local/bin/cfg b/home/xyz/.local/bin/cfg index 3f7ec29d..92a097e7 100755 --- a/home/xyz/.local/bin/cfg +++ b/home/xyz/.local/bin/cfg @@ -1,5 +1,6 @@ #!/bin/sh +umask 077 while getopts lsmM opt; do case $opt in #c) diff --git a/home/xyz/.local/bin/gita b/home/xyz/.local/bin/gita index 27b45549..9e445761 100755 --- a/home/xyz/.local/bin/gita +++ b/home/xyz/.local/bin/gita @@ -11,7 +11,7 @@ while getopts cls f; do done shift $((OPTIND-1)) -mes="${1:-refactor}" +mes="${1:-update}" $cmd add -u $cmd commit -m "$mes" diff --git a/home/xyz/.local/bin/gitfork b/home/xyz/.local/bin/gitfork deleted file mode 100755 index cefc4f68..00000000 --- a/home/xyz/.local/bin/gitfork +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -git clone "$1" -cd "$(basename "$1" .git)" || exit -git remote add upstream "$2" -git branch fly -git checkout fly -git push --set-upstream origin fly diff --git a/home/xyz/.local/bin/gitpu b/home/xyz/.local/bin/gitpu deleted file mode 100755 index fcc32be9..00000000 --- a/home/xyz/.local/bin/gitpu +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -if [ -z "$1" ]; then - git checkout master - git pull upstream master - git push - git checkout fly - git merge --no-edit master - git push -else - for dir ; do - git -C "$dir" checkout master - git -C "$dir" pull upstream master - git -C "$dir" push - git -C "$dir" checkout fly - git -C "$dir" merge --no-edit master - git -C "$dir" push - done -fi diff --git a/home/xyz/.local/bin/gitsetup b/home/xyz/.local/bin/gitsetup deleted file mode 100755 index 56f91d76..00000000 --- a/home/xyz/.local/bin/gitsetup +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -git clone "$1" -cd "$(basename "$1" .git)" || exit -git remote add upstream "$2" -git checkout fly diff --git a/home/xyz/.local/bin/mmi b/home/xyz/.local/bin/mmi index cad872cc..350fe505 100755 --- a/home/xyz/.local/bin/mmi +++ b/home/xyz/.local/bin/mmi @@ -19,7 +19,7 @@ shift $((OPTIND-1)) if [ -z "$1" ]; then eval "$cmd" else - for dir ; do + for dir; do cd "$dir" || exit eval "$cmd" cd "$origin" || exit diff --git a/home/xyz/.local/bin/mvln b/home/xyz/.local/bin/mvln index fb540390..54cef541 100755 --- a/home/xyz/.local/bin/mvln +++ b/home/xyz/.local/bin/mvln @@ -25,6 +25,3 @@ else shift done fi - -# for test -#rm -rf ~/test/A\ A/; mkdir -p ~/test/A\ A/; cp -r ~/test/0t/ ~/test/A\ A/1t/; mvln ~/test/A\ A/1t/* ~/test/A\ A/; tree ~/test/A\ A/ diff --git a/home/xyz/.local/bin/mvtr b/home/xyz/.local/bin/mvtr index 850f8dba..28eebf0f 100755 --- a/home/xyz/.local/bin/mvtr +++ b/home/xyz/.local/bin/mvtr @@ -9,6 +9,3 @@ # -exec can't replace -execdir here, can write a -exec version find "$@" -depth -execdir sh -c 'dest="$(echo "$1" | tr -d "\047" | sed -E -e "s/([[:lower:]])([[:upper:]])/\1_\2/g" | tr "[:upper:] " "[:lower:]_" | tr -s "[:punct:]" | sed -E -e "s#/-#/#g" -e "s/_([[:punct:]])/\1/g" -e "s/([[:punct:]])_/\1/g" | tr -s "[:punct:]")"; [ -e "$dest" ] || mv -v -- "$1" "$dest"' shell '{}' \; - -# for test -#mkdir -p ~/test/A\ A/; rm -rf ~/test/A\ A/1t/; cp -r ~/test/0t/ ~/test/A\ A/1t/; time mvtr ~/test/A\ A/1t/; tree ~/test/A\ A/1t/ diff --git a/home/xyz/.local/bin/o b/home/xyz/.local/bin/o index d70a6d76..8fb066c7 100755 --- a/home/xyz/.local/bin/o +++ b/home/xyz/.local/bin/o @@ -13,6 +13,8 @@ # using `>&-` or `2>&-` doesn't completely close mpv's output when run sth. like `o mpv file.mkv` # base on above observations, I choose to use `>/dev/null 2>&1` instead +# need ; before } when it is in the same line as { ? https://www.shellcheck.net/wiki/SC1056 + if [ $# -eq 1 ] && [ -e "$1" ] && { ! [ -x "$1" ] || [ -d "$1" ];}; then case "$1" in # libreoffice, please don't let firefox eat your shit diff --git a/home/xyz/.local/bin/time.uuid b/home/xyz/.local/bin/time-uuid index 11cc67ad..bdaf4b3d 100755 --- a/home/xyz/.local/bin/time.uuid +++ b/home/xyz/.local/bin/time-uuid @@ -3,4 +3,4 @@ # echo current nanosecond since epoch and alpha-numerically ordered UUID # https://stackoverflow.com/questions/28681650/generate-alpha-numerically-ordered-uuids-over-time?noredirect=1&lq=1 # https://askubuntu.com/questions/342842/what-does-this-command-mean-awk-f-print-4 -echo "$(date '+%s.%N').$(uuidgen -t | awk -F- '{OFS="-"; print $3,$2,$1,$4,$5}')" +echo "$(date '+%s-%N')-$(uuidgen -t | awk -F- '{OFS="-"; print $3,$2,$1,$4,$5}')" diff --git a/home/xyz/.local/bin/upd b/home/xyz/.local/bin/upd index 8fd6f24b..4552db43 100755 --- a/home/xyz/.local/bin/upd +++ b/home/xyz/.local/bin/upd @@ -2,34 +2,13 @@ all () { fast + clean usb - #qb - #kg - #ncm refl - #gall } clean () { - #nsxiv -c - # my ways - # -exec can't replace -execdir here - #find "$XDG_CACHE_HOME/nsxiv/" -depth -type d -empty -execdir rmdir -- '{}' \+ - # -exec can replace -execdir here - #find "$XDG_CACHE_HOME/nsxiv/" -depth -type d -execdir rmdir --ignore-fail-on-non-empty -- '{}' \+ - # nsxiv man page way - #find "$XDG_CACHE_HOME/nsxiv/" -depth -type d -empty ! -name '.' -exec rmdir -- '{}' \; - - #rm "$HOME/.mozilla/firefox/xxxxxxxx.fly/prefs.js.backup."* - - # https://unix.stackexchange.com/questions/92095/reset-atq-list-to-zero - sudo systemctl stop atd - echo 0 | sudo tee /var/spool/atd/.SEQ > /dev/null - sudo systemctl start atd - - #rm -rf "$XDG_VIDEOS_DIR/recordings/tmp/" - - sudo pacman -Sc --noconfirm + paru -aSc --noconfirm } # basic daily stuff @@ -38,100 +17,60 @@ fast () { misc } -gall () { - gallery-dl --download-archive "$XDG_DOCUMENTS_DIR/database/gallery-dl.sqlite3" -d "$XDG_PICTURES_DIR/anime/gallery-dl/" -i "$XDG_CONFIG_HOME/myconf/gallery_urls" -} - -userjs () { - kill $(pidof "$BROWSER") - "$HOME/.mozilla/firefox/xxxxxxxx.fly/prefsCleaner.sh" -s - "$HOME/.mozilla/firefox/xxxxxxxx.fly/updater.sh" -us -} - -kg () { - curlkg -u649b9e82272a348b -- "$XDG_MUSIC_DIR/not_pure/lan_lan/kg/" - #curlkg -u64949d822c25328c -- "$XDG_MUSIC_DIR/not_pure/cheng_ruan/kg/" -} - misc () { - "$EDITOR" +PlugUpgrade +PlugClean! +PlugUpdate +qa - tldr --update - sudo hardcode-fixer - sudo units_cur - awk '!a[$0]++' "$XDG_DATA_HOME/sdcv_history" | sponge "$XDG_DATA_HOME/sdcv_history" - - # temperory solution before find a way of using git submodule or subtree with `cfg -l` - #git --git-dir=/home/xyz/.mozilla/firefox/xxxxxxxx.fly/chrome/firefox-csshacks/.git/ --work-tree=/home/xyz/.mozilla/firefox/xxxxxxxx.fly/chrome/firefox-csshacks/ pull - - #userjs - clean -} - -ncm () { - curlncm -a48860966 -- "$XDG_MUSIC_DIR/not_pure/lan_lan/ncm/artist/" - #curlncm -a46703185 -- "$XDG_MUSIC_DIR/not_pure/cheng_ruan/ncm/artist/" - #curlncm -a30382647 -- "$XDG_MUSIC_DIR/not_pure/qi_tian_sakura/ncm/artist/" - - curlncm -r793052426 -- "$XDG_MUSIC_DIR/not_pure/lan_lan/ncm/djradio/" - #curlncm -r792968433 -- "$XDG_MUSIC_DIR/not_pure/cheng_ruan/ncm/djradio/" - #curlncm -r792042397 -- "$XDG_MUSIC_DIR/not_pure/qi_tian_sakura/ncm/djradio/" + "$EDITOR" +PlugClean! +PlugUpdate +qa + rustup update } pac () { pacpacs="$(sudo pacman --noconfirm -Syu | tee /dev/tty | grep '^Packages' | cut -d' ' -f3-)" - aurpacs="$(paru --noconfirm -aSyu | tee /dev/tty | grep '^Aur' | cut -d' ' -f3-)" + aurpacs="$(paru --noconfirm -aSu | tee /dev/tty | grep '^Aur' | cut -d' ' -f3-)" # part steal from aur comment # sometimes "ERROR: Failure while downloading": https://github.com/neovim/neovim/issues/15709 # echo 1, printf 1 and yes 1 all works? not sure why # aur neovim-nightly-bin has some issue on 12/26/2021? switch to community repo neovim temporary #rm -rf ~/.cache/paru/clone/neovim-nightly-bin/ && echo 1 | PARU_PAGER=cat paru --rebuild --redownload neovim-nightly-bin - sudo pacman -Fy + pacman -Qqme > "$XDG_CONFIG_HOME/myconf/pacman_Qqme" + pacman -Qqne > "$XDG_CONFIG_HOME/myconf/pacman_Qqne" + systemctl list-unit-files --state=enabled > "$XDG_CONFIG_HOME/myconf/sye" + systemctl --user list-unit-files --state=enabled > "$XDG_CONFIG_HOME/myconf/syue" # pacdiff default use pacman database, so no need `sudo -E` for find, but will be a little bit slower log="$log updated pacman packages: $pacpacs updated aur packages: $aurpacs pacdiff: $(pacdiff -o | tr '\n' ' ') +checkrebuild: $(checkrebuild) " } -qb () { - rm -r -- "$HOME/programs/qbittorrent_search_plugins/" - curlqb "$HOME/programs/qbittorrent_search_plugins/" -} - refl () { - sudo reflector --verbose --save /etc/pacman.d/mirrorlist --score 50 --fastest 45 + # why not use http: + # https://www.reddit.com/r/archlinux/comments/kx149z/should_i_use_http_mirrors/ + # https://www.reddit.com/r/archlinux/comments/ej4k4d/is_it_safe_to_use_not_secured_http_pacman_mirrors/ + # rsync may need to change XferCommand in /etc/pacman.conf + # https://www.reddit.com/r/archlinux/comments/mynw6e/rsync_mirrors_with_pacman/ + # need --delay so no super out of sync mirrors + sudo reflector --verbose --save /etc/pacman.d/mirrorlist --country us --protocol https --delay 1 --latest 25 --score 25 --fastest 10 } usb () { - cfg -l push usb cfg -s push - git --git-dir="$XDG_DOCUMENTS_DIR/notes/.git/" --work-tree="$XDG_DOCUMENTS_DIR/notes/" push usb - git --git-dir="$HOME/programs/reminders/.git/" --work-tree="$HOME/programs/reminders/" push usb - # not sure if useful or not - sync } if [ $# -eq 0 ]; then fast else - while getopts acfgjkmnpqru opt; do + while getopts acfmpru opt; do case $opt in a)all;; c)clean;; f)fast;; - g)gall;; - j)userjs;; - k)kg;; m)misc;; - n)ncm;; p)pac;; - q)qb;; r)refl;; u)usb;; \?)exit 1;; esac done fi - -printf '%s' "$log" +[ "$log" ] && printf '%s' "$log" | tee "$XDG_DOCUMENTS_DIR/logs/upd.log" diff --git a/home/xyz/.local/bin/wh b/home/xyz/.local/bin/wh index 4206c363..d20f0de6 100755 --- a/home/xyz/.local/bin/wh +++ b/home/xyz/.local/bin/wh @@ -8,4 +8,4 @@ sgr0="$(tput sgr0)" for cmd in type whatis whereis which "pacman -Qo --color always"; do printf '\n%s\n%s\n' "$setaf$cmd $*$sgr0" "$($cmd "$@" 2>&1)" #printf '\n\033[0;34m%s\033[0m\n%s\n' "$setaf$cmd $*$sgr0" "$($cmd "$@" 2>&1)" -done | $PAGER +done | "$PAGER" diff --git a/home/xyz/.profile b/home/xyz/.profile index f2cc4d20..b4dd4240 100644 --- a/home/xyz/.profile +++ b/home/xyz/.profile @@ -3,6 +3,7 @@ export XDG_CONFIG_HOME="$HOME/.config/" export XDG_CACHE_HOME="$HOME/.cache/" export XDG_DATA_HOME="$HOME/.local/share/" +export XDG_STATE_HOME="$HOME/.local/state/" . "$XDG_CONFIG_HOME/user-dirs.dirs" export XDG_DESKTOP_DIR @@ -18,72 +19,43 @@ PATH="$(find "$HOME/.local/bin" -type d -exec printf '%s:' '{}' \+)$PATH" export PATH export HISTSIZE=15000 export HISTFILESIZE=15000 +export HISTCONTROL=ignorespace +# sqlite uses VISUAL for the edit() SQL function default text editor +# https://sqlite.org/cli.html +export VISUAL=nvim export EDITOR=nvim -export BROWSER=firefox +export PAGER=less # -X seems can keep the output if exit less? # -F is useful when sdcv need user to manually select similar word, after selection if no -F less will not quit if one screen # but other situation seems less use -F as default? # steal from sdcv arch wiki -export PAGER=less +# CALCURSE_PAGER less can't use -F, else ? and > hotkey will only blink the text export LESS=-FRXi -export SDCV_PAGER="$PAGER" -export SDCV_HISTSIZE=10000 -# CALCURSE_PAGER less can't use -F, else ? and > hotkey will only blink the text -#export CALCURSE_PAGER=less -# not posix export MANPAGER='nvim +Man!' -export MANSECT='1p:1:n:l:8:3p:3:0p:0:2:5:4:9:6:7' +# This MANSECT prioritize POSIX manpages. After use it for a long time, I think it is not suitable for me any more. +#export MANSECT='1p:1:n:l:8:3p:3:0p:0:2:5:4:9:6:7' export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" export INPUTRC="$XDG_CONFIG_HOME/.inputrc" -#export QT_QPA_PLATFORMTHEME=qt5ct -#export QT_QPA_PLATFORMTHEME=gtk2 -export QT_QPA_PLATFORMTHEME=qt6ct -#export QT_STYLE_OVERRIDE=kvantum -#export SXHKD_SHELL=sh +# Thanks to https://github.com/trialuser02/qt6gtk2/pull/5 # enable color for `tree` command, not forced export CLICOLOR=1 # for pacdiff, without using aur neovim-drop-in or neovim-symlinks export DIFFPROG='nvim -d' export MAKEFLAGS="-j$(nproc --all)" -export DOTREMINDERS="$HOME/programs/reminders/.reminders" -export GTK_IM_MODULE=fcitx -export QT_IM_MODULE=fcitx -export XMODIFIERS=@im=fcitx # use sudo find for some files or dirs that has no permission ex: ~/.cache/paru/clone/ #export FZF_DEFAULT_COMMAND="fd --no-ignore --hidden --exclude .git" #export FZF_CTRL_T_COMMAND="fd --absolute-path --no-ignore --hidden --exclude .git" #export FZF_ALT_C_COMMAND="fd --no-ignore --hidden --type d --exclude .git" -export FZF_DEFAULT_COMMAND="sudo find . -mindepth 1 -path '*/\.git' -prune -o -print" +export FZF_DEFAULT_COMMAND="find . -mindepth 1 -path '*/\.git' -prune -o -print" # https://askubuntu.com/questions/444551/get-absolute-path-of-files-using-find-command # following two lines if use "" on the outermost, will not perfom expected, not sure why -export FZF_CTRL_T_COMMAND='sudo find "$PWD" -mindepth 1 -path "*/\.git" -prune -o -print' +export FZF_CTRL_T_COMMAND='find "$PWD" -mindepth 1 -path "*/\.git" -prune -o -print' #export FZF_CTRL_T_COMMAND='sudo find "$(pwd)" -path "*/\.git" -prune -o -print' # ~+ is bashism #export FZF_CTRL_T_COMMAND="sudo find ~+ -path '*/\.git' -prune -o -print" -export FZF_ALT_C_COMMAND="sudo find . -mindepth 1 -path '*/\.git' -prune -o -type d -print" - -export SCR_WIDTH=1600 -export SCR_HEIGHT=900 - -# for clipmenu -# set clipmenud to store clipboard only, don't store selection (primary) -#export CM_SELECTIONS="clipboard" -# X11, copy / close program / paste to another program, if 0 will paste nothing -#export CM_OWN_CLIPBOARD=1 -#export CM_MAX_CLIPS=8 - -# GDK_SCALE and GDK_DPI_SCALE should be use at the same time -# more see bookmarks about dpi -# not sure if correct -#export GDK_SCALE=1.36 -#export GDK_DPI_SCALE=0.73 -# correct but not sure if fits me -#export GDK_SCALE=2 -#export GDK_DPI_SCALE=0.5 - -playerctld daemon +export FZF_ALT_C_COMMAND="find . -mindepth 1 -path '*/\.git' -prune -o -type d -print" # must source .bashrc after export _ZO_ECHO=1 and INPUTRC=..., else these two env will has no effect, don't know why # here `. ~/.bashrc` same as `source ~/.bashrc`, see `source filename` in `man bash`, and `. file` in `man dash` @@ -91,9 +63,3 @@ playerctld daemon # https://github.com/koalaman/shellcheck/wiki/SC3046 #[[ -f ~/.bashrc ]] && . ~/.bashrc [ -f "$HOME/.bashrc" ] && . "$HOME/.bashrc" - -# startx when login, should be put after environmental variables for .xinitrc to use -# use `[ "$XDG_VTNR" ]` to avoid "-bash: [: : integer expression expected" warning/error message, when `sudo su - xyz` or ssh into a remote server, not sure if best practice or not -#if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then -# exec startx -#fi |