diff --git a/home/.Xresources b/home/.Xresources index 2a7e2209..3de97dab 100644 --- a/home/.Xresources +++ b/home/.Xresources @@ -4,21 +4,21 @@ *.cursorColor: #707880 *.color0: #1c2023 -*.color1: #a54242 -*.color2: #8c9440 -*.color3: #de935f -*.color4: #5f819d -*.color5: #85678f -*.color6: #5e8d87 +*.color1: #bf616a +*.color2: #a3be8c +*.color3: #ebcb8b +*.color4: #8fa1b3 +*.color5: #b48ead +*.color6: #96b5b4 *.color7: #E1E1E1 *.color8: #1c2023 -*.color9: #cc6666 -*.color10: #b5bd68 -*.color11: #f0c674 -*.color12: #81a2be -*.color13: #b294bb -*.color14: #8abeb7 -*.color15: #c5c8c6 +*.color9: #bf616a +*.color10: #a3be8c +*.color11: #ebcb8b +*.color12: #8fa1b3 +*.color13: #b48ead +*.color14: #96b5b4 +*.color15: #c0c5ce ! Rofi rofi.font: DejaVu Sans Mono 12 @@ -33,13 +33,13 @@ rofi.color-urgent: argb:00000000, #f43753, argb:00000000, argb:00000000, #e29a49 rofi.color-active: argb:00000000, #49bbfb, argb:00000000, argb:00000000, #e29a49 ! xterm +xterm*termName: xterm-256color xterm*font: DejaVu Sans Mono -xterm*faceName: DejaVu Sans Mono:size=11:antialias=false +xterm*faceName: DejaVu Sans Mono:size=11 xterm*loginShell: true xterm*vt100*geometry: 90x34 xterm*saveLines: 2000 xterm*charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48 -xterm*termName: xterm-256color xterm*eightBitInput: false ! URxvt @@ -62,7 +62,7 @@ URxvt.keysym.m-v: perl:clipboard:paste URxvt.urlLauncher: exo-open URxvt.underlineURLs: true URxvt.urlButton: 1 -URxvt.geometry: 90x30 +URxvt.geometry: 90x34 URxvt.tabbed.tabbar-fg: 4 URxvt.tabbed.tabbar-bg: 16 URxvt.tabbed.tab-fg: 15 @@ -72,9 +72,9 @@ URxvt*buffered: false ! UXTerm UXTerm*termName: xterm-256color UXTerm*cursorColor: white -UXTerm*VT100.geometry: 90x30 +UXTerm*VT100.geometry: 90x34 UXTerm*font: DejaVu Sans Mono -UXTerm*faceSize: 10 +UXTerm*faceSize: 11 UXTerm*dynamicColors: true UXTerm*utf8: 2 UXTerm*eightBitInput: true diff --git a/home/.config/bspwm/bspwmrc b/home/.config/bspwm/bspwmrc index b936ef57..793b9d12 100755 --- a/home/.config/bspwm/bspwmrc +++ b/home/.config/bspwm/bspwmrc @@ -12,9 +12,6 @@ nitrogen --restore & # launch compton al-compositor --start & -# panel -al-polybar-session & - # xfce settings xfsettingsd & @@ -28,6 +25,9 @@ gnome-keyring-daemon --start --components=pkcs11 & ksuperkey -e 'Super_L=Alt_L|F1' & ksuperkey -e 'Super_R=Alt_L|F1' & +# panel +al-polybar-session & + # Set some bsp specific stuff bspc monitor -d I II III IV V VI VII VIII IX X diff --git a/home/.config/i3/config b/home/.config/i3/config index 9e9002d8..2d81e438 100644 --- a/home/.config/i3/config +++ b/home/.config/i3/config @@ -28,7 +28,7 @@ gaps inner 15 gaps outer 5 # font -font pango:DejaVu Sans Mono 10 +font pango:DejaVu Sans Mono 11 # $Mod = Super or Alt? set $Mod Mod4 diff --git a/home/.config/openbox/autostart b/home/.config/openbox/autostart index e720d8cd..10739e28 100644 --- a/home/.config/openbox/autostart +++ b/home/.config/openbox/autostart @@ -17,17 +17,17 @@ ksuperkey -e 'Super_R=Alt_L|F1' & # restore wallpaper nitrogen --restore & -# start panel -al-polybar-session & - -# openbox autostart +# run the ob-autostart GUI configured commands ob-autostart -d & -# Required for xfce settings to work +# required for xfce settings to work xfsettingsd & -# Side panel shortcuts for file managers +# side panel shortcuts for file managers xdg-user-dirs-gtk-update & +# start the panel +al-polybar-session & + # start conky sleep 1; al-conky-session --autostart & diff --git a/home/.config/openbox/rc.xml b/home/.config/openbox/rc.xml index d501d326..09030e79 100644 --- a/home/.config/openbox/rc.xml +++ b/home/.config/openbox/rc.xml @@ -159,7 +159,6 @@ - @@ -176,135 +175,6 @@ - - - - - - - - - - -15 - 15 - 96% - 47% - - - - - - 15 - 15 - 96% - 47% - - - - - - - -15 - 15 - - - - - - - 15 - 15 - - - - - - - 15 - -15 - - - - - - - -15 - -15 - - - - - - 15 - 15 - 97% - 32% - - - - - - 34% - 15 - 97% - 32% - - - - - - -17 - 15 - 97% - 32% - - - - - - 20 - 0 - - - - - -20 - 0 - - - - - 0 - -20 - - - - - 0 - 20 - - - - - - 20 - - - - - -20 - - - - - 20 - - - - - -20 - - @@ -387,7 +257,7 @@ exo-open --launch TerminalEmulator - + exo-open --launch TerminalEmulator @@ -448,7 +318,7 @@ - + @@ -480,7 +350,7 @@ - + @@ -653,7 +523,6 @@ yes - vertical center current diff --git a/home/.vimrc b/home/.vimrc index 5123b158..08114e81 100644 --- a/home/.vimrc +++ b/home/.vimrc @@ -5,6 +5,8 @@ runtime! archlinux.vim " additional settings set modeline " enable vim modelines +set hlsearch " highlight search items +set incsearch " searches are performed as you type set clipboard^=unnamedplus " system clipboard (requires +clipboard) set number " enable line numbers set confirm " ask confirmation for some things, like save before quit, etc. @@ -36,15 +38,11 @@ endif syntax enable if has('termguicolors') && $DISPLAY !=? '' && &t_Co == 256 - let g:jinx_colors = 'night' " night or day (shift-t to change on the fly) - + set termguicolors " true colors in the terminal try - " true colors in the terminal - set termguicolors + let g:jinx_colors = 'night' " night or day, 'T' to change on the fly colorscheme jinx catch - set nocursorline - set notermguicolors colorscheme evening endtry @@ -54,8 +52,6 @@ if has('termguicolors') && $DISPLAY !=? '' && &t_Co == 256 let &term = 'xterm-256color' endif else - set nocursorline - set notermguicolors try colorscheme jinx catch @@ -63,7 +59,7 @@ else endtry endif -" change cursor shape for different editing modes (nvim does this by default) +" change cursor shape for different editing modes, neovim does this by default if !has('nvim') if exists('$TMUX') let &t_SI = "\Ptmux;\\e[5 q\\\" @@ -76,20 +72,31 @@ if !has('nvim') endif endif -set linebreak -set breakindent -set list listchars=tab:>>,trail:~ +set linebreak " wrap lines at full words rather than the last character to fit +set breakindent " wrapped lines match the same indent level -if has('multi_byte') +set list listchars=tab:>>,trail:~ +if has('multi_byte') && $DISPLAY !=? '' set listchars=tab:»»,trail:• set fillchars=vert:┃ showbreak=↪ endif +" ------ commands ------ + +command! D Explore +command! R call ranger() +command! Q call quitbuffer() +command! -nargs=1 B :call bufferselect("") +command! W execute 'silent w !sudo tee % >/dev/null' | edit! + " ------ basic maps ------ " open ranger as a file chooser using the function below nnoremap r :call ranger() +" match string to switch buffer +nnoremap b :let b:buf = input('Match: ')call bufferselect(b:buf) + " paste while in insert mode inoremap :set pastea+:set nopastea @@ -114,16 +121,42 @@ vnoremap < j v:count ? 'j' : 'gj' nnoremap k v:count ? 'k' : 'gk' +" open a terminal in $PWD +nnoremap tt :terminal + +" tab control +nnoremap :tabmove -1 +nnoremap :tabmove +1 +nnoremap te :tabnew +nnoremap tn :tabnext +nnoremap tf :tabfirst +nnoremap tp :tabprevious + +" close current buffer and/or tab +nnoremap q :B:silent tabclosegT +nnoremap tl :execute "tabn ".g:lasttab + " open a new tab in the current directory with netrw nnoremap - :tabedit =expand("%:p:h") +" split the window vertically and horizontally +nnoremap _ s +nnoremap v + + " ------ autocmd ------ +let g:lasttab = 1 +augroup save_last_tab + autocmd! + autocmd TabLeave * let g:lasttab = tabpagenr() +augroup END + " Reload changes if file changed outside of vim requires autoread augroup load_changed_file autocmd! autocmd FocusGained,BufEnter * if mode() !=? 'c' | checktime | endif - autocmd FileChangedShellPost * echo "Changes loaded from file" + autocmd FileChangedShellPost * echo "Changes loaded from source file" augroup END " when quitting a file, save the cursor position @@ -132,33 +165,38 @@ augroup save_cursor_position autocmd BufReadPost * call setpos(".", getpos("'\"")) augroup END -" enable cursorline in the currently active window -augroup cursorline - autocmd! - autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline - autocmd WinLeave * setlocal nocursorline -augroup END +" when not running in a console or a terminal that doesn't support 256 colors +" enable cursorline in the currently active window and disable it in inactive ones +if $DISPLAY !=? '' && &t_Co == 256 + augroup cursorline + autocmd! + autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline + autocmd WinLeave * setlocal nocursorline + augroup END +endif " ------ adv maps ------ -" toggle line numbers +" toggle line numbers, nn (no number) nnoremap nn \ :if &number - \ set nonumber + \ set nonumber + \ echo 'Line numbers disabled' \ else - \ set number + \ set number + \ echo 'Line numbers enabled' \ endif -" strip trailing whitespace +" strip trailing whitespace, ss (strip space) nnoremap ss - \ :let _p = getpos(".") - \ let _s = (@/ != '') ? @/ : '' + \ :let b:_p = getpos(".") + \ let b:_s = (@/ != '') ? @/ : '' \ %s/\s\+$//e - \ let @/ = _s + \ let @/ = b:_s \ nohlsearch - \ unlet _s - \ call setpos('.', _p) - \ unlet _p + \ unlet b:_s + \ call setpos('.', b:_p) + \ unlet b:_p " global replace vnoremap sw "hy @@ -190,17 +228,20 @@ nnoremap cw \ unlet b:sub \ endif -" highlight long lines -let w:longlines = matchadd('ColorColumn', '\%'.&tw.'v', &tw) +" highlight long lines, ll (long lines) +let w:longlines = matchadd('ColorColumn', '\%'.&textwidth.'v', &textwidth) nnoremap ll \ :if exists('w:longlines') \ silent! call matchdelete(w:longlines) - \ unlet w:longlines + \ echo 'Long line highlighting disabled' + \ unlet w:longlines \ elseif &textwidth > 0 \ let w:longlines = matchadd('ColorColumn', '\%'.&textwidth.'v', &textwidth) - \ else - \ let w:longlines = matchadd('ColorColumn', '\%80v', 80) - \ endif + \ echo 'Long line highlighting enabled' + \ else + \ let w:longlines = matchadd('ColorColumn', '\%80v', 81) + \ echo 'Long line highlighting enabled' + \ endif " local keyword jump nnoremap fw @@ -211,10 +252,62 @@ nnoremap fw \ endif +" quit the current buffer and switch to the next +" without this vim will leave you on an empty buffer after quiting the current +function! quitbuffer() abort + let l:bf = bufnr('%') + let l:pb = bufnr('#') + if buflisted(l:pb) + buffer # + else + bnext + endif + if bufnr('%') == l:bf + new + endif + if buflisted(l:bf) + execute('bdelete! ' . l:bf) + endif +endfunction + +" switch active buffer based on pattern matching +" if more than one match is found then list the matches to choose from +function! bufferselect(pattern) abort + let l:bufcount = bufnr('$') + let l:currbufnr = 1 + let l:nummatches = 0 + let l:matchingbufnr = 0 + " walk the buffer count + while l:currbufnr <= l:bufcount + if (bufexists(l:currbufnr)) + let l:currbufname = bufname(l:currbufnr) + if (match(l:currbufname, a:pattern) > -1) + echo l:currbufnr.': '.bufname(l:currbufnr) + let l:nummatches += 1 + let l:matchingbufnr = l:currbufnr + endif + endif + let l:currbufnr += 1 + endwhile + + " only one match + if (l:nummatches == 1) + execute ':buffer '.l:matchingbufnr + elseif (l:nummatches > 1) + " more than one match + let l:desiredbufnr = input('Enter buffer number: ') + if (strlen(l:desiredbufnr) != 0) + execute ':buffer '.l:desiredbufnr + endif + else + echoerr 'No matching buffers' + endif +endfunction + " open ranger as a file chooser function! ranger() let l:temp = tempname() - execute 'silent !st -e ranger --choosefiles='.shellescape(l:temp).' $PWD' + execute 'silent !xterm -e ranger --choosefiles='.shellescape(l:temp).' $PWD' if !filereadable(temp) redraw! return diff --git a/home/bin/rofr.sh b/home/bin/rofr.sh index 6f422861..de61c73c 100755 --- a/home/bin/rofr.sh +++ b/home/bin/rofr.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash NAME=$(basename "$0") -VER="0.3" +VER="0.4" usage() { cat <<- EOF @@ -33,14 +33,8 @@ EOF for arg in "$@"; do case $arg in - -h|--help) - usage - exit 0 - ;; - -v|--version) - echo -e "$NAME -- Version $VER" - exit 0 - ;; + -h|--help) usage; exit 0 ;; + -v|--version) echo -e "$NAME -- Version $VER"; exit 0 ;; -r|--run) rofi -modi run,drun -show drun -line-padding 4 \ -columns 2 -padding 50 -hide-scrollbar \ @@ -50,26 +44,24 @@ for arg in "$@"; do rofi -modi window -show window -hide-scrollbar -padding 50 -line-padding 4 ;; -q|--qalculate) - ! hash qalc &>/dev/null && { echo "Requires 'libqalculate' installed"; exit 1; } + hash qalc &>/dev/null || { echo "Requires 'libqalculate' installed"; exit 1; } rofi -modi "calc:qalc +u8 -nocurrencies" -padding 50 \ -show "calc:qalc +u8 -nocurrencies" -line-padding 4 \ -hide-scrollbar ;; -c|--clipboard) - ! hash greenclip &>/dev/null && { echo "Requires 'greenclip' installed"; exit 1; } + hash greenclip &>/dev/null || { echo "Requires 'greenclip' installed"; exit 1; } rofi -modi "clipboard:greenclip print" -padding 50 \ -line-padding 4 -show "clipboard:greenclip print" \ -hide-scrollbar ;; -b|--browser) - ! hash surfraw &>/dev/null && { echo "Requires 'surfraw' installed"; exit 1; } + hash surfraw &>/dev/null || { echo "Requires 'surfraw' installed"; exit 1; } - surfraw -browser="$BROWSER" $(sr -elvi | - awk -F'-' '{print $1}' | - sed '/:/d' | - awk '{$1=$1};1' | + surfraw -browser="$BROWSER" $(sr -elvi | awk -F'-' '{print $1}' | + sed '/:/d' | awk '{$1=$1};1' | rofi -hide-scrollbar -kb-row-select 'Tab' \ -kb-row-tab 'Control+space' -dmenu \ -mesg 'Tab for Autocomplete' -i -p 'Web Search' \ diff --git a/home/bin/toggle.sh b/home/bin/toggle.sh index d0d21439..93092c0c 100755 --- a/home/bin/toggle.sh +++ b/home/bin/toggle.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash NAME=$(basename "$0") -VER="0.3" +VER="0.4" usage() { cat <<- EOF @@ -37,9 +37,8 @@ toggle_polybar() { fi } - toggle_compton() { - if (( $opt == 1 )); then + if (( opt == 1 )); then if [[ $(pidof compton) ]]; then al-compositor --stop else @@ -59,9 +58,8 @@ toggle_compton() { done } - toggle_redshift() { - if (( $opt == 1 )); then + if (( opt == 1 )); then if [[ $(pidof redshift) ]]; then pkill redshift else @@ -87,7 +85,6 @@ toggle_redshift() { done } - toggle_caffeine() { if (( $opt == 1 )); then if [[ $(pidof caffeine) ]]; then @@ -109,18 +106,11 @@ toggle_caffeine() { done } - # Catch command line options case $1 in - -h|--help) - usage - ;; - -v|--version) - echo -e "$NAME -- Version $VER" - ;; - -p|--polybar) - toggle_polybar - ;; + -h|--help) usage ;; + -v|--version) echo -e "$NAME -- Version $VER" ;; + -p|--polybar) toggle_polybar ;; -c|--compton) [[ $2 =~ (-t|--toggle) ]] && opt=1 toggle_compton @@ -133,8 +123,7 @@ case $1 in [[ $2 =~ (-t|--toggle) ]] && opt=1 toggle_caffeine ;; - *) - echo -e "Option does not exist: $1" && usage && exit 1 + *) echo -e "Option does not exist: $1" && usage && exit 1 esac exit 0