commit e1f49b887839253fe5f2229efe6c1999f3e33c44 Author: Julius Klotz Date: Fri Feb 21 11:32:33 2025 +0100 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..6840b55 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# My dotfiles +- emacs setup with standard keybindings +- configuration for Alacritty terminal +- zsh +- vimrc for neovim diff --git a/alacritty/alacritty.toml b/alacritty/alacritty.toml new file mode 100644 index 0000000..063b47e --- /dev/null +++ b/alacritty/alacritty.toml @@ -0,0 +1,82 @@ +[colors.bright] +black = "#4c566a" +blue = "#81a1c1" +cyan = "#8fbcbb" +green = "#a3be8c" +magenta = "#b48ead" +red = "#bf616a" +white = "#eceff4" +yellow = "#ebcb8b" + +[colors.cursor] +cursor = "#d8dee9" +text = "#2e3440" + +[colors.dim] +black = "#373e4d" +blue = "#68809a" +cyan = "#6d96a5" +green = "#809575" +magenta = "#8c738c" +red = "#94545d" +white = "#aeb3bb" +yellow = "#b29e75" + +[colors.normal] +black = "#3b4252" +blue = "#81a1c1" +cyan = "#88c0d0" +green = "#a3be8c" +magenta = "#b48ead" +red = "#bf616a" +white = "#e5e9f0" +yellow = "#ebcb8b" + +[colors.primary] +background = "#2e3440" +dim_foreground = "#a5abb6" +foreground = "#d8dee9" + +[colors.search.matches] +background = "#88c0d0" +foreground = "CellBackground" + +[colors.selection] +background = "#4c566a" +text = "CellForeground" + +[colors.vi_mode_cursor] +cursor = "#d8dee9" +text = "#2e3440" + +[env] +TERM = "alacritty-direct" + +[font] +size = 15 + +[font.offset] +y = 4 + +[font.bold] +family = "Fira Code" +style = "SemiBold" + +[font.bold_italic] +family = "Fira Code" +style = "Bold" + +[font.italic] +family = "Fira Code" +style = "Italic" + +[font.normal] +family = "Fira Code" +style = "Medium" + +[shell] +program = "/opt/homebrew/bin/zsh" + +[window.padding] +x = 12 +y = 12 diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml new file mode 100644 index 0000000..b6ced90 --- /dev/null +++ b/alacritty/alacritty.yml @@ -0,0 +1,50 @@ +font: + normal: + family: JetBrains Mono + style: Regular + + bold: + family: JetBrains Mono + style: Bold + + italic: + family: JetBrains Mono + style: Italic + + bold_italic: + family: JetBrains Mono + style: Bold Italic + + size: 14 + +shell: + program: /opt/homebrew/bin/fish + +# Colors (One Dark) +colors: + # Default colors + primary: + background: '0x1e2127' + foreground: '0xabb2bf' + + # Normal colors + normal: + black: '0x1e2127' + red: '0xe06c75' + green: '0x98c379' + yellow: '0xd19a66' + blue: '0x61afef' + magenta: '0xc678dd' + cyan: '0x56b6c2' + white: '0xabb2bf' + + # Bright colors + bright: + black: '0x5c6370' + red: '0xe06c75' + green: '0x98c379' + yellow: '0xd19a66' + blue: '0x61afef' + magenta: '0xc678dd' + cyan: '0x56b6c2' + white: '0xffffff' diff --git a/doom/config.el b/doom/config.el new file mode 100644 index 0000000..b108938 --- /dev/null +++ b/doom/config.el @@ -0,0 +1,78 @@ +;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- + +;; Place your private configuration here! Remember, you do not need to run 'doom +;; sync' after modifying this file! + + +;; Some functionality uses this to identify you, e.g. GPG configuration, email +;; clients, file templates and snippets. It is optional. +(setq user-full-name "Julius Klotz" + user-mail-address "julius.klotz01@sap.com") + + +(setq doom-font (font-spec :family "JetBrains Mono" :size 14 )) +;; Doom exposes five (optional) variables for controlling fonts in Doom: +;; +;; - `doom-font' -- the primary font to use +;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable) +;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for +;; presentations or streaming. +;; - `doom-unicode-font' -- for unicode glyphs +;; - `doom-serif-font' -- for the `fixed-pitch-serif' face +;; +;; See 'C-h v doom-font' for documentation and more examples of what they +;; accept. For example: +;; +;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light) +;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13)) +;; +;; If you or Emacs can't find your font, use 'M-x describe-font' to look them +;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to +;; refresh your font settings. If Emacs still can't find your font, it likely +;; wasn't installed correctly. Font issues are rarely Doom issues! + +;; There are two ways to load a theme. Both assume the theme is installed and +;; available. You can either set `doom-theme' or manually load a theme with the +;; `load-theme' function. This is the default: +(setq doom-theme 'doom-vibrant) + +;; This determines the style of line numbers in effect. If set to `nil', line +;; numbers are disabled. For relative line numbers, set this to `relative'. +(setq display-line-numbers-type 'relative) + +;; If you use `org' and don't want your org files in the default location below, +;; change `org-directory'. It must be set before org loads! +(setq org-directory "~/org/") + + +;; Whenever you reconfigure a package, make sure to wrap your config in an +;; `after!' block, otherwise Doom's defaults may override your settings. E.g. +;; +;; (after! PACKAGE +;; (setq x y)) +;; +;; The exceptions to this rule: +;; +;; - Setting file/directory variables (like `org-directory') +;; - Setting variables which explicitly tell you to set them before their +;; package is loaded (see 'C-h v VARIABLE' to look up their documentation). +;; - Setting doom variables (which start with 'doom-' or '+'). +;; +;; Here are some additional functions/macros that will help you configure Doom. +;; +;; - `load!' for loading external *.el files relative to this one +;; - `use-package!' for configuring packages +;; - `after!' for running code after a package has loaded +;; - `add-load-path!' for adding directories to the `load-path', relative to +;; this file. Emacs searches the `load-path' when you load packages with +;; `require' or `use-package'. +;; - `map!' for binding new keys +;; +;; To get information about any of these functions/macros, move the cursor over +;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). +;; This will open documentation for it, including demos of how they are used. +;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces, +;; etc). +;; +;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how +;; they are implemented. diff --git a/doom/custom.el b/doom/custom.el new file mode 100644 index 0000000..27fdc69 --- /dev/null +++ b/doom/custom.el @@ -0,0 +1,47 @@ +(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. + '(ansi-color-names-vector + ["#282828" "#fb4934" "#b8bb26" "#fabd2f" "#83a598" "#cc241d" "#8ec07c" "#ebdbb2"]) + '(custom-safe-themes + '("0d01e1e300fcafa34ba35d5cf0a21b3b23bc4053d388e352ae6a901994597ab1" "c4063322b5011829f7fdd7509979b5823e8eea2abf1fe5572ec4b7af1dd78519" default)) + '(exwm-floating-border-color "#504945") + '(fci-rule-color "#7c6f64") + '(highlight-tail-colors ((("#363627" "#363627") . 0) (("#323730" "#323730") . 20))) + '(jdee-db-active-breakpoint-face-colors (cons "#0d1011" "#fabd2f")) + '(jdee-db-requested-breakpoint-face-colors (cons "#0d1011" "#b8bb26")) + '(jdee-db-spec-breakpoint-face-colors (cons "#0d1011" "#928374")) + '(objed-cursor-color "#fb4934") + '(pdf-view-midnight-colors (cons "#ebdbb2" "#282828")) + '(rustic-ansi-faces + ["#282828" "#fb4934" "#b8bb26" "#fabd2f" "#83a598" "#cc241d" "#8ec07c" "#ebdbb2"]) + '(vc-annotate-background "#282828") + '(vc-annotate-color-map + (list + (cons 20 "#b8bb26") + (cons 40 "#cebb29") + (cons 60 "#e3bc2c") + (cons 80 "#fabd2f") + (cons 100 "#fba827") + (cons 120 "#fc9420") + (cons 140 "#fe8019") + (cons 160 "#ed611a") + (cons 180 "#dc421b") + (cons 200 "#cc241d") + (cons 220 "#db3024") + (cons 240 "#eb3c2c") + (cons 260 "#fb4934") + (cons 280 "#e05744") + (cons 300 "#c66554") + (cons 320 "#ac7464") + (cons 340 "#7c6f64") + (cons 360 "#7c6f64"))) + '(vc-annotate-very-old-color nil)) +(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. + ) diff --git a/doom/init.el b/doom/init.el new file mode 100644 index 0000000..fb81fb8 --- /dev/null +++ b/doom/init.el @@ -0,0 +1,191 @@ +;;; init.el -*- lexical-binding: t; -*- + +;; This file controls what Doom modules are enabled and what order they load +;; in. Remember to run 'doom sync' after modifying it! + +;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's +;; documentation. There you'll find a link to Doom's Module Index where all +;; of our modules are listed, including what flags they support. + +;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or +;; 'C-c c k' for non-vim users) to view its documentation. This works on +;; flags as well (those symbols that start with a plus). +;; +;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its +;; directory (for easy access to its source code). + +(doom! :input + ;;chinese + ;;japanese + ;;layout ; auie,ctsrnm is the superior home row + + :completion + company ; the ultimate code completion backend + ;;helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + ivy ; a search engine for love and life + vertico ; the search engine of the future + + :ui + ;;deft ; notational velocity for Emacs + doom ; what makes DOOM look the way it does + doom-dashboard ; a nifty splash screen for Emacs + ;;doom-quit ; DOOM quit-message prompts when you quit Emacs + ;;(emoji +unicode) ; ๐Ÿ™‚ + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + ;;hydra + ;;indent-guides ; highlighted indent columns + ;;ligatures ; ligatures and symbols to make your code pretty again + ;;minimap ; show a map of the code on the side + modeline ; snazzy, Atom-inspired modeline, plus API + ;;nav-flash ; blink cursor line after big motions + neotree ; a project drawer, like NERDTree for vim + ophints ; highlight the region an operation acts on + (popup +defaults) ; tame sudden yet inevitable temporary windows + ;;tabs ; a tab bar for Emacs + ;;treemacs ; a project drawer, like neotree but cooler + ;;unicode ; extended unicode support for various languages + vc-gutter ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + ;;window-select ; visually switch windows + workspaces ; tab emulation, persistence & separate workspaces + ;;zen ; distraction-free coding or writing + + :editor + (evil +everywhere); come to the dark side, we have cookies + file-templates ; auto-snippets for empty files + fold ; (nigh) universal code folding + ;;(format +onsave) ; automated prettiness + ;;god ; run Emacs commands without modifier keys + ;;lispy ; vim for lisp, for people who don't like vim + ;;multiple-cursors ; editing in many places at once + ;;objed ; text object editing for the innocent + ;;parinfer ; turn lisp into python, sort of + ;;rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + ;;word-wrap ; soft wrapping with language-aware indent + + :emacs + dired ; making dired pretty [functional] + electric ; smarter, keyword-based electric-indent + ;;ibuffer ; interactive buffer management + undo ; persistent, smarter undo for your inevitable mistakes + vc ; version-control and Emacs, sitting in a tree + + :term + ;;eshell ; the elisp shell that works everywhere + ;;shell ; simple shell REPL for Emacs + ;;term ; basic terminal emulator for Emacs + vterm ; the best terminal emulation in Emacs + + :checkers + syntax ; tasing you for every semicolon you forget + ;;(spell +flyspell) ; tasing you for misspelling mispelling + ;;grammar ; tasing grammar mistake every you make + + :tools + ;;ansible + ;;biblio ; Writes a PhD for you (citation needed) + ;;debugger ; FIXME stepping through code, to help you add bugs + ;;direnv + ;;docker + ;;editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + ;;gist ; interacting with github gists + lookup ; navigate your code and its documentation + ;;lsp ; M-x vscode + magit ; a git porcelain for Emacs + ;;make ; run make tasks from Emacs + ;;pass ; password manager for nerds + ;;pdf ; pdf enhancements + ;;prodigy ; FIXME managing external services & code builders + ;;rgb ; creating color strings + ;;taskrunner ; taskrunner for all your projects + ;;terraform ; infrastructure as code + ;;tmux ; an API for interacting with tmux + ;;upload ; map local to remote projects via ssh/ftp + + :os + (:if IS-MAC macos) ; improve compatibility with macOS + ;;tty ; improve the terminal Emacs experience + + :lang + ;;agda ; types of types of types of types... + ;;beancount ; mind the GAAP + ;;(cc +lsp) ; C > C++ == 1 + ;;clojure ; java with a lisp + ;;common-lisp ; if you've seen one lisp, you've seen them all + ;;coq ; proofs-as-programs + ;;crystal ; ruby at the speed of c + ;;csharp ; unity, .NET, and mono shenanigans + ;;data ; config/data formats + ;;(dart +flutter) ; paint ui and not much else + ;;dhall + ;;elixir ; erlang done right + ;;elm ; care for a cup of TEA? + emacs-lisp ; drown in parentheses + ;;erlang ; an elegant language for a more civilized age + ;;ess ; emacs speaks statistics + ;;factor + ;;faust ; dsp, but you get to keep your soul + ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER) + ;;fsharp ; ML stands for Microsoft's Language + ;;fstar ; (dependent) types and (monadic) effects and Z3 + ;;gdscript ; the language you waited for + ;;(go +lsp) ; the hipster dialect + ;;(haskell +lsp) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + ;;idris ; a language you can depend on + json ; At least it ain't XML + (java +lsp) ; the poster child for carpal tunnel syndrome + ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) + ;;julia ; a better, faster MATLAB + ;;kotlin ; a better, slicker Java(Script) + ;;latex ; writing papers in Emacs has never been so fun + ;;lean ; for folks with too much to prove + ;;ledger ; be audit you can be + ;;lua ; one-based indices? one-based indices + markdown ; writing docs for people to ignore + ;;nim ; python + lisp at the speed of c + ;;nix ; I hereby declare "nix geht mehr!" + ;;ocaml ; an objective camel + org ; organize your plain life in plain text + ;;php ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + ;;purescript ; javascript, but functional + ;;python ; beautiful is better than ugly + ;;qt ; the 'cutest' gui framework ever + ;;racket ; a DSL for DSLs + ;;raku ; the artist formerly known as perl6 + ;;rest ; Emacs as a REST client + ;;rst ; ReST in peace + ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;scala ; java, but good + ;;(scheme +guile) ; a fully conniving family of lisps + sh ; she sells {ba,z,fi}sh shells on the C xor + ;;sml + ;;solidity ; do you need a blockchain? No. + ;;swift ; who asked for emoji variables? + ;;terra ; Earth and Moon in alignment for performance. + ;;web ; the tubes + ;;yaml ; JSON, but readable + ;;zig ; C, but simpler + + :email + (mu4e +org +gmail) + ;;notmuch + ;;(wanderlust +gmail) + + :app + ;;calendar + ;;emms + ;;everywhere ; *leave* Emacs!? You must be joking + ;;irc ; how neckbeards socialize + ;;(rss +org) ; emacs as an RSS reader + ;;twitter ; twitter client https://twitter.com/vnought + + :config + ;;literate + (default +bindings +smartparens)) diff --git a/doom/packages.el b/doom/packages.el new file mode 100644 index 0000000..1c80ffc --- /dev/null +++ b/doom/packages.el @@ -0,0 +1,52 @@ +;; -*- no-byte-compile: t; -*- +;;; $DOOMDIR/packages.el + +;; To install a package with Doom you must declare them here and run 'doom sync' +;; on the command line, then restart Emacs for the changes to take effect -- or +;; use 'M-x doom/reload'. + + +;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: +;(package! some-package) + +;; To install a package directly from a remote git repo, you must specify a +;; `:recipe'. You'll find documentation on what `:recipe' accepts here: +;; https://github.com/raxod502/straight.el#the-recipe-format +;(package! another-package +; :recipe (:host github :repo "username/repo")) + +;; If the package you are trying to install does not contain a PACKAGENAME.el +;; file, or is located in a subdirectory of the repo, you'll need to specify +;; `:files' in the `:recipe': +;(package! this-package +; :recipe (:host github :repo "username/repo" +; :files ("some-file.el" "src/lisp/*.el"))) + +;; If you'd like to disable a package included with Doom, you can do so here +;; with the `:disable' property: +;(package! builtin-package :disable t) + +;; You can override the recipe of a built in package without having to specify +;; all the properties for `:recipe'. These will inherit the rest of its recipe +;; from Doom or MELPA/ELPA/Emacsmirror: +;(package! builtin-package :recipe (:nonrecursive t)) +;(package! builtin-package-2 :recipe (:repo "myfork/package")) + +;; Specify a `:branch' to install a package from a particular branch or tag. +;; This is required for some packages whose default branch isn't 'master' (which +;; our package manager can't deal with; see raxod502/straight.el#279) +;(package! builtin-package :recipe (:branch "develop")) + +;; Use `:pin' to specify a particular commit to install. +;(package! builtin-package :pin "1a2b3c4d5e") + + +;; Doom's packages are pinned to a specific commit and updated from release to +;; release. The `unpin!' macro allows you to unpin single packages... +;(unpin! pinned-package) +;; ...or multiple packages +;(unpin! pinned-package another-pinned-package) +;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) +;(unpin! t) + +(package! tldr) diff --git a/emacs/init.el b/emacs/init.el new file mode 100644 index 0000000..a0229f1 --- /dev/null +++ b/emacs/init.el @@ -0,0 +1,232 @@ +(setq inhibit-startup-message t) + +(scroll-bar-mode -1) ; Disable visible scrollbar +(tool-bar-mode -1) ; Disable the toolbar +(tooltip-mode -1) ; Disable tooltips +(set-fringe-mode 10) ; Give some breathing room + +(menu-bar-mode -1) ; Disable the menu bar + +;; Set up the visible bell (setq visible-bell t) + +(set-face-attribute 'default nil :font "JetBrains Mono" :height 140) + +(global-display-line-numbers-mode t) +;; disable line numbers for some modes +(dolist (mode '(term-mode-hook + shell-mode-hook + eshell-mode-hook)) + (add-hook mode (lambda () (display-line-numbers-mode 0)))) +(global-set-key (kbd "") 'keyboard-escape-quit) + +(require 'package) + +(setq package-archives '(("melpa" . "https://melpa.org/packages/") + ("org" . "https://orgmode.org/elpa/") + ("elpa" . "https://elpa.gnu.org/packages/"))) + +(package-initialize) +(unless package-archive-contents + (package-refresh-contents)) + +;; Initialize use-package on non-Linux platforms +(unless (package-installed-p 'use-package) + (package-install 'use-package)) + +(require 'use-package) +(setq use-package-always-ensure t) + +(use-package ivy + :diminish + :bind (("C-s" . swiper) + :map ivy-minibuffer-map + ("TAB" . ivy-alt-done) + ("C-l" . ivy-alt-done) + ("C-j" . ivy-next-line) + ("C-k" . ivy-previous-line) + :map ivy-switch-buffer-map + ("C-k" . ivy-previous-line) + ("C-l" . ivy-done) + ("C-d" . ivy-switch-buffer-kill) + :map ivy-reverse-i-search-map + ("C-k" . ivy-previous-line) + ("C-d" . ivy-reverse-i-search-kill)) + :config + (ivy-mode 1)) +(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. + '(ispell-dictionary nil) + '(package-selected-packages + '(elfeed tide company-quickhelp company-quick-help company flycheck lsp-ui lsp-mode rustic evil-magit magit counsel-projectile projectile evil-collection evil general counsel ivy-rich which-key rainbow-delimiters doom-themes all-the-icons doom-modeline ivy use-package))) +(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. + ) + + +(use-package all-the-icons) + +(use-package doom-themes + :init (load-theme 'doom-palenight t)) + +(use-package rainbow-delimiters + :hook (prog-mode . rainbow-delimiters-mode)) + +(use-package which-key + :init (which-key-mode) + :diminish which-key-mode + :config + (setq which-key-idle-delay 1)) + +(use-package ivy-rich + :init + (ivy-rich-mode 1)) + +(use-package counsel + :bind (("M-x" . counsel-M-x) + ("C-x b" . counsel-ibuffer) + ("C-x C-f" . counsel-find-file) + :map minibuffer-local-map + ("C-r" . 'counsel-minibuffer-history))) + +(use-package general + :config + (general-create-definer rune/leader-keys + :keymaps '(normal insert visual emacs) + :prefix "SPC" + :global-prefix "C-SPC") + + (rune/leader-keys + "t" '(:ignore t :which-key "toggles") + "tt" '(counsel-load-theme :which-key "choose theme") + "p" '(projectile-command-map :which-key "projectile") + "l" '(:ignore l :which-key "lsp") + "lf" '(lsp-format-buffer :which-key "format buffer") + "o" '(:ignore o :which-key "org") + "oa" '(org-agenda :which-key "agenda") + "oy" '(org-yank :which.key "yank"))) + +(use-package evil + :init + (setq evil-want-integration t) + (setq evil-want-keybinding nil) + (setq evil-want-C-u-scroll t) + (setq evil-want-C-i-jump nil) + :config + (evil-mode 1) + (define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) + (define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) + (define-key evil-normal-state-map (kbd "K") 'lsp-ui-doc-toggle) + (define-key evil-normal-state-map (kbd "L") 'lsp-ui-sideline-toggle-code-actions) + + ;; Use visual line motions even outside of visual-line-mode buffers + (evil-global-set-key 'motion "j" 'evil-next-visual-line) + (evil-global-set-key 'motion "k" 'evil-previous-visual-line) + + (evil-set-initial-state 'messages-buffer-mode 'normal) + (evil-set-initial-state 'dashboard-mode 'normal)) + +(use-package evil-collection + :after evil + :config + (evil-collection-init)) + + +(use-package projectile + :diminish projectile-mode + :config (projectile-mode) + :custom ((projectile-completion-system 'ivy)) + :bind-keymap + ("C-c p" . projectile-command-map) + :init + ;; NOTE: Set this to the folder where you keep your Git repos! + (when (file-directory-p "~/Projects/Code") + (setq projectile-project-search-path '("~/Projects/Code"))) + (setq projectile-switch-project-action #'projectile-dired)) + +(use-package counsel-projectile + :config (counsel-projectile-mode)) + +(use-package magit + :custom + (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) + +(use-package rustic) + +(use-package lsp-mode + :ensure + :commands lsp + :custom + (lsp-rust-analyzer-cargo-watch-command "clippy") + (lsp-eldoc-render-all t) + (lsp-idle-delay 0.6) + :config + (add-hook 'lsp-mode-hook 'lsp-ui-mode)) + +(use-package lsp-ui + :ensure + :commands lsp-ui-mode + :custom + (lsp-ui-peek-always-show t) + (lsp-ui-sideline-show-hover t) + (lsp-ui-doc-enable nil)) + + +(use-package flycheck :ensure) + +(use-package company + :ensure + :bind + (:map company-active-map + ("C-n". company-select-next) + ("C-p". company-select-previous)) + (:map company-mode-map + ("". tab-indent-or-complete) + ("TAB". tab-indent-or-complete))) + +(global-set-key (kbd "C-j") 'next-error) +(global-set-key (kbd "C-k") 'previous-error) + + +(setq make-backup-files nil) ; stop creating ~ files +(setq lsp-signature-auto-activate nil) +(setq lsp-eldoc-enable-hover nil) +(setq lsp-ui-sideline-show-code-actions nil) +(setq lsp-ui-sideline-show-symbol nil) +(setq lsp-ui-sideline-show-hover nil) + +(use-package dired + :ensure nil + :commands (dired dired-jump) + :bind (("C-x C-j" . dired-jump)) + :custom ((dired-listing-switches "-agho --group-directories-first")) + :config + (evil-collection-define-key 'normal 'dired-mode-map + "h" 'dired-up-directory + "l" 'dired-single-buffer)) + + +(use-package tide :ensure t) + +(defun setup-tide-mode () + (interactive) + (tide-setup) + (flycheck-mode +1) + (setq flycheck-check-syntax-automatically '(save mode-enabled)) + (eldoc-mode +1) + + (company-mode +1)) + + +(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)) +(add-hook 'web-mode-hook + (lambda () + (when (string-equal "tsx" (file-name-extension buffer-file-name)) + (setup-tide-mode)))) + + diff --git a/fish/completions/fisher.fish b/fish/completions/fisher.fish new file mode 100644 index 0000000..6d23ce4 --- /dev/null +++ b/fish/completions/fisher.fish @@ -0,0 +1,7 @@ +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)" diff --git a/fish/completions/fzf_configure_bindings.fish b/fish/completions/fzf_configure_bindings.fish new file mode 100644 index 0000000..ec7db93 --- /dev/null +++ b/fish/completions/fzf_configure_bindings.fish @@ -0,0 +1,8 @@ +complete fzf_configure_bindings --no-files +complete fzf_configure_bindings --long help --short h --description "Print help" +complete fzf_configure_bindings --long directory --description "Change the key binding for searching directory" +complete fzf_configure_bindings --long git_log --description "Change the key binding for searching git log" +complete fzf_configure_bindings --long git_status --description "Change the key binding for searching git status" +complete fzf_configure_bindings --long history --description "Change the key binding for searching history" +complete fzf_configure_bindings --long processes --description "Change the key binding for searching processes" +complete fzf_configure_bindings --long variables --description "Change the key binding for searching variables" diff --git a/fish/conf.d/_pure_init.fish b/fish/conf.d/_pure_init.fish new file mode 100644 index 0000000..4a0f421 --- /dev/null +++ b/fish/conf.d/_pure_init.fish @@ -0,0 +1,25 @@ +# Deactivate the default virtualenv prompt so that we can add our own +set --global --export VIRTUAL_ENV_DISABLE_PROMPT 1 + +# Whether or not is a fresh session +set --global _pure_fresh_session true + +# Register `_pure_prompt_new_line` as an event handler fot `fish_prompt` +functions --query _pure_prompt_new_line + +function _pure_uninstall --on-event pure_uninstall + # erase _pure* variables + set --names \ + | string replace --filter --regex '(^_?pure)' 'set --erase $1' \ + | source + # erase _pure* functions + functions --names --all \ + | string replace --filter --regex '(^_?pure)' 'functions --erase $1' \ + | source + # delete _pure* files + for file in $__fish_config_dir/{functions,conf.d}/_pure_* + rm $file + end + # restore fish_prompt to default + cp {$__fish_data_dir,$__fish_config_dir}/functions/fish_prompt.fish +end diff --git a/fish/conf.d/autopair.fish b/fish/conf.d/autopair.fish new file mode 100644 index 0000000..abb4bf3 --- /dev/null +++ b/fish/conf.d/autopair.fish @@ -0,0 +1,39 @@ +status is-interactive || exit + +set --global autopair_left "(" "[" "{" '"' "'" +set --global autopair_right ")" "]" "}" '"' "'" +set --global autopair_pairs "()" "[]" "{}" '""' "''" + +function _autopair_fish_key_bindings --on-variable fish_key_bindings + set --query fish_key_bindings[1] || return + + test $fish_key_bindings = fish_default_key_bindings && + set --local mode default insert || + set --local mode insert default + + bind --mode $mode[-1] --erase \177 \b \t + + bind --mode $mode[1] \177 _autopair_backspace # macOS โŒซ + bind --mode $mode[1] \b _autopair_backspace + bind --mode $mode[1] \t _autopair_tab + + printf "%s\n" $autopair_pairs | while read --local left right --delimiter "" + bind --mode $mode[-1] --erase $left $right + if test $left = $right + bind --mode $mode[1] $left "_autopair_insert_same \\$left" + else + bind --mode $mode[1] $left "_autopair_insert_left \\$left \\$right" + bind --mode $mode[1] $right "_autopair_insert_right \\$right" + end + end +end + +_autopair_fish_key_bindings + +function _autopair_uninstall --on-event autopair_uninstall + string collect ( + bind --all | string replace --filter --regex -- "_autopair.*" --erase + set --names | string replace --filter --regex -- "^autopair" "set --erase autopair" + ) | source + functions --erase (functions --all | string match "_autopair_*") +end diff --git a/fish/conf.d/fzf.fish b/fish/conf.d/fzf.fish new file mode 100644 index 0000000..8156c11 --- /dev/null +++ b/fish/conf.d/fzf.fish @@ -0,0 +1,28 @@ +# 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 diff --git a/fish/conf.d/pure.fish b/fish/conf.d/pure.fish new file mode 100644 index 0000000..9f78ab7 --- /dev/null +++ b/fish/conf.d/pure.fish @@ -0,0 +1,91 @@ +set --global pure_version 4.4.3 # For bug report and tag-after-merge workflow + +# Base colors +_pure_set_default pure_color_primary blue +_pure_set_default pure_color_info cyan +_pure_set_default pure_color_mute brblack +_pure_set_default pure_color_success magenta +_pure_set_default pure_color_normal normal +_pure_set_default pure_color_danger red +_pure_set_default pure_color_light white +_pure_set_default pure_color_warning yellow +_pure_set_default pure_color_dark black + +# Prompt +_pure_set_default pure_symbol_prompt "โฏ" +_pure_set_default pure_symbol_reverse_prompt "โฎ" # used for VI mode +_pure_set_default pure_color_prompt_on_error pure_color_danger +_pure_set_default pure_color_prompt_on_success pure_color_success + +# Current Working Directory +_pure_set_default pure_color_current_directory pure_color_primary + +# Git +_pure_set_default pure_enable_git true +_pure_set_default pure_symbol_git_unpulled_commits "โ‡ฃ" +_pure_set_default pure_symbol_git_unpushed_commits "โ‡ก" +_pure_set_default pure_symbol_git_dirty "*" +_pure_set_default pure_symbol_git_stash "โ‰ก" +_pure_set_default pure_color_git_unpulled_commits pure_color_info +_pure_set_default pure_color_git_unpushed_commits pure_color_info +_pure_set_default pure_color_git_branch pure_color_mute +_pure_set_default pure_color_git_dirty pure_color_mute +_pure_set_default pure_color_git_stash pure_color_info + +# Remote info (user@hostname) for SSH and containers (Docker/LXC) +_pure_set_default pure_color_hostname pure_color_mute +_pure_set_default pure_color_at_sign pure_color_mute +_pure_set_default pure_color_username_normal pure_color_mute +_pure_set_default pure_color_username_root pure_color_light + +# Number of running jobs +_pure_set_default pure_show_jobs false +_pure_set_default pure_color_jobs pure_color_normal + +# Show system time +_pure_set_default pure_show_system_time false +_pure_set_default pure_color_system_time pure_color_mute + +# Virtualenv for Python +_pure_set_default pure_color_virtualenv pure_color_mute + +# Print current working directory at the beginning of prompt +# true (default): current directory, git, user@hostname (ssh-only), command duration +# false: user@hostname (ssh-only), current directory, git, command duration +_pure_set_default pure_begin_prompt_with_current_directory true + +# Show exit code of last command as a separate prompt character (cf. https://github.com/sindresorhus/pure/wiki#show-exit-code-of-last-command-as-a-separate-prompt-character) +# false - single prompt character, default +# true - separate prompt character +_pure_set_default pure_separate_prompt_on_error false + +# Max execution time of a process before its run time is shown when it exits +_pure_set_default pure_threshold_command_duration 5 +_pure_set_default pure_show_subsecond_command_duration false +_pure_set_default pure_color_command_duration pure_color_warning + +# VI mode indicator +# true (default): indicate a non-insert mode by reversing the prompt symbol (โฎ) +# false: indicate vi mode with [I], [N], [V] +_pure_set_default pure_reverse_prompt_symbol_in_vimode true + +# Title +_pure_set_default pure_symbol_title_bar_separator - + +# Check for new release on startup +_pure_set_default pure_check_for_new_release false + +# Prefix prompt when logged in as root +_pure_set_default pure_show_prefix_root_prompt false +_pure_set_default pure_symbol_prefix_root_prompt "#" +_pure_set_default pure_color_prefix_root_prompt pure_color_danger + +# Compact mode +_pure_set_default pure_enable_single_line_prompt false + +# Detect when running in container (e.g. docker, podman, LXC/LXD) +_pure_set_default pure_enable_container_detection true +_pure_set_default pure_symbol_container_prefix "" # suggestion: '๐Ÿ‹' or '๐Ÿ“ฆ' + +# Detect when running in SSH +_pure_set_default pure_symbol_ssh_prefix "" # suggestion: 'ssh:/' or '๐Ÿ”—๐Ÿ”๐Ÿ”’๐ŸŒ' diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..ca898c9 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,9 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end + +set -U fish_greeting + +alias odsmock="cd ~/personal_workspace/order-delivery-schedule/app && npm run serve:mock" +alias odsdock="cd ~/personal_workspace/order-delivery-schedule && docker compose down && docker compose up --build" +alias odsbuild="cd ~/personal_workspace/order-delivery-schedule && mvn clean package -DskipTests" diff --git a/fish/fish_plugins b/fish/fish_plugins new file mode 100644 index 0000000..5da0d98 --- /dev/null +++ b/fish/fish_plugins @@ -0,0 +1,4 @@ +jorgebucaran/fisher +pure-fish/pure +jorgebucaran/autopair.fish +patrickf1/fzf.fish diff --git a/fish/fish_variables b/fish/fish_variables new file mode 100644 index 0000000..fe1e835 --- /dev/null +++ b/fish/fish_variables @@ -0,0 +1,87 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3400 +SETUVAR _fisher_jorgebucaran_2F_autopair_2E_fish_files:\x7e/\x2econfig/fish/functions/_autopair_backspace\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_left\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_right\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_same\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_tab\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/autopair\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\x1epure\x2dfish/pure\x1ejorgebucaran/autopair\x2efish\x1epatrickf1/fzf\x2efish +SETUVAR _fisher_pure_2D_fish_2F_pure_files:\x7e/\x2econfig/fish/functions/_pure_check_for_new_release\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_detect_container_by_cgroup_method\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_detect_container_by_pid_method\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_format_time\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_get_prompt_symbol\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_is_inside_container\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_is_single_line_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_parse_directory\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_parse_git_branch\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_place_iterm2_prompt_mark\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prefix_root_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_print_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_print_prompt_rows\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_beginning\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_command_duration\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_container\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_current_folder\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_ending\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_first_line\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_git\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_git_branch\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_git_dirty\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_git_pending_commits\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_git_stash\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_jobs\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_new_line\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_ssh\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_symbol\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_system_time\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_vimode\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_prompt_virtualenv\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_set_color\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_set_default\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_string_width\x2efish\x1e\x7e/\x2econfig/fish/functions/_pure_user_at_host\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_greeting\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_mode_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_title\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/_pure_init\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/pure\x2efish +SETUVAR _fisher_upgraded_to_4_4:\x1d +SETUVAR fish_color_autosuggestion:555\x1ebrblack +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_greeting:\x1d +SETUVAR fish_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:B3A06D\x1eyellow\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:/opt/homebrew/bin +SETUVAR pure_begin_prompt_with_current_directory:true +SETUVAR pure_check_for_new_release:false +SETUVAR pure_color_at_sign:pure_color_mute +SETUVAR pure_color_command_duration:pure_color_warning +SETUVAR pure_color_current_directory:pure_color_primary +SETUVAR pure_color_danger:red +SETUVAR pure_color_dark:black +SETUVAR pure_color_git_branch:pure_color_mute +SETUVAR pure_color_git_dirty:pure_color_mute +SETUVAR pure_color_git_stash:pure_color_info +SETUVAR pure_color_git_unpulled_commits:pure_color_info +SETUVAR pure_color_git_unpushed_commits:pure_color_info +SETUVAR pure_color_hostname:pure_color_mute +SETUVAR pure_color_info:cyan +SETUVAR pure_color_jobs:pure_color_normal +SETUVAR pure_color_light:white +SETUVAR pure_color_mute:brblack +SETUVAR pure_color_normal:normal +SETUVAR pure_color_prefix_root_prompt:pure_color_danger +SETUVAR pure_color_primary:blue +SETUVAR pure_color_prompt_on_error:pure_color_danger +SETUVAR pure_color_prompt_on_success:pure_color_success +SETUVAR pure_color_success:magenta +SETUVAR pure_color_system_time:pure_color_mute +SETUVAR pure_color_username_normal:pure_color_mute +SETUVAR pure_color_username_root:pure_color_light +SETUVAR pure_color_virtualenv:pure_color_mute +SETUVAR pure_color_warning:yellow +SETUVAR pure_enable_container_detection:true +SETUVAR pure_enable_git:true +SETUVAR pure_enable_single_line_prompt:false +SETUVAR pure_reverse_prompt_symbol_in_vimode:true +SETUVAR pure_separate_prompt_on_error:false +SETUVAR pure_show_jobs:false +SETUVAR pure_show_prefix_root_prompt:false +SETUVAR pure_show_subsecond_command_duration:false +SETUVAR pure_show_system_time:false +SETUVAR pure_symbol_container_prefix: +SETUVAR pure_symbol_git_dirty:\x2a +SETUVAR pure_symbol_git_stash:\u2261 +SETUVAR pure_symbol_git_unpulled_commits:\u21e3 +SETUVAR pure_symbol_git_unpushed_commits:\u21e1 +SETUVAR pure_symbol_prefix_root_prompt:\x23 +SETUVAR pure_symbol_prompt:\u276f +SETUVAR pure_symbol_reverse_prompt:\u276e +SETUVAR pure_symbol_ssh_prefix: +SETUVAR pure_symbol_title_bar_separator:\x2d +SETUVAR pure_threshold_command_duration:5 diff --git a/fish/functions/_autopair_backspace.fish b/fish/functions/_autopair_backspace.fish new file mode 100644 index 0000000..a43fa79 --- /dev/null +++ b/fish/functions/_autopair_backspace.fish @@ -0,0 +1,9 @@ +function _autopair_backspace + set --local index (commandline --cursor) + set --local buffer (commandline) + + test $index -ge 1 && + contains -- (string sub --start=$index --length=2 -- "$buffer") $autopair_pairs && + commandline --function delete-char + commandline --function backward-delete-char +end diff --git a/fish/functions/_autopair_insert_left.fish b/fish/functions/_autopair_insert_left.fish new file mode 100644 index 0000000..f078e86 --- /dev/null +++ b/fish/functions/_autopair_insert_left.fish @@ -0,0 +1,13 @@ +function _autopair_insert_left --argument-names left right + set --local buffer (commandline) + set --local before (commandline --cut-at-cursor) + + commandline --insert -- $left + + switch "$buffer" + case "$before"{," "\*,$autopair_right\*} + set --local index (commandline --cursor) + commandline --insert -- $right + commandline --cursor $index + end +end diff --git a/fish/functions/_autopair_insert_right.fish b/fish/functions/_autopair_insert_right.fish new file mode 100644 index 0000000..a0bd61c --- /dev/null +++ b/fish/functions/_autopair_insert_right.fish @@ -0,0 +1,11 @@ +function _autopair_insert_right --argument-names key + set --local buffer (commandline) + set --local before (commandline --cut-at-cursor) + + switch "$buffer" + case "$before$key"\* + commandline --cursor (math (commandline --cursor) + 1) + case \* + commandline --insert -- $key + end +end diff --git a/fish/functions/_autopair_insert_same.fish b/fish/functions/_autopair_insert_same.fish new file mode 100644 index 0000000..27f971d --- /dev/null +++ b/fish/functions/_autopair_insert_same.fish @@ -0,0 +1,20 @@ +function _autopair_insert_same --argument-names key + set --local buffer (commandline) + set --local index (commandline --cursor) + set --local next (string sub --start=(math $index + 1) --length=1 -- "$buffer") + + if test (math (count (string match --all --regex -- "$key" "$buffer")) % 2) = 0 + test $key = $next && commandline --cursor (math $index + 1) && return + + commandline --insert -- $key + + if test $index -lt 1 || + contains -- (string sub --start=$index --length=1 -- "$buffer") "" " " $autopair_left && + contains -- $next "" " " $autopair_right + commandline --insert -- $key + commandline --cursor (math $index + 1) + end + else + commandline --insert -- $key + end +end diff --git a/fish/functions/_autopair_tab.fish b/fish/functions/_autopair_tab.fish new file mode 100644 index 0000000..f2ab8eb --- /dev/null +++ b/fish/functions/_autopair_tab.fish @@ -0,0 +1,7 @@ +function _autopair_tab + commandline --paging-mode && down-or-search && return + + string match --quiet --regex -- '\$[^\s]*"$' (commandline --current-token) && + commandline --function end-of-line --function backward-delete-char + commandline --function complete +end diff --git a/fish/functions/_fzf_configure_bindings_help.fish b/fish/functions/_fzf_configure_bindings_help.fish new file mode 100644 index 0000000..ecfe68e --- /dev/null +++ b/fish/functions/_fzf_configure_bindings_help.fish @@ -0,0 +1,43 @@ +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 diff --git a/fish/functions/_fzf_extract_var_info.fish b/fish/functions/_fzf_extract_var_info.fish new file mode 100644 index 0000000..dd4e952 --- /dev/null +++ b/fish/functions/_fzf_extract_var_info.fish @@ -0,0 +1,15 @@ +# 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 diff --git a/fish/functions/_fzf_preview_changed_file.fish b/fish/functions/_fzf_preview_changed_file.fish new file mode 100644 index 0000000..a13219b --- /dev/null +++ b/fish/functions/_fzf_preview_changed_file.fish @@ -0,0 +1,49 @@ +# 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 -l 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 -l index_status (string sub --length 1 $path_status) + set -l working_tree_status (string sub --start 2 --length 1 $path_status) + + set 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 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 diff --git a/fish/functions/_fzf_preview_file.fish b/fish/functions/_fzf_preview_file.fish new file mode 100644 index 0000000..eaa68d0 --- /dev/null +++ b/fish/functions/_fzf_preview_file.fish @@ -0,0 +1,43 @@ +# 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 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 diff --git a/fish/functions/_fzf_report_diff_type.fish b/fish/functions/_fzf_report_diff_type.fish new file mode 100644 index 0000000..3463c3f --- /dev/null +++ b/fish/functions/_fzf_report_diff_type.fish @@ -0,0 +1,18 @@ +# 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 repeat_count (math 2 + (string length $diff_type)) + set line (string repeat --count $repeat_count โ”€) + set top_border โ•ญ$lineโ•ฎ + set btm_border โ•ฐ$lineโ•ฏ + + set_color yellow + echo $top_border + echo "โ”‚ $diff_type โ”‚" + echo $btm_border + set_color normal +end diff --git a/fish/functions/_fzf_report_file_type.fish b/fish/functions/_fzf_report_file_type.fish new file mode 100644 index 0000000..49e02e1 --- /dev/null +++ b/fish/functions/_fzf_report_file_type.fish @@ -0,0 +1,6 @@ +# 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 diff --git a/fish/functions/_fzf_search_directory.fish b/fish/functions/_fzf_search_directory.fish new file mode 100644 index 0000000..15085be --- /dev/null +++ b/fish/functions/_fzf_search_directory.fish @@ -0,0 +1,34 @@ +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 fd_cmd (command -v fdfind || command -v fd || echo "fd") + set --append fd_cmd --color=always $fzf_fd_opts + + # $fzf_dir_opts is the deprecated version of $fzf_directory_opts + set fzf_arguments --multi --ansi $fzf_dir_opts $fzf_directory_opts + set token (commandline --current-token) + # expandย any variables or leading tilde (~) in the token + set expanded_token (eval echo -- $token) + # unescape token because it's already quoted so backslashes will mess up the path + set 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="Search Directory $unescaped_exp_token> " --preview="_fzf_preview_file $expanded_token{}" + set file_paths_selected $unescaped_exp_token($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments) + else + set --prepend fzf_arguments --prompt="Search Directory> " --query="$unescaped_exp_token" --preview='_fzf_preview_file {}' + set 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 diff --git a/fish/functions/_fzf_search_git_log.fish b/fish/functions/_fzf_search_git_log.fish new file mode 100644 index 0000000..a158b02 --- /dev/null +++ b/fish/functions/_fzf_search_git_log.fish @@ -0,0 +1,30 @@ +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 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 selected_log_lines ( + git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \ + _fzf_wrapper --ansi \ + --multi \ + --tiebreak=index \ + --prompt="Search Git Log> " \ + --preview='git show --color=always --stat --patch {1}' \ + --query=(commandline --current-token) \ + $fzf_git_log_opts + ) + if test $status -eq 0 + for line in $selected_log_lines + set abbreviated_commit_hash (string split --field 1 " " $line) + set full_commit_hash (git rev-parse $abbreviated_commit_hash) + set --append commit_hashes $full_commit_hash + end + commandline --current-token --replace (string join ' ' $commit_hashes) + end + end + + commandline --function repaint +end diff --git a/fish/functions/_fzf_search_git_status.fish b/fish/functions/_fzf_search_git_status.fish new file mode 100644 index 0000000..9e51453 --- /dev/null +++ b/fish/functions/_fzf_search_git_status.fish @@ -0,0 +1,36 @@ +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 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="Search Git Status> " \ + --query=(commandline --current-token) \ + --preview='_fzf_preview_changed_file {}' \ + --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 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 diff --git a/fish/functions/_fzf_search_history.fish b/fish/functions/_fzf_search_history.fish new file mode 100644 index 0000000..27cf4f1 --- /dev/null +++ b/fish/functions/_fzf_search_history.fish @@ -0,0 +1,31 @@ +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 + + # Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line + set commands_selected ( + # Reference https://devhints.io/strftime to understand strftime format symbols + builtin history --null --show-time="%m-%d %H:%M:%S โ”‚ " | + _fzf_wrapper --read0 \ + --print0 \ + --multi \ + --tiebreak=index \ + --prompt="Search History> " \ + --query=(commandline) \ + --preview="echo -- {4..} | fish_indent --ansi" \ + --preview-window="bottom:3:wrap" \ + $fzf_history_opts | + string split0 | + # remove timestamps from commands selected + string replace --regex '^\d\d-\d\d \d\d:\d\d:\d\d โ”‚ ' '' + ) + + if test $status -eq 0 + commandline --replace -- $commands_selected + end + + commandline --function repaint +end diff --git a/fish/functions/_fzf_search_processes.fish b/fish/functions/_fzf_search_processes.fish new file mode 100644 index 0000000..9424aad --- /dev/null +++ b/fish/functions/_fzf_search_processes.fish @@ -0,0 +1,29 @@ +function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process." + # 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 ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command') + set processes_selected ( + ps -A -opid,command | \ + _fzf_wrapper --multi \ + --prompt="Search 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 -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 --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 diff --git a/fish/functions/_fzf_search_variables.fish b/fish/functions/_fzf_search_variables.fish new file mode 100644 index 0000000..eda2453 --- /dev/null +++ b/fish/functions/_fzf_search_variables.fish @@ -0,0 +1,48 @@ +# 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 all_variable_names (string match --invert history <$set_names_output) + + set 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 cleaned_curr_token (string replace -- '$' '' $current_token) + + set variable_names_selected ( + printf '%s\n' $all_variable_names | + _fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \ + --prompt="Search Variables> " \ + --preview-window="wrap" \ + --multi \ + --query=$cleaned_curr_token \ + # $fzf_shell_vars_opts is the deprecated version of $fzf_variables_opts + $fzf_shell_vars_opts $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 diff --git a/fish/functions/_fzf_wrapper.fish b/fish/functions/_fzf_wrapper.fish new file mode 100644 index 0000000..a928701 --- /dev/null +++ b/fish/functions/_fzf_wrapper.fish @@ -0,0 +1,20 @@ +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 --local so that it doesn't clobber SHELL outside of this function. + set --local --export SHELL (command --search fish) + + # If FZF_DEFAULT_OPTS is not set, then set some sane defaults. + # See https://github.com/junegunn/fzf#environment-variables + if not set --query FZF_DEFAULT_OPTS + # 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 diff --git a/fish/functions/_pure_check_for_new_release.fish b/fish/functions/_pure_check_for_new_release.fish new file mode 100644 index 0000000..a174939 --- /dev/null +++ b/fish/functions/_pure_check_for_new_release.fish @@ -0,0 +1,24 @@ +function _pure_check_for_new_release \ + --description "Check for new release and show command to install" + + if test "$pure_check_for_new_release" = true + echo "๐Ÿ›ˆ Checking for new releaseโ€ฆ" + set latest (pure_get_latest_release_version "pure-fish/pure") + + if test "v"$pure_version != $latest + set --local latest_version (_pure_set_color $pure_color_info)$latest(_pure_set_color $pure_color_normal) + echo -e "๐Ÿ”” New version available!\n" + echo -e (_pure_set_color $pure_color_success)"fisher install pure-fish/pure@$latest_version\n" + end + end +end + + +function pure_get_latest_release_version \ + --argument-names user_repo + + curl \ + --silent \ + "https://api.github.com/repos/$user_repo/releases/latest" \ + | string match --regex '"tag_name": "\K.*?(?=")' +end diff --git a/fish/functions/_pure_detect_container_by_cgroup_method.fish b/fish/functions/_pure_detect_container_by_cgroup_method.fish new file mode 100644 index 0000000..30b29dd --- /dev/null +++ b/fish/functions/_pure_detect_container_by_cgroup_method.fish @@ -0,0 +1,10 @@ +function _pure_detect_container_by_cgroup_method \ + --description "Linux method to detect container using cgroup. see https://stackoverflow.com/a/37015387/802365" \ + --argument-names cgroup_namespace + set --query cgroup_namespace[1]; or set cgroup_namespace /proc/1/cgroup + + string match \ + --quiet \ + --entire \ + --regex '(lxc|docker)' <$cgroup_namespace +end diff --git a/fish/functions/_pure_detect_container_by_pid_method.fish b/fish/functions/_pure_detect_container_by_pid_method.fish new file mode 100644 index 0000000..f11470e --- /dev/null +++ b/fish/functions/_pure_detect_container_by_pid_method.fish @@ -0,0 +1,14 @@ +function _pure_detect_container_by_pid_method \ + --description "Linux method to detect container using /proc. see https://stackoverflow.com/a/37015387/802365" \ + --argument-names proc_sched + + set --query proc_sched[1]; or set proc_sched /proc/1/sched + + if test -e $proc_sched + head -n 1 $proc_sched \ + | string match \ + --quiet \ + --invert \ + --regex 'init|systemd' + end +end diff --git a/fish/functions/_pure_format_time.fish b/fish/functions/_pure_format_time.fish new file mode 100644 index 0000000..140f72f --- /dev/null +++ b/fish/functions/_pure_format_time.fish @@ -0,0 +1,49 @@ +set SUCCESS 0 +set FAILURE 1 + +function _pure_format_time \ + --description="Format milliseconds to a human readable format" \ + --argument-names \ + milliseconds \ + threshold \ + show_subsecond + + set --query show_subsecond[1]; or set show_subsecond false + test "$milliseconds" -lt 0; and return $FAILURE + test "$milliseconds" -lt (math --scale=0 "$threshold * 1000"); and echo; and return $SUCCESS + + set --local time + set --local days (math --scale=0 "$milliseconds / 86400000") + test "$days" -gt 0; and set --append time (printf "%sd" $days) + set --local hours (math --scale=0 "$milliseconds / 3600000 % 24") + test "$hours" -gt 0; and set --append time (printf "%sh" $hours) + set --local minutes (math --scale=0 "$milliseconds / 60000 % 60") + test "$minutes" -gt 0; and set --append time (printf "%sm" $minutes) + set --local seconds (math --scale=0 "$milliseconds / 1000 % 60") + + if test "$show_subsecond" = true + set --local threshold_as_ms (math --scale=0 "$threshold*1000") + set --local subseconds (_pure_format_time_subseconds $milliseconds $threshold_as_ms) + set --append time $seconds$subseconds's' + else + test "$seconds" -gt $threshold; and set --append time (printf "%ss" $seconds) + end + + echo -e (string join ' ' $time) +end + + +function _pure_format_time_subseconds \ + --description="Format duration milliseconds to a human readable format" \ + --argument-names \ + duration \ + threshold + + set --local subseconds + if test "$duration" -gt $threshold + set --local precision 2 + set --local milliseconds (string sub --start -3 --length $precision $duration) + set --append subseconds '.'$milliseconds + end + echo $subseconds +end diff --git a/fish/functions/_pure_get_prompt_symbol.fish b/fish/functions/_pure_get_prompt_symbol.fish new file mode 100644 index 0000000..75c15e7 --- /dev/null +++ b/fish/functions/_pure_get_prompt_symbol.fish @@ -0,0 +1,12 @@ +function _pure_get_prompt_symbol \ + --description 'Print prompt symbol' \ + --argument-names exit_code + + set --local prompt_symbol $pure_symbol_prompt + test "$pure_reverse_prompt_symbol_in_vimode" = true + and string match -rq "fish_(vi|hybrid)_key_bindings" $fish_key_bindings + and not contains "$fish_bind_mode" insert replace + and set prompt_symbol $pure_symbol_reverse_prompt + + echo "$prompt_symbol" +end diff --git a/fish/functions/_pure_is_inside_container.fish b/fish/functions/_pure_is_inside_container.fish new file mode 100644 index 0000000..adc53b6 --- /dev/null +++ b/fish/functions/_pure_is_inside_container.fish @@ -0,0 +1,26 @@ +function _pure_is_inside_container \ + --argument-names cgroup_namespace + set --query cgroup_namespace[1]; or set cgroup_namespace /proc/1/cgroup + + if set --query pure_enable_container_detection; and test "$pure_enable_container_detection" = true + set --local success 0 + if test -n "$container" + return $success + end + + set --local os_name (uname -s) + # echo $os_name + if test $os_name = Linux + if _pure_detect_container_by_cgroup_method $cgroup_namespace + return $success + end + + if _pure_detect_container_by_pid_method + return $success + end + end + + set --local failure 1 + return $failure + end +end diff --git a/fish/functions/_pure_is_single_line_prompt.fish b/fish/functions/_pure_is_single_line_prompt.fish new file mode 100644 index 0000000..f1efd4e --- /dev/null +++ b/fish/functions/_pure_is_single_line_prompt.fish @@ -0,0 +1,5 @@ +function _pure_is_single_line_prompt \ + --description 'Test if single line prompt feature is enabled' + set --query pure_enable_single_line_prompt + and test "$pure_enable_single_line_prompt" = true +end diff --git a/fish/functions/_pure_parse_directory.fish b/fish/functions/_pure_parse_directory.fish new file mode 100644 index 0000000..fb3822a --- /dev/null +++ b/fish/functions/_pure_parse_directory.fish @@ -0,0 +1,14 @@ +function _pure_parse_directory \ + --description "Replace '$HOME' with '~'" \ + --argument-names max_path_length + + set --local folder (string replace $HOME '~' $PWD) + + if test -n "$max_path_length"; + if test (string length $folder) -gt $max_path_length; + # If path exceeds maximum symbol limit, use default fish path formating function + set folder (prompt_pwd) + end + end + echo $folder +end diff --git a/fish/functions/_pure_parse_git_branch.fish b/fish/functions/_pure_parse_git_branch.fish new file mode 100644 index 0000000..a666f2a --- /dev/null +++ b/fish/functions/_pure_parse_git_branch.fish @@ -0,0 +1,4 @@ +function _pure_parse_git_branch --description "Parse current Git branch name" + command git symbolic-ref --short HEAD 2>/dev/null; + or command git name-rev --name-only HEAD 2>/dev/null +end diff --git a/fish/functions/_pure_place_iterm2_prompt_mark.fish b/fish/functions/_pure_place_iterm2_prompt_mark.fish new file mode 100644 index 0000000..b999b7a --- /dev/null +++ b/fish/functions/_pure_place_iterm2_prompt_mark.fish @@ -0,0 +1,5 @@ +function _pure_place_iterm2_prompt_mark + if functions -q iterm2_prompt_mark + iterm2_prompt_mark + end +end diff --git a/fish/functions/_pure_prefix_root_prompt.fish b/fish/functions/_pure_prefix_root_prompt.fish new file mode 100644 index 0000000..e9fb86f --- /dev/null +++ b/fish/functions/_pure_prefix_root_prompt.fish @@ -0,0 +1,11 @@ +function _pure_prefix_root_prompt + set --local username (id -u -n) # current user name + set --local prefix_root_prompt + + if set --query pure_show_prefix_root_prompt; and test "$pure_show_prefix_root_prompt" = true -a "$username" = "root" + set --local prefix_color (_pure_set_color $pure_color_prefix_root_prompt) + set prefix_root_prompt "$prefix_color$pure_symbol_prefix_root_prompt" + end + + echo "$prefix_root_prompt" +end diff --git a/fish/functions/_pure_print_prompt.fish b/fish/functions/_pure_print_prompt.fish new file mode 100644 index 0000000..53213c1 --- /dev/null +++ b/fish/functions/_pure_print_prompt.fish @@ -0,0 +1,13 @@ +function _pure_print_prompt \ + --description 'Concatenate parts single prompt string' \ + + set --local prompt + + for prompt_part in $argv + if test (_pure_string_width $prompt_part) -gt 0 + set --append prompt "$prompt_part" + end + end + + echo (string trim -l $prompt) +end diff --git a/fish/functions/_pure_print_prompt_rows.fish b/fish/functions/_pure_print_prompt_rows.fish new file mode 100644 index 0000000..cc8555c --- /dev/null +++ b/fish/functions/_pure_print_prompt_rows.fish @@ -0,0 +1,10 @@ +function _pure_print_prompt_rows \ + --description "Manage default vs. compact prompt" + + # print current path, git branch/status, command duration + if _pure_is_single_line_prompt + echo -e -n (_pure_prompt_first_line) + else + echo -e (_pure_prompt_first_line) + end +end diff --git a/fish/functions/_pure_prompt.fish b/fish/functions/_pure_prompt.fish new file mode 100644 index 0000000..d3eb33a --- /dev/null +++ b/fish/functions/_pure_prompt.fish @@ -0,0 +1,27 @@ +function _pure_prompt \ + --description 'Print prompt symbol' \ + --argument-names exit_code + + set --local jobs (_pure_prompt_jobs) + set --local virtualenv (_pure_prompt_virtualenv) # Python virtualenv name + set --local vimode_indicator (_pure_prompt_vimode) # vi-mode indicator + set --local pure_symbol (_pure_prompt_symbol $exit_code) + set --local system_time (_pure_prompt_system_time) + set --local root_prefix (_pure_prefix_root_prompt) + set --local space + + if _pure_is_single_line_prompt + set space ' ' + end + + echo (\ + _pure_print_prompt \ + $space \ + $system_time \ + $root_prefix \ + $jobs \ + $virtualenv \ + $vimode_indicator \ + $pure_symbol \ + ) +end diff --git a/fish/functions/_pure_prompt_beginning.fish b/fish/functions/_pure_prompt_beginning.fish new file mode 100644 index 0000000..5f00236 --- /dev/null +++ b/fish/functions/_pure_prompt_beginning.fish @@ -0,0 +1,6 @@ +function _pure_prompt_beginning + # Clear existing line content + set --local clear_line "\r\033[K" + + echo $clear_line +end diff --git a/fish/functions/_pure_prompt_command_duration.fish b/fish/functions/_pure_prompt_command_duration.fish new file mode 100644 index 0000000..0a2e231 --- /dev/null +++ b/fish/functions/_pure_prompt_command_duration.fish @@ -0,0 +1,11 @@ +function _pure_prompt_command_duration + set --local command_duration + + # Get command execution duration + if test -n "$CMD_DURATION" + set command_duration (_pure_format_time $CMD_DURATION $pure_threshold_command_duration $pure_show_subsecond_command_duration) + end + set --local command_duration_color (_pure_set_color $pure_color_command_duration) + + echo "$command_duration_color$command_duration" +end diff --git a/fish/functions/_pure_prompt_container.fish b/fish/functions/_pure_prompt_container.fish new file mode 100644 index 0000000..97a6056 --- /dev/null +++ b/fish/functions/_pure_prompt_container.fish @@ -0,0 +1,5 @@ +function _pure_prompt_container + if _pure_is_inside_container + echo "$pure_symbol_container_prefix"(_pure_user_at_host) + end +end diff --git a/fish/functions/_pure_prompt_current_folder.fish b/fish/functions/_pure_prompt_current_folder.fish new file mode 100644 index 0000000..462d9b1 --- /dev/null +++ b/fish/functions/_pure_prompt_current_folder.fish @@ -0,0 +1,11 @@ +set FAILURE 1 + +function _pure_prompt_current_folder --argument-names current_prompt_width + + if test -z "$current_prompt_width"; return $FAILURE; end + + set --local current_folder (_pure_parse_directory (math $COLUMNS - $current_prompt_width - 1)) + set --local current_folder_color (_pure_set_color $pure_color_current_directory) + + echo "$current_folder_color$current_folder" +end diff --git a/fish/functions/_pure_prompt_ending.fish b/fish/functions/_pure_prompt_ending.fish new file mode 100644 index 0000000..ba92511 --- /dev/null +++ b/fish/functions/_pure_prompt_ending.fish @@ -0,0 +1,3 @@ +function _pure_prompt_ending + echo (set_color normal)" " +end diff --git a/fish/functions/_pure_prompt_first_line.fish b/fish/functions/_pure_prompt_first_line.fish new file mode 100644 index 0000000..680d0c0 --- /dev/null +++ b/fish/functions/_pure_prompt_first_line.fish @@ -0,0 +1,37 @@ +set --global FAILURE 1 + +function _pure_prompt_first_line \ + --description 'Print contextual information before prompt.' + + set --local prompt_ssh (_pure_prompt_ssh) + set --local prompt_container (_pure_prompt_container) + set --local prompt_git (_pure_prompt_git) + set --local prompt_command_duration (_pure_prompt_command_duration) + set --local prompt (_pure_print_prompt \ + $prompt_ssh \ + $prompt_container \ + $prompt_git \ + $prompt_command_duration + ) + set --local prompt_width (_pure_string_width $prompt) + set --local current_folder (_pure_prompt_current_folder $prompt_width) + + set --local prompt_components + if set --query pure_begin_prompt_with_current_directory; and test "$pure_begin_prompt_with_current_directory" = true + set prompt_components \ + $current_folder \ + $prompt_git \ + $prompt_ssh \ + $prompt_container \ + $prompt_command_duration + else + set prompt_components \ + $prompt_ssh \ + $prompt_container \ + $current_folder \ + $prompt_git \ + $prompt_command_duration + end + + echo (_pure_print_prompt $prompt_components) +end diff --git a/fish/functions/_pure_prompt_git.fish b/fish/functions/_pure_prompt_git.fish new file mode 100644 index 0000000..6e3377d --- /dev/null +++ b/fish/functions/_pure_prompt_git.fish @@ -0,0 +1,26 @@ +function _pure_prompt_git \ + --description 'Print git repository informations: branch name, dirty, upstream ahead/behind' + + set ABORT_FEATURE 2 + + if set --query pure_enable_git; and test "$pure_enable_git" != true + return + end + + if not type -q --no-functions git # skip git-related features when `git` is not available + return $ABORT_FEATURE + end + + set --local is_git_repository (command git rev-parse --is-inside-work-tree 2>/dev/null) + + if test -n "$is_git_repository" + set --local git_prompt (_pure_prompt_git_branch)(_pure_prompt_git_dirty)(_pure_prompt_git_stash) + set --local git_pending_commits (_pure_prompt_git_pending_commits) + + if test (_pure_string_width $git_pending_commits) -ne 0 + set --append git_prompt $git_pending_commits + end + + echo $git_prompt + end +end diff --git a/fish/functions/_pure_prompt_git_branch.fish b/fish/functions/_pure_prompt_git_branch.fish new file mode 100644 index 0000000..777cd0e --- /dev/null +++ b/fish/functions/_pure_prompt_git_branch.fish @@ -0,0 +1,6 @@ +function _pure_prompt_git_branch + set --local git_branch (_pure_parse_git_branch) # current git branch + set --local git_branch_color (_pure_set_color $pure_color_git_branch) + + echo "$git_branch_color$git_branch" +end diff --git a/fish/functions/_pure_prompt_git_dirty.fish b/fish/functions/_pure_prompt_git_dirty.fish new file mode 100644 index 0000000..fbf31e3 --- /dev/null +++ b/fish/functions/_pure_prompt_git_dirty.fish @@ -0,0 +1,18 @@ +function _pure_prompt_git_dirty + set --local git_dirty_symbol + set --local git_dirty_color + + set --local is_git_dirty ( + # The first checks for staged changes, the second for unstaged ones. + # We put them in this order because checking staged changes is *fast*. + not command git diff-index --ignore-submodules --cached --quiet HEAD -- >/dev/null 2>&1 + or not command git diff --ignore-submodules --no-ext-diff --quiet --exit-code >/dev/null 2>&1 + and echo "true" + ) + if test -n "$is_git_dirty" # untracked or un-commited files + set git_dirty_symbol "$pure_symbol_git_dirty" + set git_dirty_color (_pure_set_color $pure_color_git_dirty) + end + + echo "$git_dirty_color$git_dirty_symbol" +end diff --git a/fish/functions/_pure_prompt_git_pending_commits.fish b/fish/functions/_pure_prompt_git_pending_commits.fish new file mode 100644 index 0000000..6ae7c59 --- /dev/null +++ b/fish/functions/_pure_prompt_git_pending_commits.fish @@ -0,0 +1,27 @@ +function _pure_prompt_git_pending_commits + set --local git_unpushed_commits + set --local git_unpulled_commits + + set --local has_upstream (command git rev-parse --abbrev-ref '@{upstream}' 2>/dev/null) + if test -n "$has_upstream" # check there is an upstream repo configured + and test "$has_upstream" != '@{upstream}' # Fixed #179, dont check the empty repo + command git rev-list --left-right --count 'HEAD...@{upstream}' \ + | read --local --array git_status + set --local commit_to_push $git_status[1] + set --local commit_to_pull $git_status[2] + + if test "$commit_to_push" -gt 0 # upstream is behind local repo + set --local git_unpushed_commits_color \ + (_pure_set_color $pure_color_git_unpushed_commits) + set git_unpushed_commits "$git_unpushed_commits_color$pure_symbol_git_unpushed_commits" + end + + if test "$commit_to_pull" -gt 0 # upstream is ahead of local repo + set --local git_unpulled_commits_color \ + (_pure_set_color $pure_color_git_unpulled_commits) + set git_unpulled_commits "$git_unpulled_commits_color$pure_symbol_git_unpulled_commits" + end + end + + echo "$git_unpushed_commits$git_unpulled_commits" +end diff --git a/fish/functions/_pure_prompt_git_stash.fish b/fish/functions/_pure_prompt_git_stash.fish new file mode 100644 index 0000000..531ceb4 --- /dev/null +++ b/fish/functions/_pure_prompt_git_stash.fish @@ -0,0 +1,15 @@ +function _pure_prompt_git_stash + set --local git_stash_symbol + set --local git_stash_color + + set --local has_stashed_files ( + command git rev-list --walk-reflogs --count refs/stash >/dev/null 2>&1 + and echo "true" + ) + if test -n "$has_stashed_files" # untracked or un-commited files + set git_stash_symbol " $pure_symbol_git_stash" + set git_stash_color (_pure_set_color $pure_color_git_stash) + end + + echo "$git_stash_color$git_stash_symbol" +end diff --git a/fish/functions/_pure_prompt_jobs.fish b/fish/functions/_pure_prompt_jobs.fish new file mode 100644 index 0000000..3a5181d --- /dev/null +++ b/fish/functions/_pure_prompt_jobs.fish @@ -0,0 +1,9 @@ +function _pure_prompt_jobs --description "Display number of running jobs" + if set --query pure_show_jobs; and test "$pure_show_jobs" = true + set --local njobs (count (jobs -p)) + set --local jobs_color (_pure_set_color $pure_color_jobs) + if test "$njobs" -gt 0 + echo "$jobs_color"[$njobs] + end + end +end diff --git a/fish/functions/_pure_prompt_new_line.fish b/fish/functions/_pure_prompt_new_line.fish new file mode 100644 index 0000000..2c75554 --- /dev/null +++ b/fish/functions/_pure_prompt_new_line.fish @@ -0,0 +1,11 @@ +function _pure_prompt_new_line \ + --description "Do not add a line break to a brand new session" \ + --on-event fish_prompt + + set --local new_line + if not _pure_is_single_line_prompt; and test "$_pure_fresh_session" = false + set new_line "\n" + end + + echo -e -n "$new_line" +end diff --git a/fish/functions/_pure_prompt_ssh.fish b/fish/functions/_pure_prompt_ssh.fish new file mode 100644 index 0000000..ab721df --- /dev/null +++ b/fish/functions/_pure_prompt_ssh.fish @@ -0,0 +1,5 @@ +function _pure_prompt_ssh + if test "$SSH_CONNECTION" != "" + echo "$pure_symbol_ssh_prefix"(_pure_user_at_host) + end +end diff --git a/fish/functions/_pure_prompt_symbol.fish b/fish/functions/_pure_prompt_symbol.fish new file mode 100644 index 0000000..120dd7d --- /dev/null +++ b/fish/functions/_pure_prompt_symbol.fish @@ -0,0 +1,20 @@ +function _pure_prompt_symbol \ + --description 'Print prompt symbol' \ + --argument-names exit_code + + set --local prompt_symbol (_pure_get_prompt_symbol) + set --local symbol_color_success (_pure_set_color $pure_color_prompt_on_success) + set --local symbol_color_error (_pure_set_color $pure_color_prompt_on_error) + set --local command_succeed 0 + + set --local symbol_color $symbol_color_success # default pure symbol color + if set --query exit_code; and test "$exit_code" -ne $command_succeed + set symbol_color $symbol_color_error # different pure symbol color when previous command failed + + if set --query pure_separate_prompt_on_error; and test "$pure_separate_prompt_on_error" = true + set symbol_color "$symbol_color_error$prompt_symbol$symbol_color_success" + end + end + + echo "$symbol_color$prompt_symbol" +end diff --git a/fish/functions/_pure_prompt_system_time.fish b/fish/functions/_pure_prompt_system_time.fish new file mode 100644 index 0000000..49f134f --- /dev/null +++ b/fish/functions/_pure_prompt_system_time.fish @@ -0,0 +1,6 @@ +function _pure_prompt_system_time --description "Display system time" + if set --query pure_show_system_time; and test "$pure_show_system_time" = true + set --local time_color (_pure_set_color $pure_color_system_time) + echo "$time_color"(date '+%T') + end +end diff --git a/fish/functions/_pure_prompt_vimode.fish b/fish/functions/_pure_prompt_vimode.fish new file mode 100644 index 0000000..d95d806 --- /dev/null +++ b/fish/functions/_pure_prompt_vimode.fish @@ -0,0 +1,6 @@ +function _pure_prompt_vimode + if set --query pure_reverse_prompt_symbol_in_vimode; + and test "$pure_reverse_prompt_symbol_in_vimode" = false + echo (fish_default_mode_prompt) + end +end diff --git a/fish/functions/_pure_prompt_virtualenv.fish b/fish/functions/_pure_prompt_virtualenv.fish new file mode 100644 index 0000000..5fb2ba8 --- /dev/null +++ b/fish/functions/_pure_prompt_virtualenv.fish @@ -0,0 +1,13 @@ +function _pure_prompt_virtualenv --description "Display virtualenv directory" + if test -n "$VIRTUAL_ENV" + set --local virtualenv (basename "$VIRTUAL_ENV") + set --local virtualenv_color (_pure_set_color $pure_color_virtualenv) + + echo "$virtualenv_color$virtualenv" + else if test -n "$CONDA_DEFAULT_ENV" + set --local virtualenv (basename "$CONDA_DEFAULT_ENV") + set --local virtualenv_color (_pure_set_color $pure_color_virtualenv) + + echo "$virtualenv_color$virtualenv" + end +end diff --git a/fish/functions/_pure_set_color.fish b/fish/functions/_pure_set_color.fish new file mode 100644 index 0000000..c05769a --- /dev/null +++ b/fish/functions/_pure_set_color.fish @@ -0,0 +1,19 @@ +function _pure_set_color \ + --description 'Set color' \ + --argument-names var + + set --local color $var + # Backwards compatibility for colors defined as control sequencies instead of fish colors + if not string match --quiet --all --regex '\e\[[^m]*m' $color[1] + and set -q $color + set color $$var + end + + set --local result $color + if not string match --quiet --all --regex '\e\[[^m]*m' $result[1] + and not test -z $result[1] + set result (set_color $color) + end + + echo "$result" +end diff --git a/fish/functions/_pure_set_default.fish b/fish/functions/_pure_set_default.fish new file mode 100644 index 0000000..d5c86a8 --- /dev/null +++ b/fish/functions/_pure_set_default.fish @@ -0,0 +1,11 @@ +function _pure_set_default \ + --description 'Set default value for configuration variable' \ + --argument-names var default + + set is_available_universally (not set --query --universal $var; or test -z $$var; echo $status) + set is_available_globally (not set --query --global $var; or test -z $$var; echo $status) + + if test "$is_available_universally" -eq 0 -a $is_available_globally -eq 0 + set --universal $var "$default" + end +end diff --git a/fish/functions/_pure_string_width.fish b/fish/functions/_pure_string_width.fish new file mode 100644 index 0000000..0c1957b --- /dev/null +++ b/fish/functions/_pure_string_width.fish @@ -0,0 +1,9 @@ +function _pure_string_width \ + --description 'returns raw string length, i.e. ignore ANSI-color' \ + --argument-names prompt + + set --local empty '' + set --local raw_prompt (string replace --all --regex '\e\[[^m]*m' $empty -- $prompt) + + string length -- $raw_prompt +end diff --git a/fish/functions/_pure_user_at_host.fish b/fish/functions/_pure_user_at_host.fish new file mode 100644 index 0000000..e41cc67 --- /dev/null +++ b/fish/functions/_pure_user_at_host.fish @@ -0,0 +1,13 @@ +function _pure_user_at_host + set --local username (id -u -n) # current user name + set --local at_sign "@" + set --local at_sign_color (_pure_set_color $pure_color_at_sign) + set --local hostname_color (_pure_set_color $pure_color_hostname) + + set --local username_color (_pure_set_color $pure_color_username_normal) # default color + if test "$username" = root + set username_color (_pure_set_color $pure_color_username_root) # different color for root + end + + echo "$username_color$username$at_sign_color$at_sign$hostname_color$hostname" +end diff --git a/fish/functions/fish_greeting.fish b/fish/functions/fish_greeting.fish new file mode 100644 index 0000000..878b30e --- /dev/null +++ b/fish/functions/fish_greeting.fish @@ -0,0 +1,3 @@ +function fish_greeting + _pure_check_for_new_release +end diff --git a/fish/functions/fish_mode_prompt.fish b/fish/functions/fish_mode_prompt.fish new file mode 100644 index 0000000..428a658 --- /dev/null +++ b/fish/functions/fish_mode_prompt.fish @@ -0,0 +1,2 @@ +function fish_mode_prompt +end diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..29ad856 --- /dev/null +++ b/fish/functions/fish_prompt.fish @@ -0,0 +1,12 @@ +# a called to `_pure_prompt_new_line` is triggered by an event +function fish_prompt + set --local exit_code $status # save previous exit code + + echo -e -n (_pure_prompt_beginning) # init prompt context (clear current line, etc.) + _pure_print_prompt_rows # manage default vs. compact prompt + _pure_place_iterm2_prompt_mark # place iTerm shell integration mark + echo -e -n (_pure_prompt $exit_code) # print prompt + echo -e (_pure_prompt_ending) # reset colors and end prompt + + set _pure_fresh_session false +end diff --git a/fish/functions/fish_title.fish b/fish/functions/fish_title.fish new file mode 100644 index 0000000..fbc4a27 --- /dev/null +++ b/fish/functions/fish_title.fish @@ -0,0 +1,16 @@ +function fish_title \ + --description "Set title to current folder and shell name" \ + --argument-names last_command + + set --local basename (string replace --regex '^.*/' '' -- $PWD) + set --local current_folder (_pure_parse_directory) + set --local current_command (status current-command 2>/dev/null; or echo $_) + + set --local prompt "$basename: $last_command $pure_symbol_title_bar_separator $current_command" + + if test -z "$last_command" + set prompt "$current_folder $pure_symbol_title_bar_separator $current_command" + end + + echo $prompt +end diff --git a/fish/functions/fisher.fish b/fish/functions/fisher.fish new file mode 100644 index 0000000..c0a86fa --- /dev/null +++ b/fish/functions/fisher.fish @@ -0,0 +1,240 @@ +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.3 + 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 Install plugins" + echo " fisher remove Remove installed plugins" + echo " fisher update Update installed plugins" + echo " fisher update Update all installed plugins" + echo " fisher list [] List installed plugins matching regex" + echo "Options:" + echo " -v or --version Print version" + echo " -h or --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 curl --silent -L \$url | 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 diff --git a/fish/functions/fzf_configure_bindings.fish b/fish/functions/fzf_configure_bindings.fish new file mode 100644 index 0000000..ec24f73 --- /dev/null +++ b/fish/functions/fzf_configure_bindings.fish @@ -0,0 +1,46 @@ +# 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 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 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 diff --git a/kitty/kitty.conf b/kitty/kitty.conf new file mode 100644 index 0000000..254d9af --- /dev/null +++ b/kitty/kitty.conf @@ -0,0 +1,40 @@ +background #0e1419 +foreground #e5e1cf +cursor #f19618 +selection_background #243340 +color0 #000000 +color8 #323232 +color1 #ff3333 +color9 #ff6565 +color2 #b8cc52 +color10 #e9fe83 +color3 #e6c446 +color11 #fff778 +color4 #36a3d9 +color12 #68d4ff +color5 #f07078 +color13 #ffa3aa +color6 #95e5cb +color14 #c7fffc +color7 #ffffff +color15 #ffffff +selection_foreground #0e1419 + +# Tab bar colors +active_tab_foreground #282a36 +active_tab_background #f8f8f2 +inactive_tab_foreground #282a36 +inactive_tab_background #6272a4 + +# Marks +mark1_foreground #282a36 +mark1_background #ff5555 +font_family Fira Code Medium + +macos_thicken_font 0.25 +font_size 13.0 + +macos_hide_titlebar yes + +window_padding_width 10 + diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..22a6407 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,588 @@ +-- Set as the leader key +-- See `:help mapleader` +-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- [[ Install `lazy.nvim` plugin manager ]] +-- https://github.com/folke/lazy.nvim +-- `:help lazy.nvim.txt` for more info +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not vim.loop.fs_stat(lazypath) then + vim.fn.system { + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/folke/lazy.nvim.git', + '--branch=stable', -- latest stable release + lazypath, + } +end +vim.opt.rtp:prepend(lazypath) + +-- [[ Configure plugins ]] +-- NOTE: Here is where you install your plugins. +-- You can configure plugins using the `config` key. +-- +-- You can also configure plugins after the setup call, +-- as they will be available in your neovim runtime. +require('lazy').setup({ + -- NOTE: First, some plugins that don't require any configuration + + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', + + -- Detect tabstop and shiftwidth automatically + 'tpope/vim-sleuth', + + -- NOTE: This is where your plugins related to LSP can be installed. + -- The configuration is done below. Search for lspconfig to find it below. + { + -- LSP Configuration & Plugins + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs to stdpath for neovim + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + + -- Useful status updates for LSP + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, + + -- Additional lua configuration, makes nvim stuff amazing! + 'folke/neodev.nvim', + }, + }, + + { + -- Autocompletion + 'hrsh7th/nvim-cmp', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + + -- Adds LSP completion capabilities + 'hrsh7th/cmp-nvim-lsp', + + -- Adds a number of user-friendly snippets + 'rafamadriz/friendly-snippets', + }, + }, + + -- Useful plugin to show you pending keybinds. + { 'folke/which-key.nvim', opts = {} }, + { + -- Adds git related signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = 'โ€พ' }, + changedelete = { text = '~' }, + }, + on_attach = function(bufnr) + vim.keymap.set('n', 'hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' }) + + -- don't override the built-in and fugitive keymaps + local gs = package.loaded.gitsigns + vim.keymap.set({ 'n', 'v' }, ']c', function() + if vim.wo.diff then + return ']c' + end + vim.schedule(function() + gs.next_hunk() + end) + return '' + end, { expr = true, buffer = bufnr, desc = 'Jump to next hunk' }) + vim.keymap.set({ 'n', 'v' }, '[c', function() + if vim.wo.diff then + return '[c' + end + vim.schedule(function() + gs.prev_hunk() + end) + return '' + end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' }) + end, + }, + }, + + { + -- Theme inspired by Atom + 'catppuccin/nvim', + opts = { + options = { + style = 'cool', + }, + }, + priority = 1000, + config = function() + vim.cmd.colorscheme 'catppuccin-frappe' + end, + }, + + { + 'windwp/nvim-autopairs', + event = "InsertEnter", + opts = {} -- this is equalent to setup({}) function + }, + { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'catppuccin', + component_separators = '|', + section_separators = '', + }, + }, + }, + + { + -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + -- Enable `lukas-reineke/indent-blankline.nvim` + -- See `:help ibl` + main = 'ibl', + opts = { + scope = { + enabled = false, + } + } + }, + + -- "gc" to comment visual regions/lines + { 'numToStr/Comment.nvim', opts = {} }, + + -- Fuzzy Finder (files, lsp, etc) + { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + }, + }, + + { + -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, + build = ':TSUpdate', + }, + + { + 'github/copilot.vim', + }, + +}, {}) + +-- [[ Setting options ]] +-- See `:help vim.o` +-- NOTE: You can change these options as you wish! + +-- Set highlight on search +vim.o.hlsearch = false + +-- Make line numbers default +vim.wo.relativenumber = true + +-- Enable mouse mode +vim.o.mouse = 'a' + +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.o.clipboard = 'unnamedplus' + +-- Enable break indent +vim.o.breakindent = true + +-- Save undo history +vim.o.undofile = true + +-- Case-insensitive searching UNLESS \C or capital in search +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Keep signcolumn on by default +vim.wo.signcolumn = 'yes' + +-- Decrease update time +vim.o.updatetime = 250 +vim.o.timeoutlen = 300 + +-- Set completeopt to have a better completion experience +vim.o.completeopt = 'menuone,noselect' + +-- NOTE: You should make sure your terminal supports this +vim.o.termguicolors = true + +-- [[ Basic Keymaps ]] + +-- Keymaps for better default experience +-- See `:help vim.keymap.set()` +vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) + +-- Remap for dealing with word wrap +vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +-- Diagnostic keymaps +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) + +vim.keymap.set('n', 'ff', vim.lsp.buf.format, { desc = 'Format buffer' }) +vim.keymap.set('n', 'ot', ':40spj:terminali', { desc = 'Open terminal bottom split' }) + +vim.keymap.set('t', '', [[]]) + +-- [[ Highlight on yank ]] +-- See `:help vim.highlight.on_yank()` +local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = '*', +}) + +-- [[ Configure Telescope ]] +-- See `:help telescope` and `:help telescope.setup()` +require('telescope').setup { + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, + }, + }, +} + +-- Enable telescope fzf native, if installed +pcall(require('telescope').load_extension, 'fzf') + +-- Telescope live_grep in git root +-- Function to find the git root directory based on the current buffer's path +local function find_git_root() + -- Use the current buffer's path as the starting point for the git search + local current_file = vim.api.nvim_buf_get_name(0) + local current_dir + local cwd = vim.fn.getcwd() + -- If the buffer is not associated with a file, return nil + if current_file == "" then + current_dir = cwd + else + -- Extract the directory from the current file's path + current_dir = vim.fn.fnamemodify(current_file, ":h") + end + + -- Find the Git root directory from the current file's path + local git_root = vim.fn.systemlist("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel")[1] + if vim.v.shell_error ~= 0 then + print("Not a git repository. Searching on current working directory") + return cwd + end + return git_root +end + +-- Custom live_grep function to search in git root +local function live_grep_git_root() + local git_root = find_git_root() + if git_root then + require('telescope.builtin').live_grep({ + search_dirs = { git_root }, + }) + end +end + +vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {}) + +-- See `:help telescope.builtin` +vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) +vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) +end, { desc = '[/] Fuzzily search in current buffer' }) + +vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) +vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) +vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) +vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sG', ':LiveGrepGitRoot', { desc = '[S]earch by [G]rep on Git Root' }) +vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) +vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) + +-- [[ Configure Treesitter ]] +-- See `:help nvim-treesitter` +-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}' +vim.defer_fn(function() + require('nvim-treesitter.configs').setup { + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, + + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = false, + + highlight = { enable = true }, + indent = { enable = false }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, + } +end, 0) + +-- [[ Configure LSP ]] +-- This function gets run when an LSP connects to a particular buffer. +local on_attach = function(_, bufnr) + -- NOTE: Remember that lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself + -- many times. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local nmap = function(keys, func, desc) + if desc then + desc = 'LSP: ' .. desc + end + + vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) + end + + nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') + nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + + nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- See `:help K` for why this keymap + nmap('K', vim.lsp.buf.hover, 'Hover Documentation') + nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + + -- Lesser used LSP functionality + nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') + nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') + nmap('wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, '[W]orkspace [L]ist Folders') + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + vim.lsp.buf.format() + end, { desc = 'Format current buffer with LSP' }) +end + +-- document existing key chains +require('which-key').register { + ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, + ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, + ['h'] = { name = 'More git', _ = 'which_key_ignore' }, + ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, + ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, +} + +-- mason-lspconfig requires that these setup functions are called in this order +-- before setting up the servers. +require('mason').setup() +require('mason-lspconfig').setup() + + +-- Enable the following language servers +-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. +-- +-- Add any additional override configuration in the following tables. They will be passed to +-- the `settings` field of the server config. You must look up that documentation yourself. +-- +-- If you want to override the default filetypes that your language server will attach to you can +-- define the property 'filetypes' to the map in question. +local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- tsserver = {}, + -- html = { filetypes = { 'html', 'twig', 'hbs'} }, + + lua_ls = { + Lua = { + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, + }, + }, +} + +-- Setup neovim lua configuration +require('neodev').setup() + +-- nvim-cmp supports additional completion capabilities, so broadcast that to servers +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + +-- Ensure the servers above are installed +local mason_lspconfig = require 'mason-lspconfig' + +mason_lspconfig.setup { + ensure_installed = vim.tbl_keys(servers), +} + +mason_lspconfig.setup_handlers { + function(server_name) + require('lspconfig')[server_name].setup { + capabilities = capabilities, + on_attach = on_attach, + settings = servers[server_name], + filetypes = (servers[server_name] or {}).filetypes, + } + end, +} + +-- [[ Configure nvim-cmp ]] +-- See `:help cmp` +local cmp = require 'cmp' +local luasnip = require 'luasnip' +require('luasnip.loaders.from_vscode').lazy_load() +luasnip.config.setup {} + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { + completeopt = 'menu,menuone,noinsert' + }, + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, +} + +vim.api.nvim_create_autocmd('BufWritePre', { + pattern = { '*.tsx', '*.ts', '*.jsx', '*.js' }, + command = 'silent! EslintFixAll', + group = vim.api.nvim_create_augroup('MyAutocmdsJavaScripFormatting', {}), +}) + +vim.keymap.set('i', '', 'copilot#Accept("\\")', { + expr = true, + replace_keycodes = false +}) +vim.g.copilot_no_tab_map = true + + +-- The line beneath this is called `modeline`. See `:help modeline` +-- vim: ts=2 sts=2 sw=2 et diff --git a/nvim/init.vim b/nvim/init.vim new file mode 100644 index 0000000..0aa2ee7 --- /dev/null +++ b/nvim/init.vim @@ -0,0 +1,233 @@ +set backspace=2 " Backsapce deletes character" +" always turn on syntax check +syntax on +" map sapce as leader key +let mapleader=" " +set nobackup +set nowritebackup +set tabstop=4 softtabstop=4 +set shiftwidth=4 +set expandtab +set smartindent +set undodir=~/.vim/undodir +" no line wrapping, scrolling +set nowrap +" buffers can be closed without saving +set hidden +"keep 8 lines while scrolling +set scrolloff=8 +set undofile +set incsearch +set noswapfile +set history=50 +set autoread " always read changes +set autowrite +set ruler +set number relativenumber +set rnu +set nocompatible " be iMproved, required +set clipboard=unnamed " add macos clipboard support +set splitbelow +set termguicolors +filetype off " required + +" remove bars between vertical splits +highlight VertSplit cterm=NONE + + " When editing a file, always jump to the last known cursor position. + " Don't do it for commit messages, when the position is invalid, or when + " inside an event handler (happens when dropping a file on gvim). + autocmd BufReadPost * + \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal g`\"" | + \ endif + + " Set syntax highlighting for specific file types + autocmd BufRead,BufNewFile *.md set filetype=markdown + autocmd BufRead,BufNewFile .{jscs,jshint,eslint}rc set filetype=json + autocmd BufRead,BufNewFile aliases.local,zshrc.local,*/zsh/configs/* set filetype=sh + autocmd BufRead,BufNewFile gitconfig.local set filetype=gitconfig + autocmd BufRead,BufNewFile tmux.conf.local set filetype=tmux + autocmd BufRead,BufNewFile vimrc.local set filetype=vim + +call plug#begin() + +Plug 'jiangmiao/auto-pairs' +Plug 'tpope/vim-surround' +Plug 'chrisbra/improvedft' +Plug 'mhinz/vim-startify' +Plug 'rust-lang/rust.vim' +Plug 'nvim-lua/popup.nvim' +Plug 'nvim-lua/plenary.nvim' +Plug 'nvim-telescope/telescope.nvim' +Plug 'nvim-telescope/telescope-fzy-native.nvim' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'neovim/nvim-lspconfig' +Plug 'hrsh7th/nvim-compe' +Plug 'drewtempelmeyer/palenight.vim' +Plug 'kyazdani42/nvim-web-devicons' " for file icons +Plug 'kyazdani42/nvim-tree.lua' +call plug#end() + +filetype plugin indent on " require +" use a slightly darker background, like GitHub inline code blocks + +set t_Co=256 " This is may or may not needed. +let g:github_colors_soft = 1 +set background=dark +colorscheme palenight +" let NERDTree show hidden files and directories and line numbers +let NERDTreeShowHidden=1 +let NERDTreeShowLineNumbers=1 + +" shortcut to toggle nerdtree +map :NERDTreeToggle + +let g:airline_theme = 'ayu_dark' + +tnoremap +" map Leader y and p to copy / paste from clipboard +nnoremap p "*P +nnoremap y "*y +nnoremap Y "*Y + +nnoremap :NvimTreeToggle +nnoremap r :NvimTreeRefresh + + +nnoremap lua vim.lsp.buf.definition() +nnoremap K lua vim.lsp.buf.hover() +nnoremap gD lua vim.lsp.buf.implementation() +nnoremap lua vim.lsp.buf.signature_help() +nnoremap 1gD lua vim.lsp.buf.type_definition() +nnoremap g0 lua vim.lsp.buf.document_symbol() +nnoremap gW lua vim.lsp.buf.workspace_symbol() +nnoremap gd lua vim.lsp.buf.declaration() + + +" hotkey for splitting windows +map s :sp +map v :vs +map c :q +map t :10spj:terminali + +map < :vertical resize +5 +map > :vertical resize -5 +map + :resize +5 +map - :resize -5 + + +" Find files using Telescope command-line sugar. +nnoremap ff Telescope find_files +nnoremap fg Telescope live_grep +nnoremap gf Telescope git_files +nnoremap fb Telescope buffers +nnoremap fh Telescope help_tags +nnoremap gr Telescope lsp_references +nnoremap ca Telescope lsp_code_actions +nnoremap wd Telescope lsp_workspace_diagnostics +nnoremap gd Telescope lsp_definitions +nnoremap gi Telescope lsp_implementations + +" Use tab for trigger completion with characters ahead and navigate. +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction +" GoTo code navigation. +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" map Y to copy rest of line +map Y y$ + +filetype plugin on +set shell=/usr/bin/zsh + +let g:mdip_imgdir = '.' + +nnoremap k (v:count > 1 ? "m'" . v:count : '') . 'k' +nnoremap j (v:count > 1 ? "m'" . v:count : '') . 'j' +"cycle through buffers +nnoremap bn :bn +nnoremap bp :bp +nnoremap bk :bd + +inoremap compe#complete() +inoremap compe#confirm('') +inoremap compe#close('') +inoremap compe#scroll({ 'delta': +4 }) +inoremap compe#scroll({ 'delta': -4 }) + + + +nmap K :lua vim.lsp.buf.hover() +nmap gd :lua vim.lsp.buf.definition() +nmap gi :lua vim.lsp.buf.implementation() +nmap gr :lua vim.lsp.buf.references() +nnoremap ca lua vim.lsp.buf.code_action() +nnoremap rn :lua vim.lsp.buf.rename() +map lua vim.lsp.diagnostic.goto_next() +map lua vim.lsp.diagnostic.goto_prev() +nnoremap f lua vim.lsp.buf.format() + +autocmd BufNewFile,BufRead *.org setf dotoo " make dotoo work with .org + +lua << EOF +local nvim_lsp = require('lspconfig') +require'lspconfig'.rust_analyzer.setup{} +require'lspconfig'.tsserver.setup{} +require'lspconfig'.pyright.setup{} +vim.o.completeopt = "menuone,noselect" +local on_attach = function(client, bufnr) + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + + -- Mappings. + local opts = { noremap=true, silent=true } + buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) + buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) + buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) + buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) + buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) + buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) + buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) +end + +require'compe'.setup { + enabled = true; + autocomplete = true; + debug = false; + min_length = 1; + preselect = 'enable'; + throttle_time = 80; + source_timeout = 200; + incomplete_delay = 400; + max_abbr_width = 100; + max_kind_width = 100; + max_menu_width = 100; + documentation = true; + + source = { + path = true; + buffer = true; + calc = true; + nvim_lsp = true; + nvim_lua = true; + }; +} +EOF diff --git a/scripts/notes.sh b/scripts/notes.sh new file mode 100755 index 0000000..dae315c --- /dev/null +++ b/scripts/notes.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +for f in $(find ~/personal_workspace/notes -name '*.md'); +do pandoc -s -o "${f%md}pdf" "${f}"; +done diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..94c1f41 --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,17 @@ +unbind r +bind r source-file ~/.tmux.conf + +set -g prefix C-s +set -g default-terminal "screen-256color" +set-option -a terminal-overrides ",alacritty:RGB" + +setw -g mode-keys vi +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R + +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'christoomey/vim-tmux-navigator' + +run '~/.tmux/plugins/tpm/tpm' diff --git a/vscodium/keybindings.json b/vscodium/keybindings.json new file mode 100644 index 0000000..1811bc5 --- /dev/null +++ b/vscodium/keybindings.json @@ -0,0 +1,24 @@ +// Place your key bindings in this file to override the defaultsauto[] +[ + { + "key": "alt+v", + "command": "workbench.action.splitEditor" + }, + { + "key": "alt+s", + "command": "workbench.action.splitEditorOrthogonal" + }, + { + "key": "ctrl+[Backquote]", + "command": "workbench.action.terminal.toggleTerminal" + }, + { + "key": "ctrl+shift+[Equal]", + "command": "-workbench.action.terminal.toggleTerminal" + }, + { + "key": "ctrl+k ctrl+1", + "command": "-editor.foldLevel1", + "when": "editorTextFocus && foldingEnabled" + } +] diff --git a/vscodium/settings.json b/vscodium/settings.json new file mode 100644 index 0000000..d174b6b --- /dev/null +++ b/vscodium/settings.json @@ -0,0 +1,10 @@ +{ + "workbench.colorTheme": "Atom One Dark", + "editor.fontFamily": "SF Mono", + "editor.fontWeight": "600", + "terminal.integrated.fontFamily": "SF Mono", + "terminal.integrated.fontWeight": "600", + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.formatOnPaste": true +} diff --git a/zsh/.zprofile b/zsh/.zprofile new file mode 100644 index 0000000..cb59684 --- /dev/null +++ b/zsh/.zprofile @@ -0,0 +1,5 @@ + +# Setting PATH for Python 3.8 +# The original version is saved in .zprofile.pysave +PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}" +export PATH diff --git a/zsh/.zsh_history b/zsh/.zsh_history new file mode 100644 index 0000000..ef0b910 --- /dev/null +++ b/zsh/.zsh_history @@ -0,0 +1,545 @@ +: 1584223353:0;la +: 1584223353:0;ls +: 1584223353:0;pwd +: 1584223353:0;emacs +: 1584223353:0;java +: 1584223353:0;brew +: 1584223353:0;ls +: 1584223353:0;brew +: 1584223353:0;/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +: 1584223353:0;sudo /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +: 1584223353:0;/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +: 1584223353:0;brew install emacs +: 1584223353:0;emacs +: 1584223353:0;ls -A +: 1584223353:0;emacs +: 1584223353:0;python +: 1584223353:0;defaults write com.apple.Finder AppleShowAllFiles YES +: 1584223353:0;ls +: 1584223353:0;cd Library +: 1584223353:0;ls +: 1584223353:0;cd Preferences/SAP +: 1584223353:0;ls +: 1584223353:0;nano settings +: 1584223353:0;cd Library/Preferences/SAP +: 1584223353:0;ls +: 1584223353:0;nano settings +: 1584223353:0;ls +: 1584223353:0;nano settings +: 1584223353:0;cd /etc/hosts +: 1584223353:0;cd / +: 1584223353:0;ls +: 1584223353:0;cd etc +: 1584223353:0;ls +: 1584223353:0;nano hosts +: 1584223353:0;sudo nano hosts +: 1584223353:0;pwd +: 1584223353:0;ls -A +: 1584223353:0;brew install dunn/emacs/helm +: 1584223353:0;brew install git +: 1584223353:0;git +: 1584223353:0;ls +: 1584223353:0;mkdir 'VSCode Workspace' +: 1584223353:0;cd VSCode\ Workspace +: 1584223353:0;ls +: 1584223353:0;git clone https://d068796@git.wdf.sap.corp/fnf/F2/SDbF/SDbFfSCE1O/fin.lib.brqlib.git +: 1584223353:0;git clone https://d068796@git.wdf.sap.corp/fnf/F2/SDbF/SDbFfSO1Fa/gs.fin.lib.mapformatdata.git +: 1584223353:0;git clone https://d068796@git.wdf.sap.corp/fnf/F2/SDbF/SDbFwUD/gs.fin.managetreasuryformats.git +: 1584223353:0;git clone https://d068796@git.wdf.sap.corp/fnf/F2/SDbF/SDbFwUD/glofi.gen.dmee.git +: 1584223353:0;pwd +: 1584223353:0;ls +: 1584223353:0;finder +: 1584223353:0;ssh-keygen -t rsa -b 4096 -C julius.klotz01@sap.com +: 1584223353:0;cd .ssh +: 1584223353:0;ls +: 1584223353:0;cd /Users/d068796/.ssh +: 1584223353:0;ssh-keygen -t rsa -b 4096 -C julius.klotz01@sap.com +: 1584223353:0;ssh-keygen +: 1584223353:0;ssh-keygen +: 1584223353:0;ls -A +: 1584223353:0;cd .ssh +: 1584223353:0;ssh-keygen -t rsa -b 4096 -C julius.klotz01@sap.com +: 1584223353:0;ls +: 1584223353:0;nano id_rsa.pub +: 1584223353:0;cd VSCode\ Workspace +: 1584223353:0;ls +: 1584223353:0;cd fin.lib.brqlib +: 1584223353:0;ls +: 1584223353:0;scp -p -P 29418 d068796@git.wdf.sap.corp:hooks/commit-msg .git/hooks/ +: 1584223353:0;cd +: 1584223353:0;cd VSCode\ Workspace +: 1584223353:0;git clone https://d068796@git.wdf.sap.corp/fnf/F2/Ss/CDS4/Cd/retail.xrp.revieworderplanitems.git +: 1584223353:0;ls +: 1584223353:0;brew install nginx +: 1584223353:0;nginx +: 1584223353:0;man nginx +: 1584223353:0;uit +: 1584223353:0;brew install openssl +: 1584223353:0;cd +: 1584223353:0;sudo nano localhost.conf +: 1584223353:0;sudo nano localhost.conf +: 1584223353:0;cd +: 1584223353:0;nano localhost.conf +: 1584223353:0;openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.crt -config localhost.conf +: 1584223353:0;ls +: 1584223353:0;cp localhost.crt /etc/ssl/certs/localhost.crt +: 1584223353:0;nginx +: 1584223353:0;nginx -h +: 1584223353:0;service nginx reload +: 1584223353:0;openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.crt -config localhost.conf +: 1584223353:0;reboot +: 1584223353:0;nginx +: 1584223353:0;nginx +: 1584223353:0;nginx -h +: 1584223353:0;nginx stop +: 1584223353:0;man nginx +: 1584223353:0;nginx SIGHUP +: 1584223353:0;nginx -t +: 1584223353:0;pwd +: 1584223353:0;pwd +: 1584223353:0;nginx +: 1584223353:0;certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n "localhost" -i localhost.crt +: 1584223353:0;brew install certutil +: 1584223353:0;cd / +: 1584223353:0;ls +: 1584223353:0;cd usr/local +: 1584223353:0;cd etc/openssl@1.1 +: 1584223353:0;ls +: 1584223353:0;cd certs +: 1584223353:0;ls +: 1584223353:0;security add-trusted-cert foo.crt +: 1584223353:0;cd +: 1584223353:0;security add-trusted-cert localhost.crt +: 1584223353:0;pwd +: 1584223353:0;nginx -s reload +: 1584223353:0;nginx -s reload +: 1584223353:0;nginx -s reload +: 1584223353:0;nginx -s reload +: 1584223353:0;nginx -s reload +: 1584223353:0;nginx -s reload +: 1584223353:0;nginx -s reload +: 1584223353:0;nginx -s reload +: 1584223353:0;nginx -s reload +: 1584223353:0;nginx -s reload +: 1584223353:0;cd +: 1584223353:0;git clone https://d068796@git.wdf.sap.corp/fnf/F2/Bs2/SoHQ42016/retail.udf.reuse.git +: 1584223353:0;nginx -s reload +: 1584223353:0;brew update +: 1584223353:0;brew install tomcat +: 1584223353:0;brew remove tomcat +: 1584223353:0;cd Downloads +: 1584223353:0;ls +: 1584223353:0;unzip apache-tomcat-9.0.30.tar.gz +: 1584223353:0;ls +: 1584223353:0;cd apache-tomcat-9.0.30 +: 1584223353:0;/Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.DemoApplication +: 1584223353:0;brew tap caskroom/cask +: 1584223353:0;brew install mactex +: 1584223353:0;brew cask install mactex +: 1584223353:0;/Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;java +: 1584223353:0;cd "/Users/d068796/VSCode Workspace/demo" ; /Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;cd "/Users/d068796/VSCode Workspace/demo" ; /Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;java_home -V +: 1584223353:0;/usr/libexec/java_home -V +: 1584223353:0;brew cask install jumpcut +: 1584223353:0;jumpcut +: 1584223353:0;cd /Applications +: 1584223353:0;ls +: 1584223353:0;brew cask install jumpcut +: 1584223353:0;brew tap adoptopenjdk/openjdk +: 1584223353:0;brew cask install adoptopenjdk8 +: 1584223353:0;/usr/libexec/java_home -V +: 1584223353:0;cd +: 1584223353:0;ls +: 1584223353:0;cd Downloads +: 1584223353:0;curl -O http://adt.wdf.sap.corp:8080/updatesite/milestone/bundled/distros/ABAPDevelopmentTools-macosx.cocoa.x86_64.tar.gz +: 1584223353:0;curl -O http://a4h.wdf.sap.corp:8080/updatesite/milestone/distros/hdbstudio_milestone-ADT-UI5-macosx.cocoa.x86_64.tar.gz +: 1584223353:0;/Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;cd "/Users/d068796/VSCode Workspace/demo" ; /Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;cd "/Users/d068796/VSCode Workspace/demo" ; /Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;cd "/Users/d068796/VSCode Workspace/demo" ; /Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;cd "/Users/d068796/VSCode Workspace/demo" ; /Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;cd "/Users/d068796/VSCode Workspace/demo" ; /Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;cd "/Users/d068796/VSCode Workspace/demo" ; /Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;cd .. +: 1584223353:0;git clone https://github.com/SAP-samples/cloud-bulletinboard-ads.git +: 1584223353:0;/Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;cd "/Users/d068796/VSCode Workspace/demo" ; /Library/Java/JavaVirtualMachines/sapmachine-jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 @/var/folders/02/p59xvsmx40521xn634m_hkv00000gn/T/cp_ezpct01drli0jx4mxviuhpk00.argfile com.example.demo.SpringRestToDoListApplication +: 1584223353:0;cd tomc +: 1584223353:0;ls +: 1584223353:0;cd apache-tomcat-9.0.30 +: 1584223353:0;pwd +: 1584223353:0;cd .. +: 1584223353:0;cd VSCode\ Workspace +: 1584223353:0;git clone --single-branch https://github.com/SAP-samples/cloud-bulletinboard-ads.git +: 1584223353:0;git clone https://github.com/SAP-samples/cloud-bulletinboard-ads.git -b master --single-branch +: 1584223353:0;brew install cloudfoundry/tap/cf-cli +: 1584223353:0;cf +: 1584223353:0;cf api +: 1584223353:0;cf login -a https://api.cf.eu10.hana.ondemand.com +: 1584223353:0;cf target +: 1584223353:0;ls +: 1584223353:0;cd eclipse-workspace +: 1584223353:0;ls +: 1584223353:0;cd +: 1584223353:0;cd git +: 1584223353:0;ls +: 1584223353:0;cd cloud-bulletinboard-ads +: 1584223353:0;ls +: 1584223353:0;mvn clean verify +: 1584223353:0;cd .. +: 1584223353:0;ls +: 1584223353:0;cd . +: 1584223353:0;cd .. +: 1584223353:0;ls +: 1584223353:0;mv cc-bulletinboard-ads.war git/cloud-bulletinboard-ads +: 1584223353:0;cd git +: 1584223353:0;cd cloud-bulletinboard-ads +: 1584223353:0;ls +: 1584223353:0;cf push -n bulletinboard.ads.d068796 +: 1584223353:0;ls +: 1584223353:0;mv cc-bulletinboard-ads.war target/bulletinbouard-ads.war +: 1584223353:0;ls +: 1584223353:0;cf push -n bulletinboard.ads.d068796 +: 1584223353:0;ls +: 1584223353:0;cd target +: 1584223353:0;ls +: 1584223353:0;mv bulletinbouard-ads.war bulletinboard-ads.war +: 1584223353:0;cd .. +: 1584223353:0;cf push -n bulletinboard.ads.d068796 +: 1584223353:0;cf scale bulletinboard-ads -i 2 +: 1584223353:0;cf scale bulletinboard-ads -i 1 +: 1584223353:0;/Library/PostgreSQL/12/scripts/runpsql.sh; exit +: 1584223353:0;/Library/PostgreSQL/12/scripts/runpsql.sh; exit +: 1584223353:0;/Library/PostgreSQL/12/scripts/runpsql.sh; exit +: 1584223353:0;/Library/PostgreSQL/12/scripts/runpsql.sh; exit +: 1584223353:0;/Library/PostgreSQL/12/scripts/runpsql.sh; exit +: 1584223353:0;/Library/PostgreSQL/12/scripts/runpsql.sh; exit +: 1584223353:0;createdb test +: 1584223353:0;sudo -u postgres psql template1 +: 1584223353:0;psql -U postgres +: 1584223353:0;"/Users/d068796/VSCode Workspace/ads/mvnw" package -f "/Users/d068796/VSCode Workspace/ads/pom.xml" +: 1584223353:0;"/Users/d068796/VSCode Workspace/ads/mvnw" clean -f "/Users/d068796/VSCode Workspace/ads/pom.xml" +: 1584223353:0;"/Users/d068796/VSCode Workspace/ads/mvnw" package -f "/Users/d068796/VSCode Workspace/ads/pom.xml" +: 1584223353:0;"/Users/d068796/VSCode Workspace/ads/mvnw" verify -f "/Users/d068796/VSCode Workspace/ads/pom.xml" +: 1584223353:0;"/Users/d068796/VSCode Workspace/ads/mvnw" verify -f "/Users/d068796/VSCode Workspace/ads/pom.xml" +: 1584223353:0;maven package +: 1584223353:0;mvn package +: 1584223353:0;brew install mongodb-community +: 1584223353:0;brew tap mongodb/brew +: 1584223353:0;brew install mongodb-community +: 1584223353:0;nano +: 1584223353:0;nano /usr/local/etc/mongod.conf +: 1584223353:0;mongod +: 1584223353:0;ls +: 1584223353:0;cd VSCode\ Workspace +: 1584223353:0;mkdir mydb +: 1584223353:0;ls +: 1584223353:0;cd mydb +: 1584223353:0;rm -r demo +: 1584223353:0;cd .. +: 1584223353:0;rm -r demo +: 1584223353:0;rm -r fin.lib.brqlib +: 1584223353:0;ls +: 1584223353:0;rm -r fin.lib.brqlib +: 1584223353:0;ls +: 1584223353:0;rm -r gs* +: 1584223353:0;ls +: 1584223353:0;cd mydb +: 1584223353:0;pwd +: 1584223353:0;nano /usr/local/etc/mongod.conf +: 1584223353:0;cd +: 1584223353:0;mongod +: 1584223353:0;nano /usr/local/etc/m +: 1584223353:0;nano /usr/local/etc/mongod.conf +: 1584223353:0;mongod +: 1584223353:0;mongod --config /usr/local/etc/mongod.conf +: 1584223353:0;mongod --port 27017 --dbpath /Users/d068796/VSCode Workspace/mydb +: 1584223353:0;mongod --port 27017 --dbpath "/Users/d068796/VSCode Workspace/mydb" +: 1584223353:0;ls /usr/etc +: 1584223353:0;cd /usr +: 1584223353:0;ls +: 1584223353:0;cd local +: 1584223353:0;ls +: 1584223353:0;mongo +: 1584223353:0;vim +: 1584223353:0;ls +: 1584223353:0;ls -A +: 1584223353:0;brew install dunn/emacs/helm +: 1584223353:0;pwd +: 1584223353:0;emacs +: 1584223353:0;vim +: 1584223353:0;ls -A +: 1584223353:0;netstat +: 1584223353:0;ls -A +: 1584223353:0;ls +: 1584223353:0;cf VSCode\ Workspace +: 1584223353:0;ls +: 1584223353:0;cd VSCode\ Workspace +: 1584223353:0;ls +: 1584223353:0;cd ads +: 1584223353:0;ls +: 1584223353:0;cd src +: 1584223353:0;ls +: 1584223353:0;cd main +: 1584223353:0;ls +: 1584223353:0;cd java +: 1584223353:0;ls +: 1584223353:0;cd com +: 1584223353:0;ls +: 1584223353:0;cd mongoapp/ads/controllers +: 1584223353:0;ls +: 1584223353:0;vim BadRequestException.java +: 1584223353:0;ls -A +: 1584221888:0;tmux +: 1584221893:0;brew install tmux +: 1584222173:0;ls .A +: 1584222175:0;ls -A +: 1584222595:0;vim +: 1584222746:0;cd /usr/share +: 1584222747:0;ls +: 1584222751:0;cd vim +: 1584222752:0;ls +: 1584222761:0;nano vimrc +: 1584222912:0;sudo nano vimrc +: 1584223353:0;ls -A +: 1584223353:0;nano .zprofile +: 1584223353:0;ls -G +: 1584223353:0;sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" +: 1584223204:0;ls +: 1584223209:0;cd nvim-osx64 +: 1584223211:0;cd bin +: 1584223212:0;ls +: 1584223214:0;./nvim +: 1584223353:0;/Applications/nvim ; exit; +: 1584223377:0;nvim +: 1584223385:0;./nvim test,txt +: 1584357720:0;ls -A +: 1584391303:0;npm +: 1584391335:0;brew install node +: 1584391420:0;npm +: 1585680194:0;vim +: 1585680332:0;ls -A +: 1585680343:0;vim .vimrc +: 1585680347:0;vim +: 1585680491:0;mkdir Test +: 1585680499:0;vim Test/test.js +: 1585680582:0;ls +: 1585680586:0;vim Test/test.js +: 1585680591:0;vim .vimrc +: 1585680631:0;vim Test/test.js +: 1585680887:0;git +: 1585680908:0;git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim +: 1585681237:0;vim .vimrc +: 1585681367:0;vim +: 1585681476:0;brew install python +: 1585681683:0;brew install cmake +: 1585681944:0;cd .vim +: 1585681945:0;ls +: 1585681947:0;cd bundle +: 1585681962:0;git clone https://github.com/Valloric/YouCompleteMe.git +: 1585682014:0;mkdir YouCompleteMe/ycmbuild +: 1585682022:0;cd YouCompleteMe/ycmbuild +: 1585682033:0;cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp/ +: 1585682040:0;cd .. +: 1585682042:0;ls +: 1585682052:0;cd .. +: 1585682062:0;ls +: 1585682063:0;cd bundle +: 1585682064:0;ls +: 1585682068:0;rm -r YouCompleteMe +: 1585682074:0;ls +: 1585682127:0;git clone https://github.com/Valloric/YouCompleteMe.git +: 1585682134:0;rm -r YouCompleteMe +: 1585682138:0;ls +: 1585682144:0;rm -r YouCompleteMe +: 1585682147:0;git clone https://github.com/Valloric/YouCompleteMe.git +: 1585682217:0;cd YouCompleteMe/ +: 1585682219:0;ls +: 1585682233:0;cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ +: 1585682247:0;cd third_party +: 1585682249:0;ls +: 1585682253:0;cd ycmd +: 1585682254:0;ls +: 1585682304:0;brew install macvim +: 1585685555:0;brew install mono go nodejs +: 1585685728:0;macvim +: 1585685893:0;cd +: 1585685896:0;vim .vimrc +: 1585685920:0;vim +: 1585685960:0;macvim +: 1585685963:0;mcvim +: 1585686047:0;cp .vimrc vimrcsave +: 1585686052:0;brew remove vim +: 1585686084:0;brew uninstall --force vim +: 1585686087:0;vim +: 1585686100:0;brew remove --force vim +: 1585686106:0;brew cleanup +: 1585686135:0;brew install vim --with-python3 +: 1585686175:0;brew install vim +: 1585686187:0;vim +: 1585686194:0;brew remove macvim +: 1585686197:0;vim +: 1585686729:0;brew install vim +: 1585686787:0;vim --version +: 1585686799:0;cd /usr/local/bin +: 1585686799:0;ls +: 1585686832:0;cd /usr/local/bin +: 1585686833:0;ls +: 1585686856:0;command -v vim +: 1585686908:0;echo $PATH +: 1585686927:0;brew link vim +: 1585686942:0;brew unlink vim && brew link vim +: 1585686948:0;command -v vim +: 1585686959:0;echo $PATH +: 1585687032:0;cd +: 1585687037:0;cd /usr/local/bin +: 1585687037:0;ls +: 1585687040:0;cd vim +: 1585687051:0;command -v vim +: 1585687094:0;alias vim /usr/local/bin/vim +: 1585687096:0;vim +: 1585687104:0;vim --version +: 1585687114:0;command -v vim +: 1585687127:0;echo $PATH +: 1585687186:0;brew remove vim +: 1585687196:0;brew install macvim --with-override-system-vim +: 1585687251:0;brew install macvim -- --with-override-system-vim +: 1585687282:0;vim --version +: 1585687293:0;command -v vim +: 1585687329:0;mvim +: 1585687365:0;brew install vim +: 1585687377:0;brew remove macvim +: 1585687382:0;brew install vim +: 1585687419:0;cd /usr/local +: 1585687420:0;ls +: 1585687424:0;cd Cellar +: 1585687426:0;ls +: 1585687435:0;cd vim +: 1585687437:0;ls +: 1585687441:0;cd 8.2.0450 +: 1585687441:0;ls +: 1585687446:0;cd bin +: 1585687447:0;ls +: 1585687454:0;pwd +: 1585687464:0;cd +: 1585687491:0;nano .bash_profile +: 1585687560:0;mv .bash_profile .zshenv +: 1585687591:0;vim --version +: 1585687597:0;vim +: 1585687601:0;ls +: 1585687610:0;cd +: 1585687618:0;nano .zshenv +: 1585687662:0;vim --version +: 1585687683:0;nano .vimrc +: 1585687698:0;vim +: 1585687723:0;vim .vimrc +: 1585687813:0;vim +: 1585687853:0;vim +PluginInstall +qall +: 1585687923:0;cd .vim +: 1585687924:0;ls +: 1585687926:0;cd bundle +: 1585687927:0;ls +: 1585687930:0;cd YouCompleteMe +: 1585687931:0;ls +: 1585687944:0;brew install mono go nodejs +: 1585687972:0;python3 install.py --all +: 1585688002:0;git submodule update --init --recursive +: 1585688083:0;python3 install.py --all +: 1585688401:0;vim +: 1585716994:0;ls -A +: 1585716997:0;ls +: 1585717825:0;cd Test +: 1585717827:0;ls +: 1585717830:0;vim test.js +: 1585718382:0;cd +: 1585718385:0;vim .vimrc +: 1585718428:0;vim +: 1585718469:0;ls +: 1585718476:0;vim Test/test.js +: 1585719307:0;vim .vimrc +: 1585719345:0;vim +: 1585719397:0;ls -A +: 1585719727:0;brew install nnn +: 1585719987:0;vim .vimrc +: 1585720010:0;vim +: 1585720235:0;vim -vimrc +: 1585720245:0;vim .vimrc +: 1585720267:0;vim +: 1585721135:0;vim .vimrc +: 1585721162:0;vim +: 1585765188:0;tmux +: 1585765193:0;ls -A +: 1585765195:0;vim +: 1585813241:0;vim .vimrc +: 1585827083:0;nano .vimrc +: 1585827107:0;vim +: 1585827142:0;vim .vimrc +: 1585827219:0;vim +: 1585827229:0;ls +: 1585827239:0;cd PersonalWorkspace +: 1585827239:0;ls +: 1585827317:0;git clone https://jk1006@bitbucket.org/jk1006/homepage_svg.git +: 1585827360:0;ls -A +: 1585827363:0;npm +: 1585827368:0;cd homepage_svg +: 1585827369:0;ls +: 1585827374:0;cd svg-homepage +: 1585827376:0;npm install +: 1585827740:0;ls +: 1585827744:0;cd src +: 1585827744:0;ls +: 1585827749:0;vim App.js +: 1585845985:0;ls -A +: 1585845995:0;cd PersonalWorkspace +: 1585845996:0;ls +: 1585846000:0;mkdir org +: 1585846002:0;cd org +: 1585846003:0;l +: 1585846004:0;ls +: 1585855848:0;cd +: 1585855850:0;ls +: 1585857165:0;vim +: 1585857175:0;vimtutor +: 1585857818:0;vim .vimrc +: 1585858207:0;vimtutor +: 1585892312:0;vim CDS.txt +: 1585911714:0;ls +: 1585911723:0;vimtutor +: 1585933734:0;ls -A +: 1585934001:0;vimtutor +: 1585936139:0;man tmux +: 1585936194:0;tmux +: 1585936838:0;t +: 1585936848:0;vim .bashrc +: 1585936854:0;ls -A +: 1585936867:0;vim .zshenv +: 1586015993:0;cd PersonalWorkspace/ +: 1586015995:0;ls +: 1586015999:0;mkdir dotfiles +: 1586016009:0;cd dotfiles +: 1586016015:0;git remote add origin https://jk1006@bitbucket.org/jk1006/dotfiles.git +: 1586016032:0;cd .. +: 1586016039:0;rm -r dotfiles +: 1586016045:0;git clone git clone https://jk1006@bitbucket.org/jk1006/dotfiles.git +: 1586016070:0;git clone git clone https://jk1006@bitbucket.org/jk1006/dotfiles +: 1586016075:0;git clone https://jk1006@bitbucket.org/jk1006/dotfiles.git +: 1586016081:0;ls -A +: 1586016087:0;cd +: 1586016102:0;cp .vimrc PersonalWorkspace/dotfiles +: 1586016109:0;cd PersonalWorkspace/dotfiles +: 1586016110:0;ls +: 1586016114:0;git add -A +: 1586016116:0;git commit +: 1586016145:0;git config --global user.email julius.klotz@posteo.de +: 1586016156:0;git config --global user.name Julius +: 1586016159:0;git commit +: 1586016196:0;git push +: 1586016206:0;git pull +: 1586016871:0;cd +: 1586016873:0;ls -A +: 1586016908:0;cp .z* PersonalWorkspace/dotfiles/zsh/ +: 1586016920:0;cp .z* PersonalWorkspace/dotfiles/zsh +: 1586016931:0;mkdir PersonalWorkspace/dotfiles/zsh +: 1586016936:0;cp .z* PersonalWorkspace/dotfiles/zsh diff --git a/zsh/.zshenv b/zsh/.zshenv new file mode 100644 index 0000000..44ba4b6 --- /dev/null +++ b/zsh/.zshenv @@ -0,0 +1,2 @@ +alias vim="/usr/local/Cellar/vim/8.2.0450/bin/vim" +alias t="tmux" diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..6449948 --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,103 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="/home/julius/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="robbyrussell" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work) +# See https://github.com/ohmyzsh/ohmyzsh/issues/5765 +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +alias py="python3" +alias nvim="/home/julius/AppImages/nvim-linux64/bin/nvim" +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100644 index 0000000..a5e8518 --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,114 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:/Users/d068796/.nvim-osx64/bin:$PATH +export PATH=$PATH:/Users/d068796/.nvim-osx64/bin:/Library/PostgreSQL/13/bin:/Users/d068796/.npm/bin:/Users/d068796/.emacs.d/bin:. +# Path to your oh-my-zsh installation. +export ZSH="/Users/d068796/.oh-my-zsh" +export EDITOR="nvim" +setopt nonomatch +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="robbyrussell" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=( + # other plugins... + zsh-autosuggestions + git + copydir + copyfile + dirhistory + zsh-vi-mode +) +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" +alias ca="cargo" +alias notes="cd ~/personal_workspace/notes; code ." +alias npdf="~/scripts/notes.sh" + +alias cat="bat" +alias ls="exa" +source /usr/share/fzf/shell/key-bindings.zsh