From 03ae81077ae9e46cfdb1d7abdf5c2887a76f87f4 Mon Sep 17 00:00:00 2001 From: Hassan Afify Date: Fri, 18 Oct 2019 23:18:41 +0300 Subject: [PATCH] [feat] new scripts, update bashrc vimrc & other new file: .config/mutt/themes/noir.muttrc new file: .scripts/bar_scripts/rfkill_status.sh new file: .scripts/grub_config.sh new file: .scripts/github_traffic.sh modified: .bashrc modified: .config/mutt/keymap.muttrc modified: .config/mutt/muttrc modified: .gitconfig modified: .scripts/bar_scripts/github.sh modified: .scripts/mutt_setup.sh modified: .scripts/pacman_base.txt modified: .vimrc --- .bashrc | 20 +++++++---- .config/mutt/keymap.muttrc | 46 +++++++++++-------------- .config/mutt/muttrc | 5 +-- .config/mutt/themes/noir.muttrc | 11 ++++++ .gitconfig | 21 +++++++----- .scripts/bar_scripts/github.sh | 2 +- .scripts/bar_scripts/rfkill_status.sh | 17 ++++++++++ .scripts/github_traffic.sh | 32 ++++++++++++++++++ .scripts/grub_config.sh | 6 ++++ .scripts/mutt_setup.sh | 2 +- .scripts/pacman_base.txt | 4 +++ .vimrc | 64 +++++++++++++++++++---------------- 12 files changed, 153 insertions(+), 77 deletions(-) create mode 100644 .config/mutt/themes/noir.muttrc create mode 100755 .scripts/bar_scripts/rfkill_status.sh create mode 100755 .scripts/github_traffic.sh create mode 100644 .scripts/grub_config.sh diff --git a/.bashrc b/.bashrc index e9cecb0..ec4a522 100644 --- a/.bashrc +++ b/.bashrc @@ -33,11 +33,18 @@ alias f="~/.scripts/find.sh" alias fw="~/.scripts/find_word.sh" alias fr="~/.scripts/find_replace_word.sh" alias xc='xclip -sel clip <' + alias pm="sudo pacman" alias pmu="sudo pacman -Syyu" alias pmo="sudo pacman -Rns $(pacman -Qtdq)" alias pmr="sudo pacman -Rns" +# Edit config files +alias vimrc="vim ~/.vimrc" +alias bashrc="vim ~/.bashrc" +alias dwmrc="cd /mnt/data/dev/suckless/dwm-6.2/; vim config.def.h;" +alias blockrc="cd /mnt/data/dev/suckless/dwmblocks/; vim blocks.h;" + alias gdiff="/home/hassan/.scripts/create_diff_git.sh" alias github="eval \"$(ssh-agent -s)\"; ssh-add /home/hassan/.ssh/github" @@ -73,6 +80,7 @@ bg_green="$esc[48;5;2m\]" bg_orange="$esc[48;5;166m\]" bg_blue2="$esc[48;5;24m\]" +gitbranch="\$(__git_ps1 '  %s ')" dir_fg=$gold dir_bg=$bg_black dir_bgc=$black @@ -81,14 +89,12 @@ branch_fg=$orange branch_bg=$bg_dgrey branch_bgc=$dgrey -user_fg=$blue2 -user_bg=$bg_dgrey2 -user_bgc=$dgrey2 - +# user_fg=$blue2 +# user_bg=$bg_dgrey2 +# user_bgc=$dgrey2 # sep= -# export PS1="$white$bg_blue \W $bg_red\$(__git_ps1 ' %s ')$bg_mag $ $restore " -export PS1="$dir_fg$dir_bg \W $branch_bg$dir_bgc$sep$branch_fg\$(__git_ps1 '  %s ')$user_bg$branch_bgc$sep$user_fg \\$ $restore$user_bgc$sep$restore " +export PS1="$dir_fg$dir_bg \W $branch_bg$dir_bgc$sep$branch_fg$gitbranch$restore$user_bgc$sep$restore " #------ HISTORY CONFIG -------------------------------------------------------- @@ -97,7 +103,7 @@ export HISTFILESIZE=10000 export HISTTIMEFORMAT='%b %d %I:%M %p ' export HISTCONTROL=ignoreboth export HISTIGNORE="history:pwd:exit:df:ls:ls -lahG:ll" -export HISTFILE=~/.cache/.bash_history +export HISTFILE="~/.cache/.bash_history" #------ GREP COLOR CODE ------------------------------------------------------- diff --git a/.config/mutt/keymap.muttrc b/.config/mutt/keymap.muttrc index d9d3120..aa59996 100644 --- a/.config/mutt/keymap.muttrc +++ b/.config/mutt/keymap.muttrc @@ -1,31 +1,37 @@ # vim: filetype=neomuttrc # General rebindings -bind attach view-mailcap -bind attach l view-mailcap -bind editor noop -bind index G last-entry -bind index,pager g noop -bind index gg first-entry bind pager,attach h exit +macro browser h '..' "Go to parent folder" +bind index,pager H view-raw-message +bind index h noop +# bind browser h goto-parent + bind pager j next-line + bind pager k previous-line + +bind attach view-mailcap +bind attach l view-mailcap bind pager l view-attachments -bind index D delete-message -bind index U undelete-message -bind index L limit -bind index h noop bind index l display-message -#bind browser h goto-parent -macro browser h '..' "Go to parent folder" -bind index,pager H view-raw-message bind browser l select-entry +bind index L limit + +bind index,pager g noop +bind index gg first-entry bind pager,browser gg top-page +bind index G last-entry bind pager,browser G bottom-page + +# +bind index D delete-message bind index,pager,browser d half-down +bind index U undelete-message bind index,pager,browser u half-up bind index,pager S sync-mailbox bind index,pager R group-reply +bind editor noop bind editor complete-query macro index,pager a "|abook --add-email\n" 'add sender to abook' @@ -43,20 +49,6 @@ bind index,pager B sidebar-toggle-visible - -# -# -# -# -# -# -# -# -# -# -# -# -# # # # # some sane vim-like keybindings diff --git a/.config/mutt/muttrc b/.config/mutt/muttrc index aa3dd2b..2fd46d3 100644 --- a/.config/mutt/muttrc +++ b/.config/mutt/muttrc @@ -58,7 +58,7 @@ set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+" set send_charset = "utf-8:iso-8859-1:us-ascii" # Pager View Options -set pager_index_lines = 10 +# set pager_index_lines = 10 set pager_context = 3 set pager_stop set menu_scroll @@ -79,7 +79,8 @@ set hdr_format="%4C %Z %{%m/%d} %-15.15F (%4c) %s" # format of the index # colors stuff outside # source ~/.config/mutt/themes/gruvbox.muttrc -source ~/.config/mutt/themes/new.muttrc +# source ~/.config/mutt/themes/new.muttrc +source ~/.config/mutt/themes/noir.muttrc # keyboard remaping source ~/.config/mutt/keymap.muttrc diff --git a/.config/mutt/themes/noir.muttrc b/.config/mutt/themes/noir.muttrc new file mode 100644 index 0000000..effb8bb --- /dev/null +++ b/.config/mutt/themes/noir.muttrc @@ -0,0 +1,11 @@ +color normal color243 black +color status color243 black +color indicator color243 color234 +color hdrdefault yellow black +color signature yellow black +color attachment brightyellow black +color markers brightred black +color quoted green black +color tilde blue black +color tree color234 black + diff --git a/.gitconfig b/.gitconfig index c17f640..461b9dc 100644 --- a/.gitconfig +++ b/.gitconfig @@ -1,7 +1,6 @@ [user] name = Hassan Afify email = hassanafify@protonmail.com -# signingkey = 0F6CD1196B2A5658 signingkey = CED2D2F771262467 [core] @@ -70,7 +69,7 @@ p = push github master pushall = !git remote | xargs -L1 git push --all show-unpushed-branches = log --branches --not --remotes --simplify-by-decoration --decorate --oneline -# show-unpushed-commits = +# show-unpushed-commits = # Diff d = difftool HEAD @@ -96,9 +95,11 @@ tag-tobranch = checkout -b tag_temp_branch #tagname # Log - l = log --all --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cr)\\ %d\\%C(#c0d6de)%s" - ld = log --all --date=format:'%a %d %b' --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cd)\\ %d\\%C(#c0d6de)%s" - lg = log --all --graph --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cr)\\ %d\\%C(#c0d6de)%s" + l = log --all --pretty=format:"%C(#0080ff)%h\\ \\%C(#c0d6de)%s\\%C(#17b062)%d" + ll = log --all --graph --pretty=format:"%C(#0080ff)%h\\ \\%C(#c0d6de)%s\\%C(#17b062)%d" + lo = log --all --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cr)%d\\ \\%C(#c0d6de)%s" + ld = log --all --date=format:'%a %d %b' --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cd)%d\\ \\%C(#c0d6de)%s" + lg = log --all --graph --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cr)%d\\ \\%C(#c0d6de)%s" lf = log -p stat = !git diff --stat $(git merge-base HEAD \"master\") plog = log --graph --pretty=format:'%h -%d %s %n' --abbrev-commit --date=relative --branches @@ -112,11 +113,12 @@ # Branch br = branch be = branch --edit-description - branches = branch -a # list all branches + bra = branch -av show-unmerged-branches = branch --no-merged master show-merged-branches = branch --merged master delete-remote-branch = push -d github #branch name delete-remote-branch = push --delete github #branch name + show-ahead = rev-list --count master... # git push -f origin $old_commit_id:master # change remote branch # git reset --hard origin/ # force sync with remote # git branch -m old-name new-name # rename branches @@ -127,7 +129,7 @@ unstage-all = reset unstage-file = restore --staged uncommit = reset --soft HEAD - forcerestore = !git reset --hard HEAD $1 && git clean -f +# forcerestore = !git reset --hard HEAD $1 && git clean -f # Track Ignore files dirs untrack= rm -r --cached --ignore-unmatch @@ -138,5 +140,6 @@ # interactive staging addi = add --interactive - - +# diff + create-diff = !sh ~/.scripts/create_diff_git.sh + apply-diff = !result=$(ls *.diff | dmenu -p 'select diff file' -l 10) && git apply $result diff --git a/.scripts/bar_scripts/github.sh b/.scripts/bar_scripts/github.sh index 4e72e38..440e621 100755 --- a/.scripts/bar_scripts/github.sh +++ b/.scripts/bar_scripts/github.sh @@ -12,7 +12,7 @@ pullrequest_icon="" issue_icon="" repos=( "/mnt/data/dev/azan" -# "/mnt/data/dev/splaner" + "/mnt/data/dev/splanner" # "/home/hassan/" ) diff --git a/.scripts/bar_scripts/rfkill_status.sh b/.scripts/bar_scripts/rfkill_status.sh new file mode 100755 index 0000000..9131825 --- /dev/null +++ b/.scripts/bar_scripts/rfkill_status.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +wifi_block_logo="" +bluetooth_block_logo="" + +wifi_soft=$(rfkill -rn | awk '/wlan/ {print $4}') +bluetooth_soft=$(rfkill -rn | awk '/bluetooth/ {print $4}') + +if [[ "$wifi_soft" == "blocked" ]]; then + result_wifi=$wifi_block_logo +fi + +if [[ "$bluetooth_soft" == "blocked" ]]; then + result_bluetooth=$bluetooth_block_logo +fi + +echo $result_wifi $result_bluetooth diff --git a/.scripts/github_traffic.sh b/.scripts/github_traffic.sh new file mode 100755 index 0000000..2a4b8a2 --- /dev/null +++ b/.scripts/github_traffic.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +#============================================================================== +# Name : github +# GitHub : Afify +# Copyright : MIT +# Version : +# Description : +#============================================================================== + +view_icon="" +clone_icon="" +owner=Afify +repos=( "/mnt/data/dev/azan" + "/mnt/data/dev/splanner" + ) + +for i in "${repos[@]}" +do + repo_name=$(basename $i) + declare -n repo_clones="${repo_name}_clones" + declare -n repo_views="${repo_name}_views" + declare -n repo_result="${repo_name}_result" + + repo_clones=$(hub api /repos/$owner/$repo_name/traffic/clones |\ + jq -r '.uniques') + repo_views=$(hub api /repos/$owner/$repo_name/traffic/views |\ + jq -r '.uniques') + repo_result="[$repo_name] $clone_icon $repo_clones $view_icon $repo_views" +done + +notify-send -t 20000 "Github Traffic" "$azan_result\n$splanner_result" diff --git a/.scripts/grub_config.sh b/.scripts/grub_config.sh new file mode 100644 index 0000000..c1cfb78 --- /dev/null +++ b/.scripts/grub_config.sh @@ -0,0 +1,6 @@ + +echo "GRUB_DEFAULT=0 +GRUB_TIMEOUT=0 +GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT" >> /etc/default/grub + +sudo grub-mkconfig -o /boot/grub/grub.cfg diff --git a/.scripts/mutt_setup.sh b/.scripts/mutt_setup.sh index fa6451b..d84a252 100644 --- a/.scripts/mutt_setup.sh +++ b/.scripts/mutt_setup.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -pacman -S msmtp +pacman -S abook notmuch # mutt_dir= "~/.config/mutt" diff --git a/.scripts/pacman_base.txt b/.scripts/pacman_base.txt index b627b58..23dcc72 100644 --- a/.scripts/pacman_base.txt +++ b/.scripts/pacman_base.txt @@ -1,6 +1,7 @@ linux linux-headers linux-firmware +pacman-contrib lightdm lightdm-gtk-greeter @@ -26,10 +27,12 @@ nvidia-settings man dunst htop +fd clang splint valgrind +hyperfine iw nmap @@ -67,6 +70,7 @@ unrar unzip xarchiver exfat-utils +ntfs-3g ttf-droid termius-font diff --git a/.vimrc b/.vimrc index de4ec80..4705873 100644 --- a/.vimrc +++ b/.vimrc @@ -20,6 +20,7 @@ Plug 'airblade/vim-gitgutter' " Themes Plug 'justinmk/vim-syntax-extra' Plug 'morhetz/gruvbox' +Plug 'tomasr/molokai' " Syntax Plug 'ap/vim-css-color' @@ -53,49 +54,50 @@ set noexpandtab "============================================================================== " Theme syntax on +" set t_Co=256 set background=dark +let g:gruvbox_italic =1 let g:gruvbox_contrast_dark='hard' colorscheme gruvbox - -highlight Normal ctermbg=0 -let g:gruvbox_italic =1 +" colorscheme molokai +hi Visual ctermbg=237 +hi Normal ctermbg=0 " Line numbers set number -hi LineNr ctermfg=236 -hi LineNr ctermbg=232 +hi LineNr ctermfg=236 +hi LineNr ctermbg=232 " Cursor -hi CursorLine ctermbg=232 -hi CursorLineNR cterm=bold ctermbg=232 ctermfg=166 +hi CursorLine ctermbg=232 +hi CursorLineNR cterm=bold ctermbg=232 ctermfg=166 set cursorline " Column length" set colorcolumn=80,81 -autocmd FileType gitcommit set colorcolumn=50,51,72,73 -autocmd FileType gitrebase set colorcolumn=63,64 -hi ColorColumn ctermbg=232 +autocmd FileType gitcommit set colorcolumn=50,51,72,73 +autocmd FileType gitrebase set colorcolumn=63,64 +hi ColorColumn ctermbg=232 " Comments tab todo -hi Comment ctermfg=241 cterm=italic -hi SpecialKey ctermfg=236 ctermbg=NONE -" hi SpecialKey ctermbg=0 -hi TODO ctermfg=red ctermbg=0 cterm=bold -hi NonText ctermfg=235 +hi Comment ctermfg=241 cterm=italic +hi SpecialKey ctermfg=236 ctermbg=0 +hi TODO ctermfg=red ctermbg=0 cterm=bold +hi NonText ctermfg=235 " Git signes -highlight clear SignColumn -highlight GitGutterAdd ctermfg=green ctermbg=232 -highlight GitGutterChange ctermfg=darkyellow ctermbg=232 cterm=bold -highlight GitGutterDelete ctermfg=red ctermbg=232 cterm=bold -highlight GitGutterChangeDelete ctermfg=darkyellow ctermbg=232 cterm=bold +hi clear SignColumn +hi GitGutterAdd ctermfg=green ctermbg=232 +hi GitGutterChange ctermfg=darkyellow ctermbg=232 cterm=bold +hi GitGutterDelete ctermfg=red ctermbg=232 cterm=bold +hi GitGutterChangeDelete ctermfg=darkyellow ctermbg=232 cterm=bold " hi Statement ctermfg=3 -hi VertSplit ctermfg=8 ctermbg=0 -set splitbelow splitright +hi VertSplit ctermfg=8 ctermbg=0 filetype plugin indent on set wildmenu set wildmode=list:full,full +set splitbelow splitright " Search set ignorecase "search case insensitive @@ -200,6 +202,10 @@ nnoremap c :call Clean_file() " Enter command mode noremap ; : + +" Insert current date +map i "=strftime("%d %m %Y")p + " cnoremap %s/ %s/\v " command! -range=% HighlightRepeats ,call HighlightRepeats() " :w !sudo tee % @@ -213,7 +219,7 @@ let g:airline_theme = 'minimalist' let g:airline#extensions#hunks#enabled= 0 let g:airline#extensions#branch#enabled = 1 -let g:airline_symbols = {} +let g:airline_symbols = {} let g:airline_section_a = '' let g:airline_section_b = '' let g:airline_section_x = '' @@ -238,12 +244,12 @@ let g:syntastic_enable_highlighting= 0 "underline word let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_jump = 0 -highlight link SyntasticErrorLine error -highlight SyntasticErrorLineNr ctermbg=red ctermfg=black +hi link SyntasticErrorLine error +hi SyntasticErrorLineNr ctermbg=red ctermfg=black " Symbols color -highlight SyntasticWarningSign cterm=italic ctermbg=232 ctermfg=226 -highlight SyntasticErrorSign cterm=italic ctermbg=232 ctermfg=red +hi SyntasticWarningSign cterm=italic ctermbg=232 ctermfg=226 +hi SyntasticErrorSign cterm=italic ctermbg=232 ctermfg=red " Symbols icon let g:syntastic_error_symbol = '' @@ -306,7 +312,7 @@ let g:completor_auto_trigger = 1 let g:completor_clang_binary = '/usr/bin/clang' let g:completor_complete_options = 'menuone,noselect,preview' -inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" "============================================================================== @@ -358,5 +364,3 @@ function! TempC() exe "normal!oint main(void) { return 0; }" exe "normal!kk" endfunction - - -- 2.11.4.GIT