├── .addpath ├── .aliases ├── .bash_aliases ├── .config ├── aerc │ ├── aerc.conf │ ├── binds.conf │ └── styles │ │ ├── custom │ │ └── default ├── amfora │ └── config.toml ├── doom │ ├── config.org │ ├── init.el │ └── packages.el ├── elinks │ └── elinks.conf ├── emacs │ ├── README.org │ ├── dotslash-lisp │ │ └── README │ ├── dotslash-modules │ │ ├── README │ │ ├── init-highlight.el │ │ └── packages.el │ ├── early-init.el │ ├── init.el │ ├── init.org │ └── packages.org ├── fish │ ├── config.fish │ ├── functions │ │ ├── cat.fish │ │ ├── condasetup.fish │ │ ├── fish_greeting.fish │ │ ├── fish_prompt.1673587505.copy │ │ ├── fish_prompt.fish │ │ ├── fish_right_prompt.fish │ │ ├── gitsimhis.fish │ │ ├── ll.fish │ │ ├── ls.fish │ │ ├── nvm.fish │ │ ├── omfpj.fish │ │ ├── ranger.fish │ │ ├── read_confirm.fish │ │ └── rm.fish │ └── themes │ │ └── mocha.theme ├── helix │ ├── config.toml │ ├── languages.toml │ └── themes │ │ └── custom_gh_contrast.toml ├── kitty │ ├── dracula.conf │ ├── kitty.conf │ ├── mac-font.conf │ └── mocha.conf ├── nushell │ ├── config.nu │ └── env.nu ├── nvim │ ├── README.norg │ ├── ftdetect │ │ ├── moon.lua │ │ ├── scd.lua │ │ └── slo.lua │ ├── ftplugin │ │ ├── go.lua │ │ ├── lua.lua │ │ ├── markdown.lua │ │ └── vim.lua │ ├── init.lua │ ├── lua │ │ ├── archive │ │ │ └── statusline.lua │ │ ├── config │ │ │ ├── autocmds.lua │ │ │ ├── general.lua │ │ │ └── mappings.lua │ │ ├── loadlazy.lua │ │ ├── plugins.lua │ │ └── plugins │ │ │ ├── autopair.lua │ │ │ ├── competitest.lua │ │ │ ├── complete.lua │ │ │ ├── dap.lua │ │ │ ├── ft.lua │ │ │ ├── icons.lua │ │ │ ├── incline.lua │ │ │ ├── linting.lua │ │ │ ├── lsp.lua │ │ │ ├── mini.lua │ │ │ ├── norg.lua │ │ │ ├── outline.lua │ │ │ ├── telescope.lua │ │ │ ├── treesitter.lua │ │ │ └── tundra.lua │ ├── snippets │ │ └── cpp.snippets │ └── templates │ │ └── skeleton.sh ├── omf │ ├── bundle │ ├── channel │ └── theme ├── senpai │ └── highlight ├── vimini │ └── config.toml └── yadm │ └── encrypt ├── .elinks └── elinks.conf ├── .emacs-profiles.el ├── .exportenvs ├── .gitconfig ├── .gitignore_global ├── .irbrc ├── .local └── share │ └── yadm │ └── archive ├── .qutebrowser └── config.py ├── .startup.sh ├── .tmux.conf ├── .tmux └── theme │ └── tmux.conf ├── .vimrc ├── .weechat └── .weerc ├── LICENSE ├── README.md ├── bin ├── 24bitcolor ├── awcolors ├── chmodoctal ├── dot ├── emacs-uri-handler.scpt ├── find-up ├── git-pullpr ├── gotagacme ├── gotagclean.py ├── gpg-upload ├── lbin ├── mvtmp ├── nv ├── pyhello ├── shltag ├── stupidrmdir └── wakatime ├── dotscripts ├── bin │ └── copy ├── convert │ └── addpath ├── gen │ ├── fish │ ├── localfiles │ └── nu ├── install │ ├── misc │ ├── nu │ ├── nvm │ ├── pash │ ├── pyenv │ └── yadm ├── maint │ └── doompkgs.sh └── setup │ ├── aerc │ ├── bash │ ├── emacs │ ├── fish │ ├── nu │ └── nvim └── iswsl.vim /.addpath: -------------------------------------------------------------------------------- 1 | .local/bin 2 | .doomemacs/bin 3 | local/src/pyenv/bin 4 | .luarocks/bin 5 | go/bin 6 | .nimble/bin 7 | .cargo/bin 8 | /$DENO_INSTALL/bin 9 | node_modules/.bin 10 | .local/share/pnpm 11 | /usr/local/go/bin 12 | /usr/local/sbin/ 13 | -------------------------------------------------------------------------------- /.aliases: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # In addition to this file being valid POSIX, all RHS of `=` must use single 4 | # quotes, and must be convertible to nu and fish (also see ~/dotscripts/gen/nu 5 | # and check ~/.aliases.nu) 6 | 7 | # Program aliases 8 | alias x=exit 9 | alias clr=clear 10 | alias y=yadm 11 | alias td=termdown 12 | alias bom=bombadillo 13 | alias syscu='systemctl --user' 14 | alias edoom='emacs --with-profile=doom' 15 | alias g=git 16 | alias acme='acme -f /mnt/font/FiraCode-Regular/15/font' 17 | alias la='ls -a' 18 | alias bat='bat --theme base16-256' 19 | alias emacs-clean='emacs -nw -Q --eval "(load-theme '\''modus-vivendi t)"' 20 | alias emacs-wombat='emacs -nw -Q --eval "(load-theme '\''wombat t)"' 21 | 22 | # Shortcuts 23 | alias apt-up='sudo apt update && sudo apt upgrade -y && sudo apt-get dist-upgrade -y && sudo apt autoremove' 24 | -------------------------------------------------------------------------------- /.bash_aliases: -------------------------------------------------------------------------------- 1 | /home/hedy/.aliases -------------------------------------------------------------------------------- /.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 | 8 | [messages] 9 | q = :quit 10 | 11 | j = :next 12 | = :next 13 | = :next 50% 14 | = :next 100% 15 | = :next -s 100% 16 | 17 | k = :prev 18 | = :prev 19 | = :prev 50% 20 | = :prev 100% 21 | = :prev -s 100% 22 | g = :select 0 23 | G = :select -1 24 | 25 | J = :next-folder 26 | K = :prev-folder 27 | 28 | v = :mark -t 29 | V = :mark -v 30 | 31 | = :view 32 | d = :prompt 'Really delete this message?' 'delete-message' 33 | D = :delete 34 | A = :archive flat 35 | 36 | C = :compose 37 | 38 | rr = :reply -a 39 | rq = :reply -aq 40 | Rr = :reply 41 | Rq = :reply -q 42 | 43 | c = :cf 44 | $ = :term 45 | ! = :term 46 | | = :pipe 47 | 48 | / = :search 49 | \ = :filter 50 | n = :next-result 51 | N = :prev-result 52 | 53 | [view] 54 | q = :close 55 | | = :pipe 56 | D = :delete 57 | S = :save 58 | A = :archive flat 59 | 60 | f = :forward 61 | rr = :reply -a 62 | rq = :reply -aq 63 | Rr = :reply 64 | Rq = :reply -q 65 | 66 | H = :toggle-headers 67 | = :prev-part 68 | = :next-part 69 | J = :next 70 | K = :prev 71 | 72 | # my custom: 73 | l = q:next 74 | h = qk 75 | 76 | [compose] 77 | # Keybindings used when the embedded terminal is not selected in the compose 78 | # view 79 | $ex = 80 | = :prev-field 81 | = :next-field 82 | = :next-field 83 | 84 | [compose::editor] 85 | # Keybindings used when the embedded terminal is selected in the compose view 86 | $noinherit = true 87 | $ex = 88 | = :prev-field 89 | = :next-field 90 | = :prev-tab 91 | = :next-tab 92 | 93 | [compose::review] 94 | # Keybindings used when reviewing a message to be sent 95 | y = :send 96 | n = :abort 97 | p = :postpone 98 | q = :abort 99 | e = :edit 100 | a = :attach 101 | 102 | [terminal] 103 | $noinherit = true 104 | $ex = 105 | 106 | = :prev-tab 107 | = :next-tab 108 | -------------------------------------------------------------------------------- /.config/aerc/styles/custom: -------------------------------------------------------------------------------- 1 | # This is my custom aerc styles. 2 | # 3 | # It's based on top of defaults with a little bit of colors (hopefully). It's 4 | # not working quite well so I only have the top bar colored lol 5 | 6 | *.default=true 7 | *.selected.reverse=toggle 8 | 9 | title.reverse=true 10 | header.bold=true 11 | 12 | *error.bold=true 13 | error.fg=red 14 | warning.fg=yellow 15 | success.fg=green 16 | 17 | statusline*.default=true 18 | statusline_default.reverse=true 19 | statusline_error.fg=red 20 | statusline_error.reverse=true 21 | 22 | msglist_unread.bold=true 23 | msglist_deleted.fg=gray 24 | 25 | completion_pill.reverse=true 26 | 27 | tab.reverse=true 28 | border.reverse = true 29 | 30 | selector_focused.reverse=true 31 | selector_chooser.bold=true 32 | 33 | 34 | # BEGIN custom settings 35 | 36 | tab.fg=yellow 37 | selector_focused.fg=green 38 | selector_chooser.fg=green 39 | stack.fg=yellow 40 | msglist_unread.fg=blue 41 | -------------------------------------------------------------------------------- /.config/aerc/styles/default: -------------------------------------------------------------------------------- 1 | # 2 | # aerc default styleset 3 | # 4 | # This styleset uses the terminal defaults as its base. 5 | # More information on how to configure the styleset can be found in 6 | # the aerc-stylesets(7) manpage. Please read the manual before 7 | # modifying or creating a styleset. 8 | 9 | *.default=true 10 | *.selected.reverse=toggle 11 | 12 | title.reverse=true 13 | header.bold=true 14 | 15 | *error.bold=true 16 | error.fg=red 17 | warning.fg=yellow 18 | success.fg=green 19 | 20 | statusline*.default=true 21 | statusline_default.reverse=true 22 | statusline_error.fg=red 23 | statusline_error.reverse=true 24 | 25 | msglist_unread.bold=true 26 | msglist_deleted.fg=gray 27 | 28 | completion_pill.reverse=true 29 | 30 | tab.reverse=true 31 | border.reverse = true 32 | 33 | selector_focused.reverse=true 34 | selector_chooser.bold=true 35 | -------------------------------------------------------------------------------- /.config/amfora/config.toml: -------------------------------------------------------------------------------- 1 | # This is the default config file. 2 | # It also shows all the default values, if you don't create the file. 3 | 4 | # All URL values may omit the scheme and/or port, as well as the beginning double slash 5 | # Valid URL examples: 6 | # gemini://example.com 7 | # //example.com 8 | # example.com 9 | # example.com:123 10 | 11 | 12 | [a-general] 13 | # Press Ctrl-H to access it 14 | home = "gemini://gemini.circumlunar.space" 15 | 16 | # Follow up to 5 Gemini redirects without prompting. 17 | # A prompt is always shown after the 5th redirect and for redirects to protocols other than Gemini. 18 | # If set to false, a prompt will be shown before following redirects. 19 | auto_redirect = false 20 | 21 | # What command to run to open a HTTP(S) URL. 22 | # Set to "default" to try to guess the browser, or set to "off" to not open HTTP(S) URLs. 23 | # If a command is set, than the URL will be added (in quotes) to the end of the command. 24 | # A space will be prepended to the URL. 25 | # 26 | # The best to define a command is using a string array. 27 | # Examples: 28 | # http = ['firefox'] 29 | # http = ['custom-browser', '--flag', '--option=2'] 30 | # http = ['/path/with spaces/in it/firefox'] 31 | # 32 | # Note the use of single quotes, so that backslashes will not be escaped. 33 | # Using just a string will also work, but it is deprecated, and will degrade if 34 | # you use paths with spaces. 35 | 36 | http = 'default' 37 | 38 | # Any URL that will accept a query string can be put here 39 | search = "gemini://geminispace.info/search" 40 | 41 | # Whether colors will be used in the terminal 42 | color = true 43 | 44 | # Whether ANSI color codes from the page content should be rendered 45 | ansi = true 46 | 47 | # Whether to replace list asterisks with unicode bullets 48 | bullets = true 49 | 50 | # Whether to show link after link text 51 | show_link = false 52 | 53 | # A number from 0 to 1, indicating what percentage of the terminal width the left margin should take up. 54 | left_margin = 0.15 55 | 56 | # The max number of columns to wrap a page's text to. Preformatted blocks are not wrapped. 57 | max_width = 100 58 | 59 | # 'downloads' is the path to a downloads folder. 60 | # An empty value means the code will find the default downloads folder for your system. 61 | # If the path does not exist it will be created. 62 | # Note the use of single quotes, so that backslashes will not be escaped. 63 | downloads = '' 64 | 65 | # Max size for displayable content in bytes - after that size a download window pops up 66 | page_max_size = 2097152 # 2 MiB 67 | # Max time it takes to load a page in seconds - after that a download window pops up 68 | page_max_time = 10 69 | 70 | # Whether to replace tab numbers with emoji favicons, which are cached. 71 | emoji_favicons = true 72 | 73 | 74 | [auth] 75 | # Authentication settings 76 | # Note the use of single quotes for values, so that backslashes will not be escaped. 77 | 78 | [auth.certs] 79 | # Client certificates 80 | # Set domain name equal to path to client cert 81 | # "example.com" = 'mycert.crt' 82 | "astrobotany.mozz.us" = '~/cert.pem' 83 | "chat.mozz.us" = '~/cert.pem' 84 | "station.martinrue.com" = '~/cert.pem' 85 | "feeds.drewdevault.com" = '~/cert.pem' 86 | 87 | [auth.keys] 88 | # Client certificate keys 89 | # Set domain name equal to path to key for the client cert above 90 | # "example.com" = 'mycert.key' 91 | "astrobotany.mozz.us" = '~/key.pem' 92 | "chat.mozz.us" = '~/key.pem' 93 | "station.martinrue.com" = '~/key.pem' 94 | "feeds.drewdevault.com" = '~/key.pem' 95 | 96 | 97 | [keybindings] 98 | # In the future there will be more settings here. 99 | 100 | # Hold down shift and press the numbers on your keyboard (1,2,3,4,5,6,7,8,9,0) to set this up. 101 | # It is default set to be accurate for US keyboards. 102 | shift_numbers = "!@#$%^&*()" 103 | 104 | 105 | [url-handlers] 106 | # Allows setting the commands to run for various URL schemes. 107 | # E.g. to open FTP URLs with FileZilla set the following key: 108 | # ftp = 'filezilla' 109 | # You can set any scheme to "off" or "" to disable handling it, or 110 | # just leave the key unset. 111 | # 112 | # DO NOT use this for setting the HTTP command. 113 | # Use the http setting in the "a-general" section above. 114 | # 115 | # NOTE: These settings are overrided by the ones in the proxies section. 116 | # Note the use of single quotes, so that backslashes will not be escaped. 117 | 118 | # This is a special key that defines the handler for all URL schemes for which 119 | # no handler is defined. 120 | other = 'off' 121 | 122 | 123 | [cache] 124 | # Options for page cache - which is only for text pages 125 | # Increase the cache size to speed up browsing at the expense of memory 126 | # Zero values mean there is no limit 127 | 128 | max_size = 0 # Size in bytes 129 | max_pages = 30 # The maximum number of pages the cache will store 130 | 131 | # How long a page will stay in cache, in seconds. 132 | timeout = 1800 # 30 mins 133 | 134 | [proxies] 135 | # Allows setting a Gemini proxy for different schemes. 136 | # The settings are similar to the url-handlers section above. 137 | # E.g. to open a gopher page by connecting to a Gemini proxy server: 138 | # gopher = "example.com:123" 139 | # 140 | # Port 1965 is assumed if no port is specified. 141 | # 142 | # NOTE: These settings override any external handlers specified in 143 | # the url-handlers section. 144 | # 145 | # Note that HTTP and HTTPS are treated as separate protocols here. 146 | 147 | 148 | [subscriptions] 149 | # For tracking feeds and pages 150 | 151 | # Whether a pop-up appears when viewing a potential feed 152 | popup = true 153 | 154 | # How often to check for updates to subscriptions in the background, in seconds. 155 | # Set it to 0 to disable this feature. You can still update individual feeds 156 | # manually, or restart the browser. 157 | # 158 | # Note Amfora will check for updates on browser start no matter what this setting is. 159 | update_interval = 1800 # 30 mins 160 | 161 | # How many subscriptions can be checked at the same time when updating. 162 | # If you have many subscriptions you may want to increase this for faster 163 | # update times. Any value below 1 will be corrected to 1. 164 | workers = 3 165 | 166 | # The number of subscription updates displayed per page. 167 | entries_per_page = 20 168 | 169 | 170 | [theme] 171 | # This section is for changing the COLORS used in Amfora. 172 | # These colors only apply if 'color' is enabled above. 173 | # Colors can be set using a W3C color name, or a hex value such as "#ffffff". 174 | 175 | # Note that not all colors will work on terminals that do not have truecolor support. 176 | # If you want to stick to the standard 16 or 256 colors, you can get 177 | # a list of those here: https://jonasjacek.github.io/colors/ 178 | # DO NOT use the names from that site, just the hex codes. 179 | 180 | # Definitions: 181 | # bg = background 182 | # fg = foreground 183 | # dl = download 184 | # btn = button 185 | # hdg = heading 186 | # bkmk = bookmark 187 | # modal = a popup window/box in the middle of the screen 188 | 189 | # EXAMPLES: 190 | # hdg_1 = "green" 191 | # hdg_2 = "#5f0000" 192 | 193 | # Available keys to set: 194 | 195 | # bg: background for pages, tab row, app in general 196 | # tab_num: The number/highlight of the tabs at the top 197 | # tab_divider: The color of the divider character between tab numbers: | 198 | # bottombar_label: The color of the prompt that appears when you press space 199 | # bottombar_text: The color of the text you type 200 | # bottombar_bg 201 | 202 | # hdg_1 203 | # hdg_2 204 | # hdg_3 205 | # amfora_link: A link that Amfora supports viewing. For now this is only gemini:// 206 | # foreign_link: HTTP(S), Gopher, etc 207 | # link_number: The silver number that appears to the left of a link 208 | # regular_text: Normal gemini text, and plaintext documents 209 | # quote_text 210 | # preformatted_text 211 | # list_text 212 | 213 | # btn_bg: The bg color for all modal buttons 214 | # btn_text: The text color for all modal buttons 215 | 216 | # dl_choice_modal_bg 217 | # dl_choice_modal_text 218 | # dl_modal_bg 219 | # dl_modal_text 220 | # info_modal_bg 221 | # info_modal_text 222 | # error_modal_bg 223 | # error_modal_text 224 | # yesno_modal_bg 225 | # yesno_modal_text 226 | # tofu_modal_bg 227 | # tofu_modal_text 228 | # subscription_modal_bg 229 | # subscription_modal_text 230 | 231 | # input_modal_bg 232 | # input_modal_text 233 | # input_modal_field_bg: The bg of the input field, where you type the text 234 | # input_modal_field_text: The color of the text you type 235 | 236 | # bkmk_modal_bg 237 | # bkmk_modal_text 238 | # bkmk_modal_label 239 | # bkmk_modal_field_bg 240 | # bkmk_modal_field_text 241 | -------------------------------------------------------------------------------- /.config/doom/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; $DOOMDIR/packages.el 3 | ;; Must run doom sync or doom/reload after modifying this file 4 | 5 | ;; Installing from git repo (see more on straight docs) 6 | ;(package! another-package 7 | ; :recipe (:host github :repo "username/repo")) 8 | 9 | ;; If the package you are trying to install does not contain a PACKAGENAME.el 10 | ;; file, or is located in a subdirectory of the repo, you'll need to specify 11 | ;; `:files' in the `:recipe': 12 | ;(package! this-package 13 | ; :recipe (:host github :repo "username/repo" 14 | ; :files ("some-file.el" "src/lisp/*.el"))) 15 | 16 | ;(package! builtin-package :disable t) 17 | 18 | ;; You can override the recipe of a built in package without having to specify 19 | ;; all the properties for `:recipe'. These will inherit the rest of its recipe 20 | ;; from Doom or MELPA/ELPA/Emacsmirror: 21 | ;(package! builtin-package :recipe (:nonrecursive t)) 22 | ;(package! builtin-package-2 :recipe (:repo "myfork/package")) 23 | 24 | ;; Use `:branch' to install from a branch 25 | ;; straight can't deal with non-master branches: raxod502/straight.el#279 26 | ;(package! builtin-package :recipe (:branch "develop")) 27 | 28 | ;; Use `:pin' to specify a particular commit to install. 29 | ;(package! builtin-package :pin "1a2b3c4d5e") 30 | 31 | ;; Doom's packages are pinned to a specific commit and updated from release to 32 | ;; release. 33 | ;; unpin one or multiple packages: 34 | ;(unpin! pinned-package another-pinned-package) 35 | ;; Or all (not recommended) 36 | ;(unpin! t) 37 | 38 | (package! elpher) 39 | (package! eww) 40 | (package! math-symbol-lists) 41 | (package! company-emoji) 42 | 43 | (if (>= emacs-major-version 27) 44 | (progn 45 | (unpin! org-roam) 46 | (package! org-roam-ui) 47 | (package! simple-httpd) 48 | (package! websocket))) 49 | 50 | (package! org-bullets 51 | :recipe (:host github :repo "sabof/org-bullets")) 52 | 53 | (package! org-anki) 54 | (package! wrap-region) 55 | (package! eat) 56 | (package! pos-tip 57 | :recipe (:source melpa)) 58 | (package! company-quickhelp) 59 | -------------------------------------------------------------------------------- /.config/elinks/elinks.conf: -------------------------------------------------------------------------------- 1 | # DOESN"T WORK 2 | set document.browse.links.active_link.enable_color = 0 3 | set document.browse.links.active_link.invert = 0 4 | set document.browse.links.active_link.underline = 1 5 | set document.browse.links.active_link.bold = 1 6 | set document.colors.link = "#83c1fc" 7 | set document.colors.image = "gray" 8 | # set document.browse.links.active_link.colors.background = "#83c1fc" 9 | # set document.browse.links.active_link.colors.background = "#444444" 10 | # set document.browse.links.active_link.colors.text = "white" 11 | set document.css.prefers_color_scheme = "dark" 12 | -------------------------------------------------------------------------------- /.config/emacs/README.org: -------------------------------------------------------------------------------- 1 | #+title: README for my emacs config 2 | #+auto_tangle: nil 3 | 4 | * Introduction 5 | 6 | This repository contains files related to my emacs config for vanilla emacs, Doom config lives in =~/.config/doom=. 7 | 8 | If you're reading this from a Git forge, files that are tracked would be *Literate Org configuration* (more on this below) files that are responsible for producing files like =init.el=, =dotslash-modules/packages.el= (and possibly more). Please view source if the Git forge you are viewing this file from does not show Org file properties in its preview, if it has a review at all. 9 | 10 | Things to look out for when viewing the Org sources are: 11 | - Document header properties 12 | - =auto_tangle=: this is used by org-auto-tangle plugin to auto tangle on save (=t= or =nil=) 13 | - =header_args:elisp=: specifies default SRC block header arguments for code type elisp 14 | - SRC block header arguments 15 | - =tangle=: May be set to no for obsolete configuration snippets for =elisp= code type, or for =noweb= portions (see below) 16 | - =noweb: yes=: It means that substitions are used in the code block, definitions of which may be found later (I generally like to define the layout -- blocks that make use of the individual portions first, before the actual portions) 17 | - =noweb-ref: =: It specifies the name of the "substitution" for use in the SRC block that references it (see above) 18 | 19 | I do wish forges like GitHub shows metadata information like how it shows YAML/JSON/TOML header metadata for markdown files. If you know a userscript CSS or extension to improve this, do let me know! My inbox is open at hedy (@) tilde (.) cafe. 20 | 21 | If you're not reading this from a Git forge, be informed that this =*.org= files that are tangled, this file, =early-init.el=, and =dotslash-*= directories are tracked with Git and available on the web via these URLs: 22 | 23 | - SourceHut: https://sr.ht/~hedy/dotfiles 24 | - GitHub: https://github.com/hedyhli/dotfiles 25 | - TildeGit (gitea instance for the [[https://tildeverse.org][Tildeverse]]): https://tildegit.org/hedy/dotfiles 26 | 27 | * On Literate Programming 28 | 29 | Using Literate Programming for my emacs config is a great idea IMO, because it forces myself to document each snippet of code I am tangling. If the entire Org document is essentially a =init.el= but wrapped in =BEGIN_SRC= and =END_SRC=, I would consciously want to add some text for it. 30 | 31 | Extended readings on "Literate Programming": 32 | - https://en.wikipedia.org/wiki/Literate_programming 33 | - https://www-cs-faculty.stanford.edu/~knuth/lp.html (Knuth's book) 34 | - https://orgmode.org/manual/Extracting-Source-Code.html 35 | 36 | Furthermore, headings can easily be used to leverage orgmode outlines so I can quickly jump to a position in my config. You can possibly set this up yourself for any arbitrary elisp file, but since we're talking about the emacs config here -- sort of like "frontliners" or "editting in production" -- meaning if something in my config breaks and all my packages do not load, I can still use imenu (or a outline command) to jump to an org heading, with some basic completion to fix my config in Org! 37 | 38 | Another advantage is that since it's an Org document, you can embed not only elisp, but also other code blocks in other languages. There are two use-cases for me: 39 | 40 | 1. Eshell aliases can be defined together with my Eshell package configuration! I can simply set the code type to something other than =elisp= (or nothing at all), and add =:tangle ~/.config/emacs/eshell/alias= (for example). If I weren't using Org for my emacs config, the alias file and my Eshell config would be completely detached; when I want to lookup the source of a command, I have to check both the Eshell section of my config and also (remember to check) the alias file. 41 | 42 | 2. Embedding other languages as example. 43 | 44 | As of writing, I have not yet set up the org-anki package. But in my Doom configuration I have and you can see that I have included CSS and AppleScript code blocks. These are simply example supplementary configurations for Anki card templates and =emacs://= URL scheme handlers, respectively, that are supposed to be used in conjunction with my Org-anki custom card templates. 45 | 46 | If you are not familiar with Anki or Anki integrations, you can ignore the previous paragraph; the gist is that I can group related thigns together with my emacs config to assist in providing a referrable and maintainable emacs config rather than navigating code like any other programming project. 47 | 48 | Read more on =noweb=: 49 | - https://orgmode.org/manual/Noweb-Reference-Syntax.html 50 | - (details on noweb itself linked in the footnotes of the above Org manual page) 51 | 52 | 53 | * TODO A note on copying other people's configuration 54 | 55 | * TODO Suggested references to other =.emacs= (or emacs distributions) shared on the web 56 | 57 | - Prot's 58 | - Doom emacs 59 | - Centaur 60 | - Ha-emacs 61 | - Crafted emacs 62 | - DistoTube emacs config (doom) 63 | - Purcell 64 | - Spacemacs 65 | 66 | I have heavily (or sparingly) taken inspirations from the first 6 of which, in no particular order within my own =.emacs=. 67 | -------------------------------------------------------------------------------- /.config/emacs/dotslash-lisp/README: -------------------------------------------------------------------------------- 1 | dotslash-lisp 2 | ============= 3 | 4 | This is for experimental or personal "packages". 5 | -------------------------------------------------------------------------------- /.config/emacs/dotslash-modules/README: -------------------------------------------------------------------------------- 1 | dotslash-modules 2 | ================ 3 | 4 | These are extracted, modularized configuration for packages. The package.org file tangles into packages.el here. It `provide's packages `packages'. 5 | -------------------------------------------------------------------------------- /.config/emacs/dotslash-modules/init-highlight.el: -------------------------------------------------------------------------------- 1 | ;;; init-highlight.el --- Highlighting stuff 2 | ;;; Commentary: 3 | ;; Highlighting symbols, indentation, brackets, TODO/REVIEW/FIXME/HACK/XXX 4 | 5 | ;;; Code: 6 | 7 | ;; TODO: do I need hl-line package?? 8 | 9 | ;; Highlight indentions 10 | (use-package highlight-indent-guides 11 | :diminish 12 | :hook 13 | ((prog-mode yaml-mode) . highlight-indent-guides-mode) 14 | (highlight-indent-guides-mode 15 | . 16 | ;; FIXME: No clue why setting this in config doesn't work. 17 | (lambda () (set-face-attribute 'highlight-indent-guides-character-face nil 18 | :foreground "gray30") 19 | (set-face-attribute 'highlight-indent-guides-top-character-face nil 20 | :foreground "gray50" :weight 'bold))) 21 | 22 | :init 23 | (setq highlight-indent-guides-method 'character 24 | highlight-indent-guides-responsive 'top 25 | highlight-indent-guides-suppress-auto-error t) 26 | 27 | :config 28 | (with-no-warnings 29 | ;; Don't display first level of indentation 30 | (defun my-indent-guides-for-all-but-first-column (level responsive display) 31 | (unless (< level 1) 32 | (highlight-indent-guides--highlighter-default level responsive display))) 33 | (setq highlight-indent-guides-highlighter-function 34 | #'my-indent-guides-for-all-but-first-column) 35 | 36 | ;; Disable in `macrostep' expanding 37 | (with-eval-after-load 'macrostep 38 | (advice-add #'macrostep-expand 39 | :after (lambda (&rest _) 40 | (when highlight-indent-guides-mode 41 | (highlight-indent-guides-mode -1)))) 42 | (advice-add #'macrostep-collapse 43 | :after (lambda (&rest _) 44 | (when (derived-mode-p 'prog-mode 'yaml-mode) 45 | (highlight-indent-guides-mode 1))))) 46 | 47 | ;; Don't display indentations in `swiper' 48 | ;; https://github.com/DarthFennec/highlight-indent-guides/issues/40 49 | (with-eval-after-load 'ivy 50 | (defun my-ivy-cleanup-indentation (str) 51 | "Clean up indentation highlighting in ivy minibuffer." 52 | (let ((pos 0) 53 | (next 0) 54 | (limit (length str)) 55 | (prop 'highlight-indent-guides-prop)) 56 | (while (and pos next) 57 | (setq next (text-property-not-all pos limit prop nil str)) 58 | (when next 59 | (setq pos (text-property-any next limit prop nil str)) 60 | (ignore-errors 61 | (remove-text-properties next pos '(display nil face nil) str)))))) 62 | (advice-add #'ivy-cleanup-string :after #'my-ivy-cleanup-indentation)))) 63 | 64 | 65 | ;; Colorize color names in buffers 66 | (use-package rainbow-mode 67 | :diminish 68 | :bind (:map special-mode-map 69 | ("w" . rainbow-mode)) 70 | :hook ((html-mode php-mode) . rainbow-mode) 71 | :config 72 | (with-no-warnings 73 | ;; HACK: Use overlay instead of text properties to override `hl-line' faces. 74 | ;; @see https://emacs.stackexchange.com/questions/36420 75 | (defun my-rainbow-colorize-match (color &optional match) 76 | (let* ((match (or match 0)) 77 | (ov (make-overlay (match-beginning match) (match-end match)))) 78 | (overlay-put ov 'ovrainbow t) 79 | (overlay-put ov 'face `((:foreground ,(if (> 0.5 (rainbow-x-color-luminance color)) 80 | "white" "black")) 81 | (:background ,color))))) 82 | (advice-add #'rainbow-colorize-match :override #'my-rainbow-colorize-match) 83 | 84 | (defun my-rainbow-clear-overlays () 85 | "Clear all rainbow overlays." 86 | (remove-overlays (point-min) (point-max) 'ovrainbow t)) 87 | (advice-add #'rainbow-turn-off :after #'my-rainbow-clear-overlays))) 88 | 89 | ;; Highlight brackets according to their depth 90 | (use-package rainbow-delimiters 91 | :hook (prog-mode . rainbow-delimiters-mode)) 92 | 93 | ;; Highlight TODO and similar keywords in comments and strings 94 | (use-package hl-todo 95 | :demand t 96 | :config 97 | (global-hl-todo-mode 1) 98 | (dolist (keyword '("REVIEW" "HACK")) 99 | (cl-pushnew `(,keyword . ,(face-foreground 'warning)) hl-todo-keyword-faces)) 100 | :bind (:map hl-todo-mode-map 101 | ([C-f3] . hl-todo-occur) 102 | ("C-c t p" . hl-todo-previous) 103 | ("C-c t n" . hl-todo-next) 104 | ("C-c t o" . hl-todo-occur)) 105 | ;;:hook (after-init . global-hl-todo-mode) 106 | ) 107 | (provide 'init-highlight) 108 | ;;; init-highlight.el ends here 109 | -------------------------------------------------------------------------------- /.config/emacs/early-init.el: -------------------------------------------------------------------------------- 1 | (setq package-enable-at-startup nil) 2 | (setq inhibit-startup-message t) 3 | (tool-bar-mode -1) 4 | (set-fringe-mode 10) 5 | (modify-all-frames-parameters '((width . 100) (height . 50))) 6 | -------------------------------------------------------------------------------- /.config/fish/config.fish: -------------------------------------------------------------------------------- 1 | set -gx fish_cursor_default line 2 | 3 | source ~/.aliases 4 | 5 | # Environment variables 6 | # ~/.exportenvs.fish is generated by ~/dotscripts/gen/fish-exportenvs 7 | if test -f ~/.exportenvs.fish 8 | source ~/.exportenvs.fish 9 | end 10 | 11 | if test -f ~/.config/fish/config_local.fish 12 | source ~/.config/fish/config_local.fish 13 | end 14 | 15 | abbr -a --set-cursor pj cd $PROJECTS_ROOT/% 16 | abbr -a --set-cursor ccd ranger --choosedir=/tmp/rangerdir % \&\& cd \(cat /tmp/rangerdir\) 17 | abbr -a --set-cursor cdd ranger --choosedir=/tmp/rangerdir % \&\& cd \(cat /tmp/rangerdir\) 18 | 19 | # TODO: migrate .addpath and .exportenvs to direnv :D 20 | if command -sq direnv > /dev/null 21 | direnv hook fish | source 22 | end 23 | 24 | if command -sq pyenv > /dev/null 25 | status is-login; and pyenv init --path | source 26 | status is-interactive; and pyenv init - | source 27 | end 28 | 29 | function ls_on_cd --on-variable PWD; 30 | ls --color=auto 31 | end 32 | -------------------------------------------------------------------------------- /.config/fish/functions/cat.fish: -------------------------------------------------------------------------------- 1 | function cat --description 'alias cat to ccat' 2 | # if command -sq bat 3 | # bat --theme Dracula $argv; 4 | # else if command -sq ccat 5 | # ccat $argv; 6 | if command -sq ccat 7 | ccat $argv; 8 | else 9 | set catpath (which cat) 10 | $catpath $argv; 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /.config/fish/functions/condasetup.fish: -------------------------------------------------------------------------------- 1 | function condasetup 2 | if test -f /Users/hedy/miniconda3/bin/conda 3 | eval /Users/hedy/miniconda3/bin/conda "shell.fish" "hook" $argv | source 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /.config/fish/functions/fish_greeting.fish: -------------------------------------------------------------------------------- 1 | function fish_greeting 2 | end 3 | -------------------------------------------------------------------------------- /.config/fish/functions/fish_prompt.1673587505.copy: -------------------------------------------------------------------------------- 1 | # Based on top of fish's built-in "informative" shell style (see fish_config) 2 | # I actually forgot what it's called exactly 3 | # 4 | # Most is the same. Only thing different is that it: 5 | # - prints leading space because my head is tired from moving to the left in 6 | # internet articles, terminal programs, and prompt 7 | # - changes the suffix to ">" 8 | # - fixes git clean state char 9 | # - makes base name blue 10 | # - print user@hostname in right prompt (see fish_right_prompt) 11 | function fish_prompt --description 'Write out the prompt' 12 | set -l last_pipestatus $pipestatus 13 | 14 | if not set -q __fish_git_prompt_show_informative_status 15 | set -g __fish_git_prompt_show_informative_status 1 16 | end 17 | if not set -q __fish_git_prompt_hide_untrackedfiles 18 | set -g __fish_git_prompt_hide_untrackedfiles 1 19 | end 20 | if not set -q __fish_git_prompt_color_branch 21 | set -g __fish_git_prompt_color_branch magenta --bold 22 | end 23 | if not set -q __fish_git_prompt_showupstream 24 | set -g __fish_git_prompt_showupstream "informative" 25 | end 26 | if not set -q __fish_git_prompt_char_upstream_ahead 27 | set -g __fish_git_prompt_char_upstream_ahead "↑" 28 | end 29 | if not set -q __fish_git_prompt_char_upstream_behind 30 | set -g __fish_git_prompt_char_upstream_behind "↓" 31 | end 32 | if not set -q __fish_git_prompt_char_upstream_prefix 33 | set -g __fish_git_prompt_char_upstream_prefix "" 34 | end 35 | if not set -q __fish_git_prompt_char_stagedstate 36 | set -g __fish_git_prompt_char_stagedstate "●" 37 | end 38 | if not set -q __fish_git_prompt_char_dirtystate 39 | set -g __fish_git_prompt_char_dirtystate "✚" 40 | end 41 | if not set -q __fish_git_prompt_char_untrackedfiles 42 | set -g __fish_git_prompt_char_untrackedfiles "…" 43 | end 44 | if not set -q __fish_git_prompt_char_invalidstate 45 | set -g __fish_git_prompt_char_invalidstate "✖" 46 | end 47 | if not set -q __fish_git_prompt_char_cleanstate 48 | # Switch from the check symbol to = because this fixes the width 49 | # calculation problem where where the last char at the right prompt 50 | # will be wrapped to the next line. 51 | # Solution from stack overflow obviously, lost link though 52 | set -g __fish_git_prompt_char_cleanstate "=" 53 | end 54 | if not set -q __fish_git_prompt_color_dirtystate 55 | set -g __fish_git_prompt_color_dirtystate blue 56 | end 57 | if not set -q __fish_git_prompt_color_stagedstate 58 | set -g __fish_git_prompt_color_stagedstate yellow 59 | end 60 | if not set -q __fish_git_prompt_color_invalidstate 61 | set -g __fish_git_prompt_color_invalidstate red 62 | end 63 | if not set -q __fish_git_prompt_color_untrackedfiles 64 | set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal 65 | end 66 | if not set -q __fish_git_prompt_color_cleanstate 67 | set -g __fish_git_prompt_color_cleanstate green --bold 68 | end 69 | 70 | set -l color_cwd 71 | set -l prefix 72 | set -l suffix 73 | switch "$USER" 74 | case root toor 75 | if set -q fish_color_cwd_root 76 | set color_cwd $fish_color_cwd_root 77 | set color_cwd_base $fish_color_cwd_root 78 | else 79 | set color_cwd $fish_color_cwd 80 | set color_cwd_base blue 81 | end 82 | set suffix ' #' 83 | case '*' 84 | set color_cwd $fish_color_cwd 85 | set color_cwd_base blue 86 | set suffix '>' 87 | end 88 | 89 | # NOW we print the prompt :p 90 | 91 | # PWD 92 | set wd (prompt_pwd) 93 | set_color $color_cwd 94 | if not [ $wd = '~' ] 95 | # Make basename blue just because 96 | echo -n (dirname $wd)'/' 97 | set_color $color_cwd_base 98 | echo -n (basename $wd) 99 | else 100 | echo -n ' ~' 101 | end 102 | set_color normal 103 | 104 | printf '%s' (fish_vcs_prompt) 105 | 106 | set -l pipestatus_string (__fish_print_pipestatus "[" "] " "|" (set_color $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus) 107 | echo -n $pipestatus_string 108 | set_color normal 109 | 110 | echo -n "$suffix " 111 | end 112 | -------------------------------------------------------------------------------- /.config/fish/functions/fish_prompt.fish: -------------------------------------------------------------------------------- 1 | # Based on top of fish's built-in "informative" shell style (see fish_config) 2 | # I actually forgot what it's called exactly 3 | # 4 | # Most is the same. Only thing different is that it: 5 | # - prints leading space because my head is tired from moving to the left in 6 | # internet articles, terminal programs, and prompt 7 | # - changes the suffix to ">" 8 | # - fixes git clean state char 9 | # - makes base name blue 10 | # - print user@hostname in right prompt (see fish_right_prompt) 11 | function fish_prompt --description 'Write out the prompt' 12 | set -l last_pipestatus $pipestatus 13 | 14 | if not set -q __fish_git_prompt_show_informative_status 15 | set -g __fish_git_prompt_show_informative_status 1 16 | end 17 | if not set -q __fish_git_prompt_hide_untrackedfiles 18 | set -g __fish_git_prompt_hide_untrackedfiles 1 19 | end 20 | set -g __fish_git_prompt_color_branch magenta 21 | if not set -q __fish_git_prompt_showupstream 22 | set -g __fish_git_prompt_showupstream "informative" 23 | end 24 | if not set -q __fish_git_prompt_char_upstream_ahead 25 | set -g __fish_git_prompt_char_upstream_ahead "↑" 26 | end 27 | if not set -q __fish_git_prompt_char_upstream_behind 28 | set -g __fish_git_prompt_char_upstream_behind "↓" 29 | end 30 | if not set -q __fish_git_prompt_char_upstream_prefix 31 | set -g __fish_git_prompt_char_upstream_prefix "" 32 | end 33 | if not set -q __fish_git_prompt_char_stagedstate 34 | set -g __fish_git_prompt_char_stagedstate "●" 35 | end 36 | if not set -q __fish_git_prompt_char_dirtystate 37 | set -g __fish_git_prompt_char_dirtystate "+" 38 | end 39 | if not set -q __fish_git_prompt_char_untrackedfiles 40 | set -g __fish_git_prompt_char_untrackedfiles "…" 41 | end 42 | if not set -q __fish_git_prompt_char_invalidstate 43 | set -g __fish_git_prompt_char_invalidstate "x" 44 | end 45 | if not set -q __fish_git_prompt_char_cleanstate 46 | # Switch from the check symbol to = because this fixes the width 47 | # calculation problem where where the last char at the right prompt 48 | # will be wrapped to the next line. 49 | # Solution from stack overflow obviously, lost link though 50 | set -g __fish_git_prompt_char_cleanstate "=" 51 | end 52 | if not set -q __fish_git_prompt_color_dirtystate 53 | set -g __fish_git_prompt_color_dirtystate blue 54 | end 55 | if not set -q __fish_git_prompt_color_stagedstate 56 | set -g __fish_git_prompt_color_stagedstate yellow 57 | end 58 | if not set -q __fish_git_prompt_color_invalidstate 59 | set -g __fish_git_prompt_color_invalidstate red 60 | end 61 | if not set -q __fish_git_prompt_color_untrackedfiles 62 | set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal 63 | end 64 | 65 | set -g __fish_git_prompt_color_cleanstate yellow 66 | 67 | set -l color_cwd 68 | set -l prefix 69 | set -l suffix 70 | switch "$USER" 71 | case root toor 72 | if set -q fish_color_cwd_root 73 | set color_cwd $fish_color_cwd_root 74 | set color_cwd_base $fish_color_cwd_root 75 | else 76 | set color_cwd $fish_color_cwd 77 | set color_cwd_base blue 78 | end 79 | set suffix ' #' 80 | case '*' 81 | set color_cwd $fish_color_cwd 82 | set color_cwd_base blue 83 | set suffix '>' 84 | end 85 | 86 | # NOW we print the prompt :p 87 | 88 | # PWD 89 | set wd (prompt_pwd) 90 | set_color $color_cwd 91 | if not [ $wd = '~' ] 92 | # Make basename blue just because 93 | echo -n (dirname $wd)'/' 94 | set_color $color_cwd_base 95 | echo -n (basename $wd) 96 | else 97 | echo -n ' ~' 98 | end 99 | set_color normal 100 | 101 | printf '%s' (fish_vcs_prompt) 102 | 103 | set -l pipestatus_string (__fish_print_pipestatus "[" "] " "|" (set_color $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus) 104 | echo -n $pipestatus_string 105 | set_color normal 106 | 107 | echo -n "$suffix " 108 | end 109 | -------------------------------------------------------------------------------- /.config/fish/functions/fish_right_prompt.fish: -------------------------------------------------------------------------------- 1 | function fish_right_prompt 2 | set_color $fish_color_autosuggestion 2> /dev/null; or set_color 555 3 | printf "%s@%s " $USER (hostname) 4 | date "+%H:%M:%S" 5 | set_color normal 6 | end 7 | -------------------------------------------------------------------------------- /.config/fish/functions/gitsimhis.fish: -------------------------------------------------------------------------------- 1 | function gitsimhis 2 | cd $argv[1] 3 | if read_confirm 'Everything in this directory will be replaced. Do you want to continue? ' 4 | rm -rf * 5 | else 6 | echo 'Aborting...' 7 | return 1 8 | end 9 | 10 | echo '1' > a 11 | git init && git add . && git commit -m '1' 12 | echo '2' >> a 13 | git add . && git commit -m '2' 14 | echo '3' >> a 15 | git add . && git commit -m '3' 16 | end 17 | 18 | -------------------------------------------------------------------------------- /.config/fish/functions/ll.fish: -------------------------------------------------------------------------------- 1 | function ll 2 | if command -sq exa 3 | exa -lahg --git -t modified $argv 4 | else 5 | ls -Al $argv 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /.config/fish/functions/ls.fish: -------------------------------------------------------------------------------- 1 | function ls 2 | set lspath (which ls) 3 | if [ (uname) = "NetBSD" ] 4 | command $lspath $argv 5 | return 6 | end 7 | command $lspath $__fish_ls_color_opt $argv 8 | end 9 | -------------------------------------------------------------------------------- /.config/fish/functions/nvm.fish: -------------------------------------------------------------------------------- 1 | function nvm 2 | bass source "$NVM_DIR"/nvm.sh --no-use ';' nvm $argv 3 | end 4 | 5 | -------------------------------------------------------------------------------- /.config/fish/functions/omfpj.fish: -------------------------------------------------------------------------------- 1 | function pj --description "Jump to a project" 2 | set -l argc (count $argv) 3 | 4 | if test (count $PROJECT_PATHS) -eq 0 5 | echo 'Add some directories to the environment variable $PROJECT_PATHS to get started!' 6 | echo ' set -gx PROJECT_PATHS ~/dir1 ~/dir2' 7 | return 1 8 | 9 | else if test $argc -le 0 -o $argc -gt 2 10 | echo 'Usage: pj [open] [PROJECT]' 11 | return 1 12 | 13 | else if test $argc -eq 2 -a $argv[1] != 'open' 14 | echo 'Usage: pj [open] [PROJECT]' 15 | return 1 16 | 17 | else if contains -- --help $argv 18 | echo 'Usage: pj [open] [PROJECT]' 19 | 20 | else if test $argv[1] = "open" 21 | set -l target (find $PROJECT_PATHS -maxdepth 1 -name $argv[2] | head -n 1) 22 | 23 | if test -n "$target" 24 | cd $target 25 | eval $EDITOR $target 26 | else 27 | echo "No such project: $argv[2]" 28 | return 1 29 | end 30 | 31 | else 32 | set -l target (find $PROJECT_PATHS -maxdepth 1 -name $argv[1] | head -n 1) 33 | 34 | if test -n "$target" 35 | cd $target 36 | else 37 | echo "No such project: $argv[1]" 38 | return 1 39 | end 40 | end 41 | end 42 | 43 | function __project_basenames --description "List of project basenames" 44 | set -l project_basenames 45 | 46 | for pp in $PROJECT_PATHS 47 | set -l contains_files (ls -A $pp 2>/dev/null) 48 | 49 | if test -n "$contains_files" 50 | set -a project_basenames (basename $pp) 51 | for project in (ls -d $pp/*/) 52 | set -a project_basenames (basename $project) 53 | end 54 | end 55 | end 56 | 57 | echo $project_basenames 58 | end 59 | -------------------------------------------------------------------------------- /.config/fish/functions/ranger.fish: -------------------------------------------------------------------------------- 1 | function ranger --description 'alias ranger=TERM=xterm-kitty env ranger' 2 | set path (which ranger) 3 | if test -z "$TMUX" 4 | TERM=xterm-kitty $path $argv 5 | else 6 | $path $argv 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /.config/fish/functions/read_confirm.fish: -------------------------------------------------------------------------------- 1 | function read_confirm 2 | while true 3 | read -l -P "$argv[1] [y/N] " confirm 4 | 5 | switch $confirm 6 | case Y y 7 | return 0 8 | case '' N n 9 | return 1 10 | end 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /.config/fish/functions/rm.fish: -------------------------------------------------------------------------------- 1 | function rm --wraps=trash --description 'alias rm=trash' 2 | if command -sq trash 3 | trash $argv; 4 | else 5 | set rmpath (which rm) 6 | $rmpath $argv; 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /.config/fish/themes/mocha.theme: -------------------------------------------------------------------------------- 1 | # name: 'mocha' 2 | # url: 'https://github.com/catppuccin/fish' 3 | # preferred_background: 1e1e2e 4 | 5 | # customized 6 | 7 | fish_color_normal cdd6f4 8 | fish_color_command 89b4fa 9 | fish_color_param 94e2d5 # flamingo->teal 10 | fish_color_keyword f38ba8 11 | fish_color_quote f9e2af # green->yellow 12 | fish_color_redirection 74c7ec --bold # pink->sapphire 13 | fish_color_end fab387 14 | fish_color_comment a6adc8 # overlay 1 -> subtext 0 15 | fish_color_error f38ba8 16 | fish_color_gray 6c7086 17 | fish_color_selection --background=45475a # surface 0->1 18 | fish_color_search_match --background=45475a # surface 0->1 19 | fish_color_option 74c7ec # green->sapphire 20 | fish_color_operator f5c2e7 21 | fish_color_escape eba0ac 22 | fish_color_autosuggestion 6c7086 23 | fish_color_cancel f38ba8 24 | fish_color_cwd f9e2af 25 | fish_color_user 94e2d5 26 | fish_color_host 89b4fa 27 | fish_color_host_remote a6e3a1 28 | fish_color_status f38ba8 29 | fish_pager_color_progress 6c7086 30 | fish_pager_color_prefix 89b4fa --underline # pink -> blue 31 | fish_pager_color_completion cdd6f4 32 | fish_pager_color_description f9e2af # overlay 0 -> yellow 33 | 34 | # vim:ft=fish 35 | -------------------------------------------------------------------------------- /.config/helix/config.toml: -------------------------------------------------------------------------------- 1 | theme = "catppuccin_mocha" 2 | 3 | [editor] 4 | line-number = "relative" 5 | bufferline = "multiple" 6 | color-modes = true 7 | auto-completion = false 8 | completion-trigger-len = 1 9 | insert-final-newline = false 10 | scroll-lines = 1 11 | scrolloff = 0 12 | idle-timeout = 1000 13 | soft-wrap.enable = true 14 | 15 | # Features 16 | [editor.file-picker] 17 | hidden = false 18 | 19 | # UI 20 | [editor.cursor-shape] 21 | insert = "bar" 22 | normal = "block" 23 | 24 | [editor.whitespace.render] 25 | tab = "all" 26 | nbsp = "all" 27 | 28 | [editor.whitespace.characters] 29 | space = "·" 30 | nbsp = "⍽" 31 | tab = "→" 32 | tabpad = " " 33 | 34 | [editor.indent-guides] 35 | render = true 36 | 37 | [editor.statusline] 38 | left = ["mode", "spinner", "file-name", "read-only-indicator", "file-modification-indicator"] 39 | center = ["register"] 40 | right = ["diagnostics", "selections", "position-percentage", "file-encoding", "file-line-ending"] 41 | mode.normal = "N" 42 | mode.insert = "I" 43 | mode.select = "S" 44 | 45 | # KEYBINDINGS 46 | [keys.normal] 47 | G = [ "goto_last_line", "goto_line_end" ] 48 | 49 | "\\" = "shell_keep_pipe" 50 | "$" = [ "select_mode", "goto_line_end", "normal_mode" ] 51 | "0" = [ "select_mode", "goto_line_start", "normal_mode" ] 52 | 53 | "C" = [ "select_mode", "goto_line_end", "normal_mode", "change_selection" ] 54 | "C-/" = "toggle_comments" 55 | "C-c" = "copy_selection_on_next_line" 56 | 57 | "D" = [ "select_mode", "goto_line_end", "normal_mode", "delete_selection" ] 58 | 59 | "A-`" = "switch_case" 60 | "~" = "switch_to_uppercase" # shift-` 61 | 62 | [keys.normal.space] 63 | w = ":write" 64 | q = ":quit-all" 65 | x = ":write-quit-all" 66 | 67 | [keys.select] 68 | o = "flip_selections" 69 | 70 | # Emacs 71 | [keys.insert] 72 | "C-a" = [ "goto_line_start" ] 73 | "C-e" = [ "goto_line_end", "move_char_right" ] 74 | "C-p" = "move_visual_line_up" 75 | "C-n" = "move_visual_line_down" 76 | "C-b" = "move_char_left" 77 | "C-f" = "move_char_right" 78 | -------------------------------------------------------------------------------- /.config/helix/languages.toml: -------------------------------------------------------------------------------- 1 | [language-server.ccls] 2 | command = "ccls" 3 | args = [] 4 | config = {} 5 | environment = {} 6 | 7 | [language-server.clangd] 8 | command = "/opt/homebrew/opt/llvm@16/bin/clangd" 9 | 10 | [[language]] 11 | name = "cpp" 12 | #language-servers = [ "ccls" ] 13 | formatter = { command = "clang-format", args = ["--fallback-style=Google"] } 14 | 15 | [[language]] 16 | roots = [] 17 | name = "cognate" 18 | scope = "source.cog" 19 | injection-regex = "cognate" 20 | file-types = ["cog"] 21 | comment-token = "~~" 22 | #block-comment-tokens = { start = "~", end = "~" } 23 | indent = { tab-width = 4, unit = "\t" } 24 | 25 | [[grammar]] 26 | name = "cognate" 27 | source = { path = "/Users/hedy/projects/tree-sitter-cognate/", rev = "main" } 28 | 29 | [[language]] 30 | name = "typescript" 31 | shebangs = ["deno"] 32 | roots = ["deno.json", "deno.jsonc", "package.json"] 33 | auto-format = true 34 | language-servers = ["deno-lsp"] 35 | 36 | [language-server.deno-lsp] 37 | command = "deno" 38 | args = ["lsp"] 39 | 40 | [language-server.deno-lsp.config.deno] 41 | enable = true 42 | unstable = true 43 | suggest.imports.hosts = { "https://deno.land" = true } 44 | inlayHints.parameterNames.enabled = "all" 45 | inlayHints.parameterTypes.enabled = true 46 | inlayHints.variableTypes.enabled = true 47 | inlayHints.propertyDeclarationTypes.enabled = true 48 | inlayHints.functionLikeReturnTypes.enabled = true 49 | inlayHints.enumMemberValues.enabled = true 50 | -------------------------------------------------------------------------------- /.config/helix/themes/custom_gh_contrast.toml: -------------------------------------------------------------------------------- 1 | inherits = "github_dark_high_contrast" 2 | 3 | [palette] 4 | "fg.muted" = "#9ea1a3" 5 | -------------------------------------------------------------------------------- /.config/kitty/dracula.conf: -------------------------------------------------------------------------------- 1 | # https://draculatheme.com/kitty 2 | # 3 | # Installation instructions: 4 | # 5 | # cp dracula.conf ~/.config/kitty/ 6 | # echo "include dracula.conf" >> ~/.config/kitty/kitty.conf 7 | # 8 | # Then reload kitty for the config to take affect. 9 | # Alternatively copy paste below directly into kitty.conf 10 | 11 | foreground #f8f8f2 12 | background #282a36 13 | selection_foreground #ffffff 14 | selection_background #44475a 15 | 16 | url_color #8be9fd 17 | 18 | # black 19 | color0 #21222c 20 | color8 #6272a4 21 | 22 | # red 23 | color1 #ff5555 24 | color9 #ff6e6e 25 | 26 | # green 27 | color2 #50fa7b 28 | color10 #69ff94 29 | 30 | # yellow 31 | color3 #f1fa8c 32 | color11 #ffffa5 33 | 34 | # blue 35 | color4 #bd93f9 36 | color12 #d6acff 37 | 38 | # magenta 39 | color5 #ff79c6 40 | color13 #ff92df 41 | 42 | # cyan 43 | color6 #8be9fd 44 | color14 #a4ffff 45 | 46 | # white 47 | color7 #f8f8f2 48 | color15 #ffffff 49 | 50 | # Cursor colors 51 | cursor #f8f8f2 52 | cursor_text_color background 53 | 54 | # Tab bar colors 55 | active_tab_foreground #282a36 56 | active_tab_background #f8f8f2 57 | inactive_tab_foreground #282a36 58 | inactive_tab_background #6272a4 59 | 60 | # Marks 61 | mark1_foreground #282a36 62 | mark1_background #ff5555 63 | 64 | # Splits/Windows 65 | active_border_color #f8f8f2 66 | inactive_border_color #6272a4 67 | -------------------------------------------------------------------------------- /.config/kitty/kitty.conf: -------------------------------------------------------------------------------- 1 | # THEME 2 | include mocha.conf 3 | 4 | # FONT 5 | disable_ligatures always 6 | include font.conf 7 | 8 | # TAB BAR 9 | # Minimalist: 10 | # No bg colors, no styling, no fancy unicode. Just the title and the active 11 | # tab indication. 12 | tab_bar_style separator 13 | tab_separator "" 14 | tab_bar_edge top 15 | tab_bar_align center 16 | tab_bar_margin_width 0.0 17 | # Feels as if the tag bar is floating in the *air of squishy satisfying terminal backdrops* 18 | tab_bar_margin_height 10.0 10.0 19 | # fg is a lighter adjustment of dracula "comment" color - more readable 20 | tab_title_template "{fmt.fg._9cb6d9}{fmt.bg.default}{bell_symbol}{activity_symbol} {f'{title[:9]}…{title[-6:]}' if title.rindex(title[-1]) + 1 > 25 else title} " 21 | # fg is dracula white color 22 | active_tab_title_template "{fmt.fg._f8f8f2}{fmt.bg.default}{bell_symbol}{activity_symbol} {f'{title[:9]}…{title[-6:]}' if title.rindex(title[-1]) + 1 > 25 else title} " 23 | active_tab_font_style bold 24 | inactive_tab_font_style normal 25 | tab_bar_background none 26 | 27 | # I rarely need this to navigate tabs from within kitty so I'd rather make use 28 | # of these mappings in the specific TUIs instead. 29 | map ctrl+tab no_op 30 | map ctrl+shift+tab no_op 31 | map ctrl+shift+r no_op 32 | 33 | # Source this last so it can override any settings above 34 | include local.conf 35 | 36 | # windows (not the os) 37 | map cmd+shift+down resize_window taller 3 38 | map cmd+shift+up resize_window shorter 3 39 | map f5 launch --location=hsplit --cwd=current 40 | -------------------------------------------------------------------------------- /.config/kitty/mac-font.conf: -------------------------------------------------------------------------------- 1 | # Fira Code 2 | #font_size 17 3 | #font_family Fira Code Retina 4 | 5 | # Jetbrains Mono 6 | font_family family="JetBrains Mono" 7 | font_size 17 8 | modify_font cell_height +1px 9 | bold_font auto 10 | italic_font auto 11 | bold_italic_font auto 12 | 13 | # IBM Plex 14 | font_family family="IBM Plex Mono" 15 | font_size 17 16 | modify_font cell_height +3px 17 | bold_font auto 18 | italic_font auto 19 | bold_italic_font auto 20 | 21 | # Source Code Pro 22 | #font_family family="Source Code Pro" 23 | #bold_font auto 24 | #italic_font auto 25 | #bold_italic_font auto 26 | 27 | # Use Symbols Only from Nerd Font releases page 28 | # https://github.com/ryanoasis/nerd-fonts/releases 29 | # Kitty recommends against patched fonts 30 | # (I agree since I prefer the original Fira Code Retina.) 31 | # Kitty picks up the symbols automatically and nvim-web-devicons should work. 32 | # If not, good luck 33 | 34 | #  35 | #  36 | symbol_map U+ed00 Dotslash-Extras 37 | symbol_map U+ed01 Dotslash-Extras-Test 38 | # Nerd Fonts v2.3.3 39 | symbol_map U+23FB-U+23FE,U+2665,U+26A1,U+2B58,U+E000-U+E00A,U+E0A0-U+E0A3,U+E0B0-U+E0D4,U+E200-U+E2A9,U+E300-U+E3E3,U+E5FA-U+E6AA,U+E700-U+E7C5,U+EA60-U+EBEB,U+F000-U+F2E0,U+F300-U+F32F,U+F400-U+F4A9,U+F500-U+F8FF,U+F0001-U+F1AF0 Symbols Nerd Font Mono 40 | -------------------------------------------------------------------------------- /.config/kitty/mocha.conf: -------------------------------------------------------------------------------- 1 | # vim:ft=toml 2 | 3 | # NOTE: Some 256colors are adjusted 4 | 5 | ## name: Catppuccin Kitty Mocha 6 | ## author: Catppuccin Org 7 | ## license: MIT 8 | ## upstream: https://github.com/catppuccin/kitty/blob/main/themes/mocha.conf 9 | ## blurb: Soothing pastel theme for the high-spirited! 10 | 11 | 12 | 13 | # The basic colors 14 | foreground #cdd6f4 15 | background #1e1e2e 16 | selection_foreground #ffffff 17 | selection_background #44475a 18 | 19 | # Cursor colors 20 | cursor #f5e0dc 21 | cursor_text_color #1e1e2e 22 | 23 | # URL underline color when hovering with mouse 24 | url_color #f5e0dc 25 | 26 | # Kitty window border colors 27 | active_border_color #b4befe 28 | inactive_border_color #6c7086 29 | bell_border_color #f9e2af 30 | 31 | # OS Window titlebar colors 32 | wayland_titlebar_color system 33 | macos_titlebar_color system 34 | 35 | # Tab bar colors 36 | active_tab_foreground #11111b 37 | active_tab_background #cba6f7 38 | inactive_tab_foreground #cdd6f4 39 | inactive_tab_background #181825 40 | tab_bar_background #11111b 41 | 42 | # Colors for marks (marked text in the terminal) 43 | mark1_foreground #1e1e2e 44 | mark1_background #b4befe 45 | mark2_foreground #1e1e2e 46 | mark2_background #cba6f7 47 | mark3_foreground #1e1e2e 48 | mark3_background #74c7ec 49 | 50 | # The 16 terminal colors 51 | 52 | # black 53 | color0 #1e1e2e 54 | # red 55 | color1 #f38ba8 56 | # green 57 | color2 #a6e3a1 58 | # yellow 59 | color3 #f9e2af 60 | # dark blue - blue 61 | color4 #89b4fa 62 | # purple - mauve 63 | color5 #cba6f7 64 | # teal 65 | color6 #94e2d5 66 | # silver - subtext 1 67 | color7 #bac2de 68 | # grey (darker than silver) - surface 1 69 | color8 #45475a 70 | # bright red - maroon 71 | color9 #eba0ac 72 | # lime (bright green) - sky 73 | color10 #89dceb 74 | # bright yellow - (repeated) yellow 75 | color11 #f9e2af 76 | # medium blue - blue 77 | color12 #89b4fa 78 | # fuchsia (bright magenta) - pink 79 | color13 #f5c2e7 80 | # bright cyan - sapphire 81 | color14 #74c7ec 82 | # white - text 83 | color15 #cdd6f4 84 | -------------------------------------------------------------------------------- /.config/nushell/config.nu: -------------------------------------------------------------------------------- 1 | # Nu ############################################# 2 | $env.config = { 3 | show_banner: false 4 | history: { 5 | max_size: 100_000 6 | sync_on_enter: true 7 | file_format: "sqlite" 8 | # Use current shell session when up/down'ing history 9 | isolation: true 10 | } 11 | edit_mode: vi 12 | cursor_shape: { 13 | emacs: blink_line 14 | vi_insert: line 15 | vi_normal: block 16 | } 17 | color_config: { 18 | shape_filepath: cyan_underline 19 | shape_directory: green_underline 20 | shape_string: yellow 21 | shape_globpattern: blue 22 | shape_flag: green 23 | 24 | shape_externalarg: cyan 25 | shape_external: blue 26 | 27 | shape_internalcall: light_purple 28 | shape_keyword: purple_bold 29 | } 30 | menus: [ 31 | # Adjust prompt marker and colors for some menus 32 | { 33 | name: completion_menu 34 | only_buffer_difference: false 35 | marker: "> " 36 | type: { 37 | layout: columnar 38 | columns: 4 39 | col_padding: 2 40 | } 41 | style: { 42 | text: white 43 | selected_text: { attr: r } 44 | description_text: cyan 45 | match_text: { attr: b } 46 | selected_match_text: { attr: br } 47 | } 48 | } 49 | { 50 | name: history_menu 51 | only_buffer_difference: true 52 | marker: "> " 53 | type: { 54 | layout: list 55 | page_size: 10 56 | } 57 | style: { 58 | text: cyan 59 | selected_text: cyan_reverse 60 | description_text: white 61 | } 62 | } 63 | ] 64 | keybindings: [ 65 | # Add alt-* bindings, it's easier to reach on some keyboards than ctrl 66 | { 67 | name: alt_backspace 68 | modifier: alt 69 | keycode: backspace 70 | mode: [emacs, vi_insert, vi_normal] 71 | event: { edit: backspaceword } 72 | } 73 | { 74 | name: alt_left 75 | modifier: alt 76 | keycode: left 77 | mode: [emacs, vi_insert, vi_normal] 78 | event: { edit: movewordleft } 79 | } 80 | { 81 | name: alt_right 82 | modifier: alt 83 | keycode: right 84 | mode: [emacs, vi_insert, vi_normal] 85 | event: { edit: movewordright } 86 | } 87 | ] 88 | } 89 | 90 | # Basics ######################################### 91 | # Nu does not support sourcing inside blocks without creating closures. 92 | # https://github.com/nushell/nushell/issues/8668 93 | # 94 | # If ~/.aliases.nu does not exist, I'll just have to remember to `dot gen nu` 95 | source ~/.aliases.nu 96 | 97 | # Functions ###################################### 98 | module functions { 99 | # Change to a project directory 100 | export def --env pj [ 101 | path?: string@pj_complete # /$PROJECTS_ROOT/[project/path/here] 102 | ]: nothing -> nothing { 103 | cd $"(pj_root)/($path)" 104 | } 105 | 106 | def pj_root [] { 107 | if $env.PROJECTS_ROOT == null { 108 | ~/projects 109 | } else { 110 | $env.PROJECTS_ROOT | str trim --right --char '/' 111 | } 112 | } 113 | 114 | def pj_complete [ctx: string] { 115 | # Nushell doesn't seem to support passing in a parsed arg list instead, 116 | # but I'll hope args are checked against command signature before 117 | # calling the completion function. 118 | mut prefix = ($ctx | str trim | str substring 2.. | split row -r '\s+' | last) 119 | if ($prefix | str starts-with '/') { 120 | return [] 121 | } 122 | 123 | if ($prefix != '') and not ($prefix | str ends-with '/') { 124 | if ($"(pj_root)/($prefix)" | path exists) { 125 | return [$"($prefix)/"] 126 | } else { 127 | $prefix = ($prefix | path dirname) 128 | } 129 | } 130 | let search = $"(pj_root)/($prefix)" 131 | ls $search | where type == dir | get name | str replace $search $prefix 132 | } 133 | } 134 | 135 | use functions * 136 | -------------------------------------------------------------------------------- /.config/nushell/env.nu: -------------------------------------------------------------------------------- 1 | # Nu ############################################# 2 | # Prompt with shortened path and exit code 3 | def create_left_prompt [] { 4 | let path_color = (if (is-admin) { ansi red } else { ansi green }) 5 | let last_path_color = (if (is-admin) { ansi red_bold } else { ansi blue }) 6 | let separator_color = (ansi white) 7 | let path_segment = do { 8 | # "~/path/to/dir>" OR " ~>" 9 | let dirs = ( 10 | if ($env.PWD != $env.HOME) { 11 | ($env.PWD | str replace $env.HOME '~') 12 | } else {' ~'} 13 | ) 14 | # Shorten some parts and apply highlights 15 | let parts = ($dirs | path split) 16 | let last = ($parts | length) - 1 17 | # For each part of the path except last 18 | $parts | drop 1 | enumerate | each { |p| 19 | let this = ( 20 | if ($last in 4..) and ($p.index == $last - 1) { 21 | $p.item # ~/1/2/[33]/44, ~/1/2/3/[44]/55 22 | } else if ($last == 1) { 23 | $p.item # ~/[11] 24 | } else { 25 | $p.item | str substring 0..1 26 | } 27 | ) 28 | ([$path_color $this $separator_color (char path_sep)] | str join) 29 | } | append [$last_path_color ($parts | get $last)] | str join 30 | } 31 | let last_exit_code = ( 32 | if ($env.LAST_EXIT_CODE != 0) { 33 | $"(ansi rb)[($env.LAST_EXIT_CODE)](ansi reset)" 34 | } else { "" } 35 | ) 36 | 37 | ([$path_segment $last_exit_code (ansi reset)] | str join) 38 | } 39 | 40 | $env.PROMPT_COMMAND = { create_left_prompt } 41 | $env.PROMPT_COMMAND_RIGHT = { 42 | $"(ansi xterm_grey35)($env.USER)@(hostname) (^date '+%H:%M:%S')" 43 | } 44 | 45 | $env.PROMPT_INDICATOR = {|| $"(ansi reset)> " } 46 | $env.PROMPT_INDICATOR_VI_INSERT = $env.PROMPT_INDICATOR 47 | $env.PROMPT_INDICATOR_VI_NORMAL = {|| $"(ansi yellow_reverse)>(ansi reset) " } 48 | $env.PROMPT_MULTILINE_INDICATOR = {|| "::: " } 49 | 50 | # Env ############################################ 51 | # TODO: Path and envs, if/when nu is no longer run from fish 52 | # dotscripts/gen/nu 53 | # - Loop through `dotscripts/convert/addpath ' '` 54 | # use path add from std module to append 55 | # - Loop through ~/.exportenvs 56 | # set $env. 57 | # 58 | # here 59 | # - source the generated files 60 | -------------------------------------------------------------------------------- /.config/nvim/README.norg: -------------------------------------------------------------------------------- 1 | * Welcome to my nvim config! 2 | 3 | - Plugin manager: Lazy 4 | -- Plugin spec: `./lua/plugin_spec.lua` 5 | -- Modular plugin configuration: `./lua/plugins/*.lua` 6 | - LSP & Completion 7 | -- `lsp-config`, `lspkind`, `lsp_signature` 8 | -- `nvim-cmp` 9 | -- Treesitter: context + textobjects 10 | - Status line: NONE 11 | -- Ruler area when there's only one window 12 | -- Together with incline.nvim when there are splits 13 | - Theme: Tundra 14 | - File explorer: NvimTree 15 | 16 | ** Files 17 | 18 | - `init.lua`: Entry point, sets some primitive settings and calls modular 19 | configuration in `./lua/` 20 | - `./lua` 21 | -- general: Your usual vimrc content (`set blah`) 22 | -- mappings: Keymaps that unrelated to plugins 23 | -- autocmds: Also unrelated to plugins 24 | -- loadlazy: Bootstrap and set up Lazy.nvim (Lazy) 25 | -- plugin_spec: List of plugins used by Lazy 26 | -- `./lua/plugins`- Some plugins that require slightly more configuration 27 | than a ~5 liner `.setup()` call. 28 | 29 | ** A note regarding Emacs 30 | 31 | Let's talk about neovim as an emacs user. 32 | 33 | *** The good 34 | 35 | I miss Vertico and Consult from emacs! 36 | 37 | Telescope.nvim is far from a consult-equivalent for the time being. 38 | 39 | Neogit, however, is good enough a replacement for magit for my needs. 40 | 41 | Neorg is not as mature as Org-mode, but I like the ideas there and is 42 | currently enough for my needs. 43 | 44 | SVG-based icons and SVG latex previews are both wonderful things that just 45 | cannot be replicated in neovim as a terminal program. It feels rather bloat 46 | to have to install the entire symbol set as Nerd Fonts and having to 47 | configure your terminal correctly so they can be displayed. SVG icons, on 48 | the other hand, offer much more flexibility and predictability. 49 | 50 | I also miss Emacs's calc. 51 | 52 | *** The not so good 53 | 54 | As someone who prefers C-like syntax over the Lisp/Scheme-family's, lua is 55 | a breeze to write and configure. Lazy.nvim and neovim-lua plugins are 56 | easier and more predictable to configure than emacs use-package, for me. 57 | 58 | With people's mixed feeling on Custom.el and the ins and outs of face 59 | attributes, it's much easier to work with Vim/Neovim's `highlight` command 60 | instead. However one could argue that this may in part be due to emacs being 61 | a GUI program, hence more complex to configure the UI side of things. 62 | 63 | Vim/Neovim buffers are easier to work with. 64 | 65 | Terminal emulation in Neovim just, well, works. In emacs we have various 66 | different options each with their advantages and disadvantages, then 67 | there's eshell, which IMO is pretty cool but I'm still failing to have 68 | eshell work with EAT as of writing. Is this also due to Emacs being GUI and 69 | Vim/Neovim being TUI? 70 | 71 | **** Emacs for everything? 72 | 73 | I'm personally more used to the workflow where one operates primarily on 74 | the command line, and when file editing is needed, launch an editor, then 75 | close it when editing is complete. 76 | 77 | I see how the possibily of being able to replace many of our common apps 78 | with emacs could be attractive, however I didn't really see any immediate 79 | benefits of using emacs-equivelents over more "mainstream" apps that "just 80 | do their thing", other than being available on emacs. In other words, IRC 81 | on erc, emails on mu4e, gemini/gopher on elpher don't really have much of a 82 | problem in terms of usability, but they aren't as good as say weechat, 83 | aerc, lagrange respectively since they require extra configuration to work 84 | properly and I don't really see a need to have the ability to check my 85 | mails along side a coding buffer. 86 | 87 | Maybe I'll understand the benefits or have the needs someday, but for now 88 | they are extra cherries on top and not must-haves. 89 | 90 | 91 | ** Philosophy / Choices / UI 92 | 93 | Anyway, let's get back to discussing neovim. 94 | 95 | neovim version: 0.9 96 | 97 | - UI 98 | -- No fancy UI like message popups. What are we in? GUI? 99 | -- Area of main source (code) should be as tall as possible on a laptop, 100 | this means sparingly little tabline/winbar or high cmdheight. 101 | -- Completion is turned off by default. This allows distraction free 102 | typing. The menu can be triggered with TAB. Unfortunately, nvim-cmp does 103 | not yet support ghost text + manual completion, unlike my emacs config 104 | (with corfu-candidate-overlay). 105 | 106 | - Icons 107 | -- Icons make things concise, but they shouldn't be overused! 108 | -- Strive for a balance between conciseness and compatibility 109 | 110 | - Colors 111 | -- No fancy colors nor eye candy, only colors for semantics (see 112 | `lua/plugins/tundra.lua`) 113 | -- Not too many variations of colors, we can use different shades instead. 114 | -- Enough contrast where applicable to discern UI elements 115 | 116 | - Plugins 117 | -- Preferably plugins with enough customizability but without feature-creep 118 | 119 | ** Meta todo 120 | 121 | - Emacs 122 | -- ( ) Talk about lazy.nvim/packer vs elpaca/straight + use-package 123 | 124 | ** Neovim todo 125 | 126 | - 'Statusline' set up 127 | -- ( ) Add diagnostics to incline and ruler 128 | -- ( ) Find a way to make ruler behave properly 129 | -- ( ) Look into nougat 130 | -------------------------------------------------------------------------------- /.config/nvim/ftdetect/moon.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd( 2 | { "BufNewFile", "BufRead" }, 3 | { pattern = "*.moon", command = "set filetype=moon" } 4 | ) 5 | -------------------------------------------------------------------------------- /.config/nvim/ftdetect/scd.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd( 2 | { "BufNewFile", "BufRead" }, 3 | { pattern = "*.scd", command = "set filetype=scdoc" } 4 | ) 5 | -------------------------------------------------------------------------------- /.config/nvim/ftdetect/slo.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd( 2 | { "BufNewFile", "BufRead" }, 3 | { pattern = "*.slo", command = "set filetype=slope" } 4 | ) 5 | -------------------------------------------------------------------------------- /.config/nvim/ftplugin/go.lua: -------------------------------------------------------------------------------- 1 | vim.opt_local.expandtab = false 2 | -------------------------------------------------------------------------------- /.config/nvim/ftplugin/lua.lua: -------------------------------------------------------------------------------- 1 | vim.opt_local.tabstop = 2 2 | vim.opt_local.softtabstop = 2 3 | vim.opt_local.shiftwidth = 2 4 | -------------------------------------------------------------------------------- /.config/nvim/ftplugin/markdown.lua: -------------------------------------------------------------------------------- 1 | vim.bo.shiftwidth=2 2 | vim.bo.textwidth=80 3 | vim.bo.wrapmargin=80 4 | -------------------------------------------------------------------------------- /.config/nvim/ftplugin/vim.lua: -------------------------------------------------------------------------------- 1 | vim.opt_local.shiftwidth=2 2 | vim.opt_local.tabstop=2 3 | -------------------------------------------------------------------------------- /.config/nvim/init.lua: -------------------------------------------------------------------------------- 1 | vim.g.mapleader = [[ ]] 2 | -- vim.g.maplocalleader = [[;]] 3 | -- See my vim config comment on me being stupid enough to not 4 | -- have known f, t, F, T and ';' 😔 5 | 6 | -- Set envvar VIMHOME to, eg, ~/.config/nvim (has no trailing slash) 7 | vim.env.VIMHOME = vim.fn.expand(':p:h') 8 | 9 | vim.g.loaded_netrw = 1 10 | vim.g.loaded_netrwPlugin = 1 11 | 12 | require('loadlazy') 13 | 14 | require('config/general') 15 | require('config/mappings') 16 | require('config/autocmds') 17 | -------------------------------------------------------------------------------- /.config/nvim/lua/archive/statusline.lua: -------------------------------------------------------------------------------- 1 | -- NOTE that I no longer use lualine (or any statusline at all) 2 | --- Helpers for status line components --- 3 | -- local function lineinfo() 4 | -- local total = tostring(vim.fn.line('$')) 5 | -- -- Left pad the current line count to max width of this value, to avoid jittering 6 | -- return string.format("%"..total:len().."d", vim.fn.line('.'))..'/'..total 7 | -- end 8 | 9 | local function mode_fmt(str) 10 | if str == "NORMAL" then 11 | return "./" 12 | elseif str == "INSERT" then 13 | return "i " 14 | elseif str == "COMMAND" then 15 | return ":>" 16 | elseif str == "VISUAL" then 17 | return "v " 18 | elseif str == "V-BLOCK" then 19 | return "^v" 20 | elseif str == "V-LINE" then 21 | return "VL" 22 | elseif str == "TERMINAL" then 23 | return ":D" 24 | elseif str == "REPLACE" then 25 | return "R " 26 | elseif str == "SUBSTITUTE" then 27 | return "SB" 28 | elseif str == "SELECT" then 29 | return "SL" 30 | end 31 | return str 32 | end 33 | 34 | local diagnostics_config = { 35 | 'diagnostics', 36 | symbols = {error = '', warn = '', info = 'I:', hint = 'H:'}, 37 | } 38 | 39 | local competitest_line = { 40 | filetypes = {'CompetiTest'}, 41 | inactive_sections = { 42 | lualine_c = { function() 43 | return vim.b.competitest_title or 'CompetiTest' 44 | end }, 45 | }, 46 | } 47 | 48 | --- Theme --- 49 | -- https://github.com/sam4llis/nvim-tundra/blob/main/lua/lualine/themes/tundra.lua 50 | local cp = require('nvim-tundra.palette.arctic') 51 | local tundra_lualine = { 52 | normal = { 53 | a = { fg = cp.gray._300, bg = cp.gray._700, gui = 'bold' }, 54 | b = { fg = cp.gray._300, bg = cp.gray._800, gui = 'bold' }, 55 | c = { fg = cp.gray._300, bg = cp.gray._800 }, 56 | }, 57 | 58 | insert = { 59 | a = { fg = cp.sand._500, bg = cp.gray._700, gui = 'bold' }, 60 | b = { fg = cp.gray._700, bg = cp.gray._700, gui = 'bold' }, 61 | c = { fg = cp.gray._300, bg = cp.gray._800 }, 62 | }, 63 | 64 | visual = { 65 | a = { fg = cp.gray._300, bg = cp.green._900, gui = 'bold' }, 66 | b = { fg = cp.green._900, bg = cp.transparent, gui = 'bold' }, 67 | }, 68 | 69 | replace = { 70 | a = { fg = cp.gray._300, bg = cp.red._800, gui = 'bold' }, 71 | b = { fg = cp.red._800, bg = cp.transparent, gui = 'bold' }, 72 | }, 73 | 74 | command = { 75 | a = { fg = cp.indigo._500, bg = cp.gray._600, gui = 'bold' }, 76 | b = { fg = cp.gray._600, bg = cp.transparent, gui = 'bold' }, 77 | }, 78 | 79 | -- visual_select = { 80 | -- a = { fg = cp.gray._200, bg = cp.sand._500, gui = 'bold' }, 81 | -- b = { fg = cp.gray._600, bg = cp.transparent, gui = 'bold' }, 82 | -- }, 83 | } 84 | 85 | local lualine = require('lualine') 86 | lualine.setup { 87 | options = { 88 | icons_enabled = true, 89 | -- theme = 'auto', 90 | theme = tundra_lualine, 91 | component_separators = { left = '', right = ''}, 92 | section_separators = { left = '', right = ''}, 93 | disabled_filetypes = { 94 | statusline = {}, 95 | winbar = {}, 96 | }, 97 | ignore_focus = {'CompetiTest'}, 98 | always_divide_middle = true, 99 | globalstatus = false, 100 | refresh = { 101 | statusline = 1000, 102 | tabline = 1000, 103 | winbar = 1000, 104 | } 105 | }, 106 | sections = { 107 | }, 108 | inactive_sections = { 109 | -- lualine_a = {}, 110 | -- lualine_b = {'branch', 'diff'}, 111 | -- lualine_c = {'filename'}, 112 | -- lualine_x = { diagnostics_config }, 113 | -- lualine_y = {'searchcount'}, 114 | -- lualine_z = {}, 115 | }, 116 | tabline = { 117 | lualine_a = {{ 'mode', fmt = mode_fmt }}, 118 | lualine_b = {}, 119 | lualine_c = { 120 | { 'buffers', 121 | mode = 4, 122 | hide_filename_extension = true, 123 | buffers_color = { 124 | -- Same values as the general color option can be used here. 125 | active = 'lualine_z_active', 126 | inactive = 'lualine_c', 127 | }, 128 | symbols = { 129 | modified = '+', -- Text to show when the buffer is modified 130 | alternate_file = '', -- Text to show to identify the alternate file 131 | directory = '', -- Text to show when the buffer is a directory 132 | }, 133 | } 134 | }, 135 | lualine_x = {'diff', 'encoding', { 'fileformat', 136 | icons_enabled = true, 137 | -- symbols = { unix = 'LF', dos = 'CRLF', mac = 'CR', }, 138 | }, 'filetype'}, 139 | lualine_y = {'searchcount'}, 140 | lualine_z = {diagnostics_config}, 141 | }, 142 | winbar = {}, 143 | inactive_winbar = {}, 144 | extensions = {'nvim-tree', competitest_line, 'symbols-outline'}, 145 | } 146 | -------------------------------------------------------------------------------- /.config/nvim/lua/config/autocmds.lua: -------------------------------------------------------------------------------- 1 | local au = function(...) vim.api.nvim_create_autocmd(...) end 2 | -- Return to last edit position when opening files 3 | au("BufReadPost", { 4 | pattern = "*", 5 | command = [[if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]] 6 | }) 7 | 8 | -- File templates 9 | -- VIMHOME is set in init.lua. 10 | au("BufNewFile", { 11 | pattern = "*.*", 12 | command = "silent! execute '0r '.$VIMHOME.'/templates/skeleton.'.expand(\":e\")" 13 | }) 14 | 15 | au("BufEnter", { 16 | pattern = "*", 17 | command = "set cursorline! | set cursorline!" 18 | }) 19 | 20 | vim.filetype.add({ 21 | extension = { 22 | vto = "vento", 23 | } 24 | }) 25 | vim.filetype.add({ 26 | extension = { 27 | v = "v", 28 | }, 29 | filename = { 30 | ['v.mod'] = "v", 31 | } 32 | }) 33 | vim.filetype.add({ 34 | filename = { 35 | ['build.zig.zon'] = "zig", 36 | } 37 | }) 38 | vim.filetype.add({ 39 | filename = { 40 | ['dune'] = "lisp", 41 | ['dune-project'] = "lisp", 42 | } 43 | }) 44 | vim.filetype.add({ 45 | filename = { 46 | ['justfile'] = "just", 47 | } 48 | }) 49 | -------------------------------------------------------------------------------- /.config/nvim/lua/config/general.lua: -------------------------------------------------------------------------------- 1 | local o = vim.opt 2 | 3 | -- can be toggled with rn (see mappings.lua). 4 | -- showing '0' in current row in vim is the most useless thing ever in all 5 | -- software known to humanity. 6 | o.number = true 7 | o.relativenumber = true 8 | 9 | o.mouse = "a" 10 | -- Use select mode when dragging with mouse. 11 | -- This allows IDE-like quick substitution. If I need to use the mouse for 12 | -- visual selection, I can select with mouse, then v 13 | -- See mappings.lua for IDE-like pair wrapping in select mode. (Select text, 14 | -- press an open bracket to have selection be wrapped immediately.) 15 | o.selectmode = "mouse" 16 | 17 | -- Changes to default: 18 | -- - Use vertical in command mode 19 | o.guicursor = "n-v-sm:block,i-ci-ve-c:ver25,r-cr-o:hor20" 20 | 21 | -- o.cursorline = true 22 | -- Cursor line is rather distracting when trying to focus on the code. 23 | -- Especially so when typing in comments -- the background of the cursor line 24 | -- behind the already low-constrast comment fg color makes it hard to read (and 25 | -- write with) <-- this was back when using dracula. 26 | -- 27 | -- If I'm working on something with long lines and I need a visual indicator of 28 | -- alignment I can do visual line then to "blink" the cursor line, or 29 | -- enable this locally. 30 | -- 31 | -- Maybe I'll figure out a way in the future to dynamically enable cursorline 32 | -- when screenline is wrapped. 33 | o.showcmd = true -- show incomplete commands 34 | o.hlsearch = true -- highlight search 35 | o.wildmenu = true -- command line's tab complete in a menu 36 | o.errorbells = false-- no beeps please 37 | o.visualbell = true -- flash screen instead 38 | o.title = true -- set window title to file name 39 | o.incsearch = true -- incrementally find next match while typing search 40 | -- Having scrolloff positive means I can't have cursor at the very top/bottom 41 | -- whilst referring to some content on the other side of the same buffer 42 | o.scrolloff = 0 43 | o.sidescrolloff = 0 44 | o.confirm = true 45 | o.showmatch = true 46 | o.showmode = false -- Don't show messages when switching modes 47 | -- It's such an integral part of (n)vim, I know what I'm doing :) 48 | 49 | o.encoding = "utf-8" 50 | o.matchtime = 1 -- deci second to show matching pair while typing 51 | o.inccommand = "nosplit" -- neovim only 52 | o.autoindent = true 53 | o.fileformat = "unix" 54 | 55 | o.splitbelow = true 56 | o.splitright = true 57 | if vim.fn.has("nvim-0.9") == 1 then 58 | -- Could be potentially dangerous before the exrc PR is merged. 59 | -- In 0.9 they can open files securely using trust DB 60 | o.exrc = true 61 | end 62 | vim.o.autochdir = true 63 | 64 | o.expandtab = true -- AIUI, tab -> spaces 65 | o.softtabstop = 4 -- indent by 4 spaces with tab 66 | o.tabstop = 4 -- show existing tabs with 4 spaces width 67 | o.shiftwidth = 4 -- Put or remove 4 spaces with using < and > 68 | o.smarttab = true -- Delete spaces at tabstop width 69 | o.copyindent = true -- Copy indentation from previous line 70 | o.hidden = true -- Allows switching to another file while current is unsaved. 71 | 72 | o.showcmdloc = "last" 73 | 74 | -- lualine, feline, galaxyline? RULER + inc-line! 75 | -- Used when there is only one horizontal split 76 | o.rulerformat = "%#LineNr#%20(%f %p%%%)" 77 | -- Needed to show "recording @" and other messages until this issue is resolved 78 | -- in neovim core 79 | o.cmdheight = 1 80 | o.laststatus = 0 81 | vim.api.nvim_set_hl(0, 'Statusline', {link = 'Normal'}) 82 | vim.api.nvim_set_hl(0, 'StatuslineNC', {link = 'Normal'}) 83 | o.statusline = '%#WinSeparator#'.. ("─"):rep(vim.api.nvim_win_get_width(0)) .. '%*' 84 | -- Clear cmdline 85 | vim.keymap.set("n", "", "echo") 86 | 87 | -- Show LSP W/E hints on another column next to the line numbers 88 | o.signcolumn = "yes" -- Set to "number" will merge the LSP W/E hints with the number col 89 | 90 | -- Bunch of shit really, spent *hours* trying to get tmux + nvim true colors to work 91 | -- Dracula theme without termguicolors looks like poo; see my vimrc. 92 | o.termguicolors = true 93 | 94 | o.whichwrap:append '<,>,h,l' 95 | 96 | o.foldenable = true 97 | o.foldlevelstart = 10 98 | o.foldnestmax = 10 99 | -- o.foldcolumn = "2" 100 | o.foldmethod = "expr" 101 | o.foldexpr = "nvim_treesitter#foldexpr()" 102 | 103 | o.swapfile = false 104 | -- This is used to control how often to update swap file. Since I don't 105 | -- use swap, I can control CursorHold time with this. 106 | o.updatetime = 3000 107 | o.backup = false 108 | o.undodir = vim.fn.expand("~") .. "/.local/share/nvim/undodir/" 109 | o.undofile = true 110 | 111 | -- Ignore compiled files 112 | o.wildignore = { "*.o", "*~", "*.pyc", "*/.git/*", "*/.hg/*", "*/.svn/*", "*/.DS_Store" } 113 | 114 | -- Not too noisy visually, but visible enough as a reminder. 115 | -- Underlines trailing spaces. 116 | vim.cmd [[ match Underlined '\s\+$' ]] 117 | -------------------------------------------------------------------------------- /.config/nvim/lua/config/mappings.lua: -------------------------------------------------------------------------------- 1 | -- Note that plugins config may set more mappings. 2 | 3 | local silent = { silent = true } 4 | local map = vim.keymap.set 5 | local au = vim.api.nvim_create_autocmd 6 | local function d(s) return { desc = s } end 7 | local function mapbuf(a, b, c) vim.api.nvim_buf_set_keymap(0, a, b, c, { noremap=true }) end 8 | 9 | --------------------- 10 | -- Leader mappings -- 11 | --------------------- 12 | map("n", "rn", "set relativenumber!", d "toggle rel num") 13 | map("n", "z", "zR", d "zA (toggle all folds)") 14 | -- The 3 mappings that I use most often out of all vim mappings :D 15 | map("n", "w", "wecho", d ":w") 16 | map("n", "x", "xa", d ":xa") 17 | map("n", "q", "qa", d ":qa") 18 | map("n", "nh", "noh", d ":noh") 19 | map("n", "p", "\"+p", d "System clipboard paste") 20 | -- Deprecated in favor of telescope registers because you can use to edit 21 | -- select register, how cool is that! 22 | -- map("n", "rg", "registers", d "Show registers, also fR") 23 | map("n", "u", "gul", d "Lower current char") 24 | map("n", "U", "gUl", d "Upper current char") 25 | map("n", "", ":", d "Like @: but does not ") 26 | 27 | ----------------------------------- 28 | -- Normal and Universal Mappings -- 29 | ----------------------------------- 30 | -- Close a buffer, useful when doing PlugInstall and then closing that 31 | -- Or is it close a window? frame? I'll admit all this emacs terminology got me 32 | -- so confused. 33 | map("n", "Q", "q", d":q") 34 | 35 | -- Legacy comment incomming 36 | -- > These mappings Just Work in wsl so no need the extra binding like in vimrc, 37 | -- > this is why you use neovim instead of vim ;) 38 | map("n", "", "m+1==", d "Move line down") 39 | map("n", "", "m-2==", d "Move line up") 40 | map("n", "", "t.==", d "Copy line down") 41 | map("n", "", "t.-1==", d "Copy line up") 42 | 43 | --------------------- 44 | -- Visual mappings -- 45 | --------------------- 46 | -- dot command in visual mode 47 | map("v", ".", "normal.") 48 | 49 | -- Move visual selection 50 | -- FIXME: Not working! 51 | map("v", "J", "m+1gv=gv") 52 | map("v", "K", "m-2gv=gv") 53 | 54 | -- Visual mode pressing * or # searches for the current selection 55 | map("v", "*", "call VisualSelection('', '')/=@/", silent) 56 | map("v", "#", "call VisualSelection('', '')?=@/", silent) 57 | 58 | -- Keep text selected after indentation 59 | -- This is... really useful sometimes but annoying other times 60 | map("v", "<", "", ">gv") 62 | 63 | -- Yet another "modern" IDE-like behavior 64 | map("v", "", "x") 65 | 66 | 67 | -------------------------------- 68 | -- Window/Buffer/Tab mappings -- 69 | -------------------------------- 70 | -- Better way to move between windows 71 | map("", "", "j", d "bottom window") 72 | map("", "", "k", d "top window") 73 | map("", "", "h", d "right window") 74 | map("", "", "l", d "left window") 75 | 76 | -- Managing buffers 77 | -- map("n", "bd", "bd") -- I now use moll/vim-bbye, see plugin_spec.lua 78 | map("n", "bn", "bnext", d "bnext") 79 | map("n", "bp", "bprev", d "bprev") 80 | 81 | -- Useful mappings for managing tabs 82 | -- Tab create 83 | map("n", "tc", "tabnew", d "tabnew") 84 | map("n", "to", "tabonly", d "tabonly") 85 | -- Tab delete 86 | map("n", "td", "tabclose", d "tabclose") 87 | -- I rarely have >3 tabs, let alone organize their placements D but it's here 88 | -- because why not 89 | map("n", "tm", "tabmove", d "tabmove") 90 | -- Switching tabs 91 | map("n", "tn", "tabnext", d "tabnext") 92 | map("n", "tp", "tabprev", d "tabprev") 93 | 94 | 95 | map("", "`", "botright split term://fishresize -7i") 96 | if vim.fn.has("macunix") == 1 then 97 | -- WTF?? (I checked using C-v in insert mode) 98 | -- TODO: Fix in tmux 99 | map("", "", "botright split term://fishresize -7i") 100 | else 101 | map("", "", "botright split term://fishresize -7i", 102 | d "Open terminal below" ) 103 | end 104 | map("t", "", "") 105 | 106 | -------------------------------------- 107 | -- Insert/Command Editting Mappings -- 108 | -------------------------------------- 109 | -- Emacs FTW :) 110 | map({"i", "c"}, "", "") 111 | map({"i", "c"}, "", "") 112 | map({"i", "c"}, "", "") 113 | map({"i", "c"}, "", "") 114 | map({"i", "c"}, "", "") 115 | map({"i", "c"}, "", "") 116 | map("i", "", "0") 117 | -- map("i", "", "$") 118 | map("c", "", "") -- SMH 119 | -- Command mode already supports 120 | map("i", "", "") 121 | 122 | 123 | -------------------------------- 124 | -- Filetype specific mappings -- 125 | -------------------------------- 126 | au("FileType", { 127 | pattern = {"help", "qf"}, 128 | callback = function() mapbuf("n", "q", "q") end 129 | }) 130 | 131 | 132 | -------------------------- 133 | -- Select mode mappings -- 134 | -------------------------- 135 | -- Requires 'mini.surround' for 'sa' and Comment.nvim for 'gb' 136 | map("s", '(', "sa(gvll", {remap = true}) 137 | map("s", ')', "sa)gvll", {remap = true}) 138 | map("s", '[', "sa[gvll", {remap = true}) 139 | map("s", ']', "sa]gvll", {remap = true}) 140 | map("s", '\'', "sa'gvll", {remap = true}) 141 | map("s", '"', 'sa"gvll', {remap = true}) 142 | map("s", '`', "sa`gvll", {remap = true}) 143 | map("s", '', "vgb", {remap = true}) 144 | 145 | -- Select mode tips (:h Select) 146 | -- * Ctrl-G toggles Visual and Select mode 147 | -- * Ctrl-R let's you put what ever you replaced into register 148 | -- Visual mode mappings apply to select mode unless it is a printable character 149 | -- or , or above key sequences and 150 | -- 151 | -- Visual mode tips 152 | -- * You can use 'p' on selection and it will be replaced by paste 153 | -- * 'P' is same except it does not overwrite registers 154 | -- * gn/gN select match 155 | -- * ~ Switch case (or u/U) 156 | -- Visual block 157 | -- * I/A can be used in place of i/a 158 | -- * >/< shift can be used! 159 | 160 | vim.api.nvim_create_user_command('Date', [[exe "r!date '+\\%Y-\\%m-\\%d \\%T'" | normal! kJ]], {}) 161 | -------------------------------------------------------------------------------- /.config/nvim/lua/loadlazy.lua: -------------------------------------------------------------------------------- 1 | -- Bootstrap and set up lazy.nvim 2 | -- Lazy.nvim is one of the things to keeps me from emacs 💔 3 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 4 | if not vim.loop.fs_stat(lazypath) then 5 | vim.fn.system({ 6 | "git", "clone", "--filter=blob:none", 7 | "https://github.com/folke/lazy.nvim.git", "--branch=stable", 8 | lazypath, 9 | }) 10 | end 11 | vim.opt.rtp:prepend(lazypath) 12 | vim.opt.completeopt = { "menu", "noinsert", "noselect", "preview" } 13 | 14 | -- Fix when ft = blah included in plugin spec, syntax not loaded. 15 | vim.cmd [[ 16 | filetype plugin on 17 | filetype indent on 18 | ]] 19 | 20 | require("lazy").setup("plugins", { 21 | install = { 22 | colorscheme = { "tundra" }, 23 | }, 24 | change_detection = { 25 | enabled = true, 26 | notify = false, 27 | }, 28 | ui = { 29 | -- a number <1 is a percentage., >1 is a fixed size 30 | size = { width = 0.8, height = 0.9 }, 31 | border = "rounded", 32 | }, 33 | }) 34 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins.lua: -------------------------------------------------------------------------------- 1 | -- Used by Lazy.nvim in loadlazy.lua 2 | -- 3 | -- These are plugins that don't have their own dedicated config 4 | -- file in plugins/ 5 | return { 6 | -- Use 'gf' with dot.separated.modules in lua. 7 | -- Put the cursor at the argument in "require" and press "gf" to see the effect. 8 | "sam4llis/nvim-lua-gf", 9 | 10 | { "nvim-tree/nvim-tree.lua", 11 | cmd = {"NvimTreeOpen", "NvimTreeToggle", "NvimTreeFindFile", "NvimTreeFocus", "NvimTreeFindFileToggle"}, 12 | keys = { { "e", "NvimTreeToggle", desc = ":NvimTreeToggle" } }, 13 | config = function () 14 | require("nvim-tree").setup { 15 | view = { width = 20, }, 16 | -- renderer = { group_empty = true, }, 17 | -- filters = { dotfiles = true, }, 18 | } 19 | end, 20 | }, 21 | -- "jreybert/vimagit", -- emacs' magit ✨ 22 | -- So anyways apparently almost every plugin that was popular in vim had to 23 | -- be rewritten in lua. 24 | { "NeogitOrg/neogit", 25 | cmd = "Neogit", 26 | dependencies = { 27 | "nvim-lua/plenary.nvim", 28 | "nvim-telescope/telescope.nvim", 29 | "sindrets/diffview.nvim", -- optional 30 | -- "ibhagwan/fzf-lua", -- optional 31 | }, 32 | opts = { 33 | integrations = { 34 | telescope = true, 35 | -- The diffview integration enables the diff popup. 36 | diffview = true, 37 | }, 38 | } 39 | }, 40 | -- "tpope/vim-surround", -- quoting and parenthesizing manipulation 41 | -- "tpope/vim-commentary", -- I'd rather not clog mappings with nerd commentor 42 | -- Sorry tpope! It's more convenient to configure in lua than in vim... 43 | -- * nvim-comment is lighter but doesn't, AFAIK, support block comments. 44 | -- * mini.surround let's you add quotes easily (defined above) 45 | { "numToStr/Comment.nvim", config = true }, 46 | { "lewis6991/gitsigns.nvim", 47 | -- "Be the diff you wish see in the gutter" -- Doom Emacs 48 | -- Also see comparison with vim-gitgutter: 49 | -- https://github.com/lewis6991/gitsigns.nvim?tab=readme-ov-file#comparison-with-vim-gitgutter 50 | enabled = vim.fn.has("nvim-0.8") == 1, 51 | opts = { 52 | -- No way ❤️ 53 | yadm = { enable = true }, 54 | }, 55 | }, 56 | { "folke/trouble.nvim", 57 | enabled = vim.fn.has("nvim-0.7.2") == 1, 58 | cmd = "Trouble", 59 | dependencies = { "nvim-tree/nvim-web-devicons" }, 60 | opts = { 61 | signs = { 62 | -- icons / text used for a diagnostic 63 | error = "E:", 64 | warning = "W:", 65 | hint = "H:", 66 | information = "I:", 67 | other = "X:", 68 | }, 69 | fold_open = "", -- icon used for open folds 70 | fold_closed = "", -- icon used for closed folds 71 | }, 72 | }, 73 | -- Full disclosure: I'm the maintainer of outline.nvim (see plugins/outline), 74 | -- just trying out aerial for fun :) 75 | { 'stevearc/aerial.nvim', 76 | enabled = true, 77 | cmd = { "AerialOpen", "AerialToggle", "AerialNavToggle" }, 78 | opts = { 79 | -- Doesn't seem to work 80 | filter_kind = false, 81 | backends = {"lsp", "treesitter"}, 82 | }, 83 | -- Optional dependencies 84 | dependencies = { 85 | "nvim-treesitter/nvim-treesitter", 86 | "nvim-tree/nvim-web-devicons" 87 | }, 88 | }, 89 | -- Still need the decent (ex)C(tags) support from this one... 90 | { 'preservim/tagbar' }, 91 | -- "bling/vim-bufferline", -- I prefer this over taking over the tabline space thanks 92 | -- Fair well vim-bufferline! You have served my vim and nvim experience well. 93 | -- I've since decided to set cmdheight to 1 and put the buffers in my status 94 | -- bar :') 95 | -- See archived/statusline.lua. 96 | -- Now I've abandoned the notion of having to know opened buffers all the 97 | -- time. If I need it I can use bp/bn/bd and telescope buffers. 98 | -- TODO: Check if this is still needed 99 | "tpope/vim-endwise", -- Add those 'endif'/'fi'/'done' 100 | { "moll/vim-bbye", -- smart buffer closer 101 | config = function() 102 | local function d(s) return { desc = s } end 103 | local map = vim.keymap.set 104 | map("n", "bd", "Bdelete", d"Bdelete") 105 | map("n", "bx", "Bwipeout", d"like bd but removes from jumplist") 106 | end 107 | }, 108 | { "carbon-steel/detour.nvim" }, 109 | { "tiagovla/scope.nvim", 110 | -- Tab-local buffer list. 111 | -- Similar to beframe (by prot) from emacs! 112 | config = true 113 | }, 114 | { "folke/todo-comments.nvim", 115 | dependencies = { "nvim-lua/plenary.nvim" }, 116 | opts = { 117 | highlight = { 118 | multiline = false, 119 | -- The 3 lines below tunes down the coloring of the highlights. The 120 | -- color schemes and treesitter nowdays are already way too vibrant for 121 | -- my liking, and for someone who litters todo/fixme way too much 122 | -- everywhere, adding *wide* *bg* highlighting to them is just WAY too 123 | -- much eye candy. 124 | before = "", 125 | keyword = "fg", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. 126 | after = "", -- "fg" or "bg" or empty 127 | -- Require only one space before keyword so we don't match keywords 128 | -- in the middle of comments. 129 | pattern = [[\s<(KEYWORDS)\s*]], -- (vim regex) 130 | comments_only = true, -- uses treesitter to match keywords in comments only 131 | max_line_len = 200, 132 | exclude = {}, -- filetypes 133 | }, 134 | } 135 | }, 136 | { "lukas-reineke/indent-blankline.nvim", name = "ibl", 137 | -- https://github.com/lukas-reineke/indent-blankline.nvim/wiki/Migrate-to-version-3 138 | -- Not documented but it appears new version requires a higher version of nvim. 139 | -- Upgraded to nvim 0.9.4 and the new version worked with showing context 140 | -- without needing treesitter 🎉 141 | main = vim.fn.has("nvim-0.9") == 1 and "ibl", 142 | version = vim.fn.has("nvim-0.9") == 1 and "*" or "2.20.8", 143 | pin = vim.fn.has("nvim-0.9") == 0, 144 | opts = { 145 | exclude = { 146 | filetypes = { 147 | "help", 148 | "NvimTree", 149 | "Trouble", 150 | "trouble", 151 | "lazy", 152 | "mason", 153 | "notify", 154 | "toggleterm", 155 | "lazyterm", 156 | "Outline", 157 | }, 158 | }, 159 | }, 160 | }, 161 | { "windwp/nvim-ts-autotag", 162 | -- Automatically add closing tags for HTML and JSX 163 | ft = { "html", "tsx", "jsx" }, 164 | opts = {}, 165 | }, 166 | "folke/neodev.nvim", 167 | { "stevearc/oil.nvim", 168 | opts = {}, 169 | -- Optional dependencies 170 | dependencies = { "nvim-tree/nvim-web-devicons" }, 171 | }, 172 | -- { dir = "~/projects/tree-sitter-cognate", dependencies = { "nvim-treesitter/nvim-treesitter" } }, 173 | } 174 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/autopair.lua: -------------------------------------------------------------------------------- 1 | local function config() 2 | require('nvim-autopairs').setup({ 3 | enable_check_bracket_line = false, -- Don't close pair when next char is a closing pair 4 | ignored_next_char = "[%w%.]", -- will ignore alphanumeric and `.` symbol 5 | fast_wrap = {}, 6 | }) 7 | end 8 | 9 | -- This plugin below is really good, but whenever I'm on a commented line, 10 | -- press o, press backspace, the line below is joined up above. You won't 11 | -- believe how long it took me to debug this problem and finally realize it's 12 | -- because of this plugin. 13 | -- "jiangmiao/auto-pairs", 14 | -- 15 | -- So now I'm using this instead: 16 | -- windwp/nvim-autopairs - extremely customizable, written in lua - 17 | -- integrates wth hrsh7th/nvim-cmp 18 | -- For nvim < 0.5, use: townk/vim-autoclose 19 | return { 20 | "windwp/nvim-autopairs", 21 | commit = vim.fn.has("nvim-0.7") == 1 and "b7672cd", 22 | config = config, 23 | event = "InsertEnter", 24 | } 25 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/competitest.lua: -------------------------------------------------------------------------------- 1 | local function config() 2 | vim.api.nvim_create_autocmd( 3 | { "FileType" }, 4 | { pattern = "CompetiTest", 5 | command = "setl signcolumn=no" } 6 | ) 7 | 8 | function _G.CPConfig() 9 | -- Allows opening of terminal in directory of current file (to avoid 10 | -- submitting code to the wrong problem!) 11 | -- This has since been moved to global config 12 | -- vim.o.autochdir = true 13 | -- prefix is also used by fugitive... 14 | local function d(s) return { desc = s } end 15 | local function map(...) vim.keymap.set(...) end 16 | map('c', "", "CompetiTest run", d"CompetiTest run") 17 | map('c', "c", "CompetiTest receive contest", d"CompetiTest receive contest") 18 | end 19 | 20 | vim.api.nvim_create_autocmd( 21 | { "BufRead" }, 22 | { pattern = "*/projects/cp/*", 23 | callback = _G.CPConfig } 24 | ) 25 | 26 | local function get_pieces(task) 27 | local judge, contest, problem, problem_char, div, round 28 | round = "" div = "" problem = "" problem_char = "" 29 | local hyphen = string.find(task.group, " - ", 1, true) 30 | if not hyphen then 31 | judge = task.group 32 | contest = "contest" 33 | else 34 | judge = string.sub(task.group, 1, hyphen - 1) 35 | if judge == "Codeforces" then 36 | judge = "cf" 37 | else 38 | judge = judge:lower() 39 | end 40 | -- Educational Codeforces Round 000 Div. 3 41 | contest = string.sub(task.group, hyphen + 3) 42 | div = contest:match("Div. (%d+)") -- 3 43 | round = contest:match("Round (%d+)") -- 000 44 | local edu = contest:match("Educational") 45 | if edu ~= nil then 46 | round = "edu"..round -- edu000 47 | end 48 | if not div then 49 | div = "" 50 | end 51 | div = "div"..div -- div3 52 | end 53 | problem = task.name -- A. Name of Task 54 | problem_char = problem:match(".") -- A 55 | -- A_name-of-task 56 | problem = problem_char .. "_" .. problem:match(" (.+)$"):gsub("%s", "-"):lower() 57 | 58 | return { 59 | round = round, -- 000 60 | div = div, -- div3 61 | problem = problem, 62 | problem_char = problem_char, 63 | judge = judge, 64 | } 65 | end 66 | 67 | require('competitest').setup { 68 | local_config_file_name = ".competitest.lua", 69 | 70 | floating_border = "rounded", 71 | floating_border_highlight = "FloatBorder", 72 | picker_ui = { 73 | width = 0.2, 74 | height = 0.3, 75 | mappings = { 76 | focus_next = { "j", "", "" }, 77 | focus_prev = { "k", "", "" }, 78 | close = { "", "", "q", "Q" }, 79 | submit = { "" }, 80 | }, 81 | }, 82 | editor_ui = { 83 | popup_width = 0.4, 84 | popup_height = 0.6, 85 | show_nu = true, 86 | show_rnu = false, 87 | normal_mode_mappings = { 88 | switch_window = { "", "", "" }, 89 | save_and_close = "", 90 | cancel = { "q", "Q" }, 91 | }, 92 | insert_mode_mappings = { 93 | switch_window = { "", "", "" }, 94 | save_and_close = "", 95 | cancel = "", 96 | }, 97 | }, 98 | runner_ui = { 99 | interface = "split", 100 | selector_show_nu = false, 101 | selector_show_rnu = false, 102 | show_nu = false, 103 | show_rnu = false, 104 | mappings = { 105 | run_again = "R", 106 | run_all_again = "", 107 | kill = "K", 108 | kill_all = "", 109 | view_input = { "i", "I" }, 110 | view_output = { "a", "A" }, 111 | view_stdout = { "o", "O" }, 112 | view_stderr = { "e", "E" }, 113 | toggle_diff = { "d", "D" }, 114 | close = { "q", "Q" }, 115 | }, 116 | viewer = { 117 | width = 0.5, 118 | height = 0.5, 119 | show_nu = true, 120 | show_rnu = false, 121 | close_mappings = { "q", "Q" }, 122 | }, 123 | }, 124 | popup_ui = { 125 | total_width = 0.8, 126 | total_height = 0.8, 127 | layout = { 128 | { 4, "tc" }, 129 | { 5, { { 1, "so" }, { 1, "si" } } }, 130 | { 5, { { 1, "eo" }, { 1, "se" } } }, 131 | }, 132 | }, 133 | split_ui = { 134 | position = "right", 135 | relative_to_editor = true, 136 | total_width = 0.3, 137 | vertical_layout = { 138 | { 1, "tc" }, 139 | { 1, { { 1, "so" }, { 1, "eo" } } }, 140 | { 1, { { 1, "si" }, { 1, "se" } } }, 141 | }, 142 | total_height = 0.4, 143 | horizontal_layout = { 144 | { 2, "tc" }, 145 | { 3, { { 1, "so" }, { 1, "si" } } }, 146 | { 3, { { 1, "eo" }, { 1, "se" } } }, 147 | }, 148 | }, 149 | 150 | save_current_file = true, 151 | save_all_files = false, 152 | compile_directory = ".", 153 | compile_command = { 154 | c = { exec = "gcc", args = { "-Wall", "$(FNAME)", "-o", "$(FNOEXT).out" } }, 155 | -- cpp = { exec = "clang++", args = { "-Wall", "$(FNAME)", "-o", "$(FNOEXT).out", "--include-directory=/opt/homebrew/Cellar/gcc/13.2.0/include/c++/13/aarch64-apple-darwin22" } }, 156 | cpp = { exec = "g++", args = { "-Wall", "$(FNAME)", "-o", "$(FNOEXT).out" } }, 157 | rust = { exec = "rustc", args = { "$(FNAME)" } }, 158 | java = { exec = "javac", args = { "$(FNAME)" } }, 159 | }, 160 | running_directory = ".", 161 | run_command = { 162 | c = { exec = "./$(FNOEXT).out" }, 163 | cpp = { exec = "./$(FNOEXT).out" }, 164 | rust = { exec = "./$(FNOEXT)" }, 165 | python = { exec = "python", args = { "$(FNAME)" } }, 166 | java = { exec = "java", args = { "$(FNOEXT)" } }, 167 | }, 168 | multiple_testing = -1, 169 | maximum_time = 5000, 170 | output_compare_method = "squish", 171 | view_output_diff = false, 172 | 173 | testcases_directory = "./testcases", 174 | testcases_use_single_file = false, 175 | testcases_auto_detect_storage = true, 176 | testcases_single_file_format = "$(FNOEXT)_testcases.txt", 177 | testcases_input_file_format = "input$(TCNUM).txt", 178 | testcases_output_file_format = "output$(TCNUM).txt", 179 | 180 | companion_port = 27121, 181 | receive_print_message = true, 182 | template_file = "~/projects/cp/t.cpp", 183 | evaluate_template_modifiers = true, 184 | -- Group = "Codeforces - Educational Codeforces Round 156 (Rated for Div. 2)" 185 | -- Judge = "Codeforces" 186 | -- Contest = after '-' 187 | -- JAVA_TASK_CLASS = class friendly problem name 188 | date_format = "%Y-%m-%d %H:%M", 189 | received_files_extension = "cpp", 190 | -- ~/projects/cp/contest/div0/[edu]000/A_problem-name/a.cpp 191 | received_problems_path = function(task, fext) 192 | local info = get_pieces(task) 193 | return vim.loop.os_homedir()..string.format("/projects/cp/%s/%s/%s/%s/%s.%s", 194 | info.judge, info.div, info.round, info.problem, info.problem_char:lower(), fext) 195 | end, 196 | received_problems_prompt_path = true, 197 | -- ~/projects/cp/contest/div0/[edu]000/ 198 | received_contests_directory = function (task, fext) 199 | local info = get_pieces(task) 200 | return vim.loop.os_homedir()..string.format("/projects/cp/%s/%s/%s/", 201 | info.judge, info.div, info.round) 202 | end, 203 | -- A_problem-name/a.cpp 204 | received_contests_problems_path = function (task, fext) 205 | local info = get_pieces(task) 206 | return string.format("%s/%s.%s", 207 | info.problem, info.problem_char:lower(), fext) 208 | end, 209 | received_contests_prompt_directory = true, 210 | received_contests_prompt_extension = true, 211 | open_received_problems = true, 212 | open_received_contests = true, 213 | replace_received_testcases = false, 214 | } 215 | end 216 | 217 | return { 218 | "xeluxee/competitest.nvim", 219 | dependencies = "MunifTanjim/nui.nvim", 220 | config = config, 221 | ft = "cpp", 222 | } 223 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/complete.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/hrsh7th/nvim-cmp 2 | local function config() 3 | local has_words_before = function() 4 | unpack = unpack or table.unpack 5 | local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 6 | return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil 7 | end 8 | 9 | local snippy = require("snippy") 10 | local cmp = require'cmp' 11 | 12 | cmp.setup({ 13 | completion = { 14 | autocomplete = false, -- trigger with or 15 | }, 16 | snippet = { 17 | expand = function(args) 18 | require('snippy').expand_snippet(args.body) 19 | end, 20 | }, 21 | view = { 22 | entries = { 23 | name = "custom", 24 | }, 25 | }, 26 | window = { 27 | completion = { 28 | border = "rounded", 29 | winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None', 30 | }, 31 | documentation = { 32 | border = "rounded", 33 | winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None', 34 | }, 35 | }, 36 | formatting = { 37 | fields = { 'kind', 'abbr', 'menu' }, 38 | format = function(entry, vim_item) 39 | if vim.tbl_contains({ 'path' }, entry.source.name) then 40 | local icon, hl_group = require('nvim-web-devicons').get_icon(entry:get_completion_item().label) 41 | if icon then 42 | vim_item.kind = icon..' ' 43 | vim_item.kind_hl_group = hl_group 44 | return vim_item 45 | end 46 | end 47 | vim_item = require('lspkind').cmp_format({ 48 | with_text = false, 49 | mode = 'symbol', 50 | maxwidth = 40, 51 | ellipsis_char = "⋯", 52 | })(entry, vim_item) 53 | vim_item.kind = vim_item.kind..' ' 54 | return vim_item 55 | end 56 | }, 57 | mapping = cmp.mapping.preset.insert({ 58 | [''] = cmp.mapping.scroll_docs(-4), 59 | [''] = cmp.mapping.scroll_docs(4), 60 | [''] = cmp.mapping.complete(), 61 | [''] = cmp.mapping(function(fallback) 62 | if cmp.visible() then 63 | -- Complete immediately if there's only one candidate remaining 64 | if #cmp.get_entries() == 1 then 65 | cmp.confirm({ select = true }) 66 | else 67 | cmp.select_next_item() 68 | end 69 | elseif snippy.can_expand_or_advance() then 70 | snippy.expand_or_advance() 71 | elseif has_words_before() then 72 | cmp.complete() 73 | -- Complete immediately if there's only one candidate 74 | if #cmp.get_entries() == 1 then 75 | cmp.confirm({ select = true }) 76 | end 77 | else 78 | fallback() 79 | end 80 | end, { "i", "s" }), 81 | [''] = cmp.mapping(function(fallback) 82 | if cmp.visible() then 83 | cmp.select_prev_item() 84 | elseif snippy.can_jump(-1) then 85 | snippy.previous() 86 | else 87 | fallback() 88 | end 89 | end, { "i", "s" }), 90 | [''] = cmp.mapping.abort(), 91 | -- Accept currently selected item. Set `select` to `false` to only 92 | -- confirm explicitly selected items. 93 | [''] = cmp.mapping({ 94 | i = function(fallback) 95 | if cmp.visible() and cmp.get_active_entry() then 96 | cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) 97 | else 98 | fallback() 99 | end 100 | end, 101 | s = cmp.mapping.confirm({ select = true }), 102 | -- Super useful for path completion in the command line! 103 | -- :e ~/partial_path 104 | -- Typing the above would confirm the selected entry and continue to 105 | -- complete entries from ~/partial_path/* 106 | c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), 107 | }), 108 | }), 109 | sources = cmp.config.sources({ 110 | { name = 'nvim_lsp' }, 111 | { name = 'snippy' }, 112 | { 113 | name = 'omni', 114 | option = { 115 | disable_omnifuncs = { 'v:lua.vim.lsp.omnifunc' } 116 | } 117 | }, 118 | }, { 119 | -- { name = 'buffer' }, 120 | { name = 'emoji' }, 121 | { name = "latex_symbols" }, 122 | { name = 'path' }, 123 | -- { name = 'calc' }, 124 | { name = 'neorg' }, 125 | }), 126 | }) 127 | 128 | -- Set configuration for specific filetype. 129 | cmp.setup.filetype('gitcommit', { 130 | sources = cmp.config.sources({ 131 | { name = 'cmp_git' }, 132 | }, { 133 | { name = 'emoji' }, 134 | { name = "latex_symbols" }, 135 | -- { name = 'buffer' }, 136 | { name = 'path' }, 137 | }) 138 | }) 139 | cmp.setup.filetype('fish', { 140 | sources = cmp.config.sources({ 141 | { name = 'cmp_fish' }, 142 | }, { 143 | -- { name = 'buffer' }, 144 | { name = 'calc' }, 145 | { name = 'emoji' }, 146 | { name = "latex_symbols" }, 147 | { name = 'path' }, 148 | }) 149 | }) 150 | cmp.setup.filetype('norg', { 151 | sources = cmp.config.sources({ 152 | { name = 'neorg' }, 153 | }, { 154 | -- { name = 'buffer' }, 155 | -- { name = 'calc' }, 156 | { name = 'emoji' }, 157 | { name = "latex_symbols" }, 158 | -- { name = 'path' }, 159 | }) 160 | }) 161 | 162 | 163 | -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't 164 | -- work anymore). 165 | cmp.setup.cmdline({ '/', '?' }, { 166 | mapping = cmp.mapping.preset.cmdline(), 167 | sources = { 168 | -- { name = 'buffer' } 169 | } 170 | }) 171 | 172 | -- if you enabled `native_menu` this won't work anymore 173 | cmp.setup.cmdline(':', { 174 | mapping = cmp.mapping.preset.cmdline({ 175 | [''] = { 176 | c = function(_) 177 | if cmp.visible() then 178 | -- Complete immediately if there's only one candidate remaining. 179 | -- Avoids an extra confirm trigger 180 | if #cmp.get_entries() == 1 then 181 | cmp.confirm({ select = true }) 182 | else 183 | cmp.select_next_item() 184 | end 185 | else 186 | cmp.complete() 187 | -- Complete immediately if there's only one candidate 188 | if #cmp.get_entries() == 1 then 189 | cmp.confirm({ select = true }) 190 | end 191 | end 192 | end, 193 | } 194 | }), 195 | sources = cmp.config.sources({ 196 | { name = 'path' } 197 | }, { 198 | { name = 'cmdline' } 199 | }) 200 | }) 201 | 202 | -- autopairs + cmp confirm 203 | local cmp_autopairs = require('nvim-autopairs.completion.cmp') 204 | cmp.event:on( 205 | 'confirm_done', 206 | cmp_autopairs.on_confirm_done() 207 | ) 208 | 209 | -- Set the completion item color of unmatched portion to white 210 | -- Somehow it is set to black by default ever since I switched my config to lua. 211 | -- I don't need this anymore when using tundra (theme) 212 | -- vim.api.nvim_set_hl(0, "CmpItemAbbr", { fg=vim.g['dracula#palette.fg'] }) 213 | 214 | function _G.CmpDisable() 215 | cmp.setup.buffer { enabled = false } 216 | end 217 | end 218 | 219 | return { 220 | { "hrsh7th/nvim-cmp", 221 | event = { "InsertEnter", "CmdlineEnter" }, 222 | config = config, 223 | dependencies = { 224 | "hrsh7th/cmp-nvim-lsp", 225 | "hrsh7th/cmp-path", -- File paths 226 | "hrsh7th/cmp-cmdline", -- Fire your way through the neovim cmd line 227 | "hrsh7th/cmp-calc", -- Somehwat useful.. But emacs M-x calc FTW! 228 | "hrsh7th/cmp-emoji", -- 😏 :smirk: 229 | "mtoohey31/cmp-fish", 230 | "petertriho/cmp-git", 231 | "kdheepak/cmp-latex-symbols", -- τ long live \tau 232 | -- "dcampos/nvim-snippy", -- Adding it here does not apply opts 233 | "dcampos/cmp-snippy", 234 | "hrsh7th/cmp-omni", 235 | }, 236 | }, 237 | { "dcampos/nvim-snippy", 238 | event = "InsertEnter", 239 | opts = { 240 | -- mappings to navigate expansion fields are merged in plugins/complete.lua 241 | mappings = { 242 | is = {}, 243 | nx = { 244 | ['sx'] = 'cut_text', 245 | }, 246 | }, 247 | } 248 | }, 249 | } 250 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/dap.lua: -------------------------------------------------------------------------------- 1 | local function config() 2 | local dap = require('dap') 3 | dap.adapters.python = function(cb, config) 4 | if config.request == 'attach' then 5 | ---@diagnostic disable-next-line: undefined-field 6 | local port = (config.connect or config).port 7 | ---@diagnostic disable-next-line: undefined-field 8 | local host = (config.connect or config).host or '127.0.0.1' 9 | cb({ 10 | type = 'server', 11 | port = assert(port, '`connect.port` is required for a python `attach` configuration'), 12 | host = host, 13 | options = { 14 | source_filetype = 'python', 15 | }, 16 | }) 17 | else 18 | cb({ 19 | type = 'executable', 20 | command = '/Users/hedy/.config/nvim/.virtualenvs/debugpy/bin/python', 21 | args = { '-m', 'debugpy.adapter' }, 22 | options = { 23 | source_filetype = 'python', 24 | }, 25 | }) 26 | end 27 | end 28 | 29 | dap.configurations.python = { 30 | { 31 | -- The first three options are required by nvim-dap 32 | type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python` 33 | request = 'launch'; 34 | name = "Launch file"; 35 | 36 | -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options 37 | 38 | program = "${file}"; -- This configuration will launch the current file if used. 39 | pythonPath = function() 40 | -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself. 41 | -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within. 42 | -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable. 43 | local cwd = vim.fn.getcwd() 44 | if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then 45 | return cwd .. '/venv/bin/python' 46 | elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then 47 | return cwd .. '/.venv/bin/python' 48 | else 49 | return '/usr/bin/python3' 50 | end 51 | end; 52 | }, 53 | } 54 | 55 | require("nvim-dap-virtual-text").setup({}) 56 | 57 | local dapui = require("dapui") 58 | dapui.setup({}) 59 | 60 | dap.listeners.after.event_initialized["dapui_config"] = function() 61 | dapui.open() 62 | end 63 | dap.listeners.before.event_terminated["dapui_config"] = function() 64 | dapui.close() 65 | end 66 | dap.listeners.before.event_exited["dapui_config"] = function() 67 | dapui.close() 68 | end 69 | 70 | vim.api.nvim_create_user_command( 71 | 'DuiToggle', 72 | function(opts) 73 | local a = nil 74 | if opts and #opts.args > 0 then 75 | a = opts.args[1] 76 | end 77 | require("dapui").toggle(a) 78 | end, 79 | { 80 | nargs = '?', 81 | complete = function() return {'sidebar', 'tray'} end, 82 | }) 83 | end 84 | 85 | return { 86 | -- TODO: check nvim version 87 | { "mfussenegger/nvim-dap", 88 | config = config, 89 | lazy = true, 90 | cmd = {"DapToggleBreakpoint", "DapContinue"}, 91 | }, 92 | { "theHamsta/nvim-dap-virtual-text", 93 | lazy = true, 94 | cmd = {"DapToggleBreakpoint", "DapContinue"}, 95 | dependencies = {"mfussenegger/nvim-dap"}, 96 | }, 97 | { "rcarriga/nvim-dap-ui", 98 | lazy = true, 99 | cmd = {"DapToggleBreakpoint", "DapContinue"}, 100 | dependencies = {"mfussenegger/nvim-dap"}, 101 | }, 102 | } 103 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/ft.lua: -------------------------------------------------------------------------------- 1 | return { 2 | --- File type, syntax, language helper plugins --- 3 | { url = "https://git.sr.ht/~torresjrjr/gemini.vim", ft = "gemini" }, 4 | { "cespare/vim-toml", ft = "toml" }, 5 | { "blankname/vim-fish", ft = "fish", 6 | config = function () 7 | vim.opt_local.shiftwidth = 4 8 | vim.opt_local.textwidth = 79 9 | vim.opt_local.foldmethod = "expr" 10 | vim.opt_local.expandtab = true 11 | vim.opt_local.tabstop = 4 12 | end, 13 | }, 14 | { url = "https://git.rawtext.club/slope-lang/slope-vim-syntax", 15 | ft = "slope", 16 | enabled = false; 17 | }, 18 | { "mzlogin/vim-markdown-toc", ft = "markdown", 19 | }, 20 | { dir = "~/projects/markdown-toc.nvim", ft = "markdown", 21 | opts = { 22 | -- fences = false, 23 | toc_list = { 24 | -- indent_size = function() return vim.bo.shiftwidth end, 25 | } 26 | }, 27 | }, 28 | { "leafo/moonscript-vim", ft = "moon", 29 | config = function () 30 | vim.opt_local.tabstop = 2 31 | vim.opt_local.softtabstop = 2 32 | vim.opt_local.shiftwidth = 2 33 | end 34 | }, 35 | } 36 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/icons.lua: -------------------------------------------------------------------------------- 1 | -- Remember to install the Symbols Only font zip, then configure terminal to 2 | -- use that font too. 3 | -- Used by lazy, nvim-tree, and others 4 | 5 | -- https://github.com/nvim-tree/nvim-web-devicons 6 | local function config() 7 | require'nvim-web-devicons'.setup { 8 | -- your personnal icons can go here (to override) 9 | -- you can specify color or cterm_color instead of specifying both of them 10 | -- DevIcon will be appended to `name` 11 | -- 12 | -- globally enable different highlight colors per icon (default to true) 13 | -- if set to false all icons will have the default icon's color 14 | color_icons = true; 15 | -- globally enable default icons (default to false) 16 | -- will get overriden by `get_icons` option 17 | -- default = true; 18 | -- globally enable "strict" selection of icons - icon will be looked up in 19 | -- different tables, first by filename, and if not found by extension; this 20 | -- prevents cases when file doesn't have any extension but still gets some icon 21 | -- because its name happened to match some extension (default to false) 22 | strict = true; 23 | -- same as `override` but specifically for overrides by filename 24 | -- takes effect when `strict` is true 25 | override_by_filename = { 26 | [".gitignore"] = { 27 | icon = "", 28 | color = "#f1502f", 29 | name = "Gitignore", 30 | }, 31 | }; 32 | -- same as `override` but specifically for overrides by extension 33 | -- takes effect when `strict` is true 34 | override_by_extension = { 35 | ["norg"] = { 36 | icon = "", 37 | color = "#71a6e2", 38 | name = "norg", 39 | } 40 | }, 41 | } 42 | end 43 | 44 | return { 45 | "nvim-tree/nvim-web-devicons", lazy = true, 46 | enabled = vim.fn.has("nvim-0.7") == 1, 47 | config = function() require('plugins/icons') end, 48 | pin = true, 49 | commit = 'cde67b5d5427daeecfd7c77cf02ded23a26980bb', 50 | } 51 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/incline.lua: -------------------------------------------------------------------------------- 1 | local function config() 2 | 3 | local cp = require('nvim-tundra.palette.arctic') 4 | local a = vim.api 5 | local f = vim.fn 6 | 7 | local mode_colors = { 8 | n = "=Comment", 9 | v = cp.green._500, 10 | V = cp.green._500, 11 | ["CTRL-V"] = cp.green._500, 12 | R = cp.red._500, 13 | i = cp.sand._500, 14 | s = cp.orange._500, 15 | S = cp.orange._500, 16 | ["CTRL-S"] = cp.orange._500, 17 | } 18 | 19 | local function get_mode_fghl(mode) 20 | local hl = "#Normal" 21 | if mode_colors[mode.prefix] then 22 | hl = mode_colors[mode.prefix] 23 | end 24 | if mode_colors[mode.mode] then 25 | hl = mode_colors[mode.mode] 26 | end 27 | if mode.blocking then 28 | hl = "=Error" 29 | end 30 | return hl 31 | end 32 | 33 | local function get_win_maxy() 34 | local max_y_pos = 0 35 | local max_y_win = 0 36 | for _, winid in ipairs(a.nvim_list_wins()) do 37 | local c = a.nvim_win_get_config(winid) 38 | -- Loop only proper windows (not floating etc) 39 | if c.relative == "" then 40 | if max_y_pos <= a.nvim_win_get_position(winid)[1] then 41 | max_y_win = winid 42 | end 43 | end 44 | end 45 | return max_y_win 46 | end 47 | 48 | function _G.Incrender(p) 49 | -- p.buf, win, focused 50 | -- Hide incline for bottomost win, because I have ruler 51 | if get_win_maxy() == p.win then 52 | return "" 53 | end 54 | 55 | local fp = a.nvim_buf_get_name(p.buf) 56 | fp = f.fnamemodify(fp, ":t") or '[No Name]' 57 | local mod = '' 58 | if a.nvim_buf_get_option(p.buf, 'modified') then 59 | mod = '+' 60 | end 61 | 62 | local mode = a.nvim_get_mode() 63 | mode.prefix = mode.mode:sub(1,1) 64 | mode.fghl = get_mode_fghl(mode) 65 | local r_mode = { mode.mode, guifg = mode.fghl } 66 | if mode.fghl:sub(1, 1) == '=' then 67 | -- group takes higher precedence than any other hl options 68 | r_mode.group = mode.fghl:sub(2, #mode.fghl) 69 | end 70 | 71 | local r = { group = "Comment", r_mode, ' ', fp, mod } 72 | if not p.focused then 73 | r.group = "LineNr" 74 | r_mode.group = "LineNr" 75 | end 76 | return r 77 | end 78 | -- local render = function(props) 79 | -- local bufname = a.nvim_buf_get_name(props.buf) 80 | -- local res = bufname ~= '' and f.fnamemodify(bufname, ':t') or '[No Name]' 81 | -- if a.nvim_buf_get_option(props.buf, 'modified') then 82 | -- res = res .. ' +' 83 | -- end 84 | -- return res 85 | -- end 86 | 87 | require('incline').setup { 88 | render = _G.Incrender, 89 | debounce_threshold = { 90 | falling = 50, 91 | rising = 10 92 | }, 93 | hide = { 94 | cursorline = false, 95 | focused_win = false, 96 | only_win = true, 97 | }, 98 | highlight = { 99 | groups = { 100 | InclineNormal = { 101 | default = true, 102 | group = "NormalFloat" 103 | }, 104 | InclineNormalNC = { 105 | default = true, 106 | group = "NormalFloat" 107 | } 108 | } 109 | }, 110 | ignore = { 111 | buftypes = {}, 112 | filetypes = {}, 113 | floating_wins = true, 114 | unlisted_buffers = true, 115 | wintypes = {}, 116 | }, 117 | window = { 118 | margin = { 119 | horizontal = 0, 120 | -- Needs = 1 if setting &lines+=1 121 | vertical = { top = 0, bottom = 0 } 122 | }, 123 | options = { 124 | signcolumn = "no", 125 | wrap = false 126 | }, 127 | padding = 0, 128 | padding_char = " ", 129 | placement = { 130 | horizontal = "right", 131 | vertical = "bottom" 132 | }, 133 | width = "fit", 134 | winhighlight = { 135 | active = { 136 | EndOfBuffer = "None", 137 | Normal = "InclineNormal", 138 | Search = "None" 139 | }, 140 | inactive = { 141 | EndOfBuffer = "None", 142 | Normal = "InclineNormalNC", 143 | Search = "None" 144 | } 145 | }, 146 | zindex = 50 147 | } 148 | } 149 | end 150 | 151 | return { 152 | "b0o/incline.nvim", 153 | config = config, 154 | -- enabled = false, 155 | } 156 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/linting.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/errata-ai/vale/releases 2 | 3 | local function config() 4 | local lint = require('lint') 5 | lint.linters_by_ft = { 6 | markdown = {'codespell'}, 7 | python = {'codespell'}, 8 | mail = {'proselint'}, 9 | template = {'proselint'}, 10 | -- c = {'cpplint'}, 11 | -- cpp = {'cpplint'}, 12 | } 13 | 14 | vim.api.nvim_create_autocmd("BufWritePost", { pattern = "*", callback = function() lint.try_lint() end }) 15 | end 16 | 17 | return { 18 | "mfussenegger/nvim-lint", 19 | enabled = vim.fn.has("nvim-0.6") == 1, 20 | config = config, 21 | event = {"BufWritePost", "InsertEnter"} 22 | } 23 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/lsp.lua: -------------------------------------------------------------------------------- 1 | local function config() 2 | -- IMPORTANT: make sure to setup neodev BEFORE lspconfig 3 | require("neodev").setup({ 4 | setup_jsonls = false, 5 | }) 6 | local lspconfig = require('lspconfig') 7 | 8 | -- from https://github.com/neovim/nvim-lspconfig/wiki/User-contributed-tips#peek-definition 9 | 10 | local function preview_location_callback(_, _, result) 11 | if result == nil or vim.tbl_isempty(result) then 12 | return nil 13 | end 14 | vim.lsp.util.preview_location(result[1]) 15 | end 16 | 17 | function PeekDefinition() 18 | local params = vim.lsp.util.make_position_params() 19 | return vim.lsp.buf_request(0, 'textDocument/definition', params, preview_location_callback) 20 | end 21 | 22 | 23 | -- from https://github.com/neovim/nvim-lspconfig#Keybindings-and-completion 24 | 25 | local on_attach = function(client, bufnr) 26 | local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end 27 | local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end 28 | 29 | --Enable completion triggered by 30 | buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') 31 | 32 | -- Mappings. 33 | local opts = { noremap=true, silent=true } 34 | 35 | -- See `:help vim.lsp.*` for documentation on any of the below functions 36 | buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) 37 | buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) 38 | buf_set_keymap('n', 'gp', 'lua PeekDefinition()', opts) 39 | buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) 40 | -- buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) 41 | -- Let's not override C-k for window nav thanks 42 | buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) 43 | buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) 44 | buf_set_keymap('n', '', 'lua vim.lsp.buf.rename()', opts) 45 | buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) 46 | buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) 47 | buf_set_keymap('n', 'e', 'lua vim.diagnostic.show_line_diagnostics()', opts) 48 | buf_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) 49 | buf_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) 50 | buf_set_keymap("n", "g@", "lua vim.lsp.buf.format{async=true}", opts) 51 | --buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) 52 | end 53 | 54 | local handlers = { 55 | ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {border = 'rounded'}), 56 | ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {border = 'rounded' }), 57 | } 58 | 59 | local capabilities = require('cmp_nvim_lsp').default_capabilities() 60 | 61 | -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md 62 | -- Call setup on list of wanted servers and map local keybinds 63 | local servers = { 64 | "bashls", -- node bash-language-server 65 | "vimls", -- node vim-language-server 66 | "marksman", -- https://github.com/artempyanykh/marksman/releases 67 | -- "ccls", -- https://github.com/MaskRay/ccls/wiki 68 | "nim_langserver", -- nimble install 69 | "rust_analyzer", 70 | "zls", -- https://github.com/zigtools/zls/wiki/Installation 71 | "hls", -- brew 72 | "v_analyzer", -- https://github.com/vlang/v-analyzer 73 | "ocamllsp", -- opam install ocaml-lsp-server 74 | "nushell", -- built-in to nu 75 | "ols", -- https://github.com/DanielGavin/ols?tab=readme-ov-file#installation 76 | "elmls", -- node @elm-tooling/elm-language-server 77 | } 78 | for _, lsp in pairs(servers) do 79 | lspconfig[lsp].setup { 80 | on_attach = on_attach, 81 | capabilities = capabilities, 82 | handlers = handlers, 83 | flags = { 84 | debounce_text_changes = 150, 85 | } 86 | } 87 | end 88 | -- comes with deno 89 | lspconfig.denols.setup { 90 | on_attach = on_attach, 91 | root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"), 92 | capabilities = capabilities, 93 | handlers = handlers, 94 | flags = { 95 | debounce_text_changes = 150, 96 | } 97 | } 98 | -- node typescript-language-server 99 | lspconfig.tsserver.setup { 100 | on_attach = on_attach, 101 | root_dir = lspconfig.util.root_pattern("package.json"), 102 | single_file_support = false, 103 | capabilities = capabilities, 104 | handlers = handlers, 105 | flags = { 106 | debounce_text_changes = 150, 107 | } 108 | } 109 | -- pipx install python-lsp-server 110 | -- ~/.local/pipx/venvs/python-lsp-server/bin/python3 -m pip install python-lsp-black pylsp-mypy python-lsp-ruff 111 | -- Add additional symlinks! 112 | lspconfig.pylsp.setup{ 113 | on_attach = on_attach, 114 | capabilities = capabilities, 115 | handlers = handlers, 116 | settings = { 117 | pylsp = { 118 | plugins = { 119 | pylint = { enabled = false }, 120 | black = { enabled = true }, 121 | pylsp_mypy = { 122 | enabled = false, 123 | live_mode = false, 124 | }, 125 | ruff = { 126 | enabled = true, 127 | extendSelect = { "I" }, 128 | }, 129 | }, 130 | } 131 | } 132 | } 133 | -- go install golang.org/x/tools/gopls@latest 134 | -- https://github.com/hrsh7th/nvim-cmp/wiki/Language-Server-Specific-Samples#golang-gopls 135 | lspconfig.gopls.setup{ 136 | on_attach = on_attach, 137 | capabilities = capabilities, 138 | handlers = handlers, 139 | settings = { 140 | gopls = { 141 | experimentalPostfixCompletions = true, 142 | analyses = { 143 | unusedparams = true, 144 | shadow = true, 145 | }, 146 | staticcheck = true, 147 | }, 148 | }, 149 | init_options = { 150 | usePlaceholders = true, 151 | -- hoverKind = "SynopsisDocumentation", 152 | } 153 | } 154 | -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lua_ls 155 | lspconfig.lua_ls.setup { 156 | on_attach = on_attach, 157 | capabilities = capabilities, 158 | handlers = handlers, 159 | settings = { 160 | Lua = { 161 | -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) 162 | runtime = { version = 'LuaJIT' }, 163 | -- Get the language server to recognize the `vim` global 164 | diagnostics = { 165 | globals = {'vim'}, 166 | }, 167 | -- Make the server aware of Neovim runtime files 168 | workspace = { 169 | library = vim.api.nvim_get_runtime_file("", true), 170 | checkThirdParty = false, 171 | }, 172 | -- Do not send telemetry data containing a randomized but unique identifier 173 | telemetry = { enable = false }, 174 | completion = { 175 | callSnippets = "Replace" 176 | }, 177 | }, 178 | }, 179 | } 180 | end 181 | 182 | return { 183 | { "neovim/nvim-lspconfig", 184 | config = config, 185 | ft = {"python", "go", "markdown", "lua", "vim", "bash", "javascript", 'javascriptreact', 'sh', "typescript", "typescriptreact", "nim", "rust", "zig", "haskell", "v", "ocaml", "nu", "odin", "elm"}, 186 | }, 187 | { "ray-x/lsp_signature.nvim", 188 | event = "VeryLazy", 189 | opts = { 190 | doc_lines = 10, 191 | -- set to 0 if you DO NOT want any API comments be shown 192 | -- This setting only take effect in insert mode, it does not affect signature help in normal 193 | -- mode, 10 by default 194 | max_height = 12, 195 | max_width = 80, 196 | noice = false, 197 | wrap = true, 198 | floating_window = false, 199 | floating_window_above_cur_line = true, 200 | floating_window_off_x = 1, 201 | floating_window_off_y = 0, -- -2 move window up 2 lines; 2 move down 2 lines 202 | -- can be either number or function, see examples 203 | close_timeout = 4000, 204 | fix_pos = false, -- don't auto-close the floating window all parameters finished 205 | hint_enable = true, -- virtual hint 206 | hint_prefix = " ", 207 | hint_scheme = "String", 208 | hint_inline = function() return vim.fn.has('nvim-0.10') == 1 end, 209 | hi_parameter = "LspSignatureActiveParameter", 210 | handler_opts = { border = "rounded" }, 211 | always_trigger = false, 212 | auto_close_after = nil, 213 | extra_trigger_chars = {","}, 214 | zindex = 200, 215 | padding = '', 216 | transparency = nil, -- 1~100 217 | timer_interval = 200, -- lower to reduce latency 218 | toggle_key = '', -- toggle floating window key (must set below to true) 219 | toggle_key_flip_floatwin_setting = true, 220 | select_signature_key = '', -- next signature for (eg) overloads 221 | }, 222 | }, 223 | { "onsails/lspkind.nvim" }, 224 | { "https://git.sr.ht/~whynothugo/lsp_lines.nvim", 225 | config = function() 226 | require("lsp_lines").setup() 227 | 228 | vim.diagnostic.config({ virtual_lines = false }) 229 | vim.api.nvim_create_autocmd("BufReadPost", { 230 | pattern = "*", 231 | callback = function() 232 | vim.b.lsp_lines_enabled = false 233 | end 234 | }) 235 | 236 | vim.keymap.set("n", "ll", function() 237 | require("lsp_lines").toggle() 238 | -- Disable virtual_text since it's redundant due to lsp_lines. 239 | if vim.b.lsp_lines_enabled then 240 | -- IT was enabled, now it's disabled. 241 | vim.diagnostic.config({ virtual_text = true }) 242 | vim.b.lsp_lines_enabled = false 243 | else 244 | vim.diagnostic.config({ virtual_text = false }) 245 | vim.b.lsp_lines_enabled = true 246 | end 247 | end , {desc = "Toggle Lsp Lines"}) 248 | end, 249 | }, 250 | } 251 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/mini.lua: -------------------------------------------------------------------------------- 1 | -- Ordered in discovery date of these high-quality, self-contained and 2 | -- minimalist plugins. Finding myself using switching to more of more of 3 | -- ones from the library and eventually found the need to extract it to a 4 | -- dedicated file. 5 | 6 | return { 7 | { "echasnovski/mini.files", 8 | -- Neat popout window to browse dirs and manipulate within the editor! 9 | cmd = "MiniFiles", 10 | keys = { { "E", "MiniFiles", desc = ":MiniFiles" } }, 11 | -- Mini.files stopped working a while ago, for some reason. I've switched 12 | -- to oil.nvim. 13 | enabled = false, 14 | dependencies = { "nvim-tree/nvim-web-devicons" }, 15 | config = function() 16 | require('mini.files').setup{} 17 | vim.api.nvim_create_user_command('MiniFiles', function() 18 | require('mini.files').open(nil, false) 19 | end, { desc = ":lua MiniFiles.open()" }) 20 | end, 21 | }, 22 | { "echasnovski/mini.surround", version = '*', 23 | opts = { 24 | -- Duration (in ms) of highlight when calling `MiniSurround.highlight()` 25 | highlight_duration = 500, 26 | -- Module mappings. Use `''` (empty string) to disable one. 27 | mappings = { 28 | add = 'sa', 29 | delete = 'ds', -- Using "ds" for muscle memory compat 30 | find = 'sf', -- Find surrounding (to the right) 31 | find_left = 'sF', -- Find surrounding (to the left) 32 | highlight = 'sh', -- Highlight surrounding 33 | replace = 'cs', -- Replace surrounding -- muscle memory compat 34 | update_n_lines = 'sn', -- Update `n_lines` 35 | 36 | suffix_last = 'l', -- Suffix to search with "prev" method 37 | suffix_next = 'n', -- Suffix to search with "next" method 38 | }, 39 | -- Number of lines within which surrounding is searched 40 | n_lines = 20, 41 | -- Whether to respect selection type: 42 | -- - Place surroundings on separate lines in linewise mode. 43 | -- - Place surroundings on each line in blockwise mode. 44 | respect_selection_type = false, 45 | -- How to search for surrounding (first inside current line, then inside 46 | -- neighborhood). One of 'cover', 'cover_or_next', 'cover_or_prev', 47 | -- 'cover_or_nearest', 'next', 'prev', 'nearest'. For more details, 48 | -- see `:h MiniSurround.config`. 49 | search_method = 'cover', 50 | -- Whether to disable showing non-error feedback 51 | silent = false, 52 | }, 53 | }, 54 | { "echasnovski/mini.splitjoin", 55 | opts = { 56 | mappings = { -- both n/v modes 57 | toggle = 'gS', 58 | split = '', 59 | join = '', 60 | }, 61 | detect = { 62 | -- Array of Lua patterns to detect region with arguments. 63 | -- Default: { '%b()', '%b[]', '%b{}' } 64 | brackets = nil, 65 | -- String Lua pattern defining argument separator 66 | separator = ',', 67 | -- Array of Lua patterns for sub-regions to exclude separators from. 68 | -- Enables correct detection in presence of nested brackets and quotes. 69 | -- Default: { '%b()', '%b[]', '%b{}', '%b""', "%b''" } 70 | exclude_regions = nil, 71 | }, 72 | -- Split options 73 | split = { 74 | hooks_pre = {}, 75 | hooks_post = {}, 76 | }, 77 | -- Join options 78 | join = { 79 | hooks_pre = {}, 80 | hooks_post = {}, 81 | }, 82 | } 83 | }, 84 | { "echasnovski/mini.trailspace", 85 | config = true, 86 | enabled = false, -- it doesn't seem to work, I've switched to normal `match` highlights instead 87 | }, 88 | { "echasnovski/mini.clue", 89 | enabled = false, 90 | config = function() 91 | local miniclue = require "mini.clue" 92 | miniclue.setup { 93 | triggers = { 94 | { mode = 'n', keys = '' }, 95 | { mode = 'x', keys = '' }, 96 | { mode = 'n', keys = 'g' }, 97 | { mode = 'x', keys = 'g' }, 98 | -- Marks 99 | { mode = 'n', keys = "'" }, 100 | { mode = 'n', keys = '`' }, 101 | { mode = 'x', keys = "'" }, 102 | { mode = 'x', keys = '`' }, 103 | -- Registers 104 | { mode = 'n', keys = '"' }, 105 | { mode = 'x', keys = '"' }, 106 | { mode = 'i', keys = '' }, 107 | { mode = 'c', keys = '' }, 108 | 109 | { mode = 'n', keys = '' }, 110 | { mode = 'n', keys = 'z' }, 111 | { mode = 'x', keys = 'z' }, 112 | }, 113 | 114 | clues = { 115 | -- Enhance this by adding descriptions for mapping groups 116 | miniclue.gen_clues.builtin_completion(), 117 | miniclue.gen_clues.g(), 118 | miniclue.gen_clues.marks(), 119 | miniclue.gen_clues.registers(), 120 | miniclue.gen_clues.windows(), 121 | miniclue.gen_clues.z(), 122 | }, 123 | window = { 124 | config = { 125 | width = 50, 126 | }, 127 | delay = 800, 128 | scroll_down = '', 129 | scroll_up = '', 130 | }, 131 | } 132 | end 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/norg.lua: -------------------------------------------------------------------------------- 1 | -- Org... and better? I sure hope so! 2 | 3 | return { 4 | "nvim-neorg/neorg", 5 | cmd = "Neorg", 6 | ft = "norg", 7 | build = ":Neorg sync-parsers", 8 | dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter" }, 9 | config = function() 10 | require("neorg").setup { 11 | load = { 12 | ["core.defaults"] = {}, -- Loads default behaviour 13 | ["core.concealer"] = { 14 | config = { 15 | folds = true, 16 | } 17 | }, 18 | ["core.dirman"] = { -- Manages Neorg workspaces 19 | config = { 20 | workspaces = { neorg = "~/neorg" }, 21 | default_workspace = "neorg" 22 | }, 23 | }, 24 | ["core.completion"] = { 25 | config = { 26 | engine = "nvim-cmp", 27 | name = " " 28 | }, 29 | }, 30 | ["core.highlights"] = { 31 | config = { 32 | highlights = { 33 | tags = { 34 | ranged_verbatim = { 35 | parameters = "guifg=#9ca3af", 36 | begin = "guifg=#9ca3af", 37 | ["end"] = "guifg=#9ca3af", 38 | name = { 39 | word = "guifg=#9ca3af", 40 | }, 41 | }, 42 | }, 43 | }, 44 | }, 45 | }, 46 | }, 47 | } 48 | end, 49 | } 50 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/outline.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/simrat39/symbols-outline.nvim 2 | -- Switched to this from tagbar because it does not require exctags, and it 3 | -- lists the items in order as defined in source code. 4 | -- Then I ended up forking it... 5 | -- https://github.com/hedyhli/outline.nvim 6 | 7 | return { 8 | { 9 | dir = "~/projects/outline.nvim", 10 | enabled = vim.fn.has("nvim-0.7") == 1, 11 | dependencies = { 'msr1k/outline-asciidoc-provider.nvim' }, 12 | lazy = false, 13 | cmd = { "Outline", "OutlineOpen" }, 14 | keys = { 15 | { "tt", "Outline", desc = "Toggle outline window" }, 16 | { "t", "Outline!", desc = "Toggle outline window without focus" }, 17 | { "tf", "OutlineFollow", desc = "Focus & follow outline window" }, 18 | }, 19 | config = function(_, opts) 20 | require('outline').setup(opts) 21 | vim.api.nvim_create_autocmd("FileType", { 22 | pattern = "Outline", 23 | callback = function() 24 | vim.api.nvim_create_autocmd("WinLeave", { 25 | buffer = 0, 26 | command = "noh", 27 | }) 28 | end 29 | }) 30 | end, 31 | opts = { 32 | preview_window = { 33 | live = true, 34 | border = 'rounded', 35 | open_hover_on_preview = false, 36 | height = 8, 37 | relative_height = false, 38 | }, 39 | symbol_folding = { 40 | auto_unfold = { 41 | only = 2, 42 | }, 43 | }, 44 | guides = { 45 | -- Keep only guides that indicate siblings that might span multiple lines (vertical) 46 | markers = { 47 | middle = ' ', 48 | bottom = ' ', 49 | } 50 | }, 51 | keymaps = { 52 | close = 'q', 53 | -- unfold_all = {}, 54 | -- fold_all = {}, 55 | -- fold_toggle = {'', ''}, 56 | }, 57 | outline_window = { 58 | position = 'left', 59 | auto_jump = true, 60 | show_cursorline = 'focus_in_outline', 61 | -- Beautiful, but not very good in indicating window focus (I don't use a 62 | -- statusline), plus at the time of writing preview window breaks this 63 | -- feature... But still beautiful nonetheless! 64 | hide_cursor = true, 65 | winhl = "OutlineDetails:LineNr,OutlineLineno:LineNr,OutlineGuides:Comment", 66 | }, 67 | outline_items = { 68 | auto_set_cursor = false, 69 | }, 70 | providers = { 71 | lsp = { blacklist_clients = {'marksman'} }, 72 | markdown = {filetypes = {'markdown', 'text'}}, 73 | priority = {'lsp', 'markdown', 'asciidoc', 'norg'}, 74 | }, 75 | symbols = { 76 | filter = { 77 | lua = { 'String', 'Package', 'Constant', exclude = true }, 78 | python = { 'Function', 'Method', 'Class' }, 79 | }, 80 | icon_fetcher = function(k, buf) 81 | local ft = vim.api.nvim_buf_get_option(buf, "ft") 82 | -- There can only be kind String in markdown so... let's not have the 83 | -- eye candy here 84 | if ft == 'markdown' and k == 'String' then 85 | return "" 86 | end 87 | return false 88 | end, 89 | icon_source = "lspkind", 90 | }, 91 | }, 92 | }, 93 | -- For testing when users from this repo reports issues. 94 | { "simrat39/symbols-outline.nvim", config=true }, 95 | } 96 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/telescope.lua: -------------------------------------------------------------------------------- 1 | local function config() 2 | 3 | local function d(s) return { desc = s } end 4 | local function map(...) vim.keymap.set(...) end 5 | 6 | -- Go to dir of selected entry 7 | local goto_dir = function(prompt_bufnr) 8 | local selection = require("telescope.actions.state").get_selected_entry() 9 | if selection == nil then 10 | print("No selection!") 11 | return 12 | end 13 | local dir = vim.fn.fnamemodify(selection.path, ":p:h") 14 | require("telescope.actions").close(prompt_bufnr) 15 | local cmd = string.format("silent lcd %s", dir) 16 | vim.cmd(cmd) 17 | print(cmd) 18 | end 19 | 20 | -- Open picker again but now in parent dir. 21 | -- Set noshowmode to prevent printed messages from being buried by "--INSERT--" 22 | local reprompt_from_parent_dir = function(picker, prompt_bufnr) 23 | -- local selection = require("telescope.actions.state").get_selected_entry() 24 | -- if selection == nil then 25 | -- print("No selection!") 26 | -- return 27 | -- end 28 | -- local dir = vim.fn.fnamemodify(selection.path, ":s?/.*$??:p:h:h") 29 | -- Let selection.path = ".config/nvim/init.lua" 30 | -- PWD = ~/.config/ 31 | -- What fnamemodify does: 32 | -- Result After operation 33 | -- ------ --------------- 34 | -- "nvim/init.lua" 35 | -- "nvim" :s?/.*$?? 36 | -- "/home/user/.config/nvim" :p 37 | -- "/home/user/.config" :h 38 | -- "/home/user" :h 39 | -- Hence it changes cwd of picker from ~/.config/ to ~/ 40 | require("telescope.actions").close(prompt_bufnr) 41 | vim.cmd("cd ..") 42 | require("telescope.builtin")[picker]() 43 | print("Using "..vim.fn.getcwd()) 44 | end 45 | 46 | -- Open picker again but now in git root if available. 47 | -- Set noshowmode to prevent printed messages from being buried by "--INSERT--" 48 | local reprompt_from_git_root = function(picker, prompt_bufnr) 49 | vim.fn.system({"git", "rev-parse", "--is-inside-work-tree"}) 50 | if vim.v.shell_error == 0 then 51 | local opts = { 52 | cwd = vim.fn.fnamemodify(vim.fn.finddir(".git", ".;"), ":h"), 53 | } 54 | require("telescope.actions").close(prompt_bufnr) 55 | require("telescope.builtin")[picker](opts) 56 | print("Using "..opts.cwd) 57 | else 58 | print("Failed to find git root") 59 | end 60 | end 61 | 62 | map("n", "ff", "Telescope find_files", d"Telescope find_files") 63 | map("n", "fr", "Telescope oldfiles", d"Telescope oldfiles") 64 | map("n", "fg", "Telescope live_grep", d"Telescope live_grep") 65 | map("n", "fb", "Telescope buffers", d"Telescope buffers") 66 | map("n", "bb", "Telescope buffers", d"Telescope buffers") 67 | map("n", "fh", "Telescope help_tags", d"Telescope help_tags") 68 | map("n", "fR", "Telescope registers", d"Telescope registers (also see rg)") 69 | 70 | require('telescope').setup({ 71 | defaults = { 72 | -- layout_config = { 73 | -- vertical = { width = 0.3 }, 74 | -- horizontal = { width = 0.5 }, 75 | -- }, 76 | -- preview = { 77 | -- filesize_limit = 0.1, -- MB 78 | -- }, 79 | -- theme = "dropdown", 80 | mappings = { 81 | n = { 82 | ["cd"] = goto_dir, 83 | }, 84 | i = { 85 | [""] = "close", 86 | }, 87 | }, 88 | }, 89 | pickers = { 90 | find_files = { 91 | mappings = { 92 | n = { 93 | [""] = function(...) return reprompt_from_parent_dir("find_files", ...) end, 94 | [""] = function(...) return reprompt_from_git_root("find_files", ...) end, 95 | }, 96 | }, 97 | }, 98 | live_grep = { 99 | mappings = { 100 | n = { 101 | [""] = function(...) return reprompt_from_parent_dir("live_grep", ...) end, 102 | [""] = function(...) return reprompt_from_git_root("live_grep", ...) end, 103 | }, 104 | }, 105 | }, 106 | }, 107 | }) 108 | require('telescope').load_extension('fzf') 109 | end 110 | 111 | return { 112 | 'nvim-telescope/telescope.nvim', tag = '0.1.4', 113 | enabled = vim.fn.has("nvim-0.9") == 1, 114 | dependencies = { 115 | 'nvim-lua/plenary.nvim', 116 | { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, 117 | }, 118 | config = config, 119 | } 120 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/treesitter.lua: -------------------------------------------------------------------------------- 1 | local function config() 2 | vim.filetype.add({ extension = { cog = "cognate" } }) 3 | vim.api.nvim_create_autocmd("FileType", { 4 | pattern = "cognate", 5 | callback = function(event) vim.bo[event.buf].commentstring = "~~ %s" end, 6 | }) 7 | vim.treesitter.language.add('cognate', { path = "/Users/hedy/projects/tree-sitter-cognate/cognate.dylib" }) 8 | vim.bo.commentstring = "~~ %s" 9 | require("Comment.ft").set("cognate", {"~~ %s", "~%s~"}) 10 | 11 | local parser_config = require "nvim-treesitter.parsers".get_parser_configs() 12 | parser_config.hy = { 13 | install_info = { 14 | url = "https://github.com/kwshi/tree-sitter-hy", 15 | files = {"src/parser.c"}, 16 | branch = "main", 17 | generate_requires_npm = false, 18 | requires_generate_from_grammar = false, 19 | }, 20 | filetype = "hy", 21 | } 22 | 23 | local configs = require("nvim-treesitter.configs") 24 | configs.setup({ 25 | ensure_installed = { 26 | "cpp", "lua", "vim", "vimdoc", "html", "css", "go", "bash", "regex", "markdown", "markdown_inline", "query", "toml", "vimdoc", "python", "diff", "javascript", "hy", "vento", "nim", "racket", "v", "haskell", "zig", "rust", "nu", "just" 27 | }, 28 | sync_install = false, 29 | highlight = { enable = true }, 30 | indent = { enable = true }, 31 | -- Textobjects, see below as well 32 | textobjects = { 33 | select = { 34 | enable = true, 35 | -- Automatically jump forward to textobj, similar to targets.vim 36 | lookahead = true, 37 | keymaps = { 38 | -- You can use the capture groups defined in textobjects.scm 39 | ["af"] = { query = "@function.outer", desc = "Around function" }, 40 | ["if"] = { query = "@function.inner", desc = "Inside function" }, 41 | ["ac"] = { query = "@class.outer", desc = "Around class" }, 42 | ["ic"] = { query = "@class.inner", desc = "Inside class" }, 43 | -- You can also use captures from other query groups like `locals.scm` 44 | ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" }, 45 | }, 46 | include_surrounding_whitespace = false, 47 | }, 48 | move = { 49 | enable = true, 50 | set_jumps = true, 51 | goto_next = { 52 | ["]p"] = "@parameter.outer", 53 | }, 54 | goto_previous = { 55 | ["[p"] = "@parameter.outer", 56 | }, 57 | } 58 | }, 59 | }) 60 | 61 | -- TS context 62 | require("treesitter-context").setup { 63 | enable = true, 64 | max_lines = 5, 65 | min_window_height = 20, 66 | line_numbers = true, 67 | -- Maximum number of lines to show for a single context 68 | multiline_threshold = 5, 69 | -- Which context lines to discard if `max_lines` is exceeded. inner/outer 70 | trim_scope = 'outer', 71 | mode = 'cursor', -- Line used to calculate context: cursor/topline 72 | -- Separator between context and content. Should be a single character 73 | -- string, like '-'. When separator is set, the context will only show up 74 | -- when there are at least 2 lines above cursorline. 75 | separator = nil, 76 | zindex = 20, -- The Z-index of the context window 77 | on_attach = nil, -- (fun(buf: integer): boolean) 78 | } 79 | 80 | --- TS textobjects --- 81 | vim.keymap.set("n", "].", function() 82 | local t = require("nvim-treesitter.ts_utils") 83 | local node = t.get_node_at_cursor() 84 | if node ~= nil then 85 | t.goto_node(t.get_next_node(node, true, true), false, true) 86 | end 87 | end, 88 | { desc = "Go to next sibling node" } 89 | ) 90 | vim.keymap.set("n", "[.", function() 91 | local t = require("nvim-treesitter.ts_utils") 92 | local node = t.get_node_at_cursor() 93 | if node ~= nil then 94 | t.goto_node(t.get_previous_node(node, true, true), false, true) 95 | end 96 | end, 97 | { desc = "Go to previous sibling node" } 98 | ) 99 | 100 | -- Textobject setup{} opts were set at the top along with treesitter. 101 | -- Allow repeat keys 102 | local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move" 103 | -- ensure ; goes forward and , goes backward regardless of the last direction 104 | vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move_next) 105 | vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_previous) 106 | -- vim way: ; goes to the direction you were moving. 107 | -- vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move) 108 | -- vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_opposite) 109 | -- Optionally, make builtin f, F, t, T also repeatable with ; and , 110 | vim.keymap.set({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f) 111 | vim.keymap.set({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F) 112 | vim.keymap.set({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t) 113 | vim.keymap.set({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T) 114 | end 115 | 116 | return { 117 | { "nvim-treesitter/nvim-treesitter", 118 | enabled = vim.fn.has('nvim-0.9') == 1, 119 | build = ":TSUpdate", 120 | version = false, 121 | event = "VeryLazy", 122 | cmd = { "TSUpdateSync", "TSUpdate", "TSInstall", "Inspect", "InspectTree" }, 123 | dependencies = { 124 | { "nushell/tree-sitter-nu" }, 125 | }, 126 | config = config, 127 | }, 128 | -- Setting these as dependencies of nvim-treesitter causes error of invalid 129 | -- query. 130 | { "nvim-treesitter/nvim-treesitter-context", 131 | enabled = vim.fn.has('nvim-0.9') == 1, 132 | }, 133 | { "nvim-treesitter/nvim-treesitter-textobjects", 134 | enabled = vim.fn.has('nvim-0.9') == 1, 135 | }, 136 | } 137 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/tundra.lua: -------------------------------------------------------------------------------- 1 | -- { "dracula/vim", 2 | -- name = "dracula", lazy = false, priority = 10000, 3 | -- config = function() vim.cmd("colorscheme dracula") end, 4 | -- enabled = false, -- LOL I've switched to tundra semi-temporarily 5 | -- }, 6 | -- The thing about using dracula theme in nvim here is the annoyance of having 7 | -- to use lua APIs to interact with something that was designed for vimscript. 8 | -- With "modern" nvim plugins where the themes are written in 100% lua, 9 | -- configuring everything else (such as statusline colors) reusing values 10 | -- defined in these themes provide a much smoother, cleaner configuration. 11 | -- 12 | -- This is by no means a /political/ (ahem) statement suggesting my abandoning 13 | -- of the holy dracula theme. I just, well, decided to try something new since 14 | -- I sort of realized there is no "perfect" or "best" theme. 15 | -- 16 | -- After hours of blood, pain, and tears of trying to tweak dracula colors to 17 | -- be easier on the eyes and have greater contrast, I took one look at the 18 | -- carousel of themes from NvChad and fell in love with tundra... 19 | -- 20 | -- So I did find dracula.nvim, but I've already integrated tundra well. 21 | 22 | local function config() 23 | local s = require('nvim-tundra.stylesheet.arctic') 24 | 25 | -- See also: statusline.lua for statusline colors (which I also use tundra's 26 | -- stylesheet) 27 | 28 | -- bg.cursorline is used elsewhere, rather than digging into all the places 29 | -- that they are used and make it lighter (increase contrast) I'd change change 30 | -- the field here, and optionally set the actual Cursorline highlight group 31 | -- back if needed. 32 | s.bg.cursorline = s.cp.gray._700 33 | 34 | require("nvim-tundra").setup { 35 | transparent_background = false, 36 | dim_inactive_windows = { enabled = true }, 37 | sidebars = { enabled = true }, 38 | editor = { search = {}, substitute = {}, }, 39 | syntax = { 40 | booleans = {}, 41 | comments = {}, 42 | conditionals = {}, 43 | constants = { bold = true }, 44 | fields = {}, 45 | functions = {}, 46 | keywords = {}, 47 | loops = {}, 48 | numbers = {}, 49 | operators = { bold = true }, 50 | punctuation = {}, 51 | strings = {}, 52 | types = { italic = true }, 53 | }, 54 | diagnostics = { errors = {}, warnings = {}, information = {}, hints = {}, }, 55 | plugins = { 56 | lsp = true, 57 | semantic_tokens = true, 58 | treesitter = true, 59 | telescope = true, 60 | nvimtree = true, 61 | cmp = true, 62 | context = true, 63 | dbui = true, 64 | gitsigns = true, 65 | neogit = true, 66 | textfsm = true, 67 | }, 68 | overwrite = { 69 | colors = {}, 70 | highlights = { 71 | TreesitterContext = { bg = "#283343" }, 72 | Folded = { 73 | fg = s.cp.gray._400, 74 | bg = s.cp.gray._700 75 | }, 76 | IblIndent = { fg = s.cp.gray._1000 }, 77 | IblScope = { fg = s.cp.opal._500 }, 78 | Comment = { fg = s.cp.gray._400 }, -- Add more contrast 79 | -- Inspired by Modus-Vivendi (emacs). 80 | -- Shows the matched pair more visibly 81 | MatchParen = { bg = s.cp.gray._500 }, 82 | -- Fix completion menu border color 83 | FloatBorder = { fg = s.cp.gray._500 }, 84 | }, 85 | }, 86 | } 87 | 88 | vim.o.background = "dark" 89 | vim.cmd("colorscheme tundra") 90 | end 91 | 92 | return { 93 | -- Must be loaded before ibl! 94 | "sam4llis/nvim-tundra", lazy = false, priority = 10000, 95 | config = config, 96 | } 97 | 98 | -- return { 99 | -- "craftzdog/solarized-osaka.nvim", 100 | -- lazy = false, 101 | -- priority = 1000, 102 | -- config = function() 103 | -- require('solarized-osaka').setup({ 104 | -- transparent = false, 105 | -- styles = { 106 | -- floats = "transparent", 107 | -- } 108 | -- }) 109 | -- vim.cmd("colorscheme solarized-osaka") 110 | -- end 111 | -- } 112 | -------------------------------------------------------------------------------- /.config/nvim/snippets/cpp.snippets: -------------------------------------------------------------------------------- 1 | snippet for 2 | for(int ${1:i}=0; ${1:i}<${2:n}; ++${1:i}) { 3 | ${0:$VISUAL} 4 | } 5 | 6 | snippet read2 7 | int ${1:n}, ${2:m}; cin >> ${1:n} >> ${2:m}; 8 | 9 | snippet readv 10 | Vi ${1:A}; 11 | for(int i=0; i<${2:n}; ++i) { 12 | int x; cin >> x; 13 | A.push_back(x); 14 | } 15 | 16 | snippet fr 17 | ${1:A}.begin(), ${1:A}.end() 18 | 19 | snippet pb 20 | push_back 21 | 22 | snippet sort 23 | sort(${1:A}.begin(), ${1:A}.end()); 24 | 25 | snippet sortrev 26 | sort(${1:A}.begin(), ${1:A}.end(), greater()); 27 | 28 | snippet cout 29 | cout << ${0:$VISUAL}; 30 | 31 | snippet print 32 | cout << ${0:$VISUAL}; 33 | 34 | snippet cout 35 | cout << ${0:$VISUAL}; 36 | 37 | snippet cendl 38 | cout << endl; 39 | 40 | snippet cerr 41 | cerr << ${0:$VISUAL}; 42 | 43 | snippet println 44 | cout << ${0:$VISUAL} << endl; 45 | 46 | snippet println2 47 | cout << ${1} << ${2} << endl; 48 | 49 | snippet func 50 | ${1:int} ${2:solve}(Vi &${3:A}) { 51 | ${0:$VISUAL} 52 | } 53 | 54 | snippet init 55 | #include 56 | using namespace std; 57 | 58 | int main() { 59 | ${0:$VISUAL} 60 | } 61 | 62 | -------------------------------------------------------------------------------- /.config/nvim/templates/skeleton.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | progname=$(basename "$0") 5 | 6 | -------------------------------------------------------------------------------- /.config/omf/bundle: -------------------------------------------------------------------------------- 1 | package bass 2 | package z 3 | theme default 4 | -------------------------------------------------------------------------------- /.config/omf/channel: -------------------------------------------------------------------------------- 1 | stable 2 | -------------------------------------------------------------------------------- /.config/omf/theme: -------------------------------------------------------------------------------- 1 | default 2 | -------------------------------------------------------------------------------- /.config/senpai/highlight: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | mkdir -p ~/.local/senpai/ 4 | echo "$BUFFER" '<'"$SENDER"'>' "$MESSAGE" >> ~/.local/senpai/hi 5 | -------------------------------------------------------------------------------- /.config/vimini/config.toml: -------------------------------------------------------------------------------- 1 | [styles.document.colors] 2 | background_color = [0x1e, 0x1e, 0x2e] 3 | text_color = [0xcd, 0xd6, 0xf4] 4 | link_color = [0x89, 0xb4, 0xfa] 5 | pre_color = [0x94, 0xe2, 0xd5] 6 | header1_color = [0xf5, 0xe0, 0xdc] 7 | header2_color = [0xf5, 0xc2, 0xe7] 8 | header3_color = [0xcb, 0xa6, 0xf7] 9 | quote_color = [0xa6, 0xe3, 0xa1] 10 | list_item_color = [0x74, 0xc7, 0xec] 11 | 12 | [pki] 13 | client_certificate_path = "/Users/hedy/certkey.pem" 14 | -------------------------------------------------------------------------------- /.config/yadm/encrypt: -------------------------------------------------------------------------------- 1 | .config/aerc/accounts.conf 2 | .config/senpai/senpai.scfg 3 | .gnupg/*.gpg 4 | .gnupg/*.conf 5 | .gnupg/*.d 6 | .gnupg/*.kbx* 7 | .gnupg/*.db 8 | .ssh/key* 9 | .ssh/config 10 | cert.pem 11 | key.pem 12 | -------------------------------------------------------------------------------- /.elinks/elinks.conf: -------------------------------------------------------------------------------- 1 | # FIXME: DOESN"T WORK 2 | set document.browse.links.active_link.enable_color = 0 3 | set document.browse.links.active_link.invert = 0 4 | set document.browse.links.active_link.underline = 1 5 | set document.browse.links.active_link.bold = 1 6 | set document.colors.link = "#83c1fc" 7 | set document.colors.image = "gray" 8 | # set document.browse.links.active_link.colors.background = "#83c1fc" 9 | # set document.browse.links.active_link.colors.background = "#444444" 10 | # set document.browse.links.active_link.colors.text = "white" 11 | -------------------------------------------------------------------------------- /.emacs-profiles.el: -------------------------------------------------------------------------------- 1 | (("default" . ((user-emacs-directory . "~/.config/emacs"))) 2 | ("test" . ((user-emacs-directory . "~/.config/emacstest"))) 3 | ("doom" . ((user-emacs-directory . "~/.doomemacs") 4 | (env . (("EMACSDIR" . "~/.doomemacs") 5 | ("DOOMDIR" . "~/.config/doom")))))) 6 | -------------------------------------------------------------------------------- /.exportenvs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export EDITOR=nv 4 | export DOOMDIR=~/.config/doom/ 5 | export EMACSDIR=~/.doomemacs/ 6 | export PROJECTS_ROOT=~/projects 7 | export BROWSER=elinks 8 | export FILEMAN=ranger 9 | export TERM=xterm-256color 10 | export GPG_TTY=$(tty) 11 | 12 | # telemetry shit 13 | export DO_NOT_TRACK=1 # https://consoledonottrack.com 14 | export DOTNET_CLI_TELEMETRY_OPTOUT=1 15 | export HINT_TELEMETRY="off" 16 | export GATSBY_TELEMETRY_OPTOUT=1 17 | export NEXT_TELEMETRY_DEBUG=1 18 | export NUXT_TELEMETRY_DISABLED=1 19 | export ET_NO_TELEMETRY=1 20 | export NG_CLI_ANALYTICS=false 21 | export INFLUXD_REPORTING_DISABLED=true 22 | export NG_CLI_ANALYTICS=false 23 | export CHOOSENIM_NO_ANALYTICS=1 24 | export POWERSHELL_TELEMETRY_OPTOUT=1 25 | 26 | # XDG Base Directory Specification 27 | export XDG_CONFIG_HOME="$HOME/.config" 28 | export XDG_DATA_HOME="$HOME/.local/share" 29 | export XDG_CACHE_HOME="$HOME/.cache" 30 | export XDG_USER_CONFIG_DIR="$XDG_CONFIG_HOME" 31 | 32 | # Paths 33 | export LD_LIBRARY_PATH="$HOME/local/lib/x86_64-linux-gnu/:$HOME/local/lib:/opt/pkgsrc/opt/pkg/lib:/opt/pkg/lib" 34 | export DYLD_LIBRARY_PATH="/opt/pkgsrc/opt/pkg/lib" 35 | export PKG_CONFIG_PATH="$HOME/local/lib/x86_64-linux-gnu/pkgconfig:$HOME/local/pkgconfig:/opt/pkg/lib/pkgconfig/" 36 | 37 | # Add $NVM_DIR/versions/node//bin to addpath to enable node on startup 38 | export NVM_DIR="$HOME/.config/nvm" 39 | export PNPM_HOME="$HOME/.local/share/pnpm" 40 | 41 | # GPG 42 | export PASH_KEYID="F92200AF40D013F0" 43 | 44 | export HOMEBREW_PREFIX="/opt/homebrew" 45 | export HOMEBREW_CELLAR="/opt/homebrew/Cellar" 46 | export HOMEBREW_REPOSITORY="/opt/homebrew" 47 | export DENO_INSTALL="$HOME/.deno" 48 | export BUN_INSTALL="$HOME/.bun" 49 | -------------------------------------------------------------------------------- /.gitconfig: -------------------------------------------------------------------------------- 1 | [core] 2 | editor = $EDITOR 3 | autocrlf = input 4 | excludesfile = ~/.gitignore_global 5 | pager = diff-so-fancy | less --tabs=4 -RFX 6 | 7 | [user] 8 | name = ~hedy 9 | email = hedy.dev@protonmail.com 10 | signingkey = B51B5A8D1B176372 11 | 12 | [init] 13 | # Well, it's shorter. 14 | defaultBranch = main 15 | 16 | [alias] 17 | s = status -s 18 | c = commit 19 | b = branch 20 | a = add 21 | unadd = restore --staged 22 | ls-alias = config --get-regexp alias 23 | l = log --oneline 24 | ll = log 25 | ss = status 26 | ch = checkout 27 | chb = checkout -b 28 | mylog = log --pretty=format:'%C(white)%h %C(blue)%an %C(green)%as %C(white)"%s"' 29 | lgraph = log --oneline --graph --decorate --all 30 | brd = branch -d 31 | fame = !python3 -m gitfame 32 | p = push 33 | cam = commit -am # rarely used; cav and cv are now my best friends :> 34 | cav = commit -av 35 | cv = commit -v 36 | cm = commit -m 37 | coops = commit --amend --no-edit # commit... oops! 38 | pushall = !git remote | xargs -L1 git push --all 39 | # Same as pushall but not for all branches 40 | pall = !git remote | xargs -L1 git push 41 | pallt = !git remote | xargs -L1 git push --follow-tags 42 | d = diff 43 | ds = diff --staged 44 | 45 | [credential] 46 | helper = store --file="$HOME/.git_creds" 47 | helper = cache --timeout 90000 48 | 49 | [help] 50 | autocorrect = 30 51 | 52 | [pull] 53 | rebase = false 54 | 55 | [commit] 56 | gpgsign = true 57 | 58 | # sendmail config in [include] 59 | 60 | [include] 61 | path = ~/.gitconfig-local 62 | 63 | # diff-so-fancy 64 | [color] 65 | ui = true 66 | [color "diff-highlight"] 67 | oldNormal = red bold 68 | oldHighlight = red bold 52 69 | newNormal = green bold 70 | newHighlight = green bold 22 71 | [color "diff"] 72 | meta = 11 73 | frag = magenta bold 74 | commit = yellow bold 75 | old = red bold 76 | new = green bold 77 | whitespace = red reverse 78 | [push] 79 | followTags = false 80 | -------------------------------------------------------------------------------- /.gitignore_global: -------------------------------------------------------------------------------- 1 | .vim/ 2 | # vim-obsession 3 | Session.vim 4 | .DS_Store 5 | *.tags 6 | -------------------------------------------------------------------------------- /.irbrc: -------------------------------------------------------------------------------- 1 | IRB.conf[:PROMPT_MODE] = :SIMPLE 2 | -------------------------------------------------------------------------------- /.local/share/yadm/archive: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hedyhli/dotfiles/3ce506ef19300ac167807a5bca07e8cfec271394/.local/share/yadm/archive -------------------------------------------------------------------------------- /.qutebrowser/config.py: -------------------------------------------------------------------------------- 1 | import dracula.draw 2 | 3 | # Load existing settings made via :set 4 | config.load_autoconfig() 5 | 6 | dracula.draw.blood(c, { 7 | 'spacing': { 8 | 'vertical': 6, 9 | 'horizontal': 8 10 | } 11 | }) 12 | -------------------------------------------------------------------------------- /.startup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # This script should be run at start up by sh-like shells 4 | # This of course does not include fish. 5 | # For fish see ~/dotscripts/setup/fish and ~/.config/fish/config.fish 6 | 7 | # Determine current running shell. 8 | # https://unix.stackexchange.com/a/72475 9 | if test -n "$ZSH_VERSION"; then 10 | CURSHELL=zsh 11 | elif test -n "$FISH_VERSION"; then 12 | CURSHELL=fish 13 | elif test -n "$BASH_VERSION"; then 14 | CURSHELL=bash 15 | elif test -n "$KSH_VERSION"; then 16 | CURSHELL=ksh 17 | elif test -n "$FCEDIT"; then 18 | CURSHELL=ksh 19 | elif test -n "$NU_VERISON"; then 20 | CURSHELL=nu 21 | elif test -n "$PS3"; then 22 | CURSHELL=unknown 23 | else 24 | CURSHELL=sh 25 | fi 26 | 27 | # Aliases 28 | source ~/.aliases 29 | 30 | # Add the paths 31 | export PATH="$(~/dotscripts/convert/addpath):$PATH" 32 | 33 | # Hook (the) direnv 34 | if ! command -v direnv &> /dev/null; then 35 | # TODO: Ignore if direnv hook retured status 1 36 | eval "$(direnv hook $CURSHELL)" 37 | fi 38 | 39 | # export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" 40 | # ^ Above is commented because it's already in ~/.exportenvs 41 | # Load (the) nvm 42 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" 43 | [ -s "$HOME/.exportenvs" ] && \. "$HOME/.exportenvs" 44 | 45 | # Pyenv 46 | if ! command -v pyenv &> /dev/null; then 47 | eval "$(pyenv init -)" 48 | fi 49 | -------------------------------------------------------------------------------- /.tmux.conf: -------------------------------------------------------------------------------- 1 | set-environment -g PATH "$HOME/bin:$HOME/local/bin:/opt/homebrew/bin:/opt/pkg/bin:/usr/local/bin:/usr/games:/usr/bin:/bin" 2 | 3 | # Vi keys in copy mode 4 | setw -g mode-keys vi 5 | 6 | # Quick ESC reponse in (n)vim 7 | set -sg escape-time 0 8 | 9 | set -g visual-activity off 10 | 11 | # terminal stuff 12 | set -g default-terminal "xterm-256color" 13 | # set -g terminal-overrides ",tmux-256color:Tc" 14 | set-option -sa terminal-overrides ",*:Tc" 15 | 16 | # Splitting panes 17 | bind-key v split-window -h 18 | bind-key h split-window -v 19 | 20 | # Titles 21 | set -g set-titles on 22 | set -g set-titles-string "#T" 23 | 24 | # Keys 25 | unbind r; bind r source-file ~/.tmux.conf \; display 'Reloaded tmux config' # Quick config reload 26 | unbind g; bind g set status # Toggle status bar 27 | 28 | source ~/.tmux/theme/tmux.conf 29 | -------------------------------------------------------------------------------- /.tmux/theme/tmux.conf: -------------------------------------------------------------------------------- 1 | # Based on catppuccin/tmux with mocha + `./catppuccin.tmux` (replace the last 2 | # tmux call with an echo or similar) 3 | 4 | set-option -gq status "on" ; 5 | set-option -gq status-justify "left" ; 6 | set-option -gq status-style "bg=default,fg=black" ; 7 | set-option -gq status-left-length "100" ; 8 | set-option -gq status-right-length "100" ; 9 | 10 | set-option -gq message-style "fg=cyan,bg=#313244,align=centre" ; 11 | set-option -gq message-command-style "fg=#89dceb,bg=#313244,align=centre" ; 12 | set-option -gq menu-style "default" ; 13 | set-option -gq menu-selected-style "fg=#313244,bg=#f9e2af" ; 14 | set-option -gq menu-border-style "default" ; 15 | set-window-option -gq pane-border-status "off" ; 16 | set-window-option -gq pane-active-border-style "#{?pane_in_mode,fg=#f9e2af,#{?pane_synchronized,fg=#cba6f7,fg=#fab387}}"; 17 | set-window-option -gq pane-border-style "fg=#313244" ; 18 | set-window-option -gq pane-border-format "" ; 19 | set-window-option -gq window-status-separator " " ; 20 | set-window-option -gq window-status-format "#[fg=#1e1e2e,bg=default,nobold,nounderscore,noitalics]#[fg=gray,bg=default]#I#[fg=gray,bg=default,nobold,nounderscore,noitalics] | #[fg=gray,bg=default]#W#[fg=#1e1e2e,bg=default]"; 21 | set-window-option -gq window-status-current-format "#[fg=#313244,bg=default,nobold,nounderscore,noitalics]#[fg=green,bg=#313244]#I#[fg=green,bg=#313244,nobold,nounderscore,noitalics] | #[fg=green,bg=#313244]#W#[fg=#313244,bg=default]" ; 22 | 23 | set-option -gq status-left "#[bg=default,nobold,nounderscore,noitalics]#{?client_prefix,#[fg=yellow#,bg=terminal],#[fg=black#,bg=terminal#]} ^B "; 24 | set-option -gq status-right "#[bg=default,nobold,nounderscore,noitalics]#[fg=blue,bg=#1e1e2e] [#S]#[bg=default,nobold,nounderscore,noitalics]"; 25 | 26 | set-window-option -gq clock-mode-colour "#89b4fa"; 27 | set-window-option -gq mode-style "fg=#f5c2e7 bg=#585b70 bold"; 28 | -------------------------------------------------------------------------------- /.vimrc: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | 3 | """""""""""""""" 4 | " Vundle Plugins 5 | """""""""""""""" 6 | filetype off 7 | set rtp+=~/.vim/bundle/Vundle.vim 8 | call vundle#begin() 9 | 10 | Plugin 'VundleVim/Vundle.vim' 11 | Plugin 'dracula/vim', {'name': 'dracula'} " dracula color theme 12 | Plugin 'stautob/vim-fish' " fish support for vim 13 | Plugin 'tpope/vim-surround' " quoting and parenthesizing plugin 14 | " Plugin 'preservim/nerdcommenter' " commenting made simple 15 | Plugin 'tpope/vim-commentary' 16 | Plugin 'bling/vim-bufferline' " buffer line 17 | Plugin 'preservim/nerdtree' " NERDTree :) 18 | Plugin 'townk/vim-autoclose' 19 | 20 | call vundle#end() 21 | filetype plugin indent on 22 | " Brief help 23 | " :PluginList - lists configured plugins 24 | " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate 25 | " :PluginSearch foo - searches for foo; append `!` to refresh local cache 26 | " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal 27 | " see :h vundle for more details or wiki for FAQ 28 | 29 | " end of vundle stuff 30 | 31 | 32 | """""""""""""""""" 33 | " General settings 34 | """""""""""""""""" 35 | if has('termguicolors') 36 | "dracula looks like shit without termguicolors 37 | set termguicolors 38 | let &t_8f = "\[38;2;%lu;%lu;%lum" 39 | let &t_8b = "\[48;2;%lu;%lu;%lum" 40 | colorscheme dracula 41 | else 42 | colorscheme lunaperche 43 | " Other good ones: 44 | " - darkblue - Looks like dracula but BLUEEEE 45 | " - desert - reminds me of zenburn 46 | " - elflord - like modus operandi in emacs! - but not as appealing 47 | " - habamax - looks like monokai... - mild contrast everywhere 48 | " - lunaperche - good contrast for comments - like modus operandi! but 49 | " less purples 50 | " - quiet - light 51 | " - shine - light (best light theme?) 52 | " - slate - blue - low contrast for comments 53 | " TODO: Use a non-dracula theme but ensure correct background for each 54 | " theme is set correctly just like dracula, so terminal bg is not used 55 | " when the text does not fit on entire width of terminal. 56 | " FIXME: My attempt to replicate dracula's selection but keep fg 57 | " highlights feature... 58 | " TODO: Ensure search highlights are non-obstrusive like in emacs for all 59 | " themes. 60 | let g:dracula#palette = {} 61 | let g:dracula#palette.selection = ['#44475A', 239] 62 | let s:none = ['NONE', 'NONE'] 63 | let s:selection = g:dracula#palette.selection 64 | function! s:h(scope, fg, ...) " bg, attr_list, special 65 | let l:fg = copy(a:fg) 66 | let l:bg = get(a:, 1, ['NONE', 'NONE']) 67 | let l:attr_list = filter(get(a:, 2, ['NONE']), 'type(v:val) == 1') 68 | let l:attrs = len(l:attr_list) > 0 ? join(l:attr_list, ',') : 'NONE' 69 | let l:special = get(a:, 3, ['NONE', 'NONE']) 70 | if l:special[0] !=# 'NONE' && l:fg[0] ==# 'NONE' && !g:dracula_full_special_attrs_support 71 | let l:fg[0] = l:special[0] 72 | let l:fg[1] = l:special[1] 73 | endif 74 | let l:hl_string = [ 75 | \ 'highlight', a:scope, 76 | \ 'guifg=' . l:fg[0], 'ctermfg=' . l:fg[1], 77 | \ 'guibg=' . l:bg[0], 'ctermbg=' . l:bg[1], 78 | \ 'gui=' . l:attrs, 'cterm=' . l:attrs, 79 | \ 'guisp=' . l:special[0], 80 | \] 81 | execute join(l:hl_string, ' ') 82 | endfunction 83 | call s:h('DraculaSelection', s:none, s:selection) 84 | hi! link PmenuSel DraculaSelection 85 | hi! link PmenuThumb DraculaSelection 86 | hi! link Visual DraculaSelection 87 | endif 88 | 89 | " space is used in my neovim and emacs 90 | " and I just learnt after using emacs evil mode that `;` existed, so I 91 | " can't set it to that either... 92 | " ALSO this is insane but I had no idea before learning `;` that f and t 93 | " existed 🤦 94 | " So I gave up exercising muscle memory for different leaders across neovim, 95 | " vim, emacs evil mode... 96 | let mapleader=" " 97 | set number 98 | set relativenumber 99 | syntax on 100 | set mouse=a " allow mouse for all 101 | set undofile " save undo to a file 102 | set hlsearch " highlight search 103 | set showcmd " show incomplete commands 104 | set wildmenu " command line's tab complete in a menu 105 | " set cursorline " highlight cursor line 106 | set noerrorbells " no beeps 107 | set visualbell " flash screen instead 108 | set title " set window title to file name 109 | set autoindent 110 | set softtabstop=2 " indent by 2 spaces when with tab 111 | set tabstop=4 " show existing tab with 4 spaces width 112 | set shiftwidth=4 113 | set wrap " dont wrap 114 | set incsearch " find next match while typing search 115 | set linebreak " wrap lines at convenient points 116 | " set scrolloff=6 " screen lines to keep above and below cursor 117 | set sidescrolloff=8 " screen columns to keep on left and right of cursor 118 | set confirm " display confirmation when closing unsaved file 119 | set encoding=utf-8 " set encoding with Unicode 120 | set lazyredraw " don't redraw when exe macros 121 | set showmatch " match brackets when text indecator is over it 122 | set mat=2 " how mny tenths of second to blink when matching brackets 123 | 124 | set laststatus=2 " show status line 125 | set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L\ \|\ col\ %c) 126 | 127 | " Configure backspace so it acts as it should act 128 | set backspace=eol,start,indent 129 | set whichwrap+=<,>,h,l 130 | 131 | " fold settings 132 | set foldenable 133 | set foldlevelstart=10 134 | set foldnestmax=10 135 | set foldmethod=manual 136 | set foldcolumn=2 137 | 138 | 139 | "set the swp, backup and undo settings 140 | set noswapfile 141 | set nobackup nowritebackup 142 | set undodir=~/.vim/undodir 143 | set undofile 144 | 145 | " Ignore compiled files 146 | set wildignore=*.o,*~,*.pyc 147 | if has("win16") || has("win32") 148 | set wildignore+=.git\*,.hg\*,.svn\* 149 | else 150 | set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store 151 | endif 152 | 153 | " Return to last edit position when opening files (You want this!) 154 | au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 155 | 156 | " highlight extra whitespace 157 | " Was using ErrorMsg, was scary. 158 | match Underlined '\s\+$' 159 | 160 | """"""""""" 161 | " Mappings 162 | """""""""" 163 | " enabling clipboard syncing in WSL 164 | source $HOME/iswsl.vim 165 | if IsWSL() 166 | let s:clip = '/mnt/c/Windows/System32/clip.exe' 167 | if executable(s:clip) 168 | augroup WSLYank 169 | autocmd! 170 | autocmd TextYankPost * call system('echo '.shellescape(join(v:event.regcontents, "\")).' | '.s:clip) 171 | augroup END 172 | end 173 | map "=p :r !powershell.exe -Command Get-Clipboard 174 | map! = :r !powershell.exe -Command Get-Clipboard 175 | noremap "+p :exe 'norm a'.system('/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command Get-Clipboard') 176 | endif 177 | 178 | " leader mappings 179 | nnoremap rn :set relativenumber! 180 | nnoremap z zR 181 | nnoremap w :w 182 | nnoremap x :wqa 183 | nnoremap q :qa 184 | noremap n :NERDTreeToggle % 185 | " no highlight - when finished search 186 | nnoremap nh :noh 187 | " paste shortcut below 188 | " must be recursive bcus "+p is aldy mapped above (in WSLYank - paste) 189 | nmap pa "+p 190 | nnoremap rg :registers 191 | 192 | " other mappings 193 | " dot command in visual mode 194 | vnoremap . :normal. 195 | " Lets try Ex Mode! 196 | " nnoremap Q :q 197 | " move visual selection 198 | vnoremap J :m '>+1gv=gv 199 | vnoremap K :m '<-2gv=gv 200 | 201 | if IsWSL() 202 | execute "set =\ej" 203 | execute "set =\ek" 204 | execute "set =\eJ" 205 | execute "set =\eK" 206 | endif 207 | 208 | nnoremap :m+1== 209 | nnoremap :m-2== 210 | 211 | nnoremap :t.== 212 | nnoremap :t.-1== 213 | 214 | " Visual mode pressing * or # searches for the current selection 215 | " Super useful! From an idea by Michael Naumann 216 | vnoremap * :call VisualSelection('', '')/=@/ 217 | vnoremap # :call VisualSelection('', '')?=@/" 218 | 219 | " Smart way to move between windows 220 | map j 221 | map k 222 | map h 223 | map l 224 | 225 | " Useful mappings for managing tabs 226 | map tn :tabnew 227 | map to :tabonly 228 | map tc :tabclose 229 | map tm :tabmove 230 | map t :tabnext 231 | map bn :bnext 232 | map bp :bprev 233 | 234 | noremap n :NERDTreeToggle % 235 | 236 | 237 | """""""""""""""" 238 | " other settings 239 | """""""""""""""" 240 | " setting the shell for fish to sh 241 | "if &shell =~# 'fish$' 242 | " set shell=bash 243 | "endif 244 | 245 | -------------------------------------------------------------------------------- /.weechat/.weerc: -------------------------------------------------------------------------------- 1 | # 2 | # WeeChat 3.3 (compiled on Sep 19 2021 11:50:23) 3 | # 4 | # Use /autoconf load or cat this file to the FIFO pipe. 5 | # 6 | # For more info, see https://weechat.org/scripts/source/autoconf.py.html 7 | # 8 | 9 | */set Option changed: weechat.look.day_change_message_1date "-- %d %b %Y --" 10 | */set Option changed: weechat.look.day_change_message_2dates "-- %%d %%b %%Y (%d %b %Y) --" 11 | */set Option changed: weechat.look.hotlist_names_merged_buffers on 12 | */set Option changed: weechat.look.hotlist_prefix "H " 13 | */set Option changed: weechat.look.hotlist_short_names off 14 | */set Option changed: weechat.look.nick_prefix "<" 15 | */set Option changed: weechat.look.nick_suffix ">" 16 | */set Option changed: weechat.look.prefix_suffix "" 17 | */set Option changed: weechat.completion.nick_completer ":" 18 | */set Option changed: weechat.plugin.path "%h/plugins" 19 | */set Option changed: weechat.bar.buflist.items "buflist" 20 | */set Option changed: weechat.bar.fset.items "fset" 21 | */set Option changed: weechat.bar.highmon.items "highmon" 22 | */set Option changed: logger.look.backlog 1000 23 | */set Option changed: logger.file.path "%h/logs/" 24 | */set Option changed: buflist.format.hotlist_separator "${color:cyan}," 25 | */set Option changed: fifo.file.path "%h/weechat_fifo" 26 | */set Option changed: xfer.file.download_path "%h/xfer" 27 | */set Option changed: irc.look.display_away off 28 | */set Option changed: irc.look.server_buffer independent 29 | */set Option changed: irc.look.smart_filter off 30 | */set Option changed: irc.server_default.msg_quit "I rarely quits, so I'm most probably testing something" 31 | */set Option changed: irc.server_default.realname "hedy" 32 | */set Option changed: relay.color.status_active lightblue 33 | */set Option changed: relay.color.status_auth_failed lightred 34 | */set Option changed: relay.color.status_connecting yellow 35 | */set Option changed: relay.color.status_waiting_auth brown 36 | */set Option changed: relay.network.ssl_cert_key "%h/ssl/relay.pem" 37 | */set Option changed: relay.irc.backlog_max_minutes 10080 38 | */set Option changed: autosort.v3.helpers "{"core_first": "${if:${buffer.full_name}!=core.weechat}", "hashless_name": "${info:autosort_replace,#,,${info:autosort_escape,${buffer.name}}}", "irc_raw_first": "${if:${buffer.full_name}!=irc.irc_raw}", "irc_raw_last": "${if:${buffer.full_name}==irc.irc_raw}", "script_or_plugin": "${if:${script_name}?${script_name}:${plugin}}"}" 39 | */set Option changed: script.scripts.download_enabled on 40 | */set Option changed: script.scripts.path "%h/script" 41 | */set Option changed: weechat.look.day_change_message_1date "-- %d %b %Y --" 42 | */set Option changed: weechat.look.day_change_message_2dates "-- %%d %%b %%Y (%d %b %Y) --" 43 | */set Option changed: weechat.look.hotlist_names_merged_buffers on 44 | */set Option changed: weechat.look.hotlist_prefix "H " 45 | */set Option changed: weechat.look.hotlist_short_names off 46 | */set Option changed: weechat.look.nick_prefix "<" 47 | */set Option changed: weechat.look.nick_suffix ">" 48 | */set Option changed: weechat.look.prefix_suffix "" 49 | */set Option changed: weechat.completion.nick_completer ":" 50 | */set Option changed: weechat.plugin.path "%h/plugins" 51 | */set Option changed: weechat.bar.buflist.items "buflist" 52 | */set Option changed: weechat.bar.fset.items "fset" 53 | */set Option changed: weechat.bar.highmon.items "highmon" 54 | */set Option changed: logger.look.backlog 1000 55 | */set Option changed: logger.file.path "%h/logs/" 56 | */set Option changed: buflist.format.hotlist_separator "${color:cyan}," 57 | */set Option changed: fifo.file.path "%h/weechat_fifo" 58 | */set Option changed: xfer.file.download_path "%h/xfer" 59 | */set Option changed: irc.look.display_away off 60 | */set Option changed: irc.look.server_buffer independent 61 | */set Option changed: irc.look.smart_filter off 62 | */set Option changed: irc.server_default.msg_quit "I rarely quits, so I'm most probably testing something" 63 | */set Option changed: irc.server_default.realname "hedy" 64 | */set Option changed: relay.color.status_active lightblue 65 | */set Option changed: relay.color.status_auth_failed lightred 66 | */set Option changed: relay.color.status_connecting yellow 67 | */set Option changed: relay.color.status_waiting_auth brown 68 | */set Option changed: relay.network.ssl_cert_key "%h/ssl/relay.pem" 69 | */set Option changed: relay.irc.backlog_max_minutes 10080 70 | */set Option changed: autosort.v3.helpers "{"core_first": "${if:${buffer.full_name}!=core.weechat}", "hashless_name": "${info:autosort_replace,#,,${info:autosort_escape,${buffer.name}}}", "irc_raw_first": "${if:${buffer.full_name}!=irc.irc_raw}", "irc_raw_last": "${if:${buffer.full_name}==irc.irc_raw}", "script_or_plugin": "${if:${script_name}?${script_name}:${plugin}}"}" 71 | */set Option changed: script.scripts.download_enabled on 72 | */set Option changed: script.scripts.path "%h/script" 73 | */set Option changed: weechat.look.day_change_message_1date "-- %d %b %Y --" 74 | */set Option changed: weechat.look.day_change_message_2dates "-- %%d %%b %%Y (%d %b %Y) --" 75 | */set Option changed: weechat.look.hotlist_names_merged_buffers on 76 | */set Option changed: weechat.look.hotlist_prefix "H " 77 | */set Option changed: weechat.look.hotlist_short_names off 78 | */set Option changed: weechat.look.nick_prefix "<" 79 | */set Option changed: weechat.look.nick_suffix ">" 80 | */set Option changed: weechat.look.prefix_suffix "" 81 | */set Option changed: weechat.completion.nick_completer ":" 82 | */set Option changed: weechat.plugin.path "%h/plugins" 83 | */set Option changed: weechat.bar.buflist.items "buflist" 84 | */set Option changed: weechat.bar.fset.items "fset" 85 | */set Option changed: weechat.bar.highmon.items "highmon" 86 | */set Option changed: logger.look.backlog 1000 87 | */set Option changed: logger.file.path "%h/logs/" 88 | */set Option changed: buflist.format.hotlist_separator "${color:cyan}," 89 | */set Option changed: fifo.file.path "%h/weechat_fifo" 90 | */set Option changed: xfer.file.download_path "%h/xfer" 91 | */set Option changed: irc.look.display_away off 92 | */set Option changed: irc.look.server_buffer independent 93 | */set Option changed: irc.look.smart_filter off 94 | */set Option changed: irc.server_default.msg_quit "I rarely quits, so I'm most probably testing something" 95 | */set Option changed: irc.server_default.realname "hedy" 96 | */set Option changed: relay.color.status_active lightblue 97 | */set Option changed: relay.color.status_auth_failed lightred 98 | */set Option changed: relay.color.status_connecting yellow 99 | */set Option changed: relay.color.status_waiting_auth brown 100 | */set Option changed: relay.network.ssl_cert_key "%h/ssl/relay.pem" 101 | */set Option changed: relay.irc.backlog_max_minutes 10080 102 | */set Option changed: autosort.v3.helpers "{"core_first": "${if:${buffer.full_name}!=core.weechat}", "hashless_name": "${info:autosort_replace,#,,${info:autosort_escape,${buffer.name}}}", "irc_raw_first": "${if:${buffer.full_name}!=irc.irc_raw}", "irc_raw_last": "${if:${buffer.full_name}==irc.irc_raw}", "script_or_plugin": "${if:${script_name}?${script_name}:${plugin}}"}" 103 | */set Option changed: script.scripts.download_enabled on 104 | */set Option changed: script.scripts.path "%h/script" 105 | */set Option changed: irc.server_default.msg_quit "I rarely quit (if at all), so I'm most probably testing something" 106 | */set weechat.look.day_change_message_1date "-- %d %b %Y --" 107 | */set weechat.look.day_change_message_2dates "-- %%d %%b %%Y (%d %b %Y) --" 108 | */set weechat.look.hotlist_names_merged_buffers on 109 | */set weechat.look.hotlist_prefix "H " 110 | */set weechat.look.hotlist_short_names off 111 | */set weechat.look.nick_prefix "<" 112 | */set weechat.look.nick_suffix ">" 113 | */set weechat.look.prefix_suffix "" 114 | */set weechat.completion.nick_completer ":" 115 | */set weechat.plugin.path "%h/plugins" 116 | */set weechat.bar.buflist.items "buflist" 117 | */set weechat.bar.fset.items "fset" 118 | */set weechat.bar.highmon.items "highmon" 119 | */set weechat.bar.nicklist.hidden off 120 | */set weechat.bar.status.items "[time],[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,scroll,[lag],[hotlist],completion" 121 | */set logger.look.backlog 1000 122 | */set logger.file.path "%h/logs/" 123 | */set buflist.format.hotlist_separator "${color:cyan}," 124 | */set fifo.file.path "%h/weechat_fifo" 125 | */set xfer.file.download_path "%h/xfer" 126 | */set irc.look.display_away off 127 | */set irc.look.server_buffer independent 128 | */set irc.look.smart_filter off 129 | */set irc.server_default.capabilities "" 130 | */set irc.server_default.msg_quit "I rarely quit (if at all), so I'm most probably testing something" 131 | */set irc.server_default.realname "hedy" 132 | */set irc.server_default.sasl_fail continue 133 | */set relay.color.status_active lightblue 134 | */set relay.color.status_auth_failed lightred 135 | */set relay.color.status_connecting yellow 136 | */set relay.color.status_waiting_auth brown 137 | */set relay.network.ssl_cert_key "%h/ssl/relay.pem" 138 | */set relay.irc.backlog_max_minutes 10080 139 | */set autosort.v3.helpers "{"core_first": "${if:${buffer.full_name}!=core.weechat}", "hashless_name": "${info:autosort_replace,#,,${info:autosort_escape,${buffer.name}}}", "irc_raw_first": "${if:${buffer.full_name}!=irc.irc_raw}", "irc_raw_last": "${if:${buffer.full_name}==irc.irc_raw}", "script_or_plugin": "${if:${script_name}?${script_name}:${plugin}}"}" 140 | */set script.scripts.download_enabled on 141 | */set script.scripts.path "%h/script" 142 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021-2024 hedy 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 | -------------------------------------------------------------------------------- /bin/24bitcolor: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Credits goes to a gist about setting up tmux true color. 4 | ## Begin copied content ## 5 | 6 | #!/bin/bash 7 | # This file was originally taken from iterm2 https://github.com/gnachman/iTerm2/blob/master/tests/24-bit-color.sh 8 | # 9 | # This file echoes a bunch of 24-bit color codes 10 | # to the terminal to demonstrate its functionality. 11 | # The foreground escape sequence is ^[38;2;;;m 12 | # The background escape sequence is ^[48;2;;;m 13 | # range from 0 to 255 inclusive. 14 | # The escape sequence ^[0m returns output to default 15 | 16 | setBackgroundColor() 17 | { 18 | #printf '\x1bPtmux;\x1b\x1b[48;2;%s;%s;%sm' $1 $2 $3 19 | printf '\x1b[48;2;%s;%s;%sm' $1 $2 $3 20 | } 21 | 22 | resetOutput() 23 | { 24 | echo -en "\x1b[0m\n" 25 | } 26 | 27 | # Gives a color $1/255 % along HSV 28 | # Who knows what happens when $1 is outside 0-255 29 | # Echoes "$red $green $blue" where 30 | # $red $green and $blue are integers 31 | # ranging between 0 and 255 inclusive 32 | rainbowColor() 33 | { 34 | let h=$1/43 35 | let f=$1-43*$h 36 | let t=$f*255/43 37 | let q=255-t 38 | 39 | if [ $h -eq 0 ] 40 | then 41 | echo "255 $t 0" 42 | elif [ $h -eq 1 ] 43 | then 44 | echo "$q 255 0" 45 | elif [ $h -eq 2 ] 46 | then 47 | echo "0 255 $t" 48 | elif [ $h -eq 3 ] 49 | then 50 | echo "0 $q 255" 51 | elif [ $h -eq 4 ] 52 | then 53 | echo "$t 0 255" 54 | elif [ $h -eq 5 ] 55 | then 56 | echo "255 0 $q" 57 | else 58 | # execution should never reach here 59 | echo "0 0 0" 60 | fi 61 | } 62 | 63 | for i in `seq 0 127`; do 64 | setBackgroundColor $i 0 0 65 | echo -en " " 66 | done 67 | resetOutput 68 | for i in `seq 255 -1 128`; do 69 | setBackgroundColor $i 0 0 70 | echo -en " " 71 | done 72 | resetOutput 73 | 74 | for i in `seq 0 127`; do 75 | setBackgroundColor 0 $i 0 76 | echo -n " " 77 | done 78 | resetOutput 79 | for i in `seq 255 -1 128`; do 80 | setBackgroundColor 0 $i 0 81 | echo -n " " 82 | done 83 | resetOutput 84 | 85 | for i in `seq 0 127`; do 86 | setBackgroundColor 0 0 $i 87 | echo -n " " 88 | done 89 | resetOutput 90 | for i in `seq 255 -1 128`; do 91 | setBackgroundColor 0 0 $i 92 | echo -n " " 93 | done 94 | resetOutput 95 | 96 | for i in `seq 0 127`; do 97 | setBackgroundColor `rainbowColor $i` 98 | echo -n " " 99 | done 100 | resetOutput 101 | for i in `seq 255 -1 128`; do 102 | setBackgroundColor `rainbowColor $i` 103 | echo -n " " 104 | done 105 | resetOutput 106 | -------------------------------------------------------------------------------- /bin/awcolors: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ## Credits goes to https://jdhao.github.io/2018/10/19/tmux_nvim_true_color/ 4 | ## Modified 2021-08-08: Remove the /\/\/\/\/\ in the band of colors 5 | 6 | awk 'BEGIN{ 7 | s=" "; s=s s s s s s s s; 8 | for (colnum = 0; colnum<77; colnum++) { 9 | r = 255-(colnum*255/76); 10 | g = (colnum*510/76); 11 | b = (colnum*255/76); 12 | if (g>255) g = 510-g; 13 | printf "\033[48;2;%d;%d;%dm", r,g,b; 14 | printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b; 15 | printf "%s\033[0m", substr(s,colnum+1,1); 16 | } 17 | printf "\n"; 18 | }' 19 | -------------------------------------------------------------------------------- /bin/chmodoctal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import re 4 | import sys 5 | 6 | if len(sys.argv) > 1: 7 | s = sys.argv[1] 8 | else: 9 | s = open(0).read().strip() 10 | 11 | if len(match := re.findall(f"{r'[rwx-]'*9}", s)) == 1 and match[0] == s: 12 | print(sum(sum({'r':4,'w':2,'x':1,'-':0}[c]*(10**(2-n)) for c in s[3*n:3*n+3]) for n in range(3))) 13 | else: 14 | print("pipe 9-letter symbolic file mode or as first argument") 15 | print("chmodoctal rwxr-xr-x") 16 | -------------------------------------------------------------------------------- /bin/dot: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This is (will be) the dotfile script manager for hedy. 4 | # It will run scripts in ~/dotscripts, that's all I think. 5 | 6 | # This script is horrible right now. TODO 7 | 8 | if [[ -z "$2" ]]; then 9 | ~/dotscripts/bin/"$1" 10 | exit 11 | fi 12 | 13 | type="$1" 14 | target="$2" 15 | 16 | 17 | ~/dotscripts/"$type"/"$target" 18 | -------------------------------------------------------------------------------- /bin/emacs-uri-handler.scpt: -------------------------------------------------------------------------------- 1 | on open location this_URL 2 | set thefile to (text 9 thru (count this_URL) of this_URL) 3 | do shell script "/usr/local/bin/emacsclient -c " & thefile 4 | return 5 | end open location 6 | -------------------------------------------------------------------------------- /bin/find-up: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # https://unix.stackexchange.com/questions/6463 4 | # Modified: 5 | # - Add usage 6 | # - Don't print anything and exit 1 if not found 7 | 8 | if [[ -z "$1" || "$1" == "--help" || "$1" == "-h" ]]; then 9 | cat < [/repo] 8 | 9 | Merge an arbitrary GitHub PR from some arbitrary repo with 10 | an automated merge message mentioning that PR. 11 | 12 | Make sure you're already in the correct git repo. 13 | 14 | Example: 15 | > git pullpr \\ 16 | main-repo-user/main-repo \\ 17 | pr-user:pr-branch/pr-user-repo \\ 18 | 123 19 | 20 | Merges PR #123 from main-repo-user/main-repo, which is 21 | written by pr-user on their pr-user-repo, on pr-branch. 22 | 23 | The merge message will be: 24 | 25 | > Merge upstream PR #123 26 | > 27 | > main-repo-user/main-repo#123 28 | 29 | pr-user-repo can be omitted, in which case it will be 30 | assumed to be the same as main-repo name. 31 | 32 | So to merge multiple PRs from the same repo you only need to 33 | change the last two arguments. 34 | 35 | This script was born from the need of merging upstream PRs 36 | while working on my fork of github.com/simrat39/symbols-outline.nvim 37 | which turned out to be worth it. 38 | END 39 | exit 40 | fi 41 | 42 | 43 | userbranch="$2" 44 | 45 | if [[ "$2" =~ "/" ]]; then 46 | prrepo=$(echo "$2" | sed "s_.*/__") 47 | userbranch=$(echo "$2" | sed "s_/.*__") 48 | fi 49 | 50 | user=$(echo "$userbranch" | sed "s/:.*//") 51 | branch=$(echo "$userbranch" | sed "s/.*://") 52 | orguser=$(echo "$1" | sed "s_/.*__") 53 | repo=$(echo "$1" | sed "s_.*/__") 54 | prnumber="$3" 55 | 56 | if [[ -z "$prrepo" ]]; then 57 | prrepo="$repo" 58 | fi 59 | 60 | echo "PR: $user/$prrepo on $branch, PR #$prnumber" 61 | echo "Upstream: $orguser/$repo" 62 | echo -n "Press enter to continue..." 63 | read 64 | 65 | git remote add "$user" git@github.com:"$user"/"$prrepo" 66 | echo "Added remote $user"\n 67 | echo "Fetching" 68 | git fetch "$user" "$branch" 69 | 70 | cat <> " name 4 | gotags "$name".go > tags && ~/bin/gotagclean.py tags > "$name".tags && rm tags 5 | -------------------------------------------------------------------------------- /bin/gotagclean.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | 5 | file = sys.argv[1] 6 | 7 | with open(file) as f: 8 | for line in f.readlines(): 9 | if line.startswith("!"): 10 | continue 11 | first, file, li, *rest = line.split() 12 | if rest[0] == "i": 13 | continue 14 | newrest = [] 15 | for i in range(1, len(rest)): 16 | r = rest[i] 17 | if r.startswith("line"): 18 | continue 19 | r = r.removeprefix("access:") 20 | r = r.removeprefix("signature:") 21 | newrest.append(r) 22 | print(f"{first:<12}" + " " + f"{file}:"+li[:-2] + "\t" + "\t".join(newrest)) 23 | -------------------------------------------------------------------------------- /bin/gpg-upload: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo \ 4 | keyserver.ubuntu.com \ 5 | keys.openpgp.org \ 6 | pgp.mit.edu \ 7 | keys.gnupg.net '' \ 8 | | xargs -n 1 -J '%' gpg --keyserver '%' --send-keys $@ 9 | -------------------------------------------------------------------------------- /bin/lbin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | if [[ -z "$1" || "$1" == "--help" || "$1" == "-h" ]]; then 6 | cat <, 6 | # it will be moved to ~/tmp/. Then to resotre it run mvtmp again. 7 | 8 | name=$(basename "$1") 9 | 10 | if [[ -d ~/tmp/"$name" ]]; then 11 | mv -v ~/tmp/"$name" "$1" 12 | else 13 | mv -v "$1" ~/tmp/"$name" 14 | fi 15 | -------------------------------------------------------------------------------- /bin/nv: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if ! command -v nvim &> /dev/null 3 | then 4 | vim "$@" 5 | else 6 | nvim "$@" 7 | fi 8 | 9 | -------------------------------------------------------------------------------- /bin/pyhello: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | print('Hello! ') 3 | -------------------------------------------------------------------------------- /bin/shltag: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | old=$(git describe --abbrev=0 --tags) 4 | force="" 5 | # if [[ "$2" == "-f" ]]; then 6 | # force="-f" 7 | # fi 8 | case $1 in 9 | v*) 10 | git shortlog $old..HEAD | git tag $force -as -F - $1 11 | exit;; 12 | *) 13 | echo Usage: shltag '[ --help ] [ vNEW ]' 14 | echo old tag is $old; 15 | exit;; 16 | esac 17 | -------------------------------------------------------------------------------- /bin/stupidrmdir: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | dir="$1" 4 | 5 | if [[ -z "$dir" ]]; then 6 | echo "Usage: stupidrmdir [ dir ]" 7 | echo "Ensure CWD is what you want!" 8 | fi 9 | 10 | echo mv "$dir"/** ./ '&&' rm -r "$dir" 11 | mv "$dir"/** ./ && rm -r "$dir" 12 | -------------------------------------------------------------------------------- /bin/wakatime: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | 3 | # NOTE: I don't use wakatime anymore because it makes nvim startup slow 4 | 5 | # Remember to install wakatime-cli first 6 | # This fixes some odd or legacy behaviour of the emacs wakatime plugin 7 | 8 | args=$(echo "$@" | sed 's/--file/--entity/') 9 | wakatime-cli $args 10 | -------------------------------------------------------------------------------- /dotscripts/bin/copy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | while read line; do 4 | IFS=':' read -ra parts <<< "$line" 5 | 6 | sourcefile="${parts[0]% }" 7 | destdir=$(sed "s#^~#$HOME#" <<<"${parts[1]# }") 8 | dest="$destdir/"$(basename "$sourcefile") 9 | 10 | echo mkdir -p "$destdir" 11 | mkdir -p "$destdir" 12 | 13 | cp -v "$sourcefile" "$dest" 14 | done < ~/.config/doftcopy.txt 15 | -------------------------------------------------------------------------------- /dotscripts/convert/addpath: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # read addpath file and return each path 3 | 4 | import sys 5 | from pathlib import Path 6 | 7 | home = str(Path.home()) 8 | added = {} 9 | 10 | def getpaths(file: str): 11 | global added 12 | addpaths = Path(file) 13 | if not addpaths.exists(): 14 | return 15 | 16 | lines = addpaths.read_text(encoding="utf-8").splitlines() 17 | for line in lines: 18 | path = line.strip() 19 | if not path: 20 | continue 21 | if path.startswith("#"): 22 | continue 23 | if not path.startswith("/"): 24 | path = f"{home}/{path}" 25 | if not added.get(path, False): 26 | added[path] = True 27 | yield path 28 | 29 | 30 | sep = ":" 31 | if len(sys.argv) > 1: 32 | sep = sys.argv[1] 33 | 34 | ###### 35 | file = f"{home}/.addpath" 36 | print( 37 | f"{home}/bin", 38 | f"{home}/local/bin", 39 | *getpaths(file), 40 | *getpaths(file+"_local"), 41 | sep=sep 42 | ) 43 | -------------------------------------------------------------------------------- /dotscripts/gen/fish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Stubbornly translates ~/.exportenvs to ~/.exportenvs.fish 3 | 4 | input=~/.exportenvs 5 | output="$input.fish" 6 | 7 | # clear the file 8 | rm $output 9 | touch $output 10 | 11 | while read fileline; do 12 | line=$(echo "$fileline" | sed 's/#.*//' | sed 's/export //') 13 | if [ -z "$line" ]; then 14 | continue 15 | fi 16 | tline=$(echo "$line" | sed 's/=/ /') 17 | echo "set -x $tline" >> $output 18 | done < $input 19 | -------------------------------------------------------------------------------- /dotscripts/gen/localfiles: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for file in ~/.gitconfig-local ~/.config/fish/config_local.fish ~/.addpath_local ~/.config/kitty/local.conf; do 4 | if ! [ -f "$file" ]; then 5 | echo "Creating $file" 6 | touch "$file" 7 | fi 8 | done 9 | -------------------------------------------------------------------------------- /dotscripts/gen/nu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env nu 2 | 3 | # Aliases 4 | let file = $"($env.HOME)/.aliases.nu" 5 | if ($"($env.HOME)/.aliases" | path exists) { 6 | '' | save -f $file 7 | for $line in (cat ~/.aliases | lines) { 8 | if ($line | str starts-with "alias") { 9 | let parts = ($line | str substring 6.. | split row '=' ) 10 | let name = $parts.0 11 | mut cmd = ($parts.1 | str replace -a "'" '' | str replace -a " && " "; ") 12 | mut stmt = "" 13 | if ($cmd | str contains "; ") { 14 | # RHS of alias command must be a valid command. If there are 15 | # more commands, use a def instead. 16 | if ($cmd | split words | $in.0) == $name { 17 | $cmd = $"^($cmd)" 18 | } 19 | $stmt = $" 20 | # Alias of '($cmd)' 21 | def --env ($name) [] { 22 | ($cmd) 23 | }" 24 | } else { 25 | $stmt = $"alias ($name) = ($cmd)" 26 | } 27 | $"($stmt)\n" | save -a $file 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dotscripts/install/misc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if ! command -v diff-so-fancy &> /dev/null; then 4 | echo "installing diff-so-fancy" 5 | git clone https://github.com/so-fancy/diff-so-fancy ~/local/src/diffsofancy 6 | chmod +x ~/local/src/diffsofancy/diff-so-fancy 7 | ln -s ~/local/src/diffsofancy/diff-so-fancy ~/local/bin/ 8 | else 9 | echo "upgrading diff-so-fancy" 10 | cd ~/local/src/diffsofancy 11 | git pull 12 | chmod +x ~/local/src/diffsofancy/diff-so-fancy 13 | ln -f -s ~/local/src/diffsofancy/diff-so-fancy ~/local/bin/ 14 | cd - > /dev/null 15 | fi 16 | 17 | if ! command -v vim &> /dev/null; then 18 | echo "warning: vim not found" 19 | echo "please install from your package manager and try again" 20 | else 21 | if ! test -e ~/.vim/bundle/Vundle.vim; then 22 | echo "installing vundle" 23 | git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 24 | echo "installing vim plugins" 25 | vim +PluginInstall +qall 26 | else 27 | echo "upgrading vim plugins" 28 | vim +PluginUpdate +qall 29 | echo "upgrading vundle" 30 | cd ~/.vim/bundle/Vundle.vim 31 | git pull 32 | cd - > /dev/null 33 | fi 34 | fi 35 | 36 | if ! command -v tig &> /dev/null; then 37 | echo "installing tig" 38 | mkdir -p ~/local/src ~/local/bin 39 | prevpwd=$PWD 40 | cd ~/local/src 41 | git clone https://github.com/jonas/tig 42 | cd tig 43 | make prefix=~/local 44 | make install prefix=~/local 45 | cd $prevpwd 46 | fi 47 | # TODO: Also upgrade tig 48 | 49 | cat < todotxt.tgz 62 | tar xzvf todotxt.tgz 63 | diff todo.txt-cli*/todo.cfg ~/.config/todo/config 64 | rsync todo.txt-cli*/todo.sh bin/ 65 | 66 | END 67 | 68 | echo "done!" 69 | -------------------------------------------------------------------------------- /dotscripts/install/nu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo https://www.nushell.sh/book/installation.html 4 | echo 5 | echo ' 6 | sudo cat < /usr/local/bin/nu 11 | sudo chmod +x /usr/local/bin/nu 12 | ' 13 | 14 | echo add it to /etc/shells 15 | -------------------------------------------------------------------------------- /dotscripts/install/nvm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # you don't need node on every system. for me, at least, I only use node whn 4 | # installing some cool CLI tool made with nodeJS. even so, sticking with the 5 | # node version shipped with the system is enough... but still, I do have a 6 | # nvm.fish function and sometimes I do find the possibility of switching node 7 | # versions helpful. 8 | # 9 | # BTW if your nvim is < 0.5.0 and you want to use CoC, then you'd need node. 10 | 11 | echo "Installing or updating nvm" 12 | 13 | 14 | # probably the least efficient way to get the latest tag, smh 15 | # BEGIN nonsense 16 | prevpwd=$PWD 17 | mkdir ~/tmp 18 | cd ~/tmp 19 | git clone https://github.com/nvm-sh/nvm 20 | cd nvm 21 | latest=$(git describe --tags `git rev-list --tags --max-count=1`) 22 | cd .. 23 | rm -rf nvm 24 | cd $prevpwd 25 | # END nonsense 26 | 27 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/"$latest"/install.sh | bash 28 | 29 | echo "Should be done now" 30 | echo "Restart your shells" 31 | -------------------------------------------------------------------------------- /dotscripts/install/pash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if ! command -v pash &> /dev/null; then 4 | echo "installing pash" 5 | mkdir -p ~/local/src 6 | cd ~/local/src 7 | git clone https://github.com/dylanaraps/pash 8 | echo "creating symlink" 9 | ln -s ~/local/src/pash ~/local/bin/pash 10 | echo "done" 11 | exit 12 | fi 13 | echo "upgrading pash" 14 | if ! [ -e ~/local/src/pash ]; then 15 | echo "ERROR: pash was not cloned at ~/local/src/pash" 16 | echo "please update manually" 17 | exit 1 18 | fi 19 | cd ~/local/src/pash 20 | git pull 21 | echo done! 22 | -------------------------------------------------------------------------------- /dotscripts/install/pyenv: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | install() { 5 | mkdir -p ~/local/src 6 | cd ~/local/src 7 | 8 | git clone https://github.com/pyenv/pyenv.git 9 | cd pyenv 10 | } 11 | 12 | upgrade_or_install() { 13 | git fetch --tags 14 | latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) 15 | git checkout $latestTag 16 | 17 | echo '>> src/configure && make -C src' 18 | src/configure && make -C src 19 | if ! [ $? -eq 0 ]; then 20 | echo Previous command failed 21 | read 'Quit? [Y/n] ' 22 | if ! [ "$REPLY" -eq n ]; then 23 | exit 1 24 | fi 25 | echo Wow, really? ok then 26 | fi 27 | } 28 | 29 | 30 | if ! command -v pyenv &> /dev/null; then 31 | install && upgrade_or_install 32 | else 33 | # Upgrade pyenv 34 | echo Pyenv is already installed, attempting to upgrade it 35 | path=$(which pyenv) 36 | if ! [[ $path = "$HOME/local/src/pyenv/bin/pyenv" ]]; then 37 | echo Unknown installation method 38 | exit 1 39 | fi 40 | cd ~/local/src/pyenv 41 | git pull 42 | 43 | upgrade_or_install 44 | fi 45 | 46 | echo ---------------------------- 47 | echo Should be good to go 48 | echo Run '`dot setup fish` to update the PATHs again if needed' 49 | echo Then run this: 50 | cat < /dev/null; then 4 | if ! [ -f ~/local/src/yadm/yadm ]; then 5 | echo "Attempted to upgrade yadm, but it was not installed (as a git clone) at ~/local/src/yadm/." 6 | exit 7 | fi 8 | echo "> yadm --version" 9 | yadm --version 10 | echo 11 | cd ~/local/src/yadm 12 | git pull 13 | cd - > /dev/null 14 | echo 15 | echo "Upgraded yadm!" 16 | echo "> yadm --version" 17 | yadm --version 18 | exit 19 | fi 20 | 21 | mkdir -p ~/local/bin 22 | mkdir ~/local/src 23 | 24 | git clone https://github.com/TheLocehiliosan/yadm.git ~/local/src/yadm 25 | ln -s ~/local/src/yadm/yadm ~/local/bin/yadm 26 | -------------------------------------------------------------------------------- /dotscripts/maint/doompkgs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | cd ~/.config/doom/ 5 | wget https://raw.githubusercontent.com/doomemacs/doomemacs/master/templates/init.example.el 6 | nv init.el "+vsp init.example.el" 7 | -------------------------------------------------------------------------------- /dotscripts/setup/aerc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if ! command -v aerc &> /dev/null; then 4 | echo aerc isnt installed! 5 | echo you should install go, scdoc, clone the repo, make, make install 6 | exit 1 7 | fi 8 | 9 | if [[ -d ~/local/share/aerc ]]; then 10 | echo "local/share/aerc already exists, you're all good" 11 | echo "upgrade aerc (if needed) yourself because I can't tell how you installed it" 12 | exit 13 | else 14 | if ! [[ -d /usr/share/aerc ]]; then 15 | echo Neither ~/local/share/aerc nor /usr/share/aerc exists! 16 | echo Perhaps aerc wasnt installed properly. Please figure out where aerc share folder is 17 | echo then ln -s manually 18 | exit 1 19 | fi 20 | fi 21 | mkdir -vp ~/local/share 22 | ln -vs /usr/share/aerc ~/local/share/aerc 23 | -------------------------------------------------------------------------------- /dotscripts/setup/bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo Ensure .startup.sh is sourced, and make sure it is only sourced ONCE 4 | echo '(Otherwise $PATH precedence will be messed up)' 5 | echo 6 | echo Run these yourself: 7 | echo 8 | echo sudo echo "'"'[ -r "$HOME/.startup.sh" ] && . "$HOME/.startup.sh"'"'" '| tee -a /etc/profile >> /etc/bashrc' 9 | echo 'cat < /dev/null; then 11 | source ~/.startup.sh 12 | fi 13 | END | tee -a ~/.profile >> ~/.bashrc' 14 | -------------------------------------------------------------------------------- /dotscripts/setup/emacs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | RED=$(tput setaf 1) 4 | RESET=$(tput sgr0) 5 | GREEN=$(tput setaf 2) 6 | BLUE=$(tput setaf 4) 7 | BOLD=$(tput bold) 8 | 9 | if ! command -v emacs &> /dev/null; then 10 | echo "[${RED}ERROR${RESET}] Please install emacs first (package manager or custom build maybe?)" 11 | exit 1 12 | fi 13 | 14 | echo "First you need chemacs" 15 | if [ -d ~/.emacs.d ]; then 16 | # Just to make the sudden output of many messages less confusing 17 | echo "-------------" 18 | echo "[${RED}ERROR${RESET}] .emacs.d already exists!" 19 | 20 | echo "${BOLD}Directory listing:${RESET}" 21 | ls -A ~/.emacs.d 22 | 23 | echo "${BOLD}What would you like to do?${RESET}" 24 | cat < " option 32 | case "$option" in 33 | "1") 34 | rm -rf ~/.emacs.d;; 35 | "2"|"") 36 | echo "Your original .emacs.d will be at .emacs.d.bak" 37 | # TODO: check if .emacs.d.bak exists 38 | mv ~/.emacs.d ~/.emacs.d.bak;; 39 | "3") 40 | echo "Skipping chemacs installation" 41 | install_chemacs=no;; 42 | "4") 43 | cd ~/.emacs.d 44 | echo "git pulling" 45 | git pull 46 | install_chemacs=no;; 47 | "5") 48 | echo "aborting :)" 49 | exit;; 50 | *) 51 | echo "[${RED}ERROR${RESET}] Unknown option $option" 52 | exit 1;; 53 | esac 54 | fi 55 | if [[ $install_chemacs != "no" ]]; then 56 | echo "> ${BLUE}Installing chemacs${RESET}" 57 | mkdir ~/.emacs.d 58 | cd ~/.emacs.d 59 | git clone git@github.com:plexus/chemacs2 . 60 | fi 61 | read -p "${BOLD}Run emacs? [y/N]${RESET} " run 62 | if [[ $run == "y" ]]; then 63 | cd 64 | emacs .config/emacsd/ 65 | fi 66 | 67 | echo "${GREEN}Emacs and chemacs setup all done!${RESET}" 68 | 69 | ### DOOM ### 70 | 71 | echo 72 | echo "Now we'll setup up doom" 73 | 74 | echo "Checking for emacs version" 75 | VERFULL=$(emacs --version | head -n1 | sed 's/^GNU Emacs //') 76 | VER=$(echo "$VERFULL" | grep -Eo '[[:digit:]]+[^ .]') 77 | if (( "$VER" < 27 )); then 78 | echo "[${RED}ERROR${RESET}] emacs version must be 27 or higher for installing doom" 79 | echo "Current is ${BOLD}${VERFULL}${RESET}" 80 | echo Aborting 81 | exit 82 | fi 83 | 84 | read -p "${BOLD}Set up doom? [Y/n]${RESET} " option 85 | if [[ "$option" == "n" ]]; then 86 | echo "Exiting" 87 | exit 88 | fi 89 | echo "Alright we're going to install doom. This is the part where many things could go wrong :P" 90 | 91 | if [ -d ~/.doomemacs ]; then 92 | # Just to make the sudden output of many messages less confusing 93 | echo "-------------" 94 | echo "[${RED}ERROR${RESET}] ~/.doomemacs already exists!" 95 | 96 | echo "${BOLD}Directory listing:${RESET}" 97 | ls -A ~/.doomemacs 98 | 99 | echo "${BOLD}What would you like to do?${RESET}" 100 | cat < " option 108 | case "$option" in 109 | "1") 110 | echo "Removing directory" 111 | rm -rf ~/.doomemacs;; 112 | "2"|"") 113 | echo "Original dir would be at .doomemacs.bak" 114 | mv ~/.doomemacs ~/.doomeamcs.bak;; 115 | "3") 116 | echo "Skipping installation!" 117 | install_doom=no;; 118 | "4") 119 | cd ~/.doomemacs 120 | echo "Running git pull" 121 | git pull 122 | echo "Running bin/doom upgrade (and sync just in case)" 123 | bin/doom upgrade && bin/doom sync 124 | install_doom=no;; 125 | "5") 126 | echo "aborting" 127 | exit;; 128 | *) 129 | echo "[${RED}ERROR${RESET}] Unknown option $option" 130 | exit 1;; 131 | esac 132 | fi 133 | 134 | export DOOMDIR='/home/hedy/.config/doom' 135 | export EMACSDIR='/home/hedy/.doomemacs' 136 | 137 | if [[ "$install_doom" != no ]]; then 138 | echo "> ${BLUE}Installing doom${RESET}" 139 | mkdir ~/.doomemacs 140 | cd ~/.doomemacs 141 | git clone git@github.com:hlissner/doom-emacs . 142 | 143 | echo "${BLUE}Running doom sync${RESET}" 144 | bin/doom sync 145 | 146 | read -p "${BOLD}Run doom install? [Y/n]${RESET} " option 147 | if [[ "$option" != n ]]; then 148 | echo "Running doom install with -y plus doom sync just in case" 149 | bin/doom -y install; bin/doom sync 150 | fi 151 | 152 | echo "All done! Hopefully doom would work" 153 | fi 154 | read -p "${BOLD}Run doom emacs? [Y/n]${RESET} " option 155 | if [[ "$option" != n ]]; then 156 | cd ~/.config/doom 157 | emacs --with-profile=doom . 158 | fi 159 | echo "Good luck, all done!" 160 | -------------------------------------------------------------------------------- /dotscripts/setup/fish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # This script is meant to support both first time setup as well as refreshing 4 | # the ENV later on 5 | 6 | PATH=~/bin:$PATH 7 | 8 | if ! command -v fish &> /dev/null; then 9 | echo "I'm sorry but I can't help you install fish" 10 | echo "Please install fish before running this script lol" 11 | exit 1 12 | fi 13 | 14 | echo "Setting up fish_user_paths..." 15 | fish -c "set -Ux fish_user_paths $(~/dotscripts/convert/addpath ' ')" 16 | echo "done" 17 | 18 | echo Maybe add ~/local/share/man to manpath but I forgot how as of writing 19 | 20 | # env 21 | echo "Refreshing generated fish configs" 22 | ~/dotscripts/gen/fish > /dev/null 23 | echo -n source ~/.exportenvs.fish | pbcopy 24 | echo PLEASE DO: source ~/.exportenvs.fish '(copied to clipboard)' 25 | 26 | # TODO have a better check for omf existence (command -v doesnt work) 27 | # Although omf does this same check lol 28 | if [ ! -d ~/.local/share/omf ]; then 29 | echo "Installing oh my fish" 30 | curl -L https://get.oh-my.fish | fish 31 | echo "Installing oh my fish packages" 32 | omf install 33 | echo done 34 | fi 35 | 36 | echo "Consider check \$fish_completion_path (add add vendor completions such as that of homebrew)" 37 | -------------------------------------------------------------------------------- /dotscripts/setup/nu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env nu 2 | 3 | print "Re-generating config files" 4 | ~/dotscripts/gen/nu 5 | 6 | print "Please reload the shell" 7 | -------------------------------------------------------------------------------- /dotscripts/setup/nvim: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if ! command -v nvim &> /dev/null; then 4 | echo "ERROR: nvim not found" 5 | exit 6 | fi 7 | 8 | cat <