Fix mistaken rsync
This commit is contained in:
@@ -1,101 +0,0 @@
|
|||||||
;; Added by Package.el. This must come before configurations of
|
|
||||||
;; installed packages. Don't delete this line. If you don't want it,
|
|
||||||
;; just comment it out by adding a semicolon to the start of the line.
|
|
||||||
;; You may delete these explanatory comments.
|
|
||||||
(package-initialize)
|
|
||||||
|
|
||||||
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
|
|
||||||
("melpa" . "https://melpa.org/packages/")))
|
|
||||||
|
|
||||||
;; Funzioni di servizio
|
|
||||||
(defvar rc/package-contents-refreshed nil)
|
|
||||||
(defvar rc/required-packages nil)
|
|
||||||
|
|
||||||
(defun rc/package-refresh-contents-once ()
|
|
||||||
(when (not rc/package-contents-refreshed)
|
|
||||||
(setq rc/package-contents-refreshed t)
|
|
||||||
(package-refresh-contents)))
|
|
||||||
|
|
||||||
(defun rc/require-one-package (package)
|
|
||||||
(push package rc/required-packages)
|
|
||||||
(when (not (package-installed-p package))
|
|
||||||
(rc/package-refresh-contents-once)
|
|
||||||
(package-install package)))
|
|
||||||
|
|
||||||
(defun rc/require (&rest packages)
|
|
||||||
(dolist (package packages)
|
|
||||||
(rc/require-one-package package)))
|
|
||||||
|
|
||||||
(defun rc/require-theme (theme)
|
|
||||||
(let ((theme-package (->> theme
|
|
||||||
(symbol-name)
|
|
||||||
(funcall (-flip #'concat) "-theme")
|
|
||||||
(intern))))
|
|
||||||
(rc/require theme-package)
|
|
||||||
(load-theme theme t)))
|
|
||||||
|
|
||||||
(rc/require 'dash)
|
|
||||||
(require 'dash)
|
|
||||||
|
|
||||||
(rc/require 'dash-functional)
|
|
||||||
(require 'dash-functional)
|
|
||||||
|
|
||||||
(defun rc/package-reqs (package)
|
|
||||||
(let ((package-desc
|
|
||||||
(->> package-alist
|
|
||||||
(alist-get package)
|
|
||||||
(car))))
|
|
||||||
(when package-desc
|
|
||||||
(package-desc-reqs package-desc))))
|
|
||||||
|
|
||||||
(defun rc/package-dependencies (package)
|
|
||||||
(->> package
|
|
||||||
(rc/package-reqs)
|
|
||||||
(-map #'car)
|
|
||||||
(cons package)))
|
|
||||||
|
|
||||||
(defun rc/package-expand-dependencies (packages)
|
|
||||||
(->> packages
|
|
||||||
(-map #'rc/package-dependencies)
|
|
||||||
(-flatten)
|
|
||||||
(remove-duplicates)))
|
|
||||||
|
|
||||||
(defun rc/unused-packages ()
|
|
||||||
(let ((all-package (rc/package-expand-dependencies rc/required-packages)))
|
|
||||||
(->> package-alist
|
|
||||||
(-map #'car)
|
|
||||||
(-filter (-lambda (package)
|
|
||||||
(not (-contains? all-package package)))))))
|
|
||||||
|
|
||||||
(defun rc/remove-unused-packages ()
|
|
||||||
(interactive)
|
|
||||||
(message "Unused packages: %s" (rc/unused-packages)))
|
|
||||||
|
|
||||||
;; Carica il file con delle configurazioni,
|
|
||||||
;; la configurazione è un file scritto con org-mode.
|
|
||||||
(require 'org)
|
|
||||||
(org-babel-load-file
|
|
||||||
(expand-file-name "settings.org"
|
|
||||||
user-emacs-directory))
|
|
||||||
|
|
||||||
(custom-set-variables
|
|
||||||
;; custom-set-variables was added by Custom.
|
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
|
||||||
;; Your init file should contain only one such instance.
|
|
||||||
;; If there is more than one, they won't work right.
|
|
||||||
'(org-agenda-dim-blocked-tasks nil)
|
|
||||||
'(org-agenda-exporter-settings (quote ((org-agenda-tag-filter-preset (list "+personal")))))
|
|
||||||
'(org-enforce-todo-dependencies nil)
|
|
||||||
'(org-modules
|
|
||||||
(quote
|
|
||||||
(org-bbdb org-bibtex org-docview org-gnus org-habit org-info org-irc org-mhe org-rmail org-w3m)))
|
|
||||||
'(org-refile-use-outline-path (quote file))
|
|
||||||
'(package-selected-packages
|
|
||||||
(quote
|
|
||||||
(exec-path-from-shell yasnippet rainbow-mode org-cliplink openwith nasm-mode multiple-cursors move-text ido-completing-read+ smex editorconfig company atom-one-dark-theme paredit material-theme magit lsp-mode))))
|
|
||||||
(custom-set-faces
|
|
||||||
;; custom-set-faces was added by Custom.
|
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
|
||||||
;; Your init file should contain only one such instance.
|
|
||||||
;; If there is more than one, they won't work right.
|
|
||||||
)
|
|
||||||
@@ -1,710 +0,0 @@
|
|||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(when (executable-find "agda-mode")
|
|
||||||
(load-file (let ((coding-system-for-read 'utf-8))
|
|
||||||
(shell-command-to-string "agda-mode locate"))))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
;;; Fonts
|
|
||||||
(defun rc/get-default-font ()
|
|
||||||
(cond
|
|
||||||
((eq system-type 'windows-nt) "Consolas-13")
|
|
||||||
((eq system-type 'gnu/linux) "Fira Code-12")
|
|
||||||
((eq system-type 'darwin) "Monaco-14")))
|
|
||||||
|
|
||||||
(add-to-list 'default-frame-alist `(font . ,(rc/get-default-font)))
|
|
||||||
|
|
||||||
(when (display-graphic-p)
|
|
||||||
(set-face-attribute 'fixed-pitch nil :family (rc/get-default-font)))
|
|
||||||
|
|
||||||
;;; GUI
|
|
||||||
(tool-bar-mode 0)
|
|
||||||
(menu-bar-mode 0)
|
|
||||||
(scroll-bar-mode 0)
|
|
||||||
(column-number-mode 1)
|
|
||||||
(show-paren-mode 1)
|
|
||||||
(setq frame-title-format "Emacs")
|
|
||||||
(set-default 'cursor-type 'hbar)
|
|
||||||
(global-hl-line-mode)
|
|
||||||
(winner-mode t)
|
|
||||||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
|
||||||
(windmove-default-keybindings)
|
|
||||||
|
|
||||||
;;; Themes
|
|
||||||
(rc/require-theme 'atom-one-dark)
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
;;; TODO(c3bdae31-4329-4217-98a0-743b9dcbb6d2): extract autocommit into a separate package
|
|
||||||
;;;
|
|
||||||
;;; Once e266bfaa-2a01-4881-9e7f-ce2c592f7cdd is done, I think we can do that.
|
|
||||||
|
|
||||||
(defvar rc/autocommit-local-locks
|
|
||||||
(make-hash-table :test 'equal))
|
|
||||||
|
|
||||||
(defun rc/file-truename-nilable (filename)
|
|
||||||
(when filename
|
|
||||||
(file-truename filename)))
|
|
||||||
|
|
||||||
(defun rc/autocommit--id ()
|
|
||||||
(let ((id (-> default-directory
|
|
||||||
(locate-dominating-file ".git")
|
|
||||||
(rc/file-truename-nilable))))
|
|
||||||
(when (not id)
|
|
||||||
(error "%s is not inside of a git repository" default-directory))
|
|
||||||
(unless (gethash id rc/autocommit-local-locks)
|
|
||||||
(puthash id nil rc/autocommit-local-locks))
|
|
||||||
id))
|
|
||||||
|
|
||||||
(defun rc/autocommit--get-lock (lock)
|
|
||||||
(-> (rc/autocommit--id)
|
|
||||||
(gethash rc/autocommit-local-locks)
|
|
||||||
(plist-get lock)))
|
|
||||||
|
|
||||||
(defun rc/autocommit--set-lock (lock value)
|
|
||||||
(puthash (rc/autocommit--id)
|
|
||||||
(-> (rc/autocommit--id)
|
|
||||||
(gethash rc/autocommit-local-locks)
|
|
||||||
(plist-put lock value))
|
|
||||||
rc/autocommit-local-locks))
|
|
||||||
|
|
||||||
(defun rc/autocommit--toggle-lock (lock)
|
|
||||||
(-> lock
|
|
||||||
(rc/autocommit--get-lock)
|
|
||||||
(not)
|
|
||||||
(rc/autocommit--set-lock)))
|
|
||||||
|
|
||||||
(defun rc/autocommit--create-dir-locals (file-name)
|
|
||||||
(write-region "((nil . ((eval . (rc/autocommit-dir-locals)))))"
|
|
||||||
nil file-name))
|
|
||||||
|
|
||||||
(defun rc/y-or-n-if (predicate question action)
|
|
||||||
(when (or (not (funcall predicate))
|
|
||||||
(y-or-n-p question))
|
|
||||||
(funcall action)))
|
|
||||||
|
|
||||||
;;; TODO(4229cf9a-4768-4f5e-aca1-865256c64a23): rc/autocommit-init-dir should modify dir locals file on AST level
|
|
||||||
;;;
|
|
||||||
;;; Right know it just overrides .dir-locals file on text level. I
|
|
||||||
;;; want it to
|
|
||||||
;;; - read .dir-locals,
|
|
||||||
;;; - parse the assoc list,
|
|
||||||
;;; - check if there is already autocommit stuff
|
|
||||||
;;; - add autocommit stuff to the assoc list if needed
|
|
||||||
;;; - and write it back to the file
|
|
||||||
;;;
|
|
||||||
;;; That will enable us with modifying dir locals that contains custom
|
|
||||||
;;; stuff unrelated to autocommit
|
|
||||||
(defun rc/autocommit-init-dir (&optional dir)
|
|
||||||
"Initialize autocommit folder."
|
|
||||||
(interactive "DAutocommit directory: ")
|
|
||||||
(let* ((autocommit-dir (if dir dir default-directory))
|
|
||||||
(file-name (concat autocommit-dir
|
|
||||||
dir-locals-file)))
|
|
||||||
(rc/y-or-n-if (-partial #'file-exists-p file-name)
|
|
||||||
(format "%s already exists. Replace it?" file-name)
|
|
||||||
(-partial #'rc/autocommit--create-dir-locals file-name))))
|
|
||||||
|
|
||||||
(defun rc/autocommit-dir-locals ()
|
|
||||||
"The function that has to be put into the .dir-locals.el file
|
|
||||||
of the autocommit folder as evaluated for any mode."
|
|
||||||
(interactive)
|
|
||||||
(auto-revert-mode 1)
|
|
||||||
(rc/autopull-changes)
|
|
||||||
(add-hook 'after-save-hook
|
|
||||||
'rc/autocommit-changes
|
|
||||||
nil 'make-it-local))
|
|
||||||
|
|
||||||
;;; TODO: rc/toggle-autocommit-offline doesn't work correctly
|
|
||||||
;;;
|
|
||||||
;;; It should toggle offline for all of the folders at once
|
|
||||||
(defun rc/toggle-autocommit-offline ()
|
|
||||||
"Toggle between OFFLINE and ONLINE modes.
|
|
||||||
|
|
||||||
Autocommit can be in two modes: OFFLINE and ONLINE. When ONLINE
|
|
||||||
rc/autocommit-changes does `git commit && git push'. When OFFLINE
|
|
||||||
rc/autocommit does only `git commit'."
|
|
||||||
(interactive)
|
|
||||||
(rc/autocommit--toggle-lock 'autocommit-offline)
|
|
||||||
(if (rc/autocommit--get-lock 'autocommit-offline)
|
|
||||||
(message "[OFFLINE] Autocommit Mode")
|
|
||||||
(message "[ONLINE] Autocommit Mode")))
|
|
||||||
|
|
||||||
(defun rc/autopull-changes ()
|
|
||||||
"Pull the recent changes.
|
|
||||||
|
|
||||||
Should be invoked once before working with the content under
|
|
||||||
autocommit. Usually put into the dir locals file."
|
|
||||||
(interactive)
|
|
||||||
(when (not (rc/autocommit--get-lock 'autopull-lock))
|
|
||||||
(rc/autocommit--set-lock 'autopull-lock t)
|
|
||||||
(if (rc/autocommit--get-lock 'autocommit-offline)
|
|
||||||
(message "[OFFLINE] NOT Syncing the Agenda")
|
|
||||||
(if (y-or-n-p (format "Sync the Agenda? [%s]" (rc/autocommit--id)))
|
|
||||||
(progn
|
|
||||||
(message (format "Syncing the Agenda [%s]" (rc/autocommit--id)))
|
|
||||||
(shell-command "git pull"))
|
|
||||||
(progn
|
|
||||||
(rc/autocommit--set-lock 'autocommit-offline t)
|
|
||||||
(message (format "[OFFLINE] NOT Syncing the Agenda [%s]"
|
|
||||||
(rc/autocommit--id))))))))
|
|
||||||
|
|
||||||
(defun rc/autocommit-changes ()
|
|
||||||
"Commit all of the changes under the autocommit folder.
|
|
||||||
|
|
||||||
Should be invoked each time a change is made. Usually put into
|
|
||||||
dir locals file."
|
|
||||||
(interactive)
|
|
||||||
(if (rc/autocommit--get-lock 'autocommit-lock)
|
|
||||||
(rc/autocommit--set-lock 'autocommit-changed t)
|
|
||||||
(rc/autocommit--set-lock 'autocommit-lock t)
|
|
||||||
(rc/autocommit--set-lock 'autocommit-changed nil)
|
|
||||||
(set-process-sentinel (rc/run-commit-process (rc/autocommit--id))
|
|
||||||
(-partial 'rc/autocommit-beat (rc/autocommit--id)))))
|
|
||||||
|
|
||||||
(defun rc/run-commit-process (autocommit-directory)
|
|
||||||
(let ((default-directory autocommit-directory))
|
|
||||||
(let ((autocommit-message (format-time-string "Autocommit %s")))
|
|
||||||
(start-process-shell-command
|
|
||||||
(format "Autocommit-%s" autocommit-directory)
|
|
||||||
(format "*Autocommit-%s*" autocommit-directory)
|
|
||||||
(format (if (rc/autocommit--get-lock 'autocommit-offline)
|
|
||||||
"git add -A && git commit -m \"%s\""
|
|
||||||
"git add -A && git commit -m \"%s\" && git push origin master")
|
|
||||||
autocommit-message)))))
|
|
||||||
|
|
||||||
(defun rc/autocommit-beat (autocommit-directory process event)
|
|
||||||
(let ((default-directory autocommit-directory))
|
|
||||||
(message (if (rc/autocommit--get-lock 'autocommit-offline)
|
|
||||||
"[OFFLINE] Autocommit: %s"
|
|
||||||
"Autocommit: %s")
|
|
||||||
event)
|
|
||||||
(if (not (rc/autocommit--get-lock 'autocommit-changed))
|
|
||||||
(rc/autocommit--set-lock 'autocommit-lock nil)
|
|
||||||
(rc/autocommit--set-lock 'autocommit-changed nil)
|
|
||||||
(set-process-sentinel (rc/run-commit-process autocommit-directory)
|
|
||||||
(-partial 'rc/autocommit-beat autocommit-directory)))))
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(setq-default c-basic-offset 4
|
|
||||||
c-default-style '((java-mode . "java")
|
|
||||||
(awk-mode . "awk")
|
|
||||||
(other . "bsd")))
|
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
|
|
||||||
|
|
||||||
(add-hook 'c-mode-hook (lambda ()
|
|
||||||
(interactive)
|
|
||||||
(c-toggle-comment-style -1)))
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'company)
|
|
||||||
(require 'company)
|
|
||||||
|
|
||||||
(global-company-mode)
|
|
||||||
|
|
||||||
(add-hook 'tuareg-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(interactive)
|
|
||||||
(company-mode 0)))
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(require 'dired-x)
|
|
||||||
(setq dired-omit-files
|
|
||||||
(concat dired-omit-files "\\|^\\..+$"))
|
|
||||||
(setq-default dired-dwim-target t)
|
|
||||||
(setq dired-listing-switches "-alh")
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'editorconfig)
|
|
||||||
(editorconfig-mode 1)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(defun rc/turn-on-eldoc-mode ()
|
|
||||||
(interactive)
|
|
||||||
(eldoc-mode 1))
|
|
||||||
|
|
||||||
(add-hook 'emacs-lisp-mode-hook 'rc/turn-on-eldoc-mode)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(add-hook 'emacs-lisp-mode-hook
|
|
||||||
'(lambda ()
|
|
||||||
(local-set-key (kbd "C-c C-j")
|
|
||||||
(quote eval-print-last-sexp))))
|
|
||||||
(add-to-list 'auto-mode-alist '("Cask" . emacs-lisp-mode))
|
|
||||||
|
|
||||||
;; Automatically load paredit when editing a lisp file
|
|
||||||
;; More at http://www.emacswiki.org/emacs/ParEdit
|
|
||||||
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
|
|
||||||
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
|
|
||||||
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
|
|
||||||
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
|
|
||||||
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
|
|
||||||
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
|
|
||||||
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
|
|
||||||
|
|
||||||
;; eldoc-mode shows documentation in the minibuffer when writing code
|
|
||||||
;; http://www.emacswiki.org/emacs/ElDoc
|
|
||||||
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
|
|
||||||
(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
|
|
||||||
(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'smex 'ido-completing-read+)
|
|
||||||
|
|
||||||
(require 'ido-completing-read+)
|
|
||||||
|
|
||||||
(ido-mode 1)
|
|
||||||
(ido-everywhere 1)
|
|
||||||
(ido-ubiquitous-mode 1)
|
|
||||||
|
|
||||||
(global-set-key (kbd "M-x") 'smex)
|
|
||||||
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
;; magit requres this lib, but it is not installed automatically on
|
|
||||||
;; Windows.
|
|
||||||
(rc/require 'cl-lib)
|
|
||||||
(rc/require 'magit)
|
|
||||||
|
|
||||||
(setq magit-auto-revert-mode nil)
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-c m s") 'magit-status)
|
|
||||||
(global-set-key (kbd "C-c m l") 'magit-log)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(require 'ansi-color)
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-c p") 'find-file-at-point)
|
|
||||||
(global-set-key (kbd "C-c i m") 'imenu)
|
|
||||||
|
|
||||||
(setq-default inhibit-splash-screen t
|
|
||||||
make-backup-files nil
|
|
||||||
tab-width 4
|
|
||||||
indent-tabs-mode nil
|
|
||||||
compilation-scroll-output t
|
|
||||||
;; default-input-method "russian-computer"
|
|
||||||
visible-bell (equal system-type 'windows-nt))
|
|
||||||
|
|
||||||
(defun rc/colorize-compilation-buffer ()
|
|
||||||
(read-only-mode)
|
|
||||||
(ansi-color-apply-on-region compilation-filter-start (point))
|
|
||||||
(read-only-mode))
|
|
||||||
(add-hook 'compilation-filter-hook 'rc/colorize-compilation-buffer)
|
|
||||||
|
|
||||||
(defun rc/buffer-file-name ()
|
|
||||||
(if (equal major-mode 'dired-mode)
|
|
||||||
default-directory
|
|
||||||
(buffer-file-name)))
|
|
||||||
|
|
||||||
(defun rc/parent-directory (path)
|
|
||||||
(file-name-directory (directory-file-name path)))
|
|
||||||
|
|
||||||
(defun rc/root-anchor (path anchor)
|
|
||||||
(cond
|
|
||||||
((string= anchor "") nil)
|
|
||||||
((file-exists-p (concat (file-name-as-directory path) anchor)) path)
|
|
||||||
((string-equal path "/") nil)
|
|
||||||
(t (rc/root-anchor (rc/parent-directory path) anchor))))
|
|
||||||
|
|
||||||
(defun rc/clipboard-org-mode-file-link (anchor)
|
|
||||||
(interactive "sRoot anchor: ")
|
|
||||||
(let* ((root-dir (rc/root-anchor default-directory anchor))
|
|
||||||
(org-mode-file-link (format "file:%s::%d"
|
|
||||||
(if root-dir
|
|
||||||
(file-relative-name (rc/buffer-file-name) root-dir)
|
|
||||||
(rc/buffer-file-name))
|
|
||||||
(line-number-at-pos))))
|
|
||||||
(kill-new org-mode-file-link)
|
|
||||||
(message org-mode-file-link)))
|
|
||||||
|
|
||||||
;;; Taken from here:
|
|
||||||
;;; http://stackoverflow.com/questions/2416655/file-path-to-clipboard-in-emacs
|
|
||||||
(defun rc/put-file-name-on-clipboard ()
|
|
||||||
"Put the current file name on the clipboard"
|
|
||||||
(interactive)
|
|
||||||
(let ((filename (rc/buffer-file-name)))
|
|
||||||
(when filename
|
|
||||||
(kill-new filename)
|
|
||||||
(message filename))))
|
|
||||||
|
|
||||||
(defun rc/put-buffer-name-on-clipboard ()
|
|
||||||
"Put the current buffer name on the clipboard"
|
|
||||||
(interactive)
|
|
||||||
(kill-new (buffer-name))
|
|
||||||
(message (buffer-name)))
|
|
||||||
|
|
||||||
(defun rc/kill-autoloads-buffers ()
|
|
||||||
(interactive)
|
|
||||||
(dolist (buffer (buffer-list))
|
|
||||||
(let ((name (buffer-name buffer)))
|
|
||||||
(when (string-match-p "-autoloads.el" name)
|
|
||||||
(kill-buffer buffer)
|
|
||||||
(message "Killed autoloads buffer %s" name)))))
|
|
||||||
|
|
||||||
(defun rc/start-python-simple-http-server ()
|
|
||||||
(interactive)
|
|
||||||
(shell-command "python -m SimpleHTTPServer 3001 &"
|
|
||||||
"*Simple Python HTTP Server*"))
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-x p s") 'rc/start-python-simple-http-server)
|
|
||||||
|
|
||||||
;;; Taken from here:
|
|
||||||
;;; http://blog.bookworm.at/2007/03/pretty-print-xml-with-emacs.html
|
|
||||||
(defun bf-pretty-print-xml-region (begin end)
|
|
||||||
"Pretty format XML markup in region. You need to have nxml-mode
|
|
||||||
http://www.emacswiki.org/cgi-bin/wiki/NxmlMode installed to do
|
|
||||||
this. The function inserts linebreaks to separate tags that have
|
|
||||||
nothing but whitespace between them. It then indents the markup
|
|
||||||
by using nxml's indentation rules."
|
|
||||||
(interactive "r")
|
|
||||||
(save-excursion
|
|
||||||
(nxml-mode)
|
|
||||||
(goto-char begin)
|
|
||||||
(while (search-forward-regexp "\>[ \\t]*\<" nil t)
|
|
||||||
(backward-char) (insert "\n"))
|
|
||||||
(indent-region begin end))
|
|
||||||
(message "Ah, much better!"))
|
|
||||||
|
|
||||||
;;; Stolen from http://ergoemacs.org/emacs/emacs_unfill-paragraph.html
|
|
||||||
(defun rc/unfill-paragraph ()
|
|
||||||
"Replace newline chars in current paragraph by single spaces.
|
|
||||||
This command does the inverse of `fill-paragraph'."
|
|
||||||
(interactive)
|
|
||||||
(let ((fill-column 90002000)) ; 90002000 is just random. you can use `most-positive-fixnum'
|
|
||||||
(fill-paragraph nil)))
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-c M-q") 'rc/unfill-paragraph)
|
|
||||||
|
|
||||||
(defun rc/load-path-here ()
|
|
||||||
(interactive)
|
|
||||||
(add-to-list 'load-path default-directory))
|
|
||||||
|
|
||||||
(defconst rc/frame-transparency 85)
|
|
||||||
|
|
||||||
(defun rc/toggle-transparency ()
|
|
||||||
(interactive)
|
|
||||||
(let ((frame-alpha (frame-parameter nil 'alpha)))
|
|
||||||
(if (or (not frame-alpha)
|
|
||||||
(= (cadr frame-alpha) 100))
|
|
||||||
(set-frame-parameter nil 'alpha
|
|
||||||
`(,rc/frame-transparency
|
|
||||||
,rc/frame-transparency))
|
|
||||||
(set-frame-parameter nil 'alpha '(100 100)))))
|
|
||||||
|
|
||||||
(defun rc/duplicate-line ()
|
|
||||||
"Duplicate current line"
|
|
||||||
(interactive)
|
|
||||||
(move-beginning-of-line 1)
|
|
||||||
(kill-line)
|
|
||||||
(yank)
|
|
||||||
(newline)
|
|
||||||
(yank))
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-,") 'rc/duplicate-line)
|
|
||||||
|
|
||||||
;;; A little hack which fixes a problem with meta key in fluxbox under VNC.
|
|
||||||
(setq x-alt-keysym 'meta)
|
|
||||||
|
|
||||||
(setq confirm-kill-emacs 'y-or-n-p)
|
|
||||||
;; Changes all yes/no questions to y/n type
|
|
||||||
(fset 'yes-or-no-p 'y-or-n-p)
|
|
||||||
|
|
||||||
;; shell scripts
|
|
||||||
(setq-default sh-basic-offset 2)
|
|
||||||
(setq-default sh-indentation 2)
|
|
||||||
|
|
||||||
;; No need for ~ files when editing
|
|
||||||
(setq create-lockfiles nil)
|
|
||||||
|
|
||||||
;; Go straight to scratch buffer on startup
|
|
||||||
(setq inhibit-startup-message t)
|
|
||||||
|
|
||||||
(add-hook 'emacs-startup-hook
|
|
||||||
(lambda ()
|
|
||||||
(message "Emacs ready in %s with %d garbage collections."
|
|
||||||
(format "%.2f seconds"
|
|
||||||
(float-time (time-subtract after-init-time before-init-time)))
|
|
||||||
gcs-done)))
|
|
||||||
|
|
||||||
|
|
||||||
(server-start)
|
|
||||||
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'move-text)
|
|
||||||
(global-set-key (kbd "M-p") 'move-text-up)
|
|
||||||
(global-set-key (kbd "M-n") 'move-text-down)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'multiple-cursors)
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
|
|
||||||
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
|
|
||||||
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
|
|
||||||
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
|
|
||||||
(global-set-key (kbd "C-\"") 'mc/skip-to-next-like-this)
|
|
||||||
(global-set-key (kbd "C-:") 'mc/skip-to-previous-like-this)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'nasm-mode)
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.asm\\'" . nasm-mode))
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.html\\'" . nxml-mode))
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.xsd\\'" . nxml-mode))
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.ant\\'" . nxml-mode))
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'openwith)
|
|
||||||
|
|
||||||
(openwith-mode 1)
|
|
||||||
|
|
||||||
|
|
||||||
(setq openwith-associations
|
|
||||||
(append
|
|
||||||
(when (eq system-type 'gnu/linux)
|
|
||||||
'(("\\.pdf\\'" "evince" (file))
|
|
||||||
("\\.djvu\\'" "evince" (file))))
|
|
||||||
'(("\\.docx\\'" "libreoffice" (file))
|
|
||||||
("\\.xlsx\\'" "libreoffice" (file))
|
|
||||||
("\\.doc\\'" "libreoffice" (file))
|
|
||||||
("\\.rtf\\'" "libreoffice" (file))
|
|
||||||
("\\.ods\\'" "libreoffice" (file))
|
|
||||||
("\\.mp3\\'" "vlc" (file)))))
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(require 'ob-python)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(setq org-capture-templates
|
|
||||||
'(("p" "Capture task" entry (file "~/Documents/Agenda/Tasks.org")
|
|
||||||
"* TODO %?\n SCHEDULED: %t\n")
|
|
||||||
("K" "Cliplink capture task" entry (file "~/Documents/Agenda/Tasks.org")
|
|
||||||
"* TODO %(org-cliplink-capture) \n SCHEDULED: %t\n" :empty-lines 1)))
|
|
||||||
(define-key global-map "\C-cc" 'org-capture)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'org-cliplink)
|
|
||||||
|
|
||||||
(when (eq system-type 'gnu/linux)
|
|
||||||
(custom-set-variables
|
|
||||||
'(org-cliplink-transport-implementation (quote url-el))))
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-x p i") 'org-cliplink)
|
|
||||||
|
|
||||||
(defun rc/cliplink-task ()
|
|
||||||
(interactive)
|
|
||||||
(org-cliplink-retrieve-title
|
|
||||||
(substring-no-properties (current-kill 0))
|
|
||||||
'(lambda (url title)
|
|
||||||
(insert (if title
|
|
||||||
(concat "* TODO " title
|
|
||||||
"\n [[" url "][" title "]]")
|
|
||||||
(concat "* TODO " url
|
|
||||||
"\n [[" url "]]"))))))
|
|
||||||
(global-set-key (kbd "C-x p t") 'rc/cliplink-task)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-x a") 'org-agenda)
|
|
||||||
(global-set-key (kbd "C-c C-x j") #'org-clock-jump-to-current-clock)
|
|
||||||
|
|
||||||
(setq org-agenda-files (list "~/Documents/Agenda/"))
|
|
||||||
|
|
||||||
(setq org-export-backends '(md))
|
|
||||||
|
|
||||||
(custom-set-variables
|
|
||||||
'(org-modules
|
|
||||||
(quote
|
|
||||||
(org-bbdb
|
|
||||||
org-bibtex
|
|
||||||
org-docview
|
|
||||||
org-gnus
|
|
||||||
org-habit
|
|
||||||
org-info
|
|
||||||
org-irc
|
|
||||||
org-mhe
|
|
||||||
org-rmail
|
|
||||||
org-w3m)))
|
|
||||||
'(org-enforce-todo-dependencies nil)
|
|
||||||
'(org-agenda-dim-blocked-tasks nil)
|
|
||||||
'(org-agenda-exporter-settings
|
|
||||||
(quote ((org-agenda-tag-filter-preset (list "+personal")))))
|
|
||||||
'(org-refile-use-outline-path (quote file)))
|
|
||||||
|
|
||||||
(defun rc/org-increment-move-counter ()
|
|
||||||
(interactive)
|
|
||||||
|
|
||||||
(defun default (x d)
|
|
||||||
(if x x d))
|
|
||||||
|
|
||||||
(let* ((point (point))
|
|
||||||
(move-counter-name "MOVE_COUNTER")
|
|
||||||
(move-counter-value (-> (org-entry-get point move-counter-name)
|
|
||||||
(default "0")
|
|
||||||
(string-to-number)
|
|
||||||
(1+))))
|
|
||||||
(org-entry-put point move-counter-name
|
|
||||||
(number-to-string move-counter-value)))
|
|
||||||
nil)
|
|
||||||
|
|
||||||
(defun rc/org-get-heading-name ()
|
|
||||||
(nth 4 (org-heading-components)))
|
|
||||||
|
|
||||||
(defun rc/org-kill-heading-name-save ()
|
|
||||||
(interactive)
|
|
||||||
(let ((heading-name (rc/org-get-heading-name)))
|
|
||||||
(kill-new heading-name)
|
|
||||||
(message "Kill \"%s\"" heading-name)))
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-x p w") 'rc/org-kill-heading-name-save)
|
|
||||||
|
|
||||||
(setq org-agenda-custom-commands
|
|
||||||
'(("u" "Unscheduled" tags "+personal-SCHEDULED={.+}-DEADLINE={.+}/!+TODO"
|
|
||||||
((org-agenda-sorting-strategy '(priority-down))))
|
|
||||||
("p" "Personal" ((agenda "" ((org-agenda-tag-filter-preset (list "+personal"))))))
|
|
||||||
("w" "Work" ((agenda "" ((org-agenda-tag-filter-preset (list "+work"))))))
|
|
||||||
))
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'paredit)
|
|
||||||
|
|
||||||
(defun rc/turn-on-paredit ()
|
|
||||||
(interactive)
|
|
||||||
(paredit-mode 1))
|
|
||||||
|
|
||||||
(add-hook 'emacs-lisp-mode-hook 'rc/turn-on-paredit)
|
|
||||||
(add-hook 'clojure-mode-hook 'rc/turn-on-paredit)
|
|
||||||
(add-hook 'lisp-mode-hook 'rc/turn-on-paredit)
|
|
||||||
(add-hook 'common-lisp-mode-hook 'rc/turn-on-paredit)
|
|
||||||
(add-hook 'scheme-mode-hook 'rc/turn-on-paredit)
|
|
||||||
(add-hook 'racket-mode-hook 'rc/turn-on-paredit)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'rainbow-mode)
|
|
||||||
|
|
||||||
(defun rc/turn-on-rainbow-mode ()
|
|
||||||
(interactive)
|
|
||||||
(rainbow-mode 1))
|
|
||||||
|
|
||||||
(add-hook 'html-mode-hook 'rc/turn-on-rainbow-mode)
|
|
||||||
(add-hook 'css-mode-hook 'rc/turn-on-rainbow-mode)
|
|
||||||
(add-hook 'js-mode-hook 'rc/turn-on-rainbow-mode)
|
|
||||||
(add-hook 'nxml-mode-hook 'rc/turn-on-rainbow-mode)
|
|
||||||
(add-hook 'conf-xdefaults-mode-hook 'rc/turn-on-rainbow-mode)
|
|
||||||
(add-hook 'typescript-mode-hook 'rc/turn-on-rainbow-mode)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(require 'recentf)
|
|
||||||
(recentf-mode 1)
|
|
||||||
(setq recentf-max-menu-items 25)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
;; Sets up exec-path-from shell
|
|
||||||
;; https://github.com/purcell/exec-path-from-
|
|
||||||
(require 'exec-path-from-shell)
|
|
||||||
(when (memq window-system '(mac ns))
|
|
||||||
(exec-path-from-shell-initialize)
|
|
||||||
(exec-path-from-shell-copy-envs
|
|
||||||
'("PATH")))
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
;;; http://stackoverflow.com/questions/13794433/how-to-disable-autosave-for-tramp-buffers-in-emacs
|
|
||||||
(setq tramp-auto-save-directory "/tmp")
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(defun rc/enable-word-wrap ()
|
|
||||||
(interactive)
|
|
||||||
(toggle-word-wrap 1))
|
|
||||||
|
|
||||||
(add-hook 'markdown-mode-hook 'rc/enable-word-wrap)
|
|
||||||
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
|
|
||||||
(rc/require 'yasnippet)
|
|
||||||
|
|
||||||
(require 'yasnippet)
|
|
||||||
|
|
||||||
(setq yas/triggers-in-field nil)
|
|
||||||
(setq yas-snippet-dirs '("~/.emacs.snippets/"))
|
|
||||||
|
|
||||||
(yas-global-mode 1)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# This is `bat`s configuration file. Each line either contains a comment or
|
|
||||||
# a command-line option that you want to pass to `bat` by default. You can
|
|
||||||
# run `bat --help` to get a list of all possible configuration options.
|
|
||||||
|
|
||||||
# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
|
|
||||||
# for a list of all available themes
|
|
||||||
--theme="1337"
|
|
||||||
|
|
||||||
# Enable this to use italic text on the terminal. This is not supported on all
|
|
||||||
# terminal emulators (like tmux, by default):
|
|
||||||
#--italic-text=always
|
|
||||||
|
|
||||||
# Uncomment the following line to disable automatic paging:
|
|
||||||
#--paging=never
|
|
||||||
|
|
||||||
# Uncomment the following line if you are using less version >= 551 and want to
|
|
||||||
# enable mouse scrolling support in `bat` when running inside tmux. This might
|
|
||||||
# disable text selection, unless you press shift.
|
|
||||||
#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"
|
|
||||||
|
|
||||||
# Syntax mappings: map a certain filename pattern to a language.
|
|
||||||
# Example 1: use the C++ syntax for Arduino .ino files
|
|
||||||
# Example 2: Use ".gitignore"-style highlighting for ".ignore" files
|
|
||||||
#--map-syntax "*.ino:C++"
|
|
||||||
#--map-syntax ".ignore:Git Ignore"
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
|
# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
|
||||||
# for a list of all available themes
|
# for a list of all available themes
|
||||||
--theme="Dracula"
|
--theme="1337"
|
||||||
|
|
||||||
# Enable this to use italic text on the terminal. This is not supported on all
|
# Enable this to use italic text on the terminal. This is not supported on all
|
||||||
# terminal emulators (like tmux, by default):
|
# terminal emulators (like tmux, by default):
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
"keyColor": "blue"
|
"keyColor": "blue"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "wmtheme",
|
"type": "theme",
|
||||||
"key": "│ ├",
|
"key": "│ ├",
|
||||||
"keyColor": "blue"
|
"keyColor": "blue"
|
||||||
},
|
},
|
||||||
@@ -114,11 +114,11 @@
|
|||||||
"key": "│ ├",
|
"key": "│ ├",
|
||||||
"keyColor": "green"
|
"keyColor": "green"
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
"type": "display",
|
// "type": "disk",
|
||||||
"key": "│ └",
|
// "key": "│ └",
|
||||||
"keyColor": "green"
|
// "keyColor": "green"
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
"type": "sound",
|
"type": "sound",
|
||||||
"key": " AUDIO",
|
"key": " AUDIO",
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
|
||||||
"logo": {
|
|
||||||
"padding": {
|
|
||||||
"top": 2
|
|
||||||
},
|
|
||||||
"type": "small"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"separator": " -> "
|
|
||||||
},
|
|
||||||
"modules": [
|
|
||||||
"break",
|
|
||||||
{
|
|
||||||
"type": "title",
|
|
||||||
"keyWidth": 10,
|
|
||||||
"format": " {6}{7}{8}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "custom",
|
|
||||||
"format": " ╭───────────────────────╮"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "kernel",
|
|
||||||
"key": " ",
|
|
||||||
"keyColor": "yellow"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "wm",
|
|
||||||
"key": " ",
|
|
||||||
"keyColor": "blue"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "shell",
|
|
||||||
"key": " ",
|
|
||||||
"keyColor": "yellow"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "terminal",
|
|
||||||
"key": " ",
|
|
||||||
"keyColor": "blue"
|
|
||||||
},
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
"type": "packages",
|
|
||||||
"key": " ",
|
|
||||||
"keyColor": "yellow"
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
"type": "memory",
|
|
||||||
"key": " ",
|
|
||||||
"keyColor": "magenta",
|
|
||||||
// format: used / total
|
|
||||||
"format": "{1} / {2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "uptime",
|
|
||||||
"key": " ",
|
|
||||||
"keyColor": "green"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "custom",
|
|
||||||
"format": " ╰───────────────────────╯"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "custom",
|
|
||||||
"format": " \u001b[31m \u001b[32m \u001b[33m \u001b[34m \u001b[35m \u001b[36m \u001b[37m \u001b[90m "
|
|
||||||
},
|
|
||||||
"break",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
// Load with --load-config examples/2.jsonc
|
|
||||||
// Note that you must replace the image path to an existing image to display it.
|
|
||||||
|
|
||||||
{
|
|
||||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
|
||||||
"logo": {
|
|
||||||
"padding": {
|
|
||||||
"top": 2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"separator": " "
|
|
||||||
},
|
|
||||||
"modules": [
|
|
||||||
{
|
|
||||||
"type": "custom",
|
|
||||||
"format": "\u001b[90m┌────────────────────────────────────────────────────────────┐"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "title",
|
|
||||||
"keyWidth": 10,
|
|
||||||
"format": " {6}{7}{8}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "custom",
|
|
||||||
"format": "\u001b[90m└────────────────────────────────────────────────────────────┘"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "custom",
|
|
||||||
"format": "\u001b[90m \u001b[31m \u001b[32m \u001b[33m \u001b[34m \u001b[35m \u001b[36m \u001b[37m \u001b[38m \u001b[39m \u001b[38m \u001b[37m \u001b[36m \u001b[35m \u001b[34m \u001b[33m \u001b[32m \u001b[31m \u001b[90m "
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "custom",
|
|
||||||
"format": "\u001b[90m┌────────────────────────────────────────────────────────────┐"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "os",
|
|
||||||
"key": " DISTRO",
|
|
||||||
"keyColor": "yellow"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "kernel",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "yellow"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "packages",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "yellow"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "shell",
|
|
||||||
"key": "│ └",
|
|
||||||
"keyColor": "yellow"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "wm",
|
|
||||||
"key": " DE/WM",
|
|
||||||
"keyColor": "blue"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "theme",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "blue"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "icons",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "blue"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "terminal",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "blue"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "wallpaper",
|
|
||||||
"key": "│ └",
|
|
||||||
"keyColor": "blue"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "host",
|
|
||||||
"key": " SYSTEM",
|
|
||||||
"keyColor": "green"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "cpu",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "green"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "gpu",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "green"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "display",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "green",
|
|
||||||
"compactType": "original-with-refresh-rate"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "memory",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "green"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "swap",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "green"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "uptime",
|
|
||||||
"key": "│ ├",
|
|
||||||
"keyColor": "green"
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// "type": "disk",
|
|
||||||
// "key": "│ └",
|
|
||||||
// "keyColor": "green"
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
"type": "sound",
|
|
||||||
"key": " AUDIO",
|
|
||||||
"keyColor": "cyan"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "custom",
|
|
||||||
"format": "\u001b[90m└────────────────────────────────────────────────────────────┘"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "custom",
|
|
||||||
"format": "\u001b[90m \u001b[31m \u001b[32m \u001b[33m \u001b[34m \u001b[35m \u001b[36m \u001b[37m \u001b[38m \u001b[39m \u001b[38m \u001b[37m \u001b[36m \u001b[35m \u001b[34m \u001b[33m \u001b[32m \u001b[31m \u001b[90m "
|
|
||||||
},
|
|
||||||
"break",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
0
fish/completions/fisher.fish
Executable file → Normal file
0
fish/completions/fisher.fish
Executable file → Normal file
0
fish/completions/fzf_configure_bindings.fish
Executable file → Normal file
0
fish/completions/fzf_configure_bindings.fish
Executable file → Normal file
0
fish/completions/sdk.fish
Executable file → Normal file
0
fish/completions/sdk.fish
Executable file → Normal file
0
fish/conf.d/fzf.fish
Executable file → Normal file
0
fish/conf.d/fzf.fish
Executable file → Normal file
@@ -1 +1 @@
|
|||||||
#source "$HOME/.cargo/env.fish"
|
source "$HOME/.cargo/env.fish"
|
||||||
|
|||||||
0
fish/conf.d/sdk.fish
Executable file → Normal file
0
fish/conf.d/sdk.fish
Executable file → Normal file
@@ -4,6 +4,7 @@ set fish_greeting
|
|||||||
set VIRTUAL_ENV_DISABLE_PROMPT "1"
|
set VIRTUAL_ENV_DISABLE_PROMPT "1"
|
||||||
set -xU MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
set -xU MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
||||||
set -xU MANROFFOPT "-c"
|
set -xU MANROFFOPT "-c"
|
||||||
|
set -xU EDITOR /usr/bin/nvim
|
||||||
set -x SHELL /usr/bin/fish
|
set -x SHELL /usr/bin/fish
|
||||||
|
|
||||||
## Export variable need for qt-theme
|
## Export variable need for qt-theme
|
||||||
@@ -31,7 +32,8 @@ end
|
|||||||
|
|
||||||
## Starship prompt
|
## Starship prompt
|
||||||
if status --is-interactive
|
if status --is-interactive
|
||||||
source ("/usr/bin/starship" init fish --print-full-init | psub)
|
set -l starship_path (which starship)
|
||||||
|
source ("$starship_path" init fish --print-full-init | psub)
|
||||||
end
|
end
|
||||||
|
|
||||||
## Advanced command-not-found hook
|
## Advanced command-not-found hook
|
||||||
@@ -97,8 +99,8 @@ function copy
|
|||||||
end
|
end
|
||||||
|
|
||||||
function fish_greeting
|
function fish_greeting
|
||||||
echo -e "\n"
|
# echo -e "\n"
|
||||||
fastfetch
|
# fastfetch
|
||||||
end
|
end
|
||||||
|
|
||||||
## Useful aliases
|
## Useful aliases
|
||||||
@@ -113,13 +115,15 @@ alias l. 'eza -ald --color=always --group-directories-first --icons .*' # show o
|
|||||||
# Replace some more things with better alternatives
|
# Replace some more things with better alternatives
|
||||||
alias cat 'bat --style header --style snip --style changes --style header'
|
alias cat 'bat --style header --style snip --style changes --style header'
|
||||||
|
|
||||||
|
# Replace df command tool
|
||||||
|
alias df='duf'
|
||||||
|
|
||||||
# Common use
|
# Common use
|
||||||
alias .. 'cd ..'
|
alias .. 'cd ..'
|
||||||
alias ... 'cd ../..'
|
alias ... 'cd ../..'
|
||||||
alias .... 'cd ../../..'
|
alias .... 'cd ../../..'
|
||||||
alias ..... 'cd ../../../..'
|
alias ..... 'cd ../../../..'
|
||||||
alias ...... 'cd ../../../../..'
|
alias ...... 'cd ../../../../..'
|
||||||
alias big 'expac -H M "%m\t%n" | sort -h | nl' # Sort installed packages according to size in MB (expac must be installed)
|
|
||||||
alias dir 'dir --color=auto'
|
alias dir 'dir --color=auto'
|
||||||
alias grep 'ugrep --color=auto'
|
alias grep 'ugrep --color=auto'
|
||||||
alias egrep 'ugrep -E --color=auto'
|
alias egrep 'ugrep -E --color=auto'
|
||||||
@@ -133,10 +137,15 @@ alias tarnow 'tar -acf '
|
|||||||
alias untar 'tar -zxvf '
|
alias untar 'tar -zxvf '
|
||||||
alias vdir 'vdir --color=auto'
|
alias vdir 'vdir --color=auto'
|
||||||
alias wget 'wget -c '
|
alias wget 'wget -c '
|
||||||
|
alias rost 'rpm-ostree'
|
||||||
alias vi 'nvim'
|
alias vi 'nvim'
|
||||||
|
|
||||||
# Get the error messages from journalctl
|
# Get the error messages from journalctl
|
||||||
alias jctl 'journalctl -p 3 -xb'
|
alias jctl 'journalctl -p 3 -xb'
|
||||||
|
|
||||||
# Recent installed packages
|
# Aliases run commands inner Archlinux Toolbox container
|
||||||
alias rip 'expac --timefmt="%Y-%m-%d %T" "%l\t%n %v" | sort | tail -200 | nl'
|
alias exercism 'toolbox run -c arch-toolbox-latest exercism'
|
||||||
|
alias k9s 'toolbox run -c arch-toolbox-latest k9s'
|
||||||
|
alias kubectl 'toolbox run -c arch-toolbox-latest kubectl'
|
||||||
|
alias lazydocker 'toolbox run -c arch-toolbox-latest lazydocker'
|
||||||
|
alias lazygit 'toolbox run -c arch-toolbox-latest lazygit'
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
# Configure
|
|
||||||
complete -f -c exercism -n "__fish_use_subcommand" -a "configure" -d "Writes config values to a JSON file."
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from configure" -s t -l token -d "Set token"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from configure" -s w -l workspace -d "Set workspace"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from configure" -s a -l api -d "set API base url"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from configure" -s s -l show -d "show settings"
|
|
||||||
|
|
||||||
# Download
|
|
||||||
complete -f -c exercism -n "__fish_use_subcommand" -a "download" -d "Downloads and saves a specified submission into the local system"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from download" -s e -l exercise -d "the exercise slug"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from download" -s h -l help -d "help for download"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from download" -s T -l team -d "the team slug"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from download" -s t -l track -d "the track ID"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from download" -s u -l uuid -d "the solution UUID"
|
|
||||||
|
|
||||||
# Help
|
|
||||||
complete -f -c exercism -n "__fish_use_subcommand" -a "help" -d "Shows a list of commands or help for one command"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from help" -a "configure download help open submit troubleshoot upgrade version workspace"
|
|
||||||
|
|
||||||
# Open
|
|
||||||
complete -f -c exercism -n "__fish_use_subcommand" -a "open" -d "Opens a browser to exercism.io for the specified submission."
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from open" -s h -l help -d "help for open"
|
|
||||||
|
|
||||||
# Submit
|
|
||||||
complete -f -c exercism -n "__fish_use_subcommand" -a "submit" -d "Submits a new iteration to a problem on exercism.io."
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from submit" -s h -l help -d "help for submit"
|
|
||||||
|
|
||||||
# Troubleshoot
|
|
||||||
complete -f -c exercism -n "__fish_use_subcommand" -a "troubleshoot" -d "Outputs useful debug information."
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from troubleshoot" -s f -l full-api-key -d "display full API key (censored by default)"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from troubleshoot" -s h -l help -d "help for troubleshoot"
|
|
||||||
|
|
||||||
# Upgrade
|
|
||||||
complete -f -c exercism -n "__fish_use_subcommand" -a "upgrade" -d "Upgrades to the latest available version."
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from help" -s h -l help -d "help for help"
|
|
||||||
|
|
||||||
# Version
|
|
||||||
complete -f -c exercism -n "__fish_use_subcommand" -a "version" -d "Outputs version information."
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from version" -s l -l latest -d "check latest available version"
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from version" -s h -l help -d "help for version"
|
|
||||||
|
|
||||||
# Workspace
|
|
||||||
complete -f -c exercism -n "__fish_use_subcommand" -a "workspace" -d "Outputs the root directory for Exercism exercises."
|
|
||||||
complete -f -c exercism -n "__fish_seen_subcommand_from workspace" -s h -l help -d "help for workspace"
|
|
||||||
|
|
||||||
# Options
|
|
||||||
complete -f -c exercism -s h -l help -d "show help"
|
|
||||||
complete -f -c exercism -l timeout -a "10" -d "10 seconds"
|
|
||||||
complete -f -c exercism -l timeout -a "30" -d "30 seconds"
|
|
||||||
complete -f -c exercism -l timeout -a "60" -d "1 minute"
|
|
||||||
complete -f -c exercism -l timeout -a "300" -d "5 minutes"
|
|
||||||
complete -f -c exercism -l timeout -a "600" -d "10 minutes"
|
|
||||||
complete -f -c exercism -l timeout -a "" -d "override default HTTP timeout"
|
|
||||||
complete -f -c exercism -s v -l verbose -d "turn on verbose logging"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
complete --command fisher --exclusive --long help --description "Print help"
|
|
||||||
complete --command fisher --exclusive --long version --description "Print version"
|
|
||||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins"
|
|
||||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins"
|
|
||||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins"
|
|
||||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex"
|
|
||||||
complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)"
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
complete fzf_configure_bindings --no-files
|
|
||||||
complete fzf_configure_bindings --long help --short h --description "Print help" --condition "not __fish_seen_argument --help -h"
|
|
||||||
complete fzf_configure_bindings --long directory --description "Change the key binding for Search Directory" --condition "not __fish_seen_argument --directory"
|
|
||||||
complete fzf_configure_bindings --long git_log --description "Change the key binding for Search Git Log" --condition "not __fish_seen_argument --git_log"
|
|
||||||
complete fzf_configure_bindings --long git_status --description "Change the key binding for Search Git Status" --condition "not __fish_seen_argument --git_status"
|
|
||||||
complete fzf_configure_bindings --long history --description "Change the key binding for Search History" --condition "not __fish_seen_argument --history"
|
|
||||||
complete fzf_configure_bindings --long processes --description "Change the key binding for Search Processes" --condition "not __fish_seen_argument --processes"
|
|
||||||
complete fzf_configure_bindings --long variables --description "Change the key binding for Search Variables" --condition "not __fish_seen_argument --variables"
|
|
||||||
@@ -1,243 +0,0 @@
|
|||||||
# Defines autocompletion for SDKMAN!
|
|
||||||
|
|
||||||
# Copyright (c) 2018-2023 Raphael Reitzig
|
|
||||||
# MIT License (MIT)
|
|
||||||
# https://github.com/reitzig/sdkman-for-fish
|
|
||||||
|
|
||||||
# Guard: SDKMAN! needs to be installed
|
|
||||||
if not test -f "$SDKMAN_DIR/bin/sdkman-init.sh"
|
|
||||||
exit 0
|
|
||||||
end
|
|
||||||
|
|
||||||
# # # # # #
|
|
||||||
# Completion trigger predicates
|
|
||||||
# # # # # #
|
|
||||||
|
|
||||||
# Test if there is no command
|
|
||||||
function __fish_sdkman_no_command
|
|
||||||
set cmd (commandline -opc)
|
|
||||||
|
|
||||||
if [ (count $cmd) -eq 1 ]
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
# Test if the main command matches one of the parameters
|
|
||||||
function __fish_sdkman_using_command
|
|
||||||
set cmd (commandline -opc)
|
|
||||||
|
|
||||||
if [ (count $cmd) -eq 2 ]
|
|
||||||
if contains $cmd[2] $argv
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_sdkman_specifying_candidate
|
|
||||||
set cmd (commandline -opc)
|
|
||||||
|
|
||||||
if [ (count $cmd) -eq 3 ] # currently, sdk does not support multiple versions
|
|
||||||
if contains $cmd[2] $argv
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_sdkman_command_has_enough_parameters
|
|
||||||
set cmd (commandline -opc)
|
|
||||||
|
|
||||||
if [ (count $cmd) -ge (math $argv[1] + 2) ]; and contains $cmd[2] $argv[2..-1]
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
# # # # # #
|
|
||||||
# Data collectors
|
|
||||||
# # # # # #
|
|
||||||
|
|
||||||
function __fish_sdkman_candidates
|
|
||||||
cat "$SDKMAN_DIR"/var/candidates | string replace -a -r ',' '\n'
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_sdkman_candidates_with_versions
|
|
||||||
set regexpHome (string replace -a '/' '\\/' "$HOME/")
|
|
||||||
|
|
||||||
find "$SDKMAN_DIR"/candidates/ -mindepth 2 -maxdepth 2 -name '*current' \
|
|
||||||
| awk -F '/' '{ print $(NF-1) }' \
|
|
||||||
| sort -u
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_sdkman_installed_versions
|
|
||||||
set cmd (commandline -opc)
|
|
||||||
if [ -d "$SDKMAN_DIR"/candidates/$cmd[3]/current ]
|
|
||||||
ls -v1 "$SDKMAN_DIR"/candidates/$cmd[3] | grep -v current
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# # # # # #
|
|
||||||
# Completion specification
|
|
||||||
# # # # # #
|
|
||||||
|
|
||||||
# install
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'i install' \
|
|
||||||
-d 'Install new version'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command i install' \
|
|
||||||
-a "(__fish_sdkman_candidates)"
|
|
||||||
# TODO complete available versions --> issue #4
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_specifying_candidate i install' \
|
|
||||||
-a 'a.b.c' \
|
|
||||||
-d "version list unavailable"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_specifying_candidate i install' \
|
|
||||||
-a 'x.y.z' \
|
|
||||||
-d "Specify path to install custom version."
|
|
||||||
# Implicit: complete files as fourth parameter
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 3 i install'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# uninstall
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'rm uninstall' -d 'Uninstall version'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command rm uninstall' \
|
|
||||||
-a "(__fish_sdkman_candidates_with_versions)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_specifying_candidate rm uninstall' \
|
|
||||||
-a "(__fish_sdkman_installed_versions)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 rm uninstall'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# list
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'ls list' \
|
|
||||||
-d 'List versions'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command ls list' \
|
|
||||||
-a "(__fish_sdkman_candidates)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 ls list'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# use
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'u use' \
|
|
||||||
-d 'Use specific version'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command u use' \
|
|
||||||
-a "(__fish_sdkman_candidates_with_versions)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_specifying_candidate u use' \
|
|
||||||
-a "(__fish_sdkman_installed_versions)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 u use'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# default
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'd default' \
|
|
||||||
-d 'Set default version'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command d default' \
|
|
||||||
-a "(__fish_sdkman_candidates_with_versions)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_specifying_candidate d default' \
|
|
||||||
-a "(__fish_sdkman_installed_versions)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 d default'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# current
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'c current' \
|
|
||||||
-d 'Display current version'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command c current' \
|
|
||||||
-a "(__fish_sdkman_candidates)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 c current'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# upgrade
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'ug upgrade' \
|
|
||||||
-d 'Display what is outdated'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command ug upgrade' \
|
|
||||||
-a "(__fish_sdkman_candidates_with_versions)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 ug upgrade'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# version
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'v version' \
|
|
||||||
-d 'Display version'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 v version'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# help
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'help' \
|
|
||||||
-d 'Display help message'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 h help'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# offline
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'offline' \
|
|
||||||
-d 'Set offline status'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command offline' \
|
|
||||||
-a 'enable' \
|
|
||||||
-d 'Make sdk work while offline'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command offline' \
|
|
||||||
-a 'disable' \
|
|
||||||
-d 'Turn on all features'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 offline'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# selfupdate
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'selfupdate' \
|
|
||||||
-d 'Update sdk'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command selfupdate' \
|
|
||||||
-a 'force' \
|
|
||||||
-d 'Force re-install of current version'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 selfupdate'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# update
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'update' \
|
|
||||||
-d 'Reload the candidate list'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 update'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# flush
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'flush' \
|
|
||||||
-d 'Clear out archives and temporary storage folders'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
|
|
||||||
-a 'temp' \
|
|
||||||
-d 'Clear out staging work folder'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
|
|
||||||
-a 'version' \
|
|
||||||
-d 'Flush version file'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 flush'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# env
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'e env' \
|
|
||||||
-d 'Load environment from .sdkmanrc file'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
|
|
||||||
-a 'init' \
|
|
||||||
-d 'Initialize .sdkmanrc file'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
|
|
||||||
-a 'install' \
|
|
||||||
-d 'Install all candidate versions listed in .sdkmanrc'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
|
|
||||||
-a 'clear' \
|
|
||||||
-d 'Unload currently loaded environment'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 e env'
|
|
||||||
# block
|
|
||||||
|
|
||||||
# home
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
|
||||||
-a 'h home' \
|
|
||||||
-d 'Show installation folder of given candidate'
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_using_command h home' \
|
|
||||||
-a "(__fish_sdkman_candidates_with_versions)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_specifying_candidate h home' \
|
|
||||||
-a "(__fish_sdkman_installed_versions)"
|
|
||||||
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 h home'
|
|
||||||
# block
|
|
||||||
@@ -1,335 +0,0 @@
|
|||||||
# MIT License
|
|
||||||
|
|
||||||
# Copyright (c) 2016 Francisco Lourenço & Daniel Wehner
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
if not status is-interactive
|
|
||||||
exit
|
|
||||||
end
|
|
||||||
|
|
||||||
set -g __done_version 1.19.2
|
|
||||||
|
|
||||||
function __done_run_powershell_script
|
|
||||||
set -l powershell_exe (command --search "powershell.exe")
|
|
||||||
|
|
||||||
if test $status -ne 0
|
|
||||||
and command --search wslvar
|
|
||||||
|
|
||||||
set -l powershell_exe (wslpath (wslvar windir)/System32/WindowsPowerShell/v1.0/powershell.exe)
|
|
||||||
end
|
|
||||||
|
|
||||||
if string length --quiet "$powershell_exe"
|
|
||||||
and test -x "$powershell_exe"
|
|
||||||
|
|
||||||
set cmd (string escape $argv)
|
|
||||||
|
|
||||||
eval "$powershell_exe -Command $cmd"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function __done_windows_notification -a title -a message
|
|
||||||
if test "$__done_notify_sound" -eq 1
|
|
||||||
set soundopt "<audio silent=\"false\" src=\"ms-winsoundevent:Notification.Default\" />"
|
|
||||||
else
|
|
||||||
set soundopt "<audio silent=\"true\" />"
|
|
||||||
end
|
|
||||||
|
|
||||||
__done_run_powershell_script "
|
|
||||||
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
|
|
||||||
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
|
|
||||||
|
|
||||||
\$toast_xml_source = @\"
|
|
||||||
<toast>
|
|
||||||
$soundopt
|
|
||||||
<visual>
|
|
||||||
<binding template=\"ToastText02\">
|
|
||||||
<text id=\"1\">$title</text>
|
|
||||||
<text id=\"2\">$message</text>
|
|
||||||
</binding>
|
|
||||||
</visual>
|
|
||||||
</toast>
|
|
||||||
\"@
|
|
||||||
|
|
||||||
\$toast_xml = New-Object Windows.Data.Xml.Dom.XmlDocument
|
|
||||||
\$toast_xml.loadXml(\$toast_xml_source)
|
|
||||||
|
|
||||||
\$toast = New-Object Windows.UI.Notifications.ToastNotification \$toast_xml
|
|
||||||
|
|
||||||
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier(\"fish\").Show(\$toast)
|
|
||||||
"
|
|
||||||
end
|
|
||||||
|
|
||||||
function __done_get_focused_window_id
|
|
||||||
if type -q lsappinfo
|
|
||||||
lsappinfo info -only bundleID (lsappinfo front | string replace 'ASN:0x0-' '0x') | cut -d '"' -f4
|
|
||||||
else if test -n "$SWAYSOCK"
|
|
||||||
and type -q jq
|
|
||||||
swaymsg --type get_tree | jq '.. | objects | select(.focused == true) | .id'
|
|
||||||
else if test -n "$HYPRLAND_INSTANCE_SIGNATURE"
|
|
||||||
hyprctl activewindow | awk 'NR==1 {print $2}'
|
|
||||||
else if begin
|
|
||||||
test "$XDG_SESSION_DESKTOP" = gnome; and type -q gdbus
|
|
||||||
end
|
|
||||||
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'global.display.focus_window.get_id()'
|
|
||||||
else if type -q xprop
|
|
||||||
and test -n "$DISPLAY"
|
|
||||||
# Test that the X server at $DISPLAY is running
|
|
||||||
and xprop -grammar >/dev/null 2>&1
|
|
||||||
xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2
|
|
||||||
else if uname -a | string match --quiet --ignore-case --regex microsoft
|
|
||||||
__done_run_powershell_script '
|
|
||||||
Add-Type @"
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
public class WindowsCompat {
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
public static extern IntPtr GetForegroundWindow();
|
|
||||||
}
|
|
||||||
"@
|
|
||||||
[WindowsCompat]::GetForegroundWindow()
|
|
||||||
'
|
|
||||||
else if set -q __done_allow_nongraphical
|
|
||||||
echo 12345 # dummy value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function __done_is_tmux_window_active
|
|
||||||
set -q fish_pid; or set -l fish_pid %self
|
|
||||||
|
|
||||||
# find the outermost process within tmux
|
|
||||||
# ppid != "tmux" -> pid = ppid
|
|
||||||
# ppid == "tmux" -> break
|
|
||||||
set tmux_fish_pid $fish_pid
|
|
||||||
while set tmux_fish_ppid (ps -o ppid= -p $tmux_fish_pid | string trim)
|
|
||||||
# remove leading hyphen so that basename does not treat it as an argument (e.g. -fish), and return only
|
|
||||||
# the actual command and not its arguments so that basename finds the correct command name.
|
|
||||||
# (e.g. '/usr/bin/tmux' from command '/usr/bin/tmux new-session -c /some/start/dir')
|
|
||||||
and ! string match -q "tmux*" (basename (ps -o command= -p $tmux_fish_ppid | string replace -r '^-' '' | string split ' ')[1])
|
|
||||||
set tmux_fish_pid $tmux_fish_ppid
|
|
||||||
end
|
|
||||||
|
|
||||||
# tmux session attached and window is active -> no notification
|
|
||||||
# all other combinations -> send notification
|
|
||||||
tmux list-panes -a -F "#{session_attached} #{window_active} #{pane_pid}" | string match -q "1 1 $tmux_fish_pid"
|
|
||||||
end
|
|
||||||
|
|
||||||
function __done_is_screen_window_active
|
|
||||||
string match --quiet --regex "$STY\s+\(Attached" (screen -ls)
|
|
||||||
end
|
|
||||||
|
|
||||||
function __done_is_process_window_focused
|
|
||||||
# Return false if the window is not focused
|
|
||||||
|
|
||||||
if set -q __done_allow_nongraphical
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
if set -q __done_kitty_remote_control
|
|
||||||
kitty @ --password="$__done_kitty_remote_control_password" ls | jq -e ".[].tabs[] | select(any(.windows[]; .is_self)) | .is_focused" >/dev/null
|
|
||||||
return $status
|
|
||||||
end
|
|
||||||
|
|
||||||
set __done_focused_window_id (__done_get_focused_window_id)
|
|
||||||
if test "$__done_sway_ignore_visible" -eq 1
|
|
||||||
and test -n "$SWAYSOCK"
|
|
||||||
string match --quiet --regex "^true" (swaymsg -t get_tree | jq ".. | objects | select(.id == "$__done_initial_window_id") | .visible")
|
|
||||||
return $status
|
|
||||||
else if test -n "$HYPRLAND_INSTANCE_SIGNATURE"
|
|
||||||
and test $__done_initial_window_id = (hyprctl activewindow | awk 'NR==1 {print $2}')
|
|
||||||
return $status
|
|
||||||
else if test "$__done_initial_window_id" != "$__done_focused_window_id"
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
# If inside a tmux session, check if the tmux window is focused
|
|
||||||
if type -q tmux
|
|
||||||
and test -n "$TMUX"
|
|
||||||
__done_is_tmux_window_active
|
|
||||||
return $status
|
|
||||||
end
|
|
||||||
|
|
||||||
# If inside a screen session, check if the screen window is focused
|
|
||||||
if type -q screen
|
|
||||||
and test -n "$STY"
|
|
||||||
__done_is_screen_window_active
|
|
||||||
return $status
|
|
||||||
end
|
|
||||||
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
function __done_humanize_duration -a milliseconds
|
|
||||||
set -l seconds (math --scale=0 "$milliseconds/1000" % 60)
|
|
||||||
set -l minutes (math --scale=0 "$milliseconds/60000" % 60)
|
|
||||||
set -l hours (math --scale=0 "$milliseconds/3600000")
|
|
||||||
|
|
||||||
if test $hours -gt 0
|
|
||||||
printf '%s' $hours'h '
|
|
||||||
end
|
|
||||||
if test $minutes -gt 0
|
|
||||||
printf '%s' $minutes'm '
|
|
||||||
end
|
|
||||||
if test $seconds -gt 0
|
|
||||||
printf '%s' $seconds's'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# verify that the system has graphical capabilities before initializing
|
|
||||||
if test -z "$SSH_CLIENT" # not over ssh
|
|
||||||
and count (__done_get_focused_window_id) >/dev/null # is able to get window id
|
|
||||||
set __done_enabled
|
|
||||||
end
|
|
||||||
|
|
||||||
if set -q __done_allow_nongraphical
|
|
||||||
and set -q __done_notification_command
|
|
||||||
set __done_enabled
|
|
||||||
end
|
|
||||||
|
|
||||||
if set -q __done_enabled
|
|
||||||
set -g __done_initial_window_id ''
|
|
||||||
set -q __done_min_cmd_duration; or set -g __done_min_cmd_duration 5000
|
|
||||||
set -q __done_exclude; or set -g __done_exclude '^git (?!push|pull|fetch)'
|
|
||||||
set -q __done_notify_sound; or set -g __done_notify_sound 0
|
|
||||||
set -q __done_sway_ignore_visible; or set -g __done_sway_ignore_visible 0
|
|
||||||
set -q __done_tmux_pane_format; or set -g __done_tmux_pane_format '[#{window_index}]'
|
|
||||||
set -q __done_notification_duration; or set -g __done_notification_duration 3000
|
|
||||||
|
|
||||||
function __done_started --on-event fish_preexec
|
|
||||||
set __done_initial_window_id (__done_get_focused_window_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
function __done_ended --on-event fish_postexec
|
|
||||||
set -l exit_status $status
|
|
||||||
|
|
||||||
# backwards compatibility for fish < v3.0
|
|
||||||
set -q cmd_duration; or set -l cmd_duration $CMD_DURATION
|
|
||||||
|
|
||||||
if test $cmd_duration
|
|
||||||
and test $cmd_duration -gt $__done_min_cmd_duration # longer than notify_duration
|
|
||||||
and not __done_is_process_window_focused # process pane or window not focused
|
|
||||||
|
|
||||||
# don't notify if command matches exclude list
|
|
||||||
for pattern in $__done_exclude
|
|
||||||
if string match -qr $pattern $argv[1]
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Store duration of last command
|
|
||||||
set -l humanized_duration (__done_humanize_duration "$cmd_duration")
|
|
||||||
|
|
||||||
set -l title "Done in $humanized_duration"
|
|
||||||
set -l wd (string replace --regex "^$HOME" "~" (pwd))
|
|
||||||
set -l message "$wd/ $argv[1]"
|
|
||||||
set -l sender $__done_initial_window_id
|
|
||||||
|
|
||||||
if test $exit_status -ne 0
|
|
||||||
set title "Failed ($exit_status) after $humanized_duration"
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -n "$TMUX_PANE"
|
|
||||||
set message (tmux lsw -F"$__done_tmux_pane_format" -f '#{==:#{pane_id},'$TMUX_PANE'}')" $message"
|
|
||||||
end
|
|
||||||
|
|
||||||
if set -q __done_notification_command
|
|
||||||
eval $__done_notification_command
|
|
||||||
if test "$__done_notify_sound" -eq 1
|
|
||||||
echo -e "\a" # bell sound
|
|
||||||
end
|
|
||||||
else if set -q KITTY_WINDOW_ID
|
|
||||||
printf "\x1b]99;i=done:d=0;$title\x1b\\"
|
|
||||||
printf "\x1b]99;i=done:d=1:p=body;$message\x1b\\"
|
|
||||||
else if type -q terminal-notifier # https://github.com/julienXX/terminal-notifier
|
|
||||||
if test "$__done_notify_sound" -eq 1
|
|
||||||
# pipe message into terminal-notifier to avoid escaping issues (https://github.com/julienXX/terminal-notifier/issues/134). fixes #140
|
|
||||||
echo "$message" | terminal-notifier -title "$title" -sender "$__done_initial_window_id" -sound default
|
|
||||||
else
|
|
||||||
echo "$message" | terminal-notifier -title "$title" -sender "$__done_initial_window_id"
|
|
||||||
end
|
|
||||||
|
|
||||||
else if type -q osascript # AppleScript
|
|
||||||
# escape double quotes that might exist in the message and break osascript. fixes #133
|
|
||||||
set -l message (string replace --all '"' '\"' "$message")
|
|
||||||
set -l title (string replace --all '"' '\"' "$title")
|
|
||||||
|
|
||||||
osascript -e "display notification \"$message\" with title \"$title\""
|
|
||||||
if test "$__done_notify_sound" -eq 1
|
|
||||||
osascript -e "display notification \"$message\" with title \"$title\" sound name \"Glass\""
|
|
||||||
else
|
|
||||||
osascript -e "display notification \"$message\" with title \"$title\""
|
|
||||||
end
|
|
||||||
|
|
||||||
else if type -q notify-send # Linux notify-send
|
|
||||||
# set urgency to normal
|
|
||||||
set -l urgency normal
|
|
||||||
|
|
||||||
# use user-defined urgency if set
|
|
||||||
if set -q __done_notification_urgency_level
|
|
||||||
set urgency "$__done_notification_urgency_level"
|
|
||||||
end
|
|
||||||
# override user-defined urgency level if non-zero exitstatus
|
|
||||||
if test $exit_status -ne 0
|
|
||||||
set urgency critical
|
|
||||||
if set -q __done_notification_urgency_level_failure
|
|
||||||
set urgency "$__done_notification_urgency_level_failure"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
notify-send --hint=int:transient:1 --urgency=$urgency --icon=utilities-terminal --app-name=fish --expire-time=$__done_notification_duration "$title" "$message"
|
|
||||||
|
|
||||||
if test "$__done_notify_sound" -eq 1
|
|
||||||
echo -e "\a" # bell sound
|
|
||||||
end
|
|
||||||
|
|
||||||
else if type -q notify-desktop # Linux notify-desktop
|
|
||||||
set -l urgency
|
|
||||||
if test $exit_status -ne 0
|
|
||||||
set urgency "--urgency=critical"
|
|
||||||
end
|
|
||||||
notify-desktop $urgency --icon=utilities-terminal --app-name=fish "$title" "$message"
|
|
||||||
if test "$__done_notify_sound" -eq 1
|
|
||||||
echo -e "\a" # bell sound
|
|
||||||
end
|
|
||||||
|
|
||||||
else if uname -a | string match --quiet --ignore-case --regex microsoft
|
|
||||||
__done_windows_notification "$title" "$message"
|
|
||||||
|
|
||||||
else # anything else
|
|
||||||
echo -e "\a" # bell sound
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function __done_uninstall -e done_uninstall
|
|
||||||
# Erase all __done_* functions
|
|
||||||
functions -e __done_ended
|
|
||||||
functions -e __done_started
|
|
||||||
functions -e __done_get_focused_window_id
|
|
||||||
functions -e __done_is_tmux_window_active
|
|
||||||
functions -e __done_is_screen_window_active
|
|
||||||
functions -e __done_is_process_window_focused
|
|
||||||
functions -e __done_windows_notification
|
|
||||||
functions -e __done_run_powershell_script
|
|
||||||
functions -e __done_humanize_duration
|
|
||||||
|
|
||||||
# Erase __done variables
|
|
||||||
set -e __done_version
|
|
||||||
end
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# fzf.fish is only meant to be used in interactive mode. If not in interactive mode and not in CI, skip the config to speed up shell startup
|
|
||||||
if not status is-interactive && test "$CI" != true
|
|
||||||
exit
|
|
||||||
end
|
|
||||||
|
|
||||||
# Because of scoping rules, to capture the shell variables exactly as they are, we must read
|
|
||||||
# them before even executing _fzf_search_variables. We use psub to store the
|
|
||||||
# variables' info in temporary files and pass in the filenames as arguments.
|
|
||||||
# This variable is global so that it can be referenced by fzf_configure_bindings and in tests
|
|
||||||
set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)'
|
|
||||||
|
|
||||||
|
|
||||||
# Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings
|
|
||||||
fzf_configure_bindings
|
|
||||||
|
|
||||||
# Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased
|
|
||||||
function _fzf_uninstall --on-event fzf_uninstall
|
|
||||||
_fzf_uninstall_bindings
|
|
||||||
|
|
||||||
set --erase _fzf_search_vars_command
|
|
||||||
functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings
|
|
||||||
complete --erase fzf_configure_bindings
|
|
||||||
|
|
||||||
set_color cyan
|
|
||||||
echo "fzf.fish uninstalled."
|
|
||||||
echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings."
|
|
||||||
set_color normal
|
|
||||||
end
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
source "$HOME/.cargo/env.fish"
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
#!/usr/bin/fish
|
|
||||||
|
|
||||||
# Makes command and binaries from SDKMAN! available in fish.
|
|
||||||
# Delegates to bash for the `sdk` command.
|
|
||||||
|
|
||||||
# Copyright (c) 2018-2023 Raphael Reitzig
|
|
||||||
# MIT License (MIT)
|
|
||||||
# https://github.com/reitzig/sdkman-for-fish
|
|
||||||
|
|
||||||
# Account for custom install locations
|
|
||||||
if set -q __sdkman_custom_dir
|
|
||||||
set -gx SDKMAN_DIR "$__sdkman_custom_dir"
|
|
||||||
end
|
|
||||||
# Guard: SDKMAN! needs to be installed
|
|
||||||
if set -q SDKMAN_DIR; and not test -f "$SDKMAN_DIR/bin/sdkman-init.sh"
|
|
||||||
echo "WARNING: SDKMAN! installation path set to $SDKMAN_DIR, but no installation found there"
|
|
||||||
exit 0
|
|
||||||
end
|
|
||||||
|
|
||||||
# Unless overridden, use the default location:
|
|
||||||
if not set -q SDKMAN_DIR
|
|
||||||
set -gx SDKMAN_DIR "$HOME/.sdkman"
|
|
||||||
end
|
|
||||||
|
|
||||||
set __fish_sdkman_init "$SDKMAN_DIR/bin/sdkman-init.sh"
|
|
||||||
|
|
||||||
# Guard: SDKMAN! needs to be installed
|
|
||||||
if not test -f "$__fish_sdkman_init"
|
|
||||||
exit 0
|
|
||||||
end
|
|
||||||
|
|
||||||
# Copied from https://github.com/jorgebucaran/fisher/blob/main/functions/fisher.fish to be consistent:
|
|
||||||
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
|
||||||
set __fish_sdkman_noexport_init "$fisher_path/functions/__sdkman-noexport-init.sh"
|
|
||||||
|
|
||||||
# Hack for issue #19:
|
|
||||||
# Create version of sdkman-init that doesn't export any environment variables.
|
|
||||||
# Refresh if sdkman-init changed.
|
|
||||||
if begin not test -f "$__fish_sdkman_noexport_init";
|
|
||||||
or env test "$__fish_sdkman_init" -nt "$__fish_sdkman_noexport_init"
|
|
||||||
end
|
|
||||||
mkdir -p (dirname $__fish_sdkman_noexport_init)
|
|
||||||
sed -E -e 's/^(\s*).*(export|to_path).*$/\1:/g' "$__fish_sdkman_init" \
|
|
||||||
> "$__fish_sdkman_noexport_init"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Runs the given command in bash, capturing some side effects
|
|
||||||
# and repeating them on the current fish shell.
|
|
||||||
# Returns the same status code as the given command.
|
|
||||||
function __fish_sdkman_run_in_bash
|
|
||||||
# We need to leave stdin and stdout of sdk free for user interaction.
|
|
||||||
# So, pipe relevant environment variables (which might have changed)
|
|
||||||
# through a file.
|
|
||||||
# But since now getting the exit code of sdk itself is a hassle,
|
|
||||||
# pipe it as well.
|
|
||||||
#
|
|
||||||
# TODO: Can somebody get this to work without the overhead of a file?
|
|
||||||
set pipe (mktemp)
|
|
||||||
bash -c "$argv[1];
|
|
||||||
echo -e \"\$?\" > $pipe;
|
|
||||||
env | grep -e '^SDKMAN_\|^PATH' >> $pipe;
|
|
||||||
env | grep -i -E \"^(`echo \${SDKMAN_CANDIDATES_CSV} | sed 's/,/|/g'`)_HOME\" >> $pipe;
|
|
||||||
echo \"SDKMAN_OFFLINE_MODE=\${SDKMAN_OFFLINE_MODE}\" >> $pipe;
|
|
||||||
echo \"SDKMAN_ENV=\${SDKMAN_ENV}\" >> $pipe" # it's not an environment variable!
|
|
||||||
set bashDump (cat $pipe; rm $pipe)
|
|
||||||
|
|
||||||
set sdkStatus $bashDump[1]
|
|
||||||
set bashEnv $bashDump[2..-1]
|
|
||||||
|
|
||||||
# If SDKMAN! succeeded, copy relevant environment variables
|
|
||||||
# to the current shell (they might have changed)
|
|
||||||
if [ $sdkStatus = 0 ]
|
|
||||||
for line in $bashEnv
|
|
||||||
set parts (string split "=" $line)
|
|
||||||
set var $parts[1]
|
|
||||||
set value (string join "=" $parts[2..-1])
|
|
||||||
|
|
||||||
switch "$var"
|
|
||||||
case "PATH"
|
|
||||||
# Special treatment: need fish list instead
|
|
||||||
# of colon-separated list.
|
|
||||||
set value (string split : "$value")
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -n value
|
|
||||||
set -gx $var $value
|
|
||||||
# Note: This makes SDKMAN_{OFFLINE_MODE,ENV} environment variables.
|
|
||||||
# That gives it the behaviour we _want_!
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return $sdkStatus
|
|
||||||
end
|
|
||||||
|
|
||||||
# If this is a subshell of a(n initialized) fish owned by the same user,
|
|
||||||
# no initialization necessary.
|
|
||||||
# Otherwise:
|
|
||||||
if not set -q SDKMAN_CANDIDATES_DIR; or test (ls -ld "$SDKMAN_CANDIDATES_DIR" | awk '{print $3}') != (whoami)
|
|
||||||
__fish_sdkman_run_in_bash "source $__fish_sdkman_init"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Set up auto_env
|
|
||||||
if grep -q "^sdkman_auto_env=true" "$SDKMAN_DIR/etc/config"
|
|
||||||
function __fish_sdkman_autoenv --on-variable PWD
|
|
||||||
# Run the (modified) init script, which performs the checks and calls for us!
|
|
||||||
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\""
|
|
||||||
|
|
||||||
set -x SDKMAN_OLD_PWD "$PWD" # needed by the Bash implementation
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
## Set values
|
|
||||||
# Hide welcome message & ensure we are reporting fish as shell
|
|
||||||
set fish_greeting
|
|
||||||
set VIRTUAL_ENV_DISABLE_PROMPT "1"
|
|
||||||
set -xU MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
|
||||||
set -xU MANROFFOPT "-c"
|
|
||||||
set -xU EDITOR /usr/bin/nvim
|
|
||||||
set -x SHELL /usr/bin/fish
|
|
||||||
|
|
||||||
## Export variable need for qt-theme
|
|
||||||
if type "qtile" >> /dev/null 2>&1
|
|
||||||
set -x QT_QPA_PLATFORMTHEME "qt5ct"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Set settings for https://github.com/franciscolourenco/done
|
|
||||||
set -U __done_min_cmd_duration 10000
|
|
||||||
set -U __done_notification_urgency_level low
|
|
||||||
|
|
||||||
|
|
||||||
## Environment setup
|
|
||||||
# Apply .profile: use this to put fish compatible .profile stuff in
|
|
||||||
if test -f ~/.fish_profile
|
|
||||||
source ~/.fish_profile
|
|
||||||
end
|
|
||||||
|
|
||||||
# Add ~/.local/bin to PATH
|
|
||||||
if test -d ~/.local/bin
|
|
||||||
if not contains -- ~/.local/bin $PATH
|
|
||||||
set -p PATH ~/.local/bin
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
## Starship prompt
|
|
||||||
if status --is-interactive
|
|
||||||
set -l starship_path (which starship)
|
|
||||||
source ("$starship_path" init fish --print-full-init | psub)
|
|
||||||
end
|
|
||||||
|
|
||||||
## Advanced command-not-found hook
|
|
||||||
#source /usr/share/doc/find-the-command/ftc.fish
|
|
||||||
|
|
||||||
set -l xdg_data_home $XDG_DATA_HOME ~/.local/share
|
|
||||||
set -gx --path XDG_DATA_DIRS $xdg_data_home[1]/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
|
|
||||||
|
|
||||||
for flatpakdir in ~/.local/share/flatpak/exports/bin /var/lib/flatpak/exports/bin
|
|
||||||
if test -d $flatpakdir
|
|
||||||
contains $flatpakdir $PATH; or set -a PATH $flatpakdir
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
## Functions
|
|
||||||
# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
|
|
||||||
function __history_previous_command
|
|
||||||
switch (commandline -t)
|
|
||||||
case "!"
|
|
||||||
commandline -t $history[1]; commandline -f repaint
|
|
||||||
case "*"
|
|
||||||
commandline -i !
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function __history_previous_command_arguments
|
|
||||||
switch (commandline -t)
|
|
||||||
case "!"
|
|
||||||
commandline -t ""
|
|
||||||
commandline -f history-token-search-backward
|
|
||||||
case "*"
|
|
||||||
commandline -i '$'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if [ "$fish_key_bindings" = fish_vi_key_bindings ];
|
|
||||||
bind -Minsert ! __history_previous_command
|
|
||||||
bind -Minsert '$' __history_previous_command_arguments
|
|
||||||
else
|
|
||||||
bind ! __history_previous_command
|
|
||||||
bind '$' __history_previous_command_arguments
|
|
||||||
end
|
|
||||||
|
|
||||||
# Fish command history
|
|
||||||
function history
|
|
||||||
builtin history --show-time='%F %T '
|
|
||||||
end
|
|
||||||
|
|
||||||
function backup --argument filename
|
|
||||||
cp $filename $filename.bak
|
|
||||||
end
|
|
||||||
|
|
||||||
# Copy DIR1 DIR2
|
|
||||||
function copy
|
|
||||||
set count (count $argv | tr -d \n)
|
|
||||||
if test "$count" = 2; and test -d "$argv[1]"
|
|
||||||
set from (echo $argv[1] | string trim --right --chars=/)
|
|
||||||
set to (echo $argv[2])
|
|
||||||
command cp -r $from $to
|
|
||||||
else
|
|
||||||
command cp $argv
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function fish_greeting
|
|
||||||
# echo -e "\n"
|
|
||||||
# fastfetch
|
|
||||||
end
|
|
||||||
|
|
||||||
## Useful aliases
|
|
||||||
|
|
||||||
# Replace ls with eza
|
|
||||||
alias ls 'eza --color=always --group-directories-first --icons' # preferred listing
|
|
||||||
alias la 'eza -a --color=always --group-directories-first --icons' # all files and dirs
|
|
||||||
alias ll 'eza -l --color=always --group-directories-first --icons' # long format
|
|
||||||
alias lt 'eza -aT --color=always --group-directories-first --icons' # tree listing
|
|
||||||
alias l. 'eza -ald --color=always --group-directories-first --icons .*' # show only dotfiles
|
|
||||||
|
|
||||||
# Replace some more things with better alternatives
|
|
||||||
alias cat 'bat --style header --style snip --style changes --style header'
|
|
||||||
|
|
||||||
# Replace df command tool
|
|
||||||
alias df='duf'
|
|
||||||
|
|
||||||
# Common use
|
|
||||||
alias .. 'cd ..'
|
|
||||||
alias ... 'cd ../..'
|
|
||||||
alias .... 'cd ../../..'
|
|
||||||
alias ..... 'cd ../../../..'
|
|
||||||
alias ...... 'cd ../../../../..'
|
|
||||||
alias dir 'dir --color=auto'
|
|
||||||
alias grep 'ugrep --color=auto'
|
|
||||||
alias egrep 'ugrep -E --color=auto'
|
|
||||||
alias fgrep 'ugrep -F --color=auto'
|
|
||||||
alias grubup 'sudo update-grub'
|
|
||||||
alias hw 'hwinfo --short' # Hardware Info
|
|
||||||
alias ip 'ip -color'
|
|
||||||
alias psmem 'ps auxf | sort -nr -k 4'
|
|
||||||
alias psmem10 'ps auxf | sort -nr -k 4 | head -10'
|
|
||||||
alias tarnow 'tar -acf '
|
|
||||||
alias untar 'tar -zxvf '
|
|
||||||
alias vdir 'vdir --color=auto'
|
|
||||||
alias wget 'wget -c '
|
|
||||||
alias rost 'rpm-ostree'
|
|
||||||
alias vi 'nvim'
|
|
||||||
|
|
||||||
# Get the error messages from journalctl
|
|
||||||
alias jctl 'journalctl -p 3 -xb'
|
|
||||||
|
|
||||||
# Aliases run commands inner Archlinux Toolbox container
|
|
||||||
alias exercism 'toolbox run -c arch-toolbox-latest exercism'
|
|
||||||
alias k9s 'toolbox run -c arch-toolbox-latest k9s'
|
|
||||||
alias kubectl 'toolbox run -c arch-toolbox-latest kubectl'
|
|
||||||
alias lazydocker 'toolbox run -c arch-toolbox-latest lazydocker'
|
|
||||||
alias lazygit 'toolbox run -c arch-toolbox-latest lazygit'
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
jorgebucaran/fisher
|
|
||||||
reitzig/sdkman-for-fish@v2.1.0
|
|
||||||
edc/bass
|
|
||||||
patrickf1/fzf.fish
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
# This file contains fish universal variable definitions.
|
|
||||||
# VERSION: 3.0
|
|
||||||
SETUVAR --export EDITOR:/usr/bin/nvim
|
|
||||||
SETUVAR --export FZF_DEFAULT_COMMAND:fd\x20\x2d\x2dtype\x20f
|
|
||||||
SETUVAR --export FZF_DEFAULT_OPTS:\x2d\x2dcolor\x3dfg\x3a\x23f8f8f2\x2cbg\x3a\x23282a36\x2chl\x3a\x23bd93f9\x20\x2d\x2dcolor\x3dfg\x2b\x3a\x23f8f8f2\x2cbg\x2b\x3a\x2344475a\x2chl\x2b\x3a\x23bd93f9\x20\x2d\x2dcolor\x3dinfo\x3a\x23ffb86c\x2cprompt\x3a\x2350fa7b\x2cpointer\x3a\x23ff79c6\x20\x2d\x2dcolor\x3dmarker\x3a\x23ff79c6\x2cspinner\x3a\x23ffb86c\x2cheader\x3a\x236272a4
|
|
||||||
SETUVAR --export GOBIN:/home/fscotto/\x2elocal/share/go/bin
|
|
||||||
SETUVAR --export GOPATH:/home/fscotto/\x2elocal/share/go
|
|
||||||
SETUVAR --export MANPAGER:sh\x20\x2dc\x20\x27col\x20\x2dbx\x20\x7c\x20bat\x20\x2dl\x20man\x20\x2dp\x27
|
|
||||||
SETUVAR --export MANROFFOPT:\x2dc
|
|
||||||
SETUVAR __done_min_cmd_duration:10000
|
|
||||||
SETUVAR __done_notification_urgency_level:low
|
|
||||||
SETUVAR __fish_initialized:3400
|
|
||||||
SETUVAR _fisher_edc_2F_bass_files:\x7e/\x2econfig/fish/functions/__bass\x2epy\x1e\x7e/\x2econfig/fish/functions/bass\x2efish
|
|
||||||
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
|
|
||||||
SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/\x2econfig/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_history\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/\x2econfig/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fzf\x2efish\x1e\x7e/\x2econfig/fish/completions/fzf_configure_bindings\x2efish
|
|
||||||
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ereitzig/sdkman\x2dfor\x2dfish\x40v2\x2e1\x2e0\x1eedc/bass\x1epatrickf1/fzf\x2efish
|
|
||||||
SETUVAR _fisher_reitzig_2F_sdkman_2D_for_2D_fish_40_v2_2E_31_2E_30__files:\x7e/\x2econfig/fish/functions/sdk\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/sdk\x2efish\x1e\x7e/\x2econfig/fish/completions/sdk\x2efish
|
|
||||||
SETUVAR _fisher_upgraded_to_4_4:\x1d
|
|
||||||
SETUVAR fish_color_autosuggestion:brblack
|
|
||||||
SETUVAR fish_color_cancel:\x2dr
|
|
||||||
SETUVAR fish_color_command:blue
|
|
||||||
SETUVAR fish_color_comment:red
|
|
||||||
SETUVAR fish_color_cwd:green
|
|
||||||
SETUVAR fish_color_cwd_root:red
|
|
||||||
SETUVAR fish_color_end:green
|
|
||||||
SETUVAR fish_color_error:brred
|
|
||||||
SETUVAR fish_color_escape:brcyan
|
|
||||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
|
||||||
SETUVAR fish_color_host:normal
|
|
||||||
SETUVAR fish_color_host_remote:yellow
|
|
||||||
SETUVAR fish_color_normal:normal
|
|
||||||
SETUVAR fish_color_operator:brcyan
|
|
||||||
SETUVAR fish_color_param:cyan
|
|
||||||
SETUVAR fish_color_quote:yellow
|
|
||||||
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
|
|
||||||
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
|
||||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
|
||||||
SETUVAR fish_color_status:red
|
|
||||||
SETUVAR fish_color_user:brgreen
|
|
||||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
|
||||||
SETUVAR fish_key_bindings:fish_default_key_bindings
|
|
||||||
SETUVAR fish_pager_color_completion:normal
|
|
||||||
SETUVAR fish_pager_color_description:yellow\x1e\x2di
|
|
||||||
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
|
||||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
|
||||||
SETUVAR fish_pager_color_selected_background:\x2dr
|
|
||||||
SETUVAR fish_user_paths:/var/home/fscotto/\x2elocal/share/go
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
"""
|
|
||||||
To be used with a companion fish function like this:
|
|
||||||
|
|
||||||
function refish
|
|
||||||
set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x
|
|
||||||
end
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import signal
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
|
|
||||||
BASH = 'bash'
|
|
||||||
|
|
||||||
FISH_READONLY = [
|
|
||||||
'PWD', 'SHLVL', 'history', 'pipestatus', 'status', 'version',
|
|
||||||
'FISH_VERSION', 'fish_pid', 'hostname', '_', 'fish_private_mode'
|
|
||||||
]
|
|
||||||
|
|
||||||
IGNORED = [
|
|
||||||
'PS1', 'XPC_SERVICE_NAME'
|
|
||||||
]
|
|
||||||
|
|
||||||
def ignored(name):
|
|
||||||
if name == 'PWD': # this is read only, but has special handling
|
|
||||||
return False
|
|
||||||
# ignore other read only variables
|
|
||||||
if name in FISH_READONLY:
|
|
||||||
return True
|
|
||||||
if name in IGNORED or name.startswith("BASH_FUNC"):
|
|
||||||
return True
|
|
||||||
if name.startswith('%'):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def escape(string):
|
|
||||||
# use json.dumps to reliably escape quotes and backslashes
|
|
||||||
return json.dumps(string).replace(r'$', r'\$')
|
|
||||||
|
|
||||||
def escape_identifier(word):
|
|
||||||
return escape(word.replace('?', '\\?'))
|
|
||||||
|
|
||||||
def comment(string):
|
|
||||||
return '\n'.join(['# ' + line for line in string.split('\n')])
|
|
||||||
|
|
||||||
def gen_script():
|
|
||||||
# Use the following instead of /usr/bin/env to read environment so we can
|
|
||||||
# deal with multi-line environment variables (and other odd cases).
|
|
||||||
env_reader = "%s -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'" % (sys.executable)
|
|
||||||
args = [BASH, '-c', env_reader]
|
|
||||||
output = subprocess.check_output(args, universal_newlines=True)
|
|
||||||
old_env = output.strip()
|
|
||||||
|
|
||||||
pipe_r, pipe_w = os.pipe()
|
|
||||||
if sys.version_info >= (3, 4):
|
|
||||||
os.set_inheritable(pipe_w, True)
|
|
||||||
command = 'eval $1 && ({}; alias) >&{}'.format(
|
|
||||||
env_reader,
|
|
||||||
pipe_w
|
|
||||||
)
|
|
||||||
args = [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])]
|
|
||||||
p = subprocess.Popen(args, universal_newlines=True, close_fds=False)
|
|
||||||
os.close(pipe_w)
|
|
||||||
with os.fdopen(pipe_r) as f:
|
|
||||||
new_env = f.readline()
|
|
||||||
alias_str = f.read()
|
|
||||||
if p.wait() != 0:
|
|
||||||
raise subprocess.CalledProcessError(
|
|
||||||
returncode=p.returncode,
|
|
||||||
cmd=' '.join(sys.argv[1:]),
|
|
||||||
output=new_env + alias_str
|
|
||||||
)
|
|
||||||
new_env = new_env.strip()
|
|
||||||
|
|
||||||
old_env = json.loads(old_env)
|
|
||||||
new_env = json.loads(new_env)
|
|
||||||
|
|
||||||
script_lines = []
|
|
||||||
|
|
||||||
for k, v in new_env.items():
|
|
||||||
if ignored(k):
|
|
||||||
continue
|
|
||||||
v1 = old_env.get(k)
|
|
||||||
if not v1:
|
|
||||||
script_lines.append(comment('adding %s=%s' % (k, v)))
|
|
||||||
elif v1 != v:
|
|
||||||
script_lines.append(comment('updating %s=%s -> %s' % (k, v1, v)))
|
|
||||||
# process special variables
|
|
||||||
if k == 'PWD':
|
|
||||||
script_lines.append('cd %s' % escape(v))
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
if k == 'PATH':
|
|
||||||
value = ' '.join([escape(directory)
|
|
||||||
for directory in v.split(':')])
|
|
||||||
else:
|
|
||||||
value = escape(v)
|
|
||||||
script_lines.append('set -g -x %s %s' % (k, value))
|
|
||||||
|
|
||||||
for var in set(old_env.keys()) - set(new_env.keys()):
|
|
||||||
script_lines.append(comment('removing %s' % var))
|
|
||||||
script_lines.append('set -e %s' % var)
|
|
||||||
|
|
||||||
script = '\n'.join(script_lines)
|
|
||||||
|
|
||||||
alias_lines = []
|
|
||||||
for line in alias_str.splitlines():
|
|
||||||
_, rest = line.split(None, 1)
|
|
||||||
k, v = rest.split("=", 1)
|
|
||||||
alias_lines.append("alias " + escape_identifier(k) + "=" + v)
|
|
||||||
alias = '\n'.join(alias_lines)
|
|
||||||
|
|
||||||
return script + '\n' + alias
|
|
||||||
|
|
||||||
script_file = os.fdopen(3, 'w')
|
|
||||||
|
|
||||||
if not sys.argv[1:]:
|
|
||||||
print('__bass_usage', file=script_file, end='')
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
try:
|
|
||||||
script = gen_script()
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
sys.exit(e.returncode)
|
|
||||||
except Exception:
|
|
||||||
print('Bass internal error!', file=sys.stderr)
|
|
||||||
raise # traceback will output to stderr
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
|
||||||
os.kill(os.getpid(), signal.SIGINT)
|
|
||||||
else:
|
|
||||||
script_file.write(script)
|
|
||||||
@@ -1,175 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2021 Marco Vermeulen
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
# set env vars if not set
|
|
||||||
if [ -z "$SDKMAN_CANDIDATES_API" ]; then
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$SDKMAN_DIR" ]; then
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load the sdkman config if it exists.
|
|
||||||
if [ -f "${SDKMAN_DIR}/etc/config" ]; then
|
|
||||||
source "${SDKMAN_DIR}/etc/config"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Read the platform file
|
|
||||||
SDKMAN_PLATFORM="$(cat "${SDKMAN_DIR}/var/platform")"
|
|
||||||
:
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
darwin=false
|
|
||||||
solaris=false
|
|
||||||
freebsd=false
|
|
||||||
SDKMAN_KERNEL="$(uname -s)"
|
|
||||||
case "${SDKMAN_KERNEL}" in
|
|
||||||
CYGWIN*)
|
|
||||||
cygwin=true
|
|
||||||
;;
|
|
||||||
Darwin*)
|
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
SunOS*)
|
|
||||||
solaris=true
|
|
||||||
;;
|
|
||||||
FreeBSD*)
|
|
||||||
freebsd=true
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Determine shell
|
|
||||||
zsh_shell=false
|
|
||||||
bash_shell=false
|
|
||||||
|
|
||||||
if [[ -n "$ZSH_VERSION" ]]; then
|
|
||||||
zsh_shell=true
|
|
||||||
elif [[ -n "$BASH_VERSION" ]]; then
|
|
||||||
bash_shell=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source sdkman module scripts and extension files.
|
|
||||||
#
|
|
||||||
# Extension files are prefixed with 'sdkman-' and found in the ext/ folder.
|
|
||||||
# Use this if extensions are written with the functional approach and want
|
|
||||||
# to use functions in the main sdkman script. For more details, refer to
|
|
||||||
# <https://github.com/sdkman/sdkman-extensions>.
|
|
||||||
OLD_IFS="$IFS"
|
|
||||||
IFS=$'\n'
|
|
||||||
scripts=($(find "${SDKMAN_DIR}/src" "${SDKMAN_DIR}/ext" -type f -name 'sdkman-*.sh'))
|
|
||||||
for f in "${scripts[@]}"; do
|
|
||||||
source "$f"
|
|
||||||
done
|
|
||||||
IFS="$OLD_IFS"
|
|
||||||
unset OLD_IFS scripts f
|
|
||||||
|
|
||||||
# Create upgrade delay file if it doesn't exist
|
|
||||||
if [[ ! -f "${SDKMAN_DIR}/var/delay_upgrade" ]]; then
|
|
||||||
touch "${SDKMAN_DIR}/var/delay_upgrade"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set curl connect-timeout and max-time
|
|
||||||
if [[ -z "$sdkman_curl_connect_timeout" ]]; then sdkman_curl_connect_timeout=7; fi
|
|
||||||
if [[ -z "$sdkman_curl_max_time" ]]; then sdkman_curl_max_time=10; fi
|
|
||||||
|
|
||||||
# set curl retry
|
|
||||||
if [[ -z "${sdkman_curl_retry}" ]]; then sdkman_curl_retry=0; fi
|
|
||||||
|
|
||||||
# set curl retry max time in seconds
|
|
||||||
if [[ -z "${sdkman_curl_retry_max_time}" ]]; then sdkman_curl_retry_max_time=60; fi
|
|
||||||
|
|
||||||
# set curl to continue downloading automatically
|
|
||||||
if [[ -z "${sdkman_curl_continue}" ]]; then sdkman_curl_continue=true; fi
|
|
||||||
|
|
||||||
# read list of candidates and set array
|
|
||||||
SDKMAN_CANDIDATES_CACHE="${SDKMAN_DIR}/var/candidates"
|
|
||||||
SDKMAN_CANDIDATES_CSV=$(<"$SDKMAN_CANDIDATES_CACHE")
|
|
||||||
__sdkman_echo_debug "Setting candidates csv: $SDKMAN_CANDIDATES_CSV"
|
|
||||||
if [[ "$zsh_shell" == 'true' ]]; then
|
|
||||||
SDKMAN_CANDIDATES=(${(s:,:)SDKMAN_CANDIDATES_CSV})
|
|
||||||
else
|
|
||||||
IFS=',' read -a SDKMAN_CANDIDATES <<< "${SDKMAN_CANDIDATES_CSV}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
:
|
|
||||||
|
|
||||||
for candidate_name in "${SDKMAN_CANDIDATES[@]}"; do
|
|
||||||
candidate_dir="${SDKMAN_CANDIDATES_DIR}/${candidate_name}/current"
|
|
||||||
if [[ -h "$candidate_dir" || -d "${candidate_dir}" ]]; then
|
|
||||||
:
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
unset candidate_name candidate_dir
|
|
||||||
:
|
|
||||||
|
|
||||||
# source completion scripts
|
|
||||||
if [[ "$sdkman_auto_complete" == 'true' ]]; then
|
|
||||||
if [[ "$zsh_shell" == 'true' ]]; then
|
|
||||||
# initialize zsh completions (if not already done)
|
|
||||||
if ! (( $+functions[compdef] )) ; then
|
|
||||||
autoload -Uz compinit
|
|
||||||
if [[ $ZSH_DISABLE_COMPFIX == 'true' ]]; then
|
|
||||||
compinit -u -C
|
|
||||||
else
|
|
||||||
compinit
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
autoload -U bashcompinit
|
|
||||||
bashcompinit
|
|
||||||
source "${SDKMAN_DIR}/contrib/completion/bash/sdk"
|
|
||||||
__sdkman_echo_debug "ZSH completion script loaded..."
|
|
||||||
elif [[ "$bash_shell" == 'true' ]]; then
|
|
||||||
source "${SDKMAN_DIR}/contrib/completion/bash/sdk"
|
|
||||||
__sdkman_echo_debug "Bash completion script loaded..."
|
|
||||||
else
|
|
||||||
__sdkman_echo_debug "No completion scripts found for $SHELL"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$sdkman_auto_env" == "true" ]]; then
|
|
||||||
if [[ "$zsh_shell" == "true" ]]; then
|
|
||||||
function sdkman_auto_env() {
|
|
||||||
if [[ -n $SDKMAN_ENV ]] && [[ ! $PWD =~ ^$SDKMAN_ENV ]]; then
|
|
||||||
sdk env clear
|
|
||||||
fi
|
|
||||||
if [[ -f .sdkmanrc ]]; then
|
|
||||||
sdk env
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
chpwd_functions+=(sdkman_auto_env)
|
|
||||||
else
|
|
||||||
function sdkman_auto_env() {
|
|
||||||
if [[ -n $SDKMAN_ENV ]] && [[ ! $PWD =~ ^$SDKMAN_ENV ]]; then
|
|
||||||
sdk env clear
|
|
||||||
fi
|
|
||||||
if [[ "$SDKMAN_OLD_PWD" != "$PWD" ]] && [[ -f ".sdkmanrc" ]]; then
|
|
||||||
sdk env
|
|
||||||
fi
|
|
||||||
|
|
||||||
:
|
|
||||||
}
|
|
||||||
|
|
||||||
trimmed_prompt_command="${PROMPT_COMMAND%"${PROMPT_COMMAND##*[![:space:]]}"}"
|
|
||||||
[[ -z "$trimmed_prompt_command" ]] && PROMPT_COMMAND="sdkman_auto_env" || PROMPT_COMMAND="${trimmed_prompt_command%\;};sdkman_auto_env"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sdkman_auto_env
|
|
||||||
fi
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings."
|
|
||||||
echo "\
|
|
||||||
USAGE:
|
|
||||||
fzf_configure_bindings [--COMMAND=[KEY_SEQUENCE]...]
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
fzf_configure_bindings installs key bindings for fzf.fish's commands and erases any bindings it
|
|
||||||
previously installed. It installs bindings for both default and insert modes. fzf.fish executes
|
|
||||||
it without options on fish startup to install the out-of-the-box key bindings.
|
|
||||||
|
|
||||||
By default, commands are bound to a mnemonic key sequence, shown below. Each command's binding
|
|
||||||
can be configured using a namesake corresponding option:
|
|
||||||
COMMAND | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION
|
|
||||||
Search Directory | Ctrl+Alt+F (F for file) | --directory
|
|
||||||
Search Git Log | Ctrl+Alt+L (L for log) | --git_log
|
|
||||||
Search Git Status | Ctrl+Alt+S (S for status) | --git_status
|
|
||||||
Search History | Ctrl+R (R for reverse) | --history
|
|
||||||
Search Processes | Ctrl+Alt+P (P for process) | --processes
|
|
||||||
Search Variables | Ctrl+V (V for variable) | --variables
|
|
||||||
Override a command's binding by specifying its corresponding option with the desired key
|
|
||||||
sequence. Disable a command's binding by specifying its corresponding option with no value.
|
|
||||||
|
|
||||||
Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly
|
|
||||||
executed multiple times. Once the desired fzf_configure_bindings command has been found, add it
|
|
||||||
to your config.fish in order to persist the customized bindings.
|
|
||||||
|
|
||||||
In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an
|
|
||||||
equals sign between an option's name and value. However, it does not validate key sequences.
|
|
||||||
|
|
||||||
Pass -h or --help to print this help message and exit.
|
|
||||||
|
|
||||||
EXAMPLES
|
|
||||||
Default bindings but bind Search Directory to Ctrl+F and Search Variables to Ctrl+Alt+V
|
|
||||||
\$ fzf_configure_bindings --directory=\cf --variables=\e\cv
|
|
||||||
Default bindings but disable Search History
|
|
||||||
\$ fzf_configure_bindings --history=
|
|
||||||
An agglomeration of different options
|
|
||||||
\$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes=
|
|
||||||
|
|
||||||
SEE Also
|
|
||||||
To learn more about fish key bindings, see bind(1) and fish_key_reader(1).
|
|
||||||
"
|
|
||||||
end
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# helper function for _fzf_search_variables
|
|
||||||
function _fzf_extract_var_info --argument-names variable_name set_show_output --description "Extract and reformat lines pertaining to \$variable_name from \$set_show_output."
|
|
||||||
# Extract only the lines about the variable, all of which begin with either
|
|
||||||
# $variable_name: ...or... $variable_name[
|
|
||||||
string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output |
|
|
||||||
|
|
||||||
# Strip the variable name prefix, including ": " for scope info lines
|
|
||||||
string replace --regex "^\\\$$variable_name(?:: )?" '' |
|
|
||||||
|
|
||||||
# Distill the lines of values, replacing...
|
|
||||||
# [1]: |value|
|
|
||||||
# ...with...
|
|
||||||
# [1] value
|
|
||||||
string replace --regex ": \|(.*)\|" ' $1'
|
|
||||||
end
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# helper for _fzf_search_git_status
|
|
||||||
# arg should be a line from git status --short, e.g.
|
|
||||||
# MM functions/_fzf_preview_changed_file.fish
|
|
||||||
# D README.md
|
|
||||||
# R LICENSE -> "New License"
|
|
||||||
function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file."
|
|
||||||
# remove quotes because they'll be interpreted literally by git diff
|
|
||||||
# no need to requote when referencing $path because fish does not perform word splitting
|
|
||||||
# https://fishshell.com/docs/current/fish_for_bash_users.html
|
|
||||||
set -f path (string unescape (string sub --start 4 $path_status))
|
|
||||||
# first letter of short format shows index, second letter shows working tree
|
|
||||||
# https://git-scm.com/docs/git-status/2.35.0#_short_format
|
|
||||||
set -f index_status (string sub --length 1 $path_status)
|
|
||||||
set -f working_tree_status (string sub --start 2 --length 1 $path_status)
|
|
||||||
|
|
||||||
set -f diff_opts --color=always
|
|
||||||
|
|
||||||
if test $index_status = '?'
|
|
||||||
_fzf_report_diff_type Untracked
|
|
||||||
_fzf_preview_file $path
|
|
||||||
else if contains {$index_status}$working_tree_status DD AU UD UA DU AA UU
|
|
||||||
# Unmerged statuses taken directly from git status help's short format table
|
|
||||||
# Unmerged statuses are mutually exclusive with other statuses, so if we see
|
|
||||||
# these, then safe to assume the path is unmerged
|
|
||||||
_fzf_report_diff_type Unmerged
|
|
||||||
git diff $diff_opts -- $path
|
|
||||||
else
|
|
||||||
if test $index_status != ' '
|
|
||||||
_fzf_report_diff_type Staged
|
|
||||||
|
|
||||||
# renames are only detected in the index, never working tree, so only need to test for it here
|
|
||||||
# https://stackoverflow.com/questions/73954214
|
|
||||||
if test $index_status = R
|
|
||||||
# diff the post-rename path with the original path, otherwise the diff will show the entire file as being added
|
|
||||||
set -f orig_and_new_path (string split --max 1 -- ' -> ' $path)
|
|
||||||
git diff --staged $diff_opts -- $orig_and_new_path[1] $orig_and_new_path[2]
|
|
||||||
# path currently has the form of "original -> current", so we need to correct it before it's used below
|
|
||||||
set path $orig_and_new_path[2]
|
|
||||||
else
|
|
||||||
git diff --staged $diff_opts -- $path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if test $working_tree_status != ' '
|
|
||||||
_fzf_report_diff_type Unstaged
|
|
||||||
git diff $diff_opts -- $path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
# helper function for _fzf_search_directory and _fzf_search_git_status
|
|
||||||
function _fzf_preview_file --description "Print a preview for the given file based on its file type."
|
|
||||||
# because there's no way to guarantee that _fzf_search_directory passes the path to _fzf_preview_file
|
|
||||||
# as one argument, we collect all the arguments into one single variable and treat that as the path
|
|
||||||
set -f file_path $argv
|
|
||||||
|
|
||||||
if test -L "$file_path" # symlink
|
|
||||||
# notify user and recurse on the target of the symlink, which can be any of these file types
|
|
||||||
set -l target_path (realpath "$file_path")
|
|
||||||
|
|
||||||
set_color yellow
|
|
||||||
echo "'$file_path' is a symlink to '$target_path'."
|
|
||||||
set_color normal
|
|
||||||
|
|
||||||
_fzf_preview_file "$target_path"
|
|
||||||
else if test -f "$file_path" # regular file
|
|
||||||
if set --query fzf_preview_file_cmd
|
|
||||||
# need to escape quotes to make sure eval receives file_path as a single arg
|
|
||||||
eval "$fzf_preview_file_cmd '$file_path'"
|
|
||||||
else
|
|
||||||
bat --style=numbers --color=always "$file_path"
|
|
||||||
end
|
|
||||||
else if test -d "$file_path" # directory
|
|
||||||
if set --query fzf_preview_dir_cmd
|
|
||||||
# see above
|
|
||||||
eval "$fzf_preview_dir_cmd '$file_path'"
|
|
||||||
else
|
|
||||||
# -A list hidden files as well, except for . and ..
|
|
||||||
# -F helps classify files by appending symbols after the file name
|
|
||||||
command ls -A -F "$file_path"
|
|
||||||
end
|
|
||||||
else if test -c "$file_path"
|
|
||||||
_fzf_report_file_type "$file_path" "character device file"
|
|
||||||
else if test -b "$file_path"
|
|
||||||
_fzf_report_file_type "$file_path" "block device file"
|
|
||||||
else if test -S "$file_path"
|
|
||||||
_fzf_report_file_type "$file_path" socket
|
|
||||||
else if test -p "$file_path"
|
|
||||||
_fzf_report_file_type "$file_path" "named pipe"
|
|
||||||
else
|
|
||||||
echo "$file_path doesn't exist." >&2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# helper for _fzf_preview_changed_file
|
|
||||||
# prints out something like
|
|
||||||
# ╭────────╮
|
|
||||||
# │ Staged │
|
|
||||||
# ╰────────╯
|
|
||||||
function _fzf_report_diff_type --argument-names diff_type --description "Print a distinct colored header meant to preface a git patch."
|
|
||||||
# number of "-" to draw is the length of the string to box + 2 for padding
|
|
||||||
set -f repeat_count (math 2 + (string length $diff_type))
|
|
||||||
set -f line (string repeat --count $repeat_count ─)
|
|
||||||
set -f top_border ╭$line╮
|
|
||||||
set -f btm_border ╰$line╯
|
|
||||||
|
|
||||||
set_color yellow
|
|
||||||
echo $top_border
|
|
||||||
echo "│ $diff_type │"
|
|
||||||
echo $btm_border
|
|
||||||
set_color normal
|
|
||||||
end
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# helper function for _fzf_preview_file
|
|
||||||
function _fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file."
|
|
||||||
set_color red
|
|
||||||
echo "Cannot preview '$file_path': it is a $file_type."
|
|
||||||
set_color normal
|
|
||||||
end
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths."
|
|
||||||
# Directly use fd binary to avoid output buffering delay caused by a fd alias, if any.
|
|
||||||
# Debian-based distros install fd as fdfind and the fd package is something else, so
|
|
||||||
# check for fdfind first. Fall back to "fd" for a clear error message.
|
|
||||||
set -f fd_cmd (command -v fdfind || command -v fd || echo "fd")
|
|
||||||
set -f --append fd_cmd --color=always $fzf_fd_opts
|
|
||||||
|
|
||||||
set -f fzf_arguments --multi --ansi $fzf_directory_opts
|
|
||||||
set -f token (commandline --current-token)
|
|
||||||
# expand any variables or leading tilde (~) in the token
|
|
||||||
set -f expanded_token (eval echo -- $token)
|
|
||||||
# unescape token because it's already quoted so backslashes will mess up the path
|
|
||||||
set -f unescaped_exp_token (string unescape -- $expanded_token)
|
|
||||||
|
|
||||||
# If the current token is a directory and has a trailing slash,
|
|
||||||
# then use it as fd's base directory.
|
|
||||||
if string match --quiet -- "*/" $unescaped_exp_token && test -d "$unescaped_exp_token"
|
|
||||||
set --append fd_cmd --base-directory=$unescaped_exp_token
|
|
||||||
# use the directory name as fzf's prompt to indicate the search is limited to that directory
|
|
||||||
set --prepend fzf_arguments --prompt="Directory $unescaped_exp_token> " --preview="_fzf_preview_file $expanded_token{}"
|
|
||||||
set -f file_paths_selected $unescaped_exp_token($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments)
|
|
||||||
else
|
|
||||||
set --prepend fzf_arguments --prompt="Directory> " --query="$unescaped_exp_token" --preview='_fzf_preview_file {}'
|
|
||||||
set -f file_paths_selected ($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
if test $status -eq 0
|
|
||||||
commandline --current-token --replace -- (string escape -- $file_paths_selected | string join ' ')
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
function _fzf_search_git_log --description "Search the output of git log and preview commits. Replace the current token with the selected commit hash."
|
|
||||||
if not git rev-parse --git-dir >/dev/null 2>&1
|
|
||||||
echo '_fzf_search_git_log: Not in a git repository.' >&2
|
|
||||||
else
|
|
||||||
if not set --query fzf_git_log_format
|
|
||||||
# %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below
|
|
||||||
set -f fzf_git_log_format '%C(bold blue)%h%C(reset) - %C(cyan)%ad%C(reset) %C(yellow)%d%C(reset) %C(normal)%s%C(reset) %C(dim normal)[%an]%C(reset)'
|
|
||||||
end
|
|
||||||
|
|
||||||
set -f preview_cmd 'git show --color=always --stat --patch {1}'
|
|
||||||
if set --query fzf_diff_highlighter
|
|
||||||
set preview_cmd "$preview_cmd | $fzf_diff_highlighter"
|
|
||||||
end
|
|
||||||
|
|
||||||
set -f selected_log_lines (
|
|
||||||
git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \
|
|
||||||
_fzf_wrapper --ansi \
|
|
||||||
--multi \
|
|
||||||
--scheme=history \
|
|
||||||
--prompt="Git Log> " \
|
|
||||||
--preview=$preview_cmd \
|
|
||||||
--query=(commandline --current-token) \
|
|
||||||
$fzf_git_log_opts
|
|
||||||
)
|
|
||||||
if test $status -eq 0
|
|
||||||
for line in $selected_log_lines
|
|
||||||
set -f abbreviated_commit_hash (string split --field 1 " " $line)
|
|
||||||
set -f full_commit_hash (git rev-parse $abbreviated_commit_hash)
|
|
||||||
set -f --append commit_hashes $full_commit_hash
|
|
||||||
end
|
|
||||||
commandline --current-token --replace (string join ' ' $commit_hashes)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
function _fzf_search_git_status --description "Search the output of git status. Replace the current token with the selected file paths."
|
|
||||||
if not git rev-parse --git-dir >/dev/null 2>&1
|
|
||||||
echo '_fzf_search_git_status: Not in a git repository.' >&2
|
|
||||||
else
|
|
||||||
set -f preview_cmd '_fzf_preview_changed_file {}'
|
|
||||||
if set --query fzf_diff_highlighter
|
|
||||||
set preview_cmd "$preview_cmd | $fzf_diff_highlighter"
|
|
||||||
end
|
|
||||||
|
|
||||||
set -f selected_paths (
|
|
||||||
# Pass configuration color.status=always to force status to use colors even though output is sent to a pipe
|
|
||||||
git -c color.status=always status --short |
|
|
||||||
_fzf_wrapper --ansi \
|
|
||||||
--multi \
|
|
||||||
--prompt="Git Status> " \
|
|
||||||
--query=(commandline --current-token) \
|
|
||||||
--preview=$preview_cmd \
|
|
||||||
--nth="2.." \
|
|
||||||
$fzf_git_status_opts
|
|
||||||
)
|
|
||||||
if test $status -eq 0
|
|
||||||
# git status --short automatically escapes the paths of most files for us so not going to bother trying to handle
|
|
||||||
# the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping")
|
|
||||||
set -f cleaned_paths
|
|
||||||
|
|
||||||
for path in $selected_paths
|
|
||||||
if test (string sub --length 1 $path) = R
|
|
||||||
# path has been renamed and looks like "R LICENSE -> LICENSE.md"
|
|
||||||
# extract the path to use from after the arrow
|
|
||||||
set --append cleaned_paths (string split -- "-> " $path)[-1]
|
|
||||||
else
|
|
||||||
set --append cleaned_paths (string sub --start=4 $path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --current-token --replace -- (string join ' ' $cleaned_paths)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
function _fzf_search_history --description "Search command history. Replace the command line with the selected command."
|
|
||||||
# history merge incorporates history changes from other fish sessions
|
|
||||||
# it errors out if called in private mode
|
|
||||||
if test -z "$fish_private_mode"
|
|
||||||
builtin history merge
|
|
||||||
end
|
|
||||||
|
|
||||||
if not set --query fzf_history_time_format
|
|
||||||
# Reference https://devhints.io/strftime to understand strftime format symbols
|
|
||||||
set -f fzf_history_time_format "%m-%d %H:%M:%S"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Delinate time from command in history entries using the vertical box drawing char (U+2502).
|
|
||||||
# Then, to get raw command from history entries, delete everything up to it. The ? on regex is
|
|
||||||
# necessary to make regex non-greedy so it won't match into commands containing the char.
|
|
||||||
set -f time_prefix_regex '^.*? │ '
|
|
||||||
# Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line
|
|
||||||
set -f commands_selected (
|
|
||||||
builtin history --null --show-time="$fzf_history_time_format │ " |
|
|
||||||
_fzf_wrapper --read0 \
|
|
||||||
--print0 \
|
|
||||||
--multi \
|
|
||||||
--scheme=history \
|
|
||||||
--prompt="History> " \
|
|
||||||
--query=(commandline) \
|
|
||||||
--preview="string replace --regex '$time_prefix_regex' '' -- {} | fish_indent --ansi" \
|
|
||||||
--preview-window="bottom:3:wrap" \
|
|
||||||
$fzf_history_opts |
|
|
||||||
string split0 |
|
|
||||||
# remove timestamps from commands selected
|
|
||||||
string replace --regex $time_prefix_regex ''
|
|
||||||
)
|
|
||||||
|
|
||||||
if test $status -eq 0
|
|
||||||
commandline --replace -- $commands_selected
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process."
|
|
||||||
# Directly use ps command because it is often aliased to a different command entirely
|
|
||||||
# or with options that dirty the search results and preview output
|
|
||||||
set -f ps_cmd (command -v ps || echo "ps")
|
|
||||||
# use all caps to be consistent with ps default format
|
|
||||||
# snake_case because ps doesn't seem to allow spaces in the field names
|
|
||||||
set -f ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command')
|
|
||||||
set -f processes_selected (
|
|
||||||
$ps_cmd -A -opid,command | \
|
|
||||||
_fzf_wrapper --multi \
|
|
||||||
--prompt="Processes> " \
|
|
||||||
--query (commandline --current-token) \
|
|
||||||
--ansi \
|
|
||||||
# first line outputted by ps is a header, so we need to mark it as so
|
|
||||||
--header-lines=1 \
|
|
||||||
# ps uses exit code 1 if the process was not found, in which case show an message explaining so
|
|
||||||
--preview="$ps_cmd -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \
|
|
||||||
--preview-window="bottom:4:wrap" \
|
|
||||||
$fzf_processes_opts
|
|
||||||
)
|
|
||||||
|
|
||||||
if test $status -eq 0
|
|
||||||
for process in $processes_selected
|
|
||||||
set -f --append pids_selected (string split --no-empty --field=1 -- " " $process)
|
|
||||||
end
|
|
||||||
|
|
||||||
# string join to replace the newlines outputted by string split with spaces
|
|
||||||
commandline --current-token --replace -- (string join ' ' $pids_selected)
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
# This function expects the following two arguments:
|
|
||||||
# argument 1 = output of (set --show | psub), i.e. a file with the scope info and values of all variables
|
|
||||||
# argument 2 = output of (set --names | psub), i.e. a file with all variable names
|
|
||||||
function _fzf_search_variables --argument-names set_show_output set_names_output --description "Search and preview shell variables. Replace the current token with the selected variable."
|
|
||||||
if test -z "$set_names_output"
|
|
||||||
printf '%s\n' '_fzf_search_variables requires 2 arguments.' >&2
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
return 22 # 22 means invalid argument in POSIX
|
|
||||||
end
|
|
||||||
|
|
||||||
# Exclude the history variable from being piped into fzf because
|
|
||||||
# 1. it's not included in $set_names_output
|
|
||||||
# 2. it tends to be a very large value => increases computation time
|
|
||||||
# 3._fzf_search_history is a much better way to examine history anyway
|
|
||||||
set -f all_variable_names (string match --invert history <$set_names_output)
|
|
||||||
|
|
||||||
set -f current_token (commandline --current-token)
|
|
||||||
# Use the current token to pre-populate fzf's query. If the current token begins
|
|
||||||
# with a $, remove it from the query so that it will better match the variable names
|
|
||||||
set -f cleaned_curr_token (string replace -- '$' '' $current_token)
|
|
||||||
|
|
||||||
set -f variable_names_selected (
|
|
||||||
printf '%s\n' $all_variable_names |
|
|
||||||
_fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \
|
|
||||||
--prompt="Variables> " \
|
|
||||||
--preview-window="wrap" \
|
|
||||||
--multi \
|
|
||||||
--query=$cleaned_curr_token \
|
|
||||||
$fzf_variables_opts
|
|
||||||
)
|
|
||||||
|
|
||||||
if test $status -eq 0
|
|
||||||
# If the current token begins with a $, do not overwrite the $ when
|
|
||||||
# replacing the current token with the selected variable.
|
|
||||||
# Uses brace expansion to prepend $ to each variable name.
|
|
||||||
commandline --current-token --replace (
|
|
||||||
if string match --quiet -- '$*' $current_token
|
|
||||||
string join " " \${$variable_names_selected}
|
|
||||||
else
|
|
||||||
string join " " $variable_names_selected
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
function _fzf_wrapper --description "Prepares some environment variables before executing fzf."
|
|
||||||
# Make sure fzf uses fish to execute preview commands, some of which
|
|
||||||
# are autoloaded fish functions so don't exist in other shells.
|
|
||||||
# Use --function so that it doesn't clobber SHELL outside this function.
|
|
||||||
set -f --export SHELL (command --search fish)
|
|
||||||
|
|
||||||
# If neither FZF_DEFAULT_OPTS nor FZF_DEFAULT_OPTS_FILE are set, then set some sane defaults.
|
|
||||||
# See https://github.com/junegunn/fzf#environment-variables
|
|
||||||
set --query FZF_DEFAULT_OPTS FZF_DEFAULT_OPTS_FILE
|
|
||||||
if test $status -eq 2
|
|
||||||
# cycle allows jumping between the first and last results, making scrolling faster
|
|
||||||
# layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env
|
|
||||||
# border shows where the fzf window begins and ends
|
|
||||||
# height=90% leaves space to see the current command and some scrollback, maintaining context of work
|
|
||||||
# preview-window=wrap wraps long lines in the preview window, making reading easier
|
|
||||||
# marker=* makes the multi-select marker more distinguishable from the pointer (since both default to >)
|
|
||||||
set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"'
|
|
||||||
end
|
|
||||||
|
|
||||||
fzf $argv
|
|
||||||
end
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
function bass
|
|
||||||
set -l bash_args $argv
|
|
||||||
set -l bass_debug
|
|
||||||
if test "$bash_args[1]_" = '-d_'
|
|
||||||
set bass_debug true
|
|
||||||
set -e bash_args[1]
|
|
||||||
end
|
|
||||||
|
|
||||||
set -l script_file (mktemp)
|
|
||||||
if command -v python3 >/dev/null 2>&1
|
|
||||||
command python3 -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
|
|
||||||
else
|
|
||||||
command python -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
|
|
||||||
end
|
|
||||||
set -l bass_status $status
|
|
||||||
if test $bass_status -ne 0
|
|
||||||
return $bass_status
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -n "$bass_debug"
|
|
||||||
cat $script_file
|
|
||||||
end
|
|
||||||
source $script_file
|
|
||||||
command rm $script_file
|
|
||||||
end
|
|
||||||
|
|
||||||
function __bass_usage
|
|
||||||
echo "Usage: bass [-d] <bash-command>"
|
|
||||||
end
|
|
||||||
@@ -1,240 +0,0 @@
|
|||||||
function fisher --argument-names cmd --description "A plugin manager for Fish"
|
|
||||||
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
|
||||||
set --local fisher_version 4.4.4
|
|
||||||
set --local fish_plugins $__fish_config_dir/fish_plugins
|
|
||||||
|
|
||||||
switch "$cmd"
|
|
||||||
case -v --version
|
|
||||||
echo "fisher, version $fisher_version"
|
|
||||||
case "" -h --help
|
|
||||||
echo "Usage: fisher install <plugins...> Install plugins"
|
|
||||||
echo " fisher remove <plugins...> Remove installed plugins"
|
|
||||||
echo " fisher update <plugins...> Update installed plugins"
|
|
||||||
echo " fisher update Update all installed plugins"
|
|
||||||
echo " fisher list [<regex>] List installed plugins matching regex"
|
|
||||||
echo "Options:"
|
|
||||||
echo " -v, --version Print version"
|
|
||||||
echo " -h, --help Print this help message"
|
|
||||||
echo "Variables:"
|
|
||||||
echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~
|
|
||||||
case ls list
|
|
||||||
string match --entire --regex -- "$argv[2]" $_fisher_plugins
|
|
||||||
case install update remove
|
|
||||||
isatty || read --local --null --array stdin && set --append argv $stdin
|
|
||||||
|
|
||||||
set --local install_plugins
|
|
||||||
set --local update_plugins
|
|
||||||
set --local remove_plugins
|
|
||||||
set --local arg_plugins $argv[2..-1]
|
|
||||||
set --local old_plugins $_fisher_plugins
|
|
||||||
set --local new_plugins
|
|
||||||
|
|
||||||
test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
|
|
||||||
|
|
||||||
if ! set --query argv[2]
|
|
||||||
if test "$cmd" != update
|
|
||||||
echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
|
|
||||||
else if ! set --query file_plugins
|
|
||||||
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
|
|
||||||
end
|
|
||||||
set arg_plugins $file_plugins
|
|
||||||
end
|
|
||||||
|
|
||||||
for plugin in $arg_plugins
|
|
||||||
set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin)
|
|
||||||
contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
|
|
||||||
end
|
|
||||||
|
|
||||||
if set --query argv[2]
|
|
||||||
for plugin in $new_plugins
|
|
||||||
if contains -- "$plugin" $old_plugins
|
|
||||||
test "$cmd" = remove &&
|
|
||||||
set --append remove_plugins $plugin ||
|
|
||||||
set --append update_plugins $plugin
|
|
||||||
else if test "$cmd" = install
|
|
||||||
set --append install_plugins $plugin
|
|
||||||
else
|
|
||||||
echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
for plugin in $new_plugins
|
|
||||||
contains -- "$plugin" $old_plugins &&
|
|
||||||
set --append update_plugins $plugin ||
|
|
||||||
set --append install_plugins $plugin
|
|
||||||
end
|
|
||||||
|
|
||||||
for plugin in $old_plugins
|
|
||||||
contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
set --local pid_list
|
|
||||||
set --local source_plugins
|
|
||||||
set --local fetch_plugins $update_plugins $install_plugins
|
|
||||||
set --local fish_path (status fish-path)
|
|
||||||
|
|
||||||
echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
|
|
||||||
|
|
||||||
for plugin in $fetch_plugins
|
|
||||||
set --local source (command mktemp -d)
|
|
||||||
set --append source_plugins $source
|
|
||||||
|
|
||||||
command mkdir -p $source/{completions,conf.d,themes,functions}
|
|
||||||
|
|
||||||
$fish_path --command "
|
|
||||||
if test -e $plugin
|
|
||||||
command cp -Rf $plugin/* $source
|
|
||||||
else
|
|
||||||
set temp (command mktemp -d)
|
|
||||||
set repo (string split -- \@ $plugin) || set repo[2] HEAD
|
|
||||||
|
|
||||||
if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1])
|
|
||||||
set name (string split -- / \$path)[-1]
|
|
||||||
set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz
|
|
||||||
else
|
|
||||||
set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2]
|
|
||||||
end
|
|
||||||
|
|
||||||
echo Fetching (set_color --underline)\$url(set_color normal)
|
|
||||||
|
|
||||||
if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null
|
|
||||||
command cp -Rf \$temp/*/* $source
|
|
||||||
else
|
|
||||||
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
|
||||||
command rm -rf $source
|
|
||||||
end
|
|
||||||
|
|
||||||
command rm -rf \$temp
|
|
||||||
end
|
|
||||||
|
|
||||||
set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
|
|
||||||
" &
|
|
||||||
|
|
||||||
set --append pid_list (jobs --last --pid)
|
|
||||||
end
|
|
||||||
|
|
||||||
wait $pid_list 2>/dev/null
|
|
||||||
|
|
||||||
for plugin in $fetch_plugins
|
|
||||||
if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
|
|
||||||
if set --local index (contains --index -- "$plugin" $install_plugins)
|
|
||||||
set --erase install_plugins[$index]
|
|
||||||
else
|
|
||||||
set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for plugin in $update_plugins $remove_plugins
|
|
||||||
if set --local index (contains --index -- "$plugin" $_fisher_plugins)
|
|
||||||
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
|
||||||
|
|
||||||
if contains -- "$plugin" $remove_plugins
|
|
||||||
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
|
||||||
emit {$name}_uninstall
|
|
||||||
end
|
|
||||||
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
|
||||||
set --erase _fisher_plugins[$index]
|
|
||||||
end
|
|
||||||
|
|
||||||
command rm -rf (string replace -- \~ ~ $$plugin_files_var)
|
|
||||||
|
|
||||||
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
|
||||||
|
|
||||||
for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
|
||||||
complete --erase --command $name
|
|
||||||
end
|
|
||||||
|
|
||||||
set --erase $plugin_files_var
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if set --query update_plugins[1] || set --query install_plugins[1]
|
|
||||||
command mkdir -p $fisher_path/{functions,themes,conf.d,completions}
|
|
||||||
end
|
|
||||||
|
|
||||||
for plugin in $update_plugins $install_plugins
|
|
||||||
set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
|
|
||||||
set --local files $source/{functions,themes,conf.d,completions}/*
|
|
||||||
|
|
||||||
if set --local index (contains --index -- $plugin $install_plugins)
|
|
||||||
set --local user_files $fisher_path/{functions,themes,conf.d,completions}/*
|
|
||||||
set --local conflict_files
|
|
||||||
|
|
||||||
for file in (string replace -- $source/ $fisher_path/ $files)
|
|
||||||
contains -- $file $user_files && set --append conflict_files $file
|
|
||||||
end
|
|
||||||
|
|
||||||
if set --query conflict_files[1] && set --erase install_plugins[$index]
|
|
||||||
echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
|
|
||||||
continue
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for file in (string replace -- $source/ "" $files)
|
|
||||||
command cp -RLf $source/$file $fisher_path/$file
|
|
||||||
end
|
|
||||||
|
|
||||||
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
|
||||||
|
|
||||||
set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~)
|
|
||||||
|
|
||||||
contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
|
|
||||||
contains -- $plugin $install_plugins && set --local event install || set --local event update
|
|
||||||
|
|
||||||
printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
|
||||||
|
|
||||||
for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~)
|
|
||||||
source $file
|
|
||||||
if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
|
|
||||||
emit {$name}_$event
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
command rm -rf $source_plugins
|
|
||||||
|
|
||||||
if set --query _fisher_plugins[1]
|
|
||||||
set --local commit_plugins
|
|
||||||
|
|
||||||
for plugin in $file_plugins
|
|
||||||
contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin
|
|
||||||
end
|
|
||||||
|
|
||||||
for plugin in $_fisher_plugins
|
|
||||||
contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin
|
|
||||||
end
|
|
||||||
|
|
||||||
printf "%s\n" $commit_plugins >$fish_plugins
|
|
||||||
else
|
|
||||||
set --erase _fisher_plugins
|
|
||||||
command rm -f $fish_plugins
|
|
||||||
end
|
|
||||||
|
|
||||||
set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
|
|
||||||
|
|
||||||
test "$total" != "0 0 0" && echo (string join ", " (
|
|
||||||
test $total[1] = 0 || echo "Installed $total[1]") (
|
|
||||||
test $total[2] = 0 || echo "Updated $total[2]") (
|
|
||||||
test $total[3] = 0 || echo "Removed $total[3]")
|
|
||||||
) plugin/s
|
|
||||||
case \*
|
|
||||||
echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if ! set --query _fisher_upgraded_to_4_4
|
|
||||||
set --universal _fisher_upgraded_to_4_4
|
|
||||||
if functions --query _fisher_list
|
|
||||||
set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share
|
|
||||||
command rm -rf $XDG_DATA_HOME/fisher
|
|
||||||
functions --erase _fisher_{list,plugin_parse}
|
|
||||||
fisher update >/dev/null 2>/dev/null
|
|
||||||
else
|
|
||||||
for var in (set --names | string match --entire --regex '^_fisher_.+_files$')
|
|
||||||
set $var (string replace -- ~ \~ $$var)
|
|
||||||
end
|
|
||||||
functions --erase _fisher_fish_postexec
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
# Always installs bindings for insert and default mode for simplicity and b/c it has almost no side-effect
|
|
||||||
# https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1
|
|
||||||
function fzf_configure_bindings --description "Installs the default key bindings for fzf.fish with user overrides passed as options."
|
|
||||||
# no need to install bindings if not in interactive mode or running tests
|
|
||||||
status is-interactive || test "$CI" = true; or return
|
|
||||||
|
|
||||||
set -f options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?'
|
|
||||||
argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null
|
|
||||||
if test $status -ne 0
|
|
||||||
echo "Invalid option or a positional argument was provided." >&2
|
|
||||||
_fzf_configure_bindings_help
|
|
||||||
return 22
|
|
||||||
else if set --query _flag_help
|
|
||||||
_fzf_configure_bindings_help
|
|
||||||
return
|
|
||||||
else
|
|
||||||
# Initialize with default key sequences and then override or disable them based on flags
|
|
||||||
# index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables
|
|
||||||
set -f key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv # \c = control, \e = escape
|
|
||||||
set --query _flag_directory && set key_sequences[1] "$_flag_directory"
|
|
||||||
set --query _flag_git_log && set key_sequences[2] "$_flag_git_log"
|
|
||||||
set --query _flag_git_status && set key_sequences[3] "$_flag_git_status"
|
|
||||||
set --query _flag_history && set key_sequences[4] "$_flag_history"
|
|
||||||
set --query _flag_processes && set key_sequences[5] "$_flag_processes"
|
|
||||||
set --query _flag_variables && set key_sequences[6] "$_flag_variables"
|
|
||||||
|
|
||||||
# If fzf bindings already exists, uninstall it first for a clean slate
|
|
||||||
if functions --query _fzf_uninstall_bindings
|
|
||||||
_fzf_uninstall_bindings
|
|
||||||
end
|
|
||||||
|
|
||||||
for mode in default insert
|
|
||||||
test -n $key_sequences[1] && bind --mode $mode $key_sequences[1] _fzf_search_directory
|
|
||||||
test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log
|
|
||||||
test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status
|
|
||||||
test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history
|
|
||||||
test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes
|
|
||||||
test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command"
|
|
||||||
end
|
|
||||||
|
|
||||||
function _fzf_uninstall_bindings --inherit-variable key_sequences
|
|
||||||
bind --erase -- $key_sequences
|
|
||||||
bind --erase --mode insert -- $key_sequences
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
# Wrapper function for SDKMAN!
|
|
||||||
|
|
||||||
# Copyright (c) 2018-2023 Raphael Reitzig
|
|
||||||
# MIT License (MIT)
|
|
||||||
# https://github.com/reitzig/sdkman-for-fish
|
|
||||||
|
|
||||||
function sdk -d "Manage SDKs"
|
|
||||||
# Guard: SDKMAN! needs to be installed
|
|
||||||
if not test -f "$__fish_sdkman_init"
|
|
||||||
# Propose to install SDKMAN!
|
|
||||||
|
|
||||||
function read_confirm
|
|
||||||
while true
|
|
||||||
read -l -P "$argv[1] [y/N] " confirm
|
|
||||||
|
|
||||||
switch $confirm
|
|
||||||
case Y y
|
|
||||||
return 0
|
|
||||||
case '' N n
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if read_confirm "You don't seem to have SDKMAN! installed. Install now?"
|
|
||||||
if not which curl > /dev/null
|
|
||||||
echo "curl required"
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
if not which bash > /dev/null
|
|
||||||
echo "bash required"
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
curl -s "https://get.sdkman.io" | bash | sed '/All done!/q'
|
|
||||||
echo "Please open a new terminal/shell to load SDKMAN!"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
# Declare the _actual_ sdk command for fish
|
|
||||||
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\" && sdk $argv"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
# This file contains fish universal variable definitions.
|
# This file contains fish universal variable definitions.
|
||||||
# VERSION: 3.0
|
# VERSION: 3.0
|
||||||
|
SETUVAR --export EDITOR:/usr/bin/nvim
|
||||||
|
SETUVAR --export FZF_DEFAULT_COMMAND:fd\x20\x2d\x2dtype\x20f
|
||||||
|
SETUVAR --export FZF_DEFAULT_OPTS:\x2d\x2dcolor\x3dfg\x3a\x23f8f8f2\x2cbg\x3a\x23282a36\x2chl\x3a\x23bd93f9\x20\x2d\x2dcolor\x3dfg\x2b\x3a\x23f8f8f2\x2cbg\x2b\x3a\x2344475a\x2chl\x2b\x3a\x23bd93f9\x20\x2d\x2dcolor\x3dinfo\x3a\x23ffb86c\x2cprompt\x3a\x2350fa7b\x2cpointer\x3a\x23ff79c6\x20\x2d\x2dcolor\x3dmarker\x3a\x23ff79c6\x2cspinner\x3a\x23ffb86c\x2cheader\x3a\x236272a4
|
||||||
SETUVAR --export GOBIN:/home/fscotto/\x2elocal/share/go/bin
|
SETUVAR --export GOBIN:/home/fscotto/\x2elocal/share/go/bin
|
||||||
SETUVAR --export GOPATH:/home/fscotto/\x2elocal/share/go
|
SETUVAR --export GOPATH:/home/fscotto/\x2elocal/share/go
|
||||||
SETUVAR --export MANPAGER:sh\x20\x2dc\x20\x27col\x20\x2dbx\x20\x7c\x20bat\x20\x2dl\x20man\x20\x2dp\x27
|
SETUVAR --export MANPAGER:sh\x20\x2dc\x20\x27col\x20\x2dbx\x20\x7c\x20bat\x20\x2dl\x20man\x20\x2dp\x27
|
||||||
@@ -41,4 +44,4 @@ SETUVAR fish_pager_color_description:yellow\x1e\x2di
|
|||||||
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||||
SETUVAR fish_pager_color_selected_background:\x2dr
|
SETUVAR fish_pager_color_selected_background:\x2dr
|
||||||
SETUVAR fish_user_paths:/home/fscotto/\x2elocal/share/go/bin
|
SETUVAR fish_user_paths:/var/home/fscotto/\x2elocal/share/go
|
||||||
|
|||||||
0
fish/functions/__bass.py
Executable file → Normal file
0
fish/functions/__bass.py
Executable file → Normal file
0
fish/functions/_fzf_configure_bindings_help.fish
Executable file → Normal file
0
fish/functions/_fzf_configure_bindings_help.fish
Executable file → Normal file
0
fish/functions/_fzf_extract_var_info.fish
Executable file → Normal file
0
fish/functions/_fzf_extract_var_info.fish
Executable file → Normal file
0
fish/functions/_fzf_preview_changed_file.fish
Executable file → Normal file
0
fish/functions/_fzf_preview_changed_file.fish
Executable file → Normal file
0
fish/functions/_fzf_preview_file.fish
Executable file → Normal file
0
fish/functions/_fzf_preview_file.fish
Executable file → Normal file
0
fish/functions/_fzf_report_diff_type.fish
Executable file → Normal file
0
fish/functions/_fzf_report_diff_type.fish
Executable file → Normal file
0
fish/functions/_fzf_report_file_type.fish
Executable file → Normal file
0
fish/functions/_fzf_report_file_type.fish
Executable file → Normal file
0
fish/functions/_fzf_search_directory.fish
Executable file → Normal file
0
fish/functions/_fzf_search_directory.fish
Executable file → Normal file
0
fish/functions/_fzf_search_git_log.fish
Executable file → Normal file
0
fish/functions/_fzf_search_git_log.fish
Executable file → Normal file
0
fish/functions/_fzf_search_git_status.fish
Executable file → Normal file
0
fish/functions/_fzf_search_git_status.fish
Executable file → Normal file
0
fish/functions/_fzf_search_history.fish
Executable file → Normal file
0
fish/functions/_fzf_search_history.fish
Executable file → Normal file
0
fish/functions/_fzf_search_processes.fish
Executable file → Normal file
0
fish/functions/_fzf_search_processes.fish
Executable file → Normal file
0
fish/functions/_fzf_search_variables.fish
Executable file → Normal file
0
fish/functions/_fzf_search_variables.fish
Executable file → Normal file
0
fish/functions/_fzf_wrapper.fish
Executable file → Normal file
0
fish/functions/_fzf_wrapper.fish
Executable file → Normal file
0
fish/functions/bass.fish
Executable file → Normal file
0
fish/functions/bass.fish
Executable file → Normal file
0
fish/functions/fisher.fish
Executable file → Normal file
0
fish/functions/fisher.fish
Executable file → Normal file
0
fish/functions/fzf_configure_bindings.fish
Executable file → Normal file
0
fish/functions/fzf_configure_bindings.fish
Executable file → Normal file
0
fish/functions/sdk.fish
Executable file → Normal file
0
fish/functions/sdk.fish
Executable file → Normal file
@@ -1,39 +0,0 @@
|
|||||||
ca.desrt.dconf-editor
|
|
||||||
com.github.GradienceTeam.Gradience
|
|
||||||
com.github.KRTirtho.Spotube
|
|
||||||
com.github.tchx84.Flatseal
|
|
||||||
com.jetbrains.IntelliJ-IDEA-Ultimate
|
|
||||||
com.mattjakeman.ExtensionManager
|
|
||||||
com.vscodium.codium
|
|
||||||
io.dbeaver.DBeaverCommunity
|
|
||||||
io.github.flattool.Warehouse
|
|
||||||
io.podman_desktop.PodmanDesktop
|
|
||||||
me.iepure.devtoolbox
|
|
||||||
nl.hjdskes.gcolor3
|
|
||||||
org.fedoraproject.MediaWriter
|
|
||||||
org.filezillaproject.Filezilla
|
|
||||||
org.gnome.baobab
|
|
||||||
org.gnome.Boxes
|
|
||||||
org.gnome.Calculator
|
|
||||||
org.gnome.Calendar
|
|
||||||
org.gnome.Characters
|
|
||||||
org.gnome.clocks
|
|
||||||
org.gnome.Contacts
|
|
||||||
org.gnome.Evince
|
|
||||||
org.gnome.font-viewer
|
|
||||||
org.gnome.Logs
|
|
||||||
org.gnome.Loupe
|
|
||||||
org.gnome.Maps
|
|
||||||
org.gnome.meld
|
|
||||||
org.gnome.NautilusPreviewer
|
|
||||||
org.gnome.Snapshot
|
|
||||||
org.gnome.TextEditor
|
|
||||||
org.gnome.Weather
|
|
||||||
org.libreoffice.LibreOffice
|
|
||||||
org.mozilla.firefox
|
|
||||||
org.mozilla.Thunderbird
|
|
||||||
org.onlyoffice.desktopeditors
|
|
||||||
org.raspberrypi.rpi-imager
|
|
||||||
org.telegram.desktop
|
|
||||||
org.videolan.VLC
|
|
||||||
uk.org.greenend.chiark.sgtatham.putty
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
appindicatorsupport@rgcjonas.gmail.com
|
|
||||||
apps-menu@gnome-shell-extensions.gcampax.github.com
|
|
||||||
background-logo@fedorahosted.org
|
|
||||||
bluetooth-quick-connect@bjarosze.gmail.com
|
|
||||||
blur-my-shell@aunetx
|
|
||||||
caffeine@patapon.info
|
|
||||||
clipboard-history@alexsaveau.dev
|
|
||||||
ddterm@amezin.github.com
|
|
||||||
drive-menu@gnome-shell-extensions.gcampax.github.com
|
|
||||||
gnome-ui-tune@itstime.tech
|
|
||||||
launch-new-instance@gnome-shell-extensions.gcampax.github.com
|
|
||||||
no-overview@fthx
|
|
||||||
places-menu@gnome-shell-extensions.gcampax.github.com
|
|
||||||
quick-settings-avatar@d-go
|
|
||||||
status-area-horizontal-spacing@mathematical.coffee.gmail.com
|
|
||||||
tiling-assistant@leleat-on-github
|
|
||||||
user-theme@gnome-shell-extensions.gcampax.github.com
|
|
||||||
window-list@gnome-shell-extensions.gcampax.github.com
|
|
||||||
@@ -1,167 +0,0 @@
|
|||||||
"$schema" = 'https://starship.rs/config-schema.json'
|
|
||||||
|
|
||||||
format = """
|
|
||||||
[](color_orange)\
|
|
||||||
$os\
|
|
||||||
$username\
|
|
||||||
[](bg:color_yellow fg:color_orange)\
|
|
||||||
$directory\
|
|
||||||
[](fg:color_yellow bg:color_aqua)\
|
|
||||||
$git_branch\
|
|
||||||
$git_status\
|
|
||||||
[](fg:color_aqua bg:color_blue)\
|
|
||||||
$c\
|
|
||||||
$rust\
|
|
||||||
$golang\
|
|
||||||
$nodejs\
|
|
||||||
$php\
|
|
||||||
$java\
|
|
||||||
$kotlin\
|
|
||||||
$haskell\
|
|
||||||
$python\
|
|
||||||
[](fg:color_blue bg:color_bg3)\
|
|
||||||
$docker_context\
|
|
||||||
$conda\
|
|
||||||
[](fg:color_bg3 bg:color_bg1)\
|
|
||||||
$time\
|
|
||||||
[ ](fg:color_bg1)\
|
|
||||||
$line_break$character"""
|
|
||||||
|
|
||||||
palette = 'gruvbox_dark'
|
|
||||||
|
|
||||||
[palettes.gruvbox_dark]
|
|
||||||
color_fg0 = '#fbf1c7'
|
|
||||||
color_bg1 = '#3c3836'
|
|
||||||
color_bg3 = '#665c54'
|
|
||||||
color_blue = '#458588'
|
|
||||||
color_aqua = '#689d6a'
|
|
||||||
color_green = '#98971a'
|
|
||||||
color_orange = '#d65d0e'
|
|
||||||
color_purple = '#b16286'
|
|
||||||
color_red = '#cc241d'
|
|
||||||
color_yellow = '#d79921'
|
|
||||||
|
|
||||||
[os]
|
|
||||||
disabled = false
|
|
||||||
style = "bg:color_orange fg:color_fg0"
|
|
||||||
|
|
||||||
[os.symbols]
|
|
||||||
Windows = ""
|
|
||||||
Ubuntu = ""
|
|
||||||
SUSE = ""
|
|
||||||
Raspbian = ""
|
|
||||||
Mint = ""
|
|
||||||
Macos = ""
|
|
||||||
Manjaro = ""
|
|
||||||
Linux = ""
|
|
||||||
Gentoo = ""
|
|
||||||
Fedora = ""
|
|
||||||
Alpine = ""
|
|
||||||
Amazon = ""
|
|
||||||
Android = ""
|
|
||||||
Arch = ""
|
|
||||||
Artix = ""
|
|
||||||
CentOS = ""
|
|
||||||
Debian = ""
|
|
||||||
Redhat = ""
|
|
||||||
RedHatEnterprise = ""
|
|
||||||
|
|
||||||
[username]
|
|
||||||
show_always = true
|
|
||||||
style_user = "bg:color_orange fg:color_fg0"
|
|
||||||
style_root = "bg:color_orange fg:color_fg0"
|
|
||||||
format = '[ $user ]($style)'
|
|
||||||
|
|
||||||
[directory]
|
|
||||||
style = "fg:color_fg0 bg:color_yellow"
|
|
||||||
format = "[ $path ]($style)"
|
|
||||||
truncation_length = 3
|
|
||||||
truncation_symbol = "…/"
|
|
||||||
|
|
||||||
[directory.substitutions]
|
|
||||||
"Documents" = " "
|
|
||||||
"Downloads" = " "
|
|
||||||
"Music" = " "
|
|
||||||
"Pictures" = " "
|
|
||||||
"Developer" = " "
|
|
||||||
|
|
||||||
[git_branch]
|
|
||||||
symbol = ""
|
|
||||||
style = "bg:color_aqua"
|
|
||||||
format = '[[ $symbol $branch ](fg:color_fg0 bg:color_aqua)]($style)'
|
|
||||||
|
|
||||||
[git_status]
|
|
||||||
style = "bg:color_aqua"
|
|
||||||
format = '[[($all_status$ahead_behind )](fg:color_fg0 bg:color_aqua)]($style)'
|
|
||||||
|
|
||||||
[nodejs]
|
|
||||||
symbol = ""
|
|
||||||
style = "bg:color_blue"
|
|
||||||
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
|
|
||||||
|
|
||||||
[c]
|
|
||||||
symbol = " "
|
|
||||||
style = "bg:color_blue"
|
|
||||||
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
|
|
||||||
|
|
||||||
[rust]
|
|
||||||
symbol = ""
|
|
||||||
style = "bg:color_blue"
|
|
||||||
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
|
|
||||||
|
|
||||||
[golang]
|
|
||||||
symbol = ""
|
|
||||||
style = "bg:color_blue"
|
|
||||||
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
|
|
||||||
|
|
||||||
[php]
|
|
||||||
symbol = ""
|
|
||||||
style = "bg:color_blue"
|
|
||||||
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
|
|
||||||
|
|
||||||
[java]
|
|
||||||
symbol = " "
|
|
||||||
style = "bg:color_blue"
|
|
||||||
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
|
|
||||||
|
|
||||||
[kotlin]
|
|
||||||
symbol = ""
|
|
||||||
style = "bg:color_blue"
|
|
||||||
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
|
|
||||||
|
|
||||||
[haskell]
|
|
||||||
symbol = ""
|
|
||||||
style = "bg:color_blue"
|
|
||||||
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
|
|
||||||
|
|
||||||
[python]
|
|
||||||
symbol = ""
|
|
||||||
style = "bg:color_blue"
|
|
||||||
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
|
|
||||||
|
|
||||||
[docker_context]
|
|
||||||
symbol = ""
|
|
||||||
style = "bg:color_bg3"
|
|
||||||
format = '[[ $symbol( $context) ](fg:#83a598 bg:color_bg3)]($style)'
|
|
||||||
|
|
||||||
[conda]
|
|
||||||
style = "bg:color_bg3"
|
|
||||||
format = '[[ $symbol( $environment) ](fg:#83a598 bg:color_bg3)]($style)'
|
|
||||||
|
|
||||||
[time]
|
|
||||||
disabled = false
|
|
||||||
time_format = "%R"
|
|
||||||
style = "bg:color_bg1"
|
|
||||||
format = '[[ $time ](fg:color_fg0 bg:color_bg1)]($style)'
|
|
||||||
|
|
||||||
[line_break]
|
|
||||||
disabled = false
|
|
||||||
|
|
||||||
[character]
|
|
||||||
disabled = false
|
|
||||||
success_symbol = '[](bold fg:color_green)'
|
|
||||||
error_symbol = '[](bold fg:color_red)'
|
|
||||||
vimcmd_symbol = '[](bold fg:color_green)'
|
|
||||||
vimcmd_replace_one_symbol = '[](bold fg:color_purple)'
|
|
||||||
vimcmd_replace_symbol = '[](bold fg:color_purple)'
|
|
||||||
vimcmd_visual_symbol = '[](bold fg:color_yellow)'
|
|
||||||
Reference in New Issue
Block a user