├── .gitignore ├── LICENSE ├── README.md ├── aerc ├── .config │ └── aerc │ │ ├── accounts.conf │ │ ├── aerc.conf │ │ └── binds.conf └── Library │ └── Preferences │ └── aerc ├── alacritty └── .config │ └── alacritty │ └── alacritty.toml ├── bat └── .config │ └── bat │ ├── config │ └── themes │ └── tomorrow-night.tmTheme ├── bin └── bin │ ├── box │ ├── convertvideo │ ├── defaultswrite │ ├── dl-vscode-server.sh │ ├── dockfwd │ ├── envrun │ ├── go.mod │ ├── go.sum │ └── main.go │ ├── fix-electron │ ├── forward-gateway-port │ ├── gateway-ip │ ├── keyrepeat │ ├── killport │ ├── mux │ ├── myzsh │ ├── newline │ ├── port │ ├── run │ ├── run_bash │ ├── switch-win.sh │ ├── switch.sh │ ├── synctime │ ├── temperature │ ├── theme │ └── wayland-electron ├── brew └── .config │ └── brew │ ├── .gitignore │ ├── Brewfile │ └── packages.sample.rb ├── emacs └── .emacs.d │ └── init.el ├── fleet └── config │ └── .fleet │ ├── settings.json │ └── user.json ├── git └── .config │ └── git │ ├── config │ └── template.txt ├── i3 ├── .Xresources ├── .config │ └── i3 │ │ └── config └── .profile ├── ideavim └── .ideavimrc ├── incus └── .config │ └── incus │ ├── profile-box.yaml │ └── profile-cli.yaml ├── neovim ├── .config │ └── nvim │ │ ├── colors │ │ ├── tomorrow-night.vim │ │ └── tomorrow.vim │ │ ├── config │ │ ├── fugitive.vim │ │ ├── fzf.vim │ │ ├── general.vim │ │ ├── go.vim │ │ ├── hcl.vim │ │ ├── theme.vim │ │ ├── vimplug.vim │ │ ├── vscode.vim │ │ └── yank.vim │ │ └── init.vim └── .gitignore ├── nix ├── .config │ ├── nix │ │ ├── core.nix │ │ ├── flake.nix │ │ ├── nix.conf │ │ └── packages.sample.nix │ └── nixpkgs │ │ └── config.nix └── .gitignore ├── obsidian └── slides.css ├── others ├── xmodmap │ ├── chromebook │ │ └── Xmodmap │ └── magic-keyboard │ │ └── Xmodmap └── xrandr │ └── home.sh ├── screenshots └── screenshot.png ├── tmux └── .config │ └── tmux │ └── tmux.conf ├── vscode └── .vscode │ ├── keybindings-linux.json │ ├── keybindings.json │ └── settings.json └── zsh ├── .config └── my-zsh │ ├── completions │ └── _incus │ └── themes │ └── abiola.zsh-theme └── .zshrc /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant/ 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Abiola Ibrahim 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dotfiles 2 | ======== 3 | 4 | Dotfiles managed with Stow for Nix or Brew 5 | 6 | ![Screenshot](screenshots/screenshot.png) 7 | 8 | ## Nix 9 | 10 | ### Prerequisite 11 | 12 | Install Nix. 13 | 14 | ```sh 15 | curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install 16 | ``` 17 | 18 | ### Installation 19 | 20 | `cd` into repository and setup dotfiles 21 | 22 | ``` 23 | nix run nixpkgs#stow bat bin git ideavim neovim nix tmux zsh 24 | ``` 25 | 26 | Pin the current nixpkgs version to avoid repetitive registry downloads 27 | 28 | ``` 29 | nix registry pin nixpkgs 30 | 31 | # to update the pinned nix version later on 32 | # nix flake update --flake path:$HOME/dotfiles/nix/.config/nix/ 33 | ``` 34 | 35 | Install packages. 36 | 37 | ``` 38 | nix profile install path:$HOME/dotfiles/nix/.config/nix/ 39 | ``` 40 | 41 | ### Declarative Nix packages 42 | 43 | ```sh 44 | # create a copy of sample packages file 45 | cp ~/.config/nix/packages.sample.nix ~/.config/nix/packages.nix 46 | 47 | # edit packages file to add extra packages 48 | vim ~/.config/nix/packages.nix 49 | 50 | # run the `nix-switch` alias 51 | nix-switch 52 | ``` 53 | 54 | ## Brew 55 | 56 | ### Prerequisite 57 | 58 | Homebrew 59 | 60 | ```sh 61 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 62 | ``` 63 | 64 | ### Installation 65 | 66 | Install Stow 67 | 68 | ``` 69 | brew install stow 70 | ``` 71 | 72 | Setup dotfiles 73 | 74 | ``` 75 | stow bat brew bin git ideavim neovim tmux zsh 76 | ``` 77 | 78 | Install packages 79 | 80 | ``` 81 | brew bundle -v --file ~/.config/brew/Brewfile 82 | ``` 83 | 84 | ### Declarative Brew packages 85 | 86 | ```sh 87 | # create a copy of the sample packages file 88 | cp ~/.config/brew/packages.sample.rb ~/.config/brew/packages.rb 89 | 90 | # edit packages file to add extra packages 91 | vim ~/.config/brew/packages.rb 92 | 93 | # run the `brew-switch` alias 94 | brew-switch 95 | ``` 96 | 97 | -------------------------------------------------------------------------------- /aerc/.config/aerc/accounts.conf: -------------------------------------------------------------------------------- 1 | [git@abiosoft.com] 2 | source = imaps://abiosoft%40fastmail.com@imap.fastmail.com:993 3 | outgoing = smtps+plain://abiosoft%40fastmail.com@smtp.fastmail.com:465 4 | folders = Drafts,Git,Sent 5 | default = Git 6 | from = Abiola Ibrahim 7 | copy-to = Sent 8 | outgoing-cred-cmd = op read op://Private/FastMail-SMTP/password 9 | source-cred-cmd = op read op://Private/FastMail-SMTP/password 10 | -------------------------------------------------------------------------------- /aerc/.config/aerc/aerc.conf: -------------------------------------------------------------------------------- 1 | # 2 | # aerc main configuration 3 | 4 | [general] 5 | # 6 | # Used as a default path for save operations if no other path is specified. 7 | # ~ is expanded to the current user home dir. 8 | # 9 | # Default: "" 10 | #default-save-path=~/tmp 11 | 12 | # 13 | # If set to "gpg", aerc will use system gpg binary and keystore for all crypto 14 | # operations. Otherwise, the internal openpgp implementation will be used. 15 | # 16 | # Default: internal 17 | pgp-provider=internal 18 | 19 | # By default, the file permissions of accounts.conf must be restrictive and 20 | # only allow reading by the file owner (0600). Set this option to true to 21 | # ignore this permission check. Use this with care as it may expose your 22 | # credentials. 23 | # 24 | # Default: false 25 | unsafe-accounts-conf=false 26 | 27 | [ui] 28 | # 29 | # Describes the format for each row in a mailbox view. This field is compatible 30 | # with mutt's printf-like syntax. 31 | # 32 | # Default: %-20.20D %-17.17n %Z %s 33 | # index-format=%-20.20D %-17.17n %Z %s 34 | index-columns = date<20,name<17,flags>4,subject<* 35 | column-date = {{.DateAutoFormat .Date.Local}} 36 | column-name = {{index (.From | names) 0}} 37 | column-flags = {{.Flags | join ""}} 38 | column-subject = {{.Subject}} 39 | 40 | # 41 | # See time.Time#Format at https://godoc.org/time#Time.Format 42 | # 43 | # Default: 2006-01-02 03:04 PM (ISO 8601 + 12 hour time) 44 | timestamp-format=2006-01-02 03:04 PM 45 | 46 | # 47 | # Index-only time format for messages that were received/sent today. 48 | # If this is not specified, timestamp-format is used instead. 49 | # 50 | # Default: "" 51 | #this-day-time-format=03:04 PM 52 | 53 | # 54 | # Index-only time format for messages that were received/sent within the last 55 | # 7 days. If this is not specified, timestamp-format is used instead. 56 | # 57 | # Default: "" 58 | #this-week-time-format=Monday 03:04 PM 59 | 60 | # 61 | # Index-only time format for messages that were received/sent this year. 62 | # If this is not specified, timestamp-format is used instead. 63 | # 64 | # Default: "" 65 | #this-year-time-format=January 02 66 | 67 | # 68 | # Width of the sidebar, including the border. 69 | # 70 | # Default: 20 71 | sidebar-width=20 72 | 73 | # 74 | # Message to display when viewing an empty folder. 75 | # 76 | # Default: (no messages) 77 | empty-message=(no messages) 78 | 79 | # Message to display when no folders exists or are all filtered 80 | # 81 | # Default: (no folders) 82 | empty-dirlist=(no folders) 83 | 84 | # Enable mouse events in the ui, e.g. clicking and scrolling with the mousewheel 85 | # 86 | # Default: false 87 | mouse-enabled=false 88 | 89 | # 90 | # Ring the bell when new messages are received 91 | # 92 | # Default: true 93 | new-message-bell=true 94 | 95 | # Marker to show before a pinned tab's name. 96 | # 97 | # Default: ` 98 | pinned-tab-marker='`' 99 | 100 | # Describes the format string to use for the directory list 101 | # 102 | # Default: %n %>r 103 | dirlist-format=%n %>r 104 | 105 | # Delay after which the messages are actually listed when entering a directory. 106 | # This avoids loading messages when skipping over folders and makes the UI more 107 | # responsive. If you do not want that, set it to 0s. 108 | # 109 | # Default: 200ms 110 | dirlist-delay=200ms 111 | 112 | # Display the directory list as a foldable tree that allows to collapse and 113 | # expand the folders. 114 | # 115 | # Default: false 116 | dirlist-tree=false 117 | 118 | # If dirlist-tree is enabled, set level at which folders are collapsed by 119 | # default. Set to 0 to disable. 120 | # 121 | # Default: 0 122 | dirlist-collapse=0 123 | 124 | # List of space-separated criteria to sort the messages by, see *sort* 125 | # command in *aerc*(1) for reference. Prefixing a criterion with "-r " 126 | # reverses that criterion. 127 | # 128 | # Example: "from -r date" 129 | # 130 | # Default: "" 131 | sort= 132 | 133 | # Moves to next message when the current message is deleted 134 | # 135 | # Default: true 136 | next-message-on-delete=true 137 | 138 | # Automatically set the "seen" flag when a message is opened in the message 139 | # viewer. 140 | # 141 | # Default: true 142 | auto-mark-read=true 143 | 144 | # The directories where the stylesets are stored. It takes a colon-separated 145 | # list of directories. If this is unset or if a styleset cannot be found, the 146 | # following paths will be used as a fallback in that order: 147 | # 148 | # ${XDG_CONFIG_HOME:-~/.config}/aerc/stylesets 149 | # ${XDG_DATA_HOME:-~/.local/share}/aerc/stylesets 150 | # /nix/store/wnwz0jdqxxvq1k1r1n89qf53l5l626bx-aerc-0.13.0/share/aerc/stylesets 151 | # 152 | # default: "" 153 | stylesets-dirs= 154 | 155 | # Uncomment to use box-drawing characters for vertical and horizontal borders. 156 | # 157 | # Default: spaces 158 | # border-char-vertical=│ 159 | # border-char-horizontal=─ 160 | 161 | # Sets the styleset to use for the aerc ui elements. 162 | # 163 | # Default: default 164 | styleset-name=default 165 | 166 | # Activates fuzzy search in commands and their arguments: the typed string is 167 | # searched in the command or option in any position, and need not be 168 | # consecutive characters in the command or option. 169 | #fuzzy-complete=false 170 | 171 | # How long to wait after the last input before auto-completion is triggered. 172 | # 173 | # Default: 250ms 174 | completion-delay=250ms 175 | 176 | # 177 | # Global switch for completion popovers 178 | # 179 | # Default: true 180 | completion-popovers=true 181 | 182 | # Uncomment to use UTF-8 symbols to indicate PGP status of messages 183 | # 184 | # Default: ASCII 185 | #icon-unencrypted= 186 | #icon-encrypted=✔ 187 | #icon-signed=✔ 188 | #icon-signed-encrypted=✔ 189 | #icon-unknown=✘ 190 | #icon-invalid=⚠ 191 | 192 | #[ui:account=foo] 193 | # 194 | # Enable a threaded view of messages. If this is not supported by the backend 195 | # (IMAP server or notmuch), threads will be built by the client. 196 | # 197 | # Default: false 198 | #threading-enabled=false 199 | 200 | # Force client-side thread building 201 | # 202 | # Default: false 203 | #force-client-threads=false 204 | 205 | # Debounce client-side thread building 206 | # 207 | # Default: 50ms 208 | #client-threads-delay=50ms 209 | 210 | [statusline] 211 | # Describes the format string for the statusline. 212 | # 213 | # Default: [%a] %S %>%T 214 | render-format=[%a] %S %>%T 215 | 216 | # Specifies the separator between grouped statusline elements. 217 | # 218 | # Default: " | " 219 | # separator= 220 | 221 | # Defines the mode for displaying the status elements. 222 | # Options: text, icon 223 | # 224 | # Default: text 225 | # display-mode= 226 | 227 | [viewer] 228 | # 229 | # Specifies the pager to use when displaying emails. Note that some filters 230 | # may add ANSI codes to add color to rendered emails, so you may want to use a 231 | # pager which supports ANSI codes. 232 | # 233 | # Default: less -R 234 | pager=less -R 235 | 236 | # 237 | # If an email offers several versions (multipart), you can configure which 238 | # mimetype to prefer. For example, this can be used to prefer plaintext over 239 | # html emails. 240 | # 241 | # Default: text/plain,text/html 242 | alternatives=text/plain,text/html 243 | 244 | # 245 | # Default setting to determine whether to show full headers or only parsed 246 | # ones in message viewer. 247 | # 248 | # Default: false 249 | show-headers=false 250 | 251 | # 252 | # Layout of headers when viewing a message. To display multiple headers in the 253 | # same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if 254 | # none of their specified headers are present in the message. 255 | # 256 | # Default: From|To,Cc|Bcc,Date,Subject 257 | header-layout=From|To,Cc|Bcc,Date,Subject 258 | 259 | # Whether to always show the mimetype of an email, even when it is just a single part 260 | # 261 | # Default: false 262 | always-show-mime=false 263 | 264 | # Parses and extracts http links when viewing a message. Links can then be 265 | # accessed with the open-link command. 266 | # 267 | # Default: true 268 | parse-http-links=true 269 | 270 | [compose] 271 | # 272 | # Specifies the command to run the editor with. It will be shown in an embedded 273 | # terminal, though it may also launch a graphical window if the environment 274 | # supports it. Defaults to $EDITOR, or vi. 275 | editor= 276 | 277 | # 278 | # Default header fields to display when composing a message. To display 279 | # multiple headers in the same row, separate them with a pipe, e.g. "To|From". 280 | # 281 | # Default: To|From,Subject 282 | header-layout=To|From,Subject 283 | 284 | # 285 | # Specifies the command to be used to tab-complete email addresses. Any 286 | # occurrence of "%s" in the address-book-cmd will be replaced with what the 287 | # user has typed so far. 288 | # 289 | # The command must output the completions to standard output, one completion 290 | # per line. Each line must be tab-delimited, with an email address occurring as 291 | # the first field. Only the email address field is required. The second field, 292 | # if present, will be treated as the contact name. Additional fields are 293 | # ignored. 294 | # 295 | # This parameter can also be set per account in accounts.conf. 296 | address-book-cmd= 297 | 298 | # 299 | # Allow to address yourself when replying 300 | # 301 | # Default: true 302 | reply-to-self=true 303 | 304 | # 305 | # Warn before sending an email that matches the specified regexp but does not 306 | # have any attachments. Leave empty to disable this feature. 307 | # 308 | # Uses Go's regexp syntax, documented at https://golang.org/s/re2syntax. The 309 | # "(?im)" flags are set by default (case-insensitive and multi-line). 310 | # 311 | # Example: 312 | # no-attachment-warning=^[^>]*attach(ed|ment) 313 | # 314 | no-attachment-warning= 315 | 316 | [filters] 317 | # 318 | # Filters allow you to pipe an email body through a shell command to render 319 | # certain emails differently, e.g. highlighting them with ANSI escape codes. 320 | # 321 | # The commands are invoked with sh -c. The following folders are appended to 322 | # the system $PATH to allow referencing filters from their name only: 323 | # 324 | # ${XDG_CONFIG_HOME:-~/.config}/aerc/filters 325 | # ${XDG_DATA_HOME:-~/.local/share}/aerc/filters 326 | # $PREFIX/share/aerc/filters 327 | # /usr/share/aerc/filters 328 | # 329 | # The following variables are defined in the filter command environment: 330 | # 331 | # AERC_MIME_TYPE the part MIME type/subtype 332 | # AERC_FILENAME the attachment filename (if any) 333 | # 334 | # The first filter which matches the email's mimetype will be used, so order 335 | # them from most to least specific. 336 | # 337 | # You can also match on non-mimetypes, by prefixing with the header to match 338 | # against (non-case-sensitive) and a comma, e.g. subject,text will match a 339 | # subject which contains "text". Use header,~regex to match against a regex. 340 | # 341 | text/plain=colorize 342 | text/calendar=calendar 343 | message/delivery-status=colorize 344 | message/rfc822=colorize 345 | #text/html=pandoc -f html -t plain | colorize 346 | #text/html=html | colorize 347 | #text/*=bat -fP --file-name="$AERC_FILENAME" 348 | #application/x-sh=bat -fP -l sh 349 | #image/*=catimg -w $(tput cols) - 350 | #subject,~Git(hub|lab)=lolcat -f 351 | #from,thatguywhodoesnothardwraphismessages=fmt -w 72 | colorize 352 | 353 | [openers] 354 | # 355 | # Openers allow you to specify the command to use for the :open action on a 356 | # per-MIME-type basis. 357 | # 358 | # {} is expanded as the temporary filename to be opened. If it is not 359 | # encountered in the command, the temporary filename will be appened to the end 360 | # of the command. 361 | # 362 | # Examples: 363 | # text/html=surf -dfgms 364 | # text/plain=gvim {} +125 365 | # message/rfc822=thunderbird 366 | 367 | [triggers] 368 | # 369 | # Triggers specify commands to execute when certain events occur. 370 | # 371 | # Example: 372 | # new-email=exec notify-send "New email from %n" "%s" 373 | 374 | # 375 | # Executed when a new email arrives in the selected folder 376 | new-email= 377 | 378 | [templates] 379 | # Templates are used to populate email bodies automatically. 380 | # 381 | 382 | # The directories where the templates are stored. It takes a colon-separated 383 | # list of directories. If this is unset or if a template cannot be found, the 384 | # following paths will be used as a fallback in that order: 385 | # 386 | # ${XDG_CONFIG_HOME:-~/.config}/aerc/templates 387 | # ${XDG_DATA_HOME:-~/.local/share}/aerc/templates 388 | # /nix/store/wnwz0jdqxxvq1k1r1n89qf53l5l626bx-aerc-0.13.0/share/aerc/templates 389 | # 390 | # default: "" 391 | template-dirs= 392 | 393 | # The default template to be used for new messages. 394 | # 395 | # default: new_message 396 | new-message=new_message 397 | 398 | # The default template to be used for quoted replies. 399 | # 400 | # default: quoted_reply 401 | quoted-reply=quoted_reply 402 | 403 | # The default template to be used for forward as body. 404 | # 405 | # default: forward_as_body 406 | forwards=forward_as_body 407 | -------------------------------------------------------------------------------- /aerc/.config/aerc/binds.conf: -------------------------------------------------------------------------------- 1 | # Binds are of the form = 2 | # To use '=' in a key sequence, substitute it with "Eq": "" 3 | # If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit 4 | = :prev-tab 5 | = :next-tab 6 | = :term 7 | ? = :help keys 8 | 9 | [messages] 10 | q = :quit 11 | 12 | j = :next 13 | = :next 14 | = :next 50% 15 | = :next 100% 16 | = :next 100% 17 | 18 | k = :prev 19 | = :prev 20 | = :prev 50% 21 | = :prev 100% 22 | = :prev 100% 23 | g = :select 0 24 | G = :select -1 25 | 26 | = :next-folder 27 | J = :next-folder 28 | = :prev-folder 29 | K = :prev-folder 30 | H = :collapse-folder 31 | L = :expand-folder 32 | 33 | v = :mark -t 34 | V = :mark -v 35 | 36 | T = :toggle-threads 37 | 38 | = :view 39 | d = :prompt 'Really delete this message?' 'delete-message' 40 | D = :delete 41 | A = :archive flat 42 | 43 | C = :compose 44 | 45 | rr = :reply -a 46 | rq = :reply -aq 47 | Rr = :reply 48 | Rq = :reply -q 49 | 50 | c = :cf 51 | $ = :term 52 | ! = :term 53 | | = :pipe 54 | 55 | / = :search 56 | \ = :filter 57 | n = :next-result 58 | N = :prev-result 59 | = :clear 60 | 61 | [messages:folder=Drafts] 62 | = :recall 63 | 64 | [view] 65 | / = :toggle-key-passthrough/ 66 | q = :close 67 | O = :open 68 | S = :save 69 | | = :pipe 70 | D = :delete 71 | A = :archive flat 72 | 73 | = :open-link 74 | 75 | f = :forward 76 | rr = :reply -a 77 | rq = :reply -aq 78 | Rr = :reply 79 | Rq = :reply -q 80 | 81 | H = :toggle-headers 82 | = :prev-part 83 | = :next-part 84 | J = :next 85 | K = :prev 86 | 87 | [view::passthrough] 88 | $noinherit = true 89 | $ex = 90 | = :toggle-key-passthrough 91 | 92 | [compose] 93 | # Keybindings used when the embedded terminal is not selected in the compose 94 | # view 95 | $noinherit = true 96 | $ex = 97 | = :prev-field 98 | = :next-field 99 | = :switch-account -p 100 | = :switch-account -n 101 | = :next-field 102 | = :prev-tab 103 | = :next-tab 104 | 105 | [compose::editor] 106 | # Keybindings used when the embedded terminal is selected in the compose view 107 | $noinherit = true 108 | $ex = 109 | = :prev-field 110 | = :next-field 111 | = :prev-tab 112 | = :next-tab 113 | 114 | [compose::review] 115 | # Keybindings used when reviewing a message to be sent 116 | y = :send 117 | n = :abort 118 | p = :postpone 119 | q = :choose -o d discard abort -o p postpone postpone 120 | e = :edit 121 | a = :attach 122 | d = :detach 123 | 124 | [terminal] 125 | $noinherit = true 126 | $ex = 127 | 128 | = :prev-tab 129 | = :next-tab 130 | -------------------------------------------------------------------------------- /aerc/Library/Preferences/aerc: -------------------------------------------------------------------------------- 1 | ../../.config/aerc -------------------------------------------------------------------------------- /alacritty/.config/alacritty/alacritty.toml: -------------------------------------------------------------------------------- 1 | [colors] 2 | draw_bold_text_with_bright_colors = true 3 | 4 | [font] 5 | size = 13.0 6 | 7 | [font.bold] 8 | style = "Medium" 9 | 10 | [font.bold_italic] 11 | style = "Medium Italic" 12 | 13 | [font.normal] 14 | family = "JetBrains Mono" 15 | style = "Medium" 16 | 17 | [font.offset] 18 | x = 0 19 | y = 0 20 | 21 | [mouse] 22 | hide_when_typing = true 23 | 24 | [window] 25 | decorations = "none" 26 | startup_mode = "Maximized" 27 | 28 | -------------------------------------------------------------------------------- /bat/.config/bat/config: -------------------------------------------------------------------------------- 1 | --theme='tomorrow-night' 2 | --style=plain 3 | -------------------------------------------------------------------------------- /bat/.config/bat/themes/tomorrow-night.tmTheme: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | comment 6 | http://chriskempson.com 7 | name 8 | Tomorrow Night 9 | settings 10 | 11 | 12 | settings 13 | 14 | background 15 | #1D1F21 16 | caret 17 | #AEAFAD 18 | foreground 19 | #C5C8C6 20 | invisibles 21 | #4B4E55 22 | lineHighlight 23 | #282A2E 24 | selection 25 | #373B41 26 | 27 | 28 | 29 | name 30 | Comment 31 | scope 32 | comment 33 | settings 34 | 35 | foreground 36 | #969896 37 | 38 | 39 | 40 | name 41 | Foreground 42 | scope 43 | keyword.operator.class, constant.other, source.php.embedded.line 44 | settings 45 | 46 | fontStyle 47 | 48 | foreground 49 | #CED1CF 50 | 51 | 52 | 53 | name 54 | Variable, String Link, Regular Expression, Tag Name, GitGutter deleted 55 | scope 56 | variable, support.other.variable, string.other.link, string.regexp, entity.name.tag, entity.other.attribute-name, meta.tag, declaration.tag, markup.deleted.git_gutter 57 | settings 58 | 59 | foreground 60 | #CC6666 61 | 62 | 63 | 64 | name 65 | Number, Constant, Function Argument, Tag Attribute, Embedded 66 | scope 67 | constant.numeric, constant.language, support.constant, constant.character, variable.parameter, punctuation.section.embedded, keyword.other.unit 68 | settings 69 | 70 | fontStyle 71 | 72 | foreground 73 | #DE935F 74 | 75 | 76 | 77 | name 78 | Class, Support 79 | scope 80 | entity.name.class, entity.name.type.class, support.type, support.class 81 | settings 82 | 83 | fontStyle 84 | 85 | foreground 86 | #F0C674 87 | 88 | 89 | 90 | name 91 | String, Symbols, Inherited Class, Markup Heading, GitGutter inserted 92 | scope 93 | string, constant.other.symbol, entity.other.inherited-class, entity.name.filename, markup.heading, markup.inserted.git_gutter 94 | settings 95 | 96 | fontStyle 97 | 98 | foreground 99 | #B5BD68 100 | 101 | 102 | 103 | name 104 | Operator, Misc 105 | scope 106 | keyword.operator, constant.other.color 107 | settings 108 | 109 | foreground 110 | #8ABEB7 111 | 112 | 113 | 114 | name 115 | Function, Special Method, Block Level, GitGutter changed 116 | scope 117 | entity.name.function, meta.function-call, support.function, keyword.other.special-method, meta.block-level, markup.changed.git_gutter 118 | settings 119 | 120 | fontStyle 121 | 122 | foreground 123 | #81A2BE 124 | 125 | 126 | 127 | name 128 | Keyword, Storage 129 | scope 130 | keyword, storage, storage.type, entity.name.tag.css 131 | settings 132 | 133 | fontStyle 134 | 135 | foreground 136 | #B294BB 137 | 138 | 139 | 140 | name 141 | Invalid 142 | scope 143 | invalid 144 | settings 145 | 146 | background 147 | #DF5F5F 148 | fontStyle 149 | 150 | foreground 151 | #CED2CF 152 | 153 | 154 | 155 | name 156 | Separator 157 | scope 158 | meta.separator 159 | settings 160 | 161 | background 162 | #82A3BF 163 | foreground 164 | #CED2CF 165 | 166 | 167 | 168 | name 169 | Deprecated 170 | scope 171 | invalid.deprecated 172 | settings 173 | 174 | background 175 | #B798BF 176 | fontStyle 177 | 178 | foreground 179 | #CED2CF 180 | 181 | 182 | 183 | name 184 | Diff foreground 185 | scope 186 | markup.inserted.diff, markup.deleted.diff, meta.diff.header.to-file, meta.diff.header.from-file 187 | settings 188 | 189 | foreground 190 | #FFFFFF 191 | 192 | 193 | 194 | name 195 | Diff insertion 196 | scope 197 | markup.inserted.diff, meta.diff.header.to-file 198 | settings 199 | 200 | foreground 201 | #718c00 202 | 203 | 204 | 205 | name 206 | Diff deletion 207 | scope 208 | markup.deleted.diff, meta.diff.header.from-file 209 | settings 210 | 211 | foreground 212 | #c82829 213 | 214 | 215 | 216 | name 217 | Diff header 218 | scope 219 | meta.diff.header.from-file, meta.diff.header.to-file 220 | settings 221 | 222 | foreground 223 | #FFFFFF 224 | background 225 | #4271ae 226 | 227 | 228 | 229 | name 230 | Diff range 231 | scope 232 | meta.diff.range 233 | settings 234 | 235 | fontStyle 236 | italic 237 | foreground 238 | #3e999f 239 | 240 | 241 | 242 | uuid 243 | F96223EB-1A60-4617-92F3-D24D4F13DB09 244 | colorSpaceName 245 | sRGB 246 | 247 | 248 | -------------------------------------------------------------------------------- /bin/bin/box: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | print_usage(){ 4 | cat <::' 23 | 24 | rm NAME ... 25 | remove container box(es) 26 | NAME container box name 27 | 28 | list 29 | list created container boxes 30 | 31 | -h 32 | show this help 33 | 34 | EOF 35 | if [ -z "$1" ]; then exit 0; else exit 1; fi 36 | } 37 | 38 | log(){ 39 | >&2 echo $@ 40 | } 41 | 42 | err(){ 43 | log $@ 44 | exit 1 45 | } 46 | 47 | box_name(){ 48 | if [ -z "$1" ]; then 49 | echo box_default 50 | else 51 | echo "box_$1" 52 | fi 53 | } 54 | 55 | create(){ 56 | volumes="" 57 | wd="" 58 | image="" 59 | 60 | # parse args 61 | while true; do 62 | case "$1" in 63 | -v) shift 64 | ensure_volume_exists $1 65 | volumes="$volumes -v $1:/vols/$1" 66 | shift ;; 67 | -w) shift 68 | [ "$wd" = "" ] || err working directory is not a list 69 | wd="-w $1" 70 | shift ;; 71 | -i) shift 72 | [ "$image" = "" ] || err image is not a list 73 | image="$1" 74 | shift ;; 75 | -h) print_usage ;; 76 | *) break ;; 77 | esac 78 | done 79 | 80 | [ "$image" = "" ] && image="dev" 81 | 82 | name="$1" 83 | label="$name" 84 | [ -z "$1" ] && label="default" && name="default" 85 | shift 86 | 87 | ensure_volume_exists box_home 88 | 89 | echo "$(list)" | grep "$name" > /dev/null && err "box $name already exists" 90 | docker run -d --name "$(box_name $name)" $volumes $wd \ 91 | -h $name \ 92 | -l "groupname=box" \ 93 | -l "boxlabel=$label" \ 94 | -v box_home:/root \ 95 | --entrypoint sh \ 96 | $image -c "rm .fifo 2> /dev/null; mkfifo .fifo && cat .fifo" \ 97 | > /dev/null 98 | [ $? -ne 0 ] && err "error creating box '$name'" 99 | return 0 100 | } 101 | 102 | list(){ 103 | docker ps -a -f 'label=groupname=box' --format '{{.Labels}}' \ 104 | | awk -F'boxlabel=' '{print $2}' | awk -F',' '{print $1}' | sort 105 | exit $? 106 | } 107 | 108 | status(){ 109 | docker inspect "$(box_name $1)" --format='{{.State.Status}}' 2> /dev/null 110 | } 111 | 112 | remove(){ 113 | for name in "$@"; do 114 | box="$(box_name "$name")" 115 | docker stop $box > /dev/null && docker rm $box > /dev/null 116 | if [ $? -eq 0 ]; then 117 | echo $name removed 118 | else 119 | err error ocurred removing $name 120 | fi 121 | done 122 | exit 0 123 | } 124 | 125 | ensure_volume_exists(){ 126 | docker volume ls -q | grep "$1" &> /dev/null || docker volume create "$1" 127 | [ $? -ne 0 ] && err error creating docker volume "$1" 128 | } 129 | 130 | enter(){ 131 | wd="" 132 | 133 | # parse args 134 | while true; do 135 | case "$1" in 136 | -w) shift 137 | [ "$wd" = "" ] || err working directory is not a list 138 | wd="-w $1" 139 | shift ;; 140 | -h) print_usage ;; 141 | *) break ;; 142 | esac 143 | done 144 | 145 | name="$1" 146 | [ -z "$1" ] && name="default" 147 | shift 148 | 149 | box_status="$(status "$name")" 150 | case "${box_status}" in 151 | exited|created) docker start "$(box_name $name)" > /dev/null || err error starting $name ;; 152 | running) ;; 153 | "") err "box '$name' does not exist, create with 'box create $name'" ;; 154 | *) err unknown status $box_status ;; 155 | esac 156 | 157 | # run command 158 | cmd="$@" 159 | if [ "$cmd" = "" ]; then 160 | # get command from container image 161 | container_image="$(docker inspect "$(box_name $name)" -f '{{.Image}}')" 162 | cmd=$(docker image inspect "$container_image" -f '{{join .Config.Entrypoint " "}} {{join .Config.Cmd " "}}') 163 | fi 164 | docker exec -it $wd "$(box_name $name)" $cmd 165 | } 166 | 167 | cleanup_network(){ 168 | docker network disconnect "$network" $(box_name "$name") &> /dev/null 169 | docker network rm "$network" &> /dev/null 170 | } 171 | 172 | forward(){ 173 | arg="$1" 174 | addr=(${arg//:/ }) 175 | host_port=${addr[0]} 176 | name=${addr[1]} 177 | port=${addr[2]} 178 | 179 | [ ${#addr[@]} -lt 3 ] && log "address should be of the format ::" && echo && print_usage 1 180 | 181 | 182 | box_status="$(status "$name")" 183 | case "${box_status}" in 184 | exited|created|running) ;; 185 | "") err "box '$name' does not exist" ;; 186 | *) err unknown status $box_status ;; 187 | esac 188 | 189 | network="box_net_$RANDOM" 190 | docker network create "$network" > /dev/null || err error occured creating docker network for port forward 191 | trap cleanup_network INT TERM 192 | 193 | docker network connect "$network" $(box_name "$name") || err error occurred connecting to docker network for port forward 194 | 195 | docker run --rm --network "$network" -p $host_port:1234 alpine/socat TCP-LISTEN:1234,fork TCP-CONNECT:$(box_name $name):$port 196 | 197 | cleanup_network 198 | } 199 | 200 | case "$1" in 201 | create) shift 202 | create "$@" ;; 203 | list) list ;; 204 | enter) shift 205 | enter "$@" ;; 206 | forward) shift 207 | forward "$@" ;; 208 | rm) shift 209 | remove "$@" ;; 210 | -h) print_usage ;; 211 | "") print_usage 1 ;; 212 | *) err "invalid arg '$1'. view help with 'box -h'." ;; 213 | esac 214 | 215 | 216 | -------------------------------------------------------------------------------- /bin/bin/convertvideo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eux 4 | 5 | old_extension=$1 6 | new_extension=$2 7 | 8 | mkdir -p ./converted 9 | 10 | for i in *."$old_extension"; do 11 | echo converting "$1" to $new_extension... 12 | echo 13 | ffmpeg -i "$i" "${i%.*}.converted.${new_extension}" \ 14 | && mv "$i" ./converted 15 | echo done. 16 | echo 17 | done 18 | 19 | -------------------------------------------------------------------------------- /bin/bin/defaultswrite: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # vscode 4 | defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false 5 | 6 | # jetbrains 7 | defaults write com.jetbrains.intellij ApplePressAndHoldEnabled -bool false 8 | defaults write com.jetbrains.goland ApplePressAndHoldEnabled -bool false 9 | defaults write com.jetbrains.clion ApplePressAndHoldEnabled -bool false 10 | defaults write com.jetbrains.datagrip ApplePressAndHoldEnabled -bool false 11 | defaults write com.jetbrains.cwm.guest-EAP ApplePressAndHoldEnabled -bool false 12 | defaults write com.jetbrains.client-eap ApplePressAndHoldEnabled -bool false 13 | 14 | # sublime text 15 | defaults write com.sublimetext.3 ApplePressAndHoldEnabled -bool false 16 | 17 | # insomnia 18 | defaults write com.insomnia.app ApplePressAndHoldEnabled -bool false 19 | 20 | # utm 21 | defaults write com.utmapp.UTM ApplePressAndHoldEnabled -bool false 22 | 23 | # or global disable 24 | # defaults write -g ApplePressAndHoldEnabled -bool false 25 | 26 | -------------------------------------------------------------------------------- /bin/bin/dl-vscode-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # credit: https://gist.github.com/b01/0a16b6645ab7921b0910603dfb85e4fb 3 | 4 | set -e 5 | 6 | # Auto-Get the latest commit sha via command line. 7 | get_latest_release() { 8 | tag=$(curl --silent "https://api.github.com/repos/${1}/releases/latest" | # Get latest release from GitHub API 9 | grep '"tag_name":' | # Get tag line 10 | sed -E 's/.*"([^"]+)".*/\1/' ) # Pluck JSON value 11 | 12 | tag_data=$(curl --silent "https://api.github.com/repos/${1}/git/ref/tags/${tag}") 13 | 14 | sha=$(echo "${tag_data}" | # Get latest release from GitHub API 15 | grep '"sha":' | # Get tag line 16 | sed -E 's/.*"([^"]+)".*/\1/' ) # Pluck JSON value 17 | 18 | sha_type=$(echo "${tag_data}" | # Get latest release from GitHub API 19 | grep '"type":' | # Get tag line 20 | sed -E 's/.*"([^"]+)".*/\1/' ) # Pluck JSON value 21 | 22 | if [ "${sha_type}" != "commit" ]; then 23 | combo_sha=$(curl -s "https://api.github.com/repos/${1}/git/tags/${sha}" | # Get latest release from GitHub API 24 | grep '"sha":' | # Get tag line 25 | sed -E 's/.*"([^"]+)".*/\1/' ) # Pluck JSON value 26 | 27 | # Remove the tag sha, leaving only the commit sha; 28 | # this won't work if there are ever more than 2 sha, 29 | # and use xargs to remove whitespace/newline. 30 | sha=$(echo "${combo_sha}" | sed -E "s/${sha}//" | xargs) 31 | fi 32 | 33 | printf "${sha}" 34 | } 35 | 36 | ARCH="x64" 37 | U_NAME=$(uname -m) 38 | 39 | if [ "${U_NAME}" = "aarch64" ]; then 40 | ARCH="arm64" 41 | fi 42 | 43 | archive="vscode-server-linux-${ARCH}.tar.gz" 44 | owner='microsoft' 45 | repo='vscode' 46 | commit_sha=$(get_latest_release "${owner}/${repo}") 47 | 48 | if [ -n "${commit_sha}" ]; then 49 | echo "will attempt to download VS Code Server version = '${commit_sha}'" 50 | 51 | # Download VS Code Server tarball to tmp directory. 52 | curl -L "https://update.code.visualstudio.com/commit:${commit_sha}/server-linux-${ARCH}/stable" -o "/tmp/${archive}" 53 | 54 | # Make the parent directory where the server should live. 55 | # NOTE: Ensure VS Code will have read/write access; namely the user running VScode or container user. 56 | mkdir -vp ~/.vscode-server/bin/"${commit_sha}" 57 | 58 | # Extract the tarball to the right location. 59 | tar --no-same-owner -xzv --strip-components=1 -C ~/.vscode-server/bin/"${commit_sha}" -f "/tmp/${archive}" 60 | else 61 | echo "could not pre install vscode server" 62 | fi 63 | -------------------------------------------------------------------------------- /bin/bin/dockfwd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | print_usage(){ 4 | cat < : 8 | 9 | EOF 10 | if [ -z "$1" ]; then exit 0; else exit 1; fi 11 | } 12 | 13 | log(){ 14 | >&2 echo $@ 15 | } 16 | 17 | err(){ 18 | log $@ 19 | exit 1 20 | } 21 | 22 | container="$1" 23 | shift 24 | 25 | status(){ 26 | docker inspect "$container" --format='{{.State.Status}}' 2> /dev/null 27 | } 28 | 29 | address(){ 30 | format="{{.NetworkSettings.Networks.${network}.IPAddress}}" 31 | docker inspect "$container" --format="$format" 2> /dev/null 32 | } 33 | 34 | cleanup_network(){ 35 | log 36 | log performing cleanups... 37 | 38 | docker network disconnect "$network" "$container" &> /dev/null 39 | docker network rm "$network" &> /dev/null 40 | 41 | log done. 42 | cleanup=true 43 | } 44 | 45 | forward(){ 46 | arg="$1" 47 | addr=(${arg//:/ }) 48 | host_port=${addr[0]} 49 | container_port=${addr[1]} 50 | 51 | [ ${#addr[@]} -lt 2 ] && log "ports should be of the format :" && log && print_usage 1 52 | 53 | 54 | box_status="$(status)" 55 | case "${box_status}" in 56 | exited|created|running) ;; 57 | "") err "container '$container' does not exist" ;; 58 | *) err unknown status $box_status ;; 59 | esac 60 | 61 | network="dockfwd_net_$RANDOM" 62 | 63 | docker network create "$network" > /dev/null || err error occured creating docker network for port forward 64 | trap cleanup_network INT TERM 65 | 66 | docker network connect "$network" "$container" || err error occurred connecting to docker network for port forward 67 | 68 | container_host="$(address)" 69 | 70 | log forwarding port $host_port to $container:$container_port... 71 | docker run --rm --network "$network" -p $host_port:1234 alpine/socat TCP-LISTEN:1234,fork TCP-CONNECT:"$container_host":"$container_port" 72 | 73 | if [ -z "$cleanup" ]; then cleanup_network; fi 74 | } 75 | 76 | [ -z "$1" ] && print_usage 1 77 | 78 | forward "$@" 79 | -------------------------------------------------------------------------------- /bin/bin/envrun/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/abiosoft/envrun 2 | 3 | go 1.15 4 | 5 | require ( 6 | github.com/fatih/color v1.10.0 7 | github.com/joho/godotenv v1.3.0 8 | ) 9 | -------------------------------------------------------------------------------- /bin/bin/envrun/go.sum: -------------------------------------------------------------------------------- 1 | github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= 2 | github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= 3 | github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= 4 | github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= 5 | github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= 6 | github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= 7 | github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= 8 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= 9 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 10 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= 11 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 12 | -------------------------------------------------------------------------------- /bin/bin/envrun/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "context" 6 | "fmt" 7 | "io" 8 | "log" 9 | "os" 10 | "os/exec" 11 | "path/filepath" 12 | "strconv" 13 | "strings" 14 | "sync" 15 | "syscall" 16 | "time" 17 | 18 | "github.com/fatih/color" 19 | "github.com/joho/godotenv" 20 | ) 21 | 22 | var envFiles = []string{ 23 | ".env.local", 24 | ".env", 25 | } 26 | 27 | const ( 28 | usage = `usage: run [...]` 29 | logFile = ".run.log" 30 | ) 31 | 32 | func exitErr(err error) { 33 | fmt.Fprintf(os.Stderr, "error occured: %v", err) 34 | fmt.Fprintln(os.Stderr) 35 | os.Exit(1) 36 | } 37 | 38 | func getEnv() map[string]string { 39 | for _, f := range envFiles { 40 | stat, err := os.Stat(f) 41 | if err == nil && !stat.IsDir() { 42 | m, err := godotenv.Read(f) 43 | if err != nil { 44 | err := fmt.Errorf("error loading env file: %w", err) 45 | log.Fatal(err) 46 | } 47 | return m 48 | } 49 | } 50 | return map[string]string{} 51 | } 52 | 53 | func openLogFile() (*os.File, error) { 54 | return os.OpenFile(logFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0644) 55 | } 56 | 57 | func prepareLogFile() error { 58 | l, err := openLogFile() 59 | if err != nil { 60 | return fmt.Errorf("error preparing log file: %w", err) 61 | } 62 | return l.Close() 63 | } 64 | 65 | func main() { 66 | // we only need the time to see changes in output, date not that important 67 | log.SetFlags(log.Ltime) 68 | 69 | envVars := getEnv() 70 | args := os.Args[1:] 71 | if len(args) == 0 { 72 | exitErr(fmt.Errorf("args missing")) 73 | } 74 | 75 | if err := prepareLogFile(); err != nil { 76 | exitErr(fmt.Errorf("error preparing logs: %v", err)) 77 | } 78 | 79 | if args[0] == "log" { 80 | fmt.Fprintln(os.Stderr, "to view the logs, run the following command or $(run log)") 81 | fmt.Printf("tail -f %s", logFile) 82 | fmt.Println() 83 | return 84 | } 85 | 86 | cmd, cancel, err := run(args, envVars) 87 | if err != nil { 88 | err := fmt.Errorf("error running command: %w", err) 89 | exitErr(err) 90 | } 91 | 92 | for { 93 | kill := func() error { 94 | return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) 95 | } 96 | start := func() { 97 | cmd, cancel, err = run(args, envVars) 98 | if err != nil { 99 | err := fmt.Errorf("error running command: %w", err) 100 | fmt.Fprintln(os.Stderr, err) 101 | } 102 | } 103 | 104 | continueOnFailure := false 105 | 106 | fmt.Println() 107 | fmt.Println("input one of the following") 108 | fmt.Println(" 'r' to hard restart") 109 | fmt.Println(" 'ro' to soft restart") 110 | fmt.Println(" 'x' to terminate") 111 | fmt.Println() 112 | fmt.Print(" input: ") 113 | 114 | var line string 115 | fmt.Scanln(&line) 116 | 117 | // extra newline for log clarity 118 | fmt.Println() 119 | 120 | switch line { 121 | case "r": 122 | continueOnFailure = true 123 | fallthrough 124 | case "ro": 125 | log.Println("restarting...") 126 | case "x": 127 | log.Println("terminating...") 128 | kill() 129 | cancel() 130 | os.Exit(0) 131 | default: 132 | log.Printf("unrecognized input '%s'", line) 133 | log.Println() 134 | continue 135 | } 136 | 137 | if cmd == nil { 138 | log.Println("command not running, cannot restart") 139 | start() 140 | continue 141 | } 142 | 143 | // attempt to kill process and all it's children 144 | log.Println("attempting to kill process with pid", cmd.Process.Pid) 145 | if err := kill(); err != nil { 146 | err := fmt.Errorf("error terminating process: %w", err) 147 | fmt.Fprintln(os.Stderr, err) 148 | 149 | if continueOnFailure { 150 | start() 151 | } 152 | continue 153 | } 154 | 155 | log.Println("process killed.") 156 | log.Println() 157 | 158 | // cancel the process context 159 | cancel() 160 | 161 | // let's wait for the process in case there's some delay in quitting 162 | cmd.Process.Wait() 163 | 164 | // let's attempt to run the program again 165 | start() 166 | } 167 | } 168 | 169 | func run(args []string, vars map[string]string) (*exec.Cmd, func(), error) { 170 | // convert into shell script for sh to run 171 | sh := "" 172 | for _, a := range args { 173 | sh += " " + strconv.Quote(a) 174 | } 175 | 176 | // sha args 177 | cmdArgs := []string{"-c", sh} 178 | 179 | // use a cancel context to be on safe side 180 | ctx, cancel := context.WithCancel(context.Background()) 181 | cmd := exec.CommandContext(ctx, "sh", cmdArgs...) 182 | 183 | // environment variables 184 | cmd.Env = os.Environ() 185 | for k, v := range vars { 186 | cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", k, v)) 187 | } 188 | 189 | // ensure we can kill the children 190 | cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} 191 | 192 | // set log outputs 193 | out, err := openLogFile() 194 | if err != nil { 195 | return nil, cancel, fmt.Errorf("error opening log file: %w", err) 196 | } 197 | 198 | cmd.Stdout = &lineWriter{prefix: color.New(color.BgBlue, color.FgWhite).Sprint("stdout"), out: out} 199 | cmd.Stderr = &lineWriter{prefix: color.New(color.BgRed, color.FgWhite).Sprint("stderr"), out: out} 200 | 201 | dir, err := os.Getwd() 202 | if err != nil { 203 | return nil, cancel, fmt.Errorf("error getting current working directory: %w", err) 204 | } 205 | log.Println() 206 | log.Println("project:", filepath.Base(dir)) 207 | log.Println("directory:", dir) 208 | log.Println("running {", strings.Join(args, ", "), "}...") 209 | log.Println() 210 | 211 | if err := cmd.Start(); err != nil { 212 | return nil, cancel, fmt.Errorf("error starting command: %w", err) 213 | } 214 | 215 | logStartup(out) 216 | 217 | shutdown := func() { 218 | cancel() 219 | logShutdown(out) 220 | out.Close() 221 | } 222 | 223 | return cmd, shutdown, nil 224 | } 225 | 226 | func logStartup(out io.Writer) { 227 | fmt.Fprintln(out) 228 | fmt.Fprintln(out, "starting up at", time.Now()) 229 | fmt.Fprintln(out) 230 | } 231 | func logShutdown(out io.Writer) { 232 | fmt.Fprintln(out) 233 | fmt.Fprintln(out, "shutting down at", time.Now()) 234 | fmt.Fprintln(out) 235 | } 236 | 237 | var _ io.Writer = (*lineWriter)(nil) 238 | 239 | // lineWriter is a simple writer that only writes to an underlying writer when 240 | // a newline is encountered. 241 | type lineWriter struct { 242 | out io.Writer 243 | prefix string 244 | 245 | buf bytes.Buffer 246 | sync.Mutex 247 | } 248 | 249 | func (l *lineWriter) Write(b []byte) (int, error) { 250 | l.Lock() 251 | defer l.Unlock() 252 | 253 | for i := 0; i < len(b); i++ { 254 | 255 | // special case: replace escaped chars with their real value 256 | // newline, tab, quote, backslack 257 | if b[i] == '\\' { 258 | // peek if available 259 | if i+1 < len(b) { 260 | i++ 261 | switch b[i] { 262 | case 'n': 263 | b[i] = '\n' 264 | case 't': 265 | b[i] = '\t' 266 | 267 | // do nothing for these, escape char already skipped 268 | case '\\': 269 | case '"': 270 | case '\'': 271 | 272 | // otherwise, don't skip escape char 273 | default: 274 | i-- 275 | } 276 | } 277 | } 278 | 279 | // cache the char 280 | l.buf.WriteByte(b[i]) 281 | 282 | // write to underlying writer if newline is encountered 283 | if b[i] == '\n' { 284 | l.out.Write([]byte(l.prefix + " ")) 285 | l.buf.WriteTo(l.out) 286 | l.buf.Truncate(0) 287 | } 288 | } 289 | 290 | // all bytes are always successfully written 291 | return len(b), nil 292 | } 293 | -------------------------------------------------------------------------------- /bin/bin/fix-electron: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # fix for electron apps in macOS VM 4 | 5 | if ! uname -a | grep VMAPPLE >/dev/null; then 6 | echo not a macOS VM 7 | exit 1 8 | fi 9 | 10 | LIB="Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib" 11 | for app in /Applications/*/; do 12 | file="${app}${LIB}" 13 | if [ -f "$file" ]; then 14 | echo found "$file", moving ... 15 | mv "$file" "${file}.tmp" 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /bin/bin/forward-gateway-port: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | if [ -z "$1" ]; then 6 | >&2 echo port missing. 7 | >&2 echo 8 | >&2 echo Usage: forward-docker-port PORT_NUMBER 9 | >&2 echo " e.g. forward-docker-port 8080" 10 | exit 1 11 | fi 12 | 13 | 14 | GATEWAY_IP="$(gateway-ip)" 15 | if [ -z "$GATEWAY_IP" ]; then 16 | >&2 echo gateway ip could not be retrieved. 17 | >&2 echo 18 | fi 19 | 20 | set -x 21 | socat "TCP-LISTEN:${1},reuseaddr,fork,reuseaddr" "TCP:${GATEWAY_IP}:${1}" 22 | 23 | -------------------------------------------------------------------------------- /bin/bin/gateway-ip: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if uname -a | grep VMAPPLE >/dev/null; then 4 | ifconfig en0 | grep "inet " | awk -F' ' '{print $2}' | awk -F'.' '{print $1"."$2"."$3".1"}' 5 | fi 6 | -------------------------------------------------------------------------------- /bin/bin/keyrepeat: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | xset r rate 200 40 3 | -------------------------------------------------------------------------------- /bin/bin/killport: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | kill -9 $(port $1 | awk -F' ' '{print $2}') 4 | 5 | -------------------------------------------------------------------------------- /bin/bin/mux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cmd="switch" 4 | if [ "$1" = "setenv" ]; then 5 | cmd="set_env" 6 | shift 7 | fi 8 | 9 | wd=$1 10 | if [ -z $wd ]; then 11 | wd="$PWD" 12 | fi 13 | 14 | session=$(basename $wd | tr '.' '_') 15 | 16 | unquote() ( 17 | temp="${1%\"}" 18 | temp="${temp#\"}" 19 | echo "$temp" 20 | ) 21 | 22 | set_env()( 23 | # environment files in order of priority, only the first is used 24 | declare -a arr=(".env.local" ".env") 25 | env_file="" 26 | for i in "${arr[@]}" 27 | do 28 | if [ -f "$i" ]; then 29 | env_file="$i" 30 | break 31 | fi 32 | done 33 | 34 | [ -z $env_file ] && >&2 echo no .env file found && exit 0; 35 | 36 | env_vars=$(cat "$env_file" | grep -v '^#' | grep -v '^$') 37 | while IFS= read -r line; do 38 | key=$(echo "$line" | awk -F'=' '{print $1}') 39 | value=$(echo "$line" | awk -F'=' '{print $NF}') 40 | value=$(echo "$value" | awk -F'#' '{print $1}') # trim possible comments 41 | value=$(unquote "$value") 42 | tmux setenv -t "$session" "$key" "$value" > /dev/null 2>&1 43 | done <<< "$env_vars" 44 | ) 45 | 46 | switch()( 47 | # verify the session isn't previously running 48 | tmux ls | awk -F':' '{print $1}' | grep "$session" > /dev/null && echo "$session already running..." && exit 0 49 | 50 | # convert working directory to absolute directory 51 | wd="$(cd "$wd" && pwd)" 52 | 53 | # create new tmux session 54 | tmux new-session -d -c "$wd" -s "$session" 55 | if [ $? -ne 0 ]; then 56 | >&2 echo could not start new tmux session 57 | exit 1 58 | fi 59 | 60 | # customize the tmux session and switch to it 61 | tmux new-window -t "${session}:" -c "$wd" -n vim nvim . && \ 62 | tmux split-window -p 35 -h -t "${session}:" -c "$wd" && \ 63 | tmux split-window -t "${session}:" -c "$wd" && \ 64 | tmux select-window -t "${session}:0" && \ 65 | tmux kill-window -t "${session}:0" && \ 66 | tmux rename-window -t "${session}:1" "0" && \ 67 | tmux switch -t "$session" 68 | ) 69 | 70 | session="$session" wd="$wd" $cmd "$@" 71 | 72 | -------------------------------------------------------------------------------- /bin/bin/myzsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | zsh "$@" 4 | 5 | -------------------------------------------------------------------------------- /bin/bin/newline: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | awk '{gsub(/\\n/,"\n")}1' 4 | 5 | -------------------------------------------------------------------------------- /bin/bin/port: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$1" ]; then 4 | >&2 echo port missing. 5 | >&2 echo 6 | >&2 echo Usage: port PORT_NUMBER 7 | >&2 echo " e.g. port 8080" 8 | exit 1 9 | fi 10 | 11 | 12 | lsof -nP -iTCP:"$1" | grep LISTEN 13 | 14 | -------------------------------------------------------------------------------- /bin/bin/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # change directory to the script's directory. 4 | script_dir="$(dirname "$0")" || { log "fatal shell error, 'dirname' failed" && exit 1; } 5 | 6 | (cd $script_dir && go build -o /tmp/envrun "./envrun/main.go") && /tmp/envrun "$@" 7 | 8 | -------------------------------------------------------------------------------- /bin/bin/run_bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | stdout=".run/stdout.log" 4 | stderr=".run/stderr.log" 5 | prepare()( 6 | # create log files if they do not exist 7 | mkdir -p .run 8 | touch $stdout $stderr 9 | ) 10 | 11 | log_prompt()( 12 | echo 13 | echo "input 'r' to restart process" 14 | ) 15 | 16 | log() ( 17 | >&2 echo "$@" 18 | ) 19 | 20 | # log and exit 21 | if [ "$1" = "log" ]; then 22 | prepare 23 | tail -f "$stdout" "$stderr" 24 | exit 25 | fi 26 | 27 | #environment files in order of priority, only the first is used 28 | declare -a arr=(".env.local" ".env") 29 | env_file="" 30 | for i in "${arr[@]}" 31 | do 32 | if [ -f "$i" ]; then 33 | env_file="$i" 34 | break 35 | fi 36 | done 37 | 38 | if [ ! -f $env_file ]; then 39 | >&2 echo "$env_file does not exist" 40 | exit 1 41 | fi 42 | 43 | set -o allexport; source $env_file; set +o allexport 44 | 45 | run() ( 46 | prepare 47 | command="$@" 48 | sh -c "$command" 2>> "$stderr" 1>> "$stdout" & 49 | echo "$!" 50 | ) 51 | 52 | pid=$(run "$@") 53 | log_prompt 54 | 55 | while IFS= read -r line; do 56 | if [ "$line" = "r" ]; then 57 | echo killing "$pid"... 58 | kill -9 -- -"$pid" && echo "$pid" killed. 59 | echo 60 | 61 | if [ $? -ne 0 ]; then continue; fi 62 | 63 | echo starting... 64 | pid=$(run "$@") 65 | if [ $? -eq 0 ]; then 66 | echo "started '$@'" with pid "$pid" 67 | else 68 | echo could not start "$@", check logs 69 | fi 70 | fi 71 | 72 | log_prompt 73 | done 74 | 75 | -------------------------------------------------------------------------------- /bin/bin/switch-win.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ ! -z "$1" ]; then 4 | tmux switch -t "$1" 5 | exit $? 6 | fi 7 | 8 | fzf="fzf --layout=reverse --prompt='switch to window: ' --header='tmux windows' --margin=25% --padding=5% --border=sharp" 9 | tmux new-window -n "[choose-window]" "tmux select-window -t \$(tmux lsw | $fzf | awk -F':' '{print \$1}')" 10 | 11 | -------------------------------------------------------------------------------- /bin/bin/switch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ ! -z "$1" ]; then 4 | tmux switch -t "$1" 5 | exit $? 6 | fi 7 | 8 | fzf="fzf --layout=reverse --prompt='switch to: ' --header='tmux sessions' --margin=25% --padding=5% --border=sharp" 9 | tmux new-window -n "[choose-session]" "tmux switch -t \$(tmux ls | $fzf | awk -F':' '{print \$1}')" 10 | 11 | -------------------------------------------------------------------------------- /bin/bin/synctime: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if uname -a | grep VMAPPLE >/dev/null; then 4 | sudo sntp -sS time.apple.com 5 | fi 6 | -------------------------------------------------------------------------------- /bin/bin/temperature: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sudo powermetrics -s smc | grep -i "CPU die temperature" 4 | 5 | -------------------------------------------------------------------------------- /bin/bin/theme: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | dark() ( 4 | if [ "$(uname)" = "Linux" ]; then 5 | gsettings set org.gnome.desktop.interface color-scheme prefer-dark 6 | gsettings set org.gnome.desktop.interface gtk-theme 'Yaru-dark' 7 | fi 8 | ) 9 | 10 | light() ( 11 | if [ "$(uname)" = "Linux" ]; then 12 | gsettings set org.gnome.desktop.interface color-scheme prefer-light 13 | gsettings set org.gnome.desktop.interface gtk-theme 'Yaru' 14 | fi 15 | ) 16 | 17 | [ "$1" = "dark" ] && dark && exit 0 18 | [ "$1" = "light" ] && light && exit 0 19 | 20 | -------------------------------------------------------------------------------- /bin/bin/wayland-electron: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | "$@" --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturer --ozone-platform=wayland 4 | 5 | -------------------------------------------------------------------------------- /brew/.config/brew/.gitignore: -------------------------------------------------------------------------------- 1 | packages.rb 2 | Brewfile.lock.json -------------------------------------------------------------------------------- /brew/.config/brew/Brewfile: -------------------------------------------------------------------------------- 1 | # core packages always needed regardless of development environment. 2 | # 3 | # for more packages, create ~/.config/brew/packages.rb. 4 | # a template exists at ~/.config/brew/packages.sample.rb 5 | 6 | # check if a program exists in PATH 7 | def in_path?(command) 8 | system("which #{ command} > /dev/null 2>&1") 9 | end 10 | 11 | # shell 12 | brew "bat" 13 | brew "tmux" 14 | brew "neovim" 15 | brew "tree" 16 | brew "stow" 17 | brew "zsh" unless in_path? "zsh" 18 | 19 | # utils 20 | brew "jq" 21 | brew "yq" 22 | brew "tree" 23 | brew "htop" 24 | brew "fzf" 25 | brew "watch" 26 | brew "ripgrep" 27 | brew "the_silver_searcher" 28 | brew "git" unless in_path? "git" 29 | brew "git-delta" 30 | brew "gnupg" 31 | brew "socat" 32 | 33 | # internet 34 | brew "yt-dlp" 35 | brew "wget" 36 | brew "axel" 37 | brew "curl" unless in_path? "curl" 38 | 39 | # container/devops" 40 | brew "docker" 41 | brew "docker-compose" 42 | brew "kubectl" 43 | brew "kubectx" 44 | 45 | # load extra packages if exists 46 | packages_file = File.join(ENV["HOME"], ".config/brew/packages.rb") 47 | if File.exist? packages_file 48 | p = File.open(packages_file, 'r').read 49 | eval(p) 50 | end 51 | 52 | # custom packages 53 | 54 | # oh-my-zsh 55 | unless system("(cd ~/.oh-my-zsh && git status) > /dev/null 2>&1") 56 | system("git clone https://github.com/ohmyzsh/ohmyzsh --depth=1 ~/.oh-my-zsh") 57 | end 58 | -------------------------------------------------------------------------------- /brew/.config/brew/packages.sample.rb: -------------------------------------------------------------------------------- 1 | tap "buildpacks/tap" 2 | 3 | # build tools 4 | brew "automake" 5 | brew "autoconf" 6 | brew "autoconf-archive" 7 | brew "pkg-config" 8 | brew "cmake" 9 | brew "libtool" 10 | 11 | # programming/sdks 12 | brew "python3" 13 | brew "ruby" 14 | brew "go" 15 | brew "node" 16 | brew "yarn" 17 | brew "openjdk" 18 | brew "rustup-init" 19 | brew "zig" 20 | brew "dotnet" 21 | 22 | # container/devops" 23 | brew "docker-credential-helper" 24 | brew "docker-credential-helper-ecr" 25 | brew "buildkit" 26 | brew "helm" 27 | brew "kind" 28 | brew "pack" 29 | cask "google-cloud-sdk" 30 | 31 | # virtualization 32 | brew "qemu" 33 | 34 | # misc 35 | brew "gh" 36 | brew "telnet" 37 | brew "overmind" 38 | brew "neofetch" 39 | brew "caddy" 40 | -------------------------------------------------------------------------------- /emacs/.emacs.d/init.el: -------------------------------------------------------------------------------- 1 | ;; Minimal UI 2 | ;;; Code: configuration 3 | (scroll-bar-mode -1) 4 | (tool-bar-mode -1) 5 | (tooltip-mode -1) 6 | ;; menubar is actually useful in GUI 7 | (unless (display-graphic-p) 8 | (xterm-mouse-mode 1) 9 | (menu-bar-mode -1)) 10 | ;; disable blinking cursor 11 | (blink-cursor-mode 0) 12 | ;; hopefully improve flickering 13 | (add-to-list 'default-frame-alist '(inhibit-double-buffering . t)) 14 | 15 | ;;; macOS specific 16 | (let ((is-mac (string-equal system-type "darwin"))) 17 | (when is-mac 18 | ;; make fonts look better with anti-aliasing 19 | (setq mac-allow-anti-aliasing t) 20 | ;; delete files by moving them to the trash 21 | (setq delete-by-moving-to-trash t) 22 | (setq trash-directory "~/.Trash") 23 | 24 | ;; Set modifier keys 25 | (setq mac-option-modifier 'meta) ;; Bind meta to ALT 26 | (setq mac-command-modifier 'control) ;; Bind apple/command to super if you want 27 | (setq mac-function-modifier 'hyper) ;; Bind function key to hyper if you want 28 | (setq mac-right-option-modifier 'meta) ;; unbind right key for accented input 29 | 30 | ;; Make forward delete work 31 | (global-set-key (kbd "") 'delete-forward-char))) 32 | 33 | ;;; Font 34 | ;; Set default font 35 | (set-face-attribute 'default nil 36 | :family "JetBrains Mono" 37 | :height 150 ;; this is 1/10 pt e.g. 140 = 14pt 38 | :weight 'normal 39 | :width 'normal) 40 | (set-face-attribute 'fixed-pitch nil 41 | :family "JetBrains Mono" 42 | :height 150 ;; this is 1/10 pt e.g. 140 = 14pt 43 | :weight 'normal 44 | :width 'normal) 45 | (set-face-attribute 'variable-pitch nil 46 | :family "Inter" 47 | :height 170 ;; this is 1/10 pt e.g. 140 = 14pt 48 | :weight 'normal 49 | :width 'normal) 50 | 51 | ;; Ask "y" or "n" instead of "yes" or "no". Yes, laziness is great. 52 | (fset 'yes-or-no-p 'y-or-n-p) 53 | 54 | 55 | ;;; Functions 56 | 57 | ;; lookup symbol under cursor 58 | (defun ab/help-symbol-lookup() 59 | "Lookup the symbol under cursor." 60 | (interactive) 61 | (if (bound-and-true-p lsp-mode) 62 | (lsp-describe-thing-at-point) 63 | (describe-symbol (symbol-at-point)))) 64 | 65 | ;; split window right and move to it 66 | (defun ab/window-split-right () 67 | "Split windows right and move to the new split" 68 | (interactive) 69 | (split-window-right) 70 | (windmove-right)) 71 | 72 | ;; split window down and move to it 73 | (defun ab/window-split-down () 74 | "Split windows down and move to the new split" 75 | (interactive) 76 | (split-window-below) 77 | (windmove-down)) 78 | 79 | ;; new eshell 80 | (defun ab/new-eshell () 81 | "create a new eshell" 82 | (interactive) 83 | (if (projectile-project-root) 84 | (projectile-run-eshell 'N) 85 | (eshell 'N))) 86 | 87 | ;; new eshell in split 88 | (defun ab/new-eshell-in-split () 89 | "create a new eshell in new split. 90 | if in eshell already; create a vertical split, 91 | otherwise create a horizontal split" 92 | (interactive) 93 | (if (derived-mode-p 'eshell-mode) 94 | (ab/window-split-down) 95 | (ab/window-split-right)) 96 | (ab/new-eshell)) 97 | 98 | ;; customize eshell prompt 99 | ;; found at https://stackoverflow.com/a/59236830 100 | (defun ab/eshell-prompt-function () 101 | "use custom prompt for eshell that displays 102 | current directly and lambda in new line" 103 | (setq eshell-prompt-regexp "^λ: ") 104 | (format "%s\nλ: " (abbreviate-file-name (eshell/pwd)))) 105 | 106 | ;; close window on eshell exit 107 | (defun ab/eshell-kill-window-on-exit () 108 | "delete window when eshell is terminated 109 | as long as the window is not the only window" 110 | (when (not (one-window-p)) 111 | (delete-window))) 112 | 113 | ;; choose between eshell windows 114 | (defun ab/select-or-create-eshell-name(name) 115 | "Select eshell by name or create a new eshell with name" 116 | (interactive) 117 | (if (string= name "new eshell") 118 | (ab/new-eshell) 119 | (switch-to-buffer name))) 120 | 121 | ;; select or create eshell, used by the prior function. 122 | (defun ab/select-or-create-eshell() 123 | "Select or create eshell via a completing-read prompt" 124 | (interactive) 125 | (let* ( 126 | (project-buffers (if (projectile-project-name) 127 | (projectile-project-buffers) 128 | (buffer-list))) 129 | (eshell-buffers 130 | (cl-remove-if-not (lambda (n) 131 | (eq (buffer-local-value 'major-mode n) 'eshell-mode)) 132 | project-buffers)) 133 | (eshell-buffer-names (mapcar 'buffer-name eshell-buffers)) 134 | (empty (eq 0 (length eshell-buffer-names)))) 135 | (if empty 136 | (ab/select-or-create-eshell-name "new eshell") 137 | (let ( 138 | (selected-shell (completing-read "select eshell: " (cons "new eshell" eshell-buffer-names)))) 139 | (ab/select-or-create-eshell-name selected-shell))))) 140 | 141 | ;; customize eshell mode 142 | (defun ab/eshell-mode-config () 143 | (bind-eshell-keys) 144 | (setq show-trailing-whitespace nil)) 145 | 146 | ;; org-babel display results in new buffer 147 | ;; credit: https://emacs.stackexchange.com/a/27190 148 | (defun ab/org-babel-to-buffer () 149 | "A function to efficiently feed babel code block result to a separate buffer" 150 | (interactive) 151 | (org-open-at-point) 152 | (org-babel-remove-result) 153 | (with-current-buffer "*Org Babel Results*" 154 | (when (and 155 | (> (length (buffer-string)) 2) 156 | (string-prefix-p "{" (buffer-substring 1 2))) 157 | (json-mode)))) 158 | 159 | ;; custom configuration for org mode 160 | (defun ab/org-mode-config () 161 | "To use with `org-mode-hook'" 162 | (git-gutter-mode -1) ;; attempt to explicity disable git-gutter. 163 | (company-mode -1) 164 | (local-set-key (kbd "C-c C-S-c") 'ab/org-babel-to-buffer)) 165 | (add-hook 'org-mode-hook 'ab/org-mode-config) 166 | (add-hook 'org-mode-hook 'variable-pitch-mode) 167 | (setq org-ellipsis " ⤵") 168 | 169 | ;; launch new emacs instance 170 | (defun launch-new-emacs() 171 | "launch new emacs process. 172 | it will be launched as a child process of this, 173 | therefore closing this emacs will close all extra emacs. 174 | " 175 | (interactive) 176 | (call-process-shell-command "emacs &")) 177 | 178 | ;; launch new debug emacs instance 179 | (defun launch-new-emacs-with-debug() 180 | "launch new emacs process with --debug-init flag. 181 | it will be launched as a child process of this, 182 | therefore closing this emacs will close all extra emacs. 183 | " 184 | (interactive) 185 | (call-process-shell-command "emacs --debug-init &")) 186 | 187 | ;; launch new vanilla emacs instance 188 | (defun launch-new-vanilla-emacs() 189 | "launch new emacs process. 190 | it will be launched as a child process of this, 191 | therefore closing this emacs will close all extra emacs. 192 | " 193 | (interactive) 194 | (call-process-shell-command "emacs -Q &")) 195 | 196 | ;; process management 197 | (defun ab/start-command(&optional command) 198 | "Start command as a background process" 199 | 200 | (interactive) 201 | 202 | ;; prompt for command if missing 203 | (unless (bound-and-true-p command) 204 | (setq command (read-string "Command: "))) 205 | 206 | ;; exit if not a projectile project 207 | (unless (projectile-project-name) (error "not in a projectile project")) 208 | 209 | ;; initiate the list of running commands, if not set. 210 | (unless (bound-and-true-p ab/command-list) 211 | (setq ab/command-list (make-hash-table :test 'equal))) 212 | 213 | ;; start process 214 | (let ((process-name (ab/start-command--command-name))) 215 | (puthash process-name command ab/command-list) 216 | (with-current-buffer process-name 217 | (goto-char (point-min)) 218 | (erase-buffer)) 219 | (start-process-shell-command process-name process-name command))) 220 | 221 | (defun ab/kill-command () 222 | "Kill previously started command" 223 | (interactive) 224 | (kill-process (ab/start-command--command-name))) 225 | 226 | (defun ab/restart-command () 227 | "Restart the command" 228 | (interactive) 229 | (when (ab/kill-command) 230 | (ab/start-command (gethash (ab/start-command--command-name) ab/command-list)))) 231 | 232 | (defun ab/start-command--command-name () 233 | "Get the command name, derived from projectile project name" 234 | (concat (projectile-project-name) ":cmd")) 235 | 236 | 237 | ;; Toggle Window Maximize 238 | ;; Credit: https://github.com/hlissner/doom-emacs/blob/59a6cb72be1d5f706590208d2ca5213f5a837deb/core/autoload/ui.el#L106 239 | (defvar doom--maximize-last-wconf nil) 240 | ;;;###autoload 241 | (defun doom/window-maximize-buffer () 242 | "Close other windows to focus on this one. Activate again to undo this. If the 243 | window changes before then, the undo expires. 244 | Alternatively, use `doom/window-enlargen'." 245 | (interactive) 246 | (setq doom--maximize-last-wconf 247 | (if (and (null (cdr (cl-remove-if #'window-dedicated-p (window-list)))) 248 | doom--maximize-last-wconf) 249 | (ignore (set-window-configuration doom--maximize-last-wconf)) 250 | (prog1 (current-window-configuration) 251 | (delete-other-windows))))) 252 | 253 | 254 | ;;; Package configs 255 | ;; Elpaca 256 | (defvar elpaca-installer-version 0.6) 257 | (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) 258 | (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) 259 | (defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) 260 | (defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" 261 | :ref nil 262 | :files (:defaults "elpaca-test.el" (:exclude "extensions")) 263 | :build (:not elpaca--activate-package))) 264 | (let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) 265 | (build (expand-file-name "elpaca/" elpaca-builds-directory)) 266 | (order (cdr elpaca-order)) 267 | (default-directory repo)) 268 | (add-to-list 'load-path (if (file-exists-p build) build repo)) 269 | (unless (file-exists-p repo) 270 | (make-directory repo t) 271 | (when (< emacs-major-version 28) (require 'subr-x)) 272 | (condition-case-unless-debug err 273 | (if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) 274 | ((zerop (call-process "git" nil buffer t "clone" 275 | (plist-get order :repo) repo))) 276 | ((zerop (call-process "git" nil buffer t "checkout" 277 | (or (plist-get order :ref) "--")))) 278 | (emacs (concat invocation-directory invocation-name)) 279 | ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" 280 | "--eval" "(byte-recompile-directory \".\" 0 'force)"))) 281 | ((require 'elpaca)) 282 | ((elpaca-generate-autoloads "elpaca" repo))) 283 | (progn (message "%s" (buffer-string)) (kill-buffer buffer)) 284 | (error "%s" (with-current-buffer buffer (buffer-string)))) 285 | ((error) (warn "%s" err) (delete-directory repo 'recursive)))) 286 | (unless (require 'elpaca-autoloads nil t) 287 | (require 'elpaca) 288 | (elpaca-generate-autoloads "elpaca" repo) 289 | (load "./elpaca-autoloads"))) 290 | (add-hook 'after-init-hook #'elpaca-process-queues) 291 | (elpaca `(,@elpaca-order)) 292 | ;; Install use-package support 293 | (elpaca elpaca-use-package 294 | ;; Enable :elpaca use-package keyword. 295 | (elpaca-use-package-mode) 296 | ;; Assume :elpaca t unless otherwise specified. 297 | (setq elpaca-use-package-by-default t)) 298 | ;; Block until current queue processed. 299 | (elpaca-wait) 300 | 301 | 302 | ;;; Which Key 303 | (use-package which-key 304 | :init 305 | (setq which-key-separator " ") 306 | (setq which-key-prefix-prefix "+") 307 | :config 308 | (which-key-mode 1)) 309 | 310 | 311 | ;;; Global 312 | ;; Theming/Appearance 313 | (use-package doom-modeline 314 | :config 315 | (setq doom-modeline-icon nil) 316 | :hook (after-init . doom-modeline-mode)) 317 | (setq modus-themes-operandi-color-overrides 318 | '((bg-main . "#eeeeee") 319 | (bg-hl-line . "#dddddd") 320 | (bg-hl-alt . "#eaddd0") 321 | (bg-dim . "#e8e8e8") 322 | (bg-inactive . "#dedede") 323 | (fg-main . "#222222"))) 324 | (setq modus-themes-vivendi-theme-syntax 'faint) 325 | ;; tweak theme background a bit 326 | (setq modus-themes-vivendi-color-overrides 327 | '((bg-main . "#121212") 328 | (fg-main . "#dddddd") 329 | (fg-dim . "#c0c6e0") 330 | (bg-dim . "#232323") 331 | (bg-alt . "#181732") 332 | (bg-hl-line . "#444444"))) 333 | (load-theme 'modus-vivendi t) 334 | 335 | ;; Show colons in modeline 336 | (column-number-mode 1) 337 | ;; Show matching parens 338 | (setq show-paren-delay 0) 339 | (show-paren-mode 1) 340 | 341 | 342 | ;;; Ivy/Counsel setup 343 | ;; flx for fuzzy and sorting 344 | (use-package flx) 345 | 346 | ;; the ivy parent package 347 | (use-package counsel 348 | :init 349 | (setq ivy-use-virtual-buffers t) 350 | (setq ivy-count-format "(%d/%d) ") 351 | (setq ivy-on-del-error-function #'ignore) 352 | (setq ivy-initial-inputs-alist nil) 353 | (setq ivy-re-builders-alist '((swiper . ivy--regex-plus) 354 | (t . ivy--regex-fuzzy))) 355 | :config 356 | (ivy-mode 1)) 357 | 358 | ;; other counsel key bindings 359 | ;; enable this if you want `swiper' to use it 360 | ;; (setq search-default-mode #'char-fold-to-regexp) 361 | 362 | 363 | ;;; use 4 tab space 364 | (setq-default indent-tabs-mode nil) 365 | (setq-default tab-width 4) 366 | 367 | 368 | ;;; Whitespaces 369 | ;; cleanup whitespace on save 370 | (add-hook 'before-save-hook 'whitespace-cleanup) 371 | ;; Show trailing white spaces 372 | (setq-default show-trailing-whitespace nil) 373 | 374 | 375 | ;;; customize eshell prompt 376 | (setq eshell-prompt-function #'ab/eshell-prompt-function) 377 | (setq comint-prompt-read-only t) 378 | (setq eshell-scroll-to-bottom-on-input t) 379 | ;;; terminate eshell window on exit 380 | (advice-add 'eshell-life-is-too-much :after 'ab/eshell-kill-window-on-exit) 381 | ;;; customize eshell mode with configs and custom keybindings 382 | (add-hook 'eshell-mode-hook 'ab/eshell-mode-config) 383 | 384 | 385 | ;;; Projectile 386 | (use-package projectile 387 | :init 388 | (setq projectile-require-project-root t) 389 | (setq projectile-switch-project-action #'projectile-dired) 390 | (setq projectile-mode-line-prefix "P") 391 | ;; we mainly want projects defined by a few markers and we always want to take the top-most marker. 392 | ;; Reorder so other cases are secondary 393 | (setq projectile-project-root-files #'( ".projectile" "go.mod" "package.json" )) 394 | (setq projectile-project-root-functions #'(projectile-root-top-down 395 | projectile-root-top-down-recurring 396 | projectile-root-bottom-up 397 | projectile-root-local))) 398 | 399 | (use-package counsel-projectile 400 | :config 401 | (counsel-projectile-mode 1)) 402 | 403 | 404 | ;;; General life improvements to emacs 405 | 406 | ;; Disable backup files 407 | (setq make-backup-files nil) ; stop creating backup~ files 408 | (setq auto-save-default nil) ; stop creating #autosave# files 409 | 410 | ;; Set locale to UTF8 411 | (set-language-environment 'utf-8) 412 | (set-terminal-coding-system 'utf-8) 413 | (setq locale-coding-system 'utf-8) 414 | (set-default-coding-systems 'utf-8) 415 | (set-selection-coding-system 'utf-8) 416 | (prefer-coding-system 'utf-8) 417 | 418 | ;; Improving scrolling 419 | (setq redisplay-dont-pause t 420 | scroll-margin 1 421 | scroll-step 1 422 | scroll-conservatively 10000 423 | scroll-preserve-screen-position 1) 424 | 425 | ;; PATH 426 | (use-package exec-path-from-shell 427 | :init 428 | (setq exec-path-from-shell-check-startup-files nil) 429 | (exec-path-from-shell-initialize)) 430 | 431 | 432 | ;;; Programming Languages 433 | (use-package go-mode) 434 | (use-package python-mode) 435 | (use-package rust-mode) 436 | (use-package web-mode) 437 | (use-package vue-mode) 438 | (use-package typescript-mode 439 | :config 440 | (setq typescript-indent-level 2)) 441 | (use-package graphql-mode) 442 | (use-package yaml-mode) 443 | (use-package json-mode) 444 | (use-package svelte-mode) 445 | (use-package nix-mode) 446 | 447 | ;; prettier 448 | (use-package prettier-js 449 | :after (typescript-mode) 450 | :config 451 | (setq prettier-js-args '("--tab-width" "2" "--arrow-parens" "avoid")) 452 | :hook (typescript-mode . prettier-js-mode)) 453 | 454 | ;; Language Server Protocol 455 | 456 | ;;; Yasnippets 457 | (use-package yasnippet 458 | :config (yas-global-mode 1)) 459 | (use-package yasnippet-snippets) 460 | 461 | 462 | ;; Programming life improvements 463 | 464 | ;; display relative line numbers for programming modes 465 | (setq display-line-numbers-type 'relative) 466 | (add-hook 'prog-mode-hook 'display-line-numbers-mode) 467 | ;; Auto-add parenthesis pair 468 | (add-hook 'prog-mode-hook 'electric-pair-local-mode) 469 | 470 | ;; highlight current line 471 | (global-hl-line-mode t) 472 | ;; focus help window 473 | (setq help-window-select t) 474 | 475 | ;; multiple cursors 476 | (use-package multiple-cursors) 477 | (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) 478 | (global-set-key (kbd "C->") 'mc/mark-next-like-this) 479 | (global-set-key (kbd "C-<") 'mc/mark-previous-like-this) 480 | (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) 481 | 482 | ;;; Magit 483 | ;; getting errors until I installed magit-popup and with-editor 484 | (use-package magit-popup ; make sure it is installed 485 | :demand t) ; make sure it is loaded 486 | (use-package with-editor ; make sure it is installed 487 | :demand t) ; make sure it is loaded 488 | (use-package magit 489 | :config 490 | (setq magit-diff-refine-hunk t) 491 | (setq magit-ediff-dwim-show-on-hunks t) 492 | (setq magit-diff-refine-ignore-whitespace nil)) 493 | 494 | 495 | ;;; git gutter 496 | (use-package git-gutter 497 | :init 498 | (setq git-gutter:disabled-modes '(org-mode)) 499 | :config 500 | (global-git-gutter-mode 1)) 501 | 502 | 503 | ;;; improve ediff 504 | (setq ediff-window-setup-function 'ediff-setup-windows-plain) 505 | (setq ediff-split-window-function 'split-window-horizontally) 506 | 507 | 508 | ;;; improve dired 509 | (setq dired-dwim-target t) 510 | (use-package dired-sidebar 511 | :bind (("C-x C-n" . dired-sidebar-toggle-sidebar)) 512 | :ensure t 513 | :commands (dired-sidebar-toggle-sidebar)) 514 | 515 | 516 | ;;; Undo 517 | (use-package undo-tree 518 | :config 519 | (global-undo-tree-mode)) 520 | 521 | ;; custom keybindings for code editing 522 | (global-set-key (kbd "C-h .") 'ab/help-symbol-lookup) 523 | (global-set-key (kbd "C-c p") 'counsel-projectile-find-file) 524 | (global-set-key (kbd "C-c i") 'counsel-imenu) 525 | (global-set-key (kbd "C-c ;") 'comment-line) 526 | ;; ivy/counsel bindings 527 | (global-set-key (kbd "C-x k") 'kill-current-buffer) 528 | (global-set-key (kbd "C-x :") 'counsel-M-x) 529 | (global-set-key (kbd "C-x C-f") 'counsel-find-file) 530 | (global-set-key "\C-s" 'swiper) 531 | (global-set-key (kbd "C-c C-r") 'ivy-resume) 532 | (global-set-key (kbd "") 'ivy-resume) 533 | ;; eshell terminal bindings 534 | (global-set-key (kbd "C-`") 'ab/new-eshell-in-split) 535 | (global-set-key (kbd "C-~") 'ab/select-or-create-eshell) 536 | 537 | ;; autocomplete 538 | (use-package company 539 | :init 540 | (setq company-idle-delay 0) 541 | (setq company-minimum-prefix-length 1) 542 | (setq company-selection-wrap-around t) 543 | :config 544 | (global-company-mode 1)) 545 | ;; quickhelp for autocomplete 546 | (use-package company-quickhelp 547 | :init 548 | (setq company-quickhelp-delay 1.0) 549 | :config 550 | (company-quickhelp-mode 1)) 551 | ;; bind keys to company mode 552 | (with-eval-after-load 'company 553 | (define-key company-active-map (kbd "") #'company-complete)) 554 | 555 | ;; terminal 556 | (use-package vterm) 557 | (use-package multi-vterm) 558 | 559 | ;;; rest client 560 | ;; restclient package 561 | (use-package restclient 562 | :mode (("\\.http\\'" . restclient-mode) 563 | ("\\.rest\\'" . restclient-mode)) 564 | :bind (:map restclient-mode-map 565 | ("C-c C-f" . json-mode-beautify))) 566 | ;; autocomplete in restclient 567 | (use-package company-restclient 568 | :config 569 | (add-to-list 'company-backends 'company-restclient)) 570 | 571 | ;; counsel-jq for real time jq json filter 572 | (use-package counsel-jq 573 | :config 574 | (with-eval-after-load "json-mode" 575 | (define-key json-mode-map (kbd "C-c C-j") #'counsel-jq) 576 | (define-key json-mode-map (kbd "C-c C-f") #'json-mode-beautify))) 577 | 578 | ;;; auto tail log files 579 | (add-to-list 'auto-mode-alist '("\\.log\\'" . auto-revert-mode)) 580 | 581 | 582 | ;;; org babel 583 | ;; no need to confirm evaluation for all languages, some are harmless 584 | (setq org-confirm-babel-evaluate nil) 585 | ;; other org useful configs 586 | (setq org-src-fontify-natively t) 587 | (setq org-adapt-indentation nil) 588 | (setq org-log-done 'time) 589 | (setq org-log-done-with-time t) 590 | (setq org-imenu-depth 7) 591 | ;; improve visibility with indentations. 592 | (setq org-startup-indented t) 593 | ;; Hide leading stars 594 | (setq org-startup-indented t 595 | org-hide-leading-stars 1) 596 | (setq inhibit-compacting-font-caches t) ; fix slowdowns 597 | ;;; add non-core languages 598 | ;; typescript 599 | (use-package ob-typescript) 600 | ;; go 601 | (use-package ob-go 602 | :elpaca (ob-go :type git :host github :repo "pope/ob-go")) 603 | ;; http 604 | (use-package ob-http) 605 | ;; restclient 606 | (use-package ob-restclient) 607 | ;; graphql 608 | (use-package ob-graphql) 609 | ;;; agenda 610 | (setq org-agenda-files (list 611 | "~/org-agenda")) 612 | (setq org-default-notes-file "~/org-agenda/notes.org") 613 | (setq org-default-tasks-file "~/org-agenda/tasks.org") 614 | (setq org-todo-keywords '((sequence "TODO(t)" "PREPARING(p)" "STARTED(s)" "|" "DONE(d)" "CANCELLED(c)"))) 615 | (setq org-todo-keyword-faces '(("DONE" :foreground "forest green" :strike-through nil :weight normal) 616 | ("CANCELLED" :strike-through nil :weight normal))) 617 | 618 | ;;; org code executions 619 | (elpaca-wait) 620 | (setq org-babel-python-command "python3") 621 | (org-babel-do-load-languages 'org-babel-load-languages 622 | '((shell . t) 623 | (python . t) 624 | (js . t) 625 | (typescript . t) 626 | (go . t) 627 | (org . t) 628 | (emacs-lisp . t) 629 | (http . t) 630 | (restclient . t) 631 | (java . t) 632 | (makefile . t) 633 | (sql . t) 634 | (awk . t) 635 | (graphql . t))) 636 | ;; other org keybindings 637 | (global-set-key (kbd "C-c a") 'org-agenda) 638 | (global-set-key (kbd "C-c c") 'org-capture) 639 | (global-set-key (kbd "C-c s") 'org-store-link) 640 | (global-set-key (kbd "C-c t") 'org-tags-view) 641 | ;; exit edit mode with 'C-c C-c' to stay consistent with other places like magit 642 | (eval-after-load 'org-src 643 | '(define-key org-src-mode-map 644 | (kbd "C-c C-c") #'org-edit-src-exit)) 645 | 646 | ;;; Docker 647 | (use-package docker 648 | :bind ("C-c d" . docker)) 649 | (use-package dockerfile-mode 650 | :config 651 | (add-to-list 'auto-mode-alist '("Dockerfile.*\\'" . dockerfile-mode))) 652 | 653 | ;; Terminal clipboard 654 | (use-package clipetty 655 | :ensure t 656 | :hook (after-init . global-clipetty-mode)) 657 | 658 | ;; Other useful packages 659 | (use-package denote) 660 | (use-package beframe) 661 | (elpaca-wait) 662 | (beframe-mode 1) 663 | (global-set-key (kbd "C-x b") 'beframe-switch-buffer) 664 | 665 | 666 | ;;; EVIL mode 667 | ;; Configs that must be set before loading evil mode. 668 | (setq evil-lookup-func #'ab/help-symbol-lookup) 669 | (setq evil-toggle-key "C-S-n") 670 | (setq evil-want-C-i-jump nil) 671 | (setq evil-want-minibuffer t) 672 | (setq evil-undo-system 'undo-tree) 673 | 674 | ;; change model texts 675 | (setq evil-normal-state-tag "") 676 | (setq evil-insert-state-tag "") 677 | (setq evil-visual-state-tag "") 678 | (setq evil-emacs-state-tag "") 679 | (setq evil-motion-state-tag "") 680 | (setq evil-replace-state-tag "") 681 | (setq evil-operator-state-tag "") 682 | (setq evil-normal-state-message nil) 683 | (setq evil-insert-state-message nil) 684 | (setq evil-emacs-state-message nil) 685 | (setq evil-visual-state-message nil) 686 | (setq evil-motion-state-message nil) 687 | (setq evil-replace-state-message nil) 688 | (setq evil-operator-state-message nil) 689 | 690 | 691 | ;; setup package 692 | (use-package evil 693 | :init 694 | (setq evil-want-integration nil) ;; This is optional since it's already set to t by default. 695 | (setq evil-want-keybinding nil) 696 | :config 697 | (evil-mode 1)) 698 | (elpaca-wait) 699 | 700 | ;; specify cursor types for modes 701 | ;; insert mode disabled, therefore cursor not set 702 | (use-package evil-terminal-cursor-changer 703 | :hook (after-init . (lambda() 704 | (unless (display-graphic-p) 705 | (evil-terminal-cursor-changer-activate)))) 706 | :hook (tty-setup . evil-terminal-cursor-changer-activate) 707 | :init 708 | (setq evil-motion-state-cursor 'box) ; █ 709 | (setq evil-visual-state-cursor 'box) ; █ 710 | (setq evil-normal-state-cursor 'box) ; █ 711 | (setq evil-insert-state-cursor 'bar) ; | 712 | (setq evil-emacs-state-cursor 'box)) ; █ 713 | 714 | ;; recover default emacs keys 715 | (evil-define-key 716 | '(normal insert visual replace operator motion emacs) 717 | 'global 718 | (kbd "C-n") 'next-line) 719 | (evil-define-key 720 | '(normal insert visual replace operator motion emacs) 721 | 'global 722 | (kbd "C-p") 'previous-line) 723 | (evil-define-key 724 | '(normal insert visual replace operator motion emacs) 725 | 'global 726 | (kbd "C-f") 'forward-char) 727 | (evil-define-key 728 | '(normal insert visual replace operator motion emacs) 729 | 'global 730 | (kbd "C-b") 'backward-char) 731 | (evil-define-key 732 | '(normal insert visual replace operator motion emacs) 733 | dired-mode-map 734 | (kbd "") 'dired-subtree-toggle) 735 | (define-key evil-normal-state-map (kbd ",cc") 'comment-line) 736 | (define-key evil-visual-state-map (kbd ",cc") 'comment-line) 737 | (define-key evil-normal-state-map (kbd ",O") 'dired-sidebar-toggle-sidebar) 738 | (evil-set-initial-state 'dired-mode 'emacs) 739 | 740 | ;;; startup 741 | (setq inhibit-startup-screen +1) 742 | (setq initial-major-mode 'org-mode) 743 | (setq initial-scratch-message nil) 744 | 745 | 746 | ;; set font again 747 | (custom-theme-set-faces 748 | 'user 749 | '(variable-pitch ((t (:family "Inter" :height 170 :weight normal)))) 750 | '(fixed-pitch ((t (:family "JetBrains Mono" :height 150)))) 751 | '(org-block ((t (:inherit fixed-pitch)))) 752 | '(org-block-begin-line ((t (:inherit (shadow fixed-pitch))))) 753 | '(org-block-end-line ((t (:inherit (shadow fixed-pitch))))) 754 | '(org-code ((t (:inherit (shadow fixed-pitch))))) 755 | '(org-date ((t (:inherit (shadow fixed-pitch))))) 756 | '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch))))) 757 | '(org-footnote ((t (:inherit (shadow fixed-pitch))))) 758 | '(org-indent ((t (:inherit (org-hide fixed-pitch))))) 759 | '(org-link ((t (:underline t)))) 760 | '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch))))) 761 | '(org-property-value ((t (:inherit fixed-pitch))) t) 762 | '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch))))) 763 | '(org-table ((t (:inherit fixed-pitch)))) 764 | '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8)))) 765 | '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))) 766 | -------------------------------------------------------------------------------- /fleet/config/.fleet/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "theme": "sync-with-os", 3 | "keymap": "vscode", 4 | "vimEmulationEnabled": true, 5 | "editor.fontSize": 14.0, 6 | "fus.sendAllowed": false, 7 | "editor.lineSpacing": 1.5, 8 | "terminal.lineSpacing": 1.5, 9 | "terminal.caretShape": "Block", 10 | "terminal.copyOnSelection": true, 11 | "editor.showInlayHints": true, 12 | "editor.caretBlinkingEnabled": false, 13 | "editor.formatOnSave": true, 14 | "editor.showTabs": true, 15 | "editor.indentStyle": "Spaces", 16 | "terminal.fontSize": 14.0, 17 | "editor.lineNumbers": "Relative", 18 | "[git-commit]": {}, 19 | "files.exclude": [ 20 | ".DS_Store", 21 | ".git" 22 | ] 23 | } -------------------------------------------------------------------------------- /fleet/config/.fleet/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "keymap": [ 3 | { 4 | "key": "cmd-u", 5 | "action": "page-up" 6 | }, 7 | { 8 | "key": "cmd-d", 9 | "action": "page-down" 10 | }, 11 | { 12 | "key": "cmd-k", 13 | "action": "arrow-up" 14 | }, 15 | { 16 | "key": "cmd-j", 17 | "action": "arrow-down" 18 | }, 19 | { 20 | "key": "cmd-g", 21 | "action": "show-file-symbols" 22 | }, 23 | { 24 | "key": "cmd-g", 25 | "action": "-next-occurrence" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /git/.config/git/config: -------------------------------------------------------------------------------- 1 | [core] 2 | autocrlf = "input" 3 | pager = "delta" 4 | 5 | [commit] 6 | template = "~/dotfiles/git/.config/git/template.txt" 7 | 8 | [delta] 9 | line-numbers = true 10 | side-by-side = false 11 | syntax-theme = "tomorrow-night" 12 | 13 | [filter "lfs"] 14 | clean = "git-lfs clean -- %f" 15 | process = "git-lfs filter-process" 16 | required = true 17 | smudge = "git-lfs smudge -- %f" 18 | 19 | [format] 20 | signOff = yes 21 | 22 | [sendemail] 23 | verify = "off" 24 | annotate = "yes" 25 | smtpserver = smtp.fastmail.com 26 | smtpuser = abiosoft@fastmail.com 27 | smtpencryption = ssl 28 | smtpserverport = 465 29 | smtpsslcertpath = "" 30 | 31 | [github] 32 | user = "abiosoft" 33 | 34 | [interactive] 35 | diffFilter = "delta --color-only" 36 | 37 | [pull] 38 | rebase = false 39 | 40 | [url "ssh://git@github.com/abiosoft/"] 41 | insteadOf = "https://github.com/abiosoft/" 42 | 43 | [user] 44 | email = "git@abiosoft.com" 45 | name = "Abiola Ibrahim" 46 | 47 | [credential] 48 | helper = store # placeholder. e.g. change to osxkeychain for macOS 49 | 50 | -------------------------------------------------------------------------------- /git/.config/git/template.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Signed-off-by: Abiola Ibrahim 4 | -------------------------------------------------------------------------------- /i3/.Xresources: -------------------------------------------------------------------------------- 1 | Xft.dpi: 192 2 | Xft.autohint: 0 3 | Xft.lcdfilter: lcddefault 4 | Xft.hintstyle: hintslight 5 | Xft.hinting: 1 6 | Xft.antialias: 1 7 | Xft.rgba: rgb 8 | -------------------------------------------------------------------------------- /i3/.config/i3/config: -------------------------------------------------------------------------------- 1 | # This file has been auto-generated by i3-config-wizard(1). 2 | # It will not be overwritten, so edit it as you like. 3 | # 4 | # 5 | 6 | # i3 config file (v4) 7 | # 8 | # Please see https://i3wm.org/docs/userguide.html for a complete reference! 9 | 10 | set $mod Mod4 11 | 12 | # Font for window titles. Will also be used by the bar unless a different font 13 | # is used in the bar {} block below. 14 | font pango:monospace 10 15 | 16 | # This font is widely installed, provides lots of unicode glyphs, right-to-left 17 | # text rendering and scalability on retina/hidpi displays (thanks to pango). 18 | #font pango:DejaVu Sans Mono 8 19 | 20 | # Start XDG autostart .desktop files using dex. See also 21 | # https://wiki.archlinux.org/index.php/XDG_Autostart 22 | exec --no-startup-id dex-autostart --autostart --environment i3 23 | 24 | # for gtk themes 25 | exec --no-startup-id xfsettingsd --sm-client-disable 26 | 27 | # The combination of xss-lock, nm-applet and pactl is a popular choice, so 28 | # they are included here as an example. Modify as you see fit. 29 | 30 | # xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the 31 | # screen before suspend. Use loginctl lock-session to lock your screen. 32 | exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork 33 | 34 | # NetworkManager is the most popular way to manage wireless networks on Linux, 35 | # and nm-applet is a desktop environment-independent system tray GUI for it. 36 | exec --no-startup-id nm-applet 37 | 38 | # Use pactl to adjust volume in PulseAudio. 39 | set $refresh_i3status killall -SIGUSR1 i3status 40 | bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status 41 | bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status 42 | bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status 43 | bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status 44 | 45 | # Use Mouse+$mod to drag floating windows to their wanted position 46 | floating_modifier $mod 47 | 48 | # move tiling windows via drag & drop by left-clicking into the title bar, 49 | # or left-clicking anywhere into the window while holding the floating modifier. 50 | tiling_drag modifier titlebar 51 | 52 | # start a terminal 53 | bindsym $mod+Return exec i3-sensible-terminal 54 | 55 | # kill focused window 56 | bindsym $mod+Shift+q kill 57 | 58 | # start dmenu (a program launcher) 59 | bindsym $mod+d exec --no-startup-id LC_ALL=en_US.UTF-8 dmenu_run 60 | bindsym $mod+p exec --no-startup-id LC_ALL=en_US.UTF-8 dmenu_run 61 | # A more modern dmenu replacement is rofi: 62 | # bindcode $mod+40 exec "rofi -modi drun,run -show drun" 63 | # There also is i3-dmenu-desktop which only displays applications shipping a 64 | # .desktop file. It is a wrapper around dmenu, so you need that installed. 65 | # bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop 66 | 67 | # change focus 68 | bindsym $mod+h focus left 69 | bindsym $mod+j focus down 70 | bindsym $mod+k focus up 71 | bindsym $mod+l focus right 72 | 73 | # alternatively, you can use the cursor keys: 74 | bindsym $mod+Left focus left 75 | bindsym $mod+Down focus down 76 | bindsym $mod+Up focus up 77 | bindsym $mod+Right focus right 78 | 79 | # move focused window 80 | bindsym $mod+Shift+h move left 81 | bindsym $mod+Shift+j move down 82 | bindsym $mod+Shift+k move up 83 | bindsym $mod+Shift+l move right 84 | 85 | # alternatively, you can use the cursor keys: 86 | bindsym $mod+Shift+Left move left 87 | bindsym $mod+Shift+Down move down 88 | bindsym $mod+Shift+Up move up 89 | bindsym $mod+Shift+Right move right 90 | 91 | # split in horizontal orientation 92 | bindsym $mod+alt+h split h 93 | 94 | # split in vertical orientation 95 | bindsym $mod+v split v 96 | 97 | # enter fullscreen mode for the focused container 98 | bindsym $mod+f fullscreen toggle 99 | 100 | # change container layout (stacked, tabbed, toggle split) 101 | bindsym $mod+s layout stacking 102 | bindsym $mod+w layout tabbed 103 | bindsym $mod+e layout toggle split 104 | 105 | # toggle tiling / floating 106 | bindsym $mod+Shift+space floating toggle 107 | 108 | # change focus between tiling / floating windows 109 | bindsym $mod+space focus mode_toggle 110 | 111 | # focus the parent container 112 | bindsym $mod+a focus parent 113 | 114 | # focus the child container 115 | #bindsym $mod+d focus child 116 | 117 | # Define names for default workspaces for which we configure key bindings later on. 118 | # We use variables to avoid repeating the names in multiple places. 119 | set $ws1 "1" 120 | set $ws2 "2" 121 | set $ws3 "3" 122 | set $ws4 "4" 123 | set $ws5 "5" 124 | set $ws6 "6" 125 | set $ws7 "7" 126 | set $ws8 "8" 127 | set $ws9 "9" 128 | set $ws10 "10" 129 | 130 | # switch to workspace 131 | bindsym $mod+1 workspace number $ws1 132 | bindsym $mod+2 workspace number $ws2 133 | bindsym $mod+3 workspace number $ws3 134 | bindsym $mod+4 workspace number $ws4 135 | bindsym $mod+5 workspace number $ws5 136 | bindsym $mod+6 workspace number $ws6 137 | bindsym $mod+7 workspace number $ws7 138 | bindsym $mod+8 workspace number $ws8 139 | bindsym $mod+9 workspace number $ws9 140 | bindsym $mod+0 workspace number $ws10 141 | 142 | # move focused container to workspace 143 | bindsym $mod+Shift+1 move container to workspace number $ws1 144 | bindsym $mod+Shift+2 move container to workspace number $ws2 145 | bindsym $mod+Shift+3 move container to workspace number $ws3 146 | bindsym $mod+Shift+4 move container to workspace number $ws4 147 | bindsym $mod+Shift+5 move container to workspace number $ws5 148 | bindsym $mod+Shift+6 move container to workspace number $ws6 149 | bindsym $mod+Shift+7 move container to workspace number $ws7 150 | bindsym $mod+Shift+8 move container to workspace number $ws8 151 | bindsym $mod+Shift+9 move container to workspace number $ws9 152 | bindsym $mod+Shift+0 move container to workspace number $ws10 153 | 154 | # reload the configuration file 155 | bindsym $mod+Shift+c reload 156 | # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) 157 | bindsym $mod+Shift+r restart 158 | # exit i3 (logs you out of your X session) 159 | bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" 160 | 161 | # resize window (you can also use the mouse for that) 162 | mode "resize" { 163 | # These bindings trigger as soon as you enter the resize mode 164 | 165 | # Pressing left will shrink the window’s width. 166 | # Pressing right will grow the window’s width. 167 | # Pressing up will shrink the window’s height. 168 | # Pressing down will grow the window’s height. 169 | bindsym j resize shrink width 10 px or 10 ppt 170 | bindsym k resize grow height 10 px or 10 ppt 171 | bindsym l resize shrink height 10 px or 10 ppt 172 | bindsym semicolon resize grow width 10 px or 10 ppt 173 | 174 | # same bindings, but for the arrow keys 175 | bindsym Left resize shrink width 10 px or 10 ppt 176 | bindsym Down resize grow height 10 px or 10 ppt 177 | bindsym Up resize shrink height 10 px or 10 ppt 178 | bindsym Right resize grow width 10 px or 10 ppt 179 | 180 | # back to normal: Enter or Escape or $mod+r 181 | bindsym Return mode "default" 182 | bindsym Escape mode "default" 183 | bindsym $mod+r mode "default" 184 | } 185 | 186 | bindsym $mod+r mode "resize" 187 | 188 | # Start i3bar to display a workspace bar (plus the system information i3status 189 | # finds out, if available) 190 | bar { 191 | position top 192 | status_command sh -c "export LC_ALL=en_US.UTF-8; while true; do date +'%a, %b %d %Y, %I:%M %p'; sleep 5; done" 193 | } 194 | 195 | # custom 196 | workspace_layout tabbed 197 | exec --no-startup-id xset r rate 200 40 198 | 199 | -------------------------------------------------------------------------------- /i3/.profile: -------------------------------------------------------------------------------- 1 | export GDK_SCALE=2 2 | export GDK_DPI_SCALE=0.5 3 | export QT_AUTO_SCREEN_SCALE_FACTOR=1 4 | -------------------------------------------------------------------------------- /ideavim/.ideavimrc: -------------------------------------------------------------------------------- 1 | let mapleader = "," 2 | 3 | " comment 4 | set commentary 5 | vmap cc gcc 6 | map cc gcc 7 | 8 | " map cmd to ctrl keys for convenience 9 | map 10 | map 11 | map 12 | map 13 | 14 | " easier split navigation 15 | map 16 | map h 17 | map l 18 | map j 19 | map k 20 | 21 | " clipboard 22 | set clipboard+=unnamed 23 | 24 | 25 | " vmap to maintain Visual Mode after shifting > and < 26 | vmap < >gv 28 | 29 | " fix appcode parameter expansion 30 | set selectmode+=refactoring 31 | set idearefactormode=visual 32 | 33 | " relative line number 34 | set number relativenumber 35 | 36 | -------------------------------------------------------------------------------- /incus/.config/incus/profile-box.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | security.nesting: "true" 3 | user.user-data: |- 4 | #cloud-config 5 | packages: 6 | - pulseaudio-utils 7 | - curl 8 | - wget 9 | - openssh-server 10 | users: 11 | - name: abiola 12 | plain_text_passwd: 'abiola' 13 | home: /home/abiola 14 | shell: /bin/bash 15 | lock_passwd: True 16 | gecos: Abiola 17 | groups: [adm, cdrom, dip, sudo, video] 18 | sudo: ALL=(ALL) NOPASSWD:ALL 19 | write_files: 20 | - path: /usr/local/bin/mystartup.sh 21 | permissions: 0755 22 | content: | 23 | #!/bin/sh 24 | uid=$(id -u) 25 | run_dir=/run/user/$uid 26 | mkdir -p $run_dir && chmod 700 $run_dir && chown $uid:$uid $run_dir 27 | mkdir -p $run_dir/pulse && chmod 700 $run_dir/pulse && chown $uid:$uid $run_dir/pulse 28 | ln -sf /mnt/.container_pulseaudio_socket $run_dir/pulse/native 29 | ln -sf /mnt/.container_wayland_socket $run_dir/wayland-0 30 | tmp_dir=/tmp/.X11-unix 31 | mkdir -p $tmp_dir 32 | ln -sf /mnt/.container_x11_socket $tmp_dir/X0 33 | - path: /usr/local/etc/mystartup.service 34 | content: | 35 | [Unit] 36 | After=local-fs.target 37 | [Service] 38 | Type=oneshot 39 | ExecStart=/usr/local/bin/mystartup.sh 40 | [Install] 41 | WantedBy=default.target 42 | runcmd: 43 | - mkdir -p /home/abiola/.config/systemd/user/default.target.wants 44 | - ln -s /usr/local/etc/mystartup.service /home/abiola/.config/systemd/user/default.target.wants/mystartup.service 45 | - ln -s /usr/local/etc/mystartup.service /home/abiola/.config/systemd/user/mystartup.service 46 | - chown -R abiola:abiola /home/abiola/.config 47 | - echo 'export DISPLAY=:0' >> /home/abiola/.profile 48 | - echo 'export WAYLAND_DISPLAY=wayland-0' >> /home/abiola/.profile 49 | - echo 'export XDG_SESSION_TYPE=wayland' >> /home/abiola/.profile 50 | - echo 'export QT_QPA_PLATFORM=wayland' >> /home/abiola/.profile 51 | - chown abiola:abiola /home/abiola/.profile 52 | - [ sh, -c, "[ -x /opt/scripts/init.sh ] && /opt/scripts/init.sh"] 53 | description: Ubuntu with cloud-init and Wayland/X sharing 54 | devices: 55 | dotfiles: 56 | path: /dotfiles 57 | source: /home/abiola/dotfiles 58 | type: disk 59 | readonly: true 60 | downloads: 61 | path: /downloads 62 | source: /home/abiola/Downloads 63 | type: disk 64 | mic: 65 | gid: "44" 66 | path: /dev/snd/controlC0 67 | required: "false" 68 | source: /dev/snd/controlC0 69 | type: unix-char 70 | gpu: 71 | gid: "44" 72 | type: gpu 73 | pulseaudio-socket: 74 | path: /mnt/.container_pulseaudio_socket 75 | source: /run/user/1000/pulse/native 76 | type: disk 77 | shift: true 78 | ssh: 79 | path: /ssh-keys 80 | source: /home/abiola/.ssh 81 | type: disk 82 | readonly: true 83 | wayland-socket: 84 | path: /mnt/.container_wayland_socket 85 | source: /run/user/1000/wayland-0 86 | type: disk 87 | shift: true 88 | webcam: 89 | gid: "44" 90 | path: /dev/video0 91 | required: "false" 92 | source: /dev/video0 93 | type: unix-char 94 | x11-socket: 95 | path: /mnt/.container_x11_socket 96 | source: /tmp/.X11-unix/X0 97 | type: disk 98 | shift: true 99 | name: box 100 | 101 | -------------------------------------------------------------------------------- /incus/.config/incus/profile-cli.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | security.nesting: "true" 3 | cloud-init.user-data: | 4 | #cloud-config 5 | packages: 6 | - curl 7 | - git 8 | - htop 9 | - openssh-server 10 | - stow 11 | - vim 12 | timezone: Africa/Lagos # change accordingly if needed 13 | users: 14 | - name: abiola 15 | plain_text_passwd: 'abiola' 16 | shell: /bin/bash 17 | lock_passwd: True 18 | gecos: Abiola 19 | groups: [docker, sudo, wheel] 20 | sudo: ALL=(ALL) NOPASSWD:ALL 21 | ssh_authorized_keys: # to be replaced by actual key 22 | - ssh-ed25519 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 23 | write_files: 24 | - path: /usr/local/bin/mystartup.sh 25 | permissions: 0755 26 | content: | 27 | #!/usr/bin/env bash 28 | cp -r /dotfiles /home/abiola/dotfiles 29 | rm -rf /home/abiola/dotfiles/nix/.config/nix/packages.nix 30 | sh -c "cd /home/abiola/dotfiles && stow bin bat git ideavim neovim nix tmux zsh" 31 | curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm 32 | . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh 33 | nix profile install path:/home/abiola/dotfiles/nix/.config/nix/ 34 | nix registry pin nixpkgs 35 | runcmd: 36 | - curl -fsSL https://get.docker.com | sh 37 | - sudo -u abiola sh /usr/local/bin/mystartup.sh 38 | description: Ubuntu personal image 39 | devices: 40 | dotfiles: 41 | path: /dotfiles 42 | source: /Users/abiola/dotfiles 43 | type: disk 44 | readonly: true 45 | downloads: 46 | path: /downloads 47 | source: /Users/abiola/Downloads 48 | type: disk 49 | ssh: 50 | path: /ssh-keys 51 | source: /Users/abiola/.ssh 52 | type: disk 53 | readonly: true 54 | name: cli 55 | 56 | -------------------------------------------------------------------------------- /neovim/.config/nvim/colors/tomorrow-night.vim: -------------------------------------------------------------------------------- 1 | " Tomorrow Night - Full Colour and 256 Colour 2 | " http://chriskempson.com 3 | " 4 | " Hex colour conversion functions borrowed from the theme "Desert256"" 5 | 6 | " Default GUI Colours 7 | let s:foreground = "c5c8c6" 8 | let s:background = "1d1f21" 9 | let s:selection = "373b41" 10 | let s:line = "282a2e" 11 | let s:comment = "969896" 12 | let s:red = "cc6666" 13 | let s:orange = "de935f" 14 | let s:yellow = "f0c674" 15 | let s:green = "b5bd68" 16 | let s:aqua = "8abeb7" 17 | let s:blue = "81a2be" 18 | let s:purple = "b294bb" 19 | let s:window = "4d5057" 20 | 21 | " Console 256 Colours 22 | if !has("gui_running") 23 | let s:background = "303030" 24 | let s:window = "5e5e5e" 25 | let s:line = "3a3a3a" 26 | let s:selection = "585858" 27 | end 28 | 29 | hi clear 30 | syntax reset 31 | 32 | let g:colors_name = "Tomorrow-Night" 33 | 34 | if has("gui_running") || &t_Co == 88 || &t_Co == 256 35 | " Returns an approximate grey index for the given grey level 36 | fun grey_number(x) 37 | if &t_Co == 88 38 | if a:x < 23 39 | return 0 40 | elseif a:x < 69 41 | return 1 42 | elseif a:x < 103 43 | return 2 44 | elseif a:x < 127 45 | return 3 46 | elseif a:x < 150 47 | return 4 48 | elseif a:x < 173 49 | return 5 50 | elseif a:x < 196 51 | return 6 52 | elseif a:x < 219 53 | return 7 54 | elseif a:x < 243 55 | return 8 56 | else 57 | return 9 58 | endif 59 | else 60 | if a:x < 14 61 | return 0 62 | else 63 | let l:n = (a:x - 8) / 10 64 | let l:m = (a:x - 8) % 10 65 | if l:m < 5 66 | return l:n 67 | else 68 | return l:n + 1 69 | endif 70 | endif 71 | endif 72 | endfun 73 | 74 | " Returns the actual grey level represented by the grey index 75 | fun grey_level(n) 76 | if &t_Co == 88 77 | if a:n == 0 78 | return 0 79 | elseif a:n == 1 80 | return 46 81 | elseif a:n == 2 82 | return 92 83 | elseif a:n == 3 84 | return 115 85 | elseif a:n == 4 86 | return 139 87 | elseif a:n == 5 88 | return 162 89 | elseif a:n == 6 90 | return 185 91 | elseif a:n == 7 92 | return 208 93 | elseif a:n == 8 94 | return 231 95 | else 96 | return 255 97 | endif 98 | else 99 | if a:n == 0 100 | return 0 101 | else 102 | return 8 + (a:n * 10) 103 | endif 104 | endif 105 | endfun 106 | 107 | " Returns the palette index for the given grey index 108 | fun grey_colour(n) 109 | if &t_Co == 88 110 | if a:n == 0 111 | return 16 112 | elseif a:n == 9 113 | return 79 114 | else 115 | return 79 + a:n 116 | endif 117 | else 118 | if a:n == 0 119 | return 16 120 | elseif a:n == 25 121 | return 231 122 | else 123 | return 231 + a:n 124 | endif 125 | endif 126 | endfun 127 | 128 | " Returns an approximate colour index for the given colour level 129 | fun rgb_number(x) 130 | if &t_Co == 88 131 | if a:x < 69 132 | return 0 133 | elseif a:x < 172 134 | return 1 135 | elseif a:x < 230 136 | return 2 137 | else 138 | return 3 139 | endif 140 | else 141 | if a:x < 75 142 | return 0 143 | else 144 | let l:n = (a:x - 55) / 40 145 | let l:m = (a:x - 55) % 40 146 | if l:m < 20 147 | return l:n 148 | else 149 | return l:n + 1 150 | endif 151 | endif 152 | endif 153 | endfun 154 | 155 | " Returns the actual colour level for the given colour index 156 | fun rgb_level(n) 157 | if &t_Co == 88 158 | if a:n == 0 159 | return 0 160 | elseif a:n == 1 161 | return 139 162 | elseif a:n == 2 163 | return 205 164 | else 165 | return 255 166 | endif 167 | else 168 | if a:n == 0 169 | return 0 170 | else 171 | return 55 + (a:n * 40) 172 | endif 173 | endif 174 | endfun 175 | 176 | " Returns the palette index for the given R/G/B colour indices 177 | fun rgb_colour(x, y, z) 178 | if &t_Co == 88 179 | return 16 + (a:x * 16) + (a:y * 4) + a:z 180 | else 181 | return 16 + (a:x * 36) + (a:y * 6) + a:z 182 | endif 183 | endfun 184 | 185 | " Returns the palette index to approximate the given R/G/B colour levels 186 | fun colour(r, g, b) 187 | " Get the closest grey 188 | let l:gx = grey_number(a:r) 189 | let l:gy = grey_number(a:g) 190 | let l:gz = grey_number(a:b) 191 | 192 | " Get the closest colour 193 | let l:x = rgb_number(a:r) 194 | let l:y = rgb_number(a:g) 195 | let l:z = rgb_number(a:b) 196 | 197 | if l:gx == l:gy && l:gy == l:gz 198 | " There are two possibilities 199 | let l:dgr = grey_level(l:gx) - a:r 200 | let l:dgg = grey_level(l:gy) - a:g 201 | let l:dgb = grey_level(l:gz) - a:b 202 | let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) 203 | let l:dr = rgb_level(l:gx) - a:r 204 | let l:dg = rgb_level(l:gy) - a:g 205 | let l:db = rgb_level(l:gz) - a:b 206 | let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) 207 | if l:dgrey < l:drgb 208 | " Use the grey 209 | return grey_colour(l:gx) 210 | else 211 | " Use the colour 212 | return rgb_colour(l:x, l:y, l:z) 213 | endif 214 | else 215 | " Only one possibility 216 | return rgb_colour(l:x, l:y, l:z) 217 | endif 218 | endfun 219 | 220 | " Returns the palette index to approximate the 'rrggbb' hex string 221 | fun rgb(rgb) 222 | let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 223 | let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 224 | let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 225 | 226 | return colour(l:r, l:g, l:b) 227 | endfun 228 | 229 | " Sets the highlighting for the given group 230 | fun X(group, fg, bg, attr) 231 | if a:fg != "" 232 | exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) 233 | endif 234 | if a:bg != "" 235 | exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) 236 | endif 237 | if a:attr != "" 238 | exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr 239 | endif 240 | endfun 241 | 242 | " Vim Highlighting 243 | call X("Normal", s:foreground, s:background, "") 244 | call X("LineNr", s:selection, "", "") 245 | call X("NonText", s:selection, "", "") 246 | call X("SpecialKey", s:selection, "", "") 247 | call X("Search", s:background, s:yellow, "") 248 | call X("TabLine", s:window, s:foreground, "reverse") 249 | call X("TabLineFill", s:window, s:foreground, "reverse") 250 | call X("StatusLine", s:window, s:yellow, "reverse") 251 | call X("StatusLineNC", s:window, s:foreground, "reverse") 252 | call X("VertSplit", s:window, s:window, "none") 253 | call X("Visual", "", s:selection, "") 254 | call X("Directory", s:blue, "", "") 255 | call X("ModeMsg", s:green, "", "") 256 | call X("MoreMsg", s:green, "", "") 257 | call X("Question", s:green, "", "") 258 | call X("WarningMsg", s:red, "", "") 259 | call X("MatchParen", "", s:selection, "") 260 | call X("Folded", s:comment, s:background, "") 261 | call X("FoldColumn", "", s:background, "") 262 | if version >= 700 263 | call X("CursorLine", "", s:line, "none") 264 | call X("CursorColumn", "", s:line, "none") 265 | call X("PMenu", s:foreground, s:selection, "none") 266 | call X("PMenuSel", s:foreground, s:selection, "reverse") 267 | call X("SignColumn", "", s:background, "none") 268 | end 269 | if version >= 703 270 | call X("ColorColumn", "", s:line, "none") 271 | end 272 | 273 | " Standard Highlighting 274 | call X("Comment", s:comment, "", "") 275 | call X("Todo", s:comment, s:background, "") 276 | call X("Title", s:comment, "", "") 277 | call X("Identifier", s:red, "", "none") 278 | call X("Statement", s:foreground, "", "") 279 | call X("Conditional", s:foreground, "", "") 280 | call X("Repeat", s:foreground, "", "") 281 | call X("Structure", s:purple, "", "") 282 | call X("Function", s:blue, "", "") 283 | call X("Constant", s:orange, "", "") 284 | call X("Keyword", s:orange, "", "") 285 | call X("String", s:green, "", "") 286 | call X("Special", s:foreground, "", "") 287 | call X("PreProc", s:purple, "", "") 288 | call X("Operator", s:aqua, "", "none") 289 | call X("Type", s:blue, "", "none") 290 | call X("Define", s:purple, "", "none") 291 | call X("Include", s:blue, "", "") 292 | "call X("Ignore", "666666", "", "") 293 | 294 | " Vim Highlighting 295 | call X("vimCommand", s:red, "", "none") 296 | 297 | " C Highlighting 298 | call X("cType", s:yellow, "", "") 299 | call X("cStorageClass", s:purple, "", "") 300 | call X("cConditional", s:purple, "", "") 301 | call X("cRepeat", s:purple, "", "") 302 | 303 | " PHP Highlighting 304 | call X("phpVarSelector", s:red, "", "") 305 | call X("phpKeyword", s:purple, "", "") 306 | call X("phpRepeat", s:purple, "", "") 307 | call X("phpConditional", s:purple, "", "") 308 | call X("phpStatement", s:purple, "", "") 309 | call X("phpMemberSelector", s:foreground, "", "") 310 | 311 | " Ruby Highlighting 312 | call X("rubySymbol", s:green, "", "") 313 | call X("rubyConstant", s:yellow, "", "") 314 | call X("rubyAccess", s:yellow, "", "") 315 | call X("rubyAttribute", s:blue, "", "") 316 | call X("rubyInclude", s:blue, "", "") 317 | call X("rubyLocalVariableOrMethod", s:orange, "", "") 318 | call X("rubyCurlyBlock", s:orange, "", "") 319 | call X("rubyStringDelimiter", s:green, "", "") 320 | call X("rubyInterpolationDelimiter", s:orange, "", "") 321 | call X("rubyConditional", s:purple, "", "") 322 | call X("rubyRepeat", s:purple, "", "") 323 | call X("rubyControl", s:purple, "", "") 324 | call X("rubyException", s:purple, "", "") 325 | 326 | " Crystal Highlighting 327 | call X("crystalSymbol", s:green, "", "") 328 | call X("crystalConstant", s:yellow, "", "") 329 | call X("crystalAccess", s:yellow, "", "") 330 | call X("crystalAttribute", s:blue, "", "") 331 | call X("crystalInclude", s:blue, "", "") 332 | call X("crystalLocalVariableOrMethod", s:orange, "", "") 333 | call X("crystalCurlyBlock", s:orange, "", "") 334 | call X("crystalStringDelimiter", s:green, "", "") 335 | call X("crystalInterpolationDelimiter", s:orange, "", "") 336 | call X("crystalConditional", s:purple, "", "") 337 | call X("crystalRepeat", s:purple, "", "") 338 | call X("crystalControl", s:purple, "", "") 339 | call X("crystalException", s:purple, "", "") 340 | 341 | " Python Highlighting 342 | call X("pythonInclude", s:purple, "", "") 343 | call X("pythonStatement", s:purple, "", "") 344 | call X("pythonConditional", s:purple, "", "") 345 | call X("pythonRepeat", s:purple, "", "") 346 | call X("pythonException", s:purple, "", "") 347 | call X("pythonFunction", s:blue, "", "") 348 | call X("pythonPreCondit", s:purple, "", "") 349 | call X("pythonRepeat", s:aqua, "", "") 350 | call X("pythonExClass", s:orange, "", "") 351 | 352 | " JavaScript Highlighting 353 | call X("javaScriptBraces", s:foreground, "", "") 354 | call X("javaScriptFunction", s:purple, "", "") 355 | call X("javaScriptConditional", s:purple, "", "") 356 | call X("javaScriptRepeat", s:purple, "", "") 357 | call X("javaScriptNumber", s:orange, "", "") 358 | call X("javaScriptMember", s:orange, "", "") 359 | call X("javascriptNull", s:orange, "", "") 360 | call X("javascriptGlobal", s:blue, "", "") 361 | call X("javascriptStatement", s:red, "", "") 362 | 363 | " CoffeeScript Highlighting 364 | call X("coffeeRepeat", s:purple, "", "") 365 | call X("coffeeConditional", s:purple, "", "") 366 | call X("coffeeKeyword", s:purple, "", "") 367 | call X("coffeeObject", s:yellow, "", "") 368 | 369 | " HTML Highlighting 370 | call X("htmlTag", s:red, "", "") 371 | call X("htmlTagName", s:red, "", "") 372 | call X("htmlArg", s:red, "", "") 373 | call X("htmlScriptTag", s:red, "", "") 374 | 375 | " Diff Highlighting 376 | call X("diffAdd", "", "4c4e39", "") 377 | call X("diffDelete", s:background, s:red, "") 378 | call X("diffChange", "", "2B5B77", "") 379 | call X("diffText", s:line, s:blue, "") 380 | 381 | " ShowMarks Highlighting 382 | call X("ShowMarksHLl", s:orange, s:background, "none") 383 | call X("ShowMarksHLo", s:purple, s:background, "none") 384 | call X("ShowMarksHLu", s:yellow, s:background, "none") 385 | call X("ShowMarksHLm", s:aqua, s:background, "none") 386 | 387 | " Lua Highlighting 388 | call X("luaStatement", s:purple, "", "") 389 | call X("luaRepeat", s:purple, "", "") 390 | call X("luaCondStart", s:purple, "", "") 391 | call X("luaCondElseif", s:purple, "", "") 392 | call X("luaCond", s:purple, "", "") 393 | call X("luaCondEnd", s:purple, "", "") 394 | 395 | " Cucumber Highlighting 396 | call X("cucumberGiven", s:blue, "", "") 397 | call X("cucumberGivenAnd", s:blue, "", "") 398 | 399 | " Go Highlighting 400 | call X("goDirective", s:purple, "", "") 401 | call X("goDeclaration", s:purple, "", "") 402 | call X("goStatement", s:purple, "", "") 403 | call X("goConditional", s:purple, "", "") 404 | call X("goConstants", s:orange, "", "") 405 | call X("goTodo", s:yellow, "", "") 406 | call X("goDeclType", s:blue, "", "") 407 | call X("goBuiltins", s:purple, "", "") 408 | call X("goRepeat", s:purple, "", "") 409 | call X("goLabel", s:purple, "", "") 410 | 411 | " Clojure Highlighting 412 | call X("clojureConstant", s:orange, "", "") 413 | call X("clojureBoolean", s:orange, "", "") 414 | call X("clojureCharacter", s:orange, "", "") 415 | call X("clojureKeyword", s:green, "", "") 416 | call X("clojureNumber", s:orange, "", "") 417 | call X("clojureString", s:green, "", "") 418 | call X("clojureRegexp", s:green, "", "") 419 | call X("clojureParen", s:aqua, "", "") 420 | call X("clojureVariable", s:yellow, "", "") 421 | call X("clojureCond", s:blue, "", "") 422 | call X("clojureDefine", s:purple, "", "") 423 | call X("clojureException", s:red, "", "") 424 | call X("clojureFunc", s:blue, "", "") 425 | call X("clojureMacro", s:blue, "", "") 426 | call X("clojureRepeat", s:blue, "", "") 427 | call X("clojureSpecial", s:purple, "", "") 428 | call X("clojureQuote", s:blue, "", "") 429 | call X("clojureUnquote", s:blue, "", "") 430 | call X("clojureMeta", s:blue, "", "") 431 | call X("clojureDeref", s:blue, "", "") 432 | call X("clojureAnonArg", s:blue, "", "") 433 | call X("clojureRepeat", s:blue, "", "") 434 | call X("clojureDispatch", s:blue, "", "") 435 | 436 | " Scala Highlighting 437 | call X("scalaKeyword", s:purple, "", "") 438 | call X("scalaKeywordModifier", s:purple, "", "") 439 | call X("scalaOperator", s:blue, "", "") 440 | call X("scalaPackage", s:red, "", "") 441 | call X("scalaFqn", s:foreground, "", "") 442 | call X("scalaFqnSet", s:foreground, "", "") 443 | call X("scalaImport", s:purple, "", "") 444 | call X("scalaBoolean", s:orange, "", "") 445 | call X("scalaDef", s:purple, "", "") 446 | call X("scalaVal", s:purple, "", "") 447 | call X("scalaVar", s:aqua, "", "") 448 | call X("scalaClass", s:purple, "", "") 449 | call X("scalaObject", s:purple, "", "") 450 | call X("scalaTrait", s:purple, "", "") 451 | call X("scalaDefName", s:blue, "", "") 452 | call X("scalaValName", s:foreground, "", "") 453 | call X("scalaVarName", s:foreground, "", "") 454 | call X("scalaClassName", s:foreground, "", "") 455 | call X("scalaType", s:yellow, "", "") 456 | call X("scalaTypeSpecializer", s:yellow, "", "") 457 | call X("scalaAnnotation", s:orange, "", "") 458 | call X("scalaNumber", s:orange, "", "") 459 | call X("scalaDefSpecializer", s:yellow, "", "") 460 | call X("scalaClassSpecializer", s:yellow, "", "") 461 | call X("scalaBackTick", s:green, "", "") 462 | call X("scalaRoot", s:foreground, "", "") 463 | call X("scalaMethodCall", s:blue, "", "") 464 | call X("scalaCaseType", s:yellow, "", "") 465 | call X("scalaLineComment", s:comment, "", "") 466 | call X("scalaComment", s:comment, "", "") 467 | call X("scalaDocComment", s:comment, "", "") 468 | call X("scalaDocTags", s:comment, "", "") 469 | call X("scalaEmptyString", s:green, "", "") 470 | call X("scalaMultiLineString", s:green, "", "") 471 | call X("scalaUnicode", s:orange, "", "") 472 | call X("scalaString", s:green, "", "") 473 | call X("scalaStringEscape", s:green, "", "") 474 | call X("scalaSymbol", s:orange, "", "") 475 | call X("scalaChar", s:orange, "", "") 476 | call X("scalaXml", s:green, "", "") 477 | call X("scalaConstructorSpecializer", s:yellow, "", "") 478 | call X("scalaBackTick", s:blue, "", "") 479 | 480 | " Git 481 | call X("diffAdded", s:green, "", "") 482 | call X("diffRemoved", s:red, "", "") 483 | call X("gitcommitSummary", "", "", "bold") 484 | 485 | " Delete Functions 486 | delf X 487 | delf rgb 488 | delf colour 489 | delf rgb_colour 490 | delf rgb_level 491 | delf rgb_number 492 | delf grey_colour 493 | delf grey_level 494 | delf grey_number 495 | endif 496 | 497 | set background=dark 498 | -------------------------------------------------------------------------------- /neovim/.config/nvim/colors/tomorrow.vim: -------------------------------------------------------------------------------- 1 | " Tomorrow - Full Colour and 256 Colour 2 | " http://chriskempson.com 3 | " 4 | " Hex colour conversion functions borrowed from the theme "Desert256"" 5 | 6 | " Default GUI Colours 7 | let s:foreground = "4d4d4c" 8 | let s:background = "fafafa" 9 | let s:selection = "d6d6d6" 10 | let s:line = "efefef" 11 | let s:comment = "8e908c" 12 | let s:red = "c82829" 13 | let s:orange = "f5871f" 14 | let s:yellow = "eab700" 15 | let s:green = "718c00" 16 | let s:aqua = "3e999f" 17 | let s:blue = "4271ae" 18 | let s:purple = "8959a8" 19 | let s:window = "efefef" 20 | 21 | set background=light 22 | hi clear 23 | syntax reset 24 | 25 | let g:colors_name = "Tomorrow" 26 | 27 | if has("gui_running") || &t_Co == 88 || &t_Co == 256 28 | " Returns an approximate grey index for the given grey level 29 | fun grey_number(x) 30 | if &t_Co == 88 31 | if a:x < 23 32 | return 0 33 | elseif a:x < 69 34 | return 1 35 | elseif a:x < 103 36 | return 2 37 | elseif a:x < 127 38 | return 3 39 | elseif a:x < 150 40 | return 4 41 | elseif a:x < 173 42 | return 5 43 | elseif a:x < 196 44 | return 6 45 | elseif a:x < 219 46 | return 7 47 | elseif a:x < 243 48 | return 8 49 | else 50 | return 9 51 | endif 52 | else 53 | if a:x < 14 54 | return 0 55 | else 56 | let l:n = (a:x - 8) / 10 57 | let l:m = (a:x - 8) % 10 58 | if l:m < 5 59 | return l:n 60 | else 61 | return l:n + 1 62 | endif 63 | endif 64 | endif 65 | endfun 66 | 67 | " Returns the actual grey level represented by the grey index 68 | fun grey_level(n) 69 | if &t_Co == 88 70 | if a:n == 0 71 | return 0 72 | elseif a:n == 1 73 | return 46 74 | elseif a:n == 2 75 | return 92 76 | elseif a:n == 3 77 | return 115 78 | elseif a:n == 4 79 | return 139 80 | elseif a:n == 5 81 | return 162 82 | elseif a:n == 6 83 | return 185 84 | elseif a:n == 7 85 | return 208 86 | elseif a:n == 8 87 | return 231 88 | else 89 | return 255 90 | endif 91 | else 92 | if a:n == 0 93 | return 0 94 | else 95 | return 8 + (a:n * 10) 96 | endif 97 | endif 98 | endfun 99 | 100 | " Returns the palette index for the given grey index 101 | fun grey_colour(n) 102 | if &t_Co == 88 103 | if a:n == 0 104 | return 16 105 | elseif a:n == 9 106 | return 79 107 | else 108 | return 79 + a:n 109 | endif 110 | else 111 | if a:n == 0 112 | return 16 113 | elseif a:n == 25 114 | return 231 115 | else 116 | return 231 + a:n 117 | endif 118 | endif 119 | endfun 120 | 121 | " Returns an approximate colour index for the given colour level 122 | fun rgb_number(x) 123 | if &t_Co == 88 124 | if a:x < 69 125 | return 0 126 | elseif a:x < 172 127 | return 1 128 | elseif a:x < 230 129 | return 2 130 | else 131 | return 3 132 | endif 133 | else 134 | if a:x < 75 135 | return 0 136 | else 137 | let l:n = (a:x - 55) / 40 138 | let l:m = (a:x - 55) % 40 139 | if l:m < 20 140 | return l:n 141 | else 142 | return l:n + 1 143 | endif 144 | endif 145 | endif 146 | endfun 147 | 148 | " Returns the actual colour level for the given colour index 149 | fun rgb_level(n) 150 | if &t_Co == 88 151 | if a:n == 0 152 | return 0 153 | elseif a:n == 1 154 | return 139 155 | elseif a:n == 2 156 | return 205 157 | else 158 | return 255 159 | endif 160 | else 161 | if a:n == 0 162 | return 0 163 | else 164 | return 55 + (a:n * 40) 165 | endif 166 | endif 167 | endfun 168 | 169 | " Returns the palette index for the given R/G/B colour indices 170 | fun rgb_colour(x, y, z) 171 | if &t_Co == 88 172 | return 16 + (a:x * 16) + (a:y * 4) + a:z 173 | else 174 | return 16 + (a:x * 36) + (a:y * 6) + a:z 175 | endif 176 | endfun 177 | 178 | " Returns the palette index to approximate the given R/G/B colour levels 179 | fun colour(r, g, b) 180 | " Get the closest grey 181 | let l:gx = grey_number(a:r) 182 | let l:gy = grey_number(a:g) 183 | let l:gz = grey_number(a:b) 184 | 185 | " Get the closest colour 186 | let l:x = rgb_number(a:r) 187 | let l:y = rgb_number(a:g) 188 | let l:z = rgb_number(a:b) 189 | 190 | if l:gx == l:gy && l:gy == l:gz 191 | " There are two possibilities 192 | let l:dgr = grey_level(l:gx) - a:r 193 | let l:dgg = grey_level(l:gy) - a:g 194 | let l:dgb = grey_level(l:gz) - a:b 195 | let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) 196 | let l:dr = rgb_level(l:gx) - a:r 197 | let l:dg = rgb_level(l:gy) - a:g 198 | let l:db = rgb_level(l:gz) - a:b 199 | let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) 200 | if l:dgrey < l:drgb 201 | " Use the grey 202 | return grey_colour(l:gx) 203 | else 204 | " Use the colour 205 | return rgb_colour(l:x, l:y, l:z) 206 | endif 207 | else 208 | " Only one possibility 209 | return rgb_colour(l:x, l:y, l:z) 210 | endif 211 | endfun 212 | 213 | " Returns the palette index to approximate the 'rrggbb' hex string 214 | fun rgb(rgb) 215 | let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 216 | let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 217 | let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 218 | 219 | return colour(l:r, l:g, l:b) 220 | endfun 221 | 222 | " Sets the highlighting for the given group 223 | fun X(group, fg, bg, attr) 224 | if a:fg != "" 225 | exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) 226 | endif 227 | if a:bg != "" 228 | exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) 229 | endif 230 | if a:attr != "" 231 | exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr 232 | endif 233 | endfun 234 | 235 | " Vim Highlighting 236 | call X("Normal", s:foreground, s:background, "") 237 | highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE 238 | call X("NonText", s:selection, "", "") 239 | call X("SpecialKey", s:selection, "", "") 240 | call X("Search", s:foreground, s:yellow, "") 241 | call X("TabLine", s:foreground, s:background, "reverse") 242 | call X("StatusLine", s:window, s:yellow, "reverse") 243 | call X("StatusLineNC", s:window, s:foreground, "reverse") 244 | call X("VertSplit", s:window, s:window, "none") 245 | call X("Visual", "", s:selection, "") 246 | call X("Directory", s:blue, "", "") 247 | call X("ModeMsg", s:green, "", "") 248 | call X("MoreMsg", s:green, "", "") 249 | call X("Question", s:green, "", "") 250 | call X("WarningMsg", s:red, "", "") 251 | call X("MatchParen", "", s:selection, "") 252 | call X("Folded", s:comment, s:background, "") 253 | call X("FoldColumn", s:comment, s:background, "") 254 | if version >= 700 255 | call X("CursorLine", "", s:line, "none") 256 | call X("CursorColumn", "", s:line, "none") 257 | call X("PMenu", s:foreground, s:selection, "none") 258 | call X("PMenuSel", s:foreground, s:selection, "reverse") 259 | call X("SignColumn", "", s:background, "none") 260 | end 261 | if version >= 703 262 | call X("ColorColumn", "", s:line, "none") 263 | end 264 | 265 | " Standard Highlighting 266 | call X("Comment", s:comment, "", "") 267 | call X("Todo", s:comment, s:background, "") 268 | call X("Title", s:comment, "", "") 269 | call X("Identifier", s:red, "", "none") 270 | call X("Statement", s:foreground, "", "") 271 | call X("Conditional", s:foreground, "", "") 272 | call X("Repeat", s:foreground, "", "") 273 | call X("Structure", s:purple, "", "") 274 | call X("Function", s:blue, "", "") 275 | call X("Constant", s:orange, "", "") 276 | call X("String", s:green, "", "") 277 | call X("Special", s:foreground, "", "") 278 | call X("PreProc", s:purple, "", "") 279 | call X("Operator", s:aqua, "", "none") 280 | call X("Type", s:blue, "", "none") 281 | call X("Define", s:purple, "", "none") 282 | call X("Include", s:blue, "", "") 283 | "call X("Ignore", "666666", "", "") 284 | 285 | " Vim Highlighting 286 | call X("vimCommand", s:red, "", "none") 287 | 288 | " C Highlighting 289 | call X("cType", s:yellow, "", "") 290 | call X("cStorageClass", s:purple, "", "") 291 | call X("cConditional", s:purple, "", "") 292 | call X("cRepeat", s:purple, "", "") 293 | 294 | " PHP Highlighting 295 | call X("phpVarSelector", s:red, "", "") 296 | call X("phpKeyword", s:purple, "", "") 297 | call X("phpRepeat", s:purple, "", "") 298 | call X("phpConditional", s:purple, "", "") 299 | call X("phpStatement", s:purple, "", "") 300 | call X("phpMemberSelector", s:foreground, "", "") 301 | 302 | " Ruby Highlighting 303 | call X("rubySymbol", s:green, "", "") 304 | call X("rubyConstant", s:yellow, "", "") 305 | call X("rubyAttribute", s:blue, "", "") 306 | call X("rubyInclude", s:blue, "", "") 307 | call X("rubyLocalVariableOrMethod", s:orange, "", "") 308 | call X("rubyCurlyBlock", s:orange, "", "") 309 | call X("rubyStringDelimiter", s:green, "", "") 310 | call X("rubyInterpolationDelimiter", s:orange, "", "") 311 | call X("rubyConditional", s:purple, "", "") 312 | call X("rubyRepeat", s:purple, "", "") 313 | 314 | " Python Highlighting 315 | call X("pythonInclude", s:purple, "", "") 316 | call X("pythonStatement", s:purple, "", "") 317 | call X("pythonConditional", s:purple, "", "") 318 | call X("pythonRepeat", s:purple, "", "") 319 | call X("pythonException", s:purple, "", "") 320 | call X("pythonFunction", s:blue, "", "") 321 | 322 | " Go Highlighting 323 | call X("goStatement", s:purple, "", "") 324 | call X("goConditional", s:purple, "", "") 325 | call X("goRepeat", s:purple, "", "") 326 | call X("goException", s:purple, "", "") 327 | call X("goDeclaration", s:blue, "", "") 328 | call X("goConstants", s:yellow, "", "") 329 | call X("goBuiltins", s:orange, "", "") 330 | 331 | " CoffeeScript Highlighting 332 | call X("coffeeKeyword", s:purple, "", "") 333 | call X("coffeeConditional", s:purple, "", "") 334 | 335 | " JavaScript Highlighting 336 | call X("javaScriptBraces", s:foreground, "", "") 337 | call X("javaScriptFunction", s:purple, "", "") 338 | call X("javaScriptConditional", s:purple, "", "") 339 | call X("javaScriptRepeat", s:purple, "", "") 340 | call X("javaScriptNumber", s:orange, "", "") 341 | call X("javaScriptMember", s:orange, "", "") 342 | 343 | " HTML Highlighting 344 | call X("htmlTag", s:red, "", "") 345 | call X("htmlTagName", s:red, "", "") 346 | call X("htmlArg", s:red, "", "") 347 | call X("htmlScriptTag", s:red, "", "") 348 | 349 | " Diff Highlighting 350 | call X("diffAdded", s:green, "", "") 351 | call X("diffRemoved", s:red, "", "") 352 | 353 | " Delete Functions 354 | delf X 355 | delf rgb 356 | delf colour 357 | delf rgb_colour 358 | delf rgb_level 359 | delf rgb_number 360 | delf grey_colour 361 | delf grey_level 362 | delf grey_number 363 | endif -------------------------------------------------------------------------------- /neovim/.config/nvim/config/fugitive.vim: -------------------------------------------------------------------------------- 1 | 2 | " fugitive 3 | set statusline+=%{fugitive#statusline()} 4 | 5 | if has('nvim') 6 | set diffopt+=vertical 7 | else 8 | set diffopt-=internal 9 | set diffopt+=vertical 10 | endif 11 | 12 | autocmd BufReadPost fugitive://* set bufhidden=delete 13 | 14 | " use fzf for checkout 15 | " Use `:Format` to format current buffer 16 | command! -nargs=0 Gcheckout :!bash -c 'git checkout $(git branch -a | fzf --reverse --no-preview)' 17 | 18 | -------------------------------------------------------------------------------- /neovim/.config/nvim/config/fzf.vim: -------------------------------------------------------------------------------- 1 | " layout 2 | " let g:fzf_layout = { 'window': { 'width': 0.65, 'height': 0.65 } } 3 | 4 | let $FZF_DEFAULT_OPTS="--ansi --layout reverse --margin=0,4" 5 | 6 | let $FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -l -g ""' 7 | 8 | " autocmd VimEnter * command! -bang -nargs=? GFiles call fzf#vim#gitfiles(, {'options': '--no-preview'}, 0) 9 | " 10 | " Preview window on the right side of the window, 11 | " hidden by default, ctrl-/ to toggle 12 | let g:fzf_preview_window = ['right:hidden', 'ctrl-/'] 13 | " let g:fzf_layout = 'reverse-list' 14 | 15 | -------------------------------------------------------------------------------- /neovim/.config/nvim/config/general.vim: -------------------------------------------------------------------------------- 1 | 2 | "***************************************************************************** 3 | "" Basic Setup 4 | "*****************************************************************************" 5 | "" Encoding 6 | set encoding=utf-8 7 | set fileencoding=utf-8 8 | set fileencodings=utf-8 9 | set bomb 10 | set binary 11 | 12 | 13 | "" Fix backspace indent 14 | set backspace=indent,eol,start 15 | 16 | "" Tabs. May be overriten by autocmd rules 17 | set tabstop=4 18 | set softtabstop=0 19 | set shiftwidth=4 20 | set expandtab 21 | 22 | "" Map leader to , 23 | let mapleader=',' 24 | 25 | "" Enable hidden buffers 26 | set hidden 27 | 28 | "" Searching 29 | set hlsearch 30 | set incsearch 31 | set ignorecase 32 | set smartcase 33 | 34 | "" Directories for swp files 35 | set nobackup 36 | set noswapfile 37 | 38 | set fileformats=unix,dos,mac 39 | set showcmd 40 | 41 | " session management 42 | let g:session_directory = "~/.config/nvim/session" 43 | let g:session_autoload = "no" 44 | let g:session_autosave = "no" 45 | let g:session_command_aliases = 1 46 | 47 | "***************************************************************************** 48 | "" Visual Settings 49 | "***************************************************************************** 50 | syntax on 51 | set ruler 52 | set number 53 | set relativenumber 54 | 55 | let no_buffers_menu=1 56 | 57 | set mousemodel=popup 58 | set t_Co=256 59 | set gfn=Monospace\ 10 60 | 61 | if has("gui_running") 62 | if has("gui_mac") || has("gui_macvim") 63 | set guifont=Menlo:h12 64 | set transparency=7 65 | endif 66 | else 67 | let g:CSApprox_loaded = 1 68 | 69 | " IndentLine 70 | let g:indentLine_enabled = 1 71 | let g:indentLine_concealcursor = 'nc' 72 | let g:indentLine_char = '┆' 73 | let g:indentLine_faster = 1 74 | 75 | 76 | endif 77 | 78 | 79 | 80 | "" Disable the blinking cursor. 81 | " set gcr=a:blinkon0 82 | set scrolloff=3 83 | 84 | " change cursors in modes 85 | if !has('nvim') 86 | " :autocmd InsertEnter * set cul 87 | " :autocmd InsertLeave * set nocul 88 | let &t_SI = "\e[6 q" 89 | let &t_EI = "\e[2 q" 90 | " Optionally reset the cursor on start: 91 | augroup myCmds 92 | au! 93 | autocmd VimEnter * silent !echo -ne "\e[2 q" 94 | augroup END 95 | endif 96 | 97 | "" Status bar 98 | set laststatus=2 99 | 100 | "" Use modeline overrides 101 | set modeline 102 | set modelines=10 103 | 104 | set title 105 | set titleold="Terminal" 106 | set titlestring=%F 107 | 108 | set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\ 109 | 110 | "***************************************************************************** 111 | "" Abbreviations 112 | "***************************************************************************** 113 | "" no one is really happy until you have this shortcuts 114 | cnoreabbrev W! w! 115 | cnoreabbrev Q! q! 116 | cnoreabbrev Qall! qall! 117 | cnoreabbrev Wq wq 118 | cnoreabbrev Wa wa 119 | cnoreabbrev wQ wq 120 | cnoreabbrev WQ wq 121 | cnoreabbrev W w 122 | cnoreabbrev Q q 123 | cnoreabbrev Qall qall 124 | 125 | "" NERDTree configuration 126 | let g:NERDTreeChDirMode=2 127 | let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__'] 128 | let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$'] 129 | let g:NERDTreeShowBookmarks=1 130 | let g:nerdtree_tabs_focus_on_files=1 131 | let g:NERDTreeMapOpenInTabSilent = '' 132 | let g:NERDTreeWinSize = 50 133 | set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite 134 | nnoremap o :NERDTreeFind 135 | noremap O :NERDTreeToggle 136 | " show hidden files in NERDTree 137 | let NERDTreeShowHidden=1 138 | " auto close 139 | let NERDTreeQuitOnOpen = 1 140 | " auto delete buffer of deleted file 141 | let NERDTreeAutoDeleteBuffer = 1 142 | " other customizations 143 | let NERDTreeMinimalUI = 1 144 | let NERDTreeDirArrows = 1 145 | " keep open when opening file 146 | let NERDTreeCustomOpenArgs = {'file': {'reuse': 'all', 'where': 'p', 'keepopen': 1}, 'dir': {}} 147 | " " open nerdtree on launch if there are no file as args 148 | " autocmd StdinReadPre * let s:std_in=1 149 | " autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif 150 | " autocmd VimEnter * wincmd p 151 | 152 | 153 | " grep.vim 154 | nnoremap b :Buffers 155 | nnoremap f :Ag 156 | let Grep_Default_Options = '-IR' 157 | let Grep_Skip_Files = '*.log *.db' 158 | let Grep_Skip_Dirs = '.git node_modules' 159 | 160 | " vimshell.vim 161 | let g:vimshell_user_prompt = 'fnamemodify(getcwd(), ":~")' 162 | let g:vimshell_prompt = '$ ' 163 | 164 | " terminal emulation 165 | if has('nvim') 166 | nnoremap sh :terminal 167 | else 168 | nnoremap sh :VimShellCreate 169 | endif 170 | 171 | nnoremap :Files 172 | 173 | "***************************************************************************** 174 | "" Functions 175 | "***************************************************************************** 176 | if !exists('*s:setupWrapping') 177 | function s:setupWrapping() 178 | set wrap 179 | set wm=2 180 | set textwidth=79 181 | endfunction 182 | endif 183 | 184 | "***************************************************************************** 185 | "" Autocmd Rules 186 | "***************************************************************************** 187 | "" The PC is fast enough, do syntax highlight syncing from start unless 200 lines 188 | augroup vimrc-sync-fromstart 189 | autocmd! 190 | autocmd BufEnter * :syntax sync maxlines=200 191 | augroup END 192 | 193 | "" Remember cursor position 194 | augroup vimrc-remember-cursor-position 195 | autocmd! 196 | autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif 197 | augroup END 198 | 199 | "" txt 200 | augroup vimrc-wrapping 201 | autocmd! 202 | autocmd BufRead,BufNewFile *.txt call s:setupWrapping() 203 | augroup END 204 | 205 | "" make/cmake 206 | augroup vimrc-make-cmake 207 | autocmd! 208 | autocmd FileType make setlocal noexpandtab 209 | autocmd BufNewFile,BufRead CMakeLists.txt setlocal filetype=cmake 210 | augroup END 211 | 212 | augroup filetype 213 | au! BufRead,BufNewFile *.swift set ft=swift 214 | augroup END 215 | 216 | set autoread 217 | 218 | "***************************************************************************** 219 | "" Mappings 220 | "***************************************************************************** 221 | 222 | "" Split 223 | noremap h :split 224 | noremap v :vsplit 225 | 226 | "" Git 227 | noremap ga :Gwrite 228 | noremap gc :Gcommit 229 | noremap gsh :Gpush 230 | noremap gll :Gpull 231 | noremap gs :Gstatus 232 | noremap gb :Gblame 233 | noremap gd :Gvdiff 234 | noremap gr :Gremove 235 | 236 | " session management 237 | nnoremap so :OpenSession 238 | nnoremap ss :SaveSession 239 | nnoremap sd :DeleteSession 240 | nnoremap sc :CloseSession 241 | 242 | "" Tabs 243 | nnoremap gt 244 | nnoremap gT 245 | nnoremap :tabnew 246 | 247 | "" Set working directory 248 | nnoremap . :lcd %:p:h 249 | 250 | "" Opens an edit command with the path of the currently edited file filled in 251 | noremap e :e =expand("%:p:h") . "/" 252 | 253 | "" Opens a tab edit command with the path of the currently edited file filled 254 | noremap te :tabe =expand("%:p:h") . "/" 255 | 256 | " snippets 257 | let g:UltiSnipsExpandTrigger="" 258 | let g:UltiSnipsJumpForwardTrigger="" 259 | let g:UltiSnipsJumpBackwardTrigger="" 260 | let g:UltiSnipsEditSplit="vertical" 261 | 262 | " Tagbar 263 | nmap :TagbarToggle 264 | let g:tagbar_autofocus = 1 265 | 266 | " Disable visualbell 267 | set noerrorbells visualbell t_vb= 268 | if has('autocmd') 269 | autocmd GUIEnter * set visualbell t_vb= 270 | endif 271 | 272 | "" Copy/Paste/Cut 273 | if has('unnamedplus') 274 | set clipboard=unnamed,unnamedplus 275 | endif 276 | 277 | noremap YY "+y 278 | noremap p "+gP 279 | noremap XX "+x 280 | 281 | if has('macunix') 282 | " pbcopy for OSX copy/paste 283 | vmap :!pbcopy 284 | vmap :w !pbcopy 285 | endif 286 | 287 | "" Buffer nav 288 | noremap z :bp 289 | noremap q :bp 290 | noremap x :bn 291 | noremap w :bn 292 | 293 | "" Close buffer 294 | noremap c :bp:bd # 295 | 296 | "" Clean search (highlight) 297 | nnoremap :noh 298 | 299 | "" Switching windows 300 | noremap j 301 | noremap k 302 | noremap l 303 | noremap h 304 | 305 | "" Vmap for maintain Visual Mode after shifting > and < 306 | vmap < >gv 308 | 309 | "" Move visual block 310 | vnoremap J :m '>+1gv=gv 311 | vnoremap K :m '<-2gv=gv 312 | 313 | "" Open current line on GitHub 314 | " nnoremap o :.Gbrowse 315 | 316 | "***************************************************************************** 317 | "" Custom configs 318 | "***************************************************************************** 319 | 320 | 321 | " html 322 | " for html files, 2 spaces 323 | autocmd Filetype html setlocal ts=2 sw=2 expandtab 324 | 325 | " for sh files, 2 spaces 326 | autocmd Filetype sh setlocal ts=2 sw=2 expandtab 327 | 328 | 329 | " Syntax highlight 330 | " Default highlight is better than polyglot 331 | let g:polyglot_disabled = ['python', 'go'] 332 | let python_highlight_all = 1 333 | Plug 'sheerun/vim-polyglot' 334 | Plug 'keith/swift.vim' 335 | 336 | " mdx files 337 | augroup mdx 338 | au! 339 | autocmd BufNewFile,BufRead *.mdx set filetype=markdown.mdx 340 | augroup END 341 | 342 | "***************************************************************************** 343 | "***************************************************************************** 344 | 345 | "" Include user's local vim config 346 | if filereadable(expand("~/.config/nvim/local_init.vim")) 347 | source ~/.config/nvim/local_init.vim 348 | endif 349 | 350 | "***************************************************************************** 351 | "" Convenience variables 352 | "***************************************************************************** 353 | 354 | hi Normal guibg=NONE ctermbg=NONE 355 | 356 | set shell=~/bin/myzsh 357 | 358 | " commentary 359 | noremap cc :Commentary 360 | 361 | imap jj 362 | 363 | " save read-only files 364 | cmap w!! w !sudo tee % >/dev/null 365 | 366 | " disable mouse 367 | set mouse=a 368 | if !has('nvim') 369 | " fix mouse for vim8 370 | set ttymouse=sgr 371 | endif 372 | 373 | " fix quickfix height 374 | autocmd FileType qf 6wincmd_ 375 | 376 | " use real-time search replacement. only works in neovim 377 | if has('nvim') 378 | set inccommand=nosplit 379 | endif 380 | 381 | " highlight current line 382 | set cursorline 383 | 384 | -------------------------------------------------------------------------------- /neovim/.config/nvim/config/go.vim: -------------------------------------------------------------------------------- 1 | " go 2 | let g:tagbar_type_go = { 3 | \ 'ctagstype' : 'go', 4 | \ 'kinds' : [ 'p:package', 'i:imports:1', 'c:constants', 'v:variables', 5 | \ 't:types', 'n:interfaces', 'w:fields', 'e:embedded', 'm:methods', 6 | \ 'r:constructor', 'f:functions' ], 7 | \ 'sro' : '.', 8 | \ 'kind2scope' : { 't' : 'ctype', 'n' : 'ntype' }, 9 | \ 'scope2kind' : { 'ctype' : 't', 'ntype' : 'n' }, 10 | \ 'ctagsbin' : 'gotags', 11 | \ 'ctagsargs' : '-sort -silent' 12 | \ } 13 | 14 | autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 15 | 16 | " run :GoBuild or :GoTestCompile based on the go file 17 | function! s:build_go_files() 18 | let l:file = expand('%') 19 | if l:file =~# '^\f\+_test\.go$' 20 | call go#cmd#Test(0, 1) 21 | elseif l:file =~# '^\f\+\.go$' 22 | call go#cmd#Build(0) 23 | endif 24 | endfunction 25 | 26 | let g:go_info_mode = 'gopls' 27 | let g:go_def_mode = 'gopls' 28 | let g:go_decls_mode = 'fzf' 29 | let g:go_list_type = "quickfix" 30 | let g:go_fmt_command = "goimports" 31 | let g:go_fmt_fail_silently = 1 32 | 33 | " automatic type info 34 | set updatetime=100 35 | let g:go_auto_type_info = 1 36 | 37 | " TODO enable when syntastic is installed 38 | " let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck'] 39 | " let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go','dart'] } 40 | 41 | let g:go_highlight_types = 1 42 | let g:go_highlight_fields = 0 43 | let g:go_highlight_functions = 1 44 | let g:go_highlight_methods = 1 45 | let g:go_highlight_operators = 0 46 | let g:go_highlight_build_constraints = 1 47 | let g:go_highlight_generate_tags = 1 48 | let g:go_highlight_space_tab_error = 1 49 | let g:go_highlight_array_whitespace_error = 1 50 | let g:go_highlight_trailing_whitespace_error = 1 51 | let g:go_highlight_extra_types = 0 52 | 53 | " use floating neovim window for doc 54 | let g:go_doc_popup_window = 1 55 | 56 | " metalinter - not needed, now handled by ALE 57 | " let g:go_metalinter_autosave = 1 58 | " let g:go_metalinter_autosave_enabled = ['vet', 'golint'] 59 | 60 | " debugger 61 | let g:go_debug_windows = { 62 | \ 'vars': 'rightbelow 60vnew', 63 | \ 'stack': 'rightbelow 10new', 64 | \ 'out': 'botright 20new', 65 | \ } 66 | 67 | " identifier 68 | 69 | augroup go 70 | 71 | au! 72 | au Filetype go command! -bang A call go#alternate#Switch(0, 'edit') 73 | au Filetype go command! -bang AV call go#alternate#Switch(0, 'vsplit') 74 | au Filetype go command! -bang AS call go#alternate#Switch(0, 'split') 75 | au Filetype go command! -bang AT call go#alternate#Switch(0, 'tabe') 76 | 77 | au FileType go nmap dd (go-def-vertical) 78 | au FileType go nmap dv (go-doc-vertical) 79 | au FileType go nmap db (go-doc-browser) 80 | 81 | au FileType go nmap r (go-run) 82 | au FileType go nmap t (go-test) 83 | au FileType go nmap gt (go-coverage-toggle) 84 | au FileType go nmap i (go-info) 85 | au FileType go nmap l (go-metalinter) 86 | au FileType go nmap :GoDecls 87 | au FileType go imap :GoDecls 88 | au FileType go nmap rb :call build_go_files() 89 | 90 | augroup END 91 | 92 | -------------------------------------------------------------------------------- /neovim/.config/nvim/config/hcl.vim: -------------------------------------------------------------------------------- 1 | augroup filetypedetect 2 | autocmd BufNew,BufNewFile,BufRead *.nomad :setfiletype hcl 3 | augroup END 4 | -------------------------------------------------------------------------------- /neovim/.config/nvim/config/theme.vim: -------------------------------------------------------------------------------- 1 | " theme settings 2 | set termguicolors 3 | 4 | colorscheme tomorrow-night 5 | hi Normal guibg=NONE ctermbg=NONE 6 | -------------------------------------------------------------------------------- /neovim/.config/nvim/config/vimplug.vim: -------------------------------------------------------------------------------- 1 | "***************************************************************************** 2 | "" Vim-PLug core 3 | "***************************************************************************** 4 | if has('vim_starting') 5 | set nocompatible " Be iMproved 6 | endif 7 | 8 | if has('nvim') 9 | let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim') 10 | 11 | let g:vim_bootstrap_langs = "go,html,javascript,php,python,ruby" 12 | let g:vim_bootstrap_editor = "nvim" " nvim or vim 13 | 14 | if !filereadable(vimplug_exists) 15 | echo "Installing Vim-Plug..." 16 | echo "" 17 | silent !\curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 18 | let g:not_finish_vimplug = "yes" 19 | 20 | autocmd VimEnter * PlugInstall 21 | endif 22 | else 23 | if empty(glob('~/.vim/autoload/plug.vim')) 24 | silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs 25 | \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 26 | autocmd VimEnter * PlugInstall --sync | source $MYVIMRC 27 | endif 28 | endif 29 | 30 | " Required: 31 | call plug#begin(expand('~/.config/nvim/plugged')) 32 | 33 | "***************************************************************************** 34 | "" Plug install packages 35 | "***************************************************************************** 36 | Plug 'scrooloose/nerdtree' 37 | Plug 'jistr/vim-nerdtree-tabs' 38 | Plug 'tpope/vim-commentary' 39 | Plug 'airblade/vim-gitgutter' 40 | Plug 'vim-scripts/grep.vim' 41 | Plug 'vim-scripts/CSApprox' 42 | Plug 'Raimondi/delimitMate' 43 | Plug 'majutsushi/tagbar' 44 | Plug 'Yggdroot/indentLine' 45 | Plug 'tpope/vim-fugitive' 46 | Plug 'junegunn/gv.vim' 47 | Plug 'fatih/vim-go' 48 | Plug 'LnL7/vim-nix' 49 | Plug 'fatih/vim-hclfmt' 50 | Plug 'hashivim/vim-nomadproject' 51 | Plug 'hashivim/vim-terraform' 52 | Plug 'ziglang/zig.vim' 53 | Plug 'github/copilot.vim' 54 | Plug 'ojroques/vim-oscyank' 55 | 56 | if has('nvim') 57 | Plug 'neovim/nvim-lspconfig' 58 | Plug 'nvim-lua/completion-nvim' 59 | endif 60 | 61 | 62 | let g:make = 'gmake' 63 | if exists('make') 64 | let g:make = 'make' 65 | endif 66 | Plug 'Shougo/vimproc.vim', {'do': g:make} 67 | 68 | "" Vim-Session 69 | Plug 'xolox/vim-misc' 70 | Plug 'xolox/vim-session' 71 | 72 | if v:version >= 703 73 | Plug 'Shougo/vimshell.vim' 74 | endif 75 | 76 | "***************************************************************************** 77 | "" Custom bundles 78 | "***************************************************************************** 79 | 80 | " file search 81 | Plug 'junegunn/fzf' 82 | Plug 'junegunn/fzf.vim' 83 | 84 | "***************************************************************************** 85 | "***************************************************************************** 86 | 87 | "" Include user's extra bundle 88 | if filereadable(expand("~/.config/nvim/local_bundles.vim")) 89 | source ~/.config/nvim/local_bundles.vim 90 | endif 91 | 92 | call plug#end() 93 | 94 | -------------------------------------------------------------------------------- /neovim/.config/nvim/config/vscode.vim: -------------------------------------------------------------------------------- 1 | "" Map leader to , 2 | let mapleader=',' 3 | 4 | " Better Navigation 5 | nnoremap :call VSCodeNotify('workbench.action.navigateDown') 6 | xnoremap :call VSCodeNotify('workbench.action.navigateDown') 7 | nnoremap :call VSCodeNotify('workbench.action.navigateUp') 8 | xnoremap :call VSCodeNotify('workbench.action.navigateUp') 9 | nnoremap :call VSCodeNotify('workbench.action.navigateLeft') 10 | xnoremap :call VSCodeNotify('workbench.action.navigateLeft') 11 | nnoremap :call VSCodeNotify('workbench.action.navigateRight') 12 | xnoremap :call VSCodeNotify('workbench.action.navigateRight') 13 | 14 | " nnoremap cc :call VSCodeNotify('editor.action.commentLine') 15 | xmap cc VSCodeCommentary 16 | xmap gc VSCodeCommentary 17 | nmap gc VSCodeCommentary 18 | omap gc VSCodeCommentary 19 | nmap gcc VSCodeCommentaryLine 20 | 21 | "" Copy/Paste/Cut 22 | if has('unnamedplus') 23 | set clipboard=unnamed,unnamedplus 24 | endif 25 | 26 | -------------------------------------------------------------------------------- /neovim/.config/nvim/config/yank.vim: -------------------------------------------------------------------------------- 1 | autocmd TextYankPost * 2 | \ if v:event.operator is 'y' && v:event.regname is '' | 3 | \ execute 'OSCYankRegister +' | 4 | \ endif 5 | -------------------------------------------------------------------------------- /neovim/.config/nvim/init.vim: -------------------------------------------------------------------------------- 1 | if exists('g:vscode') 2 | source ~/.config/nvim/config/vscode.vim 3 | else 4 | source ~/.config/nvim/config/vimplug.vim 5 | source ~/.config/nvim/config/general.vim 6 | source ~/.config/nvim/config/fugitive.vim 7 | source ~/.config/nvim/config/go.vim 8 | source ~/.config/nvim/config/hcl.vim 9 | source ~/.config/nvim/config/fzf.vim 10 | source ~/.config/nvim/config/theme.vim 11 | source ~/.config/nvim/config/yank.vim 12 | endif 13 | 14 | -------------------------------------------------------------------------------- /neovim/.gitignore: -------------------------------------------------------------------------------- 1 | **/autoload/** 2 | **/plugged/** 3 | -------------------------------------------------------------------------------- /nix/.config/nix/core.nix: -------------------------------------------------------------------------------- 1 | { nixpkgs ? import { }, nixpkgs-unstable ? import { } }: 2 | 3 | let 4 | hasPackages = builtins.pathExists ./packages.nix; 5 | in 6 | ( 7 | if hasPackages then (import ./packages.nix { nixpkgs = nixpkgs; nixpkgs-unstable = nixpkgs-unstable; }) else [ ] 8 | ) 9 | ++ 10 | ( 11 | with nixpkgs; 12 | # core packages always required 13 | [ 14 | ## nix 15 | nixpkgs-fmt 16 | 17 | ## shell 18 | stow 19 | bat 20 | tmux 21 | zsh 22 | neovim 23 | oh-my-zsh 24 | tree 25 | 26 | ## utils 27 | jq 28 | htop 29 | fzf 30 | watch 31 | ripgrep 32 | silver-searcher 33 | gitFull 34 | delta 35 | gh 36 | pass 37 | gnupg 38 | shellcheck 39 | sqlite 40 | socat 41 | 42 | ## internet 43 | yt-dlp 44 | wget 45 | axel 46 | curl 47 | speedtest-cli 48 | 49 | ## container/devops 50 | docker-client 51 | docker-compose 52 | kubectl 53 | ] 54 | ) 55 | 56 | /* 57 | For more packages, create a ~/.config/nix/packages.nix and populate accordingly with the packages 58 | 59 | with import { }; 60 | [ 61 | go_1_19 62 | python310 63 | ruby_3_1 64 | nodejs-18_x 65 | yarn 66 | jdk 67 | rustup 68 | dotnet-sdk 69 | postgresql 70 | ] 71 | 72 | */ 73 | -------------------------------------------------------------------------------- /nix/.config/nix/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "My dotfiles"; 3 | 4 | inputs = { 5 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; 6 | nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 7 | }; 8 | 9 | outputs = { self, nixpkgs, nixpkgs-unstable, ... }: 10 | let 11 | name = "abiola"; 12 | build = { system }: ( 13 | let 14 | pkgs = import nixpkgs { inherit system; config = { allowUnfree = true; }; }; 15 | pkgs-unstable = import nixpkgs-unstable { inherit system; config = { allowUnfree = true; }; }; 16 | env = pkgs.buildEnv { 17 | name = "${name}"; 18 | paths = import ./core.nix { nixpkgs = pkgs; nixpkgs-unstable = pkgs-unstable; }; 19 | }; 20 | in 21 | { "${name}" = env; default = env; } 22 | ); 23 | systems = [ "aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ]; 24 | list = map 25 | (system: { 26 | name = "${system}"; 27 | value = (build { inherit system; }); 28 | }) 29 | systems; 30 | in 31 | { packages = builtins.listToAttrs list; }; 32 | } 33 | -------------------------------------------------------------------------------- /nix/.config/nix/nix.conf: -------------------------------------------------------------------------------- 1 | experimental-features = nix-command flakes 2 | -------------------------------------------------------------------------------- /nix/.config/nix/packages.sample.nix: -------------------------------------------------------------------------------- 1 | /* 2 | create a copy as packages.nix and edit accordingly 3 | 4 | cp packages.sample.nix packages.nix 5 | */ 6 | 7 | { nixpkgs ? import { }, nixpkgs-unstable ? import { } }: 8 | 9 | ( 10 | with nixpkgs-unstable; 11 | [ 12 | go 13 | qemu 14 | ] 15 | ) 16 | ++ 17 | ( 18 | with nixpkgs; 19 | [ 20 | ## things fail to build without these 21 | automake 22 | autoconf 23 | autoconf-archive 24 | pkg-config 25 | gnumake 26 | cmake 27 | libtool 28 | ctags 29 | gcc 30 | 31 | ## programming/sdks 32 | python312 33 | ruby_3_1 34 | nodejs_21 35 | yarn 36 | jdk 37 | rustup 38 | dotnet-sdk_7 39 | postgresql 40 | 41 | ## container/devops 42 | docker-buildx 43 | docker-credential-gcr 44 | docker-credential-helpers 45 | buildkit 46 | kubectx 47 | kubernetes-helm 48 | kind 49 | terraform 50 | vault 51 | buildpack 52 | google-cloud-sdk 53 | google-cloud-sql-proxy 54 | 55 | # others 56 | caddy 57 | norouter 58 | ] 59 | ) 60 | -------------------------------------------------------------------------------- /nix/.config/nixpkgs/config.nix: -------------------------------------------------------------------------------- 1 | { allowUnfree = true; } 2 | -------------------------------------------------------------------------------- /nix/.gitignore: -------------------------------------------------------------------------------- 1 | packages.nix 2 | flake.lock 3 | registry.json 4 | 5 | -------------------------------------------------------------------------------- /obsidian/slides.css: -------------------------------------------------------------------------------- 1 | 2 | /* left-align all content in Slides */ 3 | .reveal .slides { 4 | text-align: left; 5 | } 6 | -------------------------------------------------------------------------------- /others/xmodmap/chromebook/Xmodmap: -------------------------------------------------------------------------------- 1 | clear control 2 | clear mod1 3 | keycode 37 = Alt_L Meta_L 4 | keycode 64 = Control_L 5 | add control = Control_L Control_R 6 | add mod1 = Alt_L Meta_L 7 | 8 | -------------------------------------------------------------------------------- /others/xmodmap/magic-keyboard/Xmodmap: -------------------------------------------------------------------------------- 1 | remove mod4 = Super_L 2 | add control = Super_L 3 | remove control = Control_L 4 | add mod4 = Control_L 5 | 6 | -------------------------------------------------------------------------------- /others/xrandr/home.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | xrandr --fb 7852x2880 4 | xrandr --output DP-1-1 --scale-from 5120x2880 5 | xrandr --output eDP-1-1 --scale-from 2732x1536 --pos 5120x0 6 | gsettings set org.gnome.desktop.interface scaling-factor 2 7 | 8 | # xrandr --output eDP-1-1 --scale-from 3840x2160 9 | # double the resolution you want it to be on low dpi display 10 | # then go back to display setting and set hidpi to 200% 11 | # e.g. xrandr --output eDP-1-1 --scale-from 2732x1536 12 | 13 | 14 | # xrandr \ 15 | # --output DP-1-1 --auto --pos 0x0 \ 16 | # --output eDP-1-1 --auto --panning 3840x2160+3840+0 --right-of DP-1-1 17 | 18 | # --dpi 192 --fb 5762x4920 \ 19 | # --mode 3840x2160 20 | # --pos 3840x0 21 | 22 | 23 | -------------------------------------------------------------------------------- /screenshots/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abiosoft/dotfiles/ec7ad2f58aaeeed31949685e536c6b7418c6cc6a/screenshots/screenshot.png -------------------------------------------------------------------------------- /tmux/.config/tmux/tmux.conf: -------------------------------------------------------------------------------- 1 | # set term color 2 | set -g default-terminal "screen-256color" 3 | 4 | # remove status color 5 | # set -g status-bg default 6 | # set -g status-fg default 7 | set -g status-style bg="#3d3f43",fg="#c5c8c6" 8 | # set -g status-style bg=default,fg=default 9 | # set -g pane-active-border-style fg="#888888" 10 | set -g pane-border-style fg="#555555" 11 | set -g pane-active-border-style fg="#aaaaaa" 12 | 13 | # ergonomic keyboard, C-n is more comfortable for me 14 | set-option -g prefix2 C-n 15 | 16 | # move status to top 17 | # set-option -g status-position top 18 | 19 | # default shell 20 | set -g default-shell ~/bin/myzsh 21 | 22 | # enable keyboard shortcuts in vim 23 | setw -g xterm-keys on 24 | 25 | # reduce escape time 26 | set -sg escape-time 20 27 | 28 | # enable mouse 29 | set -g mouse on 30 | # disable right-click 31 | unbind -n MouseDown3Pane 32 | 33 | # use vi navigation 34 | setw -g mode-keys vi 35 | bind h select-pane -L 36 | bind j select-pane -D 37 | bind k select-pane -U 38 | bind l select-pane -R 39 | 40 | # custom switcher 41 | bind s run-shell "~/dotfiles/bin/switch.sh" 42 | bind w run-shell "~/dotfiles/bin/switch-win.sh" 43 | bind r send-keys -t 1 r enter 44 | 45 | # custom status 46 | set -g status-right "%I:%M %p %d %b | #(hostname) " 47 | 48 | # enable copy in tmux session 49 | set -g set-clipboard on 50 | 51 | # Color key: 52 | # #1d1f21 Background 53 | # #282a2e Current Line 54 | # #373b41 Selection 55 | # #c5c8c6 Foreground 56 | # #969896 Comment 57 | # #cc6666 Red 58 | # #de935f Orange 59 | # #f0c674 Yellow 60 | # #b5bd68 Green 61 | # #8abeb7 Aqua 62 | # #81a2be Blue 63 | # #b294bb Purple 64 | -------------------------------------------------------------------------------- /vscode/.vscode/keybindings-linux.json: -------------------------------------------------------------------------------- 1 | // Place your key bindings in this file to override the defaultsauto[] 2 | [ 3 | { 4 | "key": "ctrl+p", 5 | "command": "-extension.vim_ctrl+p", 6 | "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl || vim.active && vim.use && !inDebugRepl && vim.mode == 'CommandlineInProgress' || vim.active && vim.use && !inDebugRepl && vim.mode == 'SearchInProgressMode'" 7 | }, 8 | { 9 | "key": "ctrl+n", 10 | "command": "-extension.vim_ctrl+n", 11 | "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl || vim.active && vim.use && !inDebugRepl && vim.mode == 'CommandlineInProgress' || vim.active && vim.use && !inDebugRepl && vim.mode == 'SearchInProgressMode'" 12 | }, 13 | { 14 | "key": "ctrl+f", 15 | "command": "-extension.vim_ctrl+f", 16 | "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl && vim.mode != 'Insert'" 17 | }, 18 | { 19 | "command": "cursorPageDown", 20 | "key": "ctrl+d", 21 | "when": "editorTextFocus" 22 | }, 23 | { 24 | "command": "cursorPageUp", 25 | "key": "ctrl+u", 26 | "when": "editorTextFocus" 27 | }, 28 | { 29 | "command": "workbench.action.navigateBack", 30 | "key": "ctrl+o", 31 | "when": "editorTextFocus" 32 | }, 33 | { 34 | "key": "ctrl+j", 35 | "command": "cursorDown", 36 | "when": "textInputFocus" 37 | }, 38 | { 39 | "key": "ctrl+k", 40 | "command": "cursorUp", 41 | "when": "textInputFocus" 42 | }, 43 | { 44 | "key": "ctrl+k", 45 | "command": "-workbench.action.terminal.clear", 46 | "when": "terminalFocus && terminalProcessSupported" 47 | }, 48 | { 49 | "key": "ctrl+j", 50 | "command": "-workbench.action.togglePanel" 51 | }, 52 | { 53 | "key": "ctrl+j", 54 | "command": "selectNextSuggestion", 55 | "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" 56 | }, 57 | { 58 | "key": "shift+ctrl+c", 59 | "command": "workbench.action.terminal.copySelection", 60 | "when": "terminalFocus && terminalProcessSupported" 61 | }, 62 | { 63 | "key": "shift+ctrl+v", 64 | "command": "workbench.action.terminal.paste", 65 | "when": "terminalFocus && terminalProcessSupported" 66 | }, 67 | { 68 | "key": "ctrl+c", 69 | "command": "-workbench.action.terminal.copy", 70 | "when": "terminalFocus && terminalProcessSupported" 71 | }, 72 | { 73 | "key": "ctrl+c", 74 | "command": "workbench.action.terminal.sendSequence", 75 | "args": { 76 | "text": "\u0003" 77 | }, 78 | "when": "terminalFocus && terminalProcessSupported" 79 | }, 80 | { 81 | "key": "ctrl+d", 82 | "command": "workbench.action.terminal.sendSequence", 83 | "args": { 84 | "text": "\u0004" 85 | }, 86 | "when": "terminalFocus && terminalProcessSupported" 87 | }, 88 | { 89 | "key": "ctrl+a", 90 | "command": "-workbench.action.terminal.selectAll", 91 | "when": "terminalFocus && terminalProcessSupported" 92 | }, 93 | { 94 | "key": "ctrl+a", 95 | "command": "workbench.action.terminal.sendSequence", 96 | "args": { 97 | "text": "\u0001" 98 | }, 99 | "when": "terminalFocus && terminalProcessSupported" 100 | }, 101 | { 102 | "key": "ctrl+e", 103 | "command": "workbench.action.terminal.sendSequence", 104 | "args": { 105 | "text": "\u0005" 106 | }, 107 | "when": "terminalFocus && terminalProcessSupported" 108 | }, 109 | { 110 | "key": "ctrl+l", 111 | "command": "workbench.action.terminal.sendSequence", 112 | "args": { 113 | "text": "\u000c" 114 | }, 115 | "when": "terminalFocus && terminalProcessSupported" 116 | }, 117 | { 118 | "key": "ctrl+r", 119 | "command": "workbench.action.terminal.sendSequence", 120 | "args": { 121 | "text": "\u0012" 122 | }, 123 | "when": "terminalFocus && terminalProcessSupported" 124 | }, 125 | { 126 | "key": "ctrl+s", 127 | "command": "workbench.action.terminal.sendSequence", 128 | "args": { 129 | "text": "\u0013" 130 | }, 131 | "when": "terminalFocus && terminalProcessSupported" 132 | }, 133 | { 134 | "key": "ctrl+k", 135 | "command": "selectPrevSuggestion", 136 | "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" 137 | } 138 | ] 139 | 140 | -------------------------------------------------------------------------------- /vscode/.vscode/keybindings.json: -------------------------------------------------------------------------------- 1 | // Place your key bindings in this file to override the defaultsauto[] 2 | [ 3 | { 4 | "command": "cursorPageDown", 5 | "key": "cmd+d", 6 | "when": "editorTextFocus" 7 | }, 8 | { 9 | "command": "cursorPageUp", 10 | "key": "cmd+u", 11 | "when": "editorTextFocus" 12 | }, 13 | { 14 | "command": "workbench.action.navigateBack", 15 | "key": "cmd+o", 16 | "when": "editorTextFocus" 17 | }, 18 | { 19 | "key": "cmd+j", 20 | "command": "cursorDown", 21 | "when": "textInputFocus" 22 | }, 23 | { 24 | "key": "cmd+k", 25 | "command": "cursorUp", 26 | "when": "textInputFocus" 27 | }, 28 | { 29 | "key": "cmd+k", 30 | "command": "-workbench.action.terminal.clear", 31 | "when": "terminalFocus && terminalProcessSupported" 32 | }, 33 | { 34 | "key": "cmd+j", 35 | "command": "-workbench.action.togglePanel" 36 | }, 37 | { 38 | "key": "cmd+j", 39 | "command": "selectNextSuggestion", 40 | "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" 41 | }, 42 | { 43 | "key": "shift+cmd+c", 44 | "command": "workbench.action.terminal.copySelection", 45 | "when": "terminalFocus && terminalProcessSupported" 46 | }, 47 | { 48 | "key": "shift+cmd+v", 49 | "command": "workbench.action.terminal.paste", 50 | "when": "terminalFocus && terminalProcessSupported" 51 | }, 52 | { 53 | "key": "cmd+c", 54 | "command": "-workbench.action.terminal.copy", 55 | "when": "terminalFocus && terminalProcessSupported" 56 | }, 57 | { 58 | "key": "cmd+c", 59 | "command": "workbench.action.terminal.sendSequence", 60 | "args": { 61 | "text": "\u0003" 62 | }, 63 | "when": "terminalFocus && terminalProcessSupported" 64 | }, 65 | { 66 | "key": "cmd+d", 67 | "command": "workbench.action.terminal.sendSequence", 68 | "args": { 69 | "text": "\u0004" 70 | }, 71 | "when": "terminalFocus && terminalProcessSupported" 72 | }, 73 | { 74 | "key": "cmd+a", 75 | "command": "-workbench.action.terminal.selectAll", 76 | "when": "terminalFocus && terminalProcessSupported" 77 | }, 78 | { 79 | "key": "cmd+a", 80 | "command": "workbench.action.terminal.sendSequence", 81 | "args": { 82 | "text": "\u0001" 83 | }, 84 | "when": "terminalFocus && terminalProcessSupported" 85 | }, 86 | { 87 | "key": "cmd+e", 88 | "command": "workbench.action.terminal.sendSequence", 89 | "args": { 90 | "text": "\u0005" 91 | }, 92 | "when": "terminalFocus && terminalProcessSupported" 93 | }, 94 | { 95 | "key": "cmd+l", 96 | "command": "workbench.action.terminal.sendSequence", 97 | "args": { 98 | "text": "\u000c" 99 | }, 100 | "when": "terminalFocus && terminalProcessSupported" 101 | }, 102 | { 103 | "key": "cmd+r", 104 | "command": "workbench.action.terminal.sendSequence", 105 | "args": { 106 | "text": "\u0012" 107 | }, 108 | "when": "terminalFocus && terminalProcessSupported" 109 | }, 110 | { 111 | "key": "cmd+s", 112 | "command": "workbench.action.terminal.sendSequence", 113 | "args": { 114 | "text": "\u0013" 115 | }, 116 | "when": "terminalFocus && terminalProcessSupported" 117 | }, 118 | { 119 | "key": "cmd+k", 120 | "command": "selectPrevSuggestion", 121 | "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" 122 | } 123 | ] -------------------------------------------------------------------------------- /vscode/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "window.autoDetectColorScheme": true, 3 | "window.customTitleBarVisibility": "never", 4 | "workbench.preferredDarkColorTheme": "Default Dark Modern", 5 | "workbench.preferredLightColorTheme": "Default Light Modern", 6 | "editor.fontFamily": "JetBrains Mono", 7 | "editor.fontSize": 15, 8 | "editor.fontWeight": "400", 9 | "terminal.integrated.fontSize": 15, 10 | "terminal.integrated.fontWeight": "400", 11 | "scm.inputFontFamily": "JetBrains Mono", 12 | "debug.console.fontFamily": "JetBrains Mono", 13 | "terminal.integrated.fontFamily": "JetBrains Mono", 14 | "debug.console.fontSize": 15, 15 | "editor.cursorBlinking": "solid", 16 | "editor.fontLigatures": true, 17 | "editor.minimap.enabled": false, 18 | "editor.formatOnSave": true, 19 | "editor.bracketPairColorization.enabled": false, 20 | "editor.inlayHints.enabled": "on", 21 | "editor.semanticTokenColorCustomizations": { 22 | "enabled": true, 23 | "rules": { 24 | "*": { 25 | "bold": false, 26 | }, 27 | "modifier": { 28 | "bold": true, 29 | }, 30 | "keyword": { 31 | "bold": true, 32 | }, 33 | "*.static": { 34 | "bold": true, 35 | }, 36 | }, 37 | }, 38 | "editor.codeActionsOnSave": { 39 | "source.fixAll.tslint": true, 40 | "source.fixAll.eslint": true 41 | }, 42 | "workbench.colorCustomizations": { 43 | "[Default Light Modern]": { 44 | "editor.background": "#f5f5f5", 45 | "activityBar.inactiveForeground": "#333333", 46 | "activityBar.foreground": "#111111", 47 | "activityBar.activeBorder": "#111111", 48 | "sideBar.background": "#f5f5f5", 49 | "terminal.background": "#f5f5f5", 50 | }, 51 | }, 52 | "go.useLanguageServer": true, 53 | "terminal.integrated.fontWeightBold": "normal", 54 | "vsicons.dontShowNewVersionMessage": true, 55 | "workbench.editor.showTabs": true, 56 | "go.addTags": { 57 | "tags": "json", 58 | "options": "json=omitempty", 59 | "promptForTags": true, 60 | "transform": "snakecase" 61 | }, 62 | "debug.allowBreakpointsEverywhere": true, 63 | "yaml.completion": true, 64 | "yaml.hover": true, 65 | "[yaml]": { 66 | "editor.fontLigatures": true, 67 | "editor.defaultFormatter": "redhat.vscode-yaml" 68 | }, 69 | "diffEditor.ignoreTrimWhitespace": false, 70 | "[javascript]": { 71 | "editor.defaultFormatter": "esbenp.prettier-vscode" 72 | }, 73 | "[jsonc]": { 74 | "editor.defaultFormatter": "vscode.json-language-features" 75 | }, 76 | "go.toolsManagement.checkForUpdates": "off", 77 | "codespaces.accountProvider": "GitHub", 78 | "go.delveConfig": { 79 | "dlvLoadConfig": { 80 | "followPointers": true, 81 | "maxVariableRecurse": 1, 82 | "maxStringLen": 1000, 83 | "maxArrayValues": 64, 84 | "maxStructFields": -1 85 | }, 86 | "apiVersion": 2, 87 | "showGlobalVariables": false 88 | }, 89 | "[json]": { 90 | "editor.defaultFormatter": "vscode.json-language-features" 91 | }, 92 | "window.nativeTabs": true, 93 | "[html]": { 94 | "editor.defaultFormatter": "vscode.html-language-features" 95 | }, 96 | "[css]": { 97 | "editor.defaultFormatter": "vscode.css-language-features" 98 | }, 99 | "editor.lineNumbers": "relative", 100 | "[caddyfile]": { 101 | "editor.insertSpaces": true, 102 | "editor.formatOnSave": true 103 | }, 104 | "telemetry.telemetryLevel": "off", 105 | "window.title": "${rootName}${separator}${activeEditorShort}", 106 | "vim.leader": ",", 107 | "vim.insertModeKeyBindings": [ 108 | { 109 | "before": [ 110 | "j", 111 | "j" 112 | ], 113 | "after": [ 114 | "" 115 | ] 116 | } 117 | ], 118 | "vim.visualModeKeyBindings": [ 119 | { 120 | "before": [ 121 | "", 122 | "c", 123 | "c" 124 | ], 125 | "commands": [ 126 | { 127 | "command": "editor.action.commentLine", 128 | "args": [] 129 | } 130 | ] 131 | } 132 | ], 133 | "vim.normalModeKeyBindings": [ 134 | { 135 | "before": [ 136 | "", 137 | "c", 138 | "c" 139 | ], 140 | "commands": [ 141 | { 142 | "command": "editor.action.commentLine", 143 | "args": [] 144 | } 145 | ] 146 | }, 147 | { 148 | "before": [ 149 | "K" 150 | ], 151 | "commands": [ 152 | { 153 | "command": "editor.action.showHover", 154 | "args": [] 155 | } 156 | ] 157 | }, 158 | { 159 | "before": [ 160 | "g", 161 | "d" 162 | ], 163 | "commands": [ 164 | { 165 | "command": "editor.action.goToDeclaration", 166 | "args": [] 167 | } 168 | ] 169 | }, 170 | { 171 | "before": [ 172 | "g", 173 | "f" 174 | ], 175 | "commands": [ 176 | { 177 | "command": "editor.action.navigateBack", 178 | "args": [] 179 | } 180 | ] 181 | } 182 | ], 183 | "vim.useSystemClipboard": true, 184 | "terminal.integrated.tabs.enabled": true, 185 | "terminal.integrated.copyOnSelection": true, 186 | "csharp.referencesCodeLens.enabled": false, 187 | "docker.containers.label": "ContainerName", 188 | "editor.suggestSelection": "first", 189 | "files.exclude": { 190 | "**/.classpath": true, 191 | "**/.project": true, 192 | "**/.settings": true, 193 | "**/.factorypath": true 194 | }, 195 | "redhat.telemetry.enabled": false, 196 | "[xml]": { 197 | "editor.defaultFormatter": "redhat.vscode-xml", 198 | "editor.formatOnSave": false 199 | }, 200 | "terminal.integrated.defaultProfile.osx": "zsh", 201 | "terminal.integrated.defaultProfile.linux": "zsh", 202 | "[dockerfile]": { 203 | "editor.defaultFormatter": "ms-azuretools.vscode-docker" 204 | }, 205 | "terminal.integrated.persistentSessionReviveProcess": "never", 206 | "window.titleBarStyle": "custom", 207 | "[dockercompose]": { 208 | "editor.defaultFormatter": "esbenp.prettier-vscode" 209 | }, 210 | "workbench.editorAssociations": { 211 | "*.md": "default" 212 | }, 213 | "workbench.iconTheme": "vscode-icons", 214 | "svelte.enable-ts-plugin": true, 215 | "[markdown]": { 216 | "editor.defaultFormatter": "yzhang.markdown-all-in-one" 217 | }, 218 | "[ruby]": { 219 | "editor.defaultFormatter": "rebornix.ruby", 220 | "editor.formatOnType": true, 221 | "editor.tabSize": 2, 222 | "editor.insertSpaces": true, 223 | "editor.semanticHighlighting.enabled": true, 224 | "editor.formatOnSave": true 225 | }, 226 | "files.trimTrailingWhitespace": true, 227 | "files.insertFinalNewline": true, 228 | "editor.rulers": [ 229 | 120 230 | ], 231 | "editor.wordWrap": "off", 232 | "workbench.colorTheme": "Default Dark+ Experimental", 233 | "workbench.startupEditor": "none", 234 | "git.alwaysSignOff": false, 235 | "editor.renderWhitespace": "boundary", 236 | "svelte.plugin.svelte.compilerWarnings": { 237 | "a11y-click-events-have-key-events": "ignore", 238 | "a11y-aria-attributes": "ignore", 239 | "a11y-incorrect-aria-attribute-type": "ignore", 240 | "a11y-unknown-aria-attribute": "ignore", 241 | "a11y-hidden": "ignore", 242 | "a11y-misplaced-role": "ignore", 243 | "a11y-unknown-role": "ignore", 244 | "a11y-no-abstract-role": "ignore", 245 | "a11y-no-static-element-interactions": "ignore", 246 | "a11y-no-redundant-roles": "ignore", 247 | "a11y-role-has-required-aria-props": "ignore", 248 | "a11y-accesskey": "ignore", 249 | "a11y-autofocus": "ignore", 250 | "a11y-misplaced-scope": "ignore", 251 | "a11y-positive-tabindex": "ignore", 252 | "a11y-invalid-attribute": "ignore", 253 | "a11y-missing-attribute": "ignore", 254 | "a11y-img-redundant-alt": "ignore", 255 | "a11y-label-has-associated-control": "ignore", 256 | "a11y-media-has-caption": "ignore", 257 | "a11y-distracting-elements": "ignore", 258 | "a11y-structure": "ignore", 259 | "a11y-mouse-events-have-key-events": "ignore", 260 | "a11y-missing-content": "ignore" 261 | } 262 | } 263 | -------------------------------------------------------------------------------- /zsh/.config/my-zsh/completions/_incus: -------------------------------------------------------------------------------- 1 | #compdef incus 2 | compdef _incus incus 3 | 4 | # zsh completion for incus -*- shell-script -*- 5 | 6 | __incus_debug() 7 | { 8 | local file="$BASH_COMP_DEBUG_FILE" 9 | if [[ -n ${file} ]]; then 10 | echo "$*" >> "${file}" 11 | fi 12 | } 13 | 14 | _incus() 15 | { 16 | local shellCompDirectiveError=1 17 | local shellCompDirectiveNoSpace=2 18 | local shellCompDirectiveNoFileComp=4 19 | local shellCompDirectiveFilterFileExt=8 20 | local shellCompDirectiveFilterDirs=16 21 | local shellCompDirectiveKeepOrder=32 22 | 23 | local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder 24 | local -a completions 25 | 26 | __incus_debug "\n========= starting completion logic ==========" 27 | __incus_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" 28 | 29 | # The user could have moved the cursor backwards on the command-line. 30 | # We need to trigger completion from the $CURRENT location, so we need 31 | # to truncate the command-line ($words) up to the $CURRENT location. 32 | # (We cannot use $CURSOR as its value does not work when a command is an alias.) 33 | words=("${=words[1,CURRENT]}") 34 | __incus_debug "Truncated words[*]: ${words[*]}," 35 | 36 | lastParam=${words[-1]} 37 | lastChar=${lastParam[-1]} 38 | __incus_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" 39 | 40 | # For zsh, when completing a flag with an = (e.g., incus -n=) 41 | # completions must be prefixed with the flag 42 | setopt local_options BASH_REMATCH 43 | if [[ "${lastParam}" =~ '-.*=' ]]; then 44 | # We are dealing with a flag with an = 45 | flagPrefix="-P ${BASH_REMATCH}" 46 | fi 47 | 48 | # Prepare the command to obtain completions 49 | requestComp="${words[1]} __complete ${words[2,-1]}" 50 | if [ "${lastChar}" = "" ]; then 51 | # If the last parameter is complete (there is a space following it) 52 | # We add an extra empty parameter so we can indicate this to the go completion code. 53 | __incus_debug "Adding extra empty parameter" 54 | requestComp="${requestComp} \"\"" 55 | fi 56 | 57 | __incus_debug "About to call: eval ${requestComp}" 58 | 59 | # Use eval to handle any environment variables and such 60 | out=$(eval ${requestComp} 2>/dev/null) 61 | __incus_debug "completion output: ${out}" 62 | 63 | # Extract the directive integer following a : from the last line 64 | local lastLine 65 | while IFS='\n' read -r line; do 66 | lastLine=${line} 67 | done < <(printf "%s\n" "${out[@]}") 68 | __incus_debug "last line: ${lastLine}" 69 | 70 | if [ "${lastLine[1]}" = : ]; then 71 | directive=${lastLine[2,-1]} 72 | # Remove the directive including the : and the newline 73 | local suffix 74 | (( suffix=${#lastLine}+2)) 75 | out=${out[1,-$suffix]} 76 | else 77 | # There is no directive specified. Leave $out as is. 78 | __incus_debug "No directive found. Setting do default" 79 | directive=0 80 | fi 81 | 82 | __incus_debug "directive: ${directive}" 83 | __incus_debug "completions: ${out}" 84 | __incus_debug "flagPrefix: ${flagPrefix}" 85 | 86 | if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then 87 | __incus_debug "Completion received error. Ignoring completions." 88 | return 89 | fi 90 | 91 | local activeHelpMarker="_activeHelp_ " 92 | local endIndex=${#activeHelpMarker} 93 | local startIndex=$((${#activeHelpMarker}+1)) 94 | local hasActiveHelp=0 95 | while IFS='\n' read -r comp; do 96 | # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) 97 | if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then 98 | __incus_debug "ActiveHelp found: $comp" 99 | comp="${comp[$startIndex,-1]}" 100 | if [ -n "$comp" ]; then 101 | compadd -x "${comp}" 102 | __incus_debug "ActiveHelp will need delimiter" 103 | hasActiveHelp=1 104 | fi 105 | 106 | continue 107 | fi 108 | 109 | if [ -n "$comp" ]; then 110 | # If requested, completions are returned with a description. 111 | # The description is preceded by a TAB character. 112 | # For zsh's _describe, we need to use a : instead of a TAB. 113 | # We first need to escape any : as part of the completion itself. 114 | comp=${comp//:/\\:} 115 | 116 | local tab="$(printf '\t')" 117 | comp=${comp//$tab/:} 118 | 119 | __incus_debug "Adding completion: ${comp}" 120 | completions+=${comp} 121 | lastComp=$comp 122 | fi 123 | done < <(printf "%s\n" "${out[@]}") 124 | 125 | # Add a delimiter after the activeHelp statements, but only if: 126 | # - there are completions following the activeHelp statements, or 127 | # - file completion will be performed (so there will be choices after the activeHelp) 128 | if [ $hasActiveHelp -eq 1 ]; then 129 | if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then 130 | __incus_debug "Adding activeHelp delimiter" 131 | compadd -x "--" 132 | hasActiveHelp=0 133 | fi 134 | fi 135 | 136 | if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then 137 | __incus_debug "Activating nospace." 138 | noSpace="-S ''" 139 | fi 140 | 141 | if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then 142 | __incus_debug "Activating keep order." 143 | keepOrder="-V" 144 | fi 145 | 146 | if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then 147 | # File extension filtering 148 | local filteringCmd 149 | filteringCmd='_files' 150 | for filter in ${completions[@]}; do 151 | if [ ${filter[1]} != '*' ]; then 152 | # zsh requires a glob pattern to do file filtering 153 | filter="\*.$filter" 154 | fi 155 | filteringCmd+=" -g $filter" 156 | done 157 | filteringCmd+=" ${flagPrefix}" 158 | 159 | __incus_debug "File filtering command: $filteringCmd" 160 | _arguments '*:filename:'"$filteringCmd" 161 | elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then 162 | # File completion for directories only 163 | local subdir 164 | subdir="${completions[1]}" 165 | if [ -n "$subdir" ]; then 166 | __incus_debug "Listing directories in $subdir" 167 | pushd "${subdir}" >/dev/null 2>&1 168 | else 169 | __incus_debug "Listing directories in ." 170 | fi 171 | 172 | local result 173 | _arguments '*:dirname:_files -/'" ${flagPrefix}" 174 | result=$? 175 | if [ -n "$subdir" ]; then 176 | popd >/dev/null 2>&1 177 | fi 178 | return $result 179 | else 180 | __incus_debug "Calling _describe" 181 | if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then 182 | __incus_debug "_describe found some completions" 183 | 184 | # Return the success of having called _describe 185 | return 0 186 | else 187 | __incus_debug "_describe did not find completions." 188 | __incus_debug "Checking if we should do file completion." 189 | if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then 190 | __incus_debug "deactivating file completion" 191 | 192 | # We must return an error code here to let zsh know that there were no 193 | # completions found by _describe; this is what will trigger other 194 | # matching algorithms to attempt to find completions. 195 | # For example zsh can match letters in the middle of words. 196 | return 1 197 | else 198 | # Perform file completion 199 | __incus_debug "Activating file completion" 200 | 201 | # We must return the result of this command, so it must be the 202 | # last command, or else we must store its result to return it. 203 | _arguments '*:filename:_files'" ${flagPrefix}" 204 | fi 205 | fi 206 | fi 207 | } 208 | 209 | # don't run the completion function when being source-ed or eval-ed 210 | if [ "$funcstack[1]" = "_incus" ]; then 211 | _incus 212 | fi 213 | -------------------------------------------------------------------------------- /zsh/.config/my-zsh/themes/abiola.zsh-theme: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # ------------------------------------------------------------------------------ 4 | # 5 | # Pure - A minimal and beautiful theme for oh-my-zsh 6 | # 7 | # Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge 8 | # thanks goes out to him for designing the fantastic Pure prompt in the first 9 | # place! I'd also like to thank Julien Nicoulaud for his "nicoulaj" theme from 10 | # which I've borrowed both some ideas and some actual code. You can find out 11 | # more about both of these fantastic two people here: 12 | # 13 | # Sindre Sorhus 14 | # Github: https://github.com/sindresorhus 15 | # Twitter: https://twitter.com/sindresorhus 16 | # 17 | # Julien Nicoulaud 18 | # Github: https://github.com/nicoulaj 19 | # Twitter: https://twitter.com/nicoulaj 20 | # 21 | # ------------------------------------------------------------------------------ 22 | 23 | # Set required options 24 | # 25 | setopt prompt_subst 26 | 27 | # Load required modules 28 | # 29 | autoload -Uz vcs_info 30 | 31 | # Set vcs_info parameters 32 | # 33 | zstyle ':vcs_info:*' enable hg bzr git 34 | zstyle ':vcs_info:*:*' unstagedstr '!' 35 | zstyle ':vcs_info:*:*' stagedstr '+' 36 | zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%b" "%%u%c" 37 | zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%b" "%u%c (%a)" 38 | # zstyle ':vcs_info:*:*' nvcsformats "%c" "" "" 39 | zstyle ':vcs_info:*:*' nvcsformats "%~" "" "" 40 | 41 | # Fastest possible way to check if repo is dirty 42 | # 43 | git_dirty() { 44 | # Check if we're in a git repo 45 | command git rev-parse --is-inside-work-tree &>/dev/null || return 46 | # Check if it's dirty 47 | command git diff --quiet --ignore-submodules HEAD &>/dev/null 48 | [ $? -eq 1 ] && echo "*" 49 | } 50 | 51 | # Display information about the current repository 52 | # 53 | repo_information() { 54 | git_info="%F{$(color)}${vcs_info_msg_0_%%/.} %F{$(color)}$vcs_info_msg_1_$(git_dirty) $vcs_info_msg_3_%f" 55 | info=$(echo $git_info) 56 | if [ "$vcs_info_msg_1_" = "" ]; then 57 | echo "%~" 58 | else 59 | echo "${info}%~" 60 | fi 61 | } 62 | 63 | # Displays the exec time of the last command if set threshold was exceeded 64 | # 65 | cmd_exec_time() { 66 | local stop=$(date +%s) 67 | local start=${cmd_timestamp:-$stop} 68 | let local elapsed=$stop-$start 69 | [ $elapsed -gt 5 ] && echo ${elapsed}s 70 | } 71 | 72 | # Get the intial timestamp for cmd_exec_time 73 | # 74 | preexec() { 75 | cmd_timestamp=$(date +%s) 76 | } 77 | 78 | print_host() { 79 | # [ "$(hostname)" != "localhost" ] && echo "[$(hostname)] " 80 | } 81 | 82 | print_nix() { 83 | [ -n "$IN_NIX_SHELL" ] && echo "[nix-shell] " 84 | } 85 | 86 | # Output additional information about paths, repos and exec time 87 | # 88 | precmd() { 89 | vcs_info # Get version control info before we start outputting stuff 90 | print -P "\n$(print_host)$(print_nix)$(repo_information) %F{yellow}$(cmd_exec_time)%f" 91 | } 92 | 93 | # gnome builder terminal hack 94 | color() { 95 | if [ -z "$INSIDE_EMACS" ]; then 96 | echo "white" 97 | else 98 | echo "white" 99 | fi 100 | } 101 | 102 | # Define prompts 103 | # 104 | PROMPT="%(?.%F{$(color)}.%F{red})$%f " # Display a red prompt char on failure 105 | #PROMPT="`cprp`❯ " # Display a red prompt char on failure 106 | RPROMPT="%F{$(color)}${SSH_TTY:+%n@%m}%f" # Display username if connected via SSH 107 | 108 | # ------------------------------------------------------------------------------ 109 | # 110 | # List of vcs_info format strings: 111 | # 112 | # %b => current branch 113 | # %a => current action (rebase/merge) 114 | # %s => current version control system 115 | # %r => name of the root directory of the repository 116 | # %S => current path relative to the repository root directory 117 | # %m => in case of Git, show information about stashes 118 | # %u => show unstaged changes in the repository 119 | # %c => show staged changes in the repository 120 | # 121 | # List of prompt format strings: 122 | # 123 | # prompt: 124 | # %F => color dict 125 | # %f => reset color 126 | # %~ => current path 127 | # %* => time 128 | # %n => username 129 | # %m => shortname host 130 | # %(?..) => prompt conditional - %(condition.true.false) 131 | # 132 | # ------------------------------------------------------------------------------ 133 | -------------------------------------------------------------------------------- /zsh/.zshrc: -------------------------------------------------------------------------------- 1 | # ZSH 2 | if [ -z "$HOMEBREW_PREFIX" ]; then 3 | export ZSH="$HOME/.nix-profile/share/oh-my-zsh" 4 | else 5 | export ZSH="$HOME/.oh-my-zsh" 6 | export HOMEBREW_NO_AUTO_UPDATE=1 7 | fi 8 | 9 | ZSH_CUSTOM="$HOME/.config/my-zsh" 10 | ZSH_THEME="abiola" 11 | CASE_SENSITIVE="true" 12 | 13 | plugins=( 14 | git 15 | command-not-found 16 | docker 17 | docker-compose 18 | kubectl 19 | ) 20 | 21 | [ -f $ZSH/oh-my-zsh.sh ] && source $ZSH/oh-my-zsh.sh 22 | 23 | # personal scripts 24 | export PATH="$PATH:$HOME/bin" 25 | 26 | # aliases 27 | alias vim='nvim' 28 | alias krun='kubectl run --namespace default --restart=Never -it --rm tmpbox --image' 29 | alias brew-switch='brew bundle install -v --cleanup --file ~/.config/brew/Brewfile' 30 | alias nix-switch='DRV="$(nix build path:$HOME/dotfiles/nix/.config/nix/ --print-out-paths --no-link)" && nix profile remove --all 2>/dev/null && nix profile install "$DRV"' 31 | alias colima-shell='nix-shell -p $(nix-build ~/projects/golang/colima)' 32 | alias hugo-new='hugo new content "content/posts/$(date +%s)_newpost.md"' 33 | 34 | # git commit editor 35 | export VISUAL=nvim 36 | export EDITOR="$VISUAL" 37 | 38 | # GO 39 | export PATH="$PATH:/usr/local/go/bin:$HOME/go/bin:$HOME/dotfiles/bin" 40 | 41 | # Rust 42 | export PATH="$PATH:$HOME/.cargo/bin" 43 | 44 | # dotNet 45 | export DOTNET_ROOT="$HOME/.dotnet" 46 | if [ -z "$HOMEBREW_PREFIX" ]; then 47 | [ -f $HOME/.nix-profile/bin/dotnet ] && export DOTNET_ROOT="$(dirname $(realpath $HOME/.nix-profile/bin/dotnet))" 48 | else 49 | export DOTNET_ROOT="$HOMEBREW_PREFIX/opt/dotnet/libexec" 50 | fi 51 | export PATH="$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools" 52 | 53 | # fzf 54 | [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh 55 | 56 | # use python 3 by default 57 | alias python='python3' 58 | 59 | # gpg 60 | export GPG_TTY=$(tty) 61 | 62 | # bat 63 | alias cat='bat' 64 | export BAT_THEME="tomorrow-night" 65 | export PAGER="bat" 66 | 67 | # nix shell 68 | if echo $PATH | grep -q "/nix/store"; then 69 | export IN_NIX_SHELL="true" 70 | fi 71 | 72 | # mac VMs 73 | if uname -a | grep VMAPPLE >/dev/null; then 74 | export DOCKER_HOST="ssh://colima" 75 | fi 76 | --------------------------------------------------------------------------------