diff options
author | terminaldweller <thabogre@gmail.com> | 2021-08-20 15:08:32 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2021-08-20 15:08:32 +0000 |
commit | 4de563ae0ee333a986e3cf6bdd170453e3261e3d (patch) | |
tree | da99522f7e6034f62d122b3987896ce205686b3f | |
parent | using vimplug now. (diff) | |
download | scripts-4de563ae0ee333a986e3cf6bdd170453e3261e3d.tar.gz scripts-4de563ae0ee333a986e3cf6bdd170453e3261e3d.zip |
zsh overhaul
Diffstat (limited to '')
-rw-r--r-- | .config/broot/conf.hjson | 23 | ||||
-rw-r--r-- | .config/ranger/rifle.conf | 284 | ||||
-rw-r--r-- | .ctags | 10 | ||||
-rw-r--r-- | .tmux.conf | 2 | ||||
-rw-r--r-- | .vimrc | 65 | ||||
-rw-r--r-- | .zshenv | 2 | ||||
-rw-r--r-- | .zshrc | 217 | ||||
-rwxr-xr-x | bin/pdf2mp3 | 32 | ||||
-rw-r--r-- | devi.zsh-theme | 266 | ||||
-rwxr-xr-x | docker/ipfs.sh | 3 | ||||
-rw-r--r-- | irssi/config | 31 | ||||
-rw-r--r-- | irssi/startup | 4 | ||||
-rwxr-xr-x | tmux/date.sh | 2 |
13 files changed, 726 insertions, 215 deletions
diff --git a/.config/broot/conf.hjson b/.config/broot/conf.hjson index 93c4fef..fd6db3f 100644 --- a/.config/broot/conf.hjson +++ b/.config/broot/conf.hjson @@ -16,6 +16,7 @@ # ############################################################### { + syntax_theme: Solarized (dark) ############################################################### # Default flags @@ -39,7 +40,7 @@ # "vim mode" # # - # modal: true + modal: true ############################################################### # Whether to mark the selected line with a triangle @@ -52,16 +53,16 @@ # array. You should keep the name at the end as it has a variable # length. # - # cols_order: [ - # mark - # git - # size - # permission - # date - # count - # branch - # name - # ] + cols_order: [ + mark + git + size + permission + date + count + branch + name + ] ############################################################### # True Colors diff --git a/.config/ranger/rifle.conf b/.config/ranger/rifle.conf new file mode 100644 index 0000000..86f53fd --- /dev/null +++ b/.config/ranger/rifle.conf @@ -0,0 +1,284 @@ +# vim: ft=cfg +# +# This is the configuration file of "rifle", ranger's file executor/opener. +# Each line consists of conditions and a command. For each line the conditions +# are checked and if they are met, the respective command is run. +# +# Syntax: +# <condition1> , <condition2> , ... = command +# +# The command can contain these environment variables: +# $1-$9 | The n-th selected file +# $@ | All selected files +# +# If you use the special command "ask", rifle will ask you what program to run. +# +# Prefixing a condition with "!" will negate its result. +# These conditions are currently supported: +# match <regexp> | The regexp matches $1 +# ext <regexp> | The regexp matches the extension of $1 +# mime <regexp> | The regexp matches the mime type of $1 +# name <regexp> | The regexp matches the basename of $1 +# path <regexp> | The regexp matches the absolute path of $1 +# has <program> | The program is installed (i.e. located in $PATH) +# env <variable> | The environment variable "variable" is non-empty +# file | $1 is a file +# directory | $1 is a directory +# number <n> | change the number of this command to n +# terminal | stdin, stderr and stdout are connected to a terminal +# X | A graphical environment is available (darwin, Xorg, or Wayland) +# +# There are also pseudo-conditions which have a "side effect": +# flag <flags> | Change how the program is run. See below. +# label <label> | Assign a label or name to the command so it can +# | be started with :open_with <label> in ranger +# | or `rifle -p <label>` in the standalone executable. +# else | Always true. +# +# Flags are single characters which slightly transform the command: +# f | Fork the program, make it run in the background. +# | New command = setsid $command >& /dev/null & +# r | Execute the command with root permissions +# | New command = sudo $command +# t | Run the program in a new terminal. If $TERMCMD is not defined, +# | rifle will attempt to extract it from $TERM. +# | New command = $TERMCMD -e $command +# Note: The "New command" serves only as an illustration, the exact +# implementation may differ. +# Note: When using rifle in ranger, there is an additional flag "c" for +# only running the current file even if you have marked multiple files. + +#------------------------------------------- +# Websites +#------------------------------------------- +# Rarely installed browsers get higher priority; It is assumed that if you +# install a rare browser, you probably use it. Firefox/konqueror/w3m on the +# other hand are often only installed as fallback browsers. +ext x?html?, has surf, X, flag f = surf -- file://"$1" +ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@" +ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@" +ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@" +ext x?html?, has dwb, X, flag f = dwb -- "$@" +ext x?html?, has jumanji, X, flag f = jumanji -- "$@" +ext x?html?, has luakit, X, flag f = luakit -- "$@" +ext x?html?, has uzbl, X, flag f = uzbl -- "$@" +ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@" +ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@" +ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@" +ext x?html?, has midori, X, flag f = midori -- "$@" +ext x?html?, has opera, X, flag f = opera -- "$@" +ext x?html?, has firefox, X, flag f = firefox -- "$@" +ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@" +ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@" +ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@" +ext x?html?, has chromium, X, flag f = chromium -- "$@" +ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@" +ext x?html?, has epiphany, X, flag f = epiphany -- "$@" +ext x?html?, has konqueror, X, flag f = konqueror -- "$@" +ext x?html?, has elinks, terminal = elinks "$@" +ext x?html?, has links2, terminal = links2 "$@" +ext x?html?, has links, terminal = links "$@" +ext x?html?, has lynx, terminal = lynx -- "$@" +ext x?html?, has w3m, terminal = w3m "$@" + +#------------------------------------------- +# Misc +#------------------------------------------- +# Define the "editor" for text files as first action +mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@" +mime ^text, label pager = "$PAGER" -- "$@" +!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@" +!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" + +ext 1 = man "$1" +ext s[wmf]c, has zsnes, X = zsnes "$1" +ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1" +ext nes, has fceux, X = fceux "$1" +ext exe = wine "$1" +name ^[mM]akefile$ = make + +#-------------------------------------------- +# Scripts +#------------------------------------------- +ext py = python -- "$1" +ext pl = perl -- "$1" +ext rb = ruby -- "$1" +ext js = node -- "$1" +ext sh = sh -- "$1" +ext php = php -- "$1" + +#-------------------------------------------- +# Audio without X +#------------------------------------------- +mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" +mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@" +mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@" +ext midi?, terminal, has wildmidi = wildmidi -- "$@" + +#-------------------------------------------- +# Video/Audio with a GUI +#------------------------------------------- +mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@" +mime ^video|audio, has smplayer, X, flag f = smplayer "$@" +mime ^video, has mpv, X, flag f = mpv -- "$@" +mime ^video, has mpv, X, flag f = mpv --fs -- "$@" +mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" +mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" +mime ^video, has mplayer, X, flag f = mplayer -- "$@" +mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@" +mime ^video|audio, has vlc, X, flag f = vlc -- "$@" +mime ^video|audio, has totem, X, flag f = totem -- "$@" +mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@" + +#-------------------------------------------- +# Video without X +#------------------------------------------- +mime ^video, terminal, !X, has mpv = mpv -- "$@" +mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@" +mime ^video, terminal, !X, has mplayer = mplayer -- "$@" + +#------------------------------------------- +# Documents +#------------------------------------------- +ext pdf, has llpp, X, flag f = llpp "$@" +ext pdf, has zathura, X, flag f = zathura -- "$@" +ext pdf, has mupdf, X, flag f = mupdf "$@" +ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@" +ext pdf, has apvlv, X, flag f = apvlv -- "$@" +ext pdf, has xpdf, X, flag f = xpdf -- "$@" +ext pdf, has evince, X, flag f = evince -- "$@" +ext pdf, has atril, X, flag f = atril -- "$@" +ext pdf, has okular, X, flag f = okular -- "$@" +ext pdf, has epdfview, X, flag f = epdfview -- "$@" +ext pdf, has qpdfview, X, flag f = qpdfview "$@" +ext pdf, has open, X, flag f = open "$@" + +ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER" + +ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@" +ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@" +ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@" +ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@" +ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@" + +ext djvu, has zathura,X, flag f = zathura -- "$@" +ext djvu, has evince, X, flag f = evince -- "$@" +ext djvu, has atril, X, flag f = atril -- "$@" +ext djvu, has djview, X, flag f = djview -- "$@" + +ext epub, has ebook-viewer, X, flag f = ebook-viewer -- "$@" +ext epub, has zathura, X, flag f = zathura -- "$@" +ext epub, has mupdf, X, flag f = mupdf -- "$@" +ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@" + +ext cbr, has zathura, X, flag f = zathura -- "$@" +ext cbz, has zathura, X, flag f = zathura -- "$@" + +#------------------------------------------- +# Images +#------------------------------------------- +mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@" +mime ^image/svg, has display, X, flag f = display -- "$@" + +mime ^image, has imv, X, flag f = imv -- "$@" +mime ^image, has pqiv, X, flag f = pqiv -- "$@" +mime ^image, has sxiv, X, flag f = sxiv -- "$@" +mime ^image, has feh, X, flag f = feh -- "$@" +mime ^image, has mirage, X, flag f = mirage -- "$@" +mime ^image, has ristretto, X, flag f = ristretto "$@" +mime ^image, has eog, X, flag f = eog -- "$@" +mime ^image, has eom, X, flag f = eom -- "$@" +mime ^image, has nomacs, X, flag f = nomacs -- "$@" +mime ^image, has geeqie, X, flag f = geeqie -- "$@" +mime ^image, has gpicview, X, flag f = gpicview -- "$@" +mime ^image, has gwenview, X, flag f = gwenview -- "$@" +mime ^image, has gimp, X, flag f = gimp -- "$@" +ext xcf, X, flag f = gimp -- "$@" + +#------------------------------------------- +# Archives +#------------------------------------------- + +# avoid password prompt by providing empty password +ext 7z, has 7z = 7z -p l "$@" | "$PAGER" +# This requires atool +ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER" +ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER" +ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@" +ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@" + +# Listing and extracting archives without atool: +ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER" +ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done +ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done +ext zip, has unzip = unzip -l "$1" | less +ext zip, has unzip = for file in "$@"; do unzip -d "${file%.*}" "$file"; done +ext ace, has unace = unace l "$1" | less +ext ace, has unace = for file in "$@"; do unace e "$file"; done +ext rar, has unrar = unrar l "$1" | less +ext rar, has unrar = for file in "$@"; do unrar x "$file"; done + +#------------------------------------------- +# Fonts +#------------------------------------------- +mime ^font, has fontforge, X, flag f = fontforge "$@" + +#------------------------------------------- +# Flag t fallback terminals +#------------------------------------------- +# Rarely installed terminal emulators get higher priority; It is assumed that +# if you install a rare terminal emulator, you probably use it. +# gnome-terminal/konsole/xterm on the other hand are often installed as part of +# a desktop environment or as fallback terminal emulators. +mime ^ranger/x-terminal-emulator, has terminology = terminology -e "$@" +mime ^ranger/x-terminal-emulator, has kitty = kitty -- "$@" +mime ^ranger/x-terminal-emulator, has alacritty = alacritty -e "$@" +mime ^ranger/x-terminal-emulator, has sakura = sakura -e "$@" +mime ^ranger/x-terminal-emulator, has lilyterm = lilyterm -e "$@" +#mime ^ranger/x-terminal-emulator, has cool-retro-term = cool-retro-term -e "$@" +mime ^ranger/x-terminal-emulator, has termite = termite -x '"$@"' +#mime ^ranger/x-terminal-emulator, has yakuake = yakuake -e "$@" +mime ^ranger/x-terminal-emulator, has guake = guake -ne "$@" +mime ^ranger/x-terminal-emulator, has tilda = tilda -c "$@" +mime ^ranger/x-terminal-emulator, has st = st -e "$@" +mime ^ranger/x-terminal-emulator, has terminator = terminator -x "$@" +mime ^ranger/x-terminal-emulator, has urxvt = urxvt -e "$@" +mime ^ranger/x-terminal-emulator, has pantheon-terminal = pantheon-terminal -e "$@" +mime ^ranger/x-terminal-emulator, has lxterminal = lxterminal -e "$@" +mime ^ranger/x-terminal-emulator, has mate-terminal = mate-terminal -x "$@" +mime ^ranger/x-terminal-emulator, has xfce4-terminal = xfce4-terminal -x "$@" +mime ^ranger/x-terminal-emulator, has konsole = konsole -e "$@" +mime ^ranger/x-terminal-emulator, has gnome-terminal = gnome-terminal -- "$@" +mime ^ranger/x-terminal-emulator, has xterm = xterm -e "$@" + +#------------------------------------------- +# Misc +#------------------------------------------- +label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1" +label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1" +label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1" +label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1" + +#------------------------------------------- +# Generic file openers +#------------------------------------------- +label open, has xdg-open = xdg-open -- "$@" +label open, has open = open -- "$@" + +# Define the editor for non-text files + pager as last action + !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask +label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@" +label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" + + +###################################################################### +# The actions below are left so low down in this file on purpose, so # +# they are never triggered accidentally. # +###################################################################### + +# Execute a file as program/script. +mime application/x-executable = "$1" + +# Move the file to trash using trash-cli. +label trash, has trash-put = trash-put -- "$@" +label trash = mkdir -p -- ${XDG_DATA_DIR:-$HOME/.ranger}/ranger-trash; mv -- "$@" ${XDG_DATA_DIR:-$HOME/.ranger}/ranger-trash @@ -57,3 +57,13 @@ --regex-typescript=/^[ \t]*(export)?[ \t]*interface[ \t]+([a-zA-Z0-9_]+)/\2/i,interfaces/ --regex-typescript=/^[ \t]*(export)?[ \t]*enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enums/ --regex-typescript=/^[ \t]*import[ \t]+([a-zA-Z0-9_]+)/\1/I,imports/ + +--langdef=tf +--langmap=tf:.tf.tfvars +--regex-tf=/^[[:space:]]*resource[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\2/r,Resource/ +--regex-tf=/^[[:space:]]*data[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\2/d,Data/ +--regex-tf=/^[[:space:]]*variable[[:space:]]*"([^"]*)"/\1/v,Variable/ +--regex-tf=/^[[:space:]]*provider[[:space:]]*"([^"]*)"/\1/p,Provider/ +--regex-tf=/^[[:space:]]*module[[:space:]]*"([^"]*)"/\1/m,Module/ +--regex-tf=/^[[:space:]]*output[[:space:]]*"([^"]*)"/\1/o,Output/ +--regex-tf=/^([a-z0-9_]+)[[:space:]]*=/\1/f,TFVar/ @@ -105,7 +105,7 @@ bind ] paste-buffer bind Space choose-buffer # bind C-l send-keys 'C-l' bind -n C-h clear-history -bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log" +bind P pipe-pane -o "cat >>~/.tmuxrecording/#W.log" \; display "Toggled logging to ~/#W.log" #move windows # bind-key -n C-S-Left swap-window -t -1 @@ -6,6 +6,7 @@ set completeopt-=preview set completeopt+=popup set showmatch set list +set listchars=eol:$,tab:>- set hidden set tabstop=2 set conceallevel=1 @@ -35,7 +36,6 @@ set ttyfast set relativenumber set wildignorecase set shm=a -" set wildmode=list:longest,full set wildignore+=*/tmp/*,*.so,*.swp,*.zip set wildmenu set confirm @@ -68,6 +68,7 @@ set smartcase set backspace=indent,eol,start " set cursorcolumn " set exrc +" set wildmode=list:longest,full set viminfo='100,\"500,:50,%,n~/.viminfo highlight clear Search @@ -77,7 +78,7 @@ let g:is_posix = 1 set rtp+=/usr/bin/fzf " set rtp+=/home/bloodstalker/extra/llvm-clang-4/build/bin/clangd " set rtp+=/usr/local/bin/pyls -let g:polyglot_disabled = ['go.plugin','markdown.plugin'] +let g:polyglot_disabled = ['go.plugin', 'markdown.plugin', 'terraform.plugin'] " call plug#begin('~/.vim/plugged') call plug#begin('~/.vim/bundle') @@ -88,7 +89,7 @@ Plug 'mhinz/vim-startify' Plug 'ctrlpvim/ctrlp.vim' Plug 'kh3phr3n/python-syntax' Plug 'VundleVim/Vundle.vim' -Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} +Plug 'scrooloose/nerdtree' Plug 'sickill/vim-pasta' Plug 'adelarsq/vim-matchit' Plug 'makerj/vim-pdf' @@ -171,7 +172,7 @@ Plug 'dbeniamine/cheat.sh-vim' Plug 'wlemuel/vim-tldr' Plug 'congma/vim-compiler-checkbashisms' Plug 'hsanson/vim-openapi' -Plug 'mattn/emmet-vim', {'for': ['html','css','xml','ejs']} +Plug 'mattn/emmet-vim', {'for': ['html','css','xml','ejs','markdown']} Plug 'hail2u/vim-css3-syntax' Plug 'chrisbra/unicode.vim' Plug 'meatballs/vim-xonsh' @@ -181,6 +182,8 @@ Plug 'christoomey/vim-tmux-navigator' Plug 'Shirk/vim-gas' Plug 'roxma/vim-tmux-clipboard' Plug 'wellle/visual-split.vim' +Plug 'zchee/vim-goasm' +Plug 'jvirtanen/vim-hcl' " Plug 'lifepillar/pgsql.vim', {'for': ['sql','pqsl', 'pgsql']} " Plug 'tmux-plugins/vim-tmux' " Plug 'rhysd/vim-gfm-syntax' @@ -431,7 +434,8 @@ augroup END "reserved for tmux use map <F6> <nop> "messes up some other bindings -"nmap Y y$ +nmap Y y$ +vmap Y y$ nnoremap <S-Delete> :bd<CR> nnoremap <leader>c :call clearmatches()<CR> inoremap <c-i> <esc>I @@ -439,6 +443,8 @@ inoremap <c-e> <esc>A nnoremap <leader>t :bel term<CR> "execute current buffer nnoremap <leader>r :!%:p<CR> +"execute current line in bash +nnoremap <leader>rl :.w !bash<CR> augroup GoLangRun autocmd! autocmd FileType go nmap <leader>r <Plug>(go-run) @@ -447,12 +453,18 @@ augroup RustLangRun autocmd! autocmd FileType rust nmap <leader>r :Crun<CR> augroup end +augroup CFamLangRun + autocmd! + autocmd FileType c,cpp nmap <leader>r :make run<CR> +augroup end nnoremap <leader>cd :cd %:p:h<cr> "terminal vim wont do weird things when you paste things in set pastetoggle=<F11> nnoremap <leader>a :ALEToggle<CR> nnoremap <leader>u :GutentagsUpdate<CR> nnoremap <localleader>v :VimtexView<CR> +nnoremap <leader>nn :bn<CR> +nnoremap <leader>pp :bp<CR> nmap [q :col<CR> nmap ]q :cnew<CR> @@ -467,6 +479,7 @@ function! GetBufferList() redir END return buflist endfunction +autocmd FileType markdown,html inoremap <C-b> <br/> function! ToggleList(bufname, pfx) let buflist = GetBufferList() @@ -707,6 +720,26 @@ let g:tagbar_type_markdown = { \ }, \ } +let g:tagbar_type_tf = { + \ 'ctagstype': 'tf', + \ 'kinds': [ + \ 'r:Resource', + \ 'R:Resource', + \ 'd:Data', + \ 'D:Data', + \ 'v:Variable', + \ 'V:Variable', + \ 'p:Provider', + \ 'P:Provider', + \ 'm:Module', + \ 'M:Module', + \ 'o:Output', + \ 'O:Output', + \ 'f:TFVar', + \ 'F:TFVar' + \ ] +\ } + "doxygentoolkit autocmd BufNewFile,BufRead,BufEnter *.sol let g:DoxygenToolkit_briefTag_pre="@dev " @@ -753,7 +786,7 @@ nnoremap <silent> <leader>9 :call HighInterestingWord(9)<cr> nnoremap <silent> <leader>0 :call HighInterestingWord(0)<cr> "scratchpad -let g:scratchpad_path = '.scratchpads' +let g:scratchpad_path = '/home/devi/.scratchpads' nmap <F9> <Plug>(ToggleScratchPad) let g:tagbar_type_rust = { @@ -985,6 +1018,7 @@ highlight vimBufnrWarn ctermbg=16 ctermfg=202 " highlight airline_tabtype ctermbg=15 ctermfg=34 "typos +iab teh the iab strign string iab pritn print iab retrun return @@ -1011,6 +1045,8 @@ let g:netrw_sort_direction = 'normal' let g:vcm_default_maps = 0 autocmd FileType c,cpp let b:vcm_tab_complete = "omni" autocmd FileType lua let b:vcm_tab_complete = "omni" +autocmd FileType go let b:vcm_tab_complete = "omni" +autocmd FileType rust let b:vcm_tab_complete = "omni" autocmd FileType python let b:vcm_tab_complete = "omni" autocmd FileType javasript let b:vcm_tab_complete = "omni" @@ -1198,6 +1234,7 @@ let g:gutentags_plus_nomap = 1 "run Vman for the word under the cursor map <leader>v <Plug>(Vman) autocmd Filetype man setlocal relativenumber +autocmd Filetype man setlocal number "context let g:context_enabled = 0 @@ -1299,7 +1336,21 @@ augroup ALEPY augroup END augroup ALERUBY autocmd! - autocmd FileType python let b:ale_fixers = {'ruby': ['rubo']} + autocmd FileType ruby let b:ale_linters = {'ruby': ['rubocop']} + autocmd FileType ruby let b:ale_fixers = {'ruby': ['rubocop']} + " autocmd FileType ruby let b:ale_fixers = {'ruby': ['rufo']} +augroup END +augroup ALEMARKDOWN + autocmd! + autocmd FileType markdown let b:ale_linters = {'markdown': ['markdownlint']} +augroup END +augroup ALEC + autocmd! + autocmd FileType c let b:ale_linters = {'c': ['clang-tidy']} +augroup END +augroup ALECPP + autocmd! + autocmd FileType cpp let b:ale_linters = {'cpp': ['clang-tidy']} augroup END "latex @@ -0,0 +1,2 @@ +source "$HOME/.cargo/env" +skip_global_compinit=1 @@ -1,11 +1,13 @@ +zmodload zsh/zprof +declare -U path # Path to your oh-my-zsh installation. - export ZSH=/home/devi/.oh-my-zsh +export ZSH=/home/devi/.oh-my-zsh ZSH_THEME="devi" COMPLETION_WAITING_DOTS="true" -plugins=(git zsh-syntax-highlighting autojump virtualenv virtualenvwrapper cargo nvm npm docker rustup zsh-autosuggestions zsh-kubectl-prompt kubectl docker-compose vagrant golang) +plugins=(git zsh-syntax-highlighting autojump virtualenv virtualenvwrapper cargo npm docker rustup zsh-autosuggestions zsh-kubectl-prompt kubectl docker-compose vagrant golang zsh-prompt-benchmark) export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/devi/.local/bin:/home/devi/bin" @@ -16,32 +18,32 @@ autoload -U compinit && compinit -u alias ls="exa" alias la="exa -a" -alias ll="exa -abghHliSmxF --git -@" -alias lss="exa -S" +alias ll="exa -abghHliSmxF --color-scale --git -@" +alias lss="exa -Sls=size" alias ee="nautilus ." alias updaterc="cp ~/scripts/.zshrc ~/.zshrc" alias fixvimrc='cp ~/scripts/.vimrc ~/.vimrc' alias fixtmuxrc='cp ~/scripts/.tmux.conf ~/.tmux.conf' -alias fixtmuxpowerline='cp ~/scripts/default.sh ~/tmux-powerline/themes/default.sh' +# alias fixtmuxpowerline='cp ~/scripts/default.sh ~/tmux-powerline/themes/default.sh' alias fixctagsrc='cp ~/scripts/.ctags ~/.ctags' -alias fixtvrc='cp ~/scripts/.tvrc ~/.tvrc' -alias tmuxpowerline='vim ~/scripts/default.sh' +# alias fixtvrc='cp ~/scripts/.tvrc ~/.tvrc' +# alias tmuxpowerline='vim ~/scripts/default.sh' alias speedtest="curl -o /dev/null http://speedtest.sea01.softlayer.com/downloads/test100.zip" alias zshrc="vim ~/scripts/.zshrc" alias vimrc="vim ~/scripts/.vimrc" alias tmuxrc="vim ~/scripts/.tmux.conf" alias zshtheme="vim ~/scripts/devi.zsh-theme" alias quit="exit" -alias xx="dtrx" -alias angband="/home/devi/angband-4.1.0/angband-master/src/angband" -alias startdocker="sudo systemctl start docker" -alias vv="vim" -alias mm="cmatrix -s -C blue" +# alias xx="dtrx" +# alias angband="/home/devi/angband-4.1.0/angband-master/src/angband" +# alias startdocker="sudo systemctl start docker" +# alias vv="vim" +# alias mm="cmatrix -s -C blue" alias contest="ping 4.2.2.4 -c 7; ping google.com -c 7" -alias solide="vim ~/scripts/makefile" -alias dropsolide="cp ~/scripts/makefile ./" -alias genjctags="find . -type f -iregex \".*\.js$\" -not -path \"./node_modules/*\" -exec jsctags {} -f \; | sed '/^$/d' | sort > tags" -alias isup="ps -aux | grep " +# alias solide="vim ~/scripts/makefile" +# alias dropsolide="cp ~/scripts/makefile ./" +# alias genjctags="find . -type f -iregex \".*\.js$\" -not -path \"./node_modules/*\" -exec jsctags {} -f \; | sed '/^$/d' | sort > tags" +# alias isup="ps -aux | grep " alias ipfsd="ipfs daemon > /dev/null 2>&1 &; disown" alias i3rc="vim ~/scripts/.config/i3/config" alias fixi3rc="cp ~/scripts/.config/i3/config ~/.config/i3/config && i3-msg restart" @@ -51,7 +53,7 @@ alias dropcmake="cp ~/scripts/makefilec ./makefile" alias dropcppmake="cp ~/scripts/makefilecpp ./makefile" alias droppy="cp ~/scripts/python/main.py ./main.py" alias diff="colordiff" -alias yy="~/scripts/hived" +# alias yy="~/scripts/hived" alias newsboaturls="vim ~/scripts/.newsboat/urls" alias fixnewsboaturls="cp ~/scripts/.newsboat/urls ~/.newsboat/urls" alias newsboatconfig="vim ~/scripts/.newsboat/config" @@ -62,12 +64,12 @@ alias dropcextra="cp ~/scripts/c/devi_extra.h ./devi_extra.h" alias dropcmain="cp ~/scripts/c/main.c ./" alias dropcppmain="cp ~/scripts/c/main.cpp ./" alias telebot="/home/devi/scripts/telebot.py > /dev/null 2>&1 &" -alias dw="~/df/df_linux/df" +# alias dw="~/df/df_linux/df" alias clean="clear" alias lynx="lynx -lss ~/scripts/lynx.lss -cfg ~/scripts/lynx.cfg -prettysrc" -alias hplovecraft="lynx http://www.hplovecraft.com/writings/texts/" -alias casmith="lynx http://www.eldritchdark.com/writings/short-stories/" -alias tt="transmission-cli -u 1 -w ~/winshare/" +alias hplovecraft="w3m http://www.hplovecraft.com/writings/texts/" +alias casmith="w3m http://www.eldritchdark.com/writings/short-stories/" +# alias tt="transmission-cli -u 1 -w ~/winshare/" alias w3m="torsocks w3m -graph" #alias make="colormake" #alias gcc="COLORMAKE_COMMAND=gcc colormake" @@ -90,6 +92,8 @@ alias kshrc="vim ~/scripts/.kshrc" alias fixkshrc="cp ~/scripts/.kshrc ~/.kshrc" alias rangerrc="vim ~/scripts/.config/ranger/rc.conf" alias fixrangerrc="cp ~/scripts/.config/ranger/rc.conf ~/.config/ranger/rc.conf" +alias riflerc="vim ~/scripts/.config/ranger/rifle.conf" +alias fixriflerc="cp ~/scripts/.config/ranger/rifle.conf ~/.config/ranger/rifle.conf" alias zathurarc="vim ~/scripts/zathurarc" alias fixzathurarc="cp ~/scripts/zathurarc ~/.config/zathura/" alias lynxcfg="cp ~/scripts/lynx.cfg" @@ -155,45 +159,45 @@ ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd history completion) ZSH_AUTOSUGGEST_USE_ASYNC=1 ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=30 -function lemon { +lemon() { /home/devi/scripts/lemonbar.sh | lemonbar -f "DejaVu Sans Mono for Powerline:size=11" -g "x16" } -function docpp { +docpp() { cp ~/scripts/makefilecpp ./makefile cp ~/scripts/c/main.cpp ./ cp ~/scripts/c/header.hpp ./ - cp ~/scripts/.ycm_extra_config.py ./.ycm_extra_conf.py - cp ~/scripts/cfam.vimrc ./.vimrc - cp ~/scripts/compiler-explorer/ceconfig.json ./ - cp ~/scripts/c/debug.dbg ./ + # cp ~/scripts/.ycm_extra_config.py ./.ycm_extra_conf.py + # cp ~/scripts/cfam.vimrc ./.vimrc + # cp ~/scripts/compiler-explorer/ceconfig.json ./ + # cp ~/scripts/c/debug.dbg ./ } -function docc { +docc() { cp ~/scripts/makefilec ./makefile cp ~/scripts/c/main.c ./ - cp ~/scripts/.ycm_extra_config.py ./.ycm_extra_conf.py - cp ~/scripts/cfam.vimrc ./.vimrc - cp ~/scripts/compiler-explorer/ceconfig.json ./ - cp ~/scripts/c/debug.dbg ./ + # cp ~/scripts/.ycm_extra_config.py ./.ycm_extra_conf.py + # cp ~/scripts/cfam.vimrc ./.vimrc + # cp ~/scripts/compiler-explorer/ceconfig.json ./ + # cp ~/scripts/c/debug.dbg ./ } -function mdvv { +mdvv() { mdv -t 729.8953 "$@" } -function gdd { +gdd() { #git --no-pager diff --numstat | gawk \'{print$1$2}\' git --no-pager diff --numstat | gawk '{sum1+=$1;sum2+=$2}END{print "additions:"sum1" ""deletions:"sum2}' } -function math { +math() { echo $(($@)) } -function pid { - ps -aux | grep "$1" | grep -v grep | awk '{print$2}' -} +# function pid { +# ps -aux | grep "$1" | grep -v grep | awk '{print$2}' +# } #bicon_on=$(ps -aux | grep bicon | grep -v grep | awk '{print$2}') #if [[ -z "${bicon_on// }" ]]; then @@ -232,14 +236,16 @@ export YTFZF_PREF="22" export YTFZF_ENABLE_FZF_DEFAULT_OPTS=1 export YTFZF_CACHE=~/.cache/ytfzf -function fixrc { +fixrc() { cp ~/scripts/.zshrc ~/.zshrc - source ~/.zshrc + # source ~/.zshrc + exec zsh } -function fixtheme { +fixtheme() { cp ~/scripts/devi.zsh-theme ~/.oh-my-zsh/themes/devi.zsh-theme - source ~/.zshrc + # source ~/.zshrc + exec zsh } export PATH=$PATH:/home/devi/.cargo/bin @@ -262,7 +268,7 @@ export PATH=$PATH:/home/devi/devi/ghorg export EDITOR=vim export BROWSER=w3m -function dig { +dig() { globalholecounter=0 if test "$("ls" -A "/home/devi/devi/abbatoir")"; then while [ 1 ]; do @@ -290,9 +296,9 @@ function dig { fi } -function clearhalf { +clearhalf() { clear - size=$(stty size|gawk '{print$1}') + local size=$(stty size|gawk '{print$1}') size=$(($size/2)) tput cup $size 0 && tput ed } @@ -301,34 +307,33 @@ alias halfclear="clearhalf" alias halfclean="clearhalf" alias dighalf="dig && cleanhalf" -function nn { - echo $1 >> ~/.devi/notes.txt -} +# function nn { +# echo $1 >> ~/.devi/notes.txt +# } -function nnshow { - cat ~/.devi/notes.txt -} +# function nnshow { +# cat ~/.devi/notes.txt +# } -function nnedit { - vim ~/.devi/notes.txt -} +# function nnedit { +# vim ~/.devi/notes.txt +# } -function nnpurge { - rm ~/.devi/notes.txt -} +# function nnpurge { +# rm ~/.devi/notes.txt +# } -function lxx { - readable $1 | lynx -stdin -} +# function lxx { +# readable $1 | lynx -stdin +# } bindkey -v set blink-matching-paren on export KEYTIMEOUT=1 export VIRTUAL_ENV_DISABLE_PROMPT=yes -#nvm -export NVM_DIR="/home/devi/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" +# fnm +eval "$(fnm env)" # OPAM configuration . /home/devi/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true @@ -346,11 +351,11 @@ export NVM_DIR="/home/devi/.nvm" [[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm" # jellybeans takes forever to load. iceberg is very fast. -function vman { +vman() { vim -c "Man $1 $2" -c 'silent only' -c 'colo iceberg' -c 'highlight Normal ctermbg=None' -c 'highlight lineNr ctermbg=16' -c 'hi EndOfBuffer ctermbg=16' } -function ddig { +ddig() { if [[ "$2" == "" ]];then docker exec -it $(docker ps | grep "\b$1\b" | gawk '{print $1}') bash else @@ -358,12 +363,17 @@ function ddig { fi } -fd() { - preview="git diff $@ --color=always -- {-1}" - git diff $@ --name-only | fzf -m --ansi --preview $preview +timezsh() { + local shell=${1-$SHELL} + for i in $(seq 1 10); do /usr/bin/time $shell -i -c exit; done } -function pod2w3m { +# fd() { +# preview="git diff $@ --color=always -- {-1}" +# git diff $@ --name-only | fzf -m --ansi --preview $preview +# } + +pod2w3m() { pod2html $1 | w3m -T text/html } @@ -381,12 +391,17 @@ setopt HIST_VERIFY setopt SHARE_HISTORY setopt AUTO_CD setopt AUTO_PUSHD +setopt NO_BEEP +setopt INTERACTIVE_COMMENTS +# no more C-s and C-q +unsetopt FLOW_CONTROL +setopt LONG_LIST_JOBS # eval "$(goenv init -)" # export PATH="$GOROOT/bin:$PATH" # export PATH="$PATH:$GOPATH/bin" -function fzf_postit() { +fzf_postit() { cat ~/scripts/postit | fzf-tmux -p 70%,70% -- --bind 'enter:execute(tmux set-buffer {})+accept' } @@ -394,17 +409,20 @@ function fzf_postit() { # this should be here before the end bindkey ' -bindkey -s '' 'fzf_postit
' +# bindkey -s '' 'fzf_postit
' +zle -N fzf_postit +bindkey '' fzf_postit is_in_git_repo() { git rev-parse HEAD > /dev/null 2>&1 } fzf-down() { - fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@" + fzf-tmux -p 80%,80% -- --bind ctrl-/:toggle-preview "$@" } -_gf() { +# these i stole from junegunn to try out +fzf_gf() { is_in_git_repo || return git -c color.status=always status --short | fzf-down -m --ansi --nth 2..,.. \ @@ -412,7 +430,7 @@ _gf() { cut -c4- | sed 's/.* -> //' } -_gb() { +fzf_gb() { is_in_git_repo || return git branch -a --color=always | grep -v '/HEAD\s' | sort | fzf-down --ansi --multi --tac --preview-window right:70% \ @@ -421,14 +439,14 @@ _gb() { sed 's#^remotes/##' } -_gt() { +fzf_gt() { is_in_git_repo || return git tag --sort -version:refname | fzf-down --multi --preview-window right:70% \ --preview 'git show --color=always {}' } -_gh() { +fzf_gm() { is_in_git_repo || return git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always | fzf-down --ansi --no-sort --reverse --multi --bind 'ctrl-s:toggle-sort' \ @@ -437,20 +455,40 @@ _gh() { grep -o "[a-f0-9]\{7,\}" } -_gr() { +fzf_gr() { is_in_git_repo || return - git remote -v | awk '{print $1 "\t" $2}' | uniq | + git remote -v | gawk '{print $1 "\t" $2}' | uniq | fzf-down --tac \ --preview 'git log --oneline --graph --date=short --pretty="format:%C(auto)%cd %h%d %s" {1}' | cut -d$'\t' -f1 } -_gs() { +fzf_gs() { is_in_git_repo || return git stash list | fzf-down --reverse -d: --preview 'git show --color=always {1}' | cut -d: -f1 } +join-lines() { + local item + while read item; do + echo -n "${(q)item} " + done +} + +bind-git-helper() { + local c + for c in $@; do + eval "fzf-g$c-widget() { local result=\$(fzf_g$c | join-lines); zle reset-prompt; LBUFFER+=\$result }" + eval "zle -N fzf-g$c-widget" + eval "bindkey '^g^$c' fzf-g$c-widget" + done +} +bindkey -r "" +# bindkey -r "^H" +bind-git-helper f b t r m s +unset -f bind-git-helper + fshow() { local out shas sha q k while out=$( @@ -471,6 +509,7 @@ fshow() { fi done } + export LESS_TERMCAP_mb=$'\e[01;31m' # begin blinking export LESS_TERMCAP_md=$'\e[01;38;5;74m' # begin bold export LESS_TERMCAP_me=$'\e[0m' # end mode @@ -478,3 +517,23 @@ export LESS_TERMCAP_se=$'\e[0m' # end standout-mode export LESS_TERMCAP_so=$'\e[38;5;246m' # begin standout-mode - info box export LESS_TERMCAP_ue=$'\e[0m' # end underline export LESS_TERMCAP_us=$'\e[04;38;5;146m' # begin underline +# handle the format of the zsh built-in time +TIMEFMT="'$fg[green]%J$reset_color' time: $fg[blue]%*Es$reset_color, cpu: $fg[blue]%P$reset_color" + +# using Q instead of q in range quits but also cds to where you last where in ranger +# https://github.com/ranger/ranger/wiki/Integration-with-other-programs#changing-directories +ranger() { + local IFS=$'\t\n' + local tempfile="$(mktemp -t tmp.XXXXXX)" + local ranger_cmd=( + command + ranger + --cmd="map Q chain shell echo %d > "$tempfile"; quitall" + ) + + ${ranger_cmd[@]} "$@" + if [[ -f "$tempfile" ]] && [[ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]]; then + cd -- "$(cat "$tempfile")" || return + fi + command rm -f -- "$tempfile" 2>/dev/null +} diff --git a/bin/pdf2mp3 b/bin/pdf2mp3 new file mode 100755 index 0000000..3c9946c --- /dev/null +++ b/bin/pdf2mp3 @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +# first run this +# docker run -p 9977:9998 apache/tika:2.0.0 +# export export TIKA_SERVER_ENDPOINT="http://127.0.0.1:9977" +# finally run the script +import argparse +from gtts import gTTS +from tika import parser + + +class Argparser(): + def __init__(self): + parser = argparse.ArgumentParser() + parser.add_argument( + "--pdf", + type=str, help="path to the pdf") + parser.add_argument("--bool", action="store_true", + help="bool", default=False) + self.args = parser.parse_args() + + +def main() -> None: + argparser = Argparser() + raw = parser.from_file(argparser.args.pdf) + print(raw['content']) + tts = gTTS(raw['content']) + tts.save("out.mp3") + + +if __name__ == "__main__": + main() diff --git a/devi.zsh-theme b/devi.zsh-theme index 1e68d7e..2c754f3 100644 --- a/devi.zsh-theme +++ b/devi.zsh-theme @@ -4,13 +4,19 @@ # git untracked files modification from Brian Carper: # http://briancarper.net/blog/570/git-info-in-your-zsh-prompt -function virtualenv_info { - if [[ -a ./bin/activate ]]; then - source ./bin/activate > /dev/null +virtualenv_info() { + # if [[ -a ./bin/activate ]]; then + # source ./bin/activate > /dev/null + # fi + # [ $VIRTUAL_ENV ] && echo ' ('`basename $VIRTUAL_ENV`')' + if [[ $VIRTUAL_ENV != "" ]];then + local result=$(basename $VIRTUAL_ENV) + echo " ($result)" + else + ; fi - [ $VIRTUAL_ENV ] && echo ' ('`basename $VIRTUAL_ENV`') ' } -#add-zsh-hook chpwd virtualenv_info +# add-zsh-hook chpwd virtualenv_info PR_GIT_UPDATE=1 @@ -35,6 +41,8 @@ if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then swampgreen="%F{64}" purple4="%F{54}" deeppink="%F{109}" + someblue="%F{27}" + bluesomething="%F{25}" limblue="%F{154}" skyblue="%F{30}" teal="%F{31}" @@ -47,6 +55,8 @@ if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then rust="%F{36}" typescript="%F{37}" viinsert="%F{33}" + veryorange="%F{202}" + yablue="%F{32}" else turquoise="$fg[cyan]" orange="$fg[yellow]" @@ -63,7 +73,7 @@ zstyle ':vcs_info:*' enable git svn # check-for-changes can be really slow. # you should disable it, if you work with large repositories -#zstyle ':vcs_info:*:prompt:*' check-for-changes true +zstyle ':vcs_info:*:prompt:*' check-for-changes true # set formats # %b - branchname @@ -84,8 +94,11 @@ zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" zstyle ':vcs_info:*:prompt:*' nvcsformats "" +is_in_git_repo() { + git rev-parse HEAD > /dev/null 2>&1 +} -function steeef_preexec { +steeef_preexec() { #case "$(history $HISTCMD)" in case "$2" in *git*) @@ -98,9 +111,10 @@ function steeef_preexec { } add-zsh-hook preexec steeef_preexec -function steeef_chpwd { +steeef_chpwd() { + # is_in_git_repo || return #this is here so we dont get errors when we are in a bare git dir - result=$(git rev-parse --is-bare-repository 2> /dev/null) + local result=$(git rev-parse --is-bare-repository 2> /dev/null) if [[ $? == 0 ]]; then if [[ $result == true ]]; then PR_GIT_UPDATE= @@ -113,12 +127,12 @@ function steeef_chpwd { } add-zsh-hook chpwd steeef_chpwd -function steeef_precmd { +steeef_precmd() { if [[ -n "$PR_GIT_UPDATE" ]] ; then # check for untracked files or updated submodules, since vcs_info doesn't if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then PR_GIT_UPDATE=1 - FMT_BRANCH="${PM_RST} on %{$turquoise%}%s-➜%r-➜%b%u%c%a%{$hotpink%} ●${PR_RST} " + FMT_BRANCH="${PM_RST} on %{$turquoise%}%s-➜%r-➜%b%u%c%a%{$hotpink%} ●${PR_RST}" else FMT_BRANCH="${PM_RST} on %{$turquoise%}%s-➜%r-➜%b%u%c%a${PR_RST} " fi @@ -130,132 +144,170 @@ function steeef_precmd { } add-zsh-hook precmd steeef_precmd -function guess_who { - upower -e > /dev/null 2>&1 +# function guess_who { +# upower -e > /dev/null 2>&1 - if [ $? -eq 0 ]; then - os="lin" - else - os="win" - fi -} -add-zsh-hook precmd guess_who +# if [ $? -eq 0 ]; then +# os="lin" +# else +# os="win" +# fi +# } +# add-zsh-hook precmd guess_who -function time_function { - $guess_who - if [[ "$os" = "win" ]]; then - date | gawk 'BEGIN{RS=","}END{print $2" "$3}' - else - date | gawk '{print $4" "$5}' - fi +time_function() { + date | gawk '{print $2" "$3" "$4}' } - -function node_version { - nvm current +# function time_function { +# $guess_who +# if [[ "$os" = "win" ]]; then +# date | gawk 'BEGIN{RS=","}END{print $2" "$3}' +# else +# date | gawk '{print $4" "$5}' +# fi +# } + +node_version() { + local version=$(fnm current) + echo " <$version>" } -function sudo_query { +sudo_query() { sudo -nv > /dev/null 2>&1 if [[ $? == 0 ]]; then #echo echo " " else - : + ; fi } -function dir_writeable { - if [ -w $(pwd) ]; then :;else echo ;fi +dir_writeable() { + if [ -w $(pwd) ]; then :;else echo " ";fi } -function sneaky { +sneaky() { if [[ $! -ne 0 ]]; then - echo $! + echo " $!" fi } -function gitadditions { +bg_job_count() { + local count=$(jobs | wc -l) + if [[ $count > 0 ]];then + echo " $count" + else + ; + fi +} + +gitadditions() { + # is_in_git_repo || return git rev-parse --git-dir > /dev/null 2>&1 if [[ $? == 0 ]]; then - insertions=$(git --no-pager diff --numstat 2> /dev/null | awk '{sum1+=$1}END{print sum1}') + local insertions=$(git --no-pager diff --numstat 2> /dev/null | awk '{sum1+=$1}END{print sum1}') if [[ $insertions == "" ]]; then - : + ; else echo " "$insertions: fi fi } -function gitdeletions { +gitdeletions() { + # is_in_git_repo || return git rev-parse --git-dir > /dev/null 2>&1 if [[ $? == 0 ]]; then - deletions=$(git --no-pager diff --numstat 2> /dev/null | awk '{sum2+=$2}END{print sum2}') + local deletions=$(git --no-pager diff --numstat 2> /dev/null | awk '{sum2+=$2}END{print sum2}') if [[ $deletions == "" ]]; then - : + ; else - echo $deletions" " + echo $deletions fi fi } -function goversion { - VERSION=$("go" version | gawk '{print $3}') - echo ${VERSION:2:$((${#VERSION}))} +goversion() { + local version=$("go" version | gawk '{print $3}') + echo " <${version:2:$((${#version}))}>" } -function rustversion { - VERSION=$(rustc --version | gawk '{print $2}') - echo $VERSION +rustversion() { + local version=$(rustc --version | gawk '{print $2}') + echo " <$version>" } -function typescriptversion { - VERSION=$(tvm tsc --version | gawk '{print $2}') - echo $VERSION +typescriptversion() { + local version=$(tvm tsc --version | gawk '{print $2}') + echo " <$version>" } -PROMPT=$'%{$new2%}$(sudo_query)%{$reset_color%}%{$swampgreen%}%n%{$reset_color%} on %{$purblue%}%M%{$reset_color%} in %{$limegreen%}%/%{$reset_color%} at %{$muckgreen%}$(time_function)%{$reset_color%}$(ruby_prompt_info " with%{$fg[red]%} " v g "%{$reset_color%}")$vcs_info_msg_0_%{$limblue%}%{$gnew%}$(gitadditions)%{$gnew2%}$(gitdeletions)%{$reset_color%}%{$deeppink%}$(virtualenv_info)%{$reset_color%} %{$teal%}<$(node_version)>%{$reset_color%} %{$gover%}<$(goversion)>%{$reset_color%} %{$rust%}<$(rustversion)>%{$reset_color%} %{$sneakyc%}$(sneaky)%{$reset_color%} %{$new%}$(rebuildquery)%{$reset_color%} %{$someblue%}<$ZSH_KUBECTL_PROMPT>%{$reset_color%}%{$batred%}$(dir_writeable)%{$reset_color%} \n%{$limblue%}--➜%{$reset_color%}' - -function battery_charge { - upower -e > /dev/null 2>&1 - - if [ $? -eq 0 ]; then - batpath=$(upower -e | grep BAT0) - batcharge=$(upower -i $batpath | grep percentage | gawk '{print $2}') - else - batcharge=$(wmic path win32_battery get estimatedchargeremaining | gawk 'BEGIN{RS=" \n"}{print$3}') - fi - - batfull=100 - batgood=66 - batbad=33 - - batcolor=$batgreen - - if [[ ($batcharge > $batgood) || ($batcharge == $batgood) || ("$batcharge"=="$batfull") ]]; then - batcolor=$batgreen - elif [[ ($batcharge < $batgood) && ($batcharge > $batbad) || ($batcharge == $batbad) ]]; then - batcolor=$batyellow - elif [[ ($batcharge < $batbad) ]]; then - batcolor=$batred +PROMPT=$'%{$new2%}$(sudo_query)%{$reset_color%}%{$swampgreen%}%n%{$reset_color%} on %{$purblue%}%M%{$reset_color%} in %{$limegreen%}%/%{$reset_color%} at %{$muckgreen%}$(time_function)%{$reset_color%}$vcs_info_msg_0_%{$limblue%}%{$gnew%}$(gitadditions)%{$gnew2%}$(gitdeletions)%{$reset_color%}%{$deeppink%}$(virtualenv_info)%{$reset_color%}%{$teal%}$(node_version)%{$reset_color%}%{$gover%}$(goversion)%{$reset_color%}%{$rust%}$(rustversion)%{$reset_color%}%{$sneakyc%}$(sneaky)%{$reset_color%}%{$new%}$(rebuildquery)%{$reset_color%} %{$someblue%}<$ZSH_KUBECTL_PROMPT>%{$reset_color%}%{$batred%}$(dir_writeable)%{$reset_color%}\n%{$limblue%}--➜%{$reset_color%}' + +# function battery_charge { +# upower -e > /dev/null 2>&1 + +# if [ $? -eq 0 ]; then +# batpath=$(upower -e | grep BAT0) +# batcharge=$(upower -i $batpath | grep percentage | gawk '{print $2}') +# else +# batcharge=$(wmic path win32_battery get estimatedchargeremaining | gawk 'BEGIN{RS=" \n"}{print$3}') +# fi + +# batfull=100 +# batgood=66 +# batbad=33 + +# batcolor=$batgreen + +# if [[ ($batcharge > $batgood) || ($batcharge == $batgood) || ("$batcharge"=="$batfull") ]]; then +# batcolor=$batgreen +# elif [[ ($batcharge < $batgood) && ($batcharge > $batbad) || ($batcharge == $batbad) ]]; then +# batcolor=$batyellow +# elif [[ ($batcharge < $batbad) ]]; then +# batcolor=$batred +# else +# batcolor=$purple +# fi +# } +# add-zsh-hook precmd battery_charge + +# function batcharge_printer { +# $battery_charge +# echo $(if [ $(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep state | gawk 'BEGIN{FS ~ ":"}{print $2}') = "charging" ]; then echo ++;else :;fi)$batcharge +# } + +rebuildquery() { + make -q > /dev/null 2>&1 + if [[ $? == 1 ]]; then + echo " ::rebuild::" else - batcolor=$purple + ; fi } -add-zsh-hook precmd battery_charge -function batcharge_printer { - $battery_charge - echo $(if [ $(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep state | gawk 'BEGIN{FS ~ ":"}{print $2}') = "charging" ]; then echo ++;else :;fi)$batcharge +inranger() { + local ranger_prompt=$(if [ -n "$RANGER_LEVEL" ];then echo " <ranger>";else echo "";fi) + echo $ranger_prompt } -function rebuildquery { - make -q > /dev/null 2>&1 - if [[ $? == 1 ]]; then - echo ::rebuild:: - else - : +timer_preexec() { + typeset -g -F SECONDS + timer=${timer:-$SECONDS} +} +add-zsh-hook preexec timer_preexec + +timer_precmd() { + if [ $timer ]; then + timer_show=$(($SECONDS - $timer)) + timer_show=$((timer_show*1000)) + typeset -g -i timer_show_int + timer_show_int=$timer_show + timer_final="$timer_show_int"mS + unset timer fi } +add-zsh-hook precmd timer_precmd #function vi-replacee { # RPS1="$VIM_PROMPT_REPLACE %{$lorange%}%?↵%{$reset_color%} %{$batcolor%}$(batcharge_printer)%%{$reset_color%}" @@ -270,25 +322,26 @@ function rebuildquery { source ~/.oh-my-zsh/plugins/zle-vi-visual/zle_vi_visual.zsh function zle-line-init zle-keymap-select { -VIM_PROMPT_INSERT="%{$fg_bold[cyan]%}% [% INS]% %{$reset_color%}" -VIM_PROMPT_MAIN="%{$fg_bold[blue]%}% [% INSERT]% %{$reset_color%}" -VIM_PROMPT_REPLACE="%{$fg_bold[black]%}% %{$bg_bold[red]%}% [% REPLACE]% %{$reset_color%}" -VIM_PROMPT_VISUAL_LINE="%{$fg_bold[red]%}% [% VISUAL-LINE]% %{$reset_color%}" -VIM_PROMPT_VISUAL_CHAR="%{$fg_bold[red]%}% [% VISUAL]% %{$reset_color%}" -VIM_PROMPT_CMD="%{$fg_bold[green]%}% [% NORMAL]% %{$reset_color%}" -if [[ $KEYMAP == vivis ]]; then - RPS1="$VIM_PROMPT_VISUAL_CHAR %{$lorange%}%?↵%{$reset_color%} %{$batcolor%}$(batcharge_printer)%%{$reset_color%}" -elif [[ $KEYMAP == vivli ]]; then - RPS1="$VIM_PROMPT_VISUAL_LINE %{$lorange%}%?↵%{$reset_color%} %{$batcolor%}$(batcharge_printer)%%{$reset_color%}" -elif [[ $KEYMAP == vicmd ]];then - RPS1="$VIM_PROMPT_CMD %{$lorange%}%?↵%{$reset_color%} %{$batcolor%}$(batcharge_printer)%%{$reset_color%}" -elif [[ $KEYMAP == viins ]]; then - RPS1="$VIM_PROMPT_INSERT %{$lorange%}%?↵%{$reset_color%} %{$batcolor%}$(batcharge_printer)%%{$reset_color%}" -elif [[ $KEYMAP == main ]]; then - RPS1="$VIM_PROMPT_MAIN %{$lorange%}%?↵%{$reset_color%} %{$batcolor%}$(batcharge_printer)%%{$reset_color%}" - VI_MODE_R_ENTERED="no" -fi -zle reset-prompt + RIGHT_PROMPT="%{$teal%}$timer_final%{$reset_color%} %{$lorange%}%?↵%{$reset_color%}%{$veryorange%}$(bg_job_count)%{$reset_color%}%{$bluesomething%}$(inranger)%{$reset_color%}" + VIM_PROMPT_INSERT="%{$fg_bold[cyan]%}% [% INS]% %{$reset_color%}" + VIM_PROMPT_MAIN="%{$fg_bold[blue]%}% [% INSERT]% %{$reset_color%}" + VIM_PROMPT_REPLACE="%{$fg_bold[black]%}% %{$bg_bold[red]%}% [% REPLACE]% %{$reset_color%}" + VIM_PROMPT_VISUAL_LINE="%{$fg_bold[red]%}% [% VISUAL-LINE]% %{$reset_color%}" + VIM_PROMPT_VISUAL_CHAR="%{$fg_bold[red]%}% [% VISUAL]% %{$reset_color%}" + VIM_PROMPT_CMD="%{$fg_bold[green]%}% [% NORMAL]% %{$reset_color%}" + if [[ $KEYMAP == vivis ]]; then + RPS1="$VIM_PROMPT_VISUAL_CHAR $RIGHT_PROMPT" + elif [[ $KEYMAP == vivli ]]; then + RPS1="$VIM_PROMPT_VISUAL_LINE $RIGHT_PROMPT" + elif [[ $KEYMAP == vicmd ]];then + RPS1="$VIM_PROMPT_CMD $RIGHT_PROMPT" + elif [[ $KEYMAP == viins ]]; then + RPS1="$VIM_PROMPT_INSERT $RIGHT_PROMPT" + elif [[ $KEYMAP == main ]]; then + RPS1="$VIM_PROMPT_MAIN $RIGHT_PROMPT" + VI_MODE_R_ENTERED="no" + fi + zle reset-prompt } zle -N zle-line-init @@ -296,4 +349,3 @@ zle -N zle-keymap-select #bindkey "^[[3~" delete-char #bindkey "^[3;5~" delete-char export KEYTIMEOUT=1 - diff --git a/docker/ipfs.sh b/docker/ipfs.sh new file mode 100755 index 0000000..ea1c717 --- /dev/null +++ b/docker/ipfs.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +IPFS_STAGING="/home/devi/.ipfs/staging";IPFS_DATA="/home/devi/.ippfs/data";docker run -d --name ipfs_host -v $IPFS_STAGING:/export -v $IPFS_DATA:/data/ipfs -p 4001:4001 -p 8881:8080 -p 5001:5001 ipfs/go-ipfs:latest diff --git a/irssi/config b/irssi/config index af19c09..f8a482e 100644 --- a/irssi/config +++ b/irssi/config @@ -1,3 +1,4 @@ +# vim: filetype=perl servers = ( { address = "irc.gitter.im"; @@ -14,7 +15,13 @@ servers = ( use_tls = "no"; tls_verify = "no"; autoconnect = "yes"; - } + }, + { + address = "irc.libera.chat"; + chatnet = "libera"; + autoconnect = "yes"; + }, + { address = "irc.oftc.net"; chatnet = "oftc"; autoconnect = "yes"; } ); chatnets = { @@ -22,14 +29,15 @@ chatnets = { OFTC = { type = "IRC"; max_kicks = "1"; max_msgs = "1"; max_whois = "1"; }; gitter = { type = "IRC"; nick = "terminaldweller"; }; "app.slack.com" = { type = "IRC"; nick = "terminaldweller"; }; - "FRRRouting.slack.com" = { type = "IRC"; }; "FRRouting.slack.com" = { type = "IRC"; }; }; channels = ( - { name = "#go-nuts"; chatnet = "freenode"; autojoin = "yes"; }, - { name = "#docker"; chatnet = "freenode"; autojoin = "yes"; }, - { name = "#dpdk"; chatnet = "libera"; autojoin = "yes"; } + { name = "#dpdk"; chatnet = "libera"; autojoin = "yes"; }, + { name = "#qemu"; chatnet = "libera"; autojoin = "yes"; }, + { name = "#fdio-vpp"; chatnet = "libera"; autojoin = "yes"; }, + { name = "#openssl"; chatnet = "libera"; autojoin = "yes"; }, + { name = "#kvm"; chatnet = "libera"; autojoin = "yes"; } ); aliases = { @@ -319,6 +327,13 @@ statusbar = { barend = { priority = "100"; alignment = "right"; }; }; }; + awl_1 = { + items = { + barstart = { priority = "100"; }; + awl_1 = { }; + barend = { priority = "100"; alignment = "right"; }; + }; + }; }; }; settings = { @@ -357,7 +372,7 @@ settings = { usercount_show_ircops = "ON"; usercount_show_zero = "ON"; timezones_divider = " %Zeeeeee%Z008080 "; - timezones = "GMT:GMT EST:EST UTC:UTC"; + timezones = "GMT:GMT EST:EST CET:CET Tehran:Asia/Tehran Tokyo:Asia/Tokyo Montreal:America/Montreal Pacific:America/Los_Angeles Paris:Europe/Paris"; # hilite_url url_color = "38;5;6"; }; @@ -376,5 +391,7 @@ ignores = ( { level = "JOINS PARTS QUITS NICKS"; channels = ( "#neomutt" ); }, { level = "JOINS PARTS QUITS NICKS"; channels = ( "#kvm" ); }, { level = "JOINS PARTS QUITS NICKS"; channels = ( "#qemu" ); }, - { level = "JOINS PARTS QUITS NICKS"; channels = ( "#vagrant" ); } + { level = "JOINS PARTS QUITS NICKS"; channels = ( "#vagrant" ); }, + { level = "JOINS PARTS QUITS NICKS"; channels = ( "#openssl" ); }, + { level = "JOINS PARTS QUITS NICKS"; channels = ( "#crypto" ); } ); diff --git a/irssi/startup b/irssi/startup index c09f401..af4706d 100644 --- a/irssi/startup +++ b/irssi/startup @@ -7,5 +7,5 @@ /* /EVAL SET proxy_string CONNECT %s:%d HTTP/1.0\n\n */ /* /SET -clear proxy_password */ -/connect irc.oftc.net -/connect irc.libera.chat +/* /connect irc.oftc.net */ +/* /connect irc.libera.chat */ diff --git a/tmux/date.sh b/tmux/date.sh index 4c26bbc..c272d07 100755 --- a/tmux/date.sh +++ b/tmux/date.sh @@ -14,7 +14,7 @@ UTC_TIME="#[fg=colour255 bg=colour25]"$(echo GMT: $UTC_TIME_RESULT) # JDATE="#[fg=colour255 bg=colour29]"$(jdate | gawk '{print $2" "$3}') JDATE="#[fg=colour255 bg=colour29]"$(jdate | gawk '{print $2" "$3}') OPENWEATHERMAP_TOKEN=$(cat /home/devi/scripts/tmux/openweathermap.json|jq -r ".token") -WEATHER_INFO=$(curl "https://api.openweathermap.org/data/2.5/weather?q=Tehran&appid=$OPENWEATHERMAP_TOKEN&units=metric"|jq ".main.temp") +WEATHER_INFO=$(sleep 120 && curl "https://api.openweathermap.org/data/2.5/weather?q=Tehran&appid=$OPENWEATHERMAP_TOKEN&units=metric"|jq ".main.temp") WEATHER="#[fg=colour255 bg=colour32]"$(echo $WEATHER_INFO" C") echo "#[fg=colour32 bg=colour16]$SEPARATOR_LEFT_BOLD$WEATHER#[fg=colour29 bg=colour32]$SEPARATOR_LEFT_BOLD$JDATE #[fg=colour31 bg=colour29]$SEPARATOR_LEFT_BOLD$DAY $SEPARATOR_LEFT_THIN $DATE $SEPARATOR_LEFT_THIN $TIME #[fg=colour25 bg=colour31]$SEPARATOR_LEFT_BOLD$UTC_TIME " |