diff --git a/config/.Xresources b/config/.Xresources index d60c7b3..6287508 100644 --- a/config/.Xresources +++ b/config/.Xresources @@ -1,36 +1,37 @@ ! special -*.foreground: #f1ebeb +*.foreground: #f8f8f2 *.background: #272822 -*.cursorColor: #f1ebeb +*.cursorColor: #f8f8f2 ! black -*.color0: #48483e -*.color8: #76715e +*.color0: #272822 +*.color8: #75715e ! red -*.color1: #dc2566 -*.color9: #fa2772 +*.color1: #f92672 +*.color9: #f92672 ! green -*.color2: #8fc029 -*.color10: #a7e22e +*.color2: #a6e22e +*.color10: #a6e22e ! yellow -*.color3: #d4c96e -*.color11: #e7db75 +*.color3: #f4bf75 +*.color11: #f4bf75 ! blue -*.color4: #55bcce -*.color12: #66d9ee +*.color4: #66d9ef +*.color12: #66d9ef ! magenta -*.color5: #9358fe -*.color13: #ae82ff +*.color5: #ae81ff +*.color13: #ae81ff ! cyan -*.color6: #56b7a5 -*.color14: #66efd5 +*.color6: #a1efe4 +*.color14: #a1efe4 ! white -*.color7: #acada1 -*.color15: #cfd0c2 +*.color7: #f8f8f2 +*.color15: #f9f8f5 + diff --git a/config/.config/i3/config b/config/.config/i3/config index 1f371b5..f3341cd 100644 --- a/config/.config/i3/config +++ b/config/.config/i3/config @@ -121,13 +121,13 @@ for_window [instance="^sun-awt-X11-XDialogPeer$" title="^Complete Installation$" ############################################################################### exec --no-startup-id setxkbmap us,de +exec --no-startup-id setxkbmap -option ctrl:swapcaps exec --no-startup-id nitrogen --restore; compton -b exec --no-startup-id nextcloud exec --no-startup-id emacs --daemon exec --no-startup-id udiskie exec --no-startup-id polybar beep -r exec --no-startup-id polybar boop -r -exec --no-startup-id setxkbmap -option "ctrl:swapcaps" exec --no-startup-id nm-applet exec --no-startup-id xss-lock -- python ~/.scripts/i3lock.py @@ -154,11 +154,15 @@ bindsym XF86MonBrightnessDown exec "xbacklight -dec 10; notify-send 'brightness bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle -bindsym XF86AudioPlay exec "if [ `cat /home/$USER/.scripts/playstate` = 0 ]; then echo '1'>/home/$USER/.scripts/playstate;else echo '0'>/home/$USER/.scripts/playstate;fi" -bindsym XF86AudioStop exec "playerctl stop && echo '0'>/home/$USER/.scripts/playstate" +# bindsym XF86AudioPlay exec "if [ `cat /home/$USER/.scripts/playstate` = 0 ]; then echo '1'>/home/$USER/.scripts/playstate;else echo '0'>/home/$USER/.scripts/playstate;fi" +# bindsym XF86AudioStop exec "playerctl stop && echo '0'>/home/$USER/.scripts/playstate" +bindsym XF86AudioPlay exec "playerctl play-pause; cmus-remote -u" +bindsym XF86AudioStop exec "playerctl stop; cmus-remote -s" +bindsym XF86AudioNext exec "playerctl next; cmus-remote -n" +bindsym XF86AudioPrevious exec "playerctl previous; cmus-remote -r" # Application Shortcuts -bindsym $mod+b exec firefox +bindsym $mod+b exec env GTK_THEME=Materia:dark firefox bindsym $mod+e exec source ~/.zshrc && termite -e 'ranger' bindsym $mod+m exec thunderbird diff --git a/config/.config/polybar/config b/config/.config/polybar/config index 9e380fb..a990497 100644 --- a/config/.config/polybar/config +++ b/config/.config/polybar/config @@ -35,9 +35,9 @@ font-1 = unifont:fontformat=truetype:size=8:antialias=false;0 font-2 = siji:pixelsize=10;1 font-3 = FontAwesome:style=Regular:pixelsize=10 -modules-left = spotify -modules-center = spotify-prev spotify-play spotify-stop spotify-next -modules-right = xkeyboard volume xbacklight wlan eth battery1 date +modules-left = volume xkeyboard +modules-center = date +modules-right = cursor-click = pointer cursor-scroll = ns-resize @@ -72,7 +72,7 @@ font-3 = FontAwesome:style=Regular:pixelsize=10 modules-left = airvpn modules-center = i3 -modules-right = powermenu +modules-right = xbacklight wlan eth battery1 powermenu cursor-click = pointer cursor-scroll = ns-resize diff --git a/config/.config/ranger/rc.conf b/config/.config/ranger/rc.conf index 2999a46..3571db9 100644 --- a/config/.config/ranger/rc.conf +++ b/config/.config/ranger/rc.conf @@ -4,3 +4,6 @@ set vcs_aware true map f console scout -ftsea%space map gg console mkdir%space map np shell cp -r ~/Templates/LaTeX/Protokoll $(date +%g.%m.%%d) +map ny shell cp %f ../Protokoll_$(echo $(basename $(pwd)) | awk '{gsub("\\.","-");print}' $2).pdf +map nr shell cp ~/Templates/LaTeX/Invoice/invoice.tex Gefeba_Engineering_-_Rechnung_$(date +%g.%m)_-Elektro-1.tex + diff --git a/config/.config/termite/config b/config/.config/termite/config index 8853219..8b9ca72 100644 --- a/config/.config/termite/config +++ b/config/.config/termite/config @@ -22,9 +22,8 @@ hyperlinks = true # "system", "on" or "off" cursor_blink = system - # "block", "underline" or "ibeam" -cursor_shape = ibeam +cursor_shape = block # Hide links that are no longer valid in url select overlay mode #filter_unmatched_urls = true @@ -42,39 +41,40 @@ scrollbar = off [colors] # special -foreground = #f1ebeb -foreground_bold = #f1ebeb -cursor = #f1ebeb +foreground = #f8f8f2 +foreground_bold = #f8f8f2 +cursor = #f8f8f2 background = #272822 # black -color0 = #48483e -color8 = #76715e +color0 = #272822 +color8 = #75715e # red -color1 = #dc2566 -color9 = #fa2772 +color1 = #f92672 +color9 = #f92672 # green -color2 = #8fc029 -color10 = #a7e22e +color2 = #a6e22e +color10 = #a6e22e # yellow -color3 = #d4c96e -color11 = #e7db75 +color3 = #f4bf75 +color11 = #f4bf75 # blue -color4 = #55bcce -color12 = #66d9ee +color4 = #66d9ef +color12 = #66d9ef # magenta -color5 = #9358fe -color13 = #ae82ff +color5 = #ae81ff +color13 = #ae81ff # cyan -color6 = #56b7a5 -color14 = #66efd5 +color6 = #a1efe4 +color14 = #a1efe4 # white -color7 = #acada1 -color15 = #cfd0c2 +color7 = #f8f8f2 +color15 = #f9f8f5 + diff --git a/config/.scripts/i3lock.py b/config/.scripts/i3lock.py index f5614d2..f39be20 100755 --- a/config/.scripts/i3lock.py +++ b/config/.scripts/i3lock.py @@ -66,8 +66,12 @@ def lock_config(): lock_date_pos = '--datepos="{}:{}"'.format(date_x, date_y) lock_date_size = '--datesize={}'.format(default_fontsize) date = "{} {}".format(lock_date_pos, lock_date_size) + # date color + datecolor = '--datecolor=777777ff' + timecolor = '--timecolor=777777ff' + color = '{} {}'.format(datecolor, timecolor) # done - datetime = "{} {}".format(l_time, date) + datetime = "{} {} {}".format(l_time, date, color) # Indicator config # Indicator inner diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 1d4e71c..2431a19 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -1,2 +1,3 @@ (package-initialize) (org-babel-load-file "~/.emacs.d/config.org") +(put 'upcase-region 'disabled nil) diff --git a/vim/.vimrc b/vim/.vimrc index f02b147..a04c2d5 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -4,35 +4,31 @@ filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() - Plugin 'VundleVim/Vundle.vim' - Plugin 'vim-pandoc/vim-pandoc' - Plugin 'vim-pandoc/vim-pandoc-syntax' - Plugin 'ledger/vim-ledger' - Plugin 'terryma/vim-multiple-cursors' - Plugin 'haya14busa/incsearch.vim' - Plugin 'esalter-va/vim-checklist' +Plugin 'VundleVim/Vundle.vim' +Plugin 'vim-pandoc/vim-pandoc' +Plugin 'vim-pandoc/vim-pandoc-syntax' +Plugin 'terryma/vim-multiple-cursors' call vundle#end() +" Filetypes +au BufNewFile,BufRead *.md set filetype=md +au BufNewFile,BufRead *.tex set filetype=tex +au BufNewFile,BufRead config set filetype=config " Functions -command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand() -function! s:RunShellCommand(cmdline) - echo a:cmdline - let expanded_cmdline = a:cmdline - for part in split(a:cmdline, ' ') - if part[0] =~ '\v[%#<]' - let expanded_part = fnameescape(expand(part)) - let expanded_cmdline = substitute(expanded_cmdline, part, expanded_part, '') - endif - endfor - botright new - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap - call setline(1, 'You entered: ' . a:cmdline) - call setline(2, 'Expanded Form: ' .expanded_cmdline) - call setline(3,substitute(getline(2),'.','=','g')) - execute '$read !'. expanded_cmdline - setlocal nomodifiable - 1 -endfunction + +" Arch defaults + +"" Move the swap file location to protect against CVE-2017-1000382 +if exists('$XDG_CACHE_HOME') + let &g:directory=$XDG_CACHE_HOME +else + let &g:directory=$HOME . '/.cache' +endif +let &g:directory.='/vim/swap//' +"" Create swap directory if it doesn't exist +if ! isdirectory(expand(&g:directory)) + silent! call mkdir(expand(&g:directory), 'p', 0700) +endif " Basics syntax on @@ -41,11 +37,12 @@ set encoding=utf-8 colorscheme monokai set autowrite set smartcase -set spelllang=en_gb,de_de - +set incsearch +set hlsearch +set nofoldenable " Line Numbers -set number -set relativenumber +"set number +"set relativenumber " Tab behavior set expandtab @@ -57,38 +54,57 @@ set softtabstop=4 set splitbelow set splitright - " Remaps -map / (incsearch-forward) -map ? (incsearch-backward) -map g/ (incsearch-stay) - nnoremap nnoremap nnoremap nnoremap +nmap 0 ^ + +" Latex +let g:tex_nospell=1 " Shortcuts -inoremap /c5l -vnoremap /c5l -map /c5l +map /c5l +inoremap /c5l +vnoremap /c5l inoremap ;; +imap jj +inoremap ;date =strftime("%Y/%m/%d") +inoremap ;time =strftime("%H:%M:%S") +" Diaeresis for e.g. german +inoremap "a ä +inoremap "o ö +inoremap "u ü +inoremap "A Ä +inoremap "U Ü +inoremap "O Ö +inoremap ;ss ß +inoremap ;euro € -"" Latex -autocmd FileType tex inoremap ;l \item -autocmd FileType tex inoremap ;beg \begin{}\end{}4k0:MultipleCursorsFindc -autocmd FileType tex inoremap ;sec \section{}2k -autocmd FileType tex inoremap ;ssec \subsection{}2k -autocmd FileType tex inoremap ;sssec \subsubsection{}2k -""" Compile to pdf and open it in evince -autocmd FileType tex map mx:silent !pdflatex % && evince %<.pdf &ggGG`x +" This callback will be executed when the entire command is completed +function! BackgroundCommandClose(channel) + " Read the output from the command into the quickfix window + unlet g:backgroundCommandOutput +endfunction -"" Ledger -autocmd FileType ledger inoremap ;a =strftime("%Y/%m/%d") * 3k0 -autocmd FileType ledger map b :! ledger -f % reg Brieftasche$ -autocmd FileType ledger map g :! ledger -f % reg Girokonto$ -autocmd FileType ledger map p :! ledger -f % reg PayPal$ +function! RunBackgroundCommand(command) + " Make sure we're running VIM version 8 or higher. + if v:version < 800 + echoerr 'RunBackgroundCommand requires VIM version 8 or higher' + return + endif + if exists('g:backgroundCommandOutput') + echo 'Already running task in background' + else + echo 'Running task in background' + " Launch the job. + " Notice that we're only capturing out, and not err here. This is because, for some reason, the callback + " will not actually get hit if we write err out to the same file. Not sure if I'm doing this wrong or? + let g:backgroundCommandOutput = tempname() + call job_start(a:command, {'close_cb': 'BackgroundCommandClose', 'out_io': 'file', 'out_name': g:backgroundCommandOutput}) + endif +endfunction + +" So we can use :BackgroundCommand to call our function. +command! -nargs=+ -complete=shellcmd RunBackgroundCommand call RunBackgroundCommand() -"" Markdown -autocmd FileType markdown,rmd map mx:silent !pandoc % --pdf-engine=xelatex -o %<.pdf && evince %<.pdf &ggGG`x -autocmd FileType markdown,rmd map t :ChecklistToggleCheckbox -autocmd FileType markdown,rmd inoremap ;h ---title: author: Tuan-Dat Tran0i---4k0 diff --git a/zsh/.zshrc b/zsh/.zshrc index d51b56f..0b7ee62 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -4,12 +4,9 @@ plugins=( git history sudo - wd - web-search ) ZSH_THEME="powerlevel9k/powerlevel9k" -HIST_STAMPS="yyyy.mm.dd" #POWERLEVEL POWERLEVEL9K_MODE='awesome-fontconfig' @@ -28,26 +25,32 @@ POWERLEVEL9K_TIME_FORMAT="%D{%H:%M:%S}" POWERLEVEL9k_SHORTEN_STRATEGY="trunctuate_middle" POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + # Alias +alias matrix="cmatrix" alias df="df -h" alias mkvirtenv="python -m virtualenv --system-site-packages" alias e="emacsclient -t" alias ek="pkill emacs" alias ej="emacs --daemon" alias nyan="nyancat" -alias rm="rm -i" -alias -s tex=e -alias -s cpp=e -alias -s org=e +alias rm="rm -I" +alias -s tex=vim +alias -s cpp=vim +alias -s org=vim alias diff="diff -s" -alias stunden="e $HOME/Nextcloud/Arbeit/Stundenzettel.org" -alias budget="e $HOME/Nextcloud/orgs/Budget/MyBudget.ledger" +alias stunden="et $HOME/Nextcloud/Arbeit/Stunden/Stundenzettel.xlsx &; disown %1;" +alias budget="emacs -nw $HOME/Nextcloud/orgs/Budget/MyBudget.ledger" alias vudget="vim $HOME/Nextcloud/orgs/Budget/MyBudget.ledger" alias q="exit" alias ranger='ranger --choosedir=$HOME/.rangerdir; LASTDIR=`cat $HOME/.rangerdir`; cd "$LASTDIR"' -alias steam='steam -silent %U' +alias steam='steam' alias vrc='vim ~/.vimrc' -alias erc='e ~/.emacs.d/config.org' +alias erc='emacs -nw ~/.emacs.d/config.org' +alias mp3='youtube-dl -x --audio-format mp3 -o "./%(title)s.%(ext)s"' +alias zrc='vim ~/.zshrc' +alias vpn_eu='sudo openvpn --config Downloads/AirVPN_Europe_UDP-443.ovpn' +alias vpn_us='sudo openvpn --config Downloads/AirVPN_America_UDP-443.ovpn' source $ZSH/oh-my-zsh.sh # Variables @@ -61,3 +64,6 @@ export VISUAL=$EDITOR export VISUAL_EDITOR=$EDITOR export STEAM_FRAME_FORCE_CLOSE=1 export HIGHLIGHT_DATADIR="~/.config/highlight/" +export GOPATH="$HOME/workspace/go/" + +# Functions