From 18507fd21b7a7709133d8f3049c683e1abffcda2 Mon Sep 17 00:00:00 2001 From: Vikas Kushwaha Date: Fri, 24 Jan 2025 10:35:59 +0530 Subject: jupyter update --- .config/Thunar/accels.scm | 199 ++-- .config/Zeal/Zeal.conf | 2 +- .config/fd/ignore | 3 + .config/i3/config | 2 +- ...story-corrupt-2024-12-09T13.25.20.800268.sqlite | Bin 147456 -> 0 bytes ...story-corrupt-2024-12-09T13.44.23.964600.sqlite | Bin 28672 -> 0 bytes .config/ipython/profile_default/history.sqlite | Bin 40960 -> 294912 bytes .config/ipython/profile_default/ipython_config.py | 20 + .config/jupyter/jupyter_console_config.py | 666 ++++++++++++ .config/jupyter/jupyter_notebook_config.py | 1116 ++++++++++++++++++++ .config/jupyter/jupyter_server_config.json | 5 + .../jupyterlab_vim/plugin.jupyterlab-settings | 11 + .../application-extension/top.jupyterlab-settings | 10 + .../full-width-notebook.jupyterlab-settings | 10 + .../shell.jupyterlab-settings | 8 + .../notification.jupyterlab-settings | 10 + .../apputils-extension/themes.jupyterlab-settings | 26 + .../plugin.jupyterlab-settings | 11 + .../browser.jupyterlab-settings | 26 + .../plugin.jupyterlab-settings | 29 + .../notebook-extension/tracker.jupyterlab-settings | 10 + .../statusbar-extension/plugin.jupyterlab-settings | 10 + .../workspaces/default-37a8.jupyterlab-workspace | 1 + .config/jupyter/migrated | 1 + .config/lf/lfrc | 17 +- .config/shell/aliasrc | 12 +- .config/shell/bm-dirs | 3 +- .config/shell/bm-files | 1 + .config/shell/profile | 8 +- .config/zsh/.zshrc | 33 +- .config/zsh/plugins/fzf-completion.zsh | 329 ------ .config/zsh/plugins/zsh-autosuggestions | 1 + .config/zsh/plugins/zsh-autosuggestions.zsh | 864 --------------- .config/zsh/plugins/zsh-history-substring-search | 1 + .../zsh/plugins/zsh-history-substring-search.zsh | 759 ------------- .gitignore | 2 + .gitmodules | 6 + .local/bin/desktop/show-i3-keybindings | 2 +- .local/bin/development/dev | 7 +- .local/bin/development/gitpush | 5 +- .local/bin/development/ipy | 6 +- .local/bin/development/jp | 16 + .local/bin/development/jpconvert | 16 + .local/bin/development/pyh | 2 + .local/bin/fmd | 11 +- .local/bin/fw | 9 +- .local/bin/preview | 6 +- .local/share/applications/omnetpp-6.1-ide.desktop | 6 + .../share/applications/omnetpp-6.1-shell.desktop | 7 + 49 files changed, 2202 insertions(+), 2103 deletions(-) create mode 100644 .config/fd/ignore delete mode 100644 .config/ipython/profile_default/history-corrupt-2024-12-09T13.25.20.800268.sqlite delete mode 100644 .config/ipython/profile_default/history-corrupt-2024-12-09T13.44.23.964600.sqlite create mode 100644 .config/jupyter/jupyter_console_config.py create mode 100644 .config/jupyter/jupyter_notebook_config.py create mode 100644 .config/jupyter/jupyter_server_config.json create mode 100644 .config/jupyter/lab/user-settings/@axlair/jupyterlab_vim/plugin.jupyterlab-settings create mode 100644 .config/jupyter/lab/user-settings/@jupyter-notebook/application-extension/top.jupyterlab-settings create mode 100644 .config/jupyter/lab/user-settings/@jupyter-notebook/notebook-extension/full-width-notebook.jupyterlab-settings create mode 100644 .config/jupyter/lab/user-settings/@jupyterlab/application-extension/shell.jupyterlab-settings create mode 100644 .config/jupyter/lab/user-settings/@jupyterlab/apputils-extension/notification.jupyterlab-settings create mode 100644 .config/jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings create mode 100644 .config/jupyter/lab/user-settings/@jupyterlab/extensionmanager-extension/plugin.jupyterlab-settings create mode 100644 .config/jupyter/lab/user-settings/@jupyterlab/filebrowser-extension/browser.jupyterlab-settings create mode 100644 .config/jupyter/lab/user-settings/@jupyterlab/fileeditor-extension/plugin.jupyterlab-settings create mode 100644 .config/jupyter/lab/user-settings/@jupyterlab/notebook-extension/tracker.jupyterlab-settings create mode 100644 .config/jupyter/lab/user-settings/@jupyterlab/statusbar-extension/plugin.jupyterlab-settings create mode 100644 .config/jupyter/lab/workspaces/default-37a8.jupyterlab-workspace create mode 100644 .config/jupyter/migrated delete mode 100644 .config/zsh/plugins/fzf-completion.zsh create mode 160000 .config/zsh/plugins/zsh-autosuggestions delete mode 100644 .config/zsh/plugins/zsh-autosuggestions.zsh create mode 160000 .config/zsh/plugins/zsh-history-substring-search delete mode 100644 .config/zsh/plugins/zsh-history-substring-search.zsh create mode 100755 .local/bin/development/jp create mode 100755 .local/bin/development/jpconvert create mode 100755 .local/share/applications/omnetpp-6.1-ide.desktop create mode 100755 .local/share/applications/omnetpp-6.1-shell.desktop diff --git a/.config/Thunar/accels.scm b/.config/Thunar/accels.scm index fb9c2c7..b140458 100644 --- a/.config/Thunar/accels.scm +++ b/.config/Thunar/accels.scm @@ -1,117 +1,126 @@ ; Thunar GtkAccelMap rc-file -*- scheme -*- ; this file is an automated accelerator map dump ; -; (gtk_accel_path "/ThunarActionManager/restore" "") -; (gtk_accel_path "/ThunarActionManager/undo" "z") -; (gtk_accel_path "/ThunarStandardView/select-all-files" "a") -; (gtk_accel_path "/ThunarBookmarks/0064c8b8c2b8ae1954479b6f2feab576" "") -; (gtk_accel_path "/ThunarStandardView/sort-by-dtime" "") +; (gtk_accel_path "/ThunarStandardView/sort-by-type" "") ; (gtk_accel_path "/ThunarStatusBar/toggle-last-modified" "") -; (gtk_accel_path "/ThunarStandardView/invert-selection" "") -; (gtk_accel_path "/ThunarStatusBar/toggle-display-name" "") +; (gtk_accel_path "/Thunarwindow/menu" "") ; (gtk_accel_path "/ThunarActionManager/cut" "x") -; (gtk_accel_path "/ThunarActionManager/restore-show" "") -; (gtk_accel_path "/ThunarWindow/zoom-in" "plus") -; (gtk_accel_path "/ThunarStandardView/sort-ascending" "") -; (gtk_accel_path "/ThunarWindow/empty-trash" "") -; (gtk_accel_path "/ThunarWindow/reload" "r") -; (gtk_accel_path "/ThunarWindow/toggle-image-preview" "") -; (gtk_accel_path "/ThunarActionManager/cut-2" "") -; (gtk_accel_path "/ThunarWindow/view-side-pane-menu" "") -; (gtk_accel_path "/ThunarActionManager/trash-delete" "Delete") -; (gtk_accel_path "/ThunarWindow/open-network" "") -; (gtk_accel_path "/ThunarActionManager/trash-delete-2" "KP_Delete") -; (gtk_accel_path "/ThunarWindow/contents/help-menu" "") -; (gtk_accel_path "/ThunarActionManager/delete" "") -; (gtk_accel_path "/ThunarStandardView/set-default-app" "") -; (gtk_accel_path "/ThunarStandardView/back-alt" "BackSpace") -; (gtk_accel_path "/ThunarActionManager/open-in-new-tab" "p") -; (gtk_accel_path "/ThunarWindow/switch-next-tab" "Page_Down") -; (gtk_accel_path "/ThunarWindow/open-file-menu" "F10") -; (gtk_accel_path "/ThunarWindow/view-as-compact-list" "3") -; (gtk_accel_path "/ThunarWindow/about" "") -; (gtk_accel_path "/ThunarWindow/open-computer" "") +; (gtk_accel_path "/ThunarStandardView/sort-by-size" "") +; (gtk_accel_path "/ThunarWindow/file-menu" "") +; (gtk_accel_path "/ThunarWindow/close-tab" "w") +; (gtk_accel_path "/ThunarWindow/switch-previous-tab-alt" "ISO_Left_Tab") +; (gtk_accel_path "/ThunarStatusBar/toggle-size" "") +; (gtk_accel_path "/ThunarWindow/new-window" "n") ; (gtk_accel_path "/ThunarWindow/clear-directory-specific-settings" "") -; (gtk_accel_path "/ThunarWindow/open-file-system" "") +; (gtk_accel_path "/ThunarWindow/close-window" "q") ; (gtk_accel_path "/ThunarWindow/open-parent" "Up") -; (gtk_accel_path "/ThunarWindow/view-menu" "") -; (gtk_accel_path "/ThunarActionManager/copy" "c") -; (gtk_accel_path "/ThunarStandardView/properties" "Return") -; (gtk_accel_path "/ThunarStandardView/back" "Left") -; (gtk_accel_path "/ThunarWindow/sendto-menu" "") -; (gtk_accel_path "/ThunarStandardView/sort-by-mtime" "") -; (gtk_accel_path "/ThunarActionManager/open-location" "") -; (gtk_accel_path "/ThunarWindow/bookmarks-menu" "") -; (gtk_accel_path "/ThunarWindow/reload-alt" "F5") -; (gtk_accel_path "/ThunarWindow/view-location-selector-buttons" "") +; (gtk_accel_path "/ThunarWindow/view-side-pane-menu" "") ; (gtk_accel_path "/ThunarStatusBar/toggle-size-in-bytes" "") -; (gtk_accel_path "/ThunarStandardView/unselect-all-files" "Escape") +; (gtk_accel_path "/ThunarWindow/switch-previous-tab" "Page_Up") +; (gtk_accel_path "/ThunarActionManager/open" "o") +; (gtk_accel_path "/ThunarStandardView/sort-ascending" "") +; (gtk_accel_path "/ThunarWindow/toggle-split-view" "F3") ; (gtk_accel_path "/ThunarActionManager/copy-2" "Insert") +; (gtk_accel_path "/ThunarActionManager/trash-delete" "Delete") +; (gtk_accel_path "/ThunarWindow/open-recent" "") +; (gtk_accel_path "/ThunarWindow/view-configure-toolbar" "") +; (gtk_accel_path "/ThunarStandardView/forward" "Right") +; (gtk_accel_path "/ThunarActionManager/restore" "") +; (gtk_accel_path "/ThunarWindow/open-location-alt" "d") ; (gtk_accel_path "/ThunarWindow/zoom-out-alt" "KP_Subtract") -; (gtk_accel_path "/ThunarWindow/cancel-search" "Escape") ; (gtk_accel_path "/ThunarStandardView/select-by-pattern" "s") -; (gtk_accel_path "/ThunarStandardView/rename" "F2") -; (gtk_accel_path "/ThunarStandardView/create-document" "") -; (gtk_accel_path "/ThunarShortcutsPane/sendto-shortcuts" "d") -; (gtk_accel_path "/ThunarActionManager/move-to-trash" "") -; (gtk_accel_path "/ThunarWindow/close-tab" "w") -; (gtk_accel_path "/ThunarWindow/view-side-pane-tree" "e") -; (gtk_accel_path "/ThunarActionManager/open" "o") -; (gtk_accel_path "/ThunarWindow/toggle-side-pane" "F9") -; (gtk_accel_path "/ThunarWindow/view-location-selector-entry" "") -; (gtk_accel_path "/ThunarWindow/open-recent" "") -; (gtk_accel_path "/ThunarWindow/open-home" "Home") -; (gtk_accel_path "/ThunarWindow/toggle-split-view" "F3") +; (gtk_accel_path "/ThunarWindow/open-file-menu" "F10") +; (gtk_accel_path "/ThunarWindow/contents" "F1") +; (gtk_accel_path "/ThunarWindow/show-highlight" "") +; (gtk_accel_path "/ThunarStandardView/sort-descending" "") +; (gtk_accel_path "/ThunarStandardView/sort-by-name" "") +; (gtk_accel_path "/ThunarStandardView/select-all-files" "a") +; (gtk_accel_path "/ThunarActionManager/execute" "") +; (gtk_accel_path "/ThunarStandardView/properties" "Return") +; (gtk_accel_path "/ThunarActionManager/cut-2" "") +; (gtk_accel_path "/ThunarStandardView/sort-by-dtime" "") +; (gtk_accel_path "/ThunarWindow/switch-next-tab" "Page_Down") ; (gtk_accel_path "/ThunarWindow/open-templates" "") -; (gtk_accel_path "/ThunarWindow/open-location-alt" "d") -; (gtk_accel_path "/ThunarStandardView/create-folder" "n") -; (gtk_accel_path "/ThunarWindow/search" "f") -; (gtk_accel_path "/ThunarStandardView/sort-by-type" "") ; (gtk_accel_path "/ThunarActionManager/paste-2" "Insert") +; (gtk_accel_path "/ThunarStatusBar/toggle-filetype" "") +; (gtk_accel_path "/ThunarWindow/close-all-windows" "w") +; (gtk_accel_path "/ThunarStandardView/create-document" "") +; (gtk_accel_path "/ThunarWindow/detach-tab" "") +; (gtk_accel_path "/ThunarWindow/cancel-search" "Escape") ; (gtk_accel_path "/ThunarWindow/zoom-in-alt2" "equal") -; (gtk_accel_path "/ThunarStandardView/duplicate" "") -; (gtk_accel_path "/ThunarWindow/remove-from-recent" "") -; (gtk_accel_path "/ThunarWindow/zoom-out" "minus") -; (gtk_accel_path "/ThunarWindow/close-window" "q") -; (gtk_accel_path "/ThunarWindow/edit-menu" "") -; (gtk_accel_path "/ThunarWindow/view-side-pane-shortcuts" "b") -; (gtk_accel_path "/ThunarWindow/show-highlight" "") -; (gtk_accel_path "/ThunarWindow/contents" "F1") -; (gtk_accel_path "/ThunarWindow/preferences" "") -; (gtk_accel_path "/ThunarWindow/switch-previous-tab" "Page_Up") -; (gtk_accel_path "/ThunarWindow/zoom-in-alt1" "KP_Add") +; (gtk_accel_path "/ThunarStatusBar/toggle-hidden-count" "") +; (gtk_accel_path "/ThunarShortcutsPane/sendto-shortcuts" "d") +; (gtk_accel_path "/ThunarActionManager/undo" "z") +; (gtk_accel_path "/ThunarBookmarks/0064c8b8c2b8ae1954479b6f2feab576" "") ; (gtk_accel_path "/ThunarStandardView/toggle-sort-order" "") -; (gtk_accel_path "/ThunarActionManager/open-in-new-window" "o") -; (gtk_accel_path "/ThunarWindow/view-configure-toolbar" "") -; (gtk_accel_path "/ThunarWindow/view-location-selector-menu" "") -; (gtk_accel_path "/ThunarWindow/view-statusbar" "") -; (gtk_accel_path "/ThunarWindow/close-all-windows" "w") -; (gtk_accel_path "/ThunarWindow/open-trash" "") +; (gtk_accel_path "/ThunarWindow/view-location-selector-entry" "") ; (gtk_accel_path "/ThunarActionManager/paste" "v") -; (gtk_accel_path "/ThunarActionManager/delete-3" "KP_Delete") -; (gtk_accel_path "/ThunarActionManager/execute" "") -; (gtk_accel_path "/ThunarWindow/open-desktop" "") -; (gtk_accel_path "/ThunarActionManager/open-with-other" "") -; (gtk_accel_path "/ThunarStatusBar/toggle-size" "") -; (gtk_accel_path "/ThunarActionManager/sendto-desktop" "") -; (gtk_accel_path "/ThunarWindow/open-location" "l") +; (gtk_accel_path "/ThunarWindow/zoom-in-alt1" "KP_Add") ; (gtk_accel_path "/ThunarWindow/view-menubar" "m") -; (gtk_accel_path "/ThunarWindow/zoom-reset-alt" "KP_0") +; (gtk_accel_path "/ThunarStandardView/back" "Left") +; (gtk_accel_path "/ThunarWindow/open-desktop" "") ; (gtk_accel_path "/ThunarWindow/view-as-detailed-list" "2") +; (gtk_accel_path "/ThunarActionManager/restore-show" "") +; (gtk_accel_path "/ThunarWindow/sendto-menu" "") +; (gtk_accel_path "/ThunarStatusBar/toggle-display-name" "") +; (gtk_accel_path "/ThunarWindow/go-menu" "") +; (gtk_accel_path "/ThunarWindow/zoom-out" "minus") +; (gtk_accel_path "/ThunarWindow/remove-from-recent" "") +; (gtk_accel_path "/ThunarActionManager/open-with-other" "") +; (gtk_accel_path "/ThunarStandardView/invert-selection" "i") +; (gtk_accel_path "/ThunarWindow/view-side-pane-shortcuts" "b") +; (gtk_accel_path "/ThunarWindow/reload-alt-2" "Reload") +; (gtk_accel_path "/ThunarWindow/view-location-selector-menu" "") +; (gtk_accel_path "/ThunarWindow/reload" "r") +; (gtk_accel_path "/ThunarWindow/edit-menu" "") +; (gtk_accel_path "/ThunarActionManager/copy" "c") +; (gtk_accel_path "/ThunarWindow/bookmarks-menu" "") +; (gtk_accel_path "/ThunarStandardView/forward-alt" "Forward") +; (gtk_accel_path "/ThunarActionManager/move-to-trash" "") +; (gtk_accel_path "/ThunarWindow/reload-alt-1" "F5") +; (gtk_accel_path "/ThunarActionManager/delete-3" "KP_Delete") +; (gtk_accel_path "/ThunarStandardView/unselect-all-files" "Escape") +; (gtk_accel_path "/ThunarWindow/contents/help-menu" "") +; (gtk_accel_path "/ThunarStandardView/arrange-items-menu" "") +; (gtk_accel_path "/ThunarStandardView/sort-by-mtime" "") +; (gtk_accel_path "/ThunarWindow/open-computer" "") +; (gtk_accel_path "/ThunarWindow/toggle-image-preview" "") +; (gtk_accel_path "/ThunarWindow/toggle-side-pane" "F9") ; (gtk_accel_path "/ThunarWindow/view-as-icons" "1") -; (gtk_accel_path "/ThunarWindow/new-window" "n") -; (gtk_accel_path "/ThunarStandardView/forward" "Right") -; (gtk_accel_path "/ThunarActionManager/redo" "z") -; (gtk_accel_path "/ThunarStandardView/sort-descending" "") -; (gtk_accel_path "/ThunarWindow/file-menu" "") -; (gtk_accel_path "/ThunarStandardView/make-link" "") ; (gtk_accel_path "/ThunarActionManager/delete-2" "Delete") +; (gtk_accel_path "/ThunarWindow/zoom-in" "plus") +; (gtk_accel_path "/ThunarStandardView/rename" "F2") +; (gtk_accel_path "/ThunarWindow/open-location" "l") +; (gtk_accel_path "/ThunarWindow/view-as-compact-list" "3") +; (gtk_accel_path "/ThunarWindow/view-menu" "") +; (gtk_accel_path "/ThunarWindow/search" "f") ; (gtk_accel_path "/ThunarWindow/new-tab" "t") -; (gtk_accel_path "/ThunarWindow/go-menu" "") -; (gtk_accel_path "/ThunarStandardView/sort-by-size" "") -; (gtk_accel_path "/ThunarStandardView/arrange-items-menu" "") -; (gtk_accel_path "/ThunarWindow/show-hidden" "h") -; (gtk_accel_path "/ThunarStandardView/sort-by-name" "") ; (gtk_accel_path "/ThunarWindow/zoom-reset" "0") -; (gtk_accel_path "/ThunarStatusBar/toggle-filetype" "") -; (gtk_accel_path "/ThunarWindow/detach-tab" "") +; (gtk_accel_path "/ThunarStandardView/back-alt2" "Back") +; (gtk_accel_path "/ThunarActionManager/open-in-new-tab" "p") +; (gtk_accel_path "/ThunarWindow/view-location-selector-buttons" "") +; (gtk_accel_path "/ThunarActionManager/redo" "z") +; (gtk_accel_path "/ThunarWindow/open-trash" "") +; (gtk_accel_path "/ThunarActionManager/open-in-new-window" "o") +; (gtk_accel_path "/ThunarWindow/view-statusbar" "") +; (gtk_accel_path "/ThunarActionManager/open-location" "") +; (gtk_accel_path "/ThunarStandardView/duplicate" "") +; (gtk_accel_path "/ThunarActionManager/trash-delete-2" "KP_Delete") +; (gtk_accel_path "/ThunarStandardView/back-alt1" "BackSpace") +; (gtk_accel_path "/ThunarStandardView/create-folder" "n") +; (gtk_accel_path "/ThunarWindow/open-home" "Home") +; (gtk_accel_path "/ThunarWindow/switch-focused-split-view-pane" "") +; (gtk_accel_path "/ThunarWindow/show-hidden" "h") +; (gtk_accel_path "/ThunarStandardView/set-default-app" "") +; (gtk_accel_path "/ThunarWindow/empty-trash" "") +; (gtk_accel_path "/ThunarWindow/preferences" "") +; (gtk_accel_path "/ThunarActionManager/delete" "") +; (gtk_accel_path "/ThunarWindow/open-network" "") +; (gtk_accel_path "/ThunarWindow/view-side-pane-tree" "e") +; (gtk_accel_path "/ThunarWindow/open-file-system" "") +; (gtk_accel_path "/ThunarWindow/search-alt" "Search") +; (gtk_accel_path "/ThunarWindow/switch-next-tab-alt" "Tab") +; (gtk_accel_path "/ThunarActionManager/sendto-desktop" "") +; (gtk_accel_path "/ThunarStandardView/make-link" "") +; (gtk_accel_path "/ThunarWindow/zoom-reset-alt" "KP_0") +; (gtk_accel_path "/ThunarWindow/about" "") diff --git a/.config/Zeal/Zeal.conf b/.config/Zeal/Zeal.conf index aee4b0c..07ee3ae 100644 --- a/.config/Zeal/Zeal.conf +++ b/.config/Zeal/Zeal.conf @@ -46,7 +46,7 @@ fuzzy_search_enabled=true [state] splitter_geometry=@ByteArray(\0\0\0\xff\0\0\0\x1\0\0\0\x2\0\0\x1X\0\0\x5P\0\xff\xff\xff\xff\x1\0\0\0\x1\0) toc_splitter_state=@ByteArray() -window_geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\a\x80\0\0\0\0\0\0\xf\x88\0\0\x4i\0\0\a\x80\0\0\0\0\0\0\xf\x88\0\0\x4i\0\0\0\x1\0\0\0\0\b\t\0\0\a\x80\0\0\0\0\0\0\xf\x88\0\0\x4i) +window_geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\x1(\0\0\x6m\0\0\x4\x8f\0\0\a\x81\0\0\0\x19\0\0\xf\x87\0\0\x4\x82\0\0\0\0\x2\0\0\0\x6n\0\0\0\0\0\0\x1(\0\0\x6m\0\0\x4\x8f) [tabs] open_new_tab_after_active=true diff --git a/.config/fd/ignore b/.config/fd/ignore new file mode 100644 index 0000000..5c4b5bc --- /dev/null +++ b/.config/fd/ignore @@ -0,0 +1,3 @@ +.git +node_modules +.thumbnails diff --git a/.config/i3/config b/.config/i3/config index f6739da..37c3ac7 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -34,7 +34,7 @@ set $homeScreenWallpaper '/usr/share/wallpapers/garuda-wallpapers/background.jpg ### Applications: ### set $preferredTerminalEmulator $TERMINAL -set $preferredBrowser torbrowser open +set $preferredBrowser librewolf set $preferredFileManager thunar set $preferredMailClient $MAIL set $preferredTextEditor $EDITOR diff --git a/.config/ipython/profile_default/history-corrupt-2024-12-09T13.25.20.800268.sqlite b/.config/ipython/profile_default/history-corrupt-2024-12-09T13.25.20.800268.sqlite deleted file mode 100644 index 77a1302..0000000 Binary files a/.config/ipython/profile_default/history-corrupt-2024-12-09T13.25.20.800268.sqlite and /dev/null differ diff --git a/.config/ipython/profile_default/history-corrupt-2024-12-09T13.44.23.964600.sqlite b/.config/ipython/profile_default/history-corrupt-2024-12-09T13.44.23.964600.sqlite deleted file mode 100644 index 4736b07..0000000 Binary files a/.config/ipython/profile_default/history-corrupt-2024-12-09T13.44.23.964600.sqlite and /dev/null differ diff --git a/.config/ipython/profile_default/history.sqlite b/.config/ipython/profile_default/history.sqlite index 294b3ed..293b944 100644 Binary files a/.config/ipython/profile_default/history.sqlite and b/.config/ipython/profile_default/history.sqlite differ diff --git a/.config/ipython/profile_default/ipython_config.py b/.config/ipython/profile_default/ipython_config.py index 83056e8..02cbf3b 100644 --- a/.config/ipython/profile_default/ipython_config.py +++ b/.config/ipython/profile_default/ipython_config.py @@ -1144,3 +1144,23 @@ c.TerminalInteractiveShell.prompt_includes_vi_mode = False # when IPython starts. # Default: False # c.StoreMagics.autorestore = False + +# Configure prompt +# try: +# from IPython.terminal.prompts import Prompts as BasePrompts +# except ImportError: +# pass # not IPython 5.0 +# else: +# from pygments.token import Token +# from time import strftime + +# class MyPrompts(BasePrompts): +# def in_prompt_tokens(self, cli=None): +# return [ +# (Token.Prompt, strftime('%H:%M') + ' '), +# (Token.PromptNum, str(self.shell.execution_count)), +# (Token.Prompt, ' >>> '), +# ] + +# c.InteractiveShell.prompts_class = MyPrompts + diff --git a/.config/jupyter/jupyter_console_config.py b/.config/jupyter/jupyter_console_config.py new file mode 100644 index 0000000..ce0ccea --- /dev/null +++ b/.config/jupyter/jupyter_console_config.py @@ -0,0 +1,666 @@ +# Configuration file for jupyter-console. + +c = get_config() #noqa + +#------------------------------------------------------------------------------ +# ConnectionFileMixin(LoggingConfigurable) configuration +#------------------------------------------------------------------------------ +## Mixin for configurable classes that work with connection files + +## JSON file in which to store connection info [default: kernel-.json] +# +# This file will contain the IP, ports, and authentication key needed to connect +# clients to this kernel. By default, this file will be created in the security dir +# of the current profile, but can be specified by absolute path. +# Default: '' +# c.ConnectionFileMixin.connection_file = '' + +## set the control (ROUTER) port [default: random] +# Default: 0 +# c.ConnectionFileMixin.control_port = 0 + +## set the heartbeat port [default: random] +# Default: 0 +# c.ConnectionFileMixin.hb_port = 0 + +## set the iopub (PUB) port [default: random] +# Default: 0 +# c.ConnectionFileMixin.iopub_port = 0 + +## Set the kernel's IP address [default localhost]. +# If the IP address is something other than localhost, then +# Consoles on other machines will be able to connect +# to the Kernel, so be careful! +# Default: '' +# c.ConnectionFileMixin.ip = '' + +## set the shell (ROUTER) port [default: random] +# Default: 0 +# c.ConnectionFileMixin.shell_port = 0 + +## set the stdin (ROUTER) port [default: random] +# Default: 0 +# c.ConnectionFileMixin.stdin_port = 0 + +# Choices: any of ['tcp', 'ipc'] (case-insensitive) +# Default: 'tcp' +# c.ConnectionFileMixin.transport = 'tcp' + +#------------------------------------------------------------------------------ +# JupyterConsoleApp(ConnectionFileMixin) configuration +#------------------------------------------------------------------------------ +## The base Jupyter console application. + +## Set to display confirmation dialog on exit. You can always use 'exit' or +# 'quit', to force a direct exit without any confirmation. +# Default: True +c.JupyterConsoleApp.confirm_exit = False + +## JSON file in which to store connection info [default: kernel-.json] +# See also: ConnectionFileMixin.connection_file +# c.JupyterConsoleApp.connection_file = '' + +## set the control (ROUTER) port [default: random] +# See also: ConnectionFileMixin.control_port +# c.JupyterConsoleApp.control_port = 0 + +## Connect to an already running kernel +# Default: '' +# c.JupyterConsoleApp.existing = '' + +## set the heartbeat port [default: random] +# See also: ConnectionFileMixin.hb_port +# c.JupyterConsoleApp.hb_port = 0 + +## set the iopub (PUB) port [default: random] +# See also: ConnectionFileMixin.iopub_port +# c.JupyterConsoleApp.iopub_port = 0 + +## Set the kernel's IP address [default localhost]. +# See also: ConnectionFileMixin.ip +# c.JupyterConsoleApp.ip = '' + +## The kernel manager class to use. +# Default: 'jupyter_client.manager.KernelManager' +# c.JupyterConsoleApp.kernel_manager_class = 'jupyter_client.manager.KernelManager' + +## The name of the default kernel to start. +# Default: 'python' +# c.JupyterConsoleApp.kernel_name = 'python' + +## set the shell (ROUTER) port [default: random] +# See also: ConnectionFileMixin.shell_port +# c.JupyterConsoleApp.shell_port = 0 + +## Path to the ssh key to use for logging in to the ssh server. +# Default: '' +# c.JupyterConsoleApp.sshkey = '' + +## The SSH server to use to connect to the kernel. +# Default: '' +# c.JupyterConsoleApp.sshserver = '' + +## set the stdin (ROUTER) port [default: random] +# See also: ConnectionFileMixin.stdin_port +# c.JupyterConsoleApp.stdin_port = 0 + +# See also: ConnectionFileMixin.transport +# c.JupyterConsoleApp.transport = 'tcp' + +#------------------------------------------------------------------------------ +# Application(SingletonConfigurable) configuration +#------------------------------------------------------------------------------ +## This is an application. + +## The date format used by logging formatters for %(asctime)s +# Default: '%Y-%m-%d %H:%M:%S' +# c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# Default: '[%(name)s]%(highlevel)s %(message)s' +# c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'] +# Default: 30 +# c.Application.log_level = 30 + +## Configure additional log handlers. +# +# The default stderr logs handler is configured by the log_level, log_datefmt +# and log_format settings. +# +# This configuration can be used to configure additional handlers (e.g. to +# output the log to a file) or for finer control over the default handlers. +# +# If provided this should be a logging configuration dictionary, for more +# information see: +# https://docs.python.org/3/library/logging.config.html#logging-config- +# dictschema +# +# This dictionary is merged with the base logging configuration which defines +# the following: +# +# * A logging formatter intended for interactive use called +# ``console``. +# * A logging handler that writes to stderr called +# ``console`` which uses the formatter ``console``. +# * A logger with the name of this application set to ``DEBUG`` +# level. +# +# This example adds a new handler that writes to a file: +# +# .. code-block:: python +# +# c.Application.logging_config = { +# "handlers": { +# "file": { +# "class": "logging.FileHandler", +# "level": "DEBUG", +# "filename": "", +# } +# }, +# "loggers": { +# "": { +# "level": "DEBUG", +# # NOTE: if you don't list the default "console" +# # handler here then it will be disabled +# "handlers": ["console", "file"], +# }, +# }, +# } +# Default: {} +# c.Application.logging_config = {} + +## Instead of starting the Application, dump configuration to stdout +# Default: False +# c.Application.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# Default: False +# c.Application.show_config_json = False + +#------------------------------------------------------------------------------ +# JupyterApp(Application) configuration +#------------------------------------------------------------------------------ +## Base class for Jupyter applications + +## Answer yes to any prompts. +# Default: False +# c.JupyterApp.answer_yes = False + +## Full path of a config file. +# Default: '' +# c.JupyterApp.config_file = '' + +## Specify a config file to load. +# Default: '' +# c.JupyterApp.config_file_name = '' + +## Generate default config file. +# Default: False +# c.JupyterApp.generate_config = False + +## The date format used by logging formatters for %(asctime)s +# See also: Application.log_datefmt +# c.JupyterApp.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# See also: Application.log_format +# c.JupyterApp.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# See also: Application.log_level +# c.JupyterApp.log_level = 30 + +## +# See also: Application.logging_config +# c.JupyterApp.logging_config = {} + +## Instead of starting the Application, dump configuration to stdout +# See also: Application.show_config +# c.JupyterApp.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# See also: Application.show_config_json +# c.JupyterApp.show_config_json = False + +#------------------------------------------------------------------------------ +# ZMQTerminalIPythonApp(JupyterApp, JupyterConsoleApp) configuration +#------------------------------------------------------------------------------ +## Answer yes to any prompts. +# See also: JupyterApp.answer_yes +# c.ZMQTerminalIPythonApp.answer_yes = False + +## Full path of a config file. +# See also: JupyterApp.config_file +# c.ZMQTerminalIPythonApp.config_file = '' + +## Specify a config file to load. +# See also: JupyterApp.config_file_name +# c.ZMQTerminalIPythonApp.config_file_name = '' + +## +# See also: JupyterConsoleApp.confirm_exit +# c.ZMQTerminalIPythonApp.confirm_exit = True + +## JSON file in which to store connection info [default: kernel-.json] +# See also: ConnectionFileMixin.connection_file +# c.ZMQTerminalIPythonApp.connection_file = '' + +## set the control (ROUTER) port [default: random] +# See also: ConnectionFileMixin.control_port +# c.ZMQTerminalIPythonApp.control_port = 0 + +## Connect to an already running kernel +# See also: JupyterConsoleApp.existing +# c.ZMQTerminalIPythonApp.existing = '' + +## Generate default config file. +# See also: JupyterApp.generate_config +# c.ZMQTerminalIPythonApp.generate_config = False + +## set the heartbeat port [default: random] +# See also: ConnectionFileMixin.hb_port +# c.ZMQTerminalIPythonApp.hb_port = 0 + +## set the iopub (PUB) port [default: random] +# See also: ConnectionFileMixin.iopub_port +# c.ZMQTerminalIPythonApp.iopub_port = 0 + +## Set the kernel's IP address [default localhost]. +# See also: ConnectionFileMixin.ip +# c.ZMQTerminalIPythonApp.ip = '' + +## The kernel manager class to use. +# See also: JupyterConsoleApp.kernel_manager_class +# c.ZMQTerminalIPythonApp.kernel_manager_class = 'jupyter_client.manager.KernelManager' + +## The name of the default kernel to start. +# See also: JupyterConsoleApp.kernel_name +# c.ZMQTerminalIPythonApp.kernel_name = 'python' + +## The date format used by logging formatters for %(asctime)s +# See also: Application.log_datefmt +# c.ZMQTerminalIPythonApp.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# See also: Application.log_format +# c.ZMQTerminalIPythonApp.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# See also: Application.log_level +# c.ZMQTerminalIPythonApp.log_level = 30 + +## +# See also: Application.logging_config +# c.ZMQTerminalIPythonApp.logging_config = {} + +## set the shell (ROUTER) port [default: random] +# See also: ConnectionFileMixin.shell_port +# c.ZMQTerminalIPythonApp.shell_port = 0 + +## Instead of starting the Application, dump configuration to stdout +# See also: Application.show_config +# c.ZMQTerminalIPythonApp.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# See also: Application.show_config_json +# c.ZMQTerminalIPythonApp.show_config_json = False + +## Path to the ssh key to use for logging in to the ssh server. +# See also: JupyterConsoleApp.sshkey +# c.ZMQTerminalIPythonApp.sshkey = '' + +## The SSH server to use to connect to the kernel. +# See also: JupyterConsoleApp.sshserver +# c.ZMQTerminalIPythonApp.sshserver = '' + +## set the stdin (ROUTER) port [default: random] +# See also: ConnectionFileMixin.stdin_port +# c.ZMQTerminalIPythonApp.stdin_port = 0 + +# See also: ConnectionFileMixin.transport +# c.ZMQTerminalIPythonApp.transport = 'tcp' + +#------------------------------------------------------------------------------ +# ZMQTerminalInteractiveShell(SingletonConfigurable) configuration +#------------------------------------------------------------------------------ +## Text to display before the first prompt. Will be formatted with variables +# {version} and {kernel_banner}. +# Default: 'Jupyter console {version}\n\n{kernel_banner}' +# c.ZMQTerminalInteractiveShell.banner = 'Jupyter console {version}\n\n{kernel_banner}' + +## Callable object called via 'callable' image handler with one argument, `data`, +# which is `msg["content"]["data"]` where `msg` is the message from iopub +# channel. For example, you can find base64 encoded PNG data as +# `data['image/png']`. If your function can't handle the data supplied, it +# should return `False` to indicate this. +# Default: None +# c.ZMQTerminalInteractiveShell.callable_image_handler = None + +## Options for displaying tab completions, 'column', 'multicolumn', and +# 'readlinelike'. These options are for `prompt_toolkit`, see `prompt_toolkit` +# documentation for more information. +# Choices: any of ['column', 'multicolumn', 'readlinelike'] +# Default: 'multicolumn' +# c.ZMQTerminalInteractiveShell.display_completions = 'multicolumn' + +## Shortcut style to use at the prompt. 'vi' or 'emacs'. +# Default: 'emacs' +c.ZMQTerminalInteractiveShell.editing_mode = 'vi' + +## Highlight matching brackets. +# Default: True +# c.ZMQTerminalInteractiveShell.highlight_matching_brackets = True + +## The name of a Pygments style to use for syntax highlighting +# Default: '' +# c.ZMQTerminalInteractiveShell.highlighting_style = '' + +## Override highlighting format for specific tokens +# Default: {} +# c.ZMQTerminalInteractiveShell.highlighting_style_overrides = {} + +## How many history items to load into memory +# Default: 1000 +# c.ZMQTerminalInteractiveShell.history_load_length = 1000 + +## Handler for image type output. This is useful, for example, when connecting +# to the kernel in which pylab inline backend is activated. There are four +# handlers defined. 'PIL': Use Python Imaging Library to popup image; 'stream': +# Use an external program to show the image. Image will be fed into the STDIN +# of the program. You will need to configure `stream_image_handler`; +# 'tempfile': Use an external program to show the image. Image will be saved in +# a temporally file and the program is called with the temporally file. You +# will need to configure `tempfile_image_handler`; 'callable': You can set any +# Python callable which is called with the image data. You will need to +# configure `callable_image_handler`. +# Choices: any of ['PIL', 'stream', 'tempfile', 'callable'] or None +# Default: 'PIL' +# c.ZMQTerminalInteractiveShell.image_handler = 'PIL' + +## Whether to include output from clients +# other than this one sharing the same kernel. +# Default: False +# c.ZMQTerminalInteractiveShell.include_other_output = False + +## Timeout (in seconds) for giving up on a kernel's is_complete +# response. +# +# If the kernel does not respond at any point within this time, +# the kernel will no longer be asked if code is complete, and the +# console will default to the built-in is_complete test. +# Default: 1 +# c.ZMQTerminalInteractiveShell.kernel_is_complete_timeout = 1 + +## Timeout for giving up on a kernel (in seconds). +# +# On first connect and restart, the console tests whether the +# kernel is running and responsive by sending kernel_info_requests. +# This sets the timeout in seconds for how long the kernel can take +# before being presumed dead. +# Default: 60 +# c.ZMQTerminalInteractiveShell.kernel_timeout = 60 + +## Preferred object representation MIME type in order. First matched MIME type +# will be used. +# Default: ['image/png', 'image/jpeg', 'image/svg+xml'] +# c.ZMQTerminalInteractiveShell.mime_preference = ['image/png', 'image/jpeg', 'image/svg+xml'] + +## Prefix to add to outputs coming from clients other than this one. +# +# Only relevant if include_other_output is True. +# Default: 'Remote ' +# c.ZMQTerminalInteractiveShell.other_output_prefix = 'Remote ' + +## Display the current vi mode (when using vi editing mode). +# Default: True +c.ZMQTerminalInteractiveShell.prompt_includes_vi_mode = False + +## Use simple fallback prompt. Features may be limited. +# Default: False +# c.ZMQTerminalInteractiveShell.simple_prompt = False + +## Command to invoke an image viewer program when you are using 'stream' image +# handler. This option is a list of string where the first element is the +# command itself and reminders are the options for the command. Raw image data +# is given as STDIN to the program. +# Default: [] +# c.ZMQTerminalInteractiveShell.stream_image_handler = [] + +## Command to invoke an image viewer program when you are using 'tempfile' image +# handler. This option is a list of string where the first element is the +# command itself and reminders are the options for the command. You can use +# {file} and {format} in the string to represent the location of the generated +# image file and image format. +# Default: [] +# c.ZMQTerminalInteractiveShell.tempfile_image_handler = [] + +## Use 24bit colors instead of 256 colors in prompt highlighting. If your +# terminal supports true color, the following command should print 'TRUECOLOR' +# in orange: printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n" +# Default: False +# c.ZMQTerminalInteractiveShell.true_color = False + +## Whether to use the kernel's is_complete message +# handling. If False, then the frontend will use its +# own is_complete handler. +# Default: True +# c.ZMQTerminalInteractiveShell.use_kernel_is_complete = True + +#------------------------------------------------------------------------------ +# KernelManager(ConnectionFileMixin) configuration +#------------------------------------------------------------------------------ +## Manages a single kernel in a subprocess on this host. +# +# This version starts kernels with Popen. + +## Should we autorestart the kernel if it dies. +# Default: True +# c.KernelManager.autorestart = True + +## True if the MultiKernelManager should cache ports for this KernelManager +# instance +# Default: False +# c.KernelManager.cache_ports = False + +## JSON file in which to store connection info [default: kernel-.json] +# See also: ConnectionFileMixin.connection_file +# c.KernelManager.connection_file = '' + +## set the control (ROUTER) port [default: random] +# See also: ConnectionFileMixin.control_port +# c.KernelManager.control_port = 0 + +## set the heartbeat port [default: random] +# See also: ConnectionFileMixin.hb_port +# c.KernelManager.hb_port = 0 + +## set the iopub (PUB) port [default: random] +# See also: ConnectionFileMixin.iopub_port +# c.KernelManager.iopub_port = 0 + +## Set the kernel's IP address [default localhost]. +# See also: ConnectionFileMixin.ip +# c.KernelManager.ip = '' + +## set the shell (ROUTER) port [default: random] +# See also: ConnectionFileMixin.shell_port +# c.KernelManager.shell_port = 0 + +## Time to wait for a kernel to terminate before killing it, in seconds. When a +# shutdown request is initiated, the kernel will be immediately sent an +# interrupt (SIGINT), followedby a shutdown_request message, after 1/2 of +# `shutdown_wait_time`it will be sent a terminate (SIGTERM) request, and finally +# at the end of `shutdown_wait_time` will be killed (SIGKILL). terminate and +# kill may be equivalent on windows. Note that this value can beoverridden by +# the in-use kernel provisioner since shutdown times mayvary by provisioned +# environment. +# Default: 5.0 +# c.KernelManager.shutdown_wait_time = 5.0 + +## set the stdin (ROUTER) port [default: random] +# See also: ConnectionFileMixin.stdin_port +# c.KernelManager.stdin_port = 0 + +# See also: ConnectionFileMixin.transport +# c.KernelManager.transport = 'tcp' + +#------------------------------------------------------------------------------ +# KernelRestarter(LoggingConfigurable) configuration +#------------------------------------------------------------------------------ +## Monitor and autorestart a kernel. + +## Whether to include every poll event in debugging output. +# +# Has to be set explicitly, because there will be *a lot* of output. +# Default: False +# c.KernelRestarter.debug = False + +## Whether to choose new random ports when restarting before the kernel is alive. +# Default: True +# c.KernelRestarter.random_ports_until_alive = True + +## The number of consecutive autorestarts before the kernel is presumed dead. +# Default: 5 +# c.KernelRestarter.restart_limit = 5 + +## The time in seconds to consider the kernel to have completed a stable start +# up. +# Default: 10.0 +# c.KernelRestarter.stable_start_time = 10.0 + +## Kernel heartbeat interval in seconds. +# Default: 3.0 +# c.KernelRestarter.time_to_dead = 3.0 + +#------------------------------------------------------------------------------ +# Session(Configurable) configuration +#------------------------------------------------------------------------------ +## Object for handling serialization and sending of messages. +# +# The Session object handles building messages and sending them with ZMQ sockets +# or ZMQStream objects. Objects can communicate with each other over the +# network via Session objects, and only need to work with the dict-based IPython +# message spec. The Session will handle serialization/deserialization, security, +# and metadata. +# +# Sessions support configurable serialization via packer/unpacker traits, and +# signing with HMAC digests via the key/keyfile traits. +# +# Parameters ---------- +# +# debug : bool +# whether to trigger extra debugging statements +# packer/unpacker : str : 'json', 'pickle' or import_string +# importstrings for methods to serialize message parts. If just +# 'json' or 'pickle', predefined JSON and pickle packers will be used. +# Otherwise, the entire importstring must be used. +# +# The functions must accept at least valid JSON input, and output *bytes*. +# +# For example, to use msgpack: +# packer = 'msgpack.packb', unpacker='msgpack.unpackb' +# pack/unpack : callables +# You can also set the pack/unpack callables for serialization directly. +# session : bytes +# the ID of this Session object. The default is to generate a new UUID. +# username : unicode +# username added to message headers. The default is to ask the OS. +# key : bytes +# The key used to initialize an HMAC signature. If unset, messages +# will not be signed or checked. +# keyfile : filepath +# The file containing a key. If this is set, `key` will be initialized +# to the contents of the file. + +## Threshold (in bytes) beyond which an object's buffer should be extracted to +# avoid pickling. +# Default: 1024 +# c.Session.buffer_threshold = 1024 + +## Whether to check PID to protect against calls after fork. +# +# This check can be disabled if fork-safety is handled elsewhere. +# Default: True +# c.Session.check_pid = True + +## Threshold (in bytes) beyond which a buffer should be sent without copying. +# Default: 65536 +# c.Session.copy_threshold = 65536 + +## Debug output in the Session +# Default: False +# c.Session.debug = False + +## The maximum number of digests to remember. +# +# The digest history will be culled when it exceeds this value. +# Default: 65536 +# c.Session.digest_history_size = 65536 + +## The maximum number of items for a container to be introspected for custom serialization. +# Containers larger than this are pickled outright. +# Default: 64 +# c.Session.item_threshold = 64 + +## execution key, for signing messages. +# Default: b'' +# c.Session.key = b'' + +## path to file containing execution key. +# Default: '' +# c.Session.keyfile = '' + +## Metadata dictionary, which serves as the default top-level metadata dict for +# each message. +# Default: {} +# c.Session.metadata = {} + +## The name of the packer for serializing messages. +# Should be one of 'json', 'pickle', or an import name +# for a custom callable serializer. +# Default: 'json' +# c.Session.packer = 'json' + +## The UUID identifying this session. +# Default: '' +# c.Session.session = '' + +## The digest scheme used to construct the message signatures. +# Must have the form 'hmac-HASH'. +# Default: 'hmac-sha256' +# c.Session.signature_scheme = 'hmac-sha256' + +## The name of the unpacker for unserializing messages. +# Only used with custom functions for `packer`. +# Default: 'json' +# c.Session.unpacker = 'json' + +## Username for the Session. Default is your system username. +# Default: 'master' +# c.Session.username = 'master' + +# from IPython.core import prompts +# import time +# prompts.lazily_evaluate['shorttime'] = prompts.LazyEvaluate(time.strftime, '%H:%M') +# c.PromptManager.in_template = '{shorttime} \\# >>> ' + +# from IPython import get_ipython +# from prompt_toolkit.enums import DEFAULT_BUFFER +# from prompt_toolkit.filters import HasFocus, ViInsertMode +# from prompt_toolkit.key_binding.vi_state import InputMode + +# ip = get_ipython() + +# def switch_to_navigation_mode(event): +# vi_state = event.cli.vi_state +# vi_state.input_mode = InputMode.NAVIGATION + +# if getattr(ip, 'pt_app', None): +# registry = ip.pt_app.key_bindings +# registry.add_binding(u'j',u'k', +# filter=(HasFocus(DEFAULT_BUFFER) +# & ViInsertMode()))(switch_to_navigation_mode) + diff --git a/.config/jupyter/jupyter_notebook_config.py b/.config/jupyter/jupyter_notebook_config.py new file mode 100644 index 0000000..1b5f33a --- /dev/null +++ b/.config/jupyter/jupyter_notebook_config.py @@ -0,0 +1,1116 @@ +# Configuration file for notebook. + +c = get_config() #noqa + +#------------------------------------------------------------------------------ +# Application(SingletonConfigurable) configuration +#------------------------------------------------------------------------------ +## This is an application. + +## The date format used by logging formatters for %(asctime)s +# Default: '%Y-%m-%d %H:%M:%S' +# c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# Default: '[%(name)s]%(highlevel)s %(message)s' +# c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'] +# Default: 30 +# c.Application.log_level = 30 + +## Configure additional log handlers. +# +# The default stderr logs handler is configured by the log_level, log_datefmt +# and log_format settings. +# +# This configuration can be used to configure additional handlers (e.g. to +# output the log to a file) or for finer control over the default handlers. +# +# If provided this should be a logging configuration dictionary, for more +# information see: +# https://docs.python.org/3/library/logging.config.html#logging-config- +# dictschema +# +# This dictionary is merged with the base logging configuration which defines +# the following: +# +# * A logging formatter intended for interactive use called +# ``console``. +# * A logging handler that writes to stderr called +# ``console`` which uses the formatter ``console``. +# * A logger with the name of this application set to ``DEBUG`` +# level. +# +# This example adds a new handler that writes to a file: +# +# .. code-block:: python +# +# c.Application.logging_config = { +# "handlers": { +# "file": { +# "class": "logging.FileHandler", +# "level": "DEBUG", +# "filename": "", +# } +# }, +# "loggers": { +# "": { +# "level": "DEBUG", +# # NOTE: if you don't list the default "console" +# # handler here then it will be disabled +# "handlers": ["console", "file"], +# }, +# }, +# } +# Default: {} +# c.Application.logging_config = {} + +## Instead of starting the Application, dump configuration to stdout +# Default: False +# c.Application.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# Default: False +# c.Application.show_config_json = False + +#------------------------------------------------------------------------------ +# JupyterApp(Application) configuration +#------------------------------------------------------------------------------ +## Base class for Jupyter applications + +## Answer yes to any prompts. +# Default: False +# c.JupyterApp.answer_yes = False + +## Full path of a config file. +# Default: '' +# c.JupyterApp.config_file = '' + +## Specify a config file to load. +# Default: '' +# c.JupyterApp.config_file_name = '' + +## Generate default config file. +# Default: False +# c.JupyterApp.generate_config = False + +## The date format used by logging formatters for %(asctime)s +# See also: Application.log_datefmt +# c.JupyterApp.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# See also: Application.log_format +# c.JupyterApp.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# See also: Application.log_level +# c.JupyterApp.log_level = 30 + +## +# See also: Application.logging_config +# c.JupyterApp.logging_config = {} + +## Instead of starting the Application, dump configuration to stdout +# See also: Application.show_config +# c.JupyterApp.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# See also: Application.show_config_json +# c.JupyterApp.show_config_json = False + +#------------------------------------------------------------------------------ +# ExtensionApp(JupyterApp) configuration +#------------------------------------------------------------------------------ +## Base class for configurable Jupyter Server Extension Applications. +# +# ExtensionApp subclasses can be initialized two ways: +# +# - Extension is listed as a jpserver_extension, and ServerApp calls +# its load_jupyter_server_extension classmethod. This is the +# classic way of loading a server extension. +# +# - Extension is launched directly by calling its `launch_instance` +# class method. This method can be set as a entry_point in +# the extensions setup.py. + +## Answer yes to any prompts. +# See also: JupyterApp.answer_yes +# c.ExtensionApp.answer_yes = False + +## Full path of a config file. +# See also: JupyterApp.config_file +# c.ExtensionApp.config_file = '' + +## Specify a config file to load. +# See also: JupyterApp.config_file_name +# c.ExtensionApp.config_file_name = '' + +# Default: '' +# c.ExtensionApp.default_url = '' + +## Generate default config file. +# See also: JupyterApp.generate_config +# c.ExtensionApp.generate_config = False + +## Handlers appended to the server. +# Default: [] +# c.ExtensionApp.handlers = [] + +## The date format used by logging formatters for %(asctime)s +# See also: Application.log_datefmt +# c.ExtensionApp.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# See also: Application.log_format +# c.ExtensionApp.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# See also: Application.log_level +# c.ExtensionApp.log_level = 30 + +## +# See also: Application.logging_config +# c.ExtensionApp.logging_config = {} + +## Whether to open in a browser after starting. +# The specific browser used is platform dependent and +# determined by the python standard library `webbrowser` +# module, unless it is overridden using the --browser +# (ServerApp.browser) configuration option. +# Default: False +# c.ExtensionApp.open_browser = False + +## Settings that will passed to the server. +# Default: {} +# c.ExtensionApp.settings = {} + +## Instead of starting the Application, dump configuration to stdout +# See also: Application.show_config +# c.ExtensionApp.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# See also: Application.show_config_json +# c.ExtensionApp.show_config_json = False + +## paths to search for serving static files. +# +# This allows adding javascript/css to be available from the notebook server machine, +# or overriding individual files in the IPython +# Default: [] +# c.ExtensionApp.static_paths = [] + +## Url where the static assets for the extension are served. +# Default: '' +# c.ExtensionApp.static_url_prefix = '' + +## Paths to search for serving jinja templates. +# +# Can be used to override templates from notebook.templates. +# Default: [] +# c.ExtensionApp.template_paths = [] + +#------------------------------------------------------------------------------ +# LabServerApp(ExtensionApp) configuration +#------------------------------------------------------------------------------ +## A Lab Server Application that runs out-of-the-box + +## "A list of comma-separated URIs to get the allowed extensions list +# +# .. versionchanged:: 2.0.0 +# `LabServerApp.whitetlist_uris` renamed to `allowed_extensions_uris` +# Default: '' +# c.LabServerApp.allowed_extensions_uris = '' + +## Answer yes to any prompts. +# See also: JupyterApp.answer_yes +# c.LabServerApp.answer_yes = False + +## The application settings directory. +# Default: '' +# c.LabServerApp.app_settings_dir = '' + +## The url path for the application. +# Default: '/lab' +# c.LabServerApp.app_url = '/lab' + +## Deprecated, use `LabServerApp.blocked_extensions_uris` +# Default: '' +# c.LabServerApp.blacklist_uris = '' + +## A list of comma-separated URIs to get the blocked extensions list +# +# .. versionchanged:: 2.0.0 +# `LabServerApp.blacklist_uris` renamed to `blocked_extensions_uris` +# Default: '' +# c.LabServerApp.blocked_extensions_uris = '' + +## Whether to cache files on the server. This should be `True` except in dev +# mode. +# Default: True +# c.LabServerApp.cache_files = True + +## Full path of a config file. +# See also: JupyterApp.config_file +# c.LabServerApp.config_file = '' + +## Specify a config file to load. +# See also: JupyterApp.config_file_name +# c.LabServerApp.config_file_name = '' + +## Whether getting a relative (False) or absolute (True) path when copying a +# path. +# Default: False +# c.LabServerApp.copy_absolute_path = False + +## Extra paths to look for federated JupyterLab extensions +# Default: [] +# c.LabServerApp.extra_labextensions_path = [] + +## Generate default config file. +# See also: JupyterApp.generate_config +# c.LabServerApp.generate_config = False + +## Handlers appended to the server. +# See also: ExtensionApp.handlers +# c.LabServerApp.handlers = [] + +## Options to pass to the jinja2 environment for this +# Default: {} +# c.LabServerApp.jinja2_options = {} + +## The standard paths to look in for federated JupyterLab extensions +# Default: [] +# c.LabServerApp.labextensions_path = [] + +## The url for federated JupyterLab extensions +# Default: '' +# c.LabServerApp.labextensions_url = '' + +## The interval delay in seconds to refresh the lists +# Default: 3600 +# c.LabServerApp.listings_refresh_seconds = 3600 + +## The optional kwargs to use for the listings HTTP requests as +# described on https://2.python-requests.org/en/v2.7.0/api/#requests.request +# Default: {} +# c.LabServerApp.listings_request_options = {} + +## The listings url. +# Default: '' +# c.LabServerApp.listings_url = '' + +## The date format used by logging formatters for %(asctime)s +# See also: Application.log_datefmt +# c.LabServerApp.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# See also: Application.log_format +# c.LabServerApp.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# See also: Application.log_level +# c.LabServerApp.log_level = 30 + +## +# See also: Application.logging_config +# c.LabServerApp.logging_config = {} + +## Whether a notebook should start a kernel automatically. +# Default: True +# c.LabServerApp.notebook_starts_kernel = True + +## Whether to open in a browser after starting. +# See also: ExtensionApp.open_browser +# c.LabServerApp.open_browser = False + +## The optional location of the settings schemas directory. If given, a handler +# will be added for settings. +# Default: '' +# c.LabServerApp.schemas_dir = '' + +## Settings that will passed to the server. +# See also: ExtensionApp.settings +# c.LabServerApp.settings = {} + +## The url path of the settings handler. +# Default: '' +# c.LabServerApp.settings_url = '' + +## Instead of starting the Application, dump configuration to stdout +# See also: Application.show_config +# c.LabServerApp.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# See also: Application.show_config_json +# c.LabServerApp.show_config_json = False + +## The optional location of local static files. If given, a static file handler +# will be added. +# Default: '' +# c.LabServerApp.static_dir = '' + +## paths to search for serving static files. +# See also: ExtensionApp.static_paths +# c.LabServerApp.static_paths = [] + +## Url where the static assets for the extension are served. +# See also: ExtensionApp.static_url_prefix +# c.LabServerApp.static_url_prefix = '' + +## Paths to search for serving jinja templates. +# See also: ExtensionApp.template_paths +# c.LabServerApp.template_paths = [] + +## The application templates directory. +# Default: '' +# c.LabServerApp.templates_dir = '' + +## The optional location of the themes directory. If given, a handler will be +# added for themes. +# Default: '' +# c.LabServerApp.themes_dir = '' + +## The theme url. +# Default: '' +# c.LabServerApp.themes_url = '' + +## The url path of the translations handler. +# Default: '' +# c.LabServerApp.translations_api_url = '' + +## The url path of the tree handler. +# Default: '' +# c.LabServerApp.tree_url = '' + +## The optional location of the user settings directory. +# Default: '' +# c.LabServerApp.user_settings_dir = '' + +## Deprecated, use `LabServerApp.allowed_extensions_uris` +# Default: '' +# c.LabServerApp.whitelist_uris = '' + +## The url path of the workspaces API. +# Default: '' +# c.LabServerApp.workspaces_api_url = '' + +## The optional location of the saved workspaces directory. If given, a handler +# will be added for workspaces. +# Default: '' +# c.LabServerApp.workspaces_dir = '' + +#------------------------------------------------------------------------------ +# JupyterNotebookApp(LabServerApp) configuration +#------------------------------------------------------------------------------ +## The notebook server extension app. + +## +# See also: LabServerApp.allowed_extensions_uris +# c.JupyterNotebookApp.allowed_extensions_uris = '' + +## Answer yes to any prompts. +# See also: JupyterApp.answer_yes +# c.JupyterNotebookApp.answer_yes = False + +## The application settings directory. +# Default: '' +# c.JupyterNotebookApp.app_settings_dir = '' + +## The url path for the application. +# Default: '/lab' +# c.JupyterNotebookApp.app_url = '/lab' + +## Deprecated, use `LabServerApp.blocked_extensions_uris` +# See also: LabServerApp.blacklist_uris +# c.JupyterNotebookApp.blacklist_uris = '' + +## +# See also: LabServerApp.blocked_extensions_uris +# c.JupyterNotebookApp.blocked_extensions_uris = '' + +## Whether to cache files on the server. This should be `True` except in dev +# mode. +# Default: True +# c.JupyterNotebookApp.cache_files = True + +## Full path of a config file. +# See also: JupyterApp.config_file +# c.JupyterNotebookApp.config_file = '' + +## Specify a config file to load. +# See also: JupyterApp.config_file_name +# c.JupyterNotebookApp.config_file_name = '' + +## Whether getting a relative (False) or absolute (True) path when copying a +# path. +# Default: False +# c.JupyterNotebookApp.copy_absolute_path = False + +## Whether custom CSS is loaded on the page. +# Defaults to True and custom CSS is loaded. +# Default: True +# c.JupyterNotebookApp.custom_css = True + +## The default URL to redirect to from `/` +# Default: '/tree' +# c.JupyterNotebookApp.default_url = '/tree' + +## Whether to expose the global app instance to browser via window.jupyterapp +# Default: False +# c.JupyterNotebookApp.expose_app_in_browser = False + +## Extra paths to look for federated JupyterLab extensions +# Default: [] +# c.JupyterNotebookApp.extra_labextensions_path = [] + +## Generate default config file. +# See also: JupyterApp.generate_config +# c.JupyterNotebookApp.generate_config = False + +## Handlers appended to the server. +# See also: ExtensionApp.handlers +# c.JupyterNotebookApp.handlers = [] + +## Options to pass to the jinja2 environment for this +# Default: {} +# c.JupyterNotebookApp.jinja2_options = {} + +## The standard paths to look in for federated JupyterLab extensions +# Default: [] +# c.JupyterNotebookApp.labextensions_path = [] + +## The url for federated JupyterLab extensions +# Default: '' +# c.JupyterNotebookApp.labextensions_url = '' + +## The interval delay in seconds to refresh the lists +# See also: LabServerApp.listings_refresh_seconds +# c.JupyterNotebookApp.listings_refresh_seconds = 3600 + +## The optional kwargs to use for the listings HTTP requests as +# described on https://2.python-requests.org/en/v2.7.0/api/#requests.request +# See also: LabServerApp.listings_request_options +# c.JupyterNotebookApp.listings_request_options = {} + +## The listings url. +# Default: '' +# c.JupyterNotebookApp.listings_url = '' + +## The date format used by logging formatters for %(asctime)s +# See also: Application.log_datefmt +# c.JupyterNotebookApp.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# See also: Application.log_format +# c.JupyterNotebookApp.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# See also: Application.log_level +# c.JupyterNotebookApp.log_level = 30 + +## +# See also: Application.logging_config +# c.JupyterNotebookApp.logging_config = {} + +## Whether a notebook should start a kernel automatically. +# Default: True +# c.JupyterNotebookApp.notebook_starts_kernel = True + +## Whether to open in a browser after starting. +# See also: ExtensionApp.open_browser +# c.JupyterNotebookApp.open_browser = False + +## The optional location of the settings schemas directory. If given, a handler +# will be added for settings. +# Default: '' +# c.JupyterNotebookApp.schemas_dir = '' + +## Settings that will passed to the server. +# See also: ExtensionApp.settings +# c.JupyterNotebookApp.settings = {} + +## The url path of the settings handler. +# Default: '' +# c.JupyterNotebookApp.settings_url = '' + +## Instead of starting the Application, dump configuration to stdout +# See also: Application.show_config +# c.JupyterNotebookApp.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# See also: Application.show_config_json +# c.JupyterNotebookApp.show_config_json = False + +## The optional location of local static files. If given, a static file handler +# will be added. +# Default: '' +# c.JupyterNotebookApp.static_dir = '' + +## paths to search for serving static files. +# See also: ExtensionApp.static_paths +# c.JupyterNotebookApp.static_paths = [] + +## Url where the static assets for the extension are served. +# See also: ExtensionApp.static_url_prefix +# c.JupyterNotebookApp.static_url_prefix = '' + +## Paths to search for serving jinja templates. +# See also: ExtensionApp.template_paths +# c.JupyterNotebookApp.template_paths = [] + +## The application templates directory. +# Default: '' +# c.JupyterNotebookApp.templates_dir = '' + +## The optional location of the themes directory. If given, a handler will be +# added for themes. +# Default: '' +# c.JupyterNotebookApp.themes_dir = '' + +## The theme url. +# Default: '' +# c.JupyterNotebookApp.themes_url = '' + +## The url path of the translations handler. +# Default: '' +# c.JupyterNotebookApp.translations_api_url = '' + +## The url path of the tree handler. +# Default: '' +# c.JupyterNotebookApp.tree_url = '' + +## The optional location of the user settings directory. +# Default: '' +# c.JupyterNotebookApp.user_settings_dir = '' + +## Deprecated, use `LabServerApp.allowed_extensions_uris` +# See also: LabServerApp.whitelist_uris +# c.JupyterNotebookApp.whitelist_uris = '' + +## The url path of the workspaces API. +# Default: '' +# c.JupyterNotebookApp.workspaces_api_url = '' + +## The optional location of the saved workspaces directory. If given, a handler +# will be added for workspaces. +# Default: '' +# c.JupyterNotebookApp.workspaces_dir = '' + +#------------------------------------------------------------------------------ +# ServerApp(JupyterApp) configuration +#------------------------------------------------------------------------------ +## The Jupyter Server application class. + +## Set the Access-Control-Allow-Credentials: true header +# Default: False +# c.ServerApp.allow_credentials = False + +## Whether or not to allow external kernels, whose connection files are placed in +# external_connection_dir. +# Default: False +# c.ServerApp.allow_external_kernels = False + +## Set the Access-Control-Allow-Origin header +# +# Use '*' to allow any origin to access your server. +# +# Takes precedence over allow_origin_pat. +# Default: '' +# c.ServerApp.allow_origin = '' + +## Use a regular expression for the Access-Control-Allow-Origin header +# +# Requests from an origin matching the expression will get replies with: +# +# Access-Control-Allow-Origin: origin +# +# where `origin` is the origin of the request. +# +# Ignored if allow_origin is set. +# Default: '' +# c.ServerApp.allow_origin_pat = '' + +## DEPRECATED in 2.0. Use PasswordIdentityProvider.allow_password_change +# Default: True +# c.ServerApp.allow_password_change = True + +## Allow requests where the Host header doesn't point to a local server +# +# By default, requests get a 403 forbidden response if the 'Host' header +# shows that the browser thinks it's on a non-local domain. +# Setting this option to True disables this check. +# +# This protects against 'DNS rebinding' attacks, where a remote web server +# serves you a page and then changes its DNS to send later requests to a +# local IP, bypassing same-origin checks. +# +# Local IP addresses (such as 127.0.0.1 and ::1) are allowed as local, +# along with hostnames configured in local_hostnames. +# Default: False +# c.ServerApp.allow_remote_access = False + +## Whether to allow the user to run the server as root. +# Default: False +# c.ServerApp.allow_root = False + +## Allow unauthenticated access to endpoints without authentication rule. +# +# When set to `True` (default in jupyter-server 2.0, subject to change +# in the future), any request to an endpoint without an authentication rule +# (either `@tornado.web.authenticated`, or `@allow_unauthenticated`) +# will be permitted, regardless of whether user has logged in or not. +# +# When set to `False`, logging in will be required for access to each endpoint, +# excluding the endpoints marked with `@allow_unauthenticated` decorator. +# +# This option can be configured using `JUPYTER_SERVER_ALLOW_UNAUTHENTICATED_ACCESS` +# environment variable: any non-empty value other than "true" and "yes" will +# prevent unauthenticated access to endpoints without `@allow_unauthenticated`. +# Default: True +# c.ServerApp.allow_unauthenticated_access = True + +## Answer yes to any prompts. +# See also: JupyterApp.answer_yes +# c.ServerApp.answer_yes = False + +## " +# Require authentication to access prometheus metrics. +# Default: True +# c.ServerApp.authenticate_prometheus = True + +## The authorizer class to use. +# Default: 'jupyter_server.auth.authorizer.AllowAllAuthorizer' +# c.ServerApp.authorizer_class = 'jupyter_server.auth.authorizer.AllowAllAuthorizer' + +## Reload the webapp when changes are made to any Python src files. +# Default: False +# c.ServerApp.autoreload = False + +## The base URL for the Jupyter server. +# +# Leading and trailing slashes can be omitted, +# and will automatically be added. +# Default: '/' +# c.ServerApp.base_url = '/' + +## Specify what command to use to invoke a web +# browser when starting the server. If not specified, the +# default browser will be determined by the `webbrowser` +# standard library module, which allows setting of the +# BROWSER environment variable to override it. +# Default: '' +c.ServerApp.browser = 'firefox' + +## The full path to an SSL/TLS certificate file. +# Default: '' +# c.ServerApp.certfile = '' + +## The full path to a certificate authority certificate for SSL/TLS client +# authentication. +# Default: '' +# c.ServerApp.client_ca = '' + +## Full path of a config file. +# See also: JupyterApp.config_file +# c.ServerApp.config_file = '' + +## Specify a config file to load. +# See also: JupyterApp.config_file_name +# c.ServerApp.config_file_name = '' + +## The config manager class to use +# Default: 'jupyter_server.services.config.manager.ConfigManager' +# c.ServerApp.config_manager_class = 'jupyter_server.services.config.manager.ConfigManager' + +## The content manager class to use. +# Default: 'jupyter_server.services.contents.largefilemanager.AsyncLargeFileManager' +# c.ServerApp.contents_manager_class = 'jupyter_server.services.contents.largefilemanager.AsyncLargeFileManager' + +## DEPRECATED. Use IdentityProvider.cookie_options +# Default: {} +# c.ServerApp.cookie_options = {} + +## The random bytes used to secure cookies. +# By default this is a new random number every time you start the server. +# Set it to a value in a config file to enable logins to persist across server sessions. +# +# Note: Cookie secrets should be kept private, do not share config files with +# cookie_secret stored in plaintext (you can read the value from a file). +# Default: b'' +# c.ServerApp.cookie_secret = b'' + +## The file where the cookie secret is stored. +# Default: '' +# c.ServerApp.cookie_secret_file = '' + +## Override URL shown to users. +# +# Replace actual URL, including protocol, address, port and base URL, +# with the given value when displaying URL to the users. Do not change +# the actual connection URL. If authentication token is enabled, the +# token is added to the custom URL automatically. +# +# This option is intended to be used when the URL to display to the user +# cannot be determined reliably by the Jupyter server (proxified +# or containerized setups for example). +# Default: '' +# c.ServerApp.custom_display_url = '' + +## The default URL to redirect to from `/` +# Default: '/' +# c.ServerApp.default_url = '/' + +## Disable cross-site-request-forgery protection +# +# Jupyter server includes protection from cross-site request forgeries, +# requiring API requests to either: +# +# - originate from pages served by this server (validated with XSRF cookie and token), or +# - authenticate with a token +# +# Some anonymous compute resources still desire the ability to run code, +# completely without authentication. +# These services can disable all authentication and security checks, +# with the full knowledge of what that implies. +# Default: False +# c.ServerApp.disable_check_xsrf = False + +## The directory to look at for external kernel connection files, if +# allow_external_kernels is True. Defaults to Jupyter +# runtime_dir/external_kernels. Make sure that this directory is not filled with +# left-over connection files, that could result in unnecessary kernel manager +# creations. +# Default: None +# c.ServerApp.external_connection_dir = None + +## handlers that should be loaded at higher priority than the default services +# Default: [] +# c.ServerApp.extra_services = [] + +## Extra paths to search for serving static files. +# +# This allows adding javascript/css to be available from the Jupyter server machine, +# or overriding individual files in the IPython +# Default: [] +# c.ServerApp.extra_static_paths = [] + +## Extra paths to search for serving jinja templates. +# +# Can be used to override templates from jupyter_server.templates. +# Default: [] +# c.ServerApp.extra_template_paths = [] + +## Open the named file when the application is launched. +# Default: '' +# c.ServerApp.file_to_run = '' + +## The URL prefix where files are opened directly. +# Default: 'notebooks' +# c.ServerApp.file_url_prefix = 'notebooks' + +## Generate default config file. +# See also: JupyterApp.generate_config +# c.ServerApp.generate_config = False + +## DEPRECATED. Use IdentityProvider.get_secure_cookie_kwargs +# Default: {} +# c.ServerApp.get_secure_cookie_kwargs = {} + +## The identity provider class to use. +# Default: 'jupyter_server.auth.identity.PasswordIdentityProvider' +# c.ServerApp.identity_provider_class = 'jupyter_server.auth.identity.PasswordIdentityProvider' + +## DEPRECATED. Use ZMQChannelsWebsocketConnection.iopub_data_rate_limit +# Default: 0.0 +# c.ServerApp.iopub_data_rate_limit = 0.0 + +## DEPRECATED. Use ZMQChannelsWebsocketConnection.iopub_msg_rate_limit +# Default: 0.0 +# c.ServerApp.iopub_msg_rate_limit = 0.0 + +## The IP address the Jupyter server will listen on. +# Default: 'localhost' +# c.ServerApp.ip = 'localhost' + +## Supply extra arguments that will be passed to Jinja environment. +# Default: {} +# c.ServerApp.jinja_environment_options = {} + +## Extra variables to supply to jinja templates when rendering. +# Default: {} +# c.ServerApp.jinja_template_vars = {} + +## Dict of Python modules to load as Jupyter server extensions.Entry values can +# be used to enable and disable the loading ofthe extensions. The extensions +# will be loaded in alphabetical order. +# Default: {} +# c.ServerApp.jpserver_extensions = {} + +## The kernel manager class to use. +# Default: 'jupyter_server.services.kernels.kernelmanager.MappingKernelManager' +# c.ServerApp.kernel_manager_class = 'jupyter_server.services.kernels.kernelmanager.MappingKernelManager' + +## The kernel spec manager class to use. Should be a subclass of +# `jupyter_client.kernelspec.KernelSpecManager`. +# +# The Api of KernelSpecManager is provisional and might change without warning +# between this version of Jupyter and the next stable one. +# Default: 'builtins.object' +# c.ServerApp.kernel_spec_manager_class = 'builtins.object' + +## The kernel websocket connection class to use. +# Default: 'jupyter_server.services.kernels.connection.base.BaseKernelWebsocketConnection' +# c.ServerApp.kernel_websocket_connection_class = 'jupyter_server.services.kernels.connection.base.BaseKernelWebsocketConnection' + +## DEPRECATED. Use ZMQChannelsWebsocketConnection.kernel_ws_protocol +# Default: '' +# c.ServerApp.kernel_ws_protocol = '' + +## The full path to a private key file for usage with SSL/TLS. +# Default: '' +# c.ServerApp.keyfile = '' + +## DEPRECATED. Use ZMQChannelsWebsocketConnection.limit_rate +# Default: False +# c.ServerApp.limit_rate = False + +## Hostnames to allow as local when allow_remote_access is False. +# +# Local IP addresses (such as 127.0.0.1 and ::1) are automatically accepted +# as local as well. +# Default: ['localhost'] +# c.ServerApp.local_hostnames = ['localhost'] + +## The date format used by logging formatters for %(asctime)s +# See also: Application.log_datefmt +# c.ServerApp.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# See also: Application.log_format +# c.ServerApp.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# See also: Application.log_level +# c.ServerApp.log_level = 30 + +## +# See also: Application.logging_config +# c.ServerApp.logging_config = {} + +## The login handler class to use. +# Default: 'jupyter_server.auth.login.LegacyLoginHandler' +# c.ServerApp.login_handler_class = 'jupyter_server.auth.login.LegacyLoginHandler' + +## The logout handler class to use. +# Default: 'jupyter_server.auth.logout.LogoutHandler' +# c.ServerApp.logout_handler_class = 'jupyter_server.auth.logout.LogoutHandler' + +## Sets the maximum allowed size of the client request body, specified in the +# Content-Length request header field. If the size in a request exceeds the +# configured value, a malformed HTTP message is returned to the client. +# +# Note: max_body_size is applied even in streaming mode. +# Default: 536870912 +# c.ServerApp.max_body_size = 536870912 + +## Gets or sets the maximum amount of memory, in bytes, that is allocated for use +# by the buffer manager. +# Default: 536870912 +# c.ServerApp.max_buffer_size = 536870912 + +## Gets or sets a lower bound on the open file handles process resource limit. +# This may need to be increased if you run into an OSError: [Errno 24] Too many +# open files. This is not applicable when running on Windows. +# Default: 0 +# c.ServerApp.min_open_files_limit = 0 + +## DEPRECATED, use root_dir. +# Default: '' +# c.ServerApp.notebook_dir = '' + +## Whether to open in a browser after starting. +# The specific browser used is platform dependent and +# determined by the python standard library `webbrowser` +# module, unless it is overridden using the --browser +# (ServerApp.browser) configuration option. +# Default: False +# c.ServerApp.open_browser = False + +## DEPRECATED in 2.0. Use PasswordIdentityProvider.hashed_password +# Default: '' +# c.ServerApp.password = '' + +## DEPRECATED in 2.0. Use PasswordIdentityProvider.password_required +# Default: False +# c.ServerApp.password_required = False + +## The port the server will listen on (env: JUPYTER_PORT). +# Default: 0 +# c.ServerApp.port = 0 + +## The number of additional ports to try if the specified port is not available +# (env: JUPYTER_PORT_RETRIES). +# Default: 50 +# c.ServerApp.port_retries = 50 + +## Preferred starting directory to use for notebooks and kernels. +# ServerApp.preferred_dir is deprecated in jupyter-server 2.0. Use +# FileContentsManager.preferred_dir instead +# Default: '' +# c.ServerApp.preferred_dir = '' + +## DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib. +# Default: 'disabled' +# c.ServerApp.pylab = 'disabled' + +## If True, display controls to shut down the Jupyter server, such as menu items +# or buttons. +# Default: True +# c.ServerApp.quit_button = True + +## DEPRECATED. Use ZMQChannelsWebsocketConnection.rate_limit_window +# Default: 0.0 +# c.ServerApp.rate_limit_window = 0.0 + +## Reraise exceptions encountered loading server extensions? +# Default: False +# c.ServerApp.reraise_server_extension_failures = False + +## The directory to use for notebooks and kernels. +# Default: '' +# c.ServerApp.root_dir = '' + +## The session manager class to use. +# Default: 'builtins.object' +# c.ServerApp.session_manager_class = 'builtins.object' + +## Instead of starting the Application, dump configuration to stdout +# See also: Application.show_config +# c.ServerApp.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# See also: Application.show_config_json +# c.ServerApp.show_config_json = False + +## Shut down the server after N seconds with no kernelsrunning and no activity. +# This can be used together with culling idle kernels +# (MappingKernelManager.cull_idle_timeout) to shutdown the Jupyter server when +# it's not in use. This is not precisely timed: it may shut down up to a minute +# later. 0 (the default) disables this automatic shutdown. +# Default: 0 +# c.ServerApp.shutdown_no_activity_timeout = 0 + +## The UNIX socket the Jupyter server will listen on. +# Default: '' +# c.ServerApp.sock = '' + +## The permissions mode for UNIX socket creation (default: 0600). +# Default: '0600' +# c.ServerApp.sock_mode = '0600' + +## Supply SSL options for the tornado HTTPServer. +# See the tornado docs for details. +# Default: {} +# c.ServerApp.ssl_options = {} + +## Paths to set up static files as immutable. +# +# This allow setting up the cache control of static files as immutable. It +# should be used for static file named with a hash for instance. +# Default: [] +# c.ServerApp.static_immutable_cache = [] + +## Supply overrides for terminado. Currently only supports "shell_command". +# Default: {} +# c.ServerApp.terminado_settings = {} + +## Set to False to disable terminals. +# +# This does *not* make the server more secure by itself. +# Anything the user can in a terminal, they can also do in a notebook. +# +# Terminals may also be automatically disabled if the terminado package +# is not available. +# Default: False +# c.ServerApp.terminals_enabled = False + +## DEPRECATED. Use IdentityProvider.token +# Default: '' +# c.ServerApp.token = '' + +## Supply overrides for the tornado.web.Application that the Jupyter server uses. +# Default: {} +# c.ServerApp.tornado_settings = {} + +## Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded- +# For headerssent by the upstream reverse proxy. Necessary if the proxy handles +# SSL +# Default: False +# c.ServerApp.trust_xheaders = False + +## Disable launching browser by redirect file +# For versions of notebook > 5.7.2, a security feature measure was added that +# prevented the authentication token used to launch the browser from being visible. +# This feature makes it difficult for other users on a multi-user system from +# running code in your Jupyter session as you. +# However, some environments (like Windows Subsystem for Linux (WSL) and Chromebooks), +# launching a browser using a redirect file can lead the browser failing to load. +# This is because of the difference in file structures/paths between the runtime and +# the browser. +# +# Disabling this setting to False will disable this behavior, allowing the browser +# to launch by using a URL and visible token (as before). +# Default: True +# c.ServerApp.use_redirect_file = True + +## Specify where to open the server on startup. This is the +# `new` argument passed to the standard library method `webbrowser.open`. +# The behaviour is not guaranteed, but depends on browser support. Valid +# values are: +# +# - 2 opens a new tab, +# - 1 opens a new window, +# - 0 opens in an existing window. +# +# See the `webbrowser.open` documentation for details. +# Default: 2 +# c.ServerApp.webbrowser_open_new = 2 + +## Set the tornado compression options for websocket connections. +# +# This value will be returned from +# :meth:`WebSocketHandler.get_compression_options`. None (default) will disable +# compression. A dict (even an empty one) will enable compression. +# +# See the tornado docs for WebSocketHandler.get_compression_options for details. +# Default: None +# c.ServerApp.websocket_compression_options = None + +## Configure the websocket ping interval in seconds. +# +# Websockets are long-lived connections that are used by some Jupyter Server +# extensions. +# +# Periodic pings help to detect disconnected clients and keep the connection +# active. If this is set to None, then no pings will be performed. +# +# When a ping is sent, the client has ``websocket_ping_timeout`` seconds to +# respond. If no response is received within this period, the connection will be +# closed from the server side. +# Default: 0 +# c.ServerApp.websocket_ping_interval = 0 + +## Configure the websocket ping timeout in seconds. +# +# See ``websocket_ping_interval`` for details. +# Default: 0 +# c.ServerApp.websocket_ping_timeout = 0 + +## The base URL for websockets, +# if it differs from the HTTP server (hint: it almost certainly doesn't). +# +# Should be in the form of an HTTP origin: ws[s]://hostname[:port] +# Default: '' +# c.ServerApp.websocket_url = '' diff --git a/.config/jupyter/jupyter_server_config.json b/.config/jupyter/jupyter_server_config.json new file mode 100644 index 0000000..cf73151 --- /dev/null +++ b/.config/jupyter/jupyter_server_config.json @@ -0,0 +1,5 @@ +{ + "IdentityProvider": { + "hashed_password": "argon2:$argon2id$v=19$m=10240,t=10,p=8$rrpr7pR6HvKksqyqLfFkwQ$r7YxjJ6eLwC93EWAKiPmTGw9pBjuOrsQoySfSX8jFCc" + } +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@axlair/jupyterlab_vim/plugin.jupyterlab-settings b/.config/jupyter/lab/user-settings/@axlair/jupyterlab_vim/plugin.jupyterlab-settings new file mode 100644 index 0000000..c4c4624 --- /dev/null +++ b/.config/jupyter/lab/user-settings/@axlair/jupyterlab_vim/plugin.jupyterlab-settings @@ -0,0 +1,11 @@ +{ + "enabled": true, + "enabledInEditors": true, + "extraKeybindings": [ + { + "context": "insert", + "command": "jk", + "keys": "" + } + ] +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@jupyter-notebook/application-extension/top.jupyterlab-settings b/.config/jupyter/lab/user-settings/@jupyter-notebook/application-extension/top.jupyterlab-settings new file mode 100644 index 0000000..308629e --- /dev/null +++ b/.config/jupyter/lab/user-settings/@jupyter-notebook/application-extension/top.jupyterlab-settings @@ -0,0 +1,10 @@ +{ + // Jupyter Notebook Top Area + // @jupyter-notebook/application-extension:top + // Jupyter Notebook Top Area settings + // ******************************************* + + // Top Bar Visibility + // Whether to show the top bar or not, yes for always showing, no for always not showing, automatic for adjusting to screen size + "visible": "no" +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@jupyter-notebook/notebook-extension/full-width-notebook.jupyterlab-settings b/.config/jupyter/lab/user-settings/@jupyter-notebook/notebook-extension/full-width-notebook.jupyterlab-settings new file mode 100644 index 0000000..76a81a7 --- /dev/null +++ b/.config/jupyter/lab/user-settings/@jupyter-notebook/notebook-extension/full-width-notebook.jupyterlab-settings @@ -0,0 +1,10 @@ +{ + // Jupyter Notebook Full Width Notebook + // @jupyter-notebook/notebook-extension:full-width-notebook + // Jupyter Notebook Notebook With settings + // ******************************************************** + + // Full Width Notebook + // Whether to the notebook should take up the full width of the application + "fullWidthNotebook": false +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@jupyterlab/application-extension/shell.jupyterlab-settings b/.config/jupyter/lab/user-settings/@jupyterlab/application-extension/shell.jupyterlab-settings new file mode 100644 index 0000000..e7afa0d --- /dev/null +++ b/.config/jupyter/lab/user-settings/@jupyterlab/application-extension/shell.jupyterlab-settings @@ -0,0 +1,8 @@ +{ + // JupyterLab Shell + // @jupyterlab/application-extension:shell + // JupyterLab Shell layout settings. + // *************************************** + + +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@jupyterlab/apputils-extension/notification.jupyterlab-settings b/.config/jupyter/lab/user-settings/@jupyterlab/apputils-extension/notification.jupyterlab-settings new file mode 100644 index 0000000..1cf5d98 --- /dev/null +++ b/.config/jupyter/lab/user-settings/@jupyterlab/apputils-extension/notification.jupyterlab-settings @@ -0,0 +1,10 @@ +{ + // Notifications + // @jupyterlab/apputils-extension:notification + // Notifications settings. + // ******************************************* + + // Fetch official Jupyter news + // Whether to fetch news from Jupyter news feed. If `true`, it will make a request to a website. + "fetchNews": "false" +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings b/.config/jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings new file mode 100644 index 0000000..a3652b1 --- /dev/null +++ b/.config/jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings @@ -0,0 +1,26 @@ +{ + // Theme + // @jupyterlab/apputils-extension:themes + // Theme manager settings. + // ************************************* + + // Adaptive Theme + // Synchronize visual styling theme with system settings + "adaptive-theme": false, + + // Theme CSS Overrides + // Override theme CSS variables by setting key-value pairs here + "overrides": { + "ui-font-size1": "18px", + "code-font-size": "18px", + "content-font-size1": "18px" + }, + + // Selected Theme + // Application-level visual styling theme. Ignored when Adaptive Theme is enabled. + "theme": "JupyterLab Dark", + + // Scrollbar Theming + // Enable/disable styling of the application scrollbars + "theme-scrollbars": false +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@jupyterlab/extensionmanager-extension/plugin.jupyterlab-settings b/.config/jupyter/lab/user-settings/@jupyterlab/extensionmanager-extension/plugin.jupyterlab-settings new file mode 100644 index 0000000..30a2240 --- /dev/null +++ b/.config/jupyter/lab/user-settings/@jupyterlab/extensionmanager-extension/plugin.jupyterlab-settings @@ -0,0 +1,11 @@ +{ + // Extension Manager + // @jupyterlab/extensionmanager-extension:plugin + // Extension manager settings. + // ********************************************* + + // Enabled Status + // Enables extension manager. + // WARNING: installing untrusted extensions may be unsafe. + "enabled": false +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@jupyterlab/filebrowser-extension/browser.jupyterlab-settings b/.config/jupyter/lab/user-settings/@jupyterlab/filebrowser-extension/browser.jupyterlab-settings new file mode 100644 index 0000000..da94029 --- /dev/null +++ b/.config/jupyter/lab/user-settings/@jupyterlab/filebrowser-extension/browser.jupyterlab-settings @@ -0,0 +1,26 @@ +{ + // File Browser + // @jupyterlab/filebrowser-extension:browser + // File Browser settings. + // ***************************************** + + // Use checkboxes to select items + // Whether to show checkboxes next to files and folders + "showFileCheckboxes": true, + + // Show file size column + // Whether to show the file size column + "showFileSizeColumn": false, + + // Show full path in browser bread crumbs + // Whether to show full path in browser bread crumbs + "showFullPath": true, + + // Show last modified column + // Whether to show the last modified column + "showLastModifiedColumn": false, + + // When sorting by name, group notebooks before other files + // Whether to group the notebooks away from files + "sortNotebooksFirst": true +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@jupyterlab/fileeditor-extension/plugin.jupyterlab-settings b/.config/jupyter/lab/user-settings/@jupyterlab/fileeditor-extension/plugin.jupyterlab-settings new file mode 100644 index 0000000..056fe62 --- /dev/null +++ b/.config/jupyter/lab/user-settings/@jupyterlab/fileeditor-extension/plugin.jupyterlab-settings @@ -0,0 +1,29 @@ +{ + // Text Editor + // @jupyterlab/fileeditor-extension:plugin + // Text editor settings. + // *************************************** + + // Editor Configuration + // The configuration for all text editors; it will override the CodeMirror default configuration. + // If `fontFamily`, `fontSize` or `lineHeight` are `null`, + // values from current theme are used. + "editorConfig": { + "customStyles": { + "fontFamily": null, + "fontSize": 16, + "lineHeight": null + }, + "theme": "jupyter" + }, + + // Scroll behavior + // Whether to scroll past the end of text document. + "scrollPastEnd": true, + + // Text editor toolbar items + // Note: To disable a toolbar item, + // copy it to User Preferences and add the + // "disabled" key. Toolbar description: + "toolbar": [] +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@jupyterlab/notebook-extension/tracker.jupyterlab-settings b/.config/jupyter/lab/user-settings/@jupyterlab/notebook-extension/tracker.jupyterlab-settings new file mode 100644 index 0000000..3fa7c15 --- /dev/null +++ b/.config/jupyter/lab/user-settings/@jupyterlab/notebook-extension/tracker.jupyterlab-settings @@ -0,0 +1,10 @@ +{ + // Notebook + // @jupyterlab/notebook-extension:tracker + // Notebook settings. + // ************************************** + + // Automatically Start Preferred Kernel + // Whether to automatically start the preferred kernel. + "autoStartDefaultKernel": true +} \ No newline at end of file diff --git a/.config/jupyter/lab/user-settings/@jupyterlab/statusbar-extension/plugin.jupyterlab-settings b/.config/jupyter/lab/user-settings/@jupyterlab/statusbar-extension/plugin.jupyterlab-settings new file mode 100644 index 0000000..5feb4cc --- /dev/null +++ b/.config/jupyter/lab/user-settings/@jupyterlab/statusbar-extension/plugin.jupyterlab-settings @@ -0,0 +1,10 @@ +{ + // Status Bar + // @jupyterlab/statusbar-extension:plugin + // Status Bar settings. + // ************************************** + + // Status Bar Visibility + // Whether to show status bar or not + "visible": true +} \ No newline at end of file diff --git a/.config/jupyter/lab/workspaces/default-37a8.jupyterlab-workspace b/.config/jupyter/lab/workspaces/default-37a8.jupyterlab-workspace new file mode 100644 index 0000000..513fec8 --- /dev/null +++ b/.config/jupyter/lab/workspaces/default-37a8.jupyterlab-workspace @@ -0,0 +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 diff --git a/.config/jupyter/migrated b/.config/jupyter/migrated new file mode 100644 index 0000000..b1e56ed --- /dev/null +++ b/.config/jupyter/migrated @@ -0,0 +1 @@ +2024-06-27T14:19:15.071480+00:00 \ No newline at end of file diff --git a/.config/lf/lfrc b/.config/lf/lfrc index b8bf800..d3a579e 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -113,8 +113,7 @@ map ${{ lf -remote "send $id select \"$(cat ${XDG_DATA_HOME:-$HOME/. fzf --tac --reverse --header-first --header='File History')\"" }} map ${{ lf -remote "send $id cd \"$(cat ${XDG_DATA_HOME:-$HOME/.local/share}/cdhist | fzf --tac --reverse --header-first --header='Path History')\"" }} -map ${{ lf -remote "send $id cd \"$(find -mindepth 1 -type d | - fzf --reverse --header-first --header='Jump to directory')\"" }} +map select_eval "fzf --reverse --query '/$ ' --header-first --header='Jump to directory'" map c map d @@ -123,7 +122,7 @@ map i :rename map a :rename; cmd-right map A :rename; cmd-end map S push A -map o $LESSOPEN="|preview %s" less $f +map o $LESSOPEN="|preview %s" less -r $f map O $mimeopen --ask $f map . set hidden! map x cut @@ -136,19 +135,17 @@ map b $vidir map V push :!nvim"" map P :link -map ge extract $f +map ge extract map gl clear -map gx ${{ chmod u+x $fx; lf -remote "send $id reload"; }} +map gx ${{ chmod +x $fx; lf -remote "send $id reload"; }} map gX ${{ chmod -x $fx; lf -remote "send $id reload"; }} map gm push $chmod--$fx map gL %lf -remote "send ${id} select '$(readlink $f)'" map gd !du -hd1 -map gf !file $f -map gy %{{ printf "%s" "$f" | xsel -b }} -map gY %{{ printf "%s" "$fs" | xsel -b }} +map gf !{{ file "$f" && file --brief --mime-type "$f" }} +map gy %{{ printf "%s" "$fx" | xsel -b }} map gi link_index -map gsh $setbg $f -map gsl $setbg -l $f +map gsb $setbg $f map zpp set previewer preview map zpc set previewer cat map zpb set previewer preview-bat diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index e60a16b..55f3cb6 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -8,22 +8,23 @@ alias md='mkdir' alias s='sudo' alias l='ls -A' alias ll='ls -al' +alias lr='ls -aR' # open alias o='${OPENER:-xdg-open}' alias e='${EDITOR:-vi}' alias se='sudoedit' alias lf='lfcd' alias rs='exec $SHELL' -alias sr='e "$(ff -L ~/.config ~/.local/bin ~/bin)"' +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' -lt() { tree -aC "$@" | less -rF; } +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() { find "$@" ! -wholename '*.git*' \( -type d -printf '%p/\n' , ! -type d -print \) | - FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS $fo" fzf -m; } +ff() { FZF_DEFAULT_COMMAND="$FZF_DEFAULT_COMMAND $@" FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS $FO" fzf -m; } senv() { source "${XDG_DATA_HOME:-$HOME/.local/share}/virtualenvs/${1:-main}/bin/activate"; } sudoedit() { @@ -81,6 +82,7 @@ alias wget='wget -c' alias fzf='fzf --ansi' alias diff='diff --color=auto' alias grep='grep --color=auto' -alias tree='tree -C' +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 93476eb..5338c77 100644 --- a/.config/shell/bm-dirs +++ b/.config/shell/bm-dirs @@ -39,7 +39,7 @@ pw ~/Phone/Android/media/com.whatsapp/WhatsApp/Media/WhatsApp\ Documents mn /mnt stg ${STORAGE:-/mnt/storage} -lr ${STORAGE:-/mnt/storage}/Library +lbr ${STORAGE:-/mnt/storage}/Library med ${STORAGE:-/mnt/storage}/Media sts ${STORAGE:-/mnt/storage}/sites sd /sdcard @@ -49,3 +49,4 @@ usr ${PREFIX:-/usr} ush /usr/share usd /usr/share/doc usha /usr/share/applications +tmu /tmp/mozilla_${USER}0 diff --git a/.config/shell/bm-files b/.config/shell/bm-files index 46723a5..442b116 100644 --- a/.config/shell/bm-files +++ b/.config/shell/bm-files @@ -20,6 +20,7 @@ ac ${XDG_CONFIG_HOME:-$HOME/.config}/alacritty/alacritty.toml xr ${XDG_CONFIG_HOME:-$HOME/.config}/X11/Xresources xi ${XDG_CONFIG_HOME:-$HOME/.config}/X11/xinitrc mm ${XDG_CONFIG_HOME:-$HOME/.config}/mimeapps.list +fdi ${XDG_CONFIG_HOME:-$HOME/.config}/fd/ignore ssc ~/.ssh/config csh ~/Dev/csstudent41.github.io/layouts/_default/home.html qn ${XDG_DOCUMENTS_HOME:-$HOME/Documents}/Notes/QuickNote.md diff --git a/.config/shell/profile b/.config/shell/profile index 46bbb9b..c8fd9c6 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -37,9 +37,12 @@ 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" # program configuration -export LESS='-Rf --mouse --use-color -Dd+r$Du+b$' +export LESS='-fiR --mouse --use-color -j 10 -Dd+r -Du+b' export LESSOPEN='|lessopen.sh %s' export GROFF_NO_SGR=1 export GTK_IM_MODULE='fcitx' @@ -51,7 +54,7 @@ export QT_FONT_DPI=112 export SDCV_PAGER='less -R --quit-if-one-screen' 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_COMMAND="find -H . ! -wholename '*.git*' ! \( -type d -printf '%p/\n' , ! -type d -print \)" export FZF_DEFAULT_OPTS=" --history='$XDG_DATA_HOME/fzf/history' --preview='\$PREVIEWER {}' --preview-window=hidden @@ -91,7 +94,6 @@ export FZF_DEFAULT_OPTS=" # export GTYPIST_OPTS="--color 3,0 --banner-colors 0,2,4,1" # green-yellow export GTYPIST_OPTS="--color 6,0 --banner-color 0,4,5,1" # blue-cyan - # # path # find -L ~/.local/share/gem/ruby/3.0.0/bin ~/.local/bin ~/bin \ # -type d ! -wholename '*/.st*' | diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index f482fd2..c855f81 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -9,10 +9,9 @@ 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/fzf-completion.zsh" -# source "$ZDOTDIR/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" -source "$ZDOTDIR/plugins/zsh-autosuggestions.zsh" +source "$ZDOTDIR/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" setopt correct # Auto correct mistakes setopt extended_glob # Allows using regular expressions with * @@ -245,22 +244,33 @@ bindkey '^[H' get-help [ -f "$SDOTDIR/shortcutrc" ] && source "$SDOTDIR/shortcutrc" [ -f "$ZDOTDIR/zshnameddirrc" ] && source "$ZDOTDIR/zshnameddirrc" + case "$TERM" in *256*) - if [ -x /bin/eza ] || [ -x /usr/bin/eza ]; then - alias l='exa -aF --group-directories-first --color=always --icons' - lt() { exa --group-directories-first --color=always \ - --icons -FaT "$@" | less -rF; } - fi + + 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' + alias lr='l -R -I "$IGNORE_GLOB"' + lt() { eza --group-directories-first --color=always \ + --icons=always -aTF -I "$IGNORE_GLOB" "$@" | less -rF; } + } + + command -V fd >/dev/null && { + FZF_DEFAULT_COMMAND="fd --hidden --no-ignore-vcs --color=always $@" + FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --ansi" + alias sr='fd --no-ignore-vcs --color=always . ~/.config ~/.local/bin ~/bin | fzf --ansi' + } command -V starship >/dev/null && { eval "$(starship init zsh)" - function set_win_title(){ + function set_win_title() { echo -ne "\033]0; $USER@$HOST:${PWD/$HOME/~} \007" } precmd_functions+=(set_win_title) } - ;; -esac + +;; esac alias p='pacman' alias sp='sudo pacman' @@ -275,6 +285,7 @@ alias gtypist="gtypist $GTYPIST_OPTS" alias typ='launch-gtypist -l "$(sed "/^gtypist lesson - \(.*\)$/!d; s//\1/" ~/Documents/Notes/QuickNote.md)"' alias typa='launch-gtypist -e 3 -l "$(sed "/^gtypist lesson - \(.*\)$/!d; s//\1/" ~/Documents/Notes/ak47.txt)"' +# Find command package f() { ret=$? [ -n "$1" ] && { pacman -F "$@"; return; } diff --git a/.config/zsh/plugins/fzf-completion.zsh b/.config/zsh/plugins/fzf-completion.zsh deleted file mode 100644 index f12afca..0000000 --- a/.config/zsh/plugins/fzf-completion.zsh +++ /dev/null @@ -1,329 +0,0 @@ -# ____ ____ -# / __/___ / __/ -# / /_/_ / / /_ -# / __/ / /_/ __/ -# /_/ /___/_/ completion.zsh -# -# - $FZF_TMUX (default: 0) -# - $FZF_TMUX_OPTS (default: '-d 40%') -# - $FZF_COMPLETION_TRIGGER (default: '**') -# - $FZF_COMPLETION_OPTS (default: empty) - -# Both branches of the following `if` do the same thing -- define -# __fzf_completion_options such that `eval $__fzf_completion_options` sets -# all options to the same values they currently have. We'll do just that at -# the bottom of the file after changing options to what we prefer. -# -# IMPORTANT: Until we get to the `emulate` line, all words that *can* be quoted -# *must* be quoted in order to prevent alias expansion. In addition, code must -# be written in a way works with any set of zsh options. This is very tricky, so -# careful when you change it. -# -# Start by loading the builtin zsh/parameter module. It provides `options` -# associative array that stores current shell options. -if 'zmodload' 'zsh/parameter' 2>'/dev/null' && (( ${+options} )); then - # This is the fast branch and it gets taken on virtually all Zsh installations. - # - # ${(kv)options[@]} expands to array of keys (option names) and values ("on" - # or "off"). The subsequent expansion# with (j: :) flag joins all elements - # together separated by spaces. __fzf_completion_options ends up with a value - # like this: "options=(shwordsplit off aliases on ...)". - __fzf_completion_options="options=(${(j: :)${(kv)options[@]}})" -else - # This branch is much slower because it forks to get the names of all - # zsh options. It's possible to eliminate this fork but it's not worth the - # trouble because this branch gets taken only on very ancient or broken - # zsh installations. - () { - # That `()` above defines an anonymous function. This is essentially a scope - # for local parameters. We use it to avoid polluting global scope. - 'local' '__fzf_opt' - __fzf_completion_options="setopt" - # `set -o` prints one line for every zsh option. Each line contains option - # name, some spaces, and then either "on" or "off". We just want option names. - # Expansion with (@f) flag splits a string into lines. The outer expansion - # removes spaces and everything that follow them on every line. __fzf_opt - # ends up iterating over option names: shwordsplit, aliases, etc. - for __fzf_opt in "${(@)${(@f)$(set -o)}%% *}"; do - if [[ -o "$__fzf_opt" ]]; then - # Option $__fzf_opt is currently on, so remember to set it back on. - __fzf_completion_options+=" -o $__fzf_opt" - else - # Option $__fzf_opt is currently off, so remember to set it back off. - __fzf_completion_options+=" +o $__fzf_opt" - fi - done - # The value of __fzf_completion_options here looks like this: - # "setopt +o shwordsplit -o aliases ..." - } -fi - -# Enable the default zsh options (those marked with in `man zshoptions`) -# but without `aliases`. Aliases in functions are expanded when functions are -# defined, so if we disable aliases here, we'll be sure to have no pesky -# aliases in any of our functions. This way we won't need prefix every -# command with `command` or to quote every word to defend against global -# aliases. Note that `aliases` is not the only option that's important to -# control. There are several others that could wreck havoc if they are set -# to values we don't expect. With the following `emulate` command we -# sidestep this issue entirely. -'emulate' 'zsh' '-o' 'no_aliases' - -# This brace is the start of try-always block. The `always` part is like -# `finally` in lesser languages. We use it to *always* restore user options. -{ - -# Bail out if not interactive shell. -[[ -o interactive ]] || return 0 - -# To use custom commands instead of find, override _fzf_compgen_{path,dir} -if ! declare -f _fzf_compgen_path > /dev/null; then - _fzf_compgen_path() { - echo "$1" - command find -L "$1" \ - -name .git -prune -o -name .hg -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \ - -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' - } -fi - -if ! declare -f _fzf_compgen_dir > /dev/null; then - _fzf_compgen_dir() { - command find -L "$1" \ - -name .git -prune -o -name .hg -prune -o -name .svn -prune -o -type d \ - -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' - } -fi - -########################################################### - -__fzf_comprun() { - if [[ "$(type _fzf_comprun 2>&1)" =~ function ]]; then - _fzf_comprun "$@" - elif [ -n "$TMUX_PANE" ] && { [ "${FZF_TMUX:-0}" != 0 ] || [ -n "$FZF_TMUX_OPTS" ]; }; then - shift - if [ -n "$FZF_TMUX_OPTS" ]; then - fzf-tmux ${(Q)${(Z+n+)FZF_TMUX_OPTS}} -- "$@" - else - fzf-tmux -d ${FZF_TMUX_HEIGHT:-40%} -- "$@" - fi - else - shift - fzf "$@" - fi -} - -# Extract the name of the command. e.g. foo=1 bar baz** -__fzf_extract_command() { - local token tokens - tokens=(${(z)1}) - for token in $tokens; do - token=${(Q)token} - if [[ "$token" =~ [[:alnum:]] && ! "$token" =~ "=" ]]; then - echo "$token" - return - fi - done - echo "${tokens[1]}" -} - -__fzf_generic_path_completion() { - local base lbuf cmd compgen fzf_opts suffix tail dir leftover matches - base=$1 - lbuf=$2 - cmd=$(__fzf_extract_command "$lbuf") - compgen=$3 - fzf_opts=$4 - suffix=$5 - tail=$6 - - setopt localoptions nonomatch - eval "base=$base" - [[ $base = *"/"* ]] && dir="$base" - while [ 1 ]; do - if [[ -z "$dir" || -d ${dir} ]]; then - leftover=${base/#"$dir"} - leftover=${leftover/#\/} - [ -z "$dir" ] && dir='.' - [ "$dir" != "/" ] && dir="${dir/%\//}" - matches=$(eval "$compgen $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" | while read item; do - echo -n "${(q)item}$suffix " - done) - matches=${matches% } - if [ -n "$matches" ]; then - LBUFFER="$lbuf$matches$tail" - fi - zle reset-prompt - break - fi - dir=$(dirname "$dir") - dir=${dir%/}/ - done -} - -_fzf_path_completion() { - __fzf_generic_path_completion "$1" "$2" _fzf_compgen_path \ - "-m" "" " " -} - -_fzf_dir_completion() { - __fzf_generic_path_completion "$1" "$2" _fzf_compgen_dir \ - "" "/" "" -} - -_fzf_feed_fifo() ( - command rm -f "$1" - mkfifo "$1" - cat <&0 > "$1" & -) - -_fzf_complete() { - setopt localoptions ksh_arrays - # Split arguments around -- - local args rest str_arg i sep - args=("$@") - sep= - for i in {0..${#args[@]}}; do - if [[ "${args[$i]}" = -- ]]; then - sep=$i - break - fi - done - if [[ -n "$sep" ]]; then - str_arg= - rest=("${args[@]:$((sep + 1)):${#args[@]}}") - args=("${args[@]:0:$sep}") - else - str_arg=$1 - args=() - shift - rest=("$@") - fi - - local fifo lbuf cmd matches post - fifo="${TMPDIR:-/tmp}/fzf-complete-fifo-$$" - lbuf=${rest[0]} - cmd=$(__fzf_extract_command "$lbuf") - post="${funcstack[1]}_post" - type $post > /dev/null 2>&1 || post=cat - - _fzf_feed_fifo "$fifo" - matches=$(FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS $str_arg" __fzf_comprun "$cmd" "${args[@]}" -q "${(Q)prefix}" < "$fifo" | $post | tr '\n' ' ') - if [ -n "$matches" ]; then - LBUFFER="$lbuf$matches" - fi - command rm -f "$fifo" -} - -_fzf_complete_telnet() { - _fzf_complete +m -- "$@" < <( - command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0' | - awk '{if (length($2) > 0) {print $2}}' | sort -u - ) -} - -_fzf_complete_ssh() { - _fzf_complete +m -- "$@" < <( - setopt localoptions nonomatch - command cat <(command tail -n +1 ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^\s*host\(name\)\? ' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}' | command grep -v '[*?]') \ - <(command grep -oE '^[[a-z0-9.,:-]+' ~/.ssh/known_hosts | tr ',' '\n' | tr -d '[' | awk '{ print $1 " " $1 }') \ - <(command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0') | - awk '{if (length($2) > 0) {print $2}}' | sort -u - ) -} - -_fzf_complete_export() { - _fzf_complete -m -- "$@" < <( - declare -xp | sed 's/=.*//' | sed 's/.* //' - ) -} - -_fzf_complete_unset() { - _fzf_complete -m -- "$@" < <( - declare -xp | sed 's/=.*//' | sed 's/.* //' - ) -} - -_fzf_complete_unalias() { - _fzf_complete +m -- "$@" < <( - alias | sed 's/=.*//' - ) -} - -_fzf_complete_kill() { - _fzf_complete -m --preview 'echo {}' --preview-window down:3:wrap --min-height 15 -- "$@" < <( - command ps -ef | sed 1d - ) -} - -_fzf_complete_kill_post() { - awk '{print $2}' -} - -fzf-completion() { - local tokens cmd prefix trigger tail matches lbuf d_cmds - setopt localoptions noshwordsplit noksh_arrays noposixbuiltins - - # http://zsh.sourceforge.net/FAQ/zshfaq03.html - # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags - tokens=(${(z)LBUFFER}) - if [ ${#tokens} -lt 1 ]; then - zle ${fzf_default_completion:-expand-or-complete} - return - fi - - cmd=$(__fzf_extract_command "$LBUFFER") - - # Explicitly allow for empty trigger. - trigger=${FZF_COMPLETION_TRIGGER-'**'} - [ -z "$trigger" -a ${LBUFFER[-1]} = ' ' ] && tokens+=("") - - # When the trigger starts with ';', it becomes a separate token - if [[ ${LBUFFER} = *"${tokens[-2]}${tokens[-1]}" ]]; then - tokens[-2]="${tokens[-2]}${tokens[-1]}" - tokens=(${tokens[0,-2]}) - fi - - lbuf=$LBUFFER - tail=${LBUFFER:$(( ${#LBUFFER} - ${#trigger} ))} - # Kill completion (do not require trigger sequence) - if [ "$cmd" = kill -a ${LBUFFER[-1]} = ' ' ]; then - tail=$trigger - tokens+=$trigger - lbuf="$lbuf$trigger" - fi - - # Trigger sequence given - if [ ${#tokens} -gt 1 -a "$tail" = "$trigger" ]; then - d_cmds=(${=FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir}) - - [ -z "$trigger" ] && prefix=${tokens[-1]} || prefix=${tokens[-1]:0:-${#trigger}} - [ -n "${tokens[-1]}" ] && lbuf=${lbuf:0:-${#tokens[-1]}} - - if eval "type _fzf_complete_${cmd} > /dev/null"; then - prefix="$prefix" eval _fzf_complete_${cmd} ${(q)lbuf} - zle reset-prompt - elif [ ${d_cmds[(i)$cmd]} -le ${#d_cmds} ]; then - _fzf_dir_completion "$prefix" "$lbuf" - else - _fzf_path_completion "$prefix" "$lbuf" - fi - # Fall back to default completion - else - zle ${fzf_default_completion:-expand-or-complete} - fi -} - -[ -z "$fzf_default_completion" ] && { - binding=$(bindkey '^I') - [[ $binding =~ 'undefined-key' ]] || fzf_default_completion=$binding[(s: :w)2] - unset binding -} - -zle -N fzf-completion -bindkey '^I' fzf-completion - -} always { - # Restore the original options. - eval $__fzf_completion_options - 'unset' '__fzf_completion_options' -} diff --git a/.config/zsh/plugins/zsh-autosuggestions b/.config/zsh/plugins/zsh-autosuggestions new file mode 160000 index 0000000..0e810e5 --- /dev/null +++ b/.config/zsh/plugins/zsh-autosuggestions @@ -0,0 +1 @@ +Subproject commit 0e810e5afa27acbd074398eefbe28d13005dbc15 diff --git a/.config/zsh/plugins/zsh-autosuggestions.zsh b/.config/zsh/plugins/zsh-autosuggestions.zsh deleted file mode 100644 index b19cac7..0000000 --- a/.config/zsh/plugins/zsh-autosuggestions.zsh +++ /dev/null @@ -1,864 +0,0 @@ -# Fish-like fast/unobtrusive autosuggestions for zsh. -# https://github.com/zsh-users/zsh-autosuggestions -# v0.7.0 -# Copyright (c) 2013 Thiago de Arruda -# Copyright (c) 2016-2021 Eric Freese -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, -# copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following -# conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. - -#--------------------------------------------------------------------# -# Global Configuration Variables # -#--------------------------------------------------------------------# - -# Color to use when highlighting suggestion -# Uses format of `region_highlight` -# More info: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets -(( ! ${+ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE} )) && -typeset -g ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8' - -# Prefix to use when saving original versions of bound widgets -(( ! ${+ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX} )) && -typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig- - -# Strategies to use to fetch a suggestion -# Will try each strategy in order until a suggestion is returned -(( ! ${+ZSH_AUTOSUGGEST_STRATEGY} )) && { - typeset -ga ZSH_AUTOSUGGEST_STRATEGY - ZSH_AUTOSUGGEST_STRATEGY=(history) -} - -# Widgets that clear the suggestion -(( ! ${+ZSH_AUTOSUGGEST_CLEAR_WIDGETS} )) && { - typeset -ga ZSH_AUTOSUGGEST_CLEAR_WIDGETS - ZSH_AUTOSUGGEST_CLEAR_WIDGETS=( - history-search-forward - history-search-backward - history-beginning-search-forward - history-beginning-search-backward - history-substring-search-up - history-substring-search-down - up-line-or-beginning-search - down-line-or-beginning-search - up-line-or-history - down-line-or-history - accept-line - copy-earlier-word - ) -} - -# Widgets that accept the entire suggestion -(( ! ${+ZSH_AUTOSUGGEST_ACCEPT_WIDGETS} )) && { - typeset -ga ZSH_AUTOSUGGEST_ACCEPT_WIDGETS - ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=( - forward-char - end-of-line - vi-forward-char - vi-end-of-line - vi-add-eol - ) -} - -# Widgets that accept the entire suggestion and execute it -(( ! ${+ZSH_AUTOSUGGEST_EXECUTE_WIDGETS} )) && { - typeset -ga ZSH_AUTOSUGGEST_EXECUTE_WIDGETS - ZSH_AUTOSUGGEST_EXECUTE_WIDGETS=( - ) -} - -# Widgets that accept the suggestion as far as the cursor moves -(( ! ${+ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS} )) && { - typeset -ga ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS - ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=( - forward-word - emacs-forward-word - vi-forward-word - vi-forward-word-end - vi-forward-blank-word - vi-forward-blank-word-end - vi-find-next-char - vi-find-next-char-skip - ) -} - -# Widgets that should be ignored (globbing supported but must be escaped) -(( ! ${+ZSH_AUTOSUGGEST_IGNORE_WIDGETS} )) && { - typeset -ga ZSH_AUTOSUGGEST_IGNORE_WIDGETS - ZSH_AUTOSUGGEST_IGNORE_WIDGETS=( - orig-\* - beep - run-help - set-local-history - which-command - yank - yank-pop - zle-\* - ) -} - -# Pty name for capturing completions for completion suggestion strategy -(( ! ${+ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME} )) && -typeset -g ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME=zsh_autosuggest_completion_pty - -#--------------------------------------------------------------------# -# Utility Functions # -#--------------------------------------------------------------------# - -_zsh_autosuggest_escape_command() { - setopt localoptions EXTENDED_GLOB - - # Escape special chars in the string (requires EXTENDED_GLOB) - echo -E "${1//(#m)[\"\'\\()\[\]|*?~]/\\$MATCH}" -} - -#--------------------------------------------------------------------# -# Widget Helpers # -#--------------------------------------------------------------------# - -_zsh_autosuggest_incr_bind_count() { - typeset -gi bind_count=$((_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]+1)) - _ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=$bind_count -} - -# Bind a single widget to an autosuggest widget, saving a reference to the original widget -_zsh_autosuggest_bind_widget() { - typeset -gA _ZSH_AUTOSUGGEST_BIND_COUNTS - - local widget=$1 - local autosuggest_action=$2 - local prefix=$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX - - local -i bind_count - - # Save a reference to the original widget - case $widgets[$widget] in - # Already bound - user:_zsh_autosuggest_(bound|orig)_*) - bind_count=$((_ZSH_AUTOSUGGEST_BIND_COUNTS[$widget])) - ;; - - # User-defined widget - user:*) - _zsh_autosuggest_incr_bind_count $widget - zle -N $prefix$bind_count-$widget ${widgets[$widget]#*:} - ;; - - # Built-in widget - builtin) - _zsh_autosuggest_incr_bind_count $widget - eval "_zsh_autosuggest_orig_${(q)widget}() { zle .${(q)widget} }" - zle -N $prefix$bind_count-$widget _zsh_autosuggest_orig_$widget - ;; - - # Completion widget - completion:*) - _zsh_autosuggest_incr_bind_count $widget - eval "zle -C $prefix$bind_count-${(q)widget} ${${(s.:.)widgets[$widget]}[2,3]}" - ;; - esac - - # Pass the original widget's name explicitly into the autosuggest - # function. Use this passed in widget name to call the original - # widget instead of relying on the $WIDGET variable being set - # correctly. $WIDGET cannot be trusted because other plugins call - # zle without the `-w` flag (e.g. `zle self-insert` instead of - # `zle self-insert -w`). - eval "_zsh_autosuggest_bound_${bind_count}_${(q)widget}() { - _zsh_autosuggest_widget_$autosuggest_action $prefix$bind_count-${(q)widget} \$@ - }" - - # Create the bound widget - zle -N -- $widget _zsh_autosuggest_bound_${bind_count}_$widget -} - -# Map all configured widgets to the right autosuggest widgets -_zsh_autosuggest_bind_widgets() { - emulate -L zsh - - local widget - local ignore_widgets - - ignore_widgets=( - .\* - _\* - ${_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS/#/autosuggest-} - $ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\* - $ZSH_AUTOSUGGEST_IGNORE_WIDGETS - ) - - # Find every widget we might want to bind and bind it appropriately - for widget in ${${(f)"$(builtin zle -la)"}:#${(j:|:)~ignore_widgets}}; do - if [[ -n ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]]; then - _zsh_autosuggest_bind_widget $widget clear - elif [[ -n ${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS[(r)$widget]} ]]; then - _zsh_autosuggest_bind_widget $widget accept - elif [[ -n ${ZSH_AUTOSUGGEST_EXECUTE_WIDGETS[(r)$widget]} ]]; then - _zsh_autosuggest_bind_widget $widget execute - elif [[ -n ${ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS[(r)$widget]} ]]; then - _zsh_autosuggest_bind_widget $widget partial_accept - else - # Assume any unspecified widget might modify the buffer - _zsh_autosuggest_bind_widget $widget modify - fi - done -} - -# Given the name of an original widget and args, invoke it, if it exists -_zsh_autosuggest_invoke_original_widget() { - # Do nothing unless called with at least one arg - (( $# )) || return 0 - - local original_widget_name="$1" - - shift - - if (( ${+widgets[$original_widget_name]} )); then - zle $original_widget_name -- $@ - fi -} - -#--------------------------------------------------------------------# -# Highlighting # -#--------------------------------------------------------------------# - -# If there was a highlight, remove it -_zsh_autosuggest_highlight_reset() { - typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT - - if [[ -n "$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT" ]]; then - region_highlight=("${(@)region_highlight:#$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT}") - unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT - fi -} - -# If there's a suggestion, highlight it -_zsh_autosuggest_highlight_apply() { - typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT - - if (( $#POSTDISPLAY )); then - typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE" - region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT") - else - unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT - fi -} - -#--------------------------------------------------------------------# -# Autosuggest Widget Implementations # -#--------------------------------------------------------------------# - -# Disable suggestions -_zsh_autosuggest_disable() { - typeset -g _ZSH_AUTOSUGGEST_DISABLED - _zsh_autosuggest_clear -} - -# Enable suggestions -_zsh_autosuggest_enable() { - unset _ZSH_AUTOSUGGEST_DISABLED - - if (( $#BUFFER )); then - _zsh_autosuggest_fetch - fi -} - -# Toggle suggestions (enable/disable) -_zsh_autosuggest_toggle() { - if (( ${+_ZSH_AUTOSUGGEST_DISABLED} )); then - _zsh_autosuggest_enable - else - _zsh_autosuggest_disable - fi -} - -# Clear the suggestion -_zsh_autosuggest_clear() { - # Remove the suggestion - unset POSTDISPLAY - - _zsh_autosuggest_invoke_original_widget $@ -} - -# Modify the buffer and get a new suggestion -_zsh_autosuggest_modify() { - local -i retval - - # Only available in zsh >= 5.4 - local -i KEYS_QUEUED_COUNT - - # Save the contents of the buffer/postdisplay - local orig_buffer="$BUFFER" - local orig_postdisplay="$POSTDISPLAY" - - # Clear suggestion while waiting for next one - unset POSTDISPLAY - - # Original widget may modify the buffer - _zsh_autosuggest_invoke_original_widget $@ - retval=$? - - emulate -L zsh - - # Don't fetch a new suggestion if there's more input to be read immediately - if (( $PENDING > 0 || $KEYS_QUEUED_COUNT > 0 )); then - POSTDISPLAY="$orig_postdisplay" - return $retval - fi - - # Optimize if manually typing in the suggestion or if buffer hasn't changed - if [[ "$BUFFER" = "$orig_buffer"* && "$orig_postdisplay" = "${BUFFER:$#orig_buffer}"* ]]; then - POSTDISPLAY="${orig_postdisplay:$(($#BUFFER - $#orig_buffer))}" - return $retval - fi - - # Bail out if suggestions are disabled - if (( ${+_ZSH_AUTOSUGGEST_DISABLED} )); then - return $? - fi - - # Get a new suggestion if the buffer is not empty after modification - if (( $#BUFFER > 0 )); then - if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then - _zsh_autosuggest_fetch - fi - fi - - return $retval -} - -# Fetch a new suggestion based on what's currently in the buffer -_zsh_autosuggest_fetch() { - if (( ${+ZSH_AUTOSUGGEST_USE_ASYNC} )); then - _zsh_autosuggest_async_request "$BUFFER" - else - local suggestion - _zsh_autosuggest_fetch_suggestion "$BUFFER" - _zsh_autosuggest_suggest "$suggestion" - fi -} - -# Offer a suggestion -_zsh_autosuggest_suggest() { - emulate -L zsh - - local suggestion="$1" - - if [[ -n "$suggestion" ]] && (( $#BUFFER )); then - POSTDISPLAY="${suggestion#$BUFFER}" - else - unset POSTDISPLAY - fi -} - -# Accept the entire suggestion -_zsh_autosuggest_accept() { - local -i retval max_cursor_pos=$#BUFFER - - # When vicmd keymap is active, the cursor can't move all the way - # to the end of the buffer - if [[ "$KEYMAP" = "vicmd" ]]; then - max_cursor_pos=$((max_cursor_pos - 1)) - fi - - # If we're not in a valid state to accept a suggestion, just run the - # original widget and bail out - if (( $CURSOR != $max_cursor_pos || !$#POSTDISPLAY )); then - _zsh_autosuggest_invoke_original_widget $@ - return - fi - - # Only accept if the cursor is at the end of the buffer - # Add the suggestion to the buffer - BUFFER="$BUFFER$POSTDISPLAY" - - # Remove the suggestion - unset POSTDISPLAY - - # Run the original widget before manually moving the cursor so that the - # cursor movement doesn't make the widget do something unexpected - _zsh_autosuggest_invoke_original_widget $@ - retval=$? - - # Move the cursor to the end of the buffer - if [[ "$KEYMAP" = "vicmd" ]]; then - CURSOR=$(($#BUFFER - 1)) - else - CURSOR=$#BUFFER - fi - - return $retval -} - -# Accept the entire suggestion and execute it -_zsh_autosuggest_execute() { - # Add the suggestion to the buffer - BUFFER="$BUFFER$POSTDISPLAY" - - # Remove the suggestion - unset POSTDISPLAY - - # Call the original `accept-line` to handle syntax highlighting or - # other potential custom behavior - _zsh_autosuggest_invoke_original_widget "accept-line" -} - -# Partially accept the suggestion -_zsh_autosuggest_partial_accept() { - local -i retval cursor_loc - - # Save the contents of the buffer so we can restore later if needed - local original_buffer="$BUFFER" - - # Temporarily accept the suggestion. - BUFFER="$BUFFER$POSTDISPLAY" - - # Original widget moves the cursor - _zsh_autosuggest_invoke_original_widget $@ - retval=$? - - # Normalize cursor location across vi/emacs modes - cursor_loc=$CURSOR - if [[ "$KEYMAP" = "vicmd" ]]; then - cursor_loc=$((cursor_loc + 1)) - fi - - # If we've moved past the end of the original buffer - if (( $cursor_loc > $#original_buffer )); then - # Set POSTDISPLAY to text right of the cursor - POSTDISPLAY="${BUFFER[$(($cursor_loc + 1)),$#BUFFER]}" - - # Clip the buffer at the cursor - BUFFER="${BUFFER[1,$cursor_loc]}" - else - # Restore the original buffer - BUFFER="$original_buffer" - fi - - return $retval -} - -() { - typeset -ga _ZSH_AUTOSUGGEST_BUILTIN_ACTIONS - - _ZSH_AUTOSUGGEST_BUILTIN_ACTIONS=( - clear - fetch - suggest - accept - execute - enable - disable - toggle - ) - - local action - for action in $_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS modify partial_accept; do - eval "_zsh_autosuggest_widget_$action() { - local -i retval - - _zsh_autosuggest_highlight_reset - - _zsh_autosuggest_$action \$@ - retval=\$? - - _zsh_autosuggest_highlight_apply - - zle -R - - return \$retval - }" - done - - for action in $_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS; do - zle -N autosuggest-$action _zsh_autosuggest_widget_$action - done -} - -#--------------------------------------------------------------------# -# Completion Suggestion Strategy # -#--------------------------------------------------------------------# -# Fetches a suggestion from the completion engine -# - -_zsh_autosuggest_capture_postcompletion() { - # Always insert the first completion into the buffer - compstate[insert]=1 - - # Don't list completions - unset 'compstate[list]' -} - -_zsh_autosuggest_capture_completion_widget() { - # Add a post-completion hook to be called after all completions have been - # gathered. The hook can modify compstate to affect what is done with the - # gathered completions. - local -a +h comppostfuncs - comppostfuncs=(_zsh_autosuggest_capture_postcompletion) - - # Only capture completions at the end of the buffer - CURSOR=$#BUFFER - - # Run the original widget wrapping `.complete-word` so we don't - # recursively try to fetch suggestions, since our pty is forked - # after autosuggestions is initialized. - zle -- ${(k)widgets[(r)completion:.complete-word:_main_complete]} - - if is-at-least 5.0.3; then - # Don't do any cr/lf transformations. We need to do this immediately before - # output because if we do it in setup, onlcr will be re-enabled when we enter - # vared in the async code path. There is a bug in zpty module in older versions - # where the tty is not properly attached to the pty slave, resulting in stty - # getting stopped with a SIGTTOU. See zsh-workers thread 31660 and upstream - # commit f75904a38 - stty -onlcr -ocrnl -F /dev/tty - fi - - # The completion has been added, print the buffer as the suggestion - echo -nE - $'\0'$BUFFER$'\0' -} - -zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget - -_zsh_autosuggest_capture_setup() { - # There is a bug in zpty module in older zsh versions by which a - # zpty that exits will kill all zpty processes that were forked - # before it. Here we set up a zsh exit hook to SIGKILL the zpty - # process immediately, before it has a chance to kill any other - # zpty processes. - if ! is-at-least 5.4; then - zshexit() { - # The zsh builtin `kill` fails sometimes in older versions - # https://unix.stackexchange.com/a/477647/156673 - kill -KILL $$ 2>&- || command kill -KILL $$ - - # Block for long enough for the signal to come through - sleep 1 - } - fi - - # Try to avoid any suggestions that wouldn't match the prefix - zstyle ':completion:*' matcher-list '' - zstyle ':completion:*' path-completion false - zstyle ':completion:*' max-errors 0 not-numeric - - bindkey '^I' autosuggest-capture-completion -} - -_zsh_autosuggest_capture_completion_sync() { - _zsh_autosuggest_capture_setup - - zle autosuggest-capture-completion -} - -_zsh_autosuggest_capture_completion_async() { - _zsh_autosuggest_capture_setup - - zmodload zsh/parameter 2>/dev/null || return # For `$functions` - - # Make vared completion work as if for a normal command line - # https://stackoverflow.com/a/7057118/154703 - autoload +X _complete - functions[_original_complete]=$functions[_complete] - function _complete() { - unset 'compstate[vared]' - _original_complete "$@" - } - - # Open zle with buffer set so we can capture completions for it - vared 1 -} - -_zsh_autosuggest_strategy_completion() { - # Reset options to defaults and enable LOCAL_OPTIONS - emulate -L zsh - - # Enable extended glob for completion ignore pattern - setopt EXTENDED_GLOB - - typeset -g suggestion - local line REPLY - - # Exit if we don't have completions - whence compdef >/dev/null || return - - # Exit if we don't have zpty - zmodload zsh/zpty 2>/dev/null || return - - # Exit if our search string matches the ignore pattern - [[ -n "$ZSH_AUTOSUGGEST_COMPLETION_IGNORE" ]] && [[ "$1" == $~ZSH_AUTOSUGGEST_COMPLETION_IGNORE ]] && return - - # Zle will be inactive if we are in async mode - if zle; then - zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_sync - else - zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_async "\$1" - zpty -w $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME $'\t' - fi - - { - # The completion result is surrounded by null bytes, so read the - # content between the first two null bytes. - zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0' - - # Extract the suggestion from between the null bytes. On older - # versions of zsh (older than 5.3), we sometimes get extra bytes after - # the second null byte, so trim those off the end. - # See http://www.zsh.org/mla/workers/2015/msg03290.html - suggestion="${${(@0)line}[2]}" - } always { - # Destroy the pty - zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME - } -} - -#--------------------------------------------------------------------# -# History Suggestion Strategy # -#--------------------------------------------------------------------# -# Suggests the most recent history item that matches the given -# prefix. -# - -_zsh_autosuggest_strategy_history() { - # Reset options to defaults and enable LOCAL_OPTIONS - emulate -L zsh - - # Enable globbing flags so that we can use (#m) and (x~y) glob operator - setopt EXTENDED_GLOB - - # Escape backslashes and all of the glob operators so we can use - # this string as a pattern to search the $history associative array. - # - (#m) globbing flag enables setting references for match data - # TODO: Use (b) flag when we can drop support for zsh older than v5.0.8 - local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}" - - # Get the history items that match the prefix, excluding those that match - # the ignore pattern - local pattern="$prefix*" - if [[ -n $ZSH_AUTOSUGGEST_HISTORY_IGNORE ]]; then - pattern="($pattern)~($ZSH_AUTOSUGGEST_HISTORY_IGNORE)" - fi - - # Give the first history item matching the pattern as the suggestion - # - (r) subscript flag makes the pattern match on values - typeset -g suggestion="${history[(r)$pattern]}" -} - -#--------------------------------------------------------------------# -# Match Previous Command Suggestion Strategy # -#--------------------------------------------------------------------# -# Suggests the most recent history item that matches the given -# prefix and whose preceding history item also matches the most -# recently executed command. -# -# For example, suppose your history has the following entries: -# - pwd -# - ls foo -# - ls bar -# - pwd -# -# Given the history list above, when you type 'ls', the suggestion -# will be 'ls foo' rather than 'ls bar' because your most recently -# executed command (pwd) was previously followed by 'ls foo'. -# -# Note that this strategy won't work as expected with ZSH options that don't -# preserve the history order such as `HIST_IGNORE_ALL_DUPS` or -# `HIST_EXPIRE_DUPS_FIRST`. - -_zsh_autosuggest_strategy_match_prev_cmd() { - # Reset options to defaults and enable LOCAL_OPTIONS - emulate -L zsh - - # Enable globbing flags so that we can use (#m) and (x~y) glob operator - setopt EXTENDED_GLOB - - # TODO: Use (b) flag when we can drop support for zsh older than v5.0.8 - local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}" - - # Get the history items that match the prefix, excluding those that match - # the ignore pattern - local pattern="$prefix*" - if [[ -n $ZSH_AUTOSUGGEST_HISTORY_IGNORE ]]; then - pattern="($pattern)~($ZSH_AUTOSUGGEST_HISTORY_IGNORE)" - fi - - # Get all history event numbers that correspond to history - # entries that match the pattern - local history_match_keys - history_match_keys=(${(k)history[(R)$~pattern]}) - - # By default we use the first history number (most recent history entry) - local histkey="${history_match_keys[1]}" - - # Get the previously executed command - local prev_cmd="$(_zsh_autosuggest_escape_command "${history[$((HISTCMD-1))]}")" - - # Iterate up to the first 200 history event numbers that match $prefix - for key in "${(@)history_match_keys[1,200]}"; do - # Stop if we ran out of history - [[ $key -gt 1 ]] || break - - # See if the history entry preceding the suggestion matches the - # previous command, and use it if it does - if [[ "${history[$((key - 1))]}" == "$prev_cmd" ]]; then - histkey="$key" - break - fi - done - - # Give back the matched history entry - typeset -g suggestion="$history[$histkey]" -} - -#--------------------------------------------------------------------# -# Fetch Suggestion # -#--------------------------------------------------------------------# -# Loops through all specified strategies and returns a suggestion -# from the first strategy to provide one. -# - -_zsh_autosuggest_fetch_suggestion() { - typeset -g suggestion - local -a strategies - local strategy - - # Ensure we are working with an array - strategies=(${=ZSH_AUTOSUGGEST_STRATEGY}) - - for strategy in $strategies; do - # Try to get a suggestion from this strategy - _zsh_autosuggest_strategy_$strategy "$1" - - # Ensure the suggestion matches the prefix - [[ "$suggestion" != "$1"* ]] && unset suggestion - - # Break once we've found a valid suggestion - [[ -n "$suggestion" ]] && break - done -} - -#--------------------------------------------------------------------# -# Async # -#--------------------------------------------------------------------# - -_zsh_autosuggest_async_request() { - zmodload zsh/system 2>/dev/null # For `$sysparams` - - typeset -g _ZSH_AUTOSUGGEST_ASYNC_FD _ZSH_AUTOSUGGEST_CHILD_PID - - # If we've got a pending request, cancel it - if [[ -n "$_ZSH_AUTOSUGGEST_ASYNC_FD" ]] && { true <&$_ZSH_AUTOSUGGEST_ASYNC_FD } 2>/dev/null; then - # Close the file descriptor and remove the handler - exec {_ZSH_AUTOSUGGEST_ASYNC_FD}<&- - zle -F $_ZSH_AUTOSUGGEST_ASYNC_FD - - # We won't know the pid unless the user has zsh/system module installed - if [[ -n "$_ZSH_AUTOSUGGEST_CHILD_PID" ]]; then - # Zsh will make a new process group for the child process only if job - # control is enabled (MONITOR option) - if [[ -o MONITOR ]]; then - # Send the signal to the process group to kill any processes that may - # have been forked by the suggestion strategy - kill -TERM -$_ZSH_AUTOSUGGEST_CHILD_PID 2>/dev/null - else - # Kill just the child process since it wasn't placed in a new process - # group. If the suggestion strategy forked any child processes they may - # be orphaned and left behind. - kill -TERM $_ZSH_AUTOSUGGEST_CHILD_PID 2>/dev/null - fi - fi - fi - - # Fork a process to fetch a suggestion and open a pipe to read from it - exec {_ZSH_AUTOSUGGEST_ASYNC_FD}< <( - # Tell parent process our pid - echo $sysparams[pid] - - # Fetch and print the suggestion - local suggestion - _zsh_autosuggest_fetch_suggestion "$1" - echo -nE "$suggestion" - ) - - # There's a weird bug here where ^C stops working unless we force a fork - # See https://github.com/zsh-users/zsh-autosuggestions/issues/364 - autoload -Uz is-at-least - is-at-least 5.8 || command true - - # Read the pid from the child process - read _ZSH_AUTOSUGGEST_CHILD_PID <&$_ZSH_AUTOSUGGEST_ASYNC_FD - - # When the fd is readable, call the response handler - zle -F "$_ZSH_AUTOSUGGEST_ASYNC_FD" _zsh_autosuggest_async_response -} - -# Called when new data is ready to be read from the pipe -# First arg will be fd ready for reading -# Second arg will be passed in case of error -_zsh_autosuggest_async_response() { - emulate -L zsh - - local suggestion - - if [[ -z "$2" || "$2" == "hup" ]]; then - # Read everything from the fd and give it as a suggestion - IFS='' read -rd '' -u $1 suggestion - zle autosuggest-suggest -- "$suggestion" - - # Close the fd - exec {1}<&- - fi - - # Always remove the handler - zle -F "$1" -} - -#--------------------------------------------------------------------# -# Start # -#--------------------------------------------------------------------# - -# Start the autosuggestion widgets -_zsh_autosuggest_start() { - # By default we re-bind widgets on every precmd to ensure we wrap other - # wrappers. Specifically, highlighting breaks if our widgets are wrapped by - # zsh-syntax-highlighting widgets. This also allows modifications to the - # widget list variables to take effect on the next precmd. However this has - # a decent performance hit, so users can set ZSH_AUTOSUGGEST_MANUAL_REBIND - # to disable the automatic re-binding. - if (( ${+ZSH_AUTOSUGGEST_MANUAL_REBIND} )); then - add-zsh-hook -d precmd _zsh_autosuggest_start - fi - - _zsh_autosuggest_bind_widgets -} - -# Mark for auto-loading the functions that we use -autoload -Uz add-zsh-hook is-at-least - -# Automatically enable asynchronous mode in newer versions of zsh. Disable for -# older versions because there is a bug when using async mode where ^C does not -# work immediately after fetching a suggestion. -# See https://github.com/zsh-users/zsh-autosuggestions/issues/364 -if is-at-least 5.0.8; then - typeset -g ZSH_AUTOSUGGEST_USE_ASYNC= -fi - -# Start the autosuggestion widgets on the next precmd -add-zsh-hook precmd _zsh_autosuggest_start diff --git a/.config/zsh/plugins/zsh-history-substring-search b/.config/zsh/plugins/zsh-history-substring-search new file mode 160000 index 0000000..87ce96b --- /dev/null +++ b/.config/zsh/plugins/zsh-history-substring-search @@ -0,0 +1 @@ +Subproject commit 87ce96b1862928d84b1afe7c173316614b30e301 diff --git a/.config/zsh/plugins/zsh-history-substring-search.zsh b/.config/zsh/plugins/zsh-history-substring-search.zsh deleted file mode 100644 index a791cc4..0000000 --- a/.config/zsh/plugins/zsh-history-substring-search.zsh +++ /dev/null @@ -1,759 +0,0 @@ -#!/usr/bin/env zsh -############################################################################## -# -# Copyright (c) 2009 Peter Stephenson -# Copyright (c) 2011 Guido van Steen -# Copyright (c) 2011 Suraj N. Kurapati -# Copyright (c) 2011 Sorin Ionescu -# Copyright (c) 2011 Vincent Guerci -# Copyright (c) 2016 Geza Lore -# Copyright (c) 2017 Bengt Brodersen -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# * Neither the name of the FIZSH nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################## - -#----------------------------------------------------------------------------- -# declare global configuration variables -#----------------------------------------------------------------------------- - -typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold' -typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold' -typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' -typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE='' -typeset -g HISTORY_SUBSTRING_SEARCH_FUZZY='' - -#----------------------------------------------------------------------------- -# declare internal global variables -#----------------------------------------------------------------------------- - -typeset -g BUFFER MATCH MBEGIN MEND CURSOR -typeset -g _history_substring_search_refresh_display -typeset -g _history_substring_search_query_highlight -typeset -g _history_substring_search_result -typeset -g _history_substring_search_query -typeset -g -a _history_substring_search_query_parts -typeset -g -a _history_substring_search_raw_matches -typeset -g -i _history_substring_search_raw_match_index -typeset -g -a _history_substring_search_matches -typeset -g -i _history_substring_search_match_index -typeset -g -A _history_substring_search_unique_filter - -#----------------------------------------------------------------------------- -# the main ZLE widgets -#----------------------------------------------------------------------------- - -history-substring-search-up() { - _history-substring-search-begin - - _history-substring-search-up-history || - _history-substring-search-up-buffer || - _history-substring-search-up-search - - _history-substring-search-end -} - -history-substring-search-down() { - _history-substring-search-begin - - _history-substring-search-down-history || - _history-substring-search-down-buffer || - _history-substring-search-down-search - - _history-substring-search-end -} - -zle -N history-substring-search-up -zle -N history-substring-search-down - -#----------------------------------------------------------------------------- -# implementation details -#----------------------------------------------------------------------------- - -zmodload -F zsh/parameter - -# -# We have to "override" some keys and widgets if the -# zsh-syntax-highlighting plugin has not been loaded: -# -# https://github.com/nicoulaj/zsh-syntax-highlighting -# -if [[ $+functions[_zsh_highlight] -eq 0 ]]; then - # - # Dummy implementation of _zsh_highlight() that - # simply removes any existing highlights when the - # user inserts printable characters into $BUFFER. - # - _zsh_highlight() { - if [[ $KEYS == [[:print:]] ]]; then - region_highlight=() - fi - } - - # - # The following snippet was taken from the zsh-syntax-highlighting project: - # - # https://github.com/zsh-users/zsh-syntax-highlighting/blob/56b134f5d62ae3d4e66c7f52bd0cc2595f9b305b/zsh-syntax-highlighting.zsh#L126-161 - # - # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors - # All rights reserved. - # - # Redistribution and use in source and binary forms, with or without - # modification, are permitted provided that the following conditions are - # met: - # - # * Redistributions of source code must retain the above copyright - # notice, this list of conditions and the following disclaimer. - # - # * Redistributions in binary form must reproduce the above copyright - # notice, this list of conditions and the following disclaimer in the - # documentation and/or other materials provided with the distribution. - # - # * Neither the name of the zsh-syntax-highlighting contributors nor the - # names of its contributors may be used to endorse or promote products - # derived from this software without specific prior written permission. - # - # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - # - #--------------8<-------------------8<-------------------8<----------------- - # Rebind all ZLE widgets to make them invoke _zsh_highlights. - _zsh_highlight_bind_widgets() - { - # Load ZSH module zsh/zleparameter, needed to override user defined widgets. - zmodload zsh/zleparameter 2>/dev/null || { - echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2 - return 1 - } - - # Override ZLE widgets to make them invoke _zsh_highlight. - local cur_widget - for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep|yank*)}; do - case $widgets[$cur_widget] in - - # Already rebound event: do nothing. - user:$cur_widget|user:_zsh_highlight_widget_*);; - - # User defined widget: override and rebind old one with prefix "orig-". - user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \ - _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \ - zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; - - # Completion widget: override and rebind old one with prefix "orig-". - completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \ - _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \ - zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; - - # Builtin widget: override and make it call the builtin ".widget". - builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \ - zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; - - # Default: unhandled case. - *) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;; - esac - done - } - #-------------->8------------------->8------------------->8----------------- - - _zsh_highlight_bind_widgets -fi - -_history-substring-search-begin() { - setopt localoptions extendedglob - - _history_substring_search_refresh_display= - _history_substring_search_query_highlight= - - # - # If the buffer is the same as the previously displayed history substring - # search result, then just keep stepping through the match list. Otherwise - # start a new search. - # - if [[ -n $BUFFER && $BUFFER == ${_history_substring_search_result:-} ]]; then - return; - fi - - # - # Clear the previous result. - # - _history_substring_search_result='' - - if [[ -z $BUFFER ]]; then - # - # If the buffer is empty, we will just act like up-history/down-history - # in ZSH, so we do not need to actually search the history. This should - # speed things up a little. - # - _history_substring_search_query= - _history_substring_search_query_parts=() - _history_substring_search_raw_matches=() - - else - # - # For the purpose of highlighting we keep a copy of the original - # query string. - # - _history_substring_search_query=$BUFFER - - # - # compose search pattern - # - if [[ -n $HISTORY_SUBSTRING_SEARCH_FUZZY ]]; then - # - # `=` split string in arguments - # - _history_substring_search_query_parts=(${=_history_substring_search_query}) - else - _history_substring_search_query_parts=(${==_history_substring_search_query}) - fi - - # - # Escape and join query parts with wildcard character '*' as seperator - # `(j:CHAR:)` join array to string with CHAR as seperator - # - local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" - - # - # Find all occurrences of the search pattern in the history file. - # - # (k) returns the "keys" (history index numbers) instead of the values - # (R) returns values in reverse older, so the index of the youngest - # matching history entry is at the head of the list. - # - _history_substring_search_raw_matches=(${(k)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${search_pattern}]}) - fi - - # - # In order to stay as responsive as possible, we will process the raw - # matches lazily (when the user requests the next match) to choose items - # that need to be displayed to the user. - # _history_substring_search_raw_match_index holds the index of the last - # unprocessed entry in _history_substring_search_raw_matches. Any items - # that need to be displayed will be added to - # _history_substring_search_matches. - # - # We use an associative array (_history_substring_search_unique_filter) as - # a 'set' data structure to ensure uniqueness of the results if desired. - # If an entry (key) is in the set (non-empty value), then we have already - # added that entry to _history_substring_search_matches. - # - _history_substring_search_raw_match_index=0 - _history_substring_search_matches=() - _history_substring_search_unique_filter=() - - # - # If $_history_substring_search_match_index is equal to - # $#_history_substring_search_matches + 1, this indicates that we - # are beyond the end of $_history_substring_search_matches and that we - # have also processed all entries in - # _history_substring_search_raw_matches. - # - # If $#_history_substring_search_match_index is equal to 0, this indicates - # that we are beyond the beginning of $_history_substring_search_matches. - # - # If we have initially pressed "up" we have to initialize - # $_history_substring_search_match_index to 0 so that it will be - # incremented to 1. - # - # If we have initially pressed "down" we have to initialize - # $_history_substring_search_match_index to 1 so that it will be - # decremented to 0. - # - if [[ $WIDGET == history-substring-search-down ]]; then - _history_substring_search_match_index=1 - else - _history_substring_search_match_index=0 - fi -} - -_history-substring-search-end() { - setopt localoptions extendedglob - - _history_substring_search_result=$BUFFER - - # the search was successful so display the result properly by clearing away - # existing highlights and moving the cursor to the end of the result buffer - if [[ $_history_substring_search_refresh_display -eq 1 ]]; then - region_highlight=() - CURSOR=${#BUFFER} - fi - - # highlight command line using zsh-syntax-highlighting - _zsh_highlight - - # highlight the search query inside the command line - if [[ -n $_history_substring_search_query_highlight ]]; then - # highlight first matching query parts - local highlight_start_index=0 - local highlight_end_index=0 - local query_part - for query_part in $_history_substring_search_query_parts; do - local escaped_query_part=${query_part//(#m)[\][()|\\*?#<>~^]/\\$MATCH} - # (i) get index of pattern - local query_part_match_index="${${BUFFER:$highlight_start_index}[(i)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${escaped_query_part}]}" - if [[ $query_part_match_index -le ${#BUFFER:$highlight_start_index} ]]; then - highlight_start_index=$(( $highlight_start_index + $query_part_match_index )) - highlight_end_index=$(( $highlight_start_index + ${#query_part} )) - region_highlight+=("$(($highlight_start_index - 1)) $(($highlight_end_index - 1)) $_history_substring_search_query_highlight") - fi - done - fi - - # For debugging purposes: - # zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches} - # read -k -t 200 && zle -U $REPLY - - # Exit successfully from the history-substring-search-* widgets. - return 0 -} - -_history-substring-search-up-buffer() { - # - # Check if the UP arrow was pressed to move the cursor within a multi-line - # buffer. This amounts to three tests: - # - # 1. $#buflines -gt 1. - # - # 2. $CURSOR -ne $#BUFFER. - # - # 3. Check if we are on the first line of the current multi-line buffer. - # If so, pressing UP would amount to leaving the multi-line buffer. - # - # We check this by adding an extra "x" to $LBUFFER, which makes - # sure that xlbuflines is always equal to the number of lines - # until $CURSOR (including the line with the cursor on it). - # - local buflines XLBUFFER xlbuflines - buflines=(${(f)BUFFER}) - XLBUFFER=$LBUFFER"x" - xlbuflines=(${(f)XLBUFFER}) - - if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xlbuflines -ne 1 ]]; then - zle up-line-or-history - return 0 - fi - - return 1 -} - -_history-substring-search-down-buffer() { - # - # Check if the DOWN arrow was pressed to move the cursor within a multi-line - # buffer. This amounts to three tests: - # - # 1. $#buflines -gt 1. - # - # 2. $CURSOR -ne $#BUFFER. - # - # 3. Check if we are on the last line of the current multi-line buffer. - # If so, pressing DOWN would amount to leaving the multi-line buffer. - # - # We check this by adding an extra "x" to $RBUFFER, which makes - # sure that xrbuflines is always equal to the number of lines - # from $CURSOR (including the line with the cursor on it). - # - local buflines XRBUFFER xrbuflines - buflines=(${(f)BUFFER}) - XRBUFFER="x"$RBUFFER - xrbuflines=(${(f)XRBUFFER}) - - if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xrbuflines -ne 1 ]]; then - zle down-line-or-history - return 0 - fi - - return 1 -} - -_history-substring-search-up-history() { - # - # Behave like up in ZSH, except clear the $BUFFER - # when beginning of history is reached like in Fish. - # - if [[ -z $_history_substring_search_query ]]; then - - # we have reached the absolute top of history - if [[ $HISTNO -eq 1 ]]; then - BUFFER= - - # going up from somewhere below the top of history - else - zle up-line-or-history - fi - - return 0 - fi - - return 1 -} - -_history-substring-search-down-history() { - # - # Behave like down-history in ZSH, except clear the - # $BUFFER when end of history is reached like in Fish. - # - if [[ -z $_history_substring_search_query ]]; then - - # going down from the absolute top of history - if [[ $HISTNO -eq 1 && -z $BUFFER ]]; then - BUFFER=${history[1]} - _history_substring_search_refresh_display=1 - - # going down from somewhere above the bottom of history - else - zle down-line-or-history - fi - - return 0 - fi - - return 1 -} - -_history_substring_search_process_raw_matches() { - # - # Process more outstanding raw matches and append any matches that need to - # be displayed to the user to _history_substring_search_matches. - # Return whether there were any more results appended. - # - - # - # While we have more raw matches. Process them to see if there are any more - # matches that need to be displayed to the user. - # - while [[ $_history_substring_search_raw_match_index -lt $#_history_substring_search_raw_matches ]]; do - # - # Move on to the next raw entry and get its history index. - # - _history_substring_search_raw_match_index+=1 - local index=${_history_substring_search_raw_matches[$_history_substring_search_raw_match_index]} - - # - # If HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set to a non-empty value, - # then ensure that only unique matches are presented to the user. - # When HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history, - # so in this case we do not need to do anything. - # - if [[ ! -o HIST_IGNORE_ALL_DUPS && -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then - # - # Get the actual history entry at the new index, and check if we have - # already added it to _history_substring_search_matches. - # - local entry=${history[$index]} - - if [[ -z ${_history_substring_search_unique_filter[$entry]} ]]; then - # - # This is a new unique entry. Add it to the filter and append the - # index to _history_substring_search_matches. - # - _history_substring_search_unique_filter[$entry]=1 - _history_substring_search_matches+=($index) - - # - # Indicate that we did find a match. - # - return 0 - fi - - else - # - # Just append the new history index to the processed matches. - # - _history_substring_search_matches+=($index) - - # - # Indicate that we did find a match. - # - return 0 - fi - - done - - # - # We are beyond the end of the list of raw matches. Indicate that no - # more matches are available. - # - return 1 -} - -_history-substring-search-has-next() { - # - # Predicate function that returns whether any more older matches are - # available. - # - - if [[ $_history_substring_search_match_index -lt $#_history_substring_search_matches ]]; then - # - # We did not reach the end of the processed list, so we do have further - # matches. - # - return 0 - - else - # - # We are at the end of the processed list. Try to process further - # unprocessed matches. _history_substring_search_process_raw_matches - # returns whether any more matches were available, so just return - # that result. - # - _history_substring_search_process_raw_matches - return $? - fi -} - -_history-substring-search-has-prev() { - # - # Predicate function that returns whether any more younger matches are - # available. - # - - if [[ $_history_substring_search_match_index -gt 1 ]]; then - # - # We did not reach the beginning of the processed list, so we do have - # further matches. - # - return 0 - - else - # - # We are at the beginning of the processed list. We do not have any more - # matches. - # - return 1 - fi -} - -_history-substring-search-found() { - # - # A match is available. The index of the match is held in - # $_history_substring_search_match_index - # - # 1. Make $BUFFER equal to the matching history entry. - # - # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND - # to highlight the current buffer. - # - BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]] - _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND -} - -_history-substring-search-not-found() { - # - # No more matches are available. - # - # 1. Make $BUFFER equal to $_history_substring_search_query so the user can - # revise it and search again. - # - # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND - # to highlight the current buffer. - # - BUFFER=$_history_substring_search_query - _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND -} - -_history-substring-search-up-search() { - _history_substring_search_refresh_display=1 - - # - # Select history entry during history-substring-down-search: - # - # The following variables have been initialized in - # _history-substring-search-up/down-search(): - # - # $_history_substring_search_matches is the current list of matches that - # need to be displayed to the user. - # $_history_substring_search_match_index is the index of the current match - # that is being displayed to the user. - # - # The range of values that $_history_substring_search_match_index can take - # is: [0, $#_history_substring_search_matches + 1]. A value of 0 - # indicates that we are beyond the beginning of - # $_history_substring_search_matches. A value of - # $#_history_substring_search_matches + 1 indicates that we are beyond - # the end of $_history_substring_search_matches and that we have also - # processed all entries in _history_substring_search_raw_matches. - # - # If $_history_substring_search_match_index equals - # $#_history_substring_search_matches and - # $_history_substring_search_raw_match_index is not greater than - # $#_history_substring_search_raw_matches, then we need to further process - # $_history_substring_search_raw_matches to see if there are any more - # entries that need to be displayed to the user. - # - # In _history-substring-search-up-search() the initial value of - # $_history_substring_search_match_index is 0. This value is set in - # _history-substring-search-begin(). _history-substring-search-up-search() - # will initially increment it to 1. - # - - if [[ $_history_substring_search_match_index -gt $#_history_substring_search_matches ]]; then - # - # We are beyond the end of $_history_substring_search_matches. This - # can only happen if we have also exhausted the unprocessed matches in - # _history_substring_search_raw_matches. - # - # 1. Update display to indicate search not found. - # - _history-substring-search-not-found - return - fi - - if _history-substring-search-has-next; then - # - # We do have older matches. - # - # 1. Move index to point to the next match. - # 2. Update display to indicate search found. - # - _history_substring_search_match_index+=1 - _history-substring-search-found - - else - # - # We do not have older matches. - # - # 1. Move the index beyond the end of - # _history_substring_search_matches. - # 2. Update display to indicate search not found. - # - _history_substring_search_match_index+=1 - _history-substring-search-not-found - fi - - # - # When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from - # history should be matched, make sure the new and old results are different. - # - # However, if the HIST_IGNORE_ALL_DUPS shell option, or - # HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set, then we already have a - # unique history, so in this case we do not need to do anything. - # - if [[ -o HIST_IGNORE_ALL_DUPS || -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then - return - fi - - if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then - # - # Repeat the current search so that a different (unique) match is found. - # - _history-substring-search-up-search - fi -} - -_history-substring-search-down-search() { - _history_substring_search_refresh_display=1 - - # - # Select history entry during history-substring-down-search: - # - # The following variables have been initialized in - # _history-substring-search-up/down-search(): - # - # $_history_substring_search_matches is the current list of matches that - # need to be displayed to the user. - # $_history_substring_search_match_index is the index of the current match - # that is being displayed to the user. - # - # The range of values that $_history_substring_search_match_index can take - # is: [0, $#_history_substring_search_matches + 1]. A value of 0 - # indicates that we are beyond the beginning of - # $_history_substring_search_matches. A value of - # $#_history_substring_search_matches + 1 indicates that we are beyond - # the end of $_history_substring_search_matches and that we have also - # processed all entries in _history_substring_search_raw_matches. - # - # In _history-substring-search-down-search() the initial value of - # $_history_substring_search_match_index is 1. This value is set in - # _history-substring-search-begin(). _history-substring-search-down-search() - # will initially decrement it to 0. - # - - if [[ $_history_substring_search_match_index -lt 1 ]]; then - # - # We are beyond the beginning of $_history_substring_search_matches. - # - # 1. Update display to indicate search not found. - # - _history-substring-search-not-found - return - fi - - if _history-substring-search-has-prev; then - # - # We do have younger matches. - # - # 1. Move index to point to the previous match. - # 2. Update display to indicate search found. - # - _history_substring_search_match_index+=-1 - _history-substring-search-found - - else - # - # We do not have younger matches. - # - # 1. Move the index beyond the beginning of - # _history_substring_search_matches. - # 2. Update display to indicate search not found. - # - _history_substring_search_match_index+=-1 - _history-substring-search-not-found - fi - - # - # When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from - # history should be matched, make sure the new and old results are different. - # - # However, if the HIST_IGNORE_ALL_DUPS shell option, or - # HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set, then we already have a - # unique history, so in this case we do not need to do anything. - # - if [[ -o HIST_IGNORE_ALL_DUPS || -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then - return - fi - - if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then - # - # Repeat the current search so that a different (unique) match is found. - # - _history-substring-search-down-search - fi -} - -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et diff --git a/.gitignore b/.gitignore index 9662a3c..022fe7f 100755 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,9 @@ shortcuts* !/.config/yt-dlp !/.config/python !/.config/ipython +!/.config/jupyter !/.config/git +!/.config/fd !/.config/gtk-2.0 !/.config/gtk-3.0 diff --git a/.gitmodules b/.gitmodules index 5ec3787..1ee381a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,9 @@ [submodule ".config/zsh/plugins/zsh-syntax-highlighting"] path = .config/zsh/plugins/zsh-syntax-highlighting url = https://github.com/zsh-users/zsh-syntax-highlighting +[submodule ".config/zsh/plugins/zsh-autosuggestions"] + path = .config/zsh/plugins/zsh-autosuggestions + url = /home/master/.config/zsh/plugins/zsh-autosuggestions +[submodule ".config/zsh/plugins/zsh-history-substring-search"] + path = .config/zsh/plugins/zsh-history-substring-search + url = /home/master/.config/zsh/plugins/zsh-history-substring-search diff --git a/.local/bin/desktop/show-i3-keybindings b/.local/bin/desktop/show-i3-keybindings index 45d0626..f7d7d70 100755 --- a/.local/bin/desktop/show-i3-keybindings +++ b/.local/bin/desktop/show-i3-keybindings @@ -6,6 +6,6 @@ if [ -n "$TERM" ]; then column --table --separator='|' | less -r else grep '^bindsym' ~/.config/i3/config | sort | - sed 's/^bindsym \(\S*\)\s\+\(.*\)$/\1|\2/; s/\$super+/  /; s/Shift+/Shift /; s/$alt+/Alt /; s/Ctrl+/Ctrl /' | + sed 's/^bindsym \(\S*\)\s\+\(.*\)$/\1|\2/; s/\$super+/  /; s/Shift+/⬆️ /; s/$alt+/⎇ /; s/Ctrl+/Ctrl /' | column --table --separator='|' | yad --text-info fi diff --git a/.local/bin/development/dev b/.local/bin/development/dev index bcb5b46..cd95f27 100755 --- a/.local/bin/development/dev +++ b/.local/bin/development/dev @@ -49,8 +49,8 @@ go_format() { gofmt "$file"; } go_lint() { gofmt -d "$file"; } go_compile() { go build "$file"; } go_run() { "$(realpath "${file%.go}")" "$@"; } -go_test() { go run "$file" "$@"; } -go_serve() { findweb . -name '*.go' | entr -r sh -c "printf '\n\n$ go run *.go\n'; go run *.go"; } +go_test() { TMPDIR=~/.cache/go-tmp go run "$file" "$@"; } +go_serve() { findweb . -name '*.go' | entr -r sh -c "printf '\n\n$ go run *.go\n'; dev test *.go"; } c_test() { out="${file%.c}" @@ -110,6 +110,9 @@ kt_test() { rm "$out" } +py_format() { autopep8 "$file"; } +py_formatin() { autopep8 -i "$file"; } + py_serve() { findweb . -name '*.py' | entr -r python "$file"; } # py_lint() { # [ -t 1 ] && printf '\033[33m' diff --git a/.local/bin/development/gitpush b/.local/bin/development/gitpush index 0af8e20..7774a7b 100755 --- a/.local/bin/development/gitpush +++ b/.local/bin/development/gitpush @@ -8,13 +8,12 @@ push_to_remote() { esac git add --all - git commit - git push -u origin + git commit && git push -u origin } [ -z "$1" ] && { push_to_remote; exit; } for dir in "$@"; do - cd "$dir" || exit 1 + cd "$dir" || exit push_to_remote done diff --git a/.local/bin/development/ipy b/.local/bin/development/ipy index 1f39550..ae26eb1 100755 --- a/.local/bin/development/ipy +++ b/.local/bin/development/ipy @@ -1,4 +1,8 @@ #!/bin/sh unset PYTHONSTARTUP -"${XDG_DATA_HOME:-$HOME/.local/share}/virtualenvs/main/bin/ipython" "$@" + +env="${XDG_DATA_HOME:-$HOME/.local/share}/virtualenvs/main/bin/activate" +[ -f "$env" ] && . "$env" + +ipython "$@" diff --git a/.local/bin/development/jp b/.local/bin/development/jp new file mode 100755 index 0000000..19bf0bc --- /dev/null +++ b/.local/bin/development/jp @@ -0,0 +1,16 @@ +#!/bin/sh + +# Alias to jupyter. +# Select and launch console when no arguments are passed. + +[ -f "${XDG_DATA_HOME:=$HOME/.local/share}/virtualenvs/main/bin/activate" ] && + . "$XDG_DATA_HOME/virtualenvs/main/bin/activate" + +[ "$#" -eq 0 ] && { + kernel="$(find "$XDG_DATA_HOME/jupyter/runtime" -name 'kernel*' -printf '%TY-%Tm-%Td %TH:%TM:%.2TS %f\n' | + sed 's/kernel-\(.\+\)-.\+-.\+-.\+-.\+\.json/\1/' | sort --reverse | + fzf --header="Select jupyter kernel" --header-first | cut -d\ -f3)" || exit + set -- console --existing "$kernel" +} + +jupyter "$@" diff --git a/.local/bin/development/jpconvert b/.local/bin/development/jpconvert new file mode 100755 index 0000000..0fa3bbc --- /dev/null +++ b/.local/bin/development/jpconvert @@ -0,0 +1,16 @@ +#!/bin/sh + +env="${XDG_DATA_HOME:-$HOME/.local/share}/virtualenvs/main/bin/activate" +[ -f "$env" ] && . "$env" + +notebook="$1" +script="${notebook%.ipynb}.py" +jupyter nbconvert --to script "$notebook" + +sed -i \ + -e "s/^# coding: .*$/# same as $notebook/" \ + -e "s/^\([A-Za-z0-9_.]\+\)$/print(\"\\\nData in '\1' :-\", \1, sep='\\\n', end='\\\n\\\n')/" \ + "$script" + +sed -i -z "s/\n# In\[[0-9 ]*\]:\n\n//g" "$script" +sed -i -z "s/\n\s*\n\([][A-Za-z0-9_\.(,)]\+\)\n\n\n/\nprint(\"\\\n>>> \1\", \1, sep='\\\n', end='\\\n\\\n')\n\n\n/g" "$script" diff --git a/.local/bin/development/pyh b/.local/bin/development/pyh index fdd524a..d8bd1a4 100755 --- a/.local/bin/development/pyh +++ b/.local/bin/development/pyh @@ -5,6 +5,8 @@ [ -x "${XDG_DATA_HOME:-$HOME/.local/share}/virtualenvs/main/bin/python" ] && alias python="${XDG_DATA_HOME:-$HOME/.local/share}/virtualenvs/main/bin/python" +export PAGER="less $LESS" + if [ "$#" -gt 0 ]; then python -c "help('$*')" else diff --git a/.local/bin/fmd b/.local/bin/fmd index 0139d77..72e5542 100755 --- a/.local/bin/fmd +++ b/.local/bin/fmd @@ -6,16 +6,7 @@ export PREVIEW="${PREVIEW:-"cat \"\$(dirname {})/.description/\${\$(basename {})%.*}.txt\" 2>/dev/null || preview {}"}" -find "$@" -type f \ - ! -path '*/.*' \ - ! -name '*.srt' \ - ! -name '*.vtt' \ - ! -name '*.description' \ - ! -wholename '.description/*' \ - ! -name '*.info.json' \ - ! -name '*.live_chat.json' \ - ! -name '*.yt*' | - sort | +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}" \ --header="${FZF_HEADER:-Browse Media Files}" --header-first \ diff --git a/.local/bin/fw b/.local/bin/fw index ada20e8..75f23af 100755 --- a/.local/bin/fw +++ b/.local/bin/fw @@ -1,10 +1,11 @@ #!/bin/sh -export FZF_HIST="$HOME/.local/share/fzf/wiki_history" +export FZF_HIST="${XDG_DATA_HOME:-$HOME/.local/share}/fzf/wiki_history" export FZF_HEADER="Search local wiki files" -export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --delimiter='/' --with-nth=-1" -fmd \ +export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --delimiter='/' --with-nth=-3.." +fmd . \ /mnt/storage/Media/Tech/ \ /mnt/storage/Library \ /usr/share/doc/arch-wiki/html/en \ - "$@" ! -name '*.css' + --exclude '*.css' \ + "$@" diff --git a/.local/bin/preview b/.local/bin/preview index 2968843..b71d0f0 100755 --- a/.local/bin/preview +++ b/.local/bin/preview @@ -2,9 +2,9 @@ if [ -d "$1" ]; then if [ -x /bin/eza ] || [ -x /usr/bin/eza ]; then - eza -alhF --group-directories-first --color=always --icons -- "$1" + eza -alhF --group-directories-first --color=always --icons=always -- "$1" else - ls -lhAF --group-directories-first --color -- "$1" + ls -lhAF --group-directories-first --color=always -- "$1" fi readme="$(find "$1" -maxdepth 1 -name "README.*" | head -1)" [ -n "$readme" ] && preview "$readme" @@ -14,7 +14,7 @@ fi alias highlight='highlight --out-format=ansi' case "$1" in - '') echo "preview: file name required" >&2; exit 1 ;; + '') echo "USAGE: preview " >&2; exit 1 ;; *.html) w3m -dump "$1" ;; *.md) glow -s dark --width="${FZF_PREVIEW_COLUMNS:-"$(tput cols)"}" "$1" ;; # *.vim) highlight --syntax=vim --replace-tabs=2 -- "$1" ;; diff --git a/.local/share/applications/omnetpp-6.1-ide.desktop b/.local/share/applications/omnetpp-6.1-ide.desktop new file mode 100755 index 0000000..a68610d --- /dev/null +++ b/.local/share/applications/omnetpp-6.1-ide.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Exec=/home/master/Downloads/omnetpp-6.1/bin/opp_ide +Icon=/home/master/Downloads/omnetpp-6.1/images/logo/logo128.png +Name=OMNeT++ 6.1 IDE +Categories=Development diff --git a/.local/share/applications/omnetpp-6.1-shell.desktop b/.local/share/applications/omnetpp-6.1-shell.desktop new file mode 100755 index 0000000..5efc7de --- /dev/null +++ b/.local/share/applications/omnetpp-6.1-shell.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Exec=/bin/bash --rcfile /home/master/Downloads/omnetpp-6.1/setenv +Terminal=true +Icon=/home/master/Downloads/omnetpp-6.1/images/logo/logo128s.png +Name=OMNeT++ 6.1 Shell +Categories=Development -- cgit v1.2.3