From c4be0fe3c58fe07e235f624974b4f8102a17ecca Mon Sep 17 00:00:00 2001 From: 0scar Date: Wed, 21 Oct 2020 17:51:56 +0200 Subject: Add some neat scripts --- .config/i3/config | 46 ++++----- .config/vimrc | 129 ------------------------- .config/xinitrc | 7 -- .config/zsh/.zshrc | 74 ++++++-------- .config/zsh/custom/themes/0undefined.zsh-theme | 3 +- 5 files changed, 54 insertions(+), 205 deletions(-) delete mode 100644 .config/vimrc delete mode 100644 .config/xinitrc (limited to '.config') diff --git a/.config/i3/config b/.config/i3/config index 37383e5..921de5d 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -13,27 +13,27 @@ set $down j set $up k set $right l -font pango: DejaVuSans Mono Nerd Font Mono 12 +font pango: DejaVuSansMono Nerd Font Mono 12 ### Output configuration # Default wallpaper (more resolutions are available in /usr/share/sway/) -exec_always feh --bg-scale $HOME/pictures/bg2.png +exec_always feh --no-fehbg --bg-scale $HOME/pictures/background.png # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod ### Key bindings # start a terminal - #bindsym $mod+Return exec $term -f "DejaVuSansMono Nerd Font Mono:pixelsize=16" bindsym $mod+Return exec $term - bindsym $mod+e exec urxvt -bg '[50]#000000' -g 220x40 -t float -e nnn + bindsym $mod+e exec $term -A 0.2 -g 120x40 -t float -e nnn bindsym $mod+Shift+Return exec $term -t float bindsym $mod+Shift+p exec $term -f ":pixelsize=24" bindsym $mod+Shift+o exec $term -f ":pixelsize=18" bindsym $mod+p exec feh -^ float_sticky -R 15 https://www.cafeen.org/test.php - bindsym Print exec import -window root -display :0 ~/scr.png && xclip -selection clip -t image/png ~/scr.png + bindsym Print exec import -window root -display :0 ~/screenshot.png && xclip -selection clip -t image/png ~/screenshot.png + bindsym $mod+z exec zathura bindsym $mod+c exec exec $term -title float -e fsharpi --consolecolors+ --nologo --use:.scripts/fsharpinit.fsx bindsym $mod+Shift+v exec exec $term -t float -e vim @@ -51,17 +51,18 @@ floating_modifier $mod bindsym XF86MonBrightnessUp exec brightnessctl s 10%+ # Volume control - bindsym XF86AudioLowerVolume exec pactl set-sink-volume $(pactl info | grep 'Default Sink' | sed -Ee 's/^.*: (.*)$/\1/g') -5% bindsym XF86AudioRaiseVolume exec pactl set-sink-volume $(pactl info | grep 'Default Sink' | sed -Ee 's/^.*: (.*)$/\1/g') +5% bindsym XF86AudioMute exec pactl set-sink-mute $(pactl info | grep 'Default Sink' | sed -Ee 's/^.*: (.*)$/\1/g') toggle + bindsym $mod+w exec notify-send 'Weather' "$(weather)" + bindsym $mod+c exec notify-send 'Calendar' "$(cal -wm)" + # Your preferred application launcher bindsym $mod+d exec dmenu_run -i -q -fn 'DejaVuSansMono Nerd Font Mono' -#bindsym $mod+d exec rofi -show run -theme Pop-Dark # Lock your computer -bindsym $mod+x exec i3lock -i $HOME/pictures/lock.png -t -f -e +bindsym $mod+x exec i3lock -c 000000 -i $HOME/pictures/lock.png -t -f -e # Drag floating windows by holding down $mod and left mouse button. # Resize them with right mouse button + $mod. @@ -189,8 +190,8 @@ bindsym $mod+v split v # change container layout (stacked, tabbed, toggle split) #bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+s layout toggle split +#bindsym $mod+w layout tabbed +#bindsym $mod+s layout toggle split # Make the current focus fullscreen bindsym $mod+f fullscreen toggle @@ -233,21 +234,22 @@ mode "resize" { # Pressing right will grow the window’s width. # Pressing up will shrink the window’s height. # Pressing down will grow the window’s height. - bindsym $left resize shrink width 10 px or 10 ppt - bindsym $down resize grow height 10 px or 10 ppt - bindsym $up resize shrink height 10 px or 10 ppt - bindsym $right resize grow width 10 px or 10 ppt + bindsym $left resize shrink width 10 px or 10 ppt + bindsym $down resize grow height 10 px or 10 ppt + bindsym $up resize shrink height 10 px or 10 ppt + bindsym $right resize grow width 10 px or 10 ppt # same bindings, but for the arrow keys - bindsym Left resize shrink width 2 px or 2 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 2 px or 2 ppt - bindsym Right resize grow width 10 px or 10 ppt + bindsym Left resize shrink width 2 px or 2 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 2 px or 2 ppt + bindsym Right resize grow width 10 px or 10 ppt + # Bigger resize - bindsym Shift+Left resize shrink width 20 px or 20 ppt - bindsym Shift+Down resize grow height 40 px or 40 ppt - bindsym Shift+Up resize shrink height 20 px or 20 ppt - bindsym Shift+Right resize grow width 20 px or 20 ppt + bindsym Shift+Left resize shrink width 20 px or 20 ppt + bindsym Shift+Down resize grow height 40 px or 40 ppt + bindsym Shift+Up resize shrink height 20 px or 20 ppt + bindsym Shift+Right resize grow width 20 px or 20 ppt # back to normal: Enter or Escape bindsym Return mode "default" diff --git a/.config/vimrc b/.config/vimrc deleted file mode 100644 index 63f8fe1..0000000 --- a/.config/vimrc +++ /dev/null @@ -1,129 +0,0 @@ -runtime! archlinux.vim -scriptencoding utf-8 - -" behaviour -set history=200 -set wildmenu -set ruler -set cursorline -set showmatch -set hlsearch -set nocompatible -set backspace=2 -set incsearch -set formatoptions+=tcroqn2bmj -"set formatoptions+=1cjmnoqrw -"set formatoptions+=2acjnoqrtw -set relativenumber -set number - -" Enable mouse support -set mouse=a - -" tabs -set expandtab -set tabstop=2 -set softtabstop=2 -set shiftwidth=2 -set smartindent -set textwidth=80 -set wrap - -" theme -syntax enable - -set background=dark -colorscheme jellybeans - -" Need to set runtimepath before calling pathogen -set runtimepath=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after - -" adding pathogen -execute pathogen#infect('bundle/{}') -filetype plugin indent on - -" encodings -set fileencoding=utf-8 -set encoding=utf-8 -set ffs=unix - -set viminfofile=${XDG_DATA_HOME:-$HOME/.local/share}/viminfo - -" some syntastics -"set listchars=space:·\,eol:¬ -set listchars= -set list - -set grepprg=grep\ -nH\ $* - -"set statusline+=%#warningmsg# -"set statusline+=%{SyntasticStatuslineFlag()} -"set statusline+=%* - -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 - -" filetypes -let g:syntastic_disabled_filetypes=['asm', 's', 'latex', 'tex'] - -let g:tex_flavor='latex' -let g:vimtex_view_method='zathura' -let g:vimtex_quickfix_mode=0 -set conceallevel=2 -let g:tex_conceal='abdmg' -"let g:syntastic_tex_checkers=['lacheck'] -let g:vimtex_compiler_method = 'latexrun' -let g:vimtex_compiler_latexrun = { - \ 'backend' : 'jobs', - \ 'background' : 1, - \ 'build_dir' : 'latex.out', - \ 'options' : [ - \ '-verbose-cmds', - \ '--latex-args="-synctex=1"', - \ ], - \} - -let g:latex_view_general_viewer = 'zathura' -let g:vimtex_view_method = 'zathura' - -function! Synctex() - " remove 'silent' for debugging - execute "silent !mv -u latex.out/" . bufname('%')[:-5] . ".synctex.gz ." - execute "silent !zathura --synctex-forward " . line('.') . ":" . col('.') . ":" . bufname('%') . " " . bufname('%')[:-5] . ".pdf" - redraw! -endfunction - -map :make -au BufNewFile,BufRead *.fo setlocal ft=fasto -au BufNewFile,BufRead /tmp/[a-zA-Z0-9]\+/ setlocal ft=sh - - -match ErrorMsg '\%>80v.\+' -match ErrorMsg ' \+$' -match ErrorMsg ' \+$' - -" Remove trailing cancer on write -autocmd BufWritePre * %s/\s\+$//e -autocmd BufWritePost *.tex !latexrun --bibtex-cmd="biber" --latex-args="-synctex=1" % -"autocmd BufWritePost *.tex !latexrun --latex-cmd xelatex % -"autocmd BufWritePost *.tex !latexrun --latex-cmd xelatex --bibtex-cmd biber % - -set makeprg=GCC_COLORS=\ make - -vnoremap // y/\V" - -map [1;5A -map [1;5B -map [1;5C -map [1;5D -map! [1;5A -map! [1;5B -map! [1;5C -map! [1;5D - -map [1;3C :tabnext -map [1;3D :tabprevious - -autocmd VimEnter * silent !echo -ne "\e[1 q" diff --git a/.config/xinitrc b/.config/xinitrc deleted file mode 100644 index e1c9c8a..0000000 --- a/.config/xinitrc +++ /dev/null @@ -1,7 +0,0 @@ -systemctl --user import-environment DISPLAY -feh --no-fehbg --bg-scale ~/pictures/bg2.png -# xrdb -m $XDEFAULTS -dunst & -xcompmgr & -# exec i3 -exec dwm diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index df2e863..ef77fcf 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,10 +1,11 @@ -# ~/.zshrc +# zshrc export GPG_TTY=$(tty) # If not running interactively, don't do anything [[ $- != *i* ]] && return +# Add [username@hostname] prefix to prompt when its ssh if [ "$TERM" = "linux" ]; then PROMPT='%(?..(%?%) )' [ -n "$SSH_CLIENT" ] && PROMPT+="[%n@%M] " @@ -25,7 +26,7 @@ CASE_SENSITIVE="true" DISABLE_AUTO_UPDATE="true" # Uncomment the following line to automatically update without prompting. -DISABLE_UPDATE_PROMPT="true" +DISABLE_UPDATE_PROMPT="false" # Uncomment the following line to change how often to auto-update (in days). export UPDATE_ZSH_DAYS=31 @@ -36,33 +37,6 @@ DISABLE_MAGIC_FUNCTIONS=true # Uncomment the following line to disable auto-setting terminal title. DISABLE_AUTO_TITLE="true" -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" - -# Uncomment the following line to display red dots whilst waiting for completion. -#COMPLETION_WAITING_DOTS="true" - -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -# DISABLE_UNTRACKED_FILES_DIRTY="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# You can set one of the optional three formats: -# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# or set a custom format using the strftime function format specifications, -# see 'man strftime' for details. -# HIST_STAMPS="mm/dd/yyyy" - -# Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder - -# Which plugins would you like to load? -# Standard plugins can be found in ~/.oh-my-zsh/plugins/* -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. #plugins=(git) source $ZSH/oh-my-zsh.sh @@ -91,12 +65,16 @@ setopt hist_reduce_blanks setopt no_share_history setopt no_histverify + autoload -Uz compinit compinit -d ~/.cache/zcompdump-$ZSH_VERSION - autoload -Uz promptinit promptinit +zstyle ':completion:*' menu select +zmodload zsh/complist + +bindkey -v export KEYTIMEOUT=1 set -o vi @@ -122,28 +100,32 @@ autoload -Uz edit-command-line zle -N edit-command-line bindkey -M vicmd ' ' edit-command-line +bindkey -v '^?' backward-delete-char + bindkey "^e" end-of-line bindkey "^a" beginning-of-line bindkey -M vicmd "^e" end-of-line bindkey -M vicmd "^a" beginning-of-line +bindkey "" beginning-of-line +bindkey "" end-of-line bindkey "${terminfo[khome]}" beginning-of-line bindkey "${terminfo[kend]}" end-of-line bindkey "^[[3~" delete-char bindkey "^[3;5~" delete-char +bindkey "^[[P" delete-char bindkey "^[[1;5C" forward-word bindkey "^[[1;5D" backward-word -autoload -U up-line-or-beginning-search -autoload -U down-line-or-beginning-search -zle -N up-line-or-beginning-search -zle -N down-line-or-beginning-search +autoload -U up-line-or-beginning-search +autoload -U down-line-or-beginning-search +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search bindkey "^[A" up-line-or-beginning-search -bindkey "^[OA" up-line-or-beginning-search bindkey "^[B" down-line-or-beginning-search +bindkey "^[OA" up-line-or-beginning-search bindkey "^[OB" down-line-or-beginning-search - ## Handy functions upload () { curl -F file=@${1} http://0x0.st @@ -196,6 +178,13 @@ calcgrade () { fi } +function screengrab() { + local OUT=screengrab.gif + local SIZE=$1 + local POS=$2 + ffmpeg -f x11grab -r 20 -s ${SIZE} -i :0.0+${POS} -r 20 out.gif +} + fr () { which futhark > /dev/null if [ ! -z $? ]; then @@ -206,9 +195,6 @@ fr () { ## Aliases alias :q='exit' -alias cgpu='sshpass -e ssh -l qgt268 ku-gpu' -alias fsharpi='fsharpi --nologo' -alias fsharpc='fsharpc --nologo --standalone' alias gdb='gdb -q' alias glog2="git log --graph --abbrev-commit --decorate --format=format:'%Cgreen%h%C(reset) [%G?] %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%Cred%d%C(reset)' --all" alias glog='git log --pretty="%Cgreen%H%Creset [%G?] %cn: %s %Cred%d%Creset"' @@ -216,19 +202,17 @@ alias ls='ls --color=auto' alias mutt='neomutt' alias pbcopy='xclip -selection clipboard -i' alias pbpaste='xclip -selection clipboard -o' -alias push='git push && mpg123 ~/Downloads/Mario-coin-sound.mp3' +alias push='git push && mpgv ~/downloads/mario_power_up.mp3' alias s='vim $(fzf)' alias scan='sudo iwlist wlp3s0 scan > /dev/null' alias v='echo -ne "\e[1 q" && vim --servername vim' -alias less='less -R' +alias ptop="ps -o pid,user,size,pcpu,command --sort size cx" ## Do before dropping into shell -source ~/.secrets/sshpass - BANNERFILE=~/.config/texts/todo.md if [[ $(tput cols) -gt 140 ]]; then - pr -mtW 140 $BANNERFILE ~/.config/texts/setsail + pr -mtW 140 $BANNERFILE ~/.config/texts/setsail else - cat $BANNERFILE + cat $BANNERFILE fi diff --git a/.config/zsh/custom/themes/0undefined.zsh-theme b/.config/zsh/custom/themes/0undefined.zsh-theme index 87257cc..8ea2a16 100644 --- a/.config/zsh/custom/themes/0undefined.zsh-theme +++ b/.config/zsh/custom/themes/0undefined.zsh-theme @@ -1,6 +1,5 @@ # vim: ft=zsh: ts=2: sts=2: expandtab append_if_nz() { - # echo " -- $1 --" if [[ "$1" == "0" || "$1" == "" ]]; then echo -n "" else @@ -19,7 +18,7 @@ git_status() { BRANCH=$(echo "$STATUS" | awk '/^# branch.head/{print $3}') AHEAD=$(append_if_nz "$(echo "$STATUS" | sed -n '/^# branch.ab/p' | sed -Ee 's/^.*\+([0-9]+).*/\1/g')" "\u2191") BEHIND=$(append_if_nz "$(echo "$STATUS" | sed -n '/^# branch.ab/p' | sed -Ee 's/^.*-([0-9]+).*/\1/g')" "\u2193") - STAGED=$(append_if_nz "$(echo "$STATUS" | sed -En '/^[0-9]+ (A|M). /p' | wc -l)" "+" "046") # green + STAGED=$(append_if_nz "$(echo "$STATUS" | sed -En '/^[0-9]+ (A|M|D). /p' | wc -l)" "+" "046") # green CONFLICT=$(append_if_nz "$(echo "$STATUS" | sed -En '/^u /p' | wc -l)" "!" "009") # red CHANGED=$(append_if_nz "$(echo "$STATUS" | sed -En '/^[0-9]+ .M /p' | wc -l)" "~" "081") # cyan RENAMED=$(append_if_nz "$(echo "$STATUS" | sed -En '/^[0-9]+ (R.|.R) /p' | wc -l)" "" "226") # YELLOW -- cgit v1.3