chore: Merge branch 'main' into linux
e3d72178
22 file(s) · +893 −540
| 1 | + | # This is the default config file. |
|
| 2 | + | # It also shows all the default values, if you don't create the file. |
|
| 3 | + | # You can edit this file to set your own configuration for Amfora. |
|
| 4 | + | ||
| 5 | + | # When Amfora updates, defaults may change, but this file on your drive will not. |
|
| 6 | + | # You can always get the latest defaults on GitHub. |
|
| 7 | + | # https://github.com/makeworld-the-better-one/amfora/blob/master/default-config.toml |
|
| 8 | + | ||
| 9 | + | # Please also check out the Amfora Wiki for more help |
|
| 10 | + | # https://github.com/makeworld-the-better-one/amfora/wiki |
|
| 11 | + | # gemini://makeworld.space/amfora-wiki/ |
|
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + | # All URL values may omit the scheme and/or port, as well as the beginning double slash |
|
| 16 | + | # Valid URL examples: |
|
| 17 | + | # gemini://example.com |
|
| 18 | + | # //example.com |
|
| 19 | + | # example.com |
|
| 20 | + | # example.com:123 |
|
| 21 | + | ||
| 22 | + | ||
| 23 | + | [a-general] |
|
| 24 | + | # Press Ctrl-H to access it |
|
| 25 | + | home = "gemini://geminiprotocol.net" |
|
| 26 | + | ||
| 27 | + | # Follow up to 5 Gemini redirects without prompting. |
|
| 28 | + | # A prompt is always shown after the 5th redirect and for redirects to protocols other than Gemini. |
|
| 29 | + | # If set to false, a prompt will be shown before following redirects. |
|
| 30 | + | auto_redirect = false |
|
| 31 | + | ||
| 32 | + | # What command to run to open a HTTP(S) URL. |
|
| 33 | + | # Set to "default" to try to guess the browser, or set to "off" to not open HTTP(S) URLs. |
|
| 34 | + | # If a command is set, than the URL will be added (in quotes) to the end of the command. |
|
| 35 | + | # A space will be prepended to the URL. |
|
| 36 | + | # |
|
| 37 | + | # The best way to define a command is using a string array. |
|
| 38 | + | # Examples: |
|
| 39 | + | # http = ['firefox'] |
|
| 40 | + | # http = ['custom-browser', '--flag', '--option=2'] |
|
| 41 | + | # http = ['/path/with spaces/in it/firefox'] |
|
| 42 | + | # |
|
| 43 | + | # Note the use of single quotes, so that backslashes will not be escaped. |
|
| 44 | + | # Using just a string will also work, but it is deprecated, and will degrade if |
|
| 45 | + | # you use paths with spaces. |
|
| 46 | + | ||
| 47 | + | http = 'default' |
|
| 48 | + | ||
| 49 | + | # Any URL that will accept a query string can be put here |
|
| 50 | + | search = "gemini://kennedy.gemi.dev/search" |
|
| 51 | + | ||
| 52 | + | # Whether colors will be used in the terminal |
|
| 53 | + | color = true |
|
| 54 | + | ||
| 55 | + | # Whether ANSI color codes from the page content should be rendered |
|
| 56 | + | ansi = true |
|
| 57 | + | ||
| 58 | + | # Whether or not to support source code highlighting in preformatted blocks based on alt text |
|
| 59 | + | highlight_code = true |
|
| 60 | + | ||
| 61 | + | # Which highlighting style to use (see https://xyproto.github.io/splash/docs/) |
|
| 62 | + | highlight_style = "monokai" |
|
| 63 | + | ||
| 64 | + | # Whether to replace list asterisks with unicode bullets |
|
| 65 | + | bullets = true |
|
| 66 | + | ||
| 67 | + | # Whether to show link after link text |
|
| 68 | + | show_link = false |
|
| 69 | + | ||
| 70 | + | # The max number of columns to wrap a page's text to. Preformatted blocks are not wrapped. |
|
| 71 | + | max_width = 80 |
|
| 72 | + | ||
| 73 | + | # 'downloads' is the path to a downloads folder. |
|
| 74 | + | # An empty value means the code will find the default downloads folder for your system. |
|
| 75 | + | # If the path does not exist it will be created. |
|
| 76 | + | # Note the use of single quotes, so that backslashes will not be escaped. |
|
| 77 | + | downloads = '' |
|
| 78 | + | ||
| 79 | + | # Max size for displayable content in bytes - after that size a download window pops up |
|
| 80 | + | page_max_size = 2097152 # 2 MiB |
|
| 81 | + | # Max time it takes to load a page in seconds - after that a download window pops up |
|
| 82 | + | page_max_time = 10 |
|
| 83 | + | ||
| 84 | + | # When a scrollbar appears. "never", "auto", and "always" are the only valid values. |
|
| 85 | + | # "auto" means the scrollbar only appears when the page is longer than the window. |
|
| 86 | + | scrollbar = "auto" |
|
| 87 | + | ||
| 88 | + | # Underline non-gemini URLs |
|
| 89 | + | # This is done to help color blind users |
|
| 90 | + | underline = true |
|
| 91 | + | ||
| 92 | + | ||
| 93 | + | [auth] |
|
| 94 | + | # Authentication settings |
|
| 95 | + | # Note the use of single quotes for values, so that backslashes will not be escaped. |
|
| 96 | + | ||
| 97 | + | [auth.certs] |
|
| 98 | + | # Client certificates |
|
| 99 | + | # Set URL equal to path to client cert file |
|
| 100 | + | # |
|
| 101 | + | # "example.com" = 'mycert.crt' # Cert is used for all paths on this domain |
|
| 102 | + | # "example.com/dir/"= 'mycert.crt' # Cert is used for /dir/ and everything below only |
|
| 103 | + | # |
|
| 104 | + | # See the comment at the beginning of this file for examples of all valid types of |
|
| 105 | + | # URLs, ports and schemes can be used too |
|
| 106 | + | "stevedylan.dev" = '/Users/stevedylandev/.local/share/amfora/cert.pem' |
|
| 107 | + | ||
| 108 | + | ||
| 109 | + | [auth.keys] |
|
| 110 | + | # Client certificate keys |
|
| 111 | + | # Same as [auth.certs] but the path is to the client key file. |
|
| 112 | + | "stevedylan.dev" = '/Users/stevedylandev/.local/share/amfora/key.pem' |
|
| 113 | + | ||
| 114 | + | ||
| 115 | + | [commands] |
|
| 116 | + | # Define up to 10 custom commands to execute on the corresponding hotkey press. |
|
| 117 | + | # Commands are run in a new process and will not terminate when Amfora is closed. |
|
| 118 | + | # If you need your command to accept additional input, it is recommended to open |
|
| 119 | + | # a GUI or use a terminal multiplexer like screen or tmux. The string ${url} will |
|
| 120 | + | # be replaced with the current or selected URL. Note that pipes and redirections |
|
| 121 | + | # are not allowed, if these are needed then you should set up a script. Use only |
|
| 122 | + | # absolute paths and/or reference executables in your $PATH. |
|
| 123 | + | # command1 = "my-script -a -b -c ${url}" |
|
| 124 | + | # command2 = "" |
|
| 125 | + | # command3 = "" |
|
| 126 | + | # command4 = "" |
|
| 127 | + | # command5 = "" |
|
| 128 | + | # command6 = "" |
|
| 129 | + | # command7 = "" |
|
| 130 | + | # command8 = "" |
|
| 131 | + | # command9 = "" |
|
| 132 | + | # command0 = "" |
|
| 133 | + | ||
| 134 | + | ||
| 135 | + | [keybindings] |
|
| 136 | + | # If you have a non-US keyboard, use bind_tab1 through bind_tab0 to |
|
| 137 | + | # setup the shift-number bindings: Eg, for US keyboards (the default): |
|
| 138 | + | # bind_tab1 = "!" |
|
| 139 | + | # bind_tab2 = "@" |
|
| 140 | + | # bind_tab3 = "#" |
|
| 141 | + | # bind_tab4 = "$" |
|
| 142 | + | # bind_tab5 = "%" |
|
| 143 | + | # bind_tab6 = "^" |
|
| 144 | + | # bind_tab7 = "&" |
|
| 145 | + | # bind_tab8 = "*" |
|
| 146 | + | # bind_tab9 = "(" |
|
| 147 | + | # bind_tab0 = ")" |
|
| 148 | + | ||
| 149 | + | # Whitespace is not allowed in any of the keybindings! Use 'Space' and 'Tab' to bind to those keys. |
|
| 150 | + | # Multiple keys can be bound to one command, just use a TOML array. |
|
| 151 | + | # To add the Alt modifier, the binding must start with Alt-, should be reasonably universal |
|
| 152 | + | # Ctrl- won't work on all keys, see this for a list: |
|
| 153 | + | # https://github.com/gdamore/tcell/blob/cb1e5d6fa606/key.go#L83 |
|
| 154 | + | ||
| 155 | + | # An example of a TOML array for multiple keys being bound to one command is the default |
|
| 156 | + | # binding for reload: |
|
| 157 | + | # bind_reload = ["R","Ctrl-R"] |
|
| 158 | + | # One thing to note here is that "R" is capitalization sensitive, so it means shift-r. |
|
| 159 | + | # "Ctrl-R" means both ctrl-r and ctrl-shift-R (this is a quirk of what ctrl-r means on |
|
| 160 | + | # an ANSI terminal) |
|
| 161 | + | ||
| 162 | + | # The default binding for opening the bottom bar for entering a URL or link number is: |
|
| 163 | + | # bind_bottom = "Space" |
|
| 164 | + | # This is how to get the Spacebar as a keybinding, if you try to use " ", it won't work. |
|
| 165 | + | # And, finally, an example of a simple, unmodified character is: |
|
| 166 | + | # bind_edit = "e" |
|
| 167 | + | # This binds the "e" key to the command to edit the current URL. |
|
| 168 | + | ||
| 169 | + | # The bind_link[1-90] options are for the commands to go to the first 10 links on a page, |
|
| 170 | + | # typically these are bound to the number keys: |
|
| 171 | + | # bind_link1 = "1" |
|
| 172 | + | # bind_link2 = "2" |
|
| 173 | + | # bind_link3 = "3" |
|
| 174 | + | # bind_link4 = "4" |
|
| 175 | + | # bind_link5 = "5" |
|
| 176 | + | # bind_link6 = "6" |
|
| 177 | + | # bind_link7 = "7" |
|
| 178 | + | # bind_link8 = "8" |
|
| 179 | + | # bind_link9 = "9" |
|
| 180 | + | # bind_link0 = "0" |
|
| 181 | + | ||
| 182 | + | # The bind_command[0-9] options are for the command hotkeys. This will pass the URL of the |
|
| 183 | + | # current tab as an argument. |
|
| 184 | + | # bind_command1 = "Alt-!" |
|
| 185 | + | # bind_command2 = "Alt-@" |
|
| 186 | + | # bind_command3 = "Alt-#" |
|
| 187 | + | # bind_command4 = "Alt-$" |
|
| 188 | + | # bind_command5 = "Alt-%" |
|
| 189 | + | # bind_command6 = "Alt-^" |
|
| 190 | + | # bind_command7 = "Alt-&" |
|
| 191 | + | # bind_command8 = "Alt-*" |
|
| 192 | + | # bind_command9 = "Alt-(" |
|
| 193 | + | # bind_command0 = "Alt-)" |
|
| 194 | + | ||
| 195 | + | # The bind_commandtarget[0-9] options are for command hotkeys that operate on the currently |
|
| 196 | + | # highlighted link. This will pass the URL of the highlighted link as an argument. |
|
| 197 | + | # bind_command_target1 = "Alt-1" |
|
| 198 | + | # bind_command_target2 = "Alt-2" |
|
| 199 | + | # bind_command_target3 = "Alt-3" |
|
| 200 | + | # bind_command_target4 = "Alt-4" |
|
| 201 | + | # bind_command_target5 = "Alt-5" |
|
| 202 | + | # bind_command_target6 = "Alt-6" |
|
| 203 | + | # bind_command_target7 = "Alt-7" |
|
| 204 | + | # bind_command_target8 = "Alt-8" |
|
| 205 | + | # bind_command_target9 = "Alt-9" |
|
| 206 | + | # bind_command_target0 = "Alt-0" |
|
| 207 | + | ||
| 208 | + | # All keybindings: |
|
| 209 | + | # |
|
| 210 | + | # bind_bottom |
|
| 211 | + | # bind_edit |
|
| 212 | + | # bind_home |
|
| 213 | + | # bind_bookmarks |
|
| 214 | + | # bind_add_bookmark |
|
| 215 | + | # bind_save |
|
| 216 | + | # bind_reload |
|
| 217 | + | # bind_back |
|
| 218 | + | # bind_forward |
|
| 219 | + | # bind_moveup |
|
| 220 | + | # bind_movedown |
|
| 221 | + | # bind_moveleft |
|
| 222 | + | # bind_moveright |
|
| 223 | + | # bind_pgup |
|
| 224 | + | # bind_pgdn |
|
| 225 | + | # bind_new_tab |
|
| 226 | + | # bind_close_tab |
|
| 227 | + | # bind_next_tab |
|
| 228 | + | # bind_prev_tab |
|
| 229 | + | # bind_quit |
|
| 230 | + | # bind_help |
|
| 231 | + | # bind_sub: for viewing the subscriptions page |
|
| 232 | + | # bind_add_sub |
|
| 233 | + | # bind_copy_page_url |
|
| 234 | + | # bind_copy_target_url |
|
| 235 | + | # bind_beginning: moving to beginning of page (top left) |
|
| 236 | + | # bind_end: same but the for the end (bottom left) |
|
| 237 | + | # bind_url_handler_open: Open highlighted URL with URL handler (#143) |
|
| 238 | + | ||
| 239 | + | # Search |
|
| 240 | + | # bind_search = "/" |
|
| 241 | + | # bind_next_match = "n" |
|
| 242 | + | # bind_prev_match = "N" |
|
| 243 | + | ||
| 244 | + | [url-handlers] |
|
| 245 | + | # Allows setting the commands to run for various URL schemes. |
|
| 246 | + | # E.g. to open FTP URLs with FileZilla set the following key: |
|
| 247 | + | # ftp = ['filezilla'] |
|
| 248 | + | # You can set any scheme to 'off' or '' to disable handling it, or |
|
| 249 | + | # just leave the key unset. |
|
| 250 | + | # |
|
| 251 | + | # DO NOT use this for setting the HTTP command. |
|
| 252 | + | # Use the http setting in the "a-general" section above. |
|
| 253 | + | # |
|
| 254 | + | # NOTE: These settings are overridden by the ones in the proxies section. |
|
| 255 | + | # |
|
| 256 | + | # The best way to define a command is using a string array. |
|
| 257 | + | # Examples: |
|
| 258 | + | # magnet = ['transmission'] |
|
| 259 | + | # foo = ['custom-browser', '--flag', '--option=2'] |
|
| 260 | + | # tel = ['/path/with spaces/in it/telephone'] |
|
| 261 | + | # |
|
| 262 | + | # Note the use of single quotes, so that backslashes will not be escaped. |
|
| 263 | + | # Using just a string will also work, but it is deprecated, and will degrade if |
|
| 264 | + | # you use paths with spaces. |
|
| 265 | + | ||
| 266 | + | # This is a special key that defines the handler for all URL schemes for which |
|
| 267 | + | # no handler is defined. |
|
| 268 | + | # It uses the special value 'default', which will try and use the default |
|
| 269 | + | # application on your computer for opening this kind of URI. |
|
| 270 | + | other = 'default' |
|
| 271 | + | ||
| 272 | + | [url-prompts] |
|
| 273 | + | # Specify whether a confirmation prompt should be shown before following URL schemes. |
|
| 274 | + | # The special key 'other' matches all schemes that don't match any other key. |
|
| 275 | + | # |
|
| 276 | + | # Example: prompt on every non-gemini URL |
|
| 277 | + | # other = true |
|
| 278 | + | # gemini = false |
|
| 279 | + | # |
|
| 280 | + | # Example: only prompt on HTTP(S) |
|
| 281 | + | # other = false |
|
| 282 | + | # http = true |
|
| 283 | + | # https = true |
|
| 284 | + | ||
| 285 | + | # [[mediatype-handlers]] section |
|
| 286 | + | # --------------------------------- |
|
| 287 | + | # |
|
| 288 | + | # Specify what applications will open certain media types. |
|
| 289 | + | # By default your default application will be used to open the file when you select "Open". |
|
| 290 | + | # You only need to configure this section if you want to override your default application, |
|
| 291 | + | # or do special things like streaming. |
|
| 292 | + | # |
|
| 293 | + | # Note the use of single quotes for commands, so that backslashes will not be escaped. |
|
| 294 | + | # |
|
| 295 | + | # |
|
| 296 | + | # To open jpeg files with the feh command: |
|
| 297 | + | # |
|
| 298 | + | # [[mediatype-handlers]] |
|
| 299 | + | # cmd = ['feh'] |
|
| 300 | + | # types = ["image/jpeg"] |
|
| 301 | + | # |
|
| 302 | + | # Each command that you specify must come under its own [[mediatype-handlers]]. You may |
|
| 303 | + | # specify as many [[mediatype-handlers]] as you want to setup multiple commands. |
|
| 304 | + | # |
|
| 305 | + | # If the subtype is omitted then the specified command will be used for the |
|
| 306 | + | # entire type: |
|
| 307 | + | # |
|
| 308 | + | # [[mediatype-handlers]] |
|
| 309 | + | # command = ['vlc', '--flag'] |
|
| 310 | + | # types = ["audio", "video"] |
|
| 311 | + | # |
|
| 312 | + | # A catch-all handler can by specified with "*". |
|
| 313 | + | # Note that there are already catch-all handlers in place for all OSes, |
|
| 314 | + | # that open the file using your default application. This is only if you |
|
| 315 | + | # want to override that. |
|
| 316 | + | # |
|
| 317 | + | # [[mediatype-handlers]] |
|
| 318 | + | # cmd = ['some-command'] |
|
| 319 | + | # types = [ |
|
| 320 | + | # "application/pdf", |
|
| 321 | + | # "*", |
|
| 322 | + | # ] |
|
| 323 | + | # |
|
| 324 | + | # You can also choose to stream the data instead of downloading it all before |
|
| 325 | + | # opening it. This is especially useful for large video or audio files, as |
|
| 326 | + | # well as radio streams, which will never complete. You can do this like so: |
|
| 327 | + | # |
|
| 328 | + | # [[mediatype-handlers]] |
|
| 329 | + | # cmd = ['vlc', '-'] |
|
| 330 | + | # types = ["audio", "video"] |
|
| 331 | + | # stream = true |
|
| 332 | + | # |
|
| 333 | + | # This uses vlc to stream all video and audio content. |
|
| 334 | + | # By default stream is set to off for all handlers |
|
| 335 | + | # |
|
| 336 | + | # |
|
| 337 | + | # If you want to always open a type in its viewer without the download or open |
|
| 338 | + | # prompt appearing, you can add no_prompt = true |
|
| 339 | + | # |
|
| 340 | + | # [[mediatype-handlers]] |
|
| 341 | + | # cmd = ['feh'] |
|
| 342 | + | # types = ["image"] |
|
| 343 | + | # no_prompt = true |
|
| 344 | + | # |
|
| 345 | + | # Note: Multiple handlers cannot be defined for the same full media type, but |
|
| 346 | + | # still there needs to be an order for which handlers are used. The following |
|
| 347 | + | # order applies regardless of the order written in the config: |
|
| 348 | + | # |
|
| 349 | + | # 1. Full media type: "image/jpeg" |
|
| 350 | + | # 2. Just type: "image" |
|
| 351 | + | # 3. Catch-all: "*" |
|
| 352 | + | ||
| 353 | + | ||
| 354 | + | [cache] |
|
| 355 | + | # Options for page cache - which is only for text pages |
|
| 356 | + | # Increase the cache size to speed up browsing at the expense of memory |
|
| 357 | + | # Zero values mean there is no limit |
|
| 358 | + | ||
| 359 | + | max_size = 0 # Size in bytes |
|
| 360 | + | max_pages = 30 # The maximum number of pages the cache will store |
|
| 361 | + | ||
| 362 | + | # How long a page will stay in cache, in seconds. |
|
| 363 | + | timeout = 1800 # 30 mins |
|
| 364 | + | ||
| 365 | + | [proxies] |
|
| 366 | + | # Allows setting a Gemini proxy for different schemes. |
|
| 367 | + | # The settings are similar to the url-handlers section above. |
|
| 368 | + | # E.g. to open a gopher page by connecting to a Gemini proxy server: |
|
| 369 | + | # gopher = "example.com:123" |
|
| 370 | + | # |
|
| 371 | + | # Port 1965 is assumed if no port is specified. |
|
| 372 | + | # |
|
| 373 | + | # NOTE: These settings override any external handlers specified in |
|
| 374 | + | # the url-handlers section. |
|
| 375 | + | # |
|
| 376 | + | # Note that HTTP and HTTPS are treated as separate protocols here. |
|
| 377 | + | ||
| 378 | + | ||
| 379 | + | [subscriptions] |
|
| 380 | + | # For tracking feeds and pages |
|
| 381 | + | ||
| 382 | + | # Whether a pop-up appears when viewing a potential feed |
|
| 383 | + | popup = true |
|
| 384 | + | ||
| 385 | + | # How often to check for updates to subscriptions in the background, in seconds. |
|
| 386 | + | # Set it to 0 to disable this feature. You can still update individual feeds |
|
| 387 | + | # manually, or restart the browser. |
|
| 388 | + | # |
|
| 389 | + | # Note Amfora will check for updates on browser start no matter what this setting is. |
|
| 390 | + | update_interval = 1800 # 30 mins |
|
| 391 | + | ||
| 392 | + | # How many subscriptions can be checked at the same time when updating. |
|
| 393 | + | # If you have many subscriptions you may want to increase this for faster |
|
| 394 | + | # update times. Any value below 1 will be corrected to 1. |
|
| 395 | + | workers = 3 |
|
| 396 | + | ||
| 397 | + | # The number of subscription updates displayed per page. |
|
| 398 | + | entries_per_page = 20 |
|
| 399 | + | ||
| 400 | + | # Set to false to remove the explanatory text from the top of the subscription page |
|
| 401 | + | header = true |
|
| 402 | + | ||
| 403 | + | ||
| 404 | + | [theme] |
|
| 405 | + | # This section is for changing the COLORS used in Amfora. |
|
| 406 | + | # These colors only apply if 'color' is enabled above. |
|
| 407 | + | # Colors can be set using a W3C color name, or a hex value such as "#ffffff". |
|
| 408 | + | # Setting a background to "default" keeps the terminal default |
|
| 409 | + | # If your terminal has transparency, set any background to "default" to keep it transparent |
|
| 410 | + | # The key "bg" is already set to "default", but this can be used on other backgrounds, |
|
| 411 | + | # like for modals. |
|
| 412 | + | ||
| 413 | + | # Note that not all colors will work on terminals that do not have truecolor support. |
|
| 414 | + | # If you want to stick to the standard 16 or 256 colors, you can get |
|
| 415 | + | # a list of those here: https://jonasjacek.github.io/colors/ |
|
| 416 | + | # DO NOT use the names from that site, just the hex codes. |
|
| 417 | + | ||
| 418 | + | # Definitions: |
|
| 419 | + | # bg = background |
|
| 420 | + | # fg = foreground |
|
| 421 | + | # dl = download |
|
| 422 | + | # btn = button |
|
| 423 | + | # hdg = heading |
|
| 424 | + | # bkmk = bookmark |
|
| 425 | + | # modal = a popup window/box in the middle of the screen |
|
| 426 | + | ||
| 427 | + | # EXAMPLES: |
|
| 428 | + | # hdg_1 = "green" |
|
| 429 | + | # hdg_2 = "#5f0000" |
|
| 430 | + | # bg = "default" |
|
| 431 | + | ||
| 432 | + | # Available keys to set: |
|
| 433 | + | ||
| 434 | + | # bg: background for pages, tab row, app in general |
|
| 435 | + | # tab_num: The number/highlight of the tabs at the top |
|
| 436 | + | # tab_divider: The color of the divider character between tab numbers: | |
|
| 437 | + | # bottombar_label: The color of the prompt that appears when you press space |
|
| 438 | + | # bottombar_text: The color of the text you type |
|
| 439 | + | # bottombar_bg |
|
| 440 | + | # scrollbar: The scrollbar that appears on the right for long pages |
|
| 441 | + | ||
| 442 | + | # You can also set an 'include' key to process another TOML file that contains theme keys. |
|
| 443 | + | # Example: |
|
| 444 | + | # include = "my/path/to/special-theme.toml" |
|
| 445 | + | # |
|
| 446 | + | # Any other theme keys will override this external file. |
|
| 447 | + | # You can use this special key to switch between themes easily. |
|
| 448 | + | # Download other themes here: https://github.com/makeworld-the-better-one/amfora/tree/master/contrib/themes |
|
| 449 | + | ||
| 450 | + | ||
| 451 | + | # hdg_1 |
|
| 452 | + | # hdg_2 |
|
| 453 | + | # hdg_3 |
|
| 454 | + | # amfora_link: A link that Amfora supports viewing. For now this is only gemini:// |
|
| 455 | + | # foreign_link: HTTP(S), Gopher, etc |
|
| 456 | + | # link_number: The silver number that appears to the left of a link |
|
| 457 | + | # regular_text: Normal gemini text, and plaintext documents |
|
| 458 | + | # quote_text |
|
| 459 | + | # preformatted_text |
|
| 460 | + | # list_text |
|
| 461 | + | ||
| 462 | + | # btn_bg: The bg color for all modal buttons |
|
| 463 | + | # btn_text: The text color for all modal buttons |
|
| 464 | + | ||
| 465 | + | # dl_choice_modal_bg |
|
| 466 | + | # dl_choice_modal_text |
|
| 467 | + | # dl_modal_bg |
|
| 468 | + | # dl_modal_text |
|
| 469 | + | # info_modal_bg |
|
| 470 | + | # info_modal_text |
|
| 471 | + | # error_modal_bg |
|
| 472 | + | # error_modal_text |
|
| 473 | + | # yesno_modal_bg |
|
| 474 | + | # yesno_modal_text |
|
| 475 | + | # tofu_modal_bg |
|
| 476 | + | # tofu_modal_text |
|
| 477 | + | # subscription_modal_bg |
|
| 478 | + | # subscription_modal_text |
|
| 479 | + | ||
| 480 | + | # input_modal_bg |
|
| 481 | + | # input_modal_text |
|
| 482 | + | # input_modal_field_bg: The bg of the input field, where you type the text |
|
| 483 | + | # input_modal_field_text: The color of the text you type |
|
| 484 | + | ||
| 485 | + | # bkmk_modal_bg |
|
| 486 | + | # bkmk_modal_text |
|
| 487 | + | # bkmk_modal_label |
|
| 488 | + | # bkmk_modal_field_bg |
|
| 489 | + | # bkmk_modal_field_text |
|
| 490 | + | ||
| 491 | + | # Darkmatter Theme |
|
| 492 | + | bg = "#121113" |
|
| 493 | + | tab_num = "#e78a53" |
|
| 494 | + | tab_divider = "#333333" |
|
| 495 | + | bottombar_label = "#e78a53" |
|
| 496 | + | bottombar_text = "#ffffff" |
|
| 497 | + | bottombar_bg = "#222222" |
|
| 498 | + | scrollbar = "#333333" |
|
| 499 | + | ||
| 500 | + | hdg_1 = "#ffffff" |
|
| 501 | + | hdg_2 = "#c1c1c1" |
|
| 502 | + | hdg_3 = "#aaaaaa" |
|
| 503 | + | amfora_link = "#e78a53" |
|
| 504 | + | foreign_link = "#fbcb97" |
|
| 505 | + | link_number = "#888888" |
|
| 506 | + | regular_text = "#ffffff" |
|
| 507 | + | quote_text = "#5f8787" |
|
| 508 | + | preformatted_text = "#fbcb97" |
|
| 509 | + | list_text = "#ffffff" |
|
| 510 | + | ||
| 511 | + | btn_bg = "#333333" |
|
| 512 | + | btn_text = "#ffffff" |
|
| 513 | + | ||
| 514 | + | dl_choice_modal_bg = "#222222" |
|
| 515 | + | dl_choice_modal_text = "#ffffff" |
|
| 516 | + | dl_modal_bg = "#222222" |
|
| 517 | + | dl_modal_text = "#ffffff" |
|
| 518 | + | info_modal_bg = "#222222" |
|
| 519 | + | info_modal_text = "#ffffff" |
|
| 520 | + | error_modal_bg = "#222222" |
|
| 521 | + | error_modal_text = "#e78a53" |
|
| 522 | + | yesno_modal_bg = "#222222" |
|
| 523 | + | yesno_modal_text = "#ffffff" |
|
| 524 | + | tofu_modal_bg = "#222222" |
|
| 525 | + | tofu_modal_text = "#ffffff" |
|
| 526 | + | subscription_modal_bg = "#222222" |
|
| 527 | + | subscription_modal_text = "#ffffff" |
|
| 528 | + | ||
| 529 | + | input_modal_bg = "#222222" |
|
| 530 | + | input_modal_text = "#ffffff" |
|
| 531 | + | input_modal_field_bg = "#333333" |
|
| 532 | + | input_modal_field_text = "#ffffff" |
|
| 533 | + | ||
| 534 | + | bkmk_modal_bg = "#222222" |
|
| 535 | + | bkmk_modal_text = "#ffffff" |
|
| 536 | + | bkmk_modal_label = "#e78a53" |
|
| 537 | + | bkmk_modal_field_bg = "#333333" |
|
| 538 | + | bkmk_modal_field_text = "#ffffff" |
| 900 | 900 | } |
|
| 901 | 901 | }] |
|
| 902 | 902 | ||
| 903 | + | def tsi [parser: string] { |
|
| 904 | + | let tree = $"($env.HOME)/.local/share/nvim/site" |
|
| 905 | + | luarocks --lua-version=5.1 $"--tree=($tree)" install $"tree-sitter-($parser)" |
|
| 906 | + | } |
|
| 907 | + | ||
| 903 | 908 | # Function to open sesh |
|
| 904 | 909 | def t [] { |
|
| 905 | 910 | let selected = (sesh list -i | gum filter --limit 1 --placeholder "Choose a session" --height 50 --prompt="> " --indicator.foreground="2" --match.foreground="2") |
| 64 | 64 | $env.GOMODCACHE = ($env.HOME | path join ".local" "share" "go-mod-cache") |
|
| 65 | 65 | $env.FZF_DEFAULT_COMMAND = 'fd --type f --hidden --exclude ".git"' |
|
| 66 | 66 | $env.FZF_DEFAULT_OPTS = [ |
|
| 67 | - | '--color=fg:7,fg+:15,bg:0,bg+:8' # fg: ansi[7], fg+: white, bg: ansi[0], bg+: brights[0] |
|
| 68 | - | '--color=hl:1,hl+:2,info:3,marker:2' # hl: ansi[1], hl+: ansi[2], info: ansi[3], marker: ansi[2] |
|
| 69 | - | '--color=prompt:3,spinner:1,pointer:2,header:6' # prompt: ansi[3], spinner: ansi[1], pointer: ansi[2], header: ansi[6] |
|
| 70 | - | '--color=border:8,label:4,query:15' # border: brights[0], label: ansi[4], query: white |
|
| 67 | + | '--color=fg:8:bold,fg+:15,bg:-1,bg+:-1' |
|
| 68 | + | '--color=hl:10:bold,hl+:10:bold' |
|
| 69 | + | '--color=info:8,spinner:9,header:4' |
|
| 70 | + | '--color=prompt:2,pointer:9,marker:1' |
|
| 71 | + | '--color=border:7,label:15:bold,query:15' |
|
| 71 | 72 | '--border="rounded"' |
|
| 72 | 73 | '--border-label=""' |
|
| 73 | 74 | '--preview-window="border-rounded"' |
|
| 74 | 75 | '--prompt="> "' |
|
| 75 | - | '--marker=">"' |
|
| 76 | + | '--marker=" "' |
|
| 76 | 77 | '--pointer="◆"' |
|
| 77 | - | '--separator="─"' |
|
| 78 | - | '--scrollbar="│"' |
|
| 78 | + | '--separator=""' |
|
| 79 | + | '--scrollbar=""' |
|
| 80 | + | '--gutter=" "' |
|
| 81 | + | '--info=inline-right' |
|
| 79 | 82 | ] | str join ' ' |
|
| 80 | 83 | path add ~/.tmux/plugins/t-smart-tmux-session-manager/bin |
|
| 81 | 84 | path add ~/.deno/bin |
| 1 | - | -- Suppress vim.tbl_islist deprecation warning |
|
| 2 | - | -- local original_deprecate = vim.deprecate |
|
| 3 | - | -- vim.deprecate = function(name, alternative, version, plugin, backtrace) |
|
| 4 | - | -- if name == "vim.tbl_islist" then |
|
| 5 | - | -- return |
|
| 6 | - | -- end |
|
| 7 | - | -- return original_deprecate(name, alternative, version, plugin, backtrace) |
|
| 8 | - | -- end |
|
| 9 | - | ||
| 10 | 1 | require("config.options") |
|
| 11 | - | require("core.lazy") |
|
| 2 | + | require("core.plugins") |
|
| 12 | 3 | require("core.lsp") |
|
| 4 | + | require("core.treesitter") |
|
| 13 | 5 | require("config.keymaps") |
|
| 14 | 6 | require("config.autocmds") |
| 1 | - | { |
|
| 2 | - | "ai.vim": { "branch": "main", "commit": "8a0431fa69b65c1d5596e62dd9fd0993ce847894" }, |
|
| 3 | - | "darkmatter-nvim": { "branch": "main", "commit": "5663ddc9d8580c0c43b996e01bfe1a335789e9c9" }, |
|
| 4 | - | "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, |
|
| 5 | - | "mini.nvim": { "branch": "main", "commit": "a995fe9cd4193fb492b5df69175a351a74b3d36b" }, |
|
| 6 | - | "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, |
|
| 7 | - | "nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" }, |
|
| 8 | - | "vim-tmux-navigator": { "branch": "master", "commit": "e41c431a0c7b7388ae7ba341f01a0d217eb3a432" } |
|
| 9 | - | } |
| 7 | 7 | "S", |
|
| 8 | 8 | "asm" |
|
| 9 | 9 | }, |
|
| 10 | - | -- settings = { |
|
| 11 | - | -- Lua = { |
|
| 12 | - | -- diagnostics = { |
|
| 13 | - | -- -- disable = { "missing-parameters", "missing-fields" }, |
|
| 14 | - | -- }, |
|
| 15 | - | -- }, |
|
| 16 | - | -- }, |
|
| 17 | - | ||
| 18 | 10 | single_file_support = true, |
|
| 19 | 11 | log_level = vim.lsp.protocol.MessageType.Warning, |
|
| 20 | 12 | } |
| 1 | 1 | return { |
|
| 2 | - | cmd = { |
|
| 3 | - | "lua-language-server", |
|
| 4 | - | }, |
|
| 5 | - | filetypes = { |
|
| 6 | - | "lua", |
|
| 7 | - | }, |
|
| 8 | - | root_markers = { |
|
| 9 | - | ".git", |
|
| 10 | - | ".luacheckrc", |
|
| 11 | - | ".luarc.json", |
|
| 12 | - | ".luarc.jsonc", |
|
| 13 | - | ".stylua.toml", |
|
| 14 | - | "selene.toml", |
|
| 15 | - | "selene.yml", |
|
| 16 | - | "stylua.toml", |
|
| 17 | - | }, |
|
| 18 | - | -- settings = { |
|
| 19 | - | -- Lua = { |
|
| 20 | - | -- diagnostics = { |
|
| 21 | - | -- -- disable = { "missing-parameters", "missing-fields" }, |
|
| 22 | - | -- }, |
|
| 23 | - | -- }, |
|
| 24 | - | -- }, |
|
| 2 | + | cmd = { |
|
| 3 | + | "lua-language-server", |
|
| 4 | + | }, |
|
| 5 | + | filetypes = { |
|
| 6 | + | "lua", |
|
| 7 | + | }, |
|
| 8 | + | root_markers = { |
|
| 9 | + | ".git", |
|
| 10 | + | ".luacheckrc", |
|
| 11 | + | ".luarc.json", |
|
| 12 | + | ".luarc.jsonc", |
|
| 13 | + | ".stylua.toml", |
|
| 14 | + | "selene.toml", |
|
| 15 | + | "selene.yml", |
|
| 16 | + | "stylua.toml", |
|
| 17 | + | }, |
|
| 18 | + | settings = { |
|
| 19 | + | Lua = { |
|
| 20 | + | diagnostics = { |
|
| 21 | + | globals = { "vim", "MiniPick", "MiniSnippets" } |
|
| 22 | + | }, |
|
| 23 | + | }, |
|
| 24 | + | }, |
|
| 25 | 25 | ||
| 26 | - | single_file_support = true, |
|
| 27 | - | log_level = vim.lsp.protocol.MessageType.Warning, |
|
| 26 | + | single_file_support = true, |
|
| 27 | + | log_level = vim.lsp.protocol.MessageType.Warning, |
|
| 28 | 28 | } |
| 8 | 8 | ".gitignore", |
|
| 9 | 9 | "foundry.toml" |
|
| 10 | 10 | }, |
|
| 11 | - | -- settings = { |
|
| 12 | - | -- Lua = { |
|
| 13 | - | -- diagnostics = { |
|
| 14 | - | -- -- disable = { "missing-parameters", "missing-fields" }, |
|
| 15 | - | -- }, |
|
| 16 | - | -- }, |
|
| 17 | - | -- }, |
|
| 18 | - | ||
| 19 | 11 | single_file_support = true, |
|
| 20 | 12 | log_level = vim.lsp.protocol.MessageType.Warning, |
|
| 21 | 13 | } |
| 12 | 12 | }, |
|
| 13 | 13 | root_markers = { |
|
| 14 | 14 | 'tsconfig.json', 'jsconfig.json', 'package.json', '.git' }, |
|
| 15 | - | -- settings = { |
|
| 16 | - | -- Lua = { |
|
| 17 | - | -- diagnostics = { |
|
| 18 | - | -- -- disable = { "missing-parameters", "missing-fields" }, |
|
| 19 | - | -- }, |
|
| 20 | - | -- }, |
|
| 21 | - | -- }, |
|
| 22 | - | ||
| 23 | 15 | single_file_support = true, |
|
| 24 | 16 | log_level = vim.lsp.protocol.MessageType.Warning, |
|
| 25 | 17 | } |
| 6 | 6 | end, |
|
| 7 | 7 | }) |
|
| 8 | 8 | ||
| 9 | + | vim.api.nvim_create_autocmd("FileType", { |
|
| 10 | + | callback = function(ev) |
|
| 11 | + | local lang = vim.treesitter.language.get_lang(ev.match) or ev.match |
|
| 12 | + | if vim.treesitter.language.add(lang) then |
|
| 13 | + | vim.treesitter.start(ev.buf, lang) |
|
| 14 | + | end |
|
| 15 | + | end |
|
| 16 | + | }) |
|
| 17 | + | ||
| 9 | 18 | -- Reload files automatically if edited externally |
|
| 10 | 19 | vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHoldI" }, { |
|
| 11 | 20 | pattern = "*", |
|
| 16 | 25 | end, |
|
| 17 | 26 | }) |
|
| 18 | 27 | ||
| 19 | - | vim.api.nvim_create_autocmd("LspAttach", { |
|
| 20 | - | group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }), |
|
| 21 | - | callback = function(event) |
|
| 22 | - | local map = function(keys, func, desc) |
|
| 23 | - | vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) |
|
| 24 | - | end |
|
| 25 | - | ||
| 26 | - | -- defaults: |
|
| 27 | - | -- https://neovim.io/doc/user/news-0.11.html#_defaults |
|
| 28 | - | ||
| 29 | - | map("gl", vim.diagnostic.open_float, "Open Diagnostic Float") |
|
| 30 | - | map("K", vim.lsp.buf.hover, "Hover Documentation") |
|
| 31 | - | map("gs", vim.lsp.buf.signature_help, "Signature Documentation") |
|
| 32 | - | map("gD", vim.lsp.buf.declaration, "Goto Declaration") |
|
| 33 | - | map("<leader>la", vim.lsp.buf.code_action, "Code Action") |
|
| 34 | - | map("<leader>lr", vim.lsp.buf.rename, "Rename all references") |
|
| 35 | - | map("<leader>lf", vim.lsp.buf.format, "Format") |
|
| 36 | - | map("<leader>v", "<cmd>vsplit | lua vim.lsp.buf.definition()<cr>", "Goto Definition in Vertical Split") |
|
| 37 | - | ||
| 38 | - | local function client_supports_method(client, method, bufnr) |
|
| 39 | - | if vim.fn.has 'nvim-0.11' == 1 then |
|
| 40 | - | return client:supports_method(method, bufnr) |
|
| 41 | - | else |
|
| 42 | - | return client.supports_method(method, { bufnr = bufnr }) |
|
| 43 | - | end |
|
| 44 | - | end |
|
| 45 | - | ||
| 46 | - | local client = vim.lsp.get_client_by_id(event.data.client_id) |
|
| 47 | - | if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then |
|
| 48 | - | local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false }) |
|
| 49 | - | ||
| 50 | - | -- When cursor stops moving: Highlights all instances of the symbol under the cursor |
|
| 51 | - | -- When cursor moves: Clears the highlighting |
|
| 52 | - | vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { |
|
| 53 | - | buffer = event.buf, |
|
| 54 | - | group = highlight_augroup, |
|
| 55 | - | callback = vim.lsp.buf.document_highlight, |
|
| 56 | - | }) |
|
| 57 | - | vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { |
|
| 58 | - | buffer = event.buf, |
|
| 59 | - | group = highlight_augroup, |
|
| 60 | - | callback = vim.lsp.buf.clear_references, |
|
| 61 | - | }) |
|
| 62 | - | ||
| 63 | - | -- When LSP detaches: Clears the highlighting |
|
| 64 | - | vim.api.nvim_create_autocmd('LspDetach', { |
|
| 65 | - | group = vim.api.nvim_create_augroup('lsp-detach', { clear = true }), |
|
| 66 | - | callback = function(event2) |
|
| 67 | - | vim.lsp.buf.clear_references() |
|
| 68 | - | vim.api.nvim_clear_autocmds { group = 'lsp-highlight', buffer = event2.buf } |
|
| 69 | - | end, |
|
| 70 | - | }) |
|
| 71 | - | end |
|
| 72 | - | end, |
|
| 73 | - | ||
| 74 | - | }) |
|
| 75 | - | ||
| 76 | 28 | vim.api.nvim_create_autocmd("VimEnter", { |
|
| 77 | 29 | callback = function() |
|
| 78 | 30 | if vim.fn.argv(0) == "" then |
|
| 79 | - | vim.defer_fn(function() |
|
| 31 | + | vim.schedule(function() |
|
| 80 | 32 | require("mini.pick").builtin.files() |
|
| 81 | - | end, 100) -- Wait 100ms |
|
| 33 | + | end) |
|
| 82 | 34 | end |
|
| 83 | 35 | end, |
|
| 84 | 36 | }) |
|
| 88 | 40 | callback = function() |
|
| 89 | 41 | vim.opt_local.wrap = true |
|
| 90 | 42 | vim.opt_local.linebreak = true -- Break at word boundaries |
|
| 43 | + | vim.opt_local.spell = true |
|
| 91 | 44 | end, |
|
| 92 | 45 | }) |
|
| 1 | 1 | local opts = { noremap = true, silent = true } |
|
| 2 | 2 | local map = vim.api.nvim_set_keymap |
|
| 3 | 3 | ||
| 4 | - | -- format |
|
| 5 | - | -- Fast saving |
|
| 4 | + | -- Saving |
|
| 6 | 5 | map("n", "++", "<cmd>write!<CR>", opts) |
|
| 7 | 6 | ||
| 8 | - | -- Some useful quickfix shortcuts for quickfix |
|
| 9 | - | map("n", "<C-n>", "<cmd>cnext<CR>zz", opts) |
|
| 10 | - | map("n", "<C-m>", "<cmd>cprev<CR>zz", opts) |
|
| 11 | - | map("n", "<leader>a", "<cmd>cclose<CR>", opts) |
|
| 7 | + | -- Tmux Navigation |
|
| 8 | + | map("n", "<C-h>", "<cmd>TmuxNavigateLeft<CR>", opts) |
|
| 9 | + | map("n", "<C-j>", "<cmd>TmuxNavigateDown<CR>", opts) |
|
| 10 | + | map("n", "<C-k>", "<cmd>TmuxNavigateUp<CR>", opts) |
|
| 11 | + | map("n", "<C-l>", "<cmd>TmuxNavigateRight<CR>", opts) |
|
| 12 | 12 | ||
| 13 | - | -- Exit on jj and jk |
|
| 13 | + | -- Navigation |
|
| 14 | 14 | map("n", "j", "gj", opts) |
|
| 15 | 15 | map("n", "k", "gk", opts) |
|
| 16 | - | ||
| 17 | - | -- Exit on jj and jk |
|
| 18 | - | map("i", "jj", "<ESC>", opts) |
|
| 19 | - | map("i", "jk", "<ESC>", opts) |
|
| 20 | - | ||
| 21 | - | -- Remove search highlight |
|
| 22 | - | map("n", "<leader>h", "<cmd>nohlsearch<CR>", opts) |
|
| 23 | - | ||
| 24 | - | -- Grab text between curly braces |
|
| 25 | - | map("n", "YY", "va{Vy", opts) |
|
| 26 | - | ||
| 27 | - | -- goodies |
|
| 28 | 16 | map("n", "n", "nzzzv", opts) |
|
| 29 | 17 | map("n", "N", "Nzzzv", opts) |
|
| 30 | - | map("n", "J", "mzJ`z", opts) |
|
| 31 | 18 | map("n", "<C-d>", "<C-d>zz", opts) |
|
| 32 | 19 | map("n", "<C-u>", "<C-u>zz", opts) |
|
| 33 | 20 | ||
| 34 | - | -- Navigate buffers |
|
| 21 | + | -- Buffers |
|
| 35 | 22 | map("n", "<S-l>", ":bnext<CR>", opts) |
|
| 36 | 23 | map("n", "<S-h>", ":bprevious<CR>", opts) |
|
| 24 | + | map("n", "<leader>o", "<cmd>Pick buffers<CR>", opts) |
|
| 25 | + | map("n", "<leader>c", ":bd<cr>", opts) |
|
| 37 | 26 | ||
| 38 | - | -- If I visually select words and paste from clipboard, don't replace my |
|
| 39 | - | -- clipboard with the selected word, instead keep my old word in the |
|
| 40 | - | -- clipboard |
|
| 41 | - | map("x", "p", '"_dP', opts) |
|
| 27 | + | -- Quickfix |
|
| 28 | + | map("n", "<C-n>", "<cmd>cnext<CR>zz", opts) |
|
| 29 | + | map("n", "<C-m>", "<cmd>cprev<CR>zz", opts) |
|
| 30 | + | map("n", "<leader>q", "<cmd>copen<CR>", opts) |
|
| 31 | + | map("n", "<leader>a", "<cmd>cclose<CR>", opts) |
|
| 42 | 32 | ||
| 43 | - | -- Better split switching |
|
| 44 | - | -- map("n", "<C-h>", "<C-w>h", opts) |
|
| 45 | - | -- map("n", "<C-j>", "<C-w>j", opts) |
|
| 46 | - | -- map("n", "<C-k>", "<C-w>k", opts) |
|
| 47 | - | -- map("n", "<C-l>", "<C-w>l", opts) |
|
| 33 | + | -- Search |
|
| 34 | + | map("n", "<leader>h", "<cmd>nohlsearch<CR>", opts) |
|
| 35 | + | map("n", "<leader>f", "<cmd>Pick files<CR>", opts) |
|
| 36 | + | map("n", "<leader>/", "<cmd>Pick grep_live<CR>", opts) |
|
| 37 | + | map("n", "<leader>hh", "<cmd>Pick help<CR>", opts) |
|
| 48 | 38 | ||
| 49 | - | -- Visual -- |
|
| 50 | - | -- Stay in indent mode |
|
| 51 | - | map("v", "<", "<gv", opts) |
|
| 52 | - | map("v", ">", ">gv", opts) |
|
| 39 | + | -- Diagnostics |
|
| 40 | + | map("n", "<leader>d", "<cmd>Pick diagnostic<CR>", opts) |
|
| 41 | + | map("n", "<leader>dd", "<cmd>lua vim.diagnostic.open_float({ border = 'rounded' })<CR>", opts) |
|
| 53 | 42 | ||
| 54 | - | -- Visually select lines, and move them up/down |
|
| 55 | - | map("v", "J", ":m '>+1<CR>gv=gv", opts) |
|
| 56 | - | map("v", "K", ":m '<-2<CR>gv=gv", opts) |
|
| 43 | + | -- Git |
|
| 44 | + | map("n", "<leader>gg", "<cmd>lua MiniDiff.toggle_overlay()<CR>", opts) |
|
| 57 | 45 | ||
| 58 | - | map("n", "<leader>c", ":bd<cr>", opts) |
|
| 46 | + | -- File explorer |
|
| 47 | + | map("n", "<leader>e", "<cmd>lua MiniFiles.open()<CR>", opts) |
|
| 59 | 48 | ||
| 60 | - | map("n", "<leader>dd", "<cmd>lua vim.diagnostic.open_float({ border = 'rounded' })<CR>", opts) |
|
| 61 | - | map("n", "<leader>gg", "<cmd>lua MiniDiff.toggle_overlay()<CR>", opts) |
|
| 49 | + | -- Spelling |
|
| 50 | + | vim.keymap.set("n", "<leader>s", function() |
|
| 51 | + | local word = vim.fn.expand("<cword>") |
|
| 52 | + | local suggestions = vim.fn.spellsuggest(word, 25) |
|
| 53 | + | MiniPick.start({ |
|
| 54 | + | source = { |
|
| 55 | + | items = suggestions, |
|
| 56 | + | name = "Spelling: " .. word, |
|
| 57 | + | choose = function(item) |
|
| 58 | + | vim.schedule(function() |
|
| 59 | + | vim.cmd("normal! ciw" .. item) |
|
| 60 | + | vim.cmd("stopinsert") |
|
| 61 | + | end) |
|
| 62 | + | end, |
|
| 63 | + | }, |
|
| 64 | + | }) |
|
| 65 | + | end, { desc = "Spelling suggestions" }) |
|
| 62 | 66 | ||
| 67 | + | -- Editing |
|
| 68 | + | map("n", "J", "mzJ`z", opts) |
|
| 69 | + | map("n", "YY", "va{Vy", opts) |
|
| 70 | + | map("x", "p", '"_dP', opts) |
|
| 71 | + | ||
| 72 | + | -- Insert mode |
|
| 73 | + | map("i", "jj", "<ESC>", opts) |
|
| 74 | + | map("i", "jk", "<ESC>", opts) |
|
| 63 | 75 | map("i", "<C-j>", 'pumvisible() ? "\\<C-n>" : "\\<C-j>"', { expr = true, noremap = true, silent = true }) |
|
| 64 | 76 | map("i", "<C-k>", 'pumvisible() ? "\\<C-p>" : "\\<C-k>"', { expr = true, noremap = true, silent = true }) |
|
| 65 | 77 | ||
| 66 | - | map("n", "<leader>e", "<cmd>lua MiniFiles.open()<CR>", opts) |
|
| 67 | - | ||
| 68 | - | map("n", "<leader>o", "<cmd>Pick buffers<CR>", opts) |
|
| 69 | - | map("n", "<leader>f", "<cmd>Pick files<CR>", opts) |
|
| 70 | - | map("n", "<leader>/", "<cmd>Pick grep_live<CR>", opts) |
|
| 71 | - | map("n", "<leader>hh", "<cmd>Pick help<CR>", opts) |
|
| 72 | - | map("n", "<leader>d", "<cmd>Pick diagnostic<CR>", opts) |
|
| 78 | + | -- Visual mode |
|
| 79 | + | map("v", "<", "<gv", opts) |
|
| 80 | + | map("v", ">", ">gv", opts) |
|
| 81 | + | map("v", "J", ":m '>+1<CR>gv=gv", opts) |
|
| 82 | + | map("v", "K", ":m '<-2<CR>gv=gv", opts) |
| 1 | 1 | vim.g.mapleader = " " |
|
| 2 | 2 | vim.g.maplocalleader = "\\" |
|
| 3 | - | ||
| 4 | 3 | vim.g.autoformat = true |
|
| 5 | - | ||
| 6 | 4 | vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } |
|
| 7 | - | ||
| 8 | - | local opt = vim.opt |
|
| 9 | - | ||
| 10 | 5 | vim.opt.swapfile = false |
|
| 11 | - | opt.autowrite = true -- Enable auto write |
|
| 12 | - | opt.clipboard = "unnamedplus" -- Sync with system clipboard |
|
| 13 | - | opt.completeopt = "menu,menuone,noselect" |
|
| 14 | - | opt.conceallevel = 3 -- Hide * markup for bold and italic |
|
| 15 | - | opt.confirm = true -- Confirm to save changes before exiting modified buffer |
|
| 16 | - | opt.cursorline = true -- Enable highlighting of the current line |
|
| 17 | - | opt.expandtab = true -- Use spaces instead of tabs |
|
| 18 | - | opt.formatoptions = "jcroqlnt" -- tcqj |
|
| 19 | - | opt.grepformat = "%f:%l:%c:%m" |
|
| 20 | - | opt.grepprg = "rg --vimgrep" |
|
| 21 | - | opt.ignorecase = true -- Ignore case |
|
| 22 | - | opt.inccommand = "nosplit" -- preview incremental substitute |
|
| 23 | - | opt.incsearch = true |
|
| 24 | - | opt.laststatus = 3 -- global statusline |
|
| 25 | - | opt.list = true -- Show some invisible characters (tabs... |
|
| 26 | - | opt.mouse = "a" -- Enable mouse mode |
|
| 27 | - | opt.number = true -- Print line number |
|
| 28 | - | opt.pumblend = 10 -- Popup blend |
|
| 29 | - | opt.pumheight = 10 -- Maximum number of entries in a popup |
|
| 30 | - | opt.relativenumber = true -- Relative line numbers |
|
| 31 | - | opt.scrolloff = 4 -- Lines of context |
|
| 32 | - | opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" } |
|
| 33 | - | opt.shiftround = true -- Round indent |
|
| 34 | - | opt.shiftwidth = 2 -- Size of an indent |
|
| 35 | - | opt.shortmess:append({ W = true, I = true, c = true, C = true }) |
|
| 36 | - | opt.showmode = false -- Dont show mode since we have a statusline |
|
| 37 | - | opt.sidescrolloff = 8 -- Columns of context |
|
| 38 | - | opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time |
|
| 39 | - | opt.smartcase = true -- Don't ignore case with capitals |
|
| 40 | - | opt.smartindent = true -- Insert indents automatically |
|
| 41 | - | opt.spelllang = { "en" } |
|
| 42 | - | opt.splitbelow = true -- Put new windows below current |
|
| 43 | - | opt.splitkeep = "screen" |
|
| 44 | - | opt.splitright = true -- Put new windows right of current |
|
| 45 | - | opt.tabstop = 2 -- Number of spaces tabs count for |
|
| 46 | - | opt.termguicolors = true -- True color support |
|
| 47 | - | opt.timeoutlen = 300 |
|
| 48 | - | opt.undofile = true |
|
| 49 | - | opt.undolevels = 10000 |
|
| 50 | - | opt.updatetime = 200 -- Save swap file and trigger CursorHold |
|
| 51 | - | opt.virtualedit = "block" -- Allow cursor to move where there is no text in visual block mode |
|
| 52 | - | opt.wildmode = "longest:full,full" -- Command-line completion mode |
|
| 53 | - | opt.winminwidth = 5 -- Minimum window width |
|
| 54 | - | opt.wrap = false -- Disable line wrap |
|
| 55 | - | opt.fillchars = { |
|
| 6 | + | vim.opt.autowrite = true -- Enable auto write |
|
| 7 | + | vim.opt.clipboard = "unnamedplus" -- Sync with system clipboard |
|
| 8 | + | vim.opt.completeopt = "menu,menuone,noselect" |
|
| 9 | + | vim.opt.conceallevel = 3 -- Hide * markup for bold and italic |
|
| 10 | + | vim.opt.confirm = true -- Confirm to save changes before exiting modified buffer |
|
| 11 | + | vim.opt.cursorline = true -- Enable highlighting of the current line |
|
| 12 | + | vim.opt.expandtab = true -- Use spaces instead of tabs |
|
| 13 | + | vim.opt.formatoptions = "jcroqlnt" -- tcqj |
|
| 14 | + | vim.opt.grepformat = "%f:%l:%c:%m" |
|
| 15 | + | vim.opt.grepprg = "rg --vimgrep" |
|
| 16 | + | vim.opt.ignorecase = true -- Ignore case |
|
| 17 | + | vim.opt.inccommand = "nosplit" -- preview incremental substitute |
|
| 18 | + | vim.opt.incsearch = true |
|
| 19 | + | vim.opt.laststatus = 3 -- global statusline |
|
| 20 | + | vim.opt.list = false -- Don't show invisible characters |
|
| 21 | + | vim.opt.mouse = "a" -- Enable mouse mode |
|
| 22 | + | vim.opt.number = true -- Print line number |
|
| 23 | + | vim.opt.pumblend = 10 -- Popup blend |
|
| 24 | + | vim.opt.pumheight = 10 -- Maximum number of entries in a popup |
|
| 25 | + | vim.opt.relativenumber = true -- Relative line numbers |
|
| 26 | + | vim.opt.scrolloff = 4 -- Lines of context |
|
| 27 | + | vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" } |
|
| 28 | + | vim.opt.shiftround = true -- Round indent |
|
| 29 | + | vim.opt.shiftwidth = 2 -- Size of an indent |
|
| 30 | + | vim.opt.shortmess:append({ W = true, I = true, c = true, C = true }) |
|
| 31 | + | vim.opt.showmode = false -- Dont show mode since we have a statusline |
|
| 32 | + | vim.opt.sidescrolloff = 8 -- Columns of context |
|
| 33 | + | vim.opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time |
|
| 34 | + | vim.opt.smartcase = true -- Don't ignore case with capitals |
|
| 35 | + | vim.opt.smartindent = true -- Insert indents automatically |
|
| 36 | + | vim.opt.spelllang = { "en" } |
|
| 37 | + | vim.opt.splitbelow = true -- Put new windows below current |
|
| 38 | + | vim.opt.splitkeep = "screen" |
|
| 39 | + | vim.opt.splitright = true -- Put new windows right of current |
|
| 40 | + | vim.opt.tabstop = 2 -- Number of spaces tabs count for |
|
| 41 | + | vim.opt.termguicolors = true -- True color support |
|
| 42 | + | vim.opt.timeoutlen = 300 |
|
| 43 | + | vim.opt.undofile = true |
|
| 44 | + | vim.opt.undolevels = 10000 |
|
| 45 | + | vim.opt.updatetime = 200 -- Save swap file and trigger CursorHold |
|
| 46 | + | vim.opt.virtualedit = "block" -- Allow cursor to move where there is no text in visual block mode |
|
| 47 | + | vim.opt.wildmode = "longest:full,full" -- Command-line completion mode |
|
| 48 | + | vim.opt.winminwidth = 5 -- Minimum window width |
|
| 49 | + | vim.opt.wrap = false -- Disable line wrap |
|
| 50 | + | vim.opt.fillchars = { |
|
| 56 | 51 | foldopen = "", |
|
| 57 | 52 | foldclose = "", |
|
| 58 | - | -- fold = "⸱", |
|
| 59 | 53 | fold = " ", |
|
| 60 | 54 | foldsep = " ", |
|
| 61 | 55 | diff = "╱", |
|
| 62 | 56 | eob = " ", |
|
| 63 | 57 | } |
|
| 64 | - | opt.list = false |
|
| 58 | + | vim.opt.shell = "sh" |
|
| 65 | 59 | ||
| 66 | 60 | if vim.fn.has("nvim-0.10") == 1 then |
|
| 67 | - | opt.smoothscroll = true |
|
| 61 | + | vim.opt.smoothscroll = true |
|
| 68 | 62 | end |
|
| 63 | + | ||
| 64 | + | -- Treesitter folding |
|
| 65 | + | vim.o.foldenable = true |
|
| 66 | + | vim.o.foldlevel = 99 |
|
| 67 | + | vim.o.foldmethod = "expr" |
|
| 68 | + | vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()" |
|
| 69 | 69 | ||
| 70 | 70 | -- Fix markdown indentation settings |
|
| 71 | 71 | vim.g.markdown_recommended_style = 0 |
| 1 | - | local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' |
|
| 2 | - | if not (vim.uv or vim.loop).fs_stat(lazypath) then |
|
| 3 | - | local lazyrepo = 'https://github.com/folke/lazy.nvim.git' |
|
| 4 | - | local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } |
|
| 5 | - | if vim.v.shell_error ~= 0 then |
|
| 6 | - | error('Error cloning lazy.nvim:\n' .. out) |
|
| 7 | - | end |
|
| 8 | - | end ---@diagnostic disable-next-line: undefined-field |
|
| 9 | - | vim.opt.rtp:prepend(lazypath) |
|
| 10 | - | ||
| 11 | - | require("lazy").setup({ import = "plugins" }, { |
|
| 12 | - | install = { |
|
| 13 | - | missing = true, |
|
| 14 | - | }, |
|
| 15 | - | checker = { |
|
| 16 | - | enabled = true, |
|
| 17 | - | notify = false, |
|
| 18 | - | }, |
|
| 19 | - | change_detection = { |
|
| 20 | - | enabled = true, |
|
| 21 | - | notify = false, |
|
| 22 | - | }, |
|
| 23 | - | ui = { |
|
| 24 | - | -- border = "rounded" |
|
| 25 | - | }, |
|
| 26 | - | performance = { |
|
| 27 | - | rtp = { |
|
| 28 | - | disabled_plugins = { |
|
| 29 | - | "gzip", |
|
| 30 | - | "tarPlugin", |
|
| 31 | - | "tohtml", |
|
| 32 | - | "tutor", |
|
| 33 | - | "zipPlugin", |
|
| 34 | - | }, |
|
| 35 | - | }, |
|
| 36 | - | }, |
|
| 37 | - | }) |
| 10 | 10 | "json" |
|
| 11 | 11 | }) |
|
| 12 | 12 | ||
| 13 | + | vim.api.nvim_create_autocmd("LspAttach", { |
|
| 14 | + | group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }), |
|
| 15 | + | callback = function(event) |
|
| 16 | + | local map = function(keys, func, desc) |
|
| 17 | + | vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) |
|
| 18 | + | end |
|
| 19 | + | ||
| 20 | + | -- defaults: |
|
| 21 | + | -- https://neovim.io/doc/user/news-0.11.html#_defaults |
|
| 22 | + | ||
| 23 | + | map("gl", vim.diagnostic.open_float, "Open Diagnostic Float") |
|
| 24 | + | map("K", vim.lsp.buf.hover, "Hover Documentation") |
|
| 25 | + | map("gs", vim.lsp.buf.signature_help, "Signature Documentation") |
|
| 26 | + | map("gD", vim.lsp.buf.declaration, "Goto Declaration") |
|
| 27 | + | map("<leader>la", vim.lsp.buf.code_action, "Code Action") |
|
| 28 | + | map("<leader>lr", vim.lsp.buf.rename, "Rename all references") |
|
| 29 | + | map("<leader>lf", vim.lsp.buf.format, "Format") |
|
| 30 | + | map("<leader>v", "<cmd>vsplit | lua vim.lsp.buf.definition()<cr>", "Goto Definition in Vertical Split") |
|
| 31 | + | ||
| 32 | + | local function client_supports_method(client, method, bufnr) |
|
| 33 | + | if vim.fn.has 'nvim-0.11' == 1 then |
|
| 34 | + | return client:supports_method(method, bufnr) |
|
| 35 | + | else |
|
| 36 | + | return client.supports_method(method, { bufnr = bufnr }) |
|
| 37 | + | end |
|
| 38 | + | end |
|
| 39 | + | ||
| 40 | + | local client = vim.lsp.get_client_by_id(event.data.client_id) |
|
| 41 | + | if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then |
|
| 42 | + | local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false }) |
|
| 43 | + | ||
| 44 | + | -- When cursor stops moving: Highlights all instances of the symbol under the cursor |
|
| 45 | + | -- When cursor moves: Clears the highlighting |
|
| 46 | + | vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { |
|
| 47 | + | buffer = event.buf, |
|
| 48 | + | group = highlight_augroup, |
|
| 49 | + | callback = vim.lsp.buf.document_highlight, |
|
| 50 | + | }) |
|
| 51 | + | vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { |
|
| 52 | + | buffer = event.buf, |
|
| 53 | + | group = highlight_augroup, |
|
| 54 | + | callback = vim.lsp.buf.clear_references, |
|
| 55 | + | }) |
|
| 56 | + | ||
| 57 | + | -- When LSP detaches: Clears the highlighting |
|
| 58 | + | vim.api.nvim_create_autocmd('LspDetach', { |
|
| 59 | + | group = vim.api.nvim_create_augroup('lsp-detach', { clear = true }), |
|
| 60 | + | callback = function(event2) |
|
| 61 | + | vim.lsp.buf.clear_references() |
|
| 62 | + | vim.api.nvim_clear_autocmds { group = 'lsp-highlight', buffer = event2.buf } |
|
| 63 | + | end, |
|
| 64 | + | }) |
|
| 65 | + | end |
|
| 66 | + | end, |
|
| 67 | + | }) |
|
| 68 | + | ||
| 13 | 69 | vim.diagnostic.config({ |
|
| 14 | 70 | virtual_lines = false, |
|
| 15 | 71 | -- virtual_text = true, |
| 1 | + | -- ============================================================================ |
|
| 2 | + | -- Colorscheme (must load at startup) |
|
| 3 | + | -- ============================================================================ |
|
| 4 | + | vim.pack.add({ |
|
| 5 | + | "https://github.com/stevedylandev/darkmatter-nvim", |
|
| 6 | + | 'https://github.com/echasnovski/mini.nvim', |
|
| 7 | + | }) |
|
| 8 | + | vim.cmd.colorscheme('darkmatter') |
|
| 9 | + | ||
| 10 | + | -- ============================================================================ |
|
| 11 | + | -- Mini.nvim — startup modules |
|
| 12 | + | -- ============================================================================ |
|
| 13 | + | local win_config = function() |
|
| 14 | + | local height = math.floor(0.618 * vim.o.lines) |
|
| 15 | + | local width = math.floor(0.618 * vim.o.columns) |
|
| 16 | + | return { |
|
| 17 | + | anchor = 'NW', |
|
| 18 | + | height = height, |
|
| 19 | + | width = width, |
|
| 20 | + | row = math.floor(0.5 * (vim.o.lines - height)), |
|
| 21 | + | col = math.floor(0.5 * (vim.o.columns - width)), |
|
| 22 | + | } |
|
| 23 | + | end |
|
| 24 | + | ||
| 25 | + | require("mini.pick").setup({ |
|
| 26 | + | mappings = { |
|
| 27 | + | choose_marked = '<C-y>', |
|
| 28 | + | move_down = '<C-j>', |
|
| 29 | + | move_up = '<C-k>', |
|
| 30 | + | }, |
|
| 31 | + | window = { config = win_config } |
|
| 32 | + | }) |
|
| 33 | + | ||
| 34 | + | vim.api.nvim_set_hl(0, "MiniPickMatchCurrent", |
|
| 35 | + | { bg = vim.g.terminal_color_8 |
|
| 36 | + | }) |
|
| 37 | + | ||
| 38 | + | require('mini.icons').setup() |
|
| 39 | + | vim.api.nvim_set_hl(0, 'MiniIconsAzure', { fg = vim.g.terminal_color_12 }) |
|
| 40 | + | vim.api.nvim_set_hl(0, 'MiniIconsBlue', { fg = vim.g.terminal_color_4 }) |
|
| 41 | + | vim.api.nvim_set_hl(0, 'MiniIconsCyan', { fg = vim.g.terminal_color_6 }) |
|
| 42 | + | vim.api.nvim_set_hl(0, 'MiniIconsGreen', { fg = vim.g.terminal_color_2 }) |
|
| 43 | + | vim.api.nvim_set_hl(0, 'MiniIconsGrey', { fg = vim.g.terminal_color_8 }) |
|
| 44 | + | vim.api.nvim_set_hl(0, 'MiniIconsOrange', { fg = vim.g.terminal_color_3 }) |
|
| 45 | + | vim.api.nvim_set_hl(0, 'MiniIconsPurple', { fg = vim.g.terminal_color_5 }) |
|
| 46 | + | vim.api.nvim_set_hl(0, 'MiniIconsRed', { fg = vim.g.terminal_color_1 }) |
|
| 47 | + | vim.api.nvim_set_hl(0, 'MiniIconsYellow', { fg = vim.g.terminal_color_11 }) |
|
| 48 | + | ||
| 49 | + | require('mini.diff').setup({ |
|
| 50 | + | view = { |
|
| 51 | + | style = vim.go.number and 'sign' or 'number', |
|
| 52 | + | signs = { |
|
| 53 | + | add = "+", |
|
| 54 | + | change = "~", |
|
| 55 | + | delete = "-", |
|
| 56 | + | topdelete = "", |
|
| 57 | + | changedelete = "▎", |
|
| 58 | + | untracked = "+" |
|
| 59 | + | }, |
|
| 60 | + | priority = 199, |
|
| 61 | + | }, |
|
| 62 | + | }) |
|
| 63 | + | require('mini.statusline').setup() |
|
| 64 | + | require('mini.extra').setup() |
|
| 65 | + | ||
| 66 | + | -- ============================================================================ |
|
| 67 | + | -- Deferred — loads right after startup via vim.schedule() |
|
| 68 | + | -- ============================================================================ |
|
| 69 | + | vim.schedule(function() |
|
| 70 | + | vim.pack.add({ |
|
| 71 | + | "https://github.com/christoomey/vim-tmux-navigator", |
|
| 72 | + | "https://github.com/rafamadriz/friendly-snippets", |
|
| 73 | + | }) |
|
| 74 | + | ||
| 75 | + | require("mini.comment").setup({ |
|
| 76 | + | mappings = { |
|
| 77 | + | comment = 'gb', |
|
| 78 | + | comment_visual = 'gb', |
|
| 79 | + | textobject = 'gb' |
|
| 80 | + | } |
|
| 81 | + | }) |
|
| 82 | + | ||
| 83 | + | require('mini.surround').setup({ |
|
| 84 | + | mappings = { |
|
| 85 | + | replace = 'cs', -- Replace surrounding |
|
| 86 | + | }, |
|
| 87 | + | }) |
|
| 88 | + | ||
| 89 | + | require('mini.files').setup({ |
|
| 90 | + | mappings = { |
|
| 91 | + | close = '<ESC>', |
|
| 92 | + | go_in_plus = '<CR>' |
|
| 93 | + | } |
|
| 94 | + | }) |
|
| 95 | + | end) |
|
| 96 | + | ||
| 97 | + | -- ============================================================================ |
|
| 98 | + | -- Lazy — loads on InsertEnter |
|
| 99 | + | -- ============================================================================ |
|
| 100 | + | vim.api.nvim_create_autocmd('InsertEnter', { once = true, callback = function() |
|
| 101 | + | require("mini.completion").setup({ |
|
| 102 | + | mappings = { |
|
| 103 | + | scroll_down = '', |
|
| 104 | + | scroll_up = '', |
|
| 105 | + | }, |
|
| 106 | + | }) |
|
| 107 | + | ||
| 108 | + | local gen_loader = require('mini.snippets').gen_loader |
|
| 109 | + | require('mini.snippets').setup({ |
|
| 110 | + | snippets = { |
|
| 111 | + | gen_loader.from_runtime("snippets"), |
|
| 112 | + | gen_loader.from_lang(), |
|
| 113 | + | }, |
|
| 114 | + | mappings = { |
|
| 115 | + | expand = '', |
|
| 116 | + | }, |
|
| 117 | + | }) |
|
| 118 | + | MiniSnippets.start_lsp_server() |
|
| 119 | + | end }) |
| 1 | + | -- Native treesitter parsers installed via luarocks |
|
| 2 | + | local rocks_path = vim.fn.stdpath("data") .. "/site/lib/luarocks/rocks-5.1" |
|
| 3 | + | for _, parser_dir in ipairs(vim.fn.glob(rocks_path .. "/tree-sitter-*/*/", true, true)) do |
|
| 4 | + | vim.opt.runtimepath:prepend(parser_dir) |
|
| 5 | + | end |
| 1 | - | return { |
|
| 2 | - | "stevedylandev/ai.vim", |
|
| 3 | - | lazy = false, |
|
| 4 | - | priority = 1000, |
|
| 5 | - | } |
|
| 6 | - |
| 1 | - | return { |
|
| 2 | - | "stevedylandev/darkmatter-nvim", |
|
| 3 | - | lazy = false, |
|
| 4 | - | priority = 1000, |
|
| 5 | - | config = function() |
|
| 6 | - | vim.cmd.colorscheme "darkmatter" |
|
| 7 | - | end, |
|
| 8 | - | } |
|
| 9 | - | ||
| 10 | - | -- return { |
|
| 11 | - | -- 'olivercederborg/poimandres.nvim', |
|
| 12 | - | -- lazy = false, |
|
| 13 | - | -- priority = 1000, |
|
| 14 | - | -- config = function() |
|
| 15 | - | -- require('poimandres').setup { |
|
| 16 | - | -- -- leave this setup function empty for default config |
|
| 17 | - | -- -- or refer to the configuration section |
|
| 18 | - | -- -- for configuration options |
|
| 19 | - | -- } |
|
| 20 | - | -- end, |
|
| 21 | - | -- |
|
| 22 | - | -- -- optionally set the colorscheme within lazy config |
|
| 23 | - | -- init = function() |
|
| 24 | - | -- vim.cmd("colorscheme poimandres") |
|
| 25 | - | -- end |
|
| 26 | - | -- } |
| 1 | - | return { |
|
| 2 | - | 'echasnovski/mini.nvim', |
|
| 3 | - | version = '*', |
|
| 4 | - | config = function() |
|
| 5 | - | local win_config = function() |
|
| 6 | - | local height = math.floor(0.618 * vim.o.lines) |
|
| 7 | - | local width = math.floor(0.618 * vim.o.columns) |
|
| 8 | - | return { |
|
| 9 | - | anchor = 'NW', |
|
| 10 | - | height = height, |
|
| 11 | - | width = width, |
|
| 12 | - | row = math.floor(0.5 * (vim.o.lines - height)), |
|
| 13 | - | col = math.floor(0.5 * (vim.o.columns - width)), |
|
| 14 | - | } |
|
| 15 | - | end |
|
| 16 | - | require("mini.pick").setup({ |
|
| 17 | - | mappings = { |
|
| 18 | - | move_down = '<C-j>', |
|
| 19 | - | move_up = '<C-k>', |
|
| 20 | - | }, |
|
| 21 | - | window = { config = win_config } |
|
| 22 | - | }) |
|
| 23 | - | ||
| 24 | - | vim.api.nvim_set_hl(0, "MiniPickMatchCurrent", |
|
| 25 | - | { bg = vim.g.terminal_color_8 |
|
| 26 | - | }) |
|
| 27 | - | ||
| 28 | - | require("mini.comment").setup({ |
|
| 29 | - | mappings = { |
|
| 30 | - | comment = 'gb', |
|
| 31 | - | comment_visual = 'gb', |
|
| 32 | - | textobject = 'gb' |
|
| 33 | - | } |
|
| 34 | - | }) |
|
| 35 | - | ||
| 36 | - | require("mini.completion").setup({ |
|
| 37 | - | mappings = { |
|
| 38 | - | scroll_down = '<C-j>', |
|
| 39 | - | scroll_up = '<C-k>', |
|
| 40 | - | }, |
|
| 41 | - | }) |
|
| 42 | - | ||
| 43 | - | local gen_loader = require('mini.snippets').gen_loader |
|
| 44 | - | require('mini.snippets').setup({ |
|
| 45 | - | snippets = { |
|
| 46 | - | gen_loader.from_lang(), |
|
| 47 | - | }, |
|
| 48 | - | }) |
|
| 49 | - | ||
| 50 | - | require('mini.files').setup({ |
|
| 51 | - | mappings = { |
|
| 52 | - | close = '<ESC>', |
|
| 53 | - | go_in_plus = '<CR>' |
|
| 54 | - | } |
|
| 55 | - | }) |
|
| 56 | - | ||
| 57 | - | require('mini.surround').setup({ |
|
| 58 | - | mappings = { |
|
| 59 | - | replace = 'cs', -- Replace surrounding |
|
| 60 | - | }, |
|
| 61 | - | }) |
|
| 62 | - | require('mini.diff').setup({ |
|
| 63 | - | view = { |
|
| 64 | - | -- Visualization style. Possible values are 'sign' and 'number'. |
|
| 65 | - | -- Default: 'number' if line numbers are enabled, 'sign' otherwise. |
|
| 66 | - | -- Suppress vim.tbl_islist deprecation warning |
|
| 67 | - | style = vim.go.number and 'sign' or 'number', |
|
| 68 | - | ||
| 69 | - | -- Signs used for hunks with 'sign' view |
|
| 70 | - | signs = { |
|
| 71 | - | add = "+", |
|
| 72 | - | change = "~", |
|
| 73 | - | delete = "-", |
|
| 74 | - | topdelete = "", |
|
| 75 | - | changedelete = "▎", |
|
| 76 | - | untracked = "+" |
|
| 77 | - | }, |
|
| 78 | - | ||
| 79 | - | priority = 199, |
|
| 80 | - | }, |
|
| 81 | - | ||
| 82 | - | delay = { |
|
| 83 | - | text_change = 200, |
|
| 84 | - | }, |
|
| 85 | - | ||
| 86 | - | mappings = { |
|
| 87 | - | -- Apply hunks inside a visual/operator region |
|
| 88 | - | apply = 'gh', |
|
| 89 | - | ||
| 90 | - | -- Reset hunks inside a visual/operator region |
|
| 91 | - | reset = 'gH', |
|
| 92 | - | ||
| 93 | - | -- Hunk range textobject to be used inside operator |
|
| 94 | - | -- Works also in Visual mode if mapping differs from apply and reset |
|
| 95 | - | textobject = 'gh', |
|
| 96 | - | ||
| 97 | - | -- Go to hunk range in corresponding direction |
|
| 98 | - | goto_first = '[H', |
|
| 99 | - | goto_prev = '[h', |
|
| 100 | - | goto_next = ']h', |
|
| 101 | - | goto_last = ']H', |
|
| 102 | - | }, |
|
| 103 | - | ||
| 104 | - | options = { |
|
| 105 | - | algorithm = 'histogram', |
|
| 106 | - | indent_heuristic = true, |
|
| 107 | - | linematch = 60, |
|
| 108 | - | wrap_goto = false, |
|
| 109 | - | }, |
|
| 110 | - | }) |
|
| 111 | - | require('mini.statusline').setup() |
|
| 112 | - | require('mini.extra').setup() |
|
| 113 | - | end |
|
| 114 | - | } |
| 1 | - | return { |
|
| 2 | - | "christoomey/vim-tmux-navigator", |
|
| 3 | - | config = function() |
|
| 4 | - | vim.keymap.set("n", "<C-h>", "<cmd>TmuxNavigateLeft<CR>", opts) |
|
| 5 | - | vim.keymap.set("n", "<C-j>", "<cmd>TmuxNavigateDown<CR>", opts) |
|
| 6 | - | vim.keymap.set("n", "<C-k>", "<cmd>TmuxNavigateUp<CR>", opts) |
|
| 7 | - | vim.keymap.set("n", "<C-l>", "<cmd>TmuxNavigateRight<CR>", opts) |
|
| 8 | - | end, |
|
| 9 | - | } |
| 1 | - | return { |
|
| 2 | - | "nvim-treesitter/nvim-treesitter", |
|
| 3 | - | version = false, |
|
| 4 | - | build = ":TSUpdate", |
|
| 5 | - | event = { "BufReadPost", "BufNewFile" }, |
|
| 6 | - | dependencies = { |
|
| 7 | - | "nvim-treesitter/nvim-treesitter-textobjects", |
|
| 8 | - | }, |
|
| 9 | - | config = function() |
|
| 10 | - | require("nvim-treesitter.configs").setup({ |
|
| 11 | - | sync_install = false, |
|
| 12 | - | ignore_install = { "javascript" }, |
|
| 13 | - | modules = {}, |
|
| 14 | - | highlight = { |
|
| 15 | - | enable = true, |
|
| 16 | - | additional_vim_regex_highlighting = false, |
|
| 17 | - | }, |
|
| 18 | - | indent = { enable = true }, |
|
| 19 | - | auto_install = true, |
|
| 20 | - | ensure_installed = { |
|
| 21 | - | "bash", |
|
| 22 | - | "c", |
|
| 23 | - | "html", |
|
| 24 | - | "javascript", |
|
| 25 | - | "json", |
|
| 26 | - | "lua", |
|
| 27 | - | "luadoc", |
|
| 28 | - | "luap", |
|
| 29 | - | "query", |
|
| 30 | - | "regex", |
|
| 31 | - | "vim", |
|
| 32 | - | "vimdoc", |
|
| 33 | - | "yaml", |
|
| 34 | - | "rust", |
|
| 35 | - | "go", |
|
| 36 | - | "gomod", |
|
| 37 | - | "gowork", |
|
| 38 | - | "gosum", |
|
| 39 | - | }, |
|
| 40 | - | incremental_selection = { |
|
| 41 | - | enable = true, |
|
| 42 | - | keymaps = { |
|
| 43 | - | init_selection = "<leader>vv", |
|
| 44 | - | node_incremental = "+", |
|
| 45 | - | scope_incremental = false, |
|
| 46 | - | node_decremental = "_", |
|
| 47 | - | }, |
|
| 48 | - | }, |
|
| 49 | - | textobjects = { |
|
| 50 | - | select = { |
|
| 51 | - | enable = true, |
|
| 52 | - | lookahead = true, |
|
| 53 | - | ||
| 54 | - | keymaps = { |
|
| 55 | - | -- You can use the capture groups defined in textobjects.scm |
|
| 56 | - | ["af"] = { query = "@function.outer", desc = "around a function" }, |
|
| 57 | - | ["if"] = { query = "@function.inner", desc = "inner part of a function" }, |
|
| 58 | - | ["ac"] = { query = "@class.outer", desc = "around a class" }, |
|
| 59 | - | ["ic"] = { query = "@class.inner", desc = "inner part of a class" }, |
|
| 60 | - | ["ai"] = { query = "@conditional.outer", desc = "around an if statement" }, |
|
| 61 | - | ["ii"] = { query = "@conditional.inner", desc = "inner part of an if statement" }, |
|
| 62 | - | ["al"] = { query = "@loop.outer", desc = "around a loop" }, |
|
| 63 | - | ["il"] = { query = "@loop.inner", desc = "inner part of a loop" }, |
|
| 64 | - | ["ap"] = { query = "@parameter.outer", desc = "around parameter" }, |
|
| 65 | - | ["ip"] = { query = "@parameter.inner", desc = "inside a parameter" }, |
|
| 66 | - | }, |
|
| 67 | - | selection_modes = { |
|
| 68 | - | ["@parameter.outer"] = "v", -- charwise |
|
| 69 | - | ["@parameter.inner"] = "v", -- charwise |
|
| 70 | - | ["@function.outer"] = "v", -- charwise |
|
| 71 | - | ["@conditional.outer"] = "V", -- linewise |
|
| 72 | - | ["@loop.outer"] = "V", -- linewise |
|
| 73 | - | ["@class.outer"] = "<c-v>", -- blockwise |
|
| 74 | - | }, |
|
| 75 | - | include_surrounding_whitespace = false, |
|
| 76 | - | }, |
|
| 77 | - | move = { |
|
| 78 | - | enable = true, |
|
| 79 | - | set_jumps = true, -- whether to set jumps in the jumplist |
|
| 80 | - | goto_previous_start = { |
|
| 81 | - | ["[f"] = { query = "@function.outer", desc = "Previous function" }, |
|
| 82 | - | ["[c"] = { query = "@class.outer", desc = "Previous class" }, |
|
| 83 | - | ["[p"] = { query = "@parameter.inner", desc = "Previous parameter" }, |
|
| 84 | - | }, |
|
| 85 | - | goto_next_start = { |
|
| 86 | - | ["]f"] = { query = "@function.outer", desc = "Next function" }, |
|
| 87 | - | ["]c"] = { query = "@class.outer", desc = "Next class" }, |
|
| 88 | - | ["]p"] = { query = "@parameter.inner", desc = "Next parameter" }, |
|
| 89 | - | }, |
|
| 90 | - | }, |
|
| 91 | - | swap = { |
|
| 92 | - | enable = true, |
|
| 93 | - | swap_next = { |
|
| 94 | - | ["<leader>a"] = "@parameter.inner", |
|
| 95 | - | }, |
|
| 96 | - | swap_previous = { |
|
| 97 | - | ["<leader>A"] = "@parameter.inner", |
|
| 98 | - | }, |
|
| 99 | - | }, |
|
| 100 | - | }, |
|
| 101 | - | }) |
|
| 102 | - | end, |
|
| 103 | - | } |
| 26 | 26 | # )\"" |
|
| 27 | 27 | ||
| 28 | 28 | bind-key "T" run-shell "sesh connect \"$( |
|
| 29 | - | sesh list --icons | fzf-tmux --reverse -p 80%,70% \ |
|
| 30 | - | --no-sort --ansi --border-label ' sesh ' --prompt ' ' \ |
|
| 31 | - | --header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \ |
|
| 29 | + | sesh list --icons --hide-duplicates | fzf-tmux --no-sort --reverse \ |
|
| 30 | + | -p 100%,100% --ansi --padding 0,1 --prompt=' ' \ |
|
| 31 | + | --border=none --input-border=rounded --preview-border=rounded \ |
|
| 32 | + | --header '^a all ^t tmux ^g configs ^x zoxide ^f find ^d kill' \ |
|
| 32 | 33 | --bind 'tab:down,btab:up' \ |
|
| 33 | - | --bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list --icons)' \ |
|
| 34 | - | --bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t --icons)' \ |
|
| 35 | - | --bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c --icons)' \ |
|
| 36 | - | --bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z --icons)' \ |
|
| 37 | - | --bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \ |
|
| 38 | - | --bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(⚡ )+reload(sesh list --icons)' \ |
|
| 39 | - | --preview-window 'right:55%' \ |
|
| 40 | - | --preview 'sesh preview {}' |
|
| 34 | + | --bind 'ctrl-a:reload(sesh list --icons --hide-duplicates)' \ |
|
| 35 | + | --bind 'ctrl-t:reload(sesh list -t --icons)' \ |
|
| 36 | + | --bind 'ctrl-g:reload(sesh list -c --icons)' \ |
|
| 37 | + | --bind 'ctrl-x:reload(sesh list -z --icons)' \ |
|
| 38 | + | --bind 'ctrl-f:reload(fd -H -d 2 -t d -E .Trash . ~)' \ |
|
| 39 | + | --bind 'ctrl-d:execute(tmux kill-session -t {2..})+reload(sesh list --icons --hide-duplicates)' \ |
|
| 40 | + | --preview 'sesh preview {}' --preview-window 'right:55%' \ |
|
| 41 | 41 | )\"" |
|
| 42 | 42 | ||
| 43 | 43 | bind-key b set-option status |