From 02c17ea2ed1dc3a6195c1c2f4bde8091fa804562 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Mon, 15 Feb 2021 00:02:05 -0500 Subject: [PATCH] vim bar + usb mount --- .Xresources | 2 +- .bashrc | 4 +++- .vimrc | 52 ++++++++++++++++++++++++++++++++++++++++++++++---- Scripts/usbmnt | 22 +++++++++++++++++++++ 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100755 Scripts/usbmnt diff --git a/.Xresources b/.Xresources index ef47530..60bd532 100644 --- a/.Xresources +++ b/.Xresources @@ -65,7 +65,7 @@ #define theme15 nord15 #define themefg nordfg #define themebg nordbg -#define themehl nord1 +#define themehl nord11 *.font: Source Code Pro:size=12 diff --git a/.bashrc b/.bashrc index f52a230..9c29ad7 100644 --- a/.bashrc +++ b/.bashrc @@ -9,7 +9,8 @@ [[ $- != *i* ]] && return # prompt lmao -PS1=' λ_ \W > ' +PS1='\e[01;33m λ_\e[m\e[01;37m \W \e[m\e[01;33m> \e[m' +PS2='\e[01;37m> \e[m' #set vi mode set -o vi @@ -41,6 +42,7 @@ alias mpv="mpv --no-input-default-bindings" # alias lockscreen='slock -m "$(figlet locked xd | cowsay -f cheese -n)"' alias darkmpv='mpv --vf=sub,lavfi="negate"' alias nmaplocal='nmap -sn 192.168.1.0/24' +alias refreshusb='udevadm control --reload-rules' source fzfutil diff --git a/.vimrc b/.vimrc index 4665ec5..8710041 100644 --- a/.vimrc +++ b/.vimrc @@ -41,6 +41,50 @@ map s :set list! hi Conceal ctermbg=Black hi SpellBad ctermfg=Red ctermbg=Black cterm=underline +" statusline +function! StatusModeColor() + if (mode() =~# '\v(n|no)') + hi StatusLine cterm=None gui=None ctermfg=black ctermbg=Yellow + elseif (mode() =~# '\v(v|V)') + hi StatusLine cterm=None gui=None ctermfg=black ctermbg=Red + elseif (mode() ==# 'i') + hi StatusLine cterm=None gui=None ctermfg=black ctermbg=LightBlue + elseif (mode() ==# 'c') + hi StatusLine cterm=None gui=None ctermfg=black ctermbg=Green + else + hi StatusLine cterm=None gui=None ctermfg=black ctermbg=DarkGrey + endif + + return '' +endfunction + +function! StatusModifiedColor() + if getbufinfo(1)[0].changed + hi User1 cterm=None gui=None ctermfg=Black ctermbg=LightGrey + else + hi User1 cterm=None gui=None ctermfg=White ctermbg=Black + endif + + return '' +endfunction + +call StatusModeColor() + +" set showtabline=2 + +set laststatus=2 +set statusline= +set statusline+=%{StatusModeColor()} +set statusline+=%{StatusModifiedColor()} +set statusline+=\ vim\ \[%{mode()}\] +set statusline+=\ %1*\ %F\ %m +set statusline+=%= +set statusline+=%0* +set statusline+=\ %ff +set statusline+=\ %r\[%{v:register}\] +set statusline+=\ %l/%L:%c +set statusline+=\ + " Netrw " let g:netrw_liststyle = 3 " let g:netrw_banner = 0 @@ -69,7 +113,7 @@ Plug 'sirver/ultisnips' Plug 'lervag/vimtex' Plug 'jiangmiao/auto-pairs' Plug 'PietroPate/vim-tex-conceal' -Plug 'vim-airline/vim-airline' +" Plug 'vim-airline/vim-airline' Plug 'tpope/vim-commentary' Plug 'ptzz/lf.vim' Plug 'voldikss/vim-floaterm' @@ -96,9 +140,9 @@ let g:vimtex_compiler_latexmk = { \} " VimAirline -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#buffer_min_count = 2 -let g:airline_powerline_fonts=1 +" let g:airline#extensions#tabline#enabled = 1 +" let g:airline#extensions#tabline#buffer_min_count = 2 +" let g:airline_powerline_fonts=1 " Ctrlp let g:ctrlp_cmd='CtrlPTag' diff --git a/Scripts/usbmnt b/Scripts/usbmnt new file mode 100755 index 0000000..cafb1fb --- /dev/null +++ b/Scripts/usbmnt @@ -0,0 +1,22 @@ +#!/bin/sh + +# $1 -> mode (a, d) +# $2 -> busnum +# $3 -> devnum + +user="pinosaur" + +export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u $user)/bus" + +case $1 in + a) + devpath="/dev/bus/usb/$(printf %03d $2)/$(printf %03d $3)" + manname="$(lsusb -D $devpath | grep 'iManufacturer' | sed 's/\s*iManufacturer\s*[0-9]\s*//')" + devname="$(lsusb -D $devpath | grep 'iProduct' | sed 's/\s*iProduct\s*[0-9]\s*//')" + su pinosaur -c "notify-send 'USB inserted: $manname $devname'" + ;; + r) su pinosaur -c "notify-send 'USB ejected'";; + *) exit 1;; +esac + + -- 2.20.1