From 470384ac206eb865582976e3508275bd705d104e Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 24 Oct 2021 02:44:58 +0200 Subject: [PATCH] Modify several files --- general/.aliases | 108 +++++++++++++++--- general/.config/alacritty/alacritty.yml | 59 ++++++---- general/.config/git/config | 104 ++++++++++------- general/.config/sxhkd/sxhkdrc | 4 +- general/.config/tmux/tmux.conf | 146 ++++++++++-------------- laptop/.aliases.laptop | 14 ++- laptop/.config/xmobar/xmobarrc | 2 +- 7 files changed, 267 insertions(+), 170 deletions(-) diff --git a/general/.aliases b/general/.aliases index 8a4b4fd..b0f161b 100755 --- a/general/.aliases +++ b/general/.aliases @@ -3,14 +3,16 @@ # When using zsh, see also # $HOME/.oh-my-zsh/lib -export SCREENSHOT_DIR='$HOME/pictures/screenshots' +export SCREENSHOT_DIR="$HOME/pictures/screenshots" # ░█▀▀░█░█░▀█▀░░░█▀▀░█▀█░█▀▀░▀█▀░█░█░█▀█░█▀▄░█▀▀ # ░█▀▀░▄▀▄░░█░░░░▀▀█░█░█░█▀▀░░█░░█▄█░█▀█░█▀▄░█▀▀ # ░▀▀▀░▀░▀░░▀░░░░▀▀▀░▀▀▀░▀░░░░▀░░▀░▀░▀░▀░▀░▀░▀▀▀ +# Music player alias m="ncmpcpp" +# Text editor if command -v nvim &> /dev/null; then alias vim="nvim" alias vi="nvim" @@ -23,17 +25,22 @@ elif command -v vi &> /dev/null; then else echo -e "\033[31m[ERROR] No vim program found on the system! Couldn't bind aliases!\033[0m" fi + +alias openfile='$HOME/.scripts/rofi/config-selector.py | xargs nvim' +# IPython if command -v ipython &> /dev/null; then alias p="ipython" fi +# YouTube-dl if command -v youtube-dl &> /dev/null; then alias youtube-dl-list='youtube-dl -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio" -o "%(playlist_index)s-%(title)s.%(ext)s"' alias music-dl='youtube-dl --extract-audio -f "bestaudio[ext=m4a]/best"' alias music-dl-list='youtube-dl --extract-audio -f "bestaudio[ext=m4a]/best" -o "%(playlist_index)s-%(title)s.%(ext)s"' fi +# Screenshots if command -v maim &> /dev/null; then alias skusho='maim --hidecursor --nokeyboard $(echo $SCREENSHOT_DIR)/$(date +%s).png' @@ -42,37 +49,108 @@ if command -v maim &> /dev/null; then fi fi -if command -v rsync &> /dev/null; then - alias ccp='/usr/bin/cp' - alias cp='rsync --progress --human-readable' - alias cpr='rsync --progress --human-readable --recursive' -fi - -if command -v bat &> /dev/null; then - alias ccat='/usr/bin/cat' - alias cat='bat' -fi - +# Scan listening ports if command -v netstat &> /dev/null; then alias ports='sudo netstat -tulpn | grep LISTEN' fi +# Latex Make if command -v latexmk &> /dev/null; then alias view-latex='latexmk -pdf -pvc main.tex' fi -# alias tangle-doom-emacs='cd $HOME/.doom.d && $HOME/.emacs.d/bin/org-tangle config.org && cd -' +# Tmux reload +if command -v tmux &> /dev/null; then + alias reload-tmux='tmux source $HOME/.config/tmux/tmux.conf' +fi +# Ag replacement +if command -v rg &> /dev/null; then + alias ag='rg' +fi + +# Xmonad recompilation if command -v xmonad &> /dev/null; then alias xr='xmonad --recompile' - alias xmr='paru -S xmobar-git --noconfirm' alias xxmr='xr; xmr' fi if [[ -f $HOME/.scripts/dropbox.py ]]; then alias dp="python $HOME/.scripts/dropbox.py" - alias openfile='$HOME/.scripts/rofi/config-selector.py | xargs nvim' +fi + +# ------------------------ System tools ------------------------ # + +# cp +if command -v z &> /dev/null; then + alias cd='z' +fi + +# cp +if command -v rsync &> /dev/null; then + alias ccp='/usr/bin/cp' + alias cp='rsync --progress --human-readable' + alias cpr='rsync --progress --human-readable --recursive' +fi + +# cat +if command -v bat &> /dev/null; then + alias ccat='/usr/bin/cat' + # TODO: use mdcat if the file is a markdown file + alias cat='bat' +fi + +# htop +if command -v bottom &> /dev/null; then + alias htop='bottom' +fi + +# ps +if command -v procs &> /dev/null; then + alias ps='procs' +fi + +# find +if command -v fd &> /dev/null; then + # At the current time, fd does not support the -m flag, which I have + # experienced that some software rely on. Therefore, it's gonna be aliased + # to fin + alias fin='fd' +fi + +# xxd +if command -v hex &> /dev/null; then + alias xxd='hex' +fi + +# uniq +if command -v runiq &> /dev/null; then + alias uniq='runiq' +fi + +# cut +if command -v hck &> /dev/null; then + alias cut='hck' +fi + +# ------------------------ Reminders ------------------------ # + +# compression decompression +if command -v ouch &> /dev/null; then + alias zip='echo "Consider using ouch instead\n"; zip' + alias unzip='echo "Consider using ouch instead\n"; unzip' + alias tar='echo "Consider using ouch instead\n"; tar' +fi + +# Make tool +if command -v just &> /dev/null; then + alias make='echo "Consider using just instead\n"; make' +fi + +# Disk usage viewer +if command -v diskonaut &> /dev/null; then + alias ncdu='echo "Consider using diskonaut instead\n"; ncdu' fi # ░█▀▀░█▀█░█░░░█▀█░█▀▄ diff --git a/general/.config/alacritty/alacritty.yml b/general/.config/alacritty/alacritty.yml index 242f317..d7115a8 100644 --- a/general/.config/alacritty/alacritty.yml +++ b/general/.config/alacritty/alacritty.yml @@ -128,37 +128,55 @@ draw_bold_text_with_bright_colors: false colors: # Default colours primary: + + # MONOKAI background: '0x272822' foreground: '0xf8f8f2' + # PAPER + # background: '0xf2e3bd' + # foreground: '0x2f343f' + # Colors that should be used to draw the terminal cursor. If these are unset, # the cursor colour will be the inverse of the cell colour. + # cursor: # text: '0x2e2e2d' - # # text: '0x000000' - # cursor: '0xffffff' + # text: '0x000000' + # cursor: '#20fccf' # Normal colors normal: - black: '0x272822' - red: '0xf92672' - green: '0xa6e22e' - yellow: '0xf4bf75' - blue: '0x66d9ef' - magenta: '0xae81ff' - cyan: '0xa1efe4' - white: '0xf8f8f2' + # MONOKAI + black: '#272822' + red: '#f92672' + green: '#a6e22e' + yellow: '#f4bf75' + blue: '#66d9ef' + magenta: '#ae81ff' + cyan: '#a1efe4' + white: '#f8f8f2' + + # PAPER + # black: '#222222' + # red: '#C30771' + # green: '#10A778' + # yellow: '#A89C14' + # blue: '#008ec4' + # magenta: '#523C79' + # cyan: '#20A5BA' + # white: '#f7f3ee' # Bright colors - bright: - black: '0x75715e' - red: '0xf92672' - green: '0xa6e22e' - yellow: '0xf4bf75' - blue: '0x66d9ef' - magenta: '0xae81ff' - cyan: '0xa1efe4' - white: '0xf8f8f5' + # bright: + # black: '#303030' + # red: '#E32791' + # green: '#5FD7A7' + # yellow: '#F3E430' + # blue: '#B6D6FD' + # magenta: '#6855DE' + # cyan: '#4FB8CC' + # white: '#f7f3ee' # Dim colors (Optional) # dim: @@ -211,7 +229,7 @@ colors: # indexed_colors: [] # Visual Bell -# + # Any time the BEL code is received, Alacritty "rings" the visual bell. Once # rung, the terminal background will be set to white and transition back to the # default background color. You can control the rate of this transition by @@ -463,6 +481,7 @@ cursor: # - _ Underline # - | Beam style: Block + blinking: On # If this is `true`, the cursor will be rendered as a hollow box when the # window is not focused. diff --git a/general/.config/git/config b/general/.config/git/config index 835f415..55de107 100644 --- a/general/.config/git/config +++ b/general/.config/git/config @@ -2,29 +2,9 @@ name = h7x4 email = h7x4abk3g@protonmail.com -[init] - defaultBranch = main - -[alias] - aliases = !git config --get-regexp alias | sed -re 's/alias\\.(\\S*)\\s(.*)$/\\1 = \\2/g' - uncommit = "reset --soft HEAD^" - rev = "checkout HEAD -- " - revall = "checkout ." - unadd = "rm --cached " - delete-merged = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" - - mkbr = "checkout -b" - mvbr = "branch -m" - rmbr = "branch -d" - rrmbr = "push origin --delete" - - graph = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all" - graphv = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all" - g = !"git graph" - [core] - excludesfile = ~/.gitignore - attributesfile = ~/.gitattributes + excludesfile = ~/.config/git/ignore + attributesfile = ~/.config/git/attributes # Treat spaces before tabs and all kinds of trailing whitespace as an error. # [default] trailing-space: looks for spaces at the end of a line @@ -37,29 +17,60 @@ editor = nvim pager = less +[alias] + aliases = !git config --get-regexp alias | sed -re 's/alias\\.(\\S*)\\s(.*)$/\\1 = \\2/g' + uncommit = "reset --soft HEAD^" + rev = "checkout HEAD -- " + revall = "checkout ." + ; unstage = "rm --cached " + unstage = "restore --staged " + delete-merged = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" + + mkbr = "checkout -b" + mvbr = "branch -m" + rmbr = "branch -d" + rrmbr = "push origin --delete" + + graph = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all" + graphv = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all" + g = !"git graph" + +# Colors + +[color "branch"] + upstream = cyan + [color] ui = auto -[github] - user = h7x4abk3g +# Commands -[filter "lfs"] - required = true - smudge = git-lfs smudge -- %f - process = git-lfs filter-process - clean = git-lfs clean -- %f +[init] + defaultBranch = main + +[fetch] + prune = true + +[pull] + rebase = true + +[push] + default = current + +[merge] + tool = nvimdiff + conflictstyle = diff3 + colorMoved = zebra + +[mergetool] + keepBackup = false +[mergetool "nvimdiff"] + cmd = "nvim -d $BASE $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'" [diff] mnemonicPrefix = true renames=true tool = nvimdiff -[merge] - tool = nvimdiff - conflictstyle = diff3 -[mergetool] - keepBackup = false -[mergetool "nvimdiff"] - cmd = "nvim -d $BASE $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'" [grep] break = true @@ -67,7 +78,14 @@ lineNumber = true extendedRegexp = true -# URL Stuff +[instaweb] + local = true + port = 9876 + +# Upstream + +[github] + user = h7x4abk3g [url "git@github.com:"] insteadOf = "gh:" @@ -95,6 +113,12 @@ pushInsteadOf = "ntnu:" pushInsteadOf = "git://gitlab.stud.idi.ntnu.no/" -# Colors -[color "branch"] - upstream = cyan +# Misc +[web] + browser = google-chrome-stable + +[filter "lfs"] + required = true + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + clean = git-lfs clean -- %f diff --git a/general/.config/sxhkd/sxhkdrc b/general/.config/sxhkd/sxhkdrc index 73e11f0..00ff7a1 100644 --- a/general/.config/sxhkd/sxhkdrc +++ b/general/.config/sxhkd/sxhkdrc @@ -48,10 +48,10 @@ XF86MonBrightnessDown light -U 5 @Print - skushoclip + maim --hidecursor --nokeyboard --select | xclip -selection clipboard -target image/png -in shift + @Print - skusho + maim --hidecursor --nokeyboard $SCREENSHOT_DIR/$(date +%s).png super + @Print boomer diff --git a/general/.config/tmux/tmux.conf b/general/.config/tmux/tmux.conf index c23459a..ba7a1b9 100644 --- a/general/.config/tmux/tmux.conf +++ b/general/.config/tmux/tmux.conf @@ -1,58 +1,8 @@ -# remap prefix from 'C-b' to 'C-a' -unbind C-b -set-option -g prefix C-a -bind-key C-a send-prefix - -# Split panes using gh -bind h split-window -h -c "#{pane_current_path}" -bind g split-window -v -c "#{pane_current_path}" -unbind '"' # Unbind default vertical split -unbind % # Unbind default horizontal split - -# Reload config -unbind r -bind r \ - source-file $XDG_CONFIG_HOME/tmux/tmux.conf\;\ - display-message 'Reloaded tmux.conf' - -# Switch panes using Alt-hjkl without prefix -bind -n C-h select-pane -L -bind -n C-j select-pane -D -bind -n C-k select-pane -U -bind -n C-l select-pane -R - -# Resize pane - bind -n M-H resize-pane -L 5 - bind -n M-J resize-pane -D 5 - bind -n M-K resize-pane -U 5 - bind -n M-L resize-pane -R 5 - -# Fullscreen current pane -unbind z -bind M-z resize-pane -Z - -unbind & -bind BSpace killp - -# Swap clock-mode and new-window -unbind c -unbind t -bind c clock-mode -bind t new-window - - # Setup 'y' to yank (copy) -bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy" -bind-key -T copy-mode-vi 'V' send -X select-line -bind-key -T copy-mode-vi 'r' send -X rectangle-toggle - - - -# OTHER SETTINGS - # Don't rename windows automatically after rename with ',' set-option -g allow-rename off set -g mouse on +set -q -g status-utf8 on setw -q -g utf8 on # setw -g mode-keys vi set-option -g default-terminal screen-256color @@ -68,6 +18,60 @@ set -g status-right-length 150 set -g base-index 1 set -g pane-base-index 0 +###################### +######## KEYS ######## +###################### + +# Remap prefix from 'C-b' to 'C-a' +# Comments will use '$P' as prefix +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# Split panes using $P-[gh] +bind h split-window -h -c "#{pane_current_path}" +bind g split-window -v -c "#{pane_current_path}" +unbind '"' # Unbind default vertical split +unbind % # Unbind default horizontal split + +# Reload config using $P-r +unbind r +bind r \ + source-file $XDG_CONFIG_HOME/tmux/tmux.conf\;\ + display-message 'Reloaded tmux.conf' + +# Switch panes using Alt-[hjkl] +bind -n C-h select-pane -L +bind -n C-j select-pane -D +bind -n C-k select-pane -U +bind -n C-l select-pane -R + +# Resize pane using Alt-Shift-[hjkl] + bind -n M-H resize-pane -L 5 + bind -n M-J resize-pane -D 5 + bind -n M-K resize-pane -U 5 + bind -n M-L resize-pane -R 5 + +# Fullscreen current pane using $P-Alt-z +unbind z +bind M-z resize-pane -Z + +# Kill pane using $P-Backspace +unbind & +bind BSpace killp + +# Swap clock-mode and new-window +# New tab: $P-t +# Clock mode: $P-c +unbind c +unbind t +bind c clock-mode +bind t new-window + + # Setup 'y' to yank (copy) +bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy" +bind-key -T copy-mode-vi 'V' send -X select-line +bind-key -T copy-mode-vi 'r' send -X rectangle-toggle ###################### ### DESIGN CHANGES ### @@ -79,8 +83,6 @@ set-window-option -g window-status-current-style fg=magenta set-option -g status-style 'bg=black fg=default' set-option -g default-shell '/bin/zsh' -#OTHER DESIGN CHANGES - set -g status-position bottom set -g status-interval 4 set -g status-justify centre # center align window list @@ -89,39 +91,11 @@ setw -g status-bg default setw -g window-status-format '#[bg=#888888]#[fg=black,bold] #I #[bg=default] #[fg=#888888]#W ' setw -g window-status-current-format '#[fg=black,bold]#[bg=cyan] #I #[fg=cyan]#[bg=default] #W ' -# # loud or quiet? -# set -g visual-activity off -# set -g visual-bell off -# set -g visual-silence off -# setw -g monitor-activity off -# set -g bell-action none +####################### +####### PLUGINS ####### +####################### -# # modes -# setw -g clock-mode-colour colour5 -# setw -g mode-style 'fg=colour1 bg=colour18 bold' - -# # panes -# set -g pane-border-style 'fg=colour8 bg=colour0' -# set -g pane-active-border-style 'bg=colour0 fg=colour2' - -# # statusbar -# set -g status-position bottom -# set -g status-justify left -# set -g status-style 'bg=color2 fg=colour2 dim' -# set -g status-left '' -# set -g status-right '#[fg=colour233,bg=colour19] %d/%m #[fg=colour233,bg=colour8] %H:%M:%S ' -# set -g status-right-length 50 -# set -g status-left-length 20 - -# setw -g window-status-current-style 'fg=colour2 bg=colourbackground bold' -# setw -g window-status-current-format ' #I#[fg=colour2]:#[fg=colour2]#W#[fg=colour2]#F ' - -# setw -g window-status-style 'fg=colour8 bg=colour18' -# setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' - -# setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold' - -# # messages -# set -g message-style 'fg=colour232 bg=colour16 bold' +# tmux-thumbs - rewrite of tmux-fingers, copy pasting using hints +run-shell $HOME/.config/tmux/plugins/tmux-thumbs/tmux-thumbs.tmux # vim: filetype=.tmux.conf: diff --git a/laptop/.aliases.laptop b/laptop/.aliases.laptop index 98771f7..5724713 100644 --- a/laptop/.aliases.laptop +++ b/laptop/.aliases.laptop @@ -4,10 +4,12 @@ # alias disable-touch="xinput set-prop 16 'Device Enabled' 0" # alias enable-touch ="xinput set-prop 16 'Device Enabled' 1" -alias turnOffScreenHDMI="xrandr --output DP-3 --off" -alias doubleScreenHDMI="xrandr --output DP-3 --mode 1920x1080" -alias extendScreenHDMI="xrandr --output DP-3 --mode 1920x1080 --right-of eDP-1" +alias updateWallpaper="feh --bg-fill $HOME/Dropbox/bilder/Wallpapers/pixiv/80242900_p0.jpg" -alias turnOffScreenUSBC="xrandr --output DP-1 --off" -alias doubleScreenUSBC="xrandr --output DP-1 --mode 1920x1080" -alias extendScreenUSBC="xrandr --output DP-1 --mode 1920x1080 --right-of eDP-1" +alias turnOffScreenHDMI="xrandr --output DP-3 --off && updateWallpaper" +alias doubleScreenHDMI="xrandr --output DP-3 --mode 1920x1080 && updateWallpaper" +alias extendScreenHDMI="xrandr --output DP-3 --mode 1920x1080 --right-of eDP-1 && updateWallpaper" + +alias turnOffScreenUSBC="xrandr --output DP-1 --off && updateWallpaper" +alias doubleScreenUSBC="xrandr --output DP-1 --mode 1920x1080 && updateWallpaper" +alias extendScreenUSBC="xrandr --output DP-1 --mode 1920x1080 --right-of eDP-1 && updateWallpaper" diff --git a/laptop/.config/xmobar/xmobarrc b/laptop/.config/xmobar/xmobarrc index a50c626..b1b7453 100644 --- a/laptop/.config/xmobar/xmobarrc +++ b/laptop/.config/xmobar/xmobarrc @@ -44,7 +44,7 @@ Config { Run Memory ["-t","%"] 10, Run Swap ["-t", "%"] 100, - Run Date "%a %_d %b %H:%M" "date" 10, + Run Date "%a %_d %b - %H:%M - W%W" "date" 10, Run Com "/home/h7x4/.config/xmobar/scripts/mpd_status.sh" [] "mpc" 10, -- Run Com "/home/h7x4/.config/xmobar/scripts/wireless.sh" [] "wi" 100, Run Com "/home/h7x4/.config/xmobar/scripts/volume.py" [] "vol" 10,