From 5940d14ddbdb6f68869f48351083875b11b6abf7 Mon Sep 17 00:00:00 2001 From: Vikas Kushwaha Date: Fri, 7 Feb 2025 18:03:41 +0530 Subject: preview updates --- .config/X11/xinitrc | 2 - .config/X11/xprofile | 8 +- .config/infokey | 4 + .config/ipython/profile_default/history.sqlite | Bin 294912 -> 303104 bytes .../workspaces/default-37a8.jupyterlab-workspace | 2 +- .config/lf/lfrc | 14 +- .config/nvim/dev.vim | 3 +- .config/nvim/init.vim | 11 +- .config/picom.conf | 322 +++++++++++++++++++++ .config/sdcv_ordering | 5 + .config/shell/aliasrc | 4 +- .config/shell/bm-dirs | 5 +- .config/shell/profile | 47 +-- .config/starship.toml | 142 +++++++++ .config/ytignore | 6 + .config/zsh/.zshrc | 46 ++- .gitignore | 34 ++- .local/bin/development/ipy | 6 +- .local/bin/development/rh | 5 + .local/bin/fcode | 8 +- .local/bin/fgrp | 15 +- .local/bin/fm | 6 +- .local/bin/fmd | 27 +- .local/bin/fpm | 8 +- .local/bin/fw | 5 +- .local/bin/open | 6 +- .local/bin/preview | 9 +- .local/bin/search | 62 ---- .local/bin/searchdb | 35 --- .local/bin/shorts/preview-bat | 3 - .local/bin/shorts/preview-highlight | 3 - .local/bin/text-preview | 23 ++ 32 files changed, 676 insertions(+), 200 deletions(-) create mode 100644 .config/infokey create mode 100644 .config/picom.conf create mode 100644 .config/sdcv_ordering create mode 100644 .config/starship.toml create mode 100644 .config/ytignore create mode 100755 .local/bin/development/rh delete mode 100755 .local/bin/search delete mode 100755 .local/bin/searchdb delete mode 100755 .local/bin/shorts/preview-bat delete mode 100755 .local/bin/shorts/preview-highlight create mode 100755 .local/bin/text-preview diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc index fa3fac4..3437699 100644 --- a/.config/X11/xinitrc +++ b/.config/X11/xinitrc @@ -24,8 +24,6 @@ # unset f # fi -printf "\n%s\n" "~/xinitrc loaded." >> ~/.local/state/xprofile.logs - if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" ]; then . "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" else diff --git a/.config/X11/xprofile b/.config/X11/xprofile index 3e71b20..46c2b18 100644 --- a/.config/X11/xprofile +++ b/.config/X11/xprofile @@ -2,16 +2,16 @@ # gui -e -echo "Sourced: $(date)" >> ~/.local/state/xprofile.logs - xrdb "${XDG_CONFIG_HOME:-$HOME/.config}/X11/Xresources" & xrdbpid=$! numlockx on & +logdir="${XDG_STATE_HOME:-$HOME/.local/state}/startup" autostart="copyq dunst pipewire syncthing remapd gammastep setdp prime-offload" +mkdir -pv "$logdir" for program in $autostart; do - pidof -sx "$program" || "$program" & -done >/dev/null 2>&1 + pidof -sx "$program" || "$program" >"$logdir/$program.stdout.log" 2>"$logdir/$program.stderr.log" & +done { sleep 5; wireplumber; } & [ -n "$xrdbpid" ] && wait "$xrdbpid" diff --git a/.config/infokey b/.config/infokey new file mode 100644 index 0000000..9c7f01d --- /dev/null +++ b/.config/infokey @@ -0,0 +1,4 @@ +#var +link-style=blue,underline +active-link-style=black,bgcyan,underline +match-style=black,bgyellow,bold diff --git a/.config/ipython/profile_default/history.sqlite b/.config/ipython/profile_default/history.sqlite index 293b944..8b60d7f 100644 Binary files a/.config/ipython/profile_default/history.sqlite and b/.config/ipython/profile_default/history.sqlite differ diff --git a/.config/jupyter/lab/workspaces/default-37a8.jupyterlab-workspace b/.config/jupyter/lab/workspaces/default-37a8.jupyterlab-workspace index 513fec8..4827d0c 100644 --- a/.config/jupyter/lab/workspaces/default-37a8.jupyterlab-workspace +++ b/.config/jupyter/lab/workspaces/default-37a8.jupyterlab-workspace @@ -1 +1 @@ -{"data":{"layout-restorer:data":{"main":{"dock":{"type":"tab-area","currentIndex":1,"widgets":["notebook:P05_Regression_and_Types/prac5_simple-linear-regression.ipynb"]}},"down":{"size":0,"widgets":[]},"left":{"collapsed":true,"visible":true,"widgets":["filebrowser","running-sessions","@jupyterlab/toc:plugin"],"widgetStates":{"jp-running-sessions":{"sizes":[0,0.5427632331848146,0.13157887207834343,0.10526315789473684,0.13815789473684212,0.08223684210526316],"expansionStates":[false,false,false,false,false,false]}}},"right":{"collapsed":true,"visible":true,"widgets":["jp-property-inspector","debugger-sidebar"],"widgetStates":{"jp-debugger-sidebar":{"sizes":[1,0,0,0,0],"expansionStates":[false,false,false,false,false]}}},"relativeSizes":[0,1,0],"top":{"simpleVisibility":false}},"docmanager:recents":{"opened":[{"path":"P05_Regression_and_Types","contentType":"directory","root":"~/GDrive/vartak/CS/sem6/practicals/Data_Science"},{"path":"P05_Regression_and_Types/prac5_simple-linear-regression.ipynb","contentType":"notebook","factory":"Notebook","root":"~/GDrive/vartak/CS/sem6/practicals/Data_Science"},{"path":"P03_Hypothesis_Testing","contentType":"directory","root":"~/GDrive/vartak/CS/sem6/practicals/Data_Science"},{"path":"P03_Hypothesis_Testing/prac3_chi-sqare-test.ipynb","contentType":"notebook","factory":"Notebook","root":"~/GDrive/vartak/CS/sem6/practicals/Data_Science"},{"path":"","contentType":"directory","root":"~/Downloads/ds-prac1"}],"closed":[{"path":"P03_Hypothesis_Testing/prac3_chi-sqare-test.ipynb","contentType":"notebook","factory":"Notebook","root":"~/GDrive/vartak/CS/sem6/practicals/Data_Science"}]},"@jupyterlab/settingeditor-extension:form-ui":{"sizes":[0.11415525114155249,0.8858447488584476],"container":{"plugin":"@jupyterlab/shortcuts-extension:shortcuts","sizes":[0.5,0.5]}},"file-browser-filebrowser:columns":{"sizes":{"name":306,"file_size":null,"is_selected":18,"last_modified":null}},"file-browser-filebrowser:cwd":{"path":"P05_Regression_and_Types"},"notebook:P05_Regression_and_Types/prac5_simple-linear-regression.ipynb":{"data":{"path":"P05_Regression_and_Types/prac5_simple-linear-regression.ipynb","factory":"Notebook"}}},"metadata":{"id":"default"}} \ No newline at end of file +{"data":{"layout-restorer:data":{"main":{"dock":{"type":"tab-area","currentIndex":1,"widgets":["notebook:P05_Regression_and_Types/prac5_simple-linear-regression.ipynb"]}},"down":{"size":0,"widgets":[]},"left":{"collapsed":true,"visible":true,"widgets":["filebrowser","running-sessions","@jupyterlab/toc:plugin"],"widgetStates":{"jp-running-sessions":{"sizes":[0,0.5427632331848146,0.13157887207834343,0.10526315789473684,0.13815789473684212,0.08223684210526316],"expansionStates":[false,false,false,false,false,false]}}},"right":{"collapsed":true,"visible":true,"widgets":["jp-property-inspector","debugger-sidebar"],"widgetStates":{"jp-debugger-sidebar":{"sizes":[1,0,0,0,0],"expansionStates":[false,false,false,false,false]}}},"relativeSizes":[0,1,0],"top":{"simpleVisibility":false}},"docmanager:recents":{"opened":[{"path":"P05_Regression_and_Types","contentType":"directory","root":"~/GDrive/vartak/CS/sem6/practicals/Data_Science"},{"path":"P05_Regression_and_Types/prac5_simple-linear-regression.ipynb","contentType":"notebook","factory":"Notebook","root":"~/GDrive/vartak/CS/sem6/practicals/Data_Science"},{"path":"P03_Hypothesis_Testing","contentType":"directory","root":"~/GDrive/vartak/CS/sem6/practicals/Data_Science"},{"path":"P03_Hypothesis_Testing/prac3_chi-sqare-test.ipynb","contentType":"notebook","factory":"Notebook","root":"~/GDrive/vartak/CS/sem6/practicals/Data_Science"},{"path":"","contentType":"directory","root":"~/Downloads/ds-prac1"}],"closed":[{"path":"P03_Hypothesis_Testing/prac3_chi-sqare-test.ipynb","contentType":"notebook","factory":"Notebook","root":"~/GDrive/vartak/CS/sem6/practicals/Data_Science"}]},"@jupyterlab/settingeditor-extension:form-ui":{"sizes":[0.11415525114155249,0.8858447488584476],"container":{"plugin":"@jupyterlab/shortcuts-extension:shortcuts","sizes":[0.5,0.5]}},"file-browser-filebrowser:columns":{"sizes":{"name":306,"file_size":null,"is_selected":18,"last_modified":null}},"file-browser-filebrowser:cwd":{"path":"P05_Regression_and_Types"},"notebook:P05_Regression_and_Types/prac5_simple-linear-regression.ipynb":{"data":{"path":"P05_Regression_and_Types/prac5_simple-linear-regression.ipynb","factory":"Notebook"}}},"metadata":{"id":"default"}} diff --git a/.config/lf/lfrc b/.config/lf/lfrc index d3a579e..75ea880 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -33,8 +33,10 @@ set preview cmd open $$OPENER $f cmd on-cd &{{ - sed -i "\|^$PWD$|d" ${XDG_DATA_HOME:-$HOME/.local/share}/cdhist - echo "$PWD" >> ${XDG_DATA_HOME:-$HOME/.local/share}/cdhist + [ -z "$CD_HISTFILE" ] && + export CD_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/cd_history" + sed -i "\|^$PWD$|d" "$CD_HISTFILE" + echo "$PWD" >> "$CD_HISTFILE" }} cmd delete ${{ @@ -109,9 +111,9 @@ map :toggle; down map :toggle; up map Z :toggle; up map select_eval "fzf --reverse --query '!/$ ' --header-first --header='Jump to location'" -map ${{ lf -remote "send $id select \"$(cat ${XDG_DATA_HOME:-$HOME/.local/share}/openhist | +map ${{ lf -remote "send $id select \"$(cat \"${OPEN_HISTFILE:-${XDG_STATE_HOME:-$HOME/.local/state}/open_history}\" | fzf --tac --reverse --header-first --header='File History')\"" }} -map ${{ lf -remote "send $id cd \"$(cat ${XDG_DATA_HOME:-$HOME/.local/share}/cdhist | +map ${{ lf -remote "send $id cd \"$(cat ${CD_HISTFILE:-${XDG_STATE_HOME:-$HOME/.local/state}/cd_history} | fzf --tac --reverse --header-first --header='Path History')\"" }} map select_eval "fzf --reverse --query '/$ ' --header-first --header='Jump to directory'" @@ -147,9 +149,7 @@ map gy %{{ printf "%s" "$fx" | xsel -b }} map gi link_index map gsb $setbg $f map zpp set previewer preview -map zpc set previewer cat -map zpb set previewer preview-bat -map zph set previewer preview-highlight +map zpt set previewer text-preview # Trash Mappings map dd ${{ echo "$fx" | xargs -I{} trash-put "{}" }} diff --git a/.config/nvim/dev.vim b/.config/nvim/dev.vim index 89b8eca..64f70c3 100644 --- a/.config/nvim/dev.vim +++ b/.config/nvim/dev.vim @@ -19,7 +19,6 @@ let g:coc_global_extensions = [ \ 'coc-css', \ 'coc-tsserver', \ 'coc-pyright', - \ 'coc-java', \ 'coc-sh', \ ] nnoremap ca :CocList diagnostics @@ -91,3 +90,5 @@ if exists('+termguicolors') " autocmd VimEnter * AirlineTheme endif +AirlineTheme +CocList extensions diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 6583a94..8001758 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -25,9 +25,16 @@ if filereadable(config_dir . "autoload/plug.vim") " Plug 'jreybert/vimagit' " Plug 'lukesmithxyz/vimling' " Plug 'vimwiki/vimwiki' - " Plug 'vim-airline/vim-airline', {'on': 'AirlineTheme'} - " Plug 'vim-airline/vim-airline-themes', {'on': 'AirlineTheme'} + Plug 'vim-airline/vim-airline', {'on': 'AirlineTheme'} + Plug 'vim-airline/vim-airline-themes', {'on': 'AirlineTheme'} " Plug 'joshdick/onedark.vim' + + Plug 'pangloss/vim-javascript' + Plug 'leafgarland/typescript-vim' + Plug 'peitalin/vim-jsx-typescript' + " Plug 'styled-components/vim-styled-components', { 'branch': 'main' } + " Plug 'jparise/vim-graphql' + call plug#end() endif diff --git a/.config/picom.conf b/.config/picom.conf new file mode 100644 index 0000000..b3c84bd --- /dev/null +++ b/.config/picom.conf @@ -0,0 +1,322 @@ +# Thank you code_nomad: http://9m.no/ꪯ鵞 +# and Arch Wiki contributors: https://wiki.archlinux.org/index.php/Compton + +################################# +# +# Backend +# +################################# + +# Backend to use: "xrender" or "glx". +# GLX backend is typically much faster but depends on a sane driver. +backend = "glx"; + +################################# +# +# GLX backend +# +################################# + +glx-no-stencil = true; + +# GLX backend: Copy unmodified regions from front buffer instead of redrawing them all. +# My tests with nvidia-drivers show a 10% decrease in performance when the whole screen is modified, +# but a 20% increase when only 1/4 is. +# My tests on nouveau show terrible slowdown. +glx-copy-from-front = false; + +# GLX backend: Use MESA_copy_sub_buffer to do partial screen update. +# My tests on nouveau shows a 200% performance boost when only 1/4 of the screen is updated. +# May break VSync and is not available on some drivers. +# Overrides --glx-copy-from-front. +# glx-use-copysubbuffermesa = true; + +# GLX backend: Avoid rebinding pixmap on window damage. +# Probably could improve performance on rapid window content changes, but is known to break things on some drivers (LLVMpipe). +# Recommended if it works. +# glx-no-rebind-pixmap = true; + +# GLX backend: GLX buffer swap method we assume. +# Could be undefined (0), copy (1), exchange (2), 3-6, or buffer-age (-1). +# undefined is the slowest and the safest, and the default value. +# copy is fastest, but may fail on some drivers, +# 2-6 are gradually slower but safer (6 is still faster than 0). +# Usually, double buffer means 2, triple buffer means 3. +# buffer-age means auto-detect using GLX_EXT_buffer_age, supported by some drivers. +# Useless with --glx-use-copysubbuffermesa. +# Partially breaks --resize-damage. +# Defaults to undefined. +#glx-swap-method = "undefined"; #deprecated ! +#use-damage = true + +################################# +# +# Shadows +# +################################# + +# Enabled client-side shadows on windows. +shadow = false; +# The blur radius for shadows. (default 12) +shadow-radius = 5; +# The left offset for shadows. (default -15) +shadow-offset-x = -5; +# The top offset for shadows. (default -15) +shadow-offset-y = -5; +# The translucency for shadows. (default .75) +shadow-opacity = 0.3; + +# Set if you want different colour shadows +# shadow-red = 0.0; +# shadow-green = 0.0; +# shadow-blue = 0.0; + +# The shadow exclude options are helpful if you have shadows enabled. Due to the way picom draws its shadows, certain applications will have visual glitches +# (most applications are fine, only apps that do weird things with xshapes or argb are affected). +# This list includes all the affected apps I found in my testing. The "! name~=''" part excludes shadows on any "Unknown" windows, this prevents a visual glitch with the XFWM alt tab switcher. +shadow-exclude = [ + "! name~=''", + "name = 'Notification'", + "name = 'Plank'", + "name = 'Docky'", + "name = 'Kupfer'", + "name = 'xfce4-notifyd'", + "name *= 'VLC'", + "name *= 'compton'", + "name *= 'picom'", + "name *= 'Chromium'", + "name *= 'Chrome'", + "class_g = 'Firefox' && argb", + "class_g = 'Conky'", + "class_g = 'Kupfer'", + "class_g = 'Synapse'", + "class_g ?= 'Notify-osd'", + "class_g ?= 'Cairo-dock'", + "class_g ?= 'Xfce4-notifyd'", + "class_g ?= 'Xfce4-power-manager'", + "class_g ?= 'Dmenu'", +# "class_g ?= 'Dunst'", +# disables shadows on i3 frames +# "class_g ?= 'i3-frame'" +# "_GTK_FRAME_EXTENTS@:c", +# "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'" +]; +# Avoid drawing shadow on all shaped windows (see also: --detect-rounded-corners) +shadow-ignore-shaped = false; + +################################# +# +# Opacity +# +################################# + +inactive-opacity = 0.90; +active-opacity = 0.95; +frame-opacity = 1; +inactive-opacity-override = false; + +# Dim inactive windows. (0.0 - 1.0) +# inactive-dim = 0.2; +# Do not let dimness adjust based on window opacity. +# inactive-dim-fixed = true; + +################################# +# +# Fading +# +################################# + +# Fade windows during opacity changes. +fading = true; +# The time between steps in a fade in milliseconds. (default 10). +# fade-delta = 100; +# Opacity change between steps while fading in. (default 0.028). +fade-in-step = 0.03; +# Opacity change between steps while fading out. (default 0.03). +fade-out-step = 0.03; +# Fade windows in/out when opening/closing +# no-fading-openclose = true; + +# Specify a list of conditions of windows that should not be faded. +fade-exclude = [ ]; + +################################# +# +# Other +# +################################# + +# Try to detect WM windows and mark them as active. +mark-wmwin-focused = true; +# Mark all non-WM but override-redirect windows active (e.g. menus). +mark-ovredir-focused = true; +# Use EWMH _NET_WM_ACTIVE_WINDOW to determine which window is focused instead of using FocusIn/Out events. +# Usually more reliable but depends on a EWMH-compliant WM. +use-ewmh-active-win = true; +# Detect rounded corners and treat them as rectangular when --shadow-ignore-shaped is on. +detect-rounded-corners = true; + +# Detect _NET_WM_OPACITY on client windows, useful for window managers not passing _NET_WM_OPACITY of client windows to frame windows. +# This prevents opacity being ignored for some apps. +# For example without this enabled my xfce4-notifyd is 100% opacity no matter what. +detect-client-opacity = true; + +# Specify refresh rate of the screen. +# If not specified or 0, picom will try detecting this with X RandR extension. +refresh-rate = 0; + +# Vertical synchronization: match the refresh rate of the monitor +vsync = false; + +# Enable DBE painting mode, intended to use with VSync to (hopefully) eliminate tearing. +# Reported to have no effect, though. +dbe = false; + +# Limit picom to repaint at most once every 1 / refresh_rate second to boost performance. +# This should not be used with --vsync drm/opengl/opengl-oml as they essentially does --sw-opti's job already, +# unless you wish to specify a lower refresh rate than the actual value. +#sw-opti = true; + +# Unredirect all windows if a full-screen opaque window is detected, to maximize performance for full-screen windows, like games. +# Known to cause flickering when redirecting/unredirecting windows. +unredir-if-possible = true; + +# Specify a list of conditions of windows that should always be considered focused. +focus-exclude = [ "class_g = 'Cairo-clock'" ]; + +# Use WM_TRANSIENT_FOR to group windows, and consider windows in the same group focused at the same time. +detect-transient = true; +# Use WM_CLIENT_LEADER to group windows, and consider windows in the same group focused at the same time. +# WM_TRANSIENT_FOR has higher priority if --detect-transient is enabled, too. +detect-client-leader = true; + +################################# +# +# Window type settings +# +################################# + +wintypes : +{ + tooltip : + { + fade = true; + shadow = false; + opacity = 0.85; + focus = true; + }; + fullscreen : + { + fade = true; + shadow = false; + opacity = 1; + focus = true; + }; +}; + +###################### +# +# XSync +# See: https://github.com/yshui/picom/commit/b18d46bcbdc35a3b5620d817dd46fbc76485c20d +# +###################### + +# Use X Sync fence to sync clients' draw calls. Needed on nvidia-drivers with GLX backend for some users. +xrender-sync-fence = true; + +#opacity-rule = [ +#"99:name *?= 'Call'", +#"99:class_g = 'Chromium'", +#"99:name *?= 'Conky'", +#"99:class_g = 'Darktable'", +#"50:class_g = 'Dmenu'", +#"99:name *?= 'Event'", +#"99:class_g = 'Firefox'", +#"99:class_g = 'GIMP'", +#"99:name *?= 'Image'", +#"99:class_g = 'Lazpaint'", +#"99:class_g = 'Midori'", +#"99:name *?= 'Minitube'", +#"99:class_g = 'Mousepad'", +#"99:name *?= 'MuseScore'", +#"90:name *?= 'Page Info'", +#"99:name *?= 'Pale Moon'", +#"90:name *?= 'Panel'", +#"99:class_g = 'Pinta'", +#"90:name *?= 'Restart'", +#"99:name *?= 'sudo'", +#"99:name *?= 'Screenshot'", +#"99:class_g = 'Viewnior'", +#"99:class_g = 'VirtualBox'", +#"99:name *?= 'VLC'", +#"99:name *?= 'Write'", +#"93:class_g = 'URxvt' && !_NET_WM_STATE@:32a", +#"0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", +#"96:_NET_WM_STATE@:32a *= '_NET_WM_STATE_STICKY'" +#]; + + +################################# +# Background-Blurring # +################################# + + +# Parameters for background blurring, see the *BLUR* section for more information. +# blur-method = +# blur-size = 12 +# +# blur-deviation = false + +# Blur background of semi-transparent / ARGB windows. +# Bad in performance, with driver-dependent behavior. +# The name of the switch may change without prior notifications. +# +# blur-background = true; + +# Blur background of windows when the window frame is not opaque. +# Implies: +# blur-background +# Bad in performance, with driver-dependent behavior. The name may change. +# +# blur-background-frame = false; + + +# Use fixed blur strength rather than adjusting according to window opacity. +# blur-background-fixed = false; + + +# Specify the blur convolution kernel, with the following format: +# example: +# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; +# +# blur-kern = '' +# blur-kern = "3x3box"; + +blur: { + # requires: https://github.com/ibhagwan/picom + method = "kawase"; + #method = "kernel"; + strength = 7; + # deviation = 1.0; + # kernel = "11x11gaussian"; + background = false; + background-frame = false; + background-fixed = false; + kern = "3x3box"; +} + +# Exclude conditions for background blur. +blur-background-exclude = [ + #"window_type = 'dock'", + #"window_type = 'desktop'", + #"class_g = 'URxvt'", + "class_g = 'slop'", + "class_g = 'i3status'", + "_GTK_FRAME_EXTENTS@:c", + "window_type = 'menu'", + "window_type = 'tooltip'", + "window_type = 'popup_menu'", + "window_type = 'dropdown_menu'", + "window_type = 'dock'", + "window_type = 'desktop'" +]; diff --git a/.config/sdcv_ordering b/.config/sdcv_ordering new file mode 100644 index 0000000..89a4308 --- /dev/null +++ b/.config/sdcv_ordering @@ -0,0 +1,5 @@ +WordNet® 3.0 (En-En) +American Heritage Dictionary 4th Ed. (En-En) +Urban Dictionary P1 (En-En) +Urban Dictionary P2 (En-En) +Wikipedia English - Free Encyclopedia diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 55f3cb6..489f66d 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -16,7 +16,6 @@ alias se='sudoedit' alias lf='lfcd' alias rs='exec $SHELL' alias sr='ff ~/.config ~/.local/bin ~/bin' -alias fh='fzf --tac < "${XDG_DATA_HOME:-$HOME/.local/share}/openhist"' alias uc='cd ~ && gitpush' alias gpu='gitpush' @@ -24,7 +23,7 @@ alias gpu='gitpush' lt() { tree -aC --dirsfirst -I "$IGNORE_GLOB" "$@" | less -F; } dul() { du -ahd 1 "$@" | sort -h | less -FX; } v() { LESSOPEN="|preview %s" less -r -F "${1:-.}"; } -ff() { FZF_DEFAULT_COMMAND="$FZF_DEFAULT_COMMAND $@" FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS $FO" fzf -m; } +ff() { find -H "$@" ! -wholename '*.git*' ! \( -type d -printf '%p/\n' , ! -type d -print \) | fzf -m; } senv() { source "${XDG_DATA_HOME:-$HOME/.local/share}/virtualenvs/${1:-main}/bin/activate"; } sudoedit() { @@ -85,4 +84,3 @@ alias grep='grep --color=auto' alias tree='tree -C --dirsfirst' alias ls='ls -h --group-directories-first --color=auto --classify=auto' alias info='info --vi-keys --init-file ~/.config/infokey' -alias fd='fd --hidden' diff --git a/.config/shell/bm-dirs b/.config/shell/bm-dirs index 5338c77..11f3852 100644 --- a/.config/shell/bm-dirs +++ b/.config/shell/bm-dirs @@ -3,6 +3,7 @@ cac ${XDG_CACHE_HOME:-$HOME/.cache} cg ${XDG_CONFIG_HOME:-$HOME/.config} lsh ${XDG_DATA_DIR:-$HOME/.local/share} vnv ${XDG_DATA_DIR:-$HOME/.local/share}/virtualenvs +ltr ${XDG_DATA_DIR:-$HOME/.local/share}/Trash lsr ${XDG_DATA_DIR:-$HOME/.local/src} lst ${XDG_DATA_DIR:-$HOME/.local/state} dn ${XDG_DOWNLOAD_DIR:-$HOME/Downloads} @@ -13,7 +14,7 @@ ms ${XDG_MUSIC_DIR:-$HOME/Music} px ${XDG_PICTURES_DIR:-$HOME/Pictures} vd ${XDG_VIDEOS_DIR:-$HOME/Videos} -lb ~/.local/bin +lbn ~/.local/bin bn ~/bin sd ~/sdcard rp ~/repos @@ -29,7 +30,7 @@ vrp ~/Dev/sites/vikas.rocks/public td ~/Dev/test gd ~/GDrive/vartak/CS/sem6 gf ~/GDrive/vartak/CS/sem6/practicals -gp ~/GDrive/vartak/CS/sem6/journal +gp ~/GDrive/vartak/CS/sem6/journals gz ~/GDrive/vartak/CS/practical-zip/sem5 gn ~/GDrive/vartak/CS/sem6/notes rs ~/GDrive/vartak/results diff --git a/.config/shell/profile b/.config/shell/profile index c8fd9c6..51111c1 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -14,32 +14,36 @@ XDG_STATE_HOME="$HOME/.local/state" XDG_CACHE_HOME="$HOME/.cache" export MOUNTPATH="/run/media/$USER" -export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME/jupyter" -export W3M_DIR="$XDG_CONFIG_HOME/w3m" -export NCFTPDIR="$XDG_DATA_HOME/ncftp" export PASSWORD_STORE_DIR="$HOME/Phone/Backup/pass" +export SSH_AUTH_SOCK="$HOME/.ssh/ssh_auth_sock" +export NCFTPDIR="$XDG_DATA_HOME/ncftp" +export R_ENVIRON_USER="$XDG_DATA_HOME/R/.Renviron" +export GOPATH="$XDG_DATA_HOME/go" export ANDROID_USER_HOME="$XDG_DATA_HOME/android" export __GL_SHADER_DISK_CACHE_PATH="$HOME/.cache/nv" +export PYENV_ROOT="$XDG_DATA_HOME/pyenv" export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" export ZDOTDIR="$XDG_CONFIG_HOME/zsh" export INPUTRC="$XDG_CONFIG_HOME/shell/inputrc" export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc" +export W3M_DIR="$XDG_CONFIG_HOME/w3m" export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc" export IPYTHONDIR="$XDG_CONFIG_HOME/ipython" +export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME/jupyter" export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config" export MBSYNCRC="$XDG_CONFIG_HOME/isyncrc" -export LESSHISTFILE="$XDG_DATA_HOME/less/history" -export FZF_HIST_FILE="$XDG_DATA_HOME/fzf/history" -export SDCV_HISTFILE="$XDG_DATA_HOME/sdcv" -export R_ENVIRON_USER="$XDG_DATA_HOME/R/.Renviron" -export SSH_AUTH_SOCK="$HOME/.ssh/ssh_auth_sock" -export GOPATH="$XDG_DATA_HOME/go" -export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history" -export NODE_REPL_HISTOR="$XDG_DATA_HOME/node_repl_history" -export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history" -export HISTFILE="$XDG_DATA_HOME/bash_history" +export FZF_HISTDIR="$XDG_STATE_HOME/fzf" +export LESSHISTFILE="$XDG_STATE_HOME/less/history" +export FZF_HISTFILE="$XDG_STATE_HOME/fzf/history" +export SDCV_HISTFILE="$XDG_STATE_HOME/sdcv_history" +export SQLITE_HISTORY="$XDG_STATE_HOME/sqlite_history" +export NODE_REPL_HISTORY="$XDG_STATE_HOME/node_repl_history" +export MYSQL_HISTFILE="$XDG_STATE_HOME/mysql_history" +export HISTFILE="$XDG_STATE_HOME/bash_history" +export OPEN_HISTFILE="$XDG_STATE_HOME/open_history" +export CD_HISTFILE="$XDG_STATE_HOME/cd_history" # program configuration export LESS='-fiR --mouse --use-color -j 10 -Dd+r -Du+b' @@ -56,7 +60,7 @@ export HTTP_HOME='https://www.duckduckgo.com' export CHROME_EXECUTABLE='chromium' export FZF_DEFAULT_COMMAND="find -H . ! -wholename '*.git*' ! \( -type d -printf '%p/\n' , ! -type d -print \)" export FZF_DEFAULT_OPTS=" - --history='$XDG_DATA_HOME/fzf/history' + --history='$FZF_HISTFILE' --preview='\$PREVIEWER {}' --preview-window=hidden --bind 'ctrl-s:toggle-sort' --bind 'ctrl-y:execute-silent(printf \"%s\\\n\" {+} | xsel --clipboard)' @@ -75,18 +79,17 @@ export FZF_DEFAULT_OPTS=" --bind 'alt-g:preview-top,alt-G:preview-bottom' --bind 'alt-s:execute(dmenu-send {})' --bind 'alt-0:change-preview(echo {})' - --bind 'alt-1:change-preview(highlight --out-format=ansi -- {} 2>/dev/null || - ls -Als --group-directories-first --color=always --classify=always -- {})' + --bind 'alt-1:change-preview(text-preview {})' --bind 'alt-2:change-preview(\$PREVIEWER {})' --bind 'alt-9:change-preview(printf \"%s\\\n\" {+})' --bind 'alt-!:execute(less {})' --bind 'alt-@:execute(\$PREVIEWER {} | less)' - --bind 'alt-v:execute(echo {q} >> \"$FZF_HIST_FILE\"; LESSOPEN=\"|preview %s\" less {})' - --bind 'alt-e:execute(echo {q} >> \"$FZF_HIST_FILE\"; eval \"\${EDITOR:-vi} {}\")' - --bind 'ctrl-o:execute(echo {q} >> \"$FZF_HIST_FILE\"; eval \"\${OPENER:-xdg-open} {}\")' - --bind 'alt-O:execute(echo {q} >> \"$FZF_HIST_FILE\"; mimeopen --ask {})' - --bind 'alt-o:execute(echo {q} >> \"$FZF_HIST_FILE\"; eval \"\${FILES:-lf} {}\")' - --bind 'alt-D:become(echo {q} >> \"$FZF_HIST_FILE\"; dirname {} )' + --bind 'alt-v:execute(echo {q} >> \"$FZF_HISTFILE\"; LESSOPEN=\"|preview %s\" less {})' + --bind 'alt-e:execute(echo {q} >> \"$FZF_HISTFILE\"; eval \"\${EDITOR:-vi} {}\")' + --bind 'ctrl-o:execute(echo {q} >> \"$FZF_HISTFILE\"; eval \"\${OPENER:-xdg-open} {}\")' + --bind 'alt-O:execute(echo {q} >> \"$FZF_HISTFILE\"; mimeopen --ask {})' + --bind 'alt-o:execute(echo {q} >> \"$FZF_HISTFILE\"; eval \"\${FILES:-lf} {}\")' + --bind 'alt-D:become(echo {q} >> \"$FZF_HISTFILE\"; dirname {} )' " ## Custom themes for GTypist diff --git a/.config/starship.toml b/.config/starship.toml new file mode 100644 index 0000000..06f8b23 --- /dev/null +++ b/.config/starship.toml @@ -0,0 +1,142 @@ +# # FIRST LINE/ROW: Info & Status +# # First param ─┌ +# [username] +# format = " [╭─$user]($style)@" +# style_user = "bold red" +# style_root = "bold red" +# show_always = true + +# # Second param +# [hostname] +# format = "[$hostname]($style) in " +# style = "bold dimmed red" +# trim_at = "-" +# ssh_only = false +# disabled = false + +# # Third param +# [directory] +# style = "purple" +# truncation_length = 0 +# truncate_to_repo = true +# truncation_symbol = "repo: " + +# Before all the version info (python, nodejs, php, etc.) +[git_status] +style = "white" +ahead = "⇡${count}" +diverged = "⇕⇡${ahead_count}⇣${behind_count}" +behind = "⇣${count}" +deleted = "x" + +# Last param in the first line/row +[cmd_duration] +min_time = 50 +format = "took [$duration]($style)" +disabled = false + + +## SECOND LINE/ROW: Prompt +# Somethere at the beginning +[battery] +full_symbol = " " +charging_symbol = " " +discharging_symbol = " " +disabled = true + +[[battery.display]] # "bold red" style when capacity is between 0% and 10% +threshold = 15 +style = "bold red" +disabled = true + +[[battery.display]] # "bold yellow" style when capacity is between 10% and 30% +threshold = 50 +style = "bold yellow" +disabled = true + +[[battery.display]] # "bold green" style when capacity is between 10% and 30% +threshold = 80 +style = "bold green" +disabled = true + +# Prompt: optional param 1 +[time] +format = " 🕙 $time($style)\n" +time_format = "%T" +style = "bright-white" +disabled = true + +# # Prompt: param 2 └─ +# [character] +# success_symbol = " [╰─λ](bold red)" +# error_symbol = " [×](bold red)" + +# SYMBOLS +[status] +symbol = "🔴" +format = '[\[$symbol$status_common_meaning$status_signal_name$status_maybe_int\]]($style)' +map_symbol = true +disabled = false + +[aws] +symbol = " " + +[conda] +symbol = " " + +[dart] +symbol = " " + +[docker_context] +symbol = " " + +[elixir] +symbol = " " + +[elm] +symbol = " " + +[git_branch] +symbol = " " + +[golang] +symbol = " " + +[hg_branch] +symbol = " " + +[java] +symbol = " " + +[julia] +symbol = " " + +[nim] +symbol = " " + +[nix_shell] +symbol = " " + +[nodejs] +symbol = " " + +[package] +symbol = " " + +[perl] +symbol = " " + +[php] +symbol = " " + +[python] +symbol = " " + +[ruby] +symbol = " " + +[rust] +symbol = " " + +[swift] +symbol = "ﯣ " diff --git a/.config/ytignore b/.config/ytignore new file mode 100644 index 0000000..6bc17cd --- /dev/null +++ b/.config/ytignore @@ -0,0 +1,6 @@ +*.srt +*.vtt +*.description +*.info.json +*.live_chat.json +*.yt* diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index c855f81..b6c435e 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -8,7 +8,6 @@ alias find="2> >(grep -v 'Permission denied' >&2) find" source ~/.profile [ -n "$SDOTDIR" ] || SDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/shell" [ -n "$ZDOTDIR" ] || ZDOTDIR="${XDG_CONFIG_HOME:-HOME/.config}/zsh" - source "/usr/share/fzf/completion.zsh" source "$ZDOTDIR/command-tools.zsh" source "$ZDOTDIR/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" @@ -74,13 +73,19 @@ ZSH_AUTOSUGGEST_STRATEGY=(history completion) ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(end-of-line vi-end-of-line vi-add-eol) ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS+=(forward-char vi-forward-char) -HISTFILE="${XDG_DATA_HOME:=$HOME/.local/share}/zsh/history" +HISTFILE="${XDG_STATE_HOME:=$HOME/.local/state}/zsh/history" HISTSIZE=100000 SAVEHIST=50000 unset WORDCHARS stty -ixon +[ -z "$CD_HISTFILE" ] && + export CD_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/cd_history" + +[ -z "$OPEN_HISTFILE" ] && + export OPEN_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/open_history" + # Angular # _ng_yargs_completions() # { @@ -105,8 +110,8 @@ _command_fail_hook() { add-zsh-hook precmd _command_fail_hook _cd_history_hook() { - sed -i "\|^$PWD$|d" "${XDG_DATA_HOME:-$HOME/.local/share}/cdhist" - echo "$PWD" >> "${XDG_DATA_HOME:-$HOME/.local/share}/cdhist" + sed -i "\|^$PWD$|d" "$CD_HISTFILE" + echo "$PWD" >> "$CD_HISTFILE" } add-zsh-hook -Uz chpwd _cd_history_hook @@ -176,7 +181,7 @@ zle -N backward-delete-word-to-slash bindkey '^W' backward-delete-word-to-slash _fzf-file-history() { - LBUFFER="${LBUFFER}$(sed "s|$HOME|~|" "${XDG_DATA_HOME:-$HOME/.local/share}/openhist" | fzf --tac --reverse --height 40% | sed "s/ /\\\ /")" + LBUFFER="${LBUFFER}$(sed "s|$HOME|~|" "$OPEN_HISTFILE" | fzf --tac --reverse --height 40% | sed "s/ /\\\ /")" zle reset-prompt } zle -N fzf-file-history _fzf-file-history @@ -196,7 +201,7 @@ zle -N fzf-cd-widget _fzf-cd-widget bindkey '^[c' fzf-cd-widget _cd-path-history() { - FZF_CD_COMMAND="< ${XDG_DATA_HOME:-$HOME/.local/share}/cdhist" \ + FZF_CD_COMMAND="< $CD_HISTFILE" \ FZF_CD_OPTS="--tac --tiebreak=index --no-sort" \ zle fzf-cd-widget } @@ -230,10 +235,11 @@ alias which-command='where' _get-help() { cmd=(${=BUFFER}) zle push-line - case "${cmd[1]}" in - docker|gh|hugo|npm|git) BUFFER="help ${cmd[1]}-${cmd[2]}" ;; - *) BUFFER="get-help $cmd" ;; - esac + # case "${cmd[1]}" in + # docker|gh|hugo|npm|git|pip) BUFFER="help ${cmd[1]}-${cmd[2]}" ;; + # *) BUFFER="get-help $cmd" ;; + # esac + BUFFER="help ${cmd[1]}-${cmd[2]}" zle accept-line } zle -N get-help _get-help @@ -247,7 +253,7 @@ bindkey '^[H' get-help case "$TERM" in *256*) - command -V eza >/dev/null && { + command -v eza >/dev/null && { export IGNORE_GLOB="$(tr '\n' '|' < "$XDG_CONFIG_HOME/fd/ignore")" alias l='eza -aF --group-directories-first --color=always --icons' alias ll='l -l' @@ -256,13 +262,15 @@ case "$TERM" in *256*) --icons=always -aTF -I "$IGNORE_GLOB" "$@" | less -rF; } } - command -V fd >/dev/null && { + command -v fd >/dev/null && { FZF_DEFAULT_COMMAND="fd --hidden --no-ignore-vcs --color=always $@" FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --ansi" + ff() { FZF_DEFAULT_COMMAND+="$@" fzf -m; } + alias f='fd --hidden --no-ignore-vcs' alias sr='fd --no-ignore-vcs --color=always . ~/.config ~/.local/bin ~/bin | fzf --ansi' } - command -V starship >/dev/null && { + command -v starship >/dev/null && { eval "$(starship init zsh)" function set_win_title() { echo -ne "\033]0; $USER@$HOST:${PWD/$HOME/~} \007" @@ -277,6 +285,7 @@ alias sp='sudo pacman' alias sv='sudo sv' alias mmv='noglob zmv -W' alias s='sudo ' +alias fh='fzf --tac < "$OPEN_HISTFILE"' alias mirror='sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist-arch' alias mirrord='sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist-arch' alias cleanup='sudo pacman -Rns $(pacman -Qtdq)' @@ -286,7 +295,7 @@ alias typ='launch-gtypist -l "$(sed "/^gtypist lesson - \(.*\)$/!d; s//\1/" ~/Do alias typa='launch-gtypist -e 3 -l "$(sed "/^gtypist lesson - \(.*\)$/!d; s//\1/" ~/Documents/Notes/ak47.txt)"' # Find command package -f() { +F() { ret=$? [ -n "$1" ] && { pacman -F "$@"; return; } [ "$ret" != 127 ] && echo "Return code of last command is not 127" >&2 && return 2 @@ -300,6 +309,15 @@ f() { # } # alias ssudo='sudofu ' +pyenvs() { + if [ "$PYENV_VIRTUALENV_INIT" != 1 ]; then + [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" + eval "$(pyenv init - zsh)" + eval "$(pyenv virtualenv-init -)" + fi + pyenv activate "$1" +} + # Load syntax highlighter; should be last. source "/home/master/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh" diff --git a/.gitignore b/.gitignore index 022fe7f..0361746 100755 --- a/.gitignore +++ b/.gitignore @@ -9,11 +9,18 @@ !/.config /.config/* -!/.config/gh/config.yml shortcutrc shortcuts* +!/.config/fdignore +!/.config/ytignore +!/.config/mimeapps.list +!/.config/infokey +!/.config/picom.conf +!/.config/sdcv_ordering +!/.config/starship.toml + !/.config/shell /.config/shell/* !/.config/shell/aliasrc @@ -29,6 +36,27 @@ shortcuts* !/.config/zsh/zprofile !/.config/zsh/.zshrc +!/.config/gh/config.yml + +!/.config/python +/.config/python/* +!/.config/python/pythonrc + +!/.config/ipython +/.config/ipython/* +!/.config/ipython/profile_default +/.config/ipython/profile_default/* +!/.config/ipython/profile_default/startup +!/.config/ipython/profile_default/ipython_config.py + +!/.config/jupyter +/.config/jupyter/* +!/.config/jupyter/lab +/.config/jupyter/lab/* +!/.config/jupyter/lab/user-settings +!/.config/jupyter/jupyter_console_config.py +!/.config/jupyter/jupyter_notebook_config.py + !/.config/terminal-colors.d !/.config/wget !/.config/htop @@ -38,9 +66,6 @@ shortcuts* !/.config/lf !/.config/sc-im !/.config/yt-dlp -!/.config/python -!/.config/ipython -!/.config/jupyter !/.config/git !/.config/fd @@ -49,7 +74,6 @@ shortcuts* !/.config/gtk-4.0 !/.config/lxsession !/.config/X11 -!/.config/mimeapps.list !/.config/i3 !/.config/i3blocks diff --git a/.local/bin/development/ipy b/.local/bin/development/ipy index ae26eb1..1f39550 100755 --- a/.local/bin/development/ipy +++ b/.local/bin/development/ipy @@ -1,8 +1,4 @@ #!/bin/sh unset PYTHONSTARTUP - -env="${XDG_DATA_HOME:-$HOME/.local/share}/virtualenvs/main/bin/activate" -[ -f "$env" ] && . "$env" - -ipython "$@" +"${XDG_DATA_HOME:-$HOME/.local/share}/virtualenvs/main/bin/ipython" "$@" diff --git a/.local/bin/development/rh b/.local/bin/development/rh new file mode 100755 index 0000000..b65c51f --- /dev/null +++ b/.local/bin/development/rh @@ -0,0 +1,5 @@ +#!/bin/sh + +# rh - R help + +R -e "help($@)" diff --git a/.local/bin/fcode b/.local/bin/fcode index 8da7a17..073bec4 100755 --- a/.local/bin/fcode +++ b/.local/bin/fcode @@ -3,9 +3,6 @@ # fzf-unicode: get a list of emojis or unicode charecters using fzf # place your charecter files in plain text in ~/.local/share/chars/* -FZF_HIST="$HOME/.local/share/fzf/unicode_history" -mkdir -pv ~/.local/share/fzf - if [ "$OPENFLAG" = 0 ]; then notify-send fzf-unicode "$*" chosen="$(printf '%s\n' "$@" | cut -d\ -f1 | tr -d '\n')" @@ -14,6 +11,11 @@ if [ "$OPENFLAG" = 0 ]; then exit fi +[ -z "$FZF_HISTDIR" ] && + export FZF_HISTDIR="${XDG_STATE_HOME:-$HOME/.local/state}/fzf" +mkdir -pv "$FZF_HISTDIR" +export FZF_HIST="$FZF_HISTDIR/unicode_history" + cut -d ';' -f1 ~/.local/share/chars/* | fzf -m --history="$FZF_HIST" \ --header="Copy Emojis to Clipboard" --header-first \ diff --git a/.local/bin/fgrp b/.local/bin/fgrp index ddf3448..b9c0566 100755 --- a/.local/bin/fgrp +++ b/.local/bin/fgrp @@ -11,8 +11,11 @@ if [ "$OPENFLAG" = 0 ]; then esac; exit fi -mkdir -pv "${XDG_DATA_HOME:=$HOME/.local/share}/fzf" -export FZF_HIST="$XDG_DATA_HOME/fzf/grep_history" +[ -z "$FZF_HISTDIR" ] && + export FZF_HISTDIR="${XDG_STATE_HOME:-$HOME/.local/state}/fzf" +mkdir -pv "$FZF_HISTDIR" +export FZF_HIST="$FZF_HISTDIR/grep_history" + grep -Rnsi --exclude-dir=.git --exclude-dir=node_modules --color=always "$@" | fzf --ansi \ --history="$FZF_HIST" \ @@ -21,7 +24,7 @@ grep -Rnsi --exclude-dir=.git --exclude-dir=node_modules --color=always "$@" | --preview-window="hidden" \ --bind 'ctrl-v:toggle-preview,ctrl-space:toggle-preview' \ --bind "ctrl-r:reload(grep -Rns --color=always $*)" \ - --bind 'enter:execute(echo {} >> "$FZF_HIST"; OPENFLAG=0 fgrp {})' \ - --bind 'alt-e:execute(echo {} >> "$FZF_HIST"; OPENFLAG=0 OPENWITH=${EDITOR:-vi} fgrp {})' \ - --bind 'alt-o:execute(echo {} >> "$FZF_HIST"; OPENFLAG=0 OPENWITH=${OPENER:-xdg-open} fgrp {})' \ - --bind 'alt-O:execute(echo {} >> "$FZF_HIST"; OPENFLAG=0 OPENWITH=${FILES:-lf} fgrp {})' + --bind 'enter:execute(append-to-history {} "$FZF_HIST"; OPENFLAG=0 fgrp {})' \ + --bind 'alt-e:execute(append-to-history {} "$FZF_HIST"; OPENFLAG=0 OPENWITH=${EDITOR:-vi} fgrp {})' \ + --bind 'alt-o:execute(append-to-history {} "$FZF_HIST"; OPENFLAG=0 OPENWITH=${OPENER:-xdg-open} fgrp {})' \ + --bind 'alt-O:execute(append-to-history {} "$FZF_HIST"; OPENFLAG=0 OPENWITH=${FILES:-lf} fgrp {})' diff --git a/.local/bin/fm b/.local/bin/fm index 2f4fbb8..314d783 100755 --- a/.local/bin/fm +++ b/.local/bin/fm @@ -12,8 +12,10 @@ if [ "$OPENFLAG" = 0 ]; then fi; exit fi -mkdir -pv "${XDG_DATA_HOME:=$HOME/.local/share}/fzf" -export FZF_HIST="${XDG_DATA_HOME:=$HOME/.local/share}/fzf/manual_history" +[ -z "$FZF_HISTDIR" ] && + export FZF_HISTDIR="${XDG_STATE_HOME:-$HOME/.local/state}/fzf" +mkdir -pv "$FZF_HISTDIR" +export FZF_HIST="$FZF_HISTDIR/manual_history" apropos -l "${@:-.}" | fzf --history="$FZF_HIST" --prompt="man: " \ --preview='MANWIDTH=$FZF_PREVIEW_COLUMNS OPENFLAG=0 fm {}' \ diff --git a/.local/bin/fmd b/.local/bin/fmd index 72e5542..7dfb0e9 100755 --- a/.local/bin/fmd +++ b/.local/bin/fmd @@ -1,17 +1,30 @@ #!/bin/sh # fzf-media: fuzzy search media files -# Useful when you want to look through a list of video without having to -# bother with their individual supplementary files like subtitles. +# Useful for browsing video files without having to bother with +# their subtitle files. export PREVIEW="${PREVIEW:-"cat \"\$(dirname {})/.description/\${\$(basename {})%.*}.txt\" 2>/dev/null || preview {}"}" -fd -I --color=always --type=file --ignore-file="${XDG_CONFIG_HOME:-$HOME/.config}/ytignore" "$@" | sort | - fzf --multi --reverse \ - --history="${FZF_HIST:=$HOME/.local/share/fzf/media_history}" \ +find_files() { + filter="${XDG_CONFIG_HOME:-$HOME/.config}/ytignore" + if command -v fd >/dev/null; then + fd -I --color=always --type=file --ignore-file="$filter" . "$@" + else + eval "find $* -type f ! -path '*/.*' $(sed -z "s/\(\S\+\)\n/! -name '\1' /g" "$filter")" + fi +} + +[ -z "$FZF_HISTDIR" ] && + export FZF_HISTDIR="${XDG_STATE_HOME:-$HOME/.local/state}/fzf" +mkdir -pv "$FZF_HISTDIR" +export FZF_HIST="$FZF_HISTDIR/${FMD_HIST_NAME:-media_history}" + +find_files "$@" | sort | fzf --multi --reverse --history="$FZF_HIST" \ --header="${FZF_HEADER:-Browse Media Files}" --header-first \ --preview="$PREVIEW" --preview-window=hidden \ - --bind 'alt-C:execute( ffbrowser "$(mediainfo --inform="General;%Comment%" {})" )' \ + --bind 'alt-C:execute(librewolf-open "$(mediainfo --inform="General;%Comment%" {})")' \ --bind 'ctrl-o:execute(append-to-history {q} "$FZF_HIST"; ${OPENER:-xdg-open} {})' \ --bind "alt-3:change-preview($PREVIEW)" \ - --bind 'alt-#:execute($PREVIEW | less)' + --bind "alt-@:execute($PREVIEW | yad --text-info)" + diff --git a/.local/bin/fpm b/.local/bin/fpm index 8da3d35..98ab94e 100755 --- a/.local/bin/fpm +++ b/.local/bin/fpm @@ -126,7 +126,11 @@ else get_pkgs() { list_pkgs; } fi -[ -z "$FZF_HIST_DIR" ] && export FZF_HIST_DIR="$HOME/.local/share/fzf" +[ -z "$FZF_HISTDIR" ] && + export FZF_HISTDIR="${XDG_STATE_HOME:-$HOME/.local/state}/fzf" +mkdir -pv "$FZF_HISTDIR" +export FZF_HIST="$FZF_HISTDIR/package_history" + fzff() { preview=' echo "selected packages:"; @@ -135,7 +139,7 @@ fzff() { eval "$pkg_info 2>/dev/null" {1} ' fzf --ansi --multi \ - --history="${FZF_HIST_DIR:-$HOME/.local/share}/package_history" \ + --history="$FZF_HIST" \ --header="Select packages $opmsg" --header-first --prompt="$prompt> " \ --preview="$preview" --preview-window="hidden" --tiebreak='begin' \ --bind 'ctrl-v:toggle-preview,ctrl-space:toggle-preview' diff --git a/.local/bin/fw b/.local/bin/fw index 75f23af..32443b6 100755 --- a/.local/bin/fw +++ b/.local/bin/fw @@ -1,11 +1,10 @@ #!/bin/sh -export FZF_HIST="${XDG_DATA_HOME:-$HOME/.local/share}/fzf/wiki_history" +export FMD_HIST_NAME="wiki_history" export FZF_HEADER="Search local wiki files" export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --delimiter='/' --with-nth=-3.." -fmd . \ +fmd \ /mnt/storage/Media/Tech/ \ /mnt/storage/Library \ /usr/share/doc/arch-wiki/html/en \ - --exclude '*.css' \ "$@" diff --git a/.local/bin/open b/.local/bin/open index 9b83265..b054729 100755 --- a/.local/bin/open +++ b/.local/bin/open @@ -42,7 +42,9 @@ for file in "$@"; do esac + [ -z "$OPEN_HISTFILE" ] && + export OPEN_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/open_history" file="$(realpath "$file")" - sed -i "\|^$file$|d" "${XDG_DATA_HOME:-$HOME/.local/share}/openhist" - echo "$file" >> "${XDG_DATA_HOME:-$HOME/.local/share}/openhist" + sed -i "\|^$file$|d" "$OPEN_HISTFILE" + echo "$file" >> "$OPEN_HISTFILE" done diff --git a/.local/bin/preview b/.local/bin/preview index b71d0f0..f15e884 100755 --- a/.local/bin/preview +++ b/.local/bin/preview @@ -1,22 +1,23 @@ #!/bin/sh if [ -d "$1" ]; then - if [ -x /bin/eza ] || [ -x /usr/bin/eza ]; then + if command -v eza >/dev/null; then eza -alhF --group-directories-first --color=always --icons=always -- "$1" else ls -lhAF --group-directories-first --color=always -- "$1" fi readme="$(find "$1" -maxdepth 1 -name "README.*" | head -1)" - [ -n "$readme" ] && preview "$readme" + [ -z "$readme" ] || preview "$readme" exit fi alias highlight='highlight --out-format=ansi' +alias glow='glow -s dark --width="$(( "${FZF_PREVIEW_COLUMNS:-"$(tput cols)"}" - 5 ))"' case "$1" in '') echo "USAGE: preview " >&2; exit 1 ;; *.html) w3m -dump "$1" ;; - *.md) glow -s dark --width="${FZF_PREVIEW_COLUMNS:-"$(tput cols)"}" "$1" ;; + *.md) glow "$1" ;; # *.vim) highlight --syntax=vim --replace-tabs=2 -- "$1" ;; *.js|*.vim|*.lua) highlight -- "$1" ;; *.txt|*.description|*.srt) cat -- "$1" ;; @@ -44,7 +45,7 @@ case "$1" in filetype=$(file --dereference --brief --mime-type "$1") case $filetype in *html) w3m -dump "$1" ;; - text/markdown) glow -s dark -w "$(tput cols)" "$1" ;; + text/markdown) glow "$1" ;; application/json) highlight --syntax=json --replace-tabs=2 -- "$1" ;; text/*) highlight --force -- "$1" ;; audio/*|video/*|image/*) mediainfo -- "$1" ;; diff --git a/.local/bin/search b/.local/bin/search deleted file mode 100755 index d9c1a3d..0000000 --- a/.local/bin/search +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -help() { echo "search - search tool for unix users - -USAGE: - search [OPTION]... - -OPTIONS: - -h show this help message"; } - -err() { printf 'search: %s\n' "$@" >&2; exit 1; } -while getopts 'h' o; do case "$o" in - h) help >&2; exit ;; - *) err "invalid option -- '$OPTARG'" ;; -esac done -shift $((OPTIND - 1)) - -if [ "$PREVIEWFLAG" = 0 ]; then - [ -z "$INDEX" ] && export INDEX="$(echo "$*" | cut -d: -f1)" - [ -z "$LINE" ] && export LINE="$(echo "$*" | cut -d: -f2-)" - - case "$INDEX" in - wiki) "${FILE_HANDLER:-preview}" "/usr/share/doc/$LINE" ;; - docs) "${FILE_HANDLER:-preview}" "$HOME/.local/share/Zeal/Zeal/docsets/$LINE" ;; - media) "${FILE_HANDLER:-preview}" "/run/media/$USER/Storage/Media/$LINE" ;; - library) "${FILE_HANDLER:-preview}" "/run/media/$USER/Storage/Library/$LINE" ;; - tldr) tldr --color=always "$LINE" ;; - word) sdcv-dict "$LINE" ;; - man) - page="${LINE%%)*}"; name="${page%%[ (]*}"; section="${page#*(}" - if [ "$name" != "$section" ]; then - man "$section" "$name" - else - man "$name" - fi - ;; - pacman) pacman --color=always -Si "${LINE%% *}" ;; - esac - exit -fi - -if [ "$OPENFLAG" = 0 ]; then - export INDEX="$(echo "$*" | cut -d: -f1)" - export LINE="$(echo "$*" | cut -d: -f2-)" - export FILE_HANDLER="open" - - case "$INDEX" in - wiki|docs|web-docs|media|library|man) PREVIEWFLAG=0 search ;; - *) PREVIEWFLAG=0 search | less -r ;; - esac - exit -fi - -[ "$#" -lt 1 ] && help >&2 && exit 1 -FZF_HIST="$HOME/.local/share/fzf/search_history" - -cd "${SEARCHDB:-$HOME/.cache/search}" || exit -mkdir -pv ~/.local/share/fzf -grep -Rsi --color=always "$@" | fzf --ansi \ - --history="$FZF_HIST" \ - --preview="PREVIEWFLAG=0 search {}" \ - --bind 'enter:execute(echo {} >> $FZF_HIST; OPENFLAG=0 search {})' diff --git a/.local/bin/searchdb b/.local/bin/searchdb deleted file mode 100755 index 57e3fa8..0000000 --- a/.local/bin/searchdb +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -help() { - echo "searchdb - update local search database - -USAGE: - searchdb [OPTION]... - -OPTIONS: - -x clear all databases - -h show this help message" -} - -err() { printf 'searchdb: %s\n' "$@" >&2; exit 1; } -while getopts 'xh' o; do case "$o" in - x) rm -rf ~/.cache/search; exit ;; - h) help >&2; exit ;; - *) err "invalid option -- '$OPTARG'" ;; -esac done -shift $((OPTIND - 1)) - -rm -rf ~/.cache/search -export SEARCHDB="$HOME/.cache/search" -mkdir -p "$SEARCHDB" || exit -ln -sf /usr/share/dict/words "$SEARCHDB/word" - -tldr --list > "$SEARCHDB/tldr" -apropos . > "$SEARCHDB/man" -pacman -Ss | sed -e "N;s/\n\s*/ => /" > "$SEARCHDB/pacman" - -list() { find -L "$@" ! -wholename '*/.git*' -printf "%P\n"; } -list /usr/share/doc > "$SEARCHDB/wiki" -list ~/.local/share/Zeal/Zeal/docsets > "$SEARCHDB/docs" -list -L "/run/media/$USER/Storage/Media" > "$SEARCHDB/media" -list "/run/media/$USER/Storage/Library" > "$SEARCHDB/library" diff --git a/.local/bin/shorts/preview-bat b/.local/bin/shorts/preview-bat deleted file mode 100755 index 43d1532..0000000 --- a/.local/bin/shorts/preview-bat +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -bat --tabs=2 --style=plain --color=always "$@" diff --git a/.local/bin/shorts/preview-highlight b/.local/bin/shorts/preview-highlight deleted file mode 100755 index 0972538..0000000 --- a/.local/bin/shorts/preview-highlight +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -highlight --force --stdout --replace-tabs=2 --out-format=ansi "$@" diff --git a/.local/bin/text-preview b/.local/bin/text-preview new file mode 100755 index 0000000..4d0931d --- /dev/null +++ b/.local/bin/text-preview @@ -0,0 +1,23 @@ +#!/bin/sh + +# A simple text previewer. +# Useful in certain cases when you don't want to use your glorified previewer +# and just see the raw text content of a processable document like a markdown +# file. + +[ -f "$1" ] && { + if command -v highlight >/dev/null; then + highlight --out-format=ansi -- "$1" + elif command -v bat >/dev/null; then + bat -- "$1" + else + cat -- "$1" + fi + exit +} + +if command -v eza >/dev/null; then + eza -alhF --group-directories-first --color=always --icons=always -- "$1" +else + ls -lhAF --group-directories-first --color=always -- "$1" +fi -- cgit v1.2.3