├── .config ├── bat │ └── config ├── btop │ ├── btop.conf │ └── themes │ │ └── onedark.theme ├── gh-dash │ └── config.yml ├── ghostty │ └── config ├── ideavim │ └── .ideavimrc ├── karabiner │ ├── assets │ │ └── complex_modifications │ │ │ ├── 1525181456.json │ │ │ ├── 1525197743.json │ │ │ └── 1651680526.json │ ├── automatic_backups │ │ └── karabiner_20200817.json │ └── karabiner.json ├── kitty │ ├── current-theme.conf │ ├── kitty.app.icns │ ├── kitty.conf │ ├── launch-actions.conf │ ├── macos-launch-services-cmdline │ ├── mime.types │ ├── neighboring_window.py │ ├── open-actions.conf │ ├── pass_keys.py │ ├── relative_resize.py │ ├── split_window.py │ └── themes │ │ ├── doom-one.conf │ │ ├── github_dark_default.conf │ │ └── github_dark_dimmed.conf ├── lazygit │ └── config.yml ├── nvim │ ├── after │ │ ├── ftplugin │ │ │ ├── dart.lua │ │ │ ├── help.lua │ │ │ ├── json.lua │ │ │ ├── lua.lua │ │ │ ├── markdown.lua │ │ │ ├── qf.lua │ │ │ ├── svelte.lua │ │ │ └── vim.lua │ │ └── syntax │ │ │ └── dap-repl.vim │ ├── filetype.lua │ ├── init.lua │ ├── lazy-lock.json │ ├── lua │ │ └── as │ │ │ ├── globals.lua │ │ │ ├── highlights.lua │ │ │ ├── plugins │ │ │ ├── completion.lua │ │ │ ├── debugger.lua │ │ │ ├── editing.lua │ │ │ ├── flutter-tools.lua │ │ │ ├── git.lua │ │ │ ├── init.lua │ │ │ ├── navigation.lua │ │ │ ├── noice.lua │ │ │ ├── picker.lua │ │ │ ├── projects.lua │ │ │ ├── snippets.lua │ │ │ ├── terminal.lua │ │ │ ├── testing.lua │ │ │ ├── themes.lua │ │ │ ├── tools.lua │ │ │ ├── treesitter.lua │ │ │ ├── ui.lua │ │ │ └── whichkey.lua │ │ │ ├── servers.lua │ │ │ ├── settings.lua │ │ │ ├── strings.lua │ │ │ ├── ui.lua │ │ │ └── vscode │ │ │ ├── init.lua │ │ │ └── plugins.lua │ ├── luasnippets │ │ ├── all.lua │ │ ├── dart.lua │ │ ├── gitcommit.lua │ │ ├── go.lua │ │ ├── help.lua │ │ ├── lua.lua │ │ └── vim.lua │ ├── plugin │ │ ├── autocommands.lua │ │ ├── colors.lua │ │ ├── env.lua │ │ ├── filetypes.lua │ │ ├── lastplace.lua │ │ ├── lsp.lua │ │ ├── mappings.lua │ │ ├── numbers.lua │ │ ├── rooter.lua │ │ ├── statuscolumn.lua │ │ ├── statusline.lua │ │ └── whitespace.lua │ ├── queries │ │ ├── dart │ │ │ └── highlights.scm │ │ ├── go │ │ │ └── injections.scm │ │ ├── html │ │ │ └── rainbow-tags.scm │ │ ├── lua │ │ │ ├── highlights.scm │ │ │ └── injections.scm │ │ ├── markdown │ │ │ └── highlights.scm │ │ ├── org │ │ │ └── highlights.scm │ │ ├── svelte │ │ │ └── rainbow-tags.scm │ │ └── vim │ │ │ └── highlights.scm │ ├── snippets │ │ └── textmate │ │ │ ├── dart.json │ │ │ ├── help.json │ │ │ ├── json.json │ │ │ └── package.json │ └── spell │ │ └── en.utf-8.add ├── rg │ └── .ripgreprc ├── stylua │ └── stylua.toml ├── tmux │ └── tmux.conf └── zsh │ ├── .zprofile │ ├── .zshenv │ ├── .zshrc │ ├── funcs │ ├── last_working_dir │ └── zsh_add_plugin │ └── scripts │ ├── alias.zsh │ ├── functions.zsh │ └── fzf.sh ├── .gitattributes ├── .gitignore ├── .gitmodules ├── .luarc.json ├── .psqlrc ├── .rgignore ├── .styluaignore ├── README.md ├── git ├── .gitconfig ├── .gitignore ├── .gitmessage └── config.template ├── install ├── install.conf.yaml ├── install.sh ├── macos ├── Brewfile ├── install.sh ├── kitty-icon-automation.norg ├── kitty-icon.zsh └── limit.maxfiles.plist ├── neorg └── macos.norg ├── ssh └── config ├── stylua.toml └── vim └── .vimrc /.config/bat/config: -------------------------------------------------------------------------------- 1 | # This is `bat`s configuration file. Each line either contains a comment or 2 | # a command-line option that you want to pass to `bat` by default. You can 3 | # run `bat --help` to get a list of all possible configuration options. 4 | 5 | # Run `bat --list-themes` for examples 6 | --theme="TwoDark" 7 | 8 | --italic-text=always 9 | 10 | # Uncomment the following line if you are using less version >= 551 and want to 11 | # enable mouse scrolling support in `bat` when running inside tmux. This might 12 | # disable text selection, unless you press shift. 13 | #--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse" 14 | # vim:ft=sh 15 | -------------------------------------------------------------------------------- /.config/btop/themes/onedark.theme: -------------------------------------------------------------------------------- 1 | # Theme: OneDark 2 | # By: Vitor Melo 3 | 4 | # Main bg 5 | theme[main_bg]="#282c34" 6 | 7 | # Main text color 8 | theme[main_fg]="#abb2bf" 9 | 10 | # Title color for boxes 11 | theme[title]="#abb2bf" 12 | 13 | # Higlight color for keyboard shortcuts 14 | theme[hi_fg]="#61afef" 15 | 16 | # Background color of selected item in processes box 17 | theme[selected_bg]="#2c313c" 18 | 19 | # Foreground color of selected item in processes box 20 | theme[selected_fg]="#abb2bf" 21 | 22 | # Color of inactive/disabled text 23 | theme[inactive_fg]="#5c6370" 24 | 25 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 26 | theme[proc_misc]="#61afef" 27 | 28 | # Cpu box outline color 29 | theme[cpu_box]="#5c6370" 30 | 31 | # Memory/disks box outline color 32 | theme[mem_box]="#5c6370" 33 | 34 | # Net up/down box outline color 35 | theme[net_box]="#5c6370" 36 | 37 | # Processes box outline color 38 | theme[proc_box]="#5c6370" 39 | 40 | # Box divider line and small boxes line color 41 | theme[div_line]="#5c6370" 42 | 43 | # Temperature graph colors 44 | theme[temp_start]="#98c379" 45 | theme[temp_mid]="#e5c07b" 46 | theme[temp_end]="#e06c75" 47 | 48 | # CPU graph colors 49 | theme[cpu_start]="#98c379" 50 | theme[cpu_mid]="#e5c07b" 51 | theme[cpu_end]="#e06c75" 52 | 53 | # Mem/Disk free meter 54 | theme[free_start]="#98c379" 55 | theme[free_mid]="#e5c07b" 56 | theme[free_end]="#e06c75" 57 | 58 | # Mem/Disk cached meter 59 | theme[cached_start]="#98c379" 60 | theme[cached_mid]="#e5c07b" 61 | theme[cached_end]="#e06c75" 62 | 63 | # Mem/Disk available meter 64 | theme[available_start]="#98c379" 65 | theme[available_mid]="#e5c07b" 66 | theme[available_end]="#e06c75" 67 | 68 | # Mem/Disk used meter 69 | theme[used_start]="#98c379" 70 | theme[used_mid]="#e5c07b" 71 | theme[used_end]="#e06c75" 72 | 73 | # Download graph colors 74 | theme[download_start]="#98c379" 75 | theme[download_mid]="#e5c07b" 76 | theme[download_end]="#e06c75" 77 | 78 | # Upload graph colors 79 | theme[upload_start]="#98c379" 80 | theme[upload_mid]="#e5c07b" 81 | theme[upload_end]="#e06c75" 82 | -------------------------------------------------------------------------------- /.config/gh-dash/config.yml: -------------------------------------------------------------------------------- 1 | prSections: 2 | - title: My Pull Requests 3 | filters: is:open author:@me 4 | - title: Needs My Review 5 | filters: is:pr is:open archived:false sort:updated-desc user:akinsho 6 | - title: Neovim Issues 7 | filters: is:open repo:neovim/neovim 8 | issuesSections: 9 | - title: My Open Source Projects 10 | filters: is:issue is:open archived:false sort:updated-desc user:akinsho 11 | - title: My Issues 12 | filters: is:open author:@me 13 | - title: Neovim Issues 14 | filters: is:open repo:neovim/neovim 15 | defaults: 16 | preview: 17 | open: true 18 | width: 50 19 | prsLimit: 20 20 | issuesLimit: 20 21 | view: issues 22 | repoPaths: 23 | neovim/neovim: $PROJECTS_DIR/contributing/neovim 24 | akinsho/bufferline.nvim: $PROJECTS_DIR/personal/bufferline.nvim 25 | akinsho/toggleterm.nvim: $PROJECTS_DIR/personal/bufferline.nvim 26 | keybindings: 27 | prs: 28 | - key: c 29 | command: kitty @ launch --cwd={{.RepoPath}} zsh -c 'gh pr checkout {{.PrNumber}}; nvim' 30 | -------------------------------------------------------------------------------- /.config/ghostty/config: -------------------------------------------------------------------------------- 1 | #---------------------------------- 2 | # DISPLAY 3 | #---------------------------------- 4 | adjust-underline-position = 6 5 | adjust-underline-thickness = 2 6 | bold-is-bright = true 7 | confirm-close-surface = false 8 | config-file = "?local" 9 | #---------------------------------- 10 | # Theme 11 | #---------------------------------- 12 | theme = "github-dark-high-contrast" 13 | 14 | #---------------------------------- 15 | # FONTS 16 | #---------------------------------- 17 | font-family = "Cartograph CF" 18 | font-size = 14 19 | font-thicken = true 20 | 21 | #---------------------------------- 22 | # MOUSE 23 | #---------------------------------- 24 | mouse-hide-while-typing = true 25 | 26 | #---------------------------------- 27 | # WINDOW 28 | #---------------------------------- 29 | macos-titlebar-style = tabs 30 | window-save-state = always 31 | #---------------------------------- 32 | # KEYBINDINGS 33 | #---------------------------------- 34 | macos-option-as-alt = left 35 | # RESET ALL 36 | keybind = clear 37 | #---------------------------------- 38 | # CORE 39 | #---------------------------------- 40 | keybind = super+shift+r=reload_config 41 | keybind = super+c=copy_to_clipboard 42 | keybind = super+v=paste_from_clipboard 43 | keybind = super+plus=increase_font_size:1 44 | keybind = super+equal=increase_font_size:1 45 | keybind = super+minus=decrease_font_size:1 46 | #---------------------------------- 47 | # SPLITS 48 | #---------------------------------- 49 | keybind = super+ctrl+h=goto_split:left 50 | keybind = super+ctrl+j=goto_split:bottom 51 | keybind = super+ctrl+k=goto_split:top 52 | keybind = super+ctrl+l=goto_split:right 53 | keybind = super+shift+/=new_split:auto 54 | #---------------------------------- 55 | # TABS 56 | #---------------------------------- 57 | keybind = super+shift+t=new_tab 58 | keybind = super+shift+h=previous_tab 59 | keybind = super+shift+l=next_tab 60 | keybind = super+shift+comma=move_tab:-1 61 | keybind = super+shift+period=move_tab:1 62 | #---------------------------------- 63 | keybind = ctrl+shift+space=toggle_split_zoom 64 | keybind = super+w=close_surface 65 | 66 | keybind = global:super+shift+]=toggle_quick_terminal 67 | -------------------------------------------------------------------------------- /.config/karabiner/assets/complex_modifications/1525181456.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Caps and return to ctrl. Ctrl to caps.", 3 | "rules": [ 4 | { 5 | "description": "Post left_ctrl when return_or_enter is hold.", 6 | "manipulators": [ 7 | { 8 | "from": { 9 | "key_code": "return_or_enter", 10 | "modifiers": { 11 | "optional": [ 12 | "any" 13 | ] 14 | } 15 | }, 16 | "to": [ 17 | { 18 | "key_code": "right_control" 19 | } 20 | ], 21 | "to_if_alone": [ 22 | { 23 | "key_code": "return_or_enter" 24 | } 25 | ], 26 | "type": "basic" 27 | } 28 | ] 29 | }, 30 | { 31 | "description": "Post escape if caps is pressed alone, left_ctrl otherwise", 32 | "manipulators": [ 33 | { 34 | "from": { 35 | "key_code": "caps_lock", 36 | "modifiers": { 37 | "optional": [ 38 | "any" 39 | ] 40 | } 41 | }, 42 | "to": [ 43 | { 44 | "key_code": "left_control" 45 | } 46 | ], 47 | "to_if_alone": [ 48 | { 49 | "key_code": "escape" 50 | } 51 | ], 52 | "type": "basic" 53 | } 54 | ] 55 | }, 56 | { 57 | "description": "Map left_ctrl to caps_lock.", 58 | "manipulators": [ 59 | { 60 | "from": { 61 | "key_code": "left_control", 62 | "modifiers": { 63 | "optional": [ 64 | "any" 65 | ] 66 | } 67 | }, 68 | "to": [ 69 | { 70 | "key_code": "caps_lock" 71 | } 72 | ], 73 | "type": "basic" 74 | } 75 | ] 76 | } 77 | ] 78 | } 79 | -------------------------------------------------------------------------------- /.config/karabiner/assets/complex_modifications/1525197743.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Use right_command+h/j/k/l/;/' to switch current tab/window/application", 3 | "rules": [ 4 | { 5 | "description": "Use right_command+;/' to cycle through running applications (like command+tab).", 6 | "manipulators": [ 7 | { 8 | "type": "basic", 9 | "from": { 10 | "key_code": "quote", 11 | "modifiers": { 12 | "mandatory": [ 13 | "right_command" 14 | ] 15 | } 16 | }, 17 | "to": [ 18 | { 19 | "key_code": "tab", 20 | "modifiers": [ 21 | "left_command" 22 | ] 23 | } 24 | ] 25 | }, 26 | { 27 | "type": "basic", 28 | "from": { 29 | "key_code": "semicolon", 30 | "modifiers": { 31 | "mandatory": [ 32 | "right_command" 33 | ] 34 | } 35 | }, 36 | "to": [ 37 | { 38 | "key_code": "tab", 39 | "modifiers": [ 40 | "left_command", 41 | "left_shift" 42 | ] 43 | } 44 | ] 45 | } 46 | ] 47 | }, 48 | { 49 | "description": "Use right_command+h/l to switch tabs in an application.", 50 | "manipulators": [ 51 | { 52 | "type": "basic", 53 | "from": { 54 | "key_code": "l", 55 | "modifiers": { 56 | "mandatory": [ 57 | "right_command" 58 | ] 59 | } 60 | }, 61 | "to": [ 62 | { 63 | "key_code": "tab", 64 | "modifiers": [ 65 | "left_control" 66 | ] 67 | } 68 | ] 69 | }, 70 | { 71 | "type": "basic", 72 | "from": { 73 | "key_code": "h", 74 | "modifiers": { 75 | "mandatory": [ 76 | "right_command" 77 | ] 78 | } 79 | }, 80 | "to": [ 81 | { 82 | "key_code": "tab", 83 | "modifiers": [ 84 | "left_control", 85 | "left_shift" 86 | ] 87 | } 88 | ] 89 | } 90 | ] 91 | }, 92 | { 93 | "description": "Use right_command+j/k to switch windows of the foreground application .", 94 | "manipulators": [ 95 | { 96 | "type": "basic", 97 | "from": { 98 | "key_code": "k", 99 | "modifiers": { 100 | "mandatory": [ 101 | "right_command" 102 | ] 103 | } 104 | }, 105 | "to": [ 106 | { 107 | "key_code": "grave_accent_and_tilde", 108 | "modifiers": [ 109 | "left_command" 110 | ] 111 | } 112 | ] 113 | }, 114 | { 115 | "type": "basic", 116 | "from": { 117 | "key_code": "j", 118 | "modifiers": { 119 | "mandatory": [ 120 | "right_command" 121 | ] 122 | } 123 | }, 124 | "to": [ 125 | { 126 | "key_code": "grave_accent_and_tilde", 127 | "modifiers": [ 128 | "left_command", 129 | "left_shift" 130 | ] 131 | } 132 | ] 133 | } 134 | ] 135 | }, 136 | { 137 | "description": "Disable left_command+(tab/shift+tab) (to retrain reflexes using the other manipulators).", 138 | "manipulators": [ 139 | { 140 | "type": "basic", 141 | "from": { 142 | "key_code": "tab", 143 | "modifiers": { 144 | "mandatory": [ 145 | "left_command" 146 | ] 147 | } 148 | }, 149 | "to": [ 150 | { 151 | "key_code": "out" 152 | } 153 | ] 154 | }, 155 | { 156 | "type": "basic", 157 | "from": { 158 | "key_code": "tab", 159 | "modifiers": { 160 | "mandatory": [ 161 | "left_command", 162 | "left_shift" 163 | ] 164 | } 165 | }, 166 | "to": [ 167 | { 168 | "key_code": "out" 169 | } 170 | ] 171 | } 172 | ] 173 | } 174 | ] 175 | } 176 | -------------------------------------------------------------------------------- /.config/karabiner/karabiner.json: -------------------------------------------------------------------------------- 1 | { 2 | "global": { "show_in_menu_bar": false }, 3 | "profiles": [ 4 | { 5 | "complex_modifications": { 6 | "rules": [ 7 | { 8 | "description": "Change shift + delete to forward delete", 9 | "manipulators": [ 10 | { 11 | "from": { 12 | "key_code": "delete_or_backspace", 13 | "modifiers": { 14 | "mandatory": ["shift"], 15 | "optional": ["caps_lock"] 16 | } 17 | }, 18 | "to": [{ "key_code": "delete_forward" }], 19 | "type": "basic" 20 | } 21 | ] 22 | }, 23 | { 24 | "description": "Change caps_lock to control if pressed with other keys, to escape if pressed alone.", 25 | "manipulators": [ 26 | { 27 | "from": { 28 | "key_code": "caps_lock", 29 | "modifiers": { "optional": ["any"] } 30 | }, 31 | "to": [{ "key_code": "left_control" }], 32 | "to_if_alone": [{ "key_code": "escape" }], 33 | "type": "basic" 34 | } 35 | ] 36 | }, 37 | { 38 | "description": "Change Fn + h/j/k/l to Arrows", 39 | "manipulators": [ 40 | { 41 | "from": { 42 | "key_code": "h", 43 | "modifiers": { 44 | "mandatory": ["fn"], 45 | "optional": ["caps_lock"] 46 | } 47 | }, 48 | "to": [{ "key_code": "left_arrow" }], 49 | "type": "basic" 50 | }, 51 | { 52 | "from": { 53 | "key_code": "j", 54 | "modifiers": { 55 | "mandatory": ["fn"], 56 | "optional": ["caps_lock"] 57 | } 58 | }, 59 | "to": [{ "key_code": "down_arrow" }], 60 | "type": "basic" 61 | }, 62 | { 63 | "from": { 64 | "key_code": "k", 65 | "modifiers": { 66 | "mandatory": ["fn"], 67 | "optional": ["caps_lock"] 68 | } 69 | }, 70 | "to": [{ "key_code": "up_arrow" }], 71 | "type": "basic" 72 | }, 73 | { 74 | "from": { 75 | "key_code": "l", 76 | "modifiers": { 77 | "mandatory": ["fn"], 78 | "optional": ["caps_lock"] 79 | } 80 | }, 81 | "to": [{ "key_code": "right_arrow" }], 82 | "type": "basic" 83 | } 84 | ] 85 | } 86 | ] 87 | }, 88 | "fn_function_keys": [ 89 | { 90 | "from": { "key_code": "f1" }, 91 | "to": [{ "key_code": "display_brightness_decrement" }] 92 | }, 93 | { 94 | "from": { "key_code": "f2" }, 95 | "to": [{ "key_code": "display_brightness_increment" }] 96 | }, 97 | { 98 | "from": { "key_code": "f3" }, 99 | "to": [{ "key_code": "mission_control" }] 100 | }, 101 | { 102 | "from": { "key_code": "f4" }, 103 | "to": [{ "key_code": "launchpad" }] 104 | }, 105 | { 106 | "from": { "key_code": "f5" }, 107 | "to": [{ "key_code": "illumination_decrement" }] 108 | }, 109 | { 110 | "from": { "key_code": "f6" }, 111 | "to": [{ "key_code": "illumination_increment" }] 112 | }, 113 | { 114 | "from": { "key_code": "f7" }, 115 | "to": [{ "key_code": "rewind" }] 116 | }, 117 | { 118 | "from": { "key_code": "f8" }, 119 | "to": [{ "key_code": "play_or_pause" }] 120 | }, 121 | { 122 | "from": { "key_code": "f9" }, 123 | "to": [{ "key_code": "fastforward" }] 124 | }, 125 | { 126 | "from": { "key_code": "f10" }, 127 | "to": [{ "key_code": "mute" }] 128 | }, 129 | { 130 | "from": { "key_code": "f11" }, 131 | "to": [{ "key_code": "volume_decrement" }] 132 | }, 133 | { 134 | "from": { "key_code": "f12" }, 135 | "to": [{ "key_code": "volume_increment" }] 136 | } 137 | ], 138 | "name": "Akin", 139 | "selected": true, 140 | "virtual_hid_keyboard": { 141 | "caps_lock_delay_milliseconds": 0, 142 | "country_code": 0, 143 | "keyboard_type": "ansi", 144 | "keyboard_type_v2": "ansi" 145 | } 146 | } 147 | ] 148 | } -------------------------------------------------------------------------------- /.config/kitty/current-theme.conf: -------------------------------------------------------------------------------- 1 | # (Github Dark Default) Colors for kitty 2 | 3 | background #0d1117 4 | foreground #e6edf3 5 | url_color #e6edf3 6 | 7 | cursor #e6edf3 8 | cursor_text_color background 9 | 10 | # Tabs 11 | active_tab_background #3fb950 12 | active_tab_foreground #0d1117 13 | inactive_tab_background #111d2e 14 | inactive_tab_foreground #6e7681 15 | 16 | # Windows Border 17 | active_border_color #2f81f7 18 | inactive_border_color #24282e 19 | 20 | # normal 21 | color0 #484f58 22 | color1 #ff7b72 23 | color2 #3fb950 24 | color3 #d29922 25 | color4 #58a6ff 26 | color5 #bc8cff 27 | color6 #39c5cf 28 | color7 #b1bac4 29 | 30 | # bright 31 | color8 #6e7681 32 | color9 #ffa198 33 | color10 #56d364 34 | color11 #e3b341 35 | color12 #79c0ff 36 | color13 #d2a8ff 37 | color14 #56d4dd 38 | color15 #ffffff -------------------------------------------------------------------------------- /.config/kitty/kitty.app.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akinsho/dotfiles/6cd1f8aabb1ab19d53daa1da603959fa23a8968e/.config/kitty/kitty.app.icns -------------------------------------------------------------------------------- /.config/kitty/launch-actions.conf: -------------------------------------------------------------------------------- 1 | # Open text files without fragments in the editor 2 | protocol file 3 | mime text/* 4 | action launch --type=tab zsh -c '${EDITOR} ${FILE_PATH}' 5 | 6 | # Open directories 7 | protocol file 8 | mime inode/directory 9 | action launch --type=tab --cwd $FILE_PATH 10 | -------------------------------------------------------------------------------- /.config/kitty/macos-launch-services-cmdline: -------------------------------------------------------------------------------- 1 | --single-instance 2 | --listen-on unix:/tmp/kitty-{kitty_pid} 3 | --start-as=fullscreen 4 | -------------------------------------------------------------------------------- /.config/kitty/mime.types: -------------------------------------------------------------------------------- 1 | text/plain lua js ts 2 | -------------------------------------------------------------------------------- /.config/kitty/neighboring_window.py: -------------------------------------------------------------------------------- 1 | from kitty.key_encoding import KeyEvent, parse_shortcut 2 | from kittens.tui.handler import result_handler 3 | 4 | 5 | def main(): 6 | pass 7 | 8 | 9 | def encode_key_mapping(window, key_mapping): 10 | mods, key = parse_shortcut(key_mapping) 11 | event = KeyEvent( 12 | mods=mods, 13 | key=key, 14 | shift=bool(mods & 1), 15 | alt=bool(mods & 2), 16 | ctrl=bool(mods & 4), 17 | super=bool(mods & 8), 18 | hyper=bool(mods & 16), 19 | meta=bool(mods & 32), 20 | ).as_window_system_event() 21 | 22 | return window.encoded_key(event) 23 | 24 | 25 | @result_handler(no_ui=True) 26 | def handle_result(args, result, target_window_id, boss): 27 | window = boss.window_id_map.get(target_window_id) 28 | 29 | cmd = window.child.foreground_cmdline[0] 30 | if cmd == 'tmux': 31 | keymap = args[2] 32 | encoded = encode_key_mapping(window, keymap) 33 | window.write_to_child(encoded) 34 | else: 35 | boss.active_tab.neighboring_window(args[1]) 36 | -------------------------------------------------------------------------------- /.config/kitty/open-actions.conf: -------------------------------------------------------------------------------- 1 | protocol file 2 | mime text/* 3 | action launch --type=overlay zsh -c 'nvim ${FILE_PATH}' 4 | 5 | protocol file 6 | mime image/* 7 | action launch --type=overlay zsh -c 'kitty +kitten icat --hold ${FILE_PATH}' 8 | 9 | # Open directories 10 | protocol file 11 | mime inode/directory 12 | action launch --type=os-window --cwd $FILE_PATH 13 | 14 | # Tail a log file (*.log) in a new OS Window and reduce its font size 15 | protocol file 16 | ext log 17 | action launch --title ${FILE} --type=os-window tail -f ${FILE_PATH} 18 | action change_font_size current -2 19 | -------------------------------------------------------------------------------- /.config/kitty/pass_keys.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from kittens.tui.handler import result_handler 4 | from kitty.key_encoding import KeyEvent, parse_shortcut 5 | 6 | 7 | def is_window_vim(window, vim_id): 8 | from kittens.tui.loop import debug 9 | debug(vim_id) 10 | fp = window.child.foreground_processes 11 | return any(re.search(vim_id, p['cmdline'][0] if len(p['cmdline']) else '', re.I) for p in fp) 12 | 13 | 14 | def encode_key_mapping(window, key_mapping): 15 | mods, key = parse_shortcut(key_mapping) 16 | event = KeyEvent( 17 | mods=mods, 18 | key=key, 19 | shift=bool(mods & 1), 20 | alt=bool(mods & 2), 21 | ctrl=bool(mods & 4), 22 | super=bool(mods & 8), 23 | hyper=bool(mods & 16), 24 | meta=bool(mods & 32), 25 | ).as_window_system_event() 26 | 27 | return window.encoded_key(event) 28 | 29 | def relative_resize_window(direction, amount, target_window_id, boss): 30 | window = boss.window_id_map.get(target_window_id) 31 | if window is None: 32 | return 33 | 34 | neighbors = boss.active_tab.current_layout.neighbors_for_window(window, boss.active_tab.windows) 35 | current_window_id = boss.active_tab.active_window 36 | 37 | left_neighbors = neighbors.get('left') 38 | right_neighbors = neighbors.get('right') 39 | top_neighbors = neighbors.get('top') 40 | bottom_neighbors = neighbors.get('bottom') 41 | 42 | # has a neighbor on both sides 43 | if direction == 'left' and (left_neighbors and right_neighbors): 44 | boss.active_tab.resize_window('narrower', amount) 45 | # only has left neighbor 46 | elif direction == 'left' and left_neighbors: 47 | boss.active_tab.resize_window('wider', amount) 48 | # only has right neighbor 49 | elif direction == 'left' and right_neighbors: 50 | boss.active_tab.resize_window('narrower', amount) 51 | 52 | # has a neighbor on both sides 53 | elif direction == 'right' and (left_neighbors and right_neighbors): 54 | boss.active_tab.resize_window('wider', amount) 55 | # only has left neighbor 56 | elif direction == 'right' and left_neighbors: 57 | boss.active_tab.resize_window('narrower', amount) 58 | # only has right neighbor 59 | elif direction == 'right' and right_neighbors: 60 | boss.active_tab.resize_window('wider', amount) 61 | 62 | # has a neighbor above and below 63 | elif direction == 'up' and (top_neighbors and bottom_neighbors): 64 | boss.active_tab.resize_window('shorter', amount) 65 | # only has top neighbor 66 | elif direction == 'up' and top_neighbors: 67 | boss.active_tab.resize_window('taller', amount) 68 | # only has bottom neighbor 69 | elif direction == 'up' and bottom_neighbors: 70 | boss.active_tab.resize_window('shorter', amount) 71 | 72 | # has a neighbor above and below 73 | elif direction == 'down' and (top_neighbors and bottom_neighbors): 74 | boss.active_tab.resize_window('taller', amount) 75 | # only has top neighbor 76 | elif direction == 'down' and top_neighbors: 77 | boss.active_tab.resize_window('shorter', amount) 78 | # only has bottom neighbor 79 | elif direction == 'down' and bottom_neighbors: 80 | boss.active_tab.resize_window('taller', amount) 81 | 82 | 83 | def main(): 84 | pass 85 | 86 | 87 | @result_handler(no_ui=True) 88 | def handle_result(args, result, target_window_id, boss): 89 | window = boss.window_id_map.get(target_window_id) 90 | action = args[1] 91 | direction = args[2] 92 | key_mapping = args[3] if action == 'neighboring_window' else args[4] 93 | amount = int(args[3]) if action == 'relative_resize' else None 94 | vim_id_idx = 4 if action == 'neighboring_window' else 5 95 | vim_id = args[vim_id_idx] if len(args) > vim_id_idx else "n?vim" 96 | 97 | if window is None: 98 | return 99 | if is_window_vim(window, vim_id): 100 | for keymap in key_mapping.split(">"): 101 | encoded = encode_key_mapping(window, keymap) 102 | window.write_to_child(encoded) 103 | elif action == 'neighboring_window': 104 | boss.active_tab.neighboring_window(direction) 105 | elif action == 'relative_resize': 106 | relative_resize_window(direction, amount, target_window_id, boss) 107 | -------------------------------------------------------------------------------- /.config/kitty/relative_resize.py: -------------------------------------------------------------------------------- 1 | # Based on MIT licensed code at https://github.com/chancez/dotfiles/blob/badc69d3895a6a942285amount26b8c372a55d77533eamount/kitty/.config/kitty/relative_resize.py 2 | from kittens.tui.handler import result_handler 3 | from kitty.key_encoding import KeyEvent, parse_shortcut 4 | 5 | 6 | def encode_key_mapping(window, key_mapping): 7 | mods, key = parse_shortcut(key_mapping) 8 | event = KeyEvent( 9 | mods=mods, 10 | key=key, 11 | shift=bool(mods & 1), 12 | alt=bool(mods & 2), 13 | ctrl=bool(mods & 4), 14 | super=bool(mods & 8), 15 | hyper=bool(mods & 16), 16 | meta=bool(mods & 32), 17 | ).as_window_system_event() 18 | 19 | return window.encoded_key(event) 20 | 21 | 22 | def main(args): 23 | pass 24 | 25 | 26 | def relative_resize_window(direction, amount, target_window_id, boss): 27 | window = boss.window_id_map.get(target_window_id) 28 | if window is None: 29 | return 30 | 31 | neighbors = boss.active_tab.current_layout.neighbors_for_window( 32 | window, boss.active_tab.windows 33 | ) 34 | current_window_id = boss.active_tab.active_window 35 | 36 | left_neighbors = neighbors.get('left') 37 | right_neighbors = neighbors.get('right') 38 | top_neighbors = neighbors.get('top') 39 | bottom_neighbors = neighbors.get('bottom') 40 | 41 | # has a neighbor on both sides 42 | if direction == 'left' and (left_neighbors and right_neighbors): 43 | boss.active_tab.resize_window('narrower', amount) 44 | # only has left neighbor 45 | elif direction == 'left' and left_neighbors: 46 | boss.active_tab.resize_window('wider', amount) 47 | # only has right neighbor 48 | elif direction == 'left' and right_neighbors: 49 | boss.active_tab.resize_window('narrower', amount) 50 | 51 | # has a neighbor on both sides 52 | elif direction == 'right' and (left_neighbors and right_neighbors): 53 | boss.active_tab.resize_window('wider', amount) 54 | # only has left neighbor 55 | elif direction == 'right' and left_neighbors: 56 | boss.active_tab.resize_window('narrower', amount) 57 | # only has right neighbor 58 | elif direction == 'right' and right_neighbors: 59 | boss.active_tab.resize_window('wider', amount) 60 | 61 | # has a neighbor above and below 62 | elif direction == 'up' and (top_neighbors and bottom_neighbors): 63 | boss.active_tab.resize_window('shorter', amount) 64 | # only has top neighbor 65 | elif direction == 'up' and top_neighbors: 66 | boss.active_tab.resize_window('taller', amount) 67 | # only has bottom neighbor 68 | elif direction == 'up' and bottom_neighbors: 69 | boss.active_tab.resize_window('shorter', amount) 70 | 71 | # has a neighbor above and below 72 | elif direction == 'down' and (top_neighbors and bottom_neighbors): 73 | boss.active_tab.resize_window('taller', amount) 74 | # only has top neighbor 75 | elif direction == 'down' and top_neighbors: 76 | boss.active_tab.resize_window('shorter', amount) 77 | # only has bottom neighbor 78 | elif direction == 'down' and bottom_neighbors: 79 | boss.active_tab.resize_window('taller', amount) 80 | 81 | 82 | @result_handler(no_ui=True) 83 | def handle_result(args, result, target_window_id, boss): 84 | direction = args[1] 85 | amount = int(args[2]) 86 | window = boss.window_id_map.get(target_window_id) 87 | 88 | cmd = window.child.foreground_cmdline[0] 89 | if cmd == 'tmux': 90 | keymap = args[3] 91 | encoded = encode_key_mapping(window, keymap) 92 | window.write_to_child(encoded) 93 | else: 94 | relative_resize_window(direction, amount, target_window_id, boss) 95 | -------------------------------------------------------------------------------- /.config/kitty/split_window.py: -------------------------------------------------------------------------------- 1 | from kittens.tui.handler import result_handler 2 | from kitty.key_encoding import KeyEvent, parse_shortcut 3 | 4 | 5 | def main(args): 6 | pass 7 | 8 | 9 | def encode_key_mapping(window, key_mapping): 10 | mods, key = parse_shortcut(key_mapping) 11 | event = KeyEvent( 12 | mods=mods, 13 | key=key, 14 | shift=bool(mods & 1), 15 | alt=bool(mods & 2), 16 | ctrl=bool(mods & 4), 17 | super=bool(mods & 8), 18 | hyper=bool(mods & 16), 19 | meta=bool(mods & 32), 20 | ).as_window_system_event() 21 | 22 | return window.encoded_key(event) 23 | 24 | 25 | def split_window(boss, direction): 26 | if direction == 'up' or direction == 'down': 27 | boss.launch('--cwd=current', '--location=hsplit') 28 | else: 29 | boss.launch('--cwd=current', '--location=vsplit') 30 | 31 | if direction == 'up' or direction == 'left': 32 | boss.active_tab.move_window(direction) 33 | 34 | 35 | @result_handler(no_ui=True) 36 | def handle_result(args, result, target_window_id, boss): 37 | window = boss.window_id_map.get(target_window_id) 38 | 39 | if window is None: 40 | return 41 | 42 | direction = args[1] 43 | cmd = window.child.foreground_cmdline[0] 44 | if cmd == 'tmux': 45 | keymap = args[2] 46 | encoded = encode_key_mapping(window, keymap) 47 | window.write_to_child(encoded) 48 | else: 49 | split_window(boss, direction) -------------------------------------------------------------------------------- /.config/kitty/themes/doom-one.conf: -------------------------------------------------------------------------------- 1 | # vim:ft=kitty 2 | 3 | ## name: Doom Vibrant 4 | ## author: Henrik Lissner 5 | ## license: MIT 6 | ## blurb: A version of Doom One Emacs theme that uses more vibrant colors. 7 | 8 | # The basic colors 9 | foreground #bbc2cf 10 | # Doom one background #242730 11 | # horizon background #1D1F27 12 | # Github Dark Default #020304 13 | background #242730 14 | selection_foreground #bbc2cf 15 | selection_background #6A8FBF 16 | 17 | # Cursor colors 18 | cursor #bbc2cf 19 | cursor_text_color #242730 20 | 21 | # kitty window border colors 22 | active_border_color #46D9FF 23 | inactive_border_color #484854 24 | 25 | # Tab bar colors 26 | # alternate background - 27 | # Doom One #16181C 28 | # Doom One with dark tab bar #0f1115 29 | # Darkened Horizon bg #15171d 30 | # Horizon Dark bg #1D1F27 31 | active_tab_foreground #BBC2CF 32 | active_tab_background #1D1F27 33 | inactive_tab_foreground #5B6268 34 | inactive_tab_background #1D1F27 35 | tab_bar_background #1D1F27 36 | 37 | # The basic 16 colors 38 | # black 39 | color0 #2a2e38 40 | color8 #484854 41 | 42 | # red 43 | color1 #ff665c 44 | color9 #ff665c 45 | 46 | # green 47 | color2 #7bc275 48 | color10 #99bb66 49 | 50 | # yellow 51 | color3 #fcce7b 52 | color11 #ecbe7b 53 | 54 | # blue 55 | color4 #51afef 56 | color12 #51afef 57 | 58 | # magenta 59 | color5 #C57BDB 60 | color13 #c678dd 61 | 62 | # cyan 63 | color6 #5cEfFF 64 | color14 #46D9FF 65 | 66 | # white 67 | color7 #DFDFDF 68 | color15 #bbc2cf 69 | -------------------------------------------------------------------------------- /.config/kitty/themes/github_dark_default.conf: -------------------------------------------------------------------------------- 1 | # (Github Dark Default) Colors for kitty 2 | 3 | background #0d1117 4 | foreground #e6edf3 5 | url_color #e6edf3 6 | 7 | cursor #e6edf3 8 | cursor_text_color background 9 | 10 | # Tabs 11 | active_tab_background #3fb950 12 | active_tab_foreground #0d1117 13 | inactive_tab_background #111d2e 14 | inactive_tab_foreground #6e7681 15 | 16 | # Windows Border 17 | active_border_color #2f81f7 18 | inactive_border_color #24282e 19 | 20 | # normal 21 | color0 #484f58 22 | color1 #ff7b72 23 | color2 #3fb950 24 | color3 #d29922 25 | color4 #58a6ff 26 | color5 #bc8cff 27 | color6 #39c5cf 28 | color7 #b1bac4 29 | 30 | # bright 31 | color8 #6e7681 32 | color9 #ffa198 33 | color10 #56d364 34 | color11 #e3b341 35 | color12 #79c0ff 36 | color13 #d2a8ff 37 | color14 #56d4dd 38 | color15 #ffffff -------------------------------------------------------------------------------- /.config/kitty/themes/github_dark_dimmed.conf: -------------------------------------------------------------------------------- 1 | # (Github Dark Dimmed) Colors for kitty 2 | 3 | background #22272e 4 | foreground #adbac7 5 | url_color #adbac7 6 | 7 | cursor #adbac7 8 | cursor_text_color background 9 | 10 | # Tabs 11 | active_tab_background #57ab5a 12 | active_tab_foreground #22272e 13 | inactive_tab_background #253040 14 | inactive_tab_foreground #636e7b 15 | 16 | # Windows Border 17 | active_border_color #539bf5 18 | inactive_border_color #333940 19 | 20 | # normal 21 | color0 #545d68 22 | color1 #f47067 23 | color2 #57ab5a 24 | color3 #c69026 25 | color4 #539bf5 26 | color5 #b083f0 27 | color6 #39c5cf 28 | color7 #909dab 29 | 30 | # bright 31 | color8 #636e7b 32 | color9 #ff938a 33 | color10 #6bc46d 34 | color11 #daaa3f 35 | color12 #6cb6ff 36 | color13 #dcbdfb 37 | color14 #56d4dd 38 | color15 #cdd9e5 -------------------------------------------------------------------------------- /.config/lazygit/config.yml: -------------------------------------------------------------------------------- 1 | os: 2 | editPreset: "nvim" 3 | gui: 4 | ## stuff relating to the UI 5 | scrollHeight: 2 6 | scrollPastBottom: true 7 | mouseEvents: true 8 | skipDiscardChangeWarning: false 9 | skipStashWarning: true 10 | nerdFontsVersion: "3" 11 | sidePanelWidth: 0.3333 12 | theme: 13 | activeBorderColor: 14 | - green 15 | - bold 16 | # inactiveBorderColor: 17 | # - white 18 | optionsTextColor: 19 | - blue 20 | # selectedLineBgColor: 21 | # - black 22 | # selectedRangeBgColor: 23 | # - blue 24 | commitLength: 25 | show: true 26 | services: 27 | "github-work": "github:github.com" 28 | git: 29 | paging: 30 | colorArg: always 31 | pager: delta --dark --paging=never --24-bit-color=never 32 | merging: 33 | manualCommit: false 34 | args: "" 35 | skipHookPrefix: "WIP" 36 | autoFetch: true 37 | update: 38 | method: prompt # can be: prompt | background | never 39 | days: 14 # how often a update is checked for 40 | confirmOnQuit: false 41 | keybinding: 42 | universal: 43 | quit: "q" 44 | quit-alt1: "" 45 | return: "" 46 | quitWithoutChangingDirectory: "Q" 47 | togglePanel: "" 48 | prevItem: "" 49 | nextItem: "" 50 | prevItem-alt: "k" 51 | nextItem-alt: "j" 52 | prevPage: "," 53 | nextPage: "." 54 | gotoTop: "<" 55 | gotoBottom: ">" 56 | prevBlock: "" 57 | nextBlock: "" 58 | prevBlock-alt: "h" 59 | nextBlock-alt: "l" 60 | nextMatch: "n" 61 | prevMatch: "N" 62 | startSearch: "/" 63 | optionMenu: "x" 64 | optionMenu-alt1: "?" 65 | select: "" 66 | goInto: "" 67 | remove: "d" 68 | new: "n" 69 | edit: "e" 70 | openFile: "o" 71 | scrollUpMain: "" 72 | scrollDownMain: "" 73 | scrollUpMain-alt1: "K" 74 | scrollDownMain-alt1: "J" 75 | scrollUpMain-alt2: "" 76 | scrollDownMain-alt2: "" 77 | executeShellCommand: ":" 78 | createRebaseOptionsMenu: "m" 79 | pushFiles: "P" 80 | pullFiles: "p" 81 | refresh: "R" 82 | createPatchOptionsMenu: "" 83 | nextTab: "]" 84 | prevTab: "[" 85 | nextScreenMode: "+" 86 | prevScreenMode: "_" 87 | undo: "z" 88 | redo: "" 89 | filteringMenu: 90 | diffingMenu: "" 91 | copyToClipboard: "" 92 | status: 93 | checkForUpdate: "u" 94 | recentRepos: "" 95 | files: 96 | commitChanges: "c" 97 | commitChangesWithoutHook: "w" 98 | amendLastCommit: "A" 99 | commitChangesWithEditor: "C" 100 | ignoreFile: "i" 101 | refreshFiles: "r" 102 | stashAllChanges: "s" 103 | viewStashOptions: "S" 104 | toggleStagedAll: "a" 105 | viewResetOptions: "D" 106 | fetch: "f" 107 | branches: 108 | createPullRequest: "o" 109 | checkoutBranchByName: "c" 110 | forceCheckoutBranch: "F" 111 | rebaseBranch: "r" 112 | renameBranch: "R" 113 | mergeIntoCurrentBranch: "M" 114 | viewGitFlowOptions: "i" 115 | fastForward: "f" 116 | pushTag: "P" 117 | setUpstream: "u" 118 | fetchRemote: "f" 119 | commits: 120 | squashDown: "s" 121 | renameCommit: "r" 122 | renameCommitWithEditor: "R" 123 | viewResetOptions: "g" 124 | markCommitAsFixup: "f" 125 | createFixupCommit: "F" 126 | squashAboveCommits: "S" 127 | moveDownCommit: "J" 128 | moveUpCommit: "K" 129 | amendToCommit: "A" 130 | pickCommit: "p" 131 | revertCommit: "t" 132 | cherryPickCopy: "c" 133 | cherryPickCopyRange: "C" 134 | pasteCommits: "v" 135 | tagCommit: "T" 136 | checkoutCommit: "" 137 | resetCherryPick: "" 138 | stash: 139 | popStash: "g" 140 | commitFiles: 141 | checkoutCommitFile: "c" 142 | main: 143 | toggleDragSelect: "v" 144 | toggleDragSelect-alt: "V" 145 | toggleSelectHunk: "a" 146 | pickBothHunks: "b" 147 | -------------------------------------------------------------------------------- /.config/nvim/after/ftplugin/dart.lua: -------------------------------------------------------------------------------- 1 | vim.bo.syntax = '' 2 | vim.bo.textwidth = 100 3 | vim.opt_local.spell = true 4 | 5 | map('n', 'dd', 'FlutterDevices', { desc = 'flutter: devices', buffer = 0 }) 6 | map('n', 'de', 'FlutterEmulators', { desc = 'flutter: emulators', buffer = 0 }) 7 | map('n', 'do', 'FlutterOutline', { desc = 'flutter: outline', buffer = 0 }) 8 | map('n', 'dq', 'FlutterQuit', { desc = 'flutter: quit', buffer = 0 }) 9 | map('n', 'drn', 'FlutterRun', { desc = 'flutter: server run', buffer = 0 }) 10 | map('n', 'drs', 'FlutterRestart', { desc = 'flutter: server restart', buffer = 0 }) 11 | map('n', 'rn', 'FlutterRename', { desc = 'flutter: rename class (& file)', buffer = 0 }) 12 | map('n', 'db', "TermExec cmd='flutter pub run build_runner watch'", { 13 | desc = 'flutter: run code generation', 14 | buffer = 0, 15 | }) 16 | -------------------------------------------------------------------------------- /.config/nvim/after/ftplugin/help.lua: -------------------------------------------------------------------------------- 1 | if vim.g.vscode then return end 2 | local opt, fn, api = vim.opt_local, vim.fn, vim.api 3 | 4 | opt.list = false 5 | opt.wrap = false 6 | opt.spell = true 7 | opt.textwidth = 78 8 | 9 | local opts = { buffer = 0 } 10 | 11 | -- if this a vim help file create mappings to make navigation easier otherwise enable preferred editing settings 12 | if vim.startswith(fn.expand('%'), vim.env.VIMRUNTIME) or vim.bo.readonly then 13 | opt.spell = false 14 | api.nvim_create_autocmd('BufWinEnter', { buffer = 0, command = 'wincmd L | vertical resize 80' }) 15 | -- https://vim.fandom.com/wiki/Learn_to_use_help 16 | map('n', '', '', opts) 17 | map('n', '', '', opts) 18 | else 19 | map('n', 'ml', 'maGovim:tw=78:ts=8:noet:ft=help:norl:`a', opts) 20 | end 21 | -------------------------------------------------------------------------------- /.config/nvim/after/ftplugin/json.lua: -------------------------------------------------------------------------------- 1 | local api = vim.api 2 | local map = map or vim.keymap.set 3 | 4 | map('n', 'o', function() 5 | local line = api.nvim_get_current_line() 6 | return line:find('[^,{[]$') and 'A,' or 'o' 7 | end, { buffer = 0, expr = true }) 8 | -------------------------------------------------------------------------------- /.config/nvim/after/ftplugin/lua.lua: -------------------------------------------------------------------------------- 1 | if vim.g.vscode or not as then return end 2 | local fn, opt = vim.fn, vim.opt_local 3 | local fmt = string.format 4 | 5 | opt.textwidth = 120 6 | opt.formatoptions:remove('o') 7 | 8 | local function find(word, ...) 9 | for _, str in ipairs({ ... }) do 10 | local match_start, match_end = string.find(word, str) 11 | if match_start then return str, match_start, match_end end 12 | end 13 | end 14 | 15 | local function open_help(tag) as.pcall(vim.cmd.help, tag) end 16 | 17 | --- Stolen from nlua.nvim this function attempts to open 18 | --- vim help docs if an api or vim.fn function otherwise it 19 | --- shows the lsp hover doc 20 | --- @param word string 21 | --- @param callback function 22 | local function keyword(word, callback) 23 | local original_iskeyword = vim.bo.iskeyword 24 | 25 | vim.bo.iskeyword = vim.bo.iskeyword .. ',.' 26 | word = word or fn.expand('') 27 | 28 | vim.bo.iskeyword = original_iskeyword 29 | 30 | local match, _, end_idx = find(word, 'api.', 'vim.api.') 31 | if match and end_idx then return open_help(word:sub(end_idx + 1)) end 32 | 33 | match, _, end_idx = find(word, 'fn.', 'vim.fn.') 34 | if match and end_idx then return open_help(word:sub(end_idx + 1) .. '()') end 35 | 36 | match, _, end_idx = find(word, '^vim.(%w+)') 37 | if match and end_idx then return open_help(word:sub(1, end_idx)) end 38 | 39 | if callback then return callback() end 40 | 41 | vim.lsp.buf.hover() 42 | end 43 | 44 | map('n', 'gK', keyword, { buffer = 0 }) 45 | map('n', 'so', function() 46 | vim.cmd.luafile('%') 47 | vim.notify('Sourced ' .. fn.expand('%')) 48 | end) 49 | 50 | as.ftplugin_conf({ 51 | ['nvim-surround'] = function(surround) 52 | local get_input = function(prompt) 53 | local ok, input = pcall(vim.fn.input, fmt('%s: ', prompt)) 54 | if not ok then return end 55 | return input 56 | end 57 | surround.buffer_setup({ 58 | surrounds = { 59 | s = { 60 | add = { "['", "']" }, 61 | }, 62 | l = { add = { 'function () ', ' end' } }, 63 | F = { 64 | add = function() 65 | return { 66 | { fmt('local function %s() ', get_input('Enter a function name')) }, 67 | { ' end' }, 68 | } 69 | end, 70 | }, 71 | i = { 72 | add = function() 73 | return { 74 | { fmt('if %s then ', get_input('Enter a condition')) }, 75 | { ' end' }, 76 | } 77 | end, 78 | }, 79 | t = { 80 | add = function() 81 | return { 82 | { fmt('{ %s = { ', get_input('Enter a field name')) }, 83 | { ' }}' }, 84 | } 85 | end, 86 | }, 87 | }, 88 | }) 89 | end, 90 | }) 91 | -------------------------------------------------------------------------------- /.config/nvim/after/ftplugin/markdown.lua: -------------------------------------------------------------------------------- 1 | if not as then return end 2 | 3 | local opt, b, fn = vim.opt_local, vim.b, vim.fn 4 | local map = map or vim.keymap.set 5 | 6 | opt.spell = true 7 | 8 | map('n', 'p', 'MarkdownPreviewToggle', { desc = 'markdown preview', buffer = 0 }) 9 | 10 | b.formatting_disabled = not vim.startswith(fn.expand('%'), vim.env.PROJECTS_DIR .. '/personal') 11 | 12 | as.ftplugin_conf({ 13 | ['nvim-surround'] = function(surround) 14 | surround.buffer_setup({ 15 | surrounds = { 16 | l = { 17 | add = function() return { { '[' }, { ('](%s)'):format(fn.getreg('*')) } } end, 18 | }, 19 | }, 20 | }) 21 | end, 22 | }) 23 | -------------------------------------------------------------------------------- /.config/nvim/after/ftplugin/qf.lua: -------------------------------------------------------------------------------- 1 | local opt = vim.opt_local 2 | 3 | opt.wrap = false 4 | opt.number = false 5 | opt.signcolumn = 'yes' 6 | opt.buflisted = false 7 | opt.winfixheight = true 8 | 9 | map('n', 'dd', as.list.qf.delete, { desc = 'delete current quickfix entry', buffer = 0 }) 10 | map('v', 'd', as.list.qf.delete, { desc = 'delete selected quickfix entry', buffer = 0 }) 11 | map('n', 'H', ':colder', { buffer = 0 }) 12 | map('n', 'L', ':cnewer', { buffer = 0 }) 13 | -- force quickfix to open beneath all other splits 14 | vim.cmd.wincmd('J') 15 | as.adjust_split_height(3, 10) 16 | -------------------------------------------------------------------------------- /.config/nvim/after/ftplugin/svelte.lua: -------------------------------------------------------------------------------- 1 | if not as then return end 2 | as.ftplugin_conf({ 3 | ['nvim-surround'] = function(surround) 4 | surround.buffer_setup({ 5 | surrounds = { 6 | i = { 7 | add = function() return { { '{#if condition}' }, { '{/if}' } } end, 8 | }, 9 | }, 10 | }) 11 | end, 12 | }) 13 | -------------------------------------------------------------------------------- /.config/nvim/after/ftplugin/vim.lua: -------------------------------------------------------------------------------- 1 | if vim.g.vscode then return end 2 | local opt, fn = vim.opt_local, vim.fn 3 | opt.spell = true 4 | 5 | map('n', 'so', function() 6 | vim.cmd.source('%') 7 | vim.notify('Sourced ' .. fn.expand('%')) 8 | end) 9 | 10 | vim.schedule(function() opt.syntax = 'off' end) -- FIXME: if the syntax isn't delayed it still gets enabled 11 | -------------------------------------------------------------------------------- /.config/nvim/after/syntax/dap-repl.vim: -------------------------------------------------------------------------------- 1 | " Quit when a syntax file was already loaded 2 | if exists("b:current_syntax") 3 | finish 4 | endif 5 | 6 | runtime! syntax/log.vim 7 | let b:current_syntax = "dap-repl" 8 | -------------------------------------------------------------------------------- /.config/nvim/filetype.lua: -------------------------------------------------------------------------------- 1 | if not vim.filetype then return end 2 | 3 | vim.filetype.add({ 4 | extension = { 5 | lock = 'yaml', 6 | }, 7 | filename = { 8 | ['NEOGIT_COMMIT_EDITMSG'] = 'NeogitCommitMessage', 9 | ['.psqlrc'] = 'conf', 10 | ['launch.json'] = 'jsonc', 11 | Podfile = 'ruby', 12 | Brewfile = 'ruby', 13 | }, 14 | pattern = { 15 | ['.*%.conf'] = 'conf', 16 | ['.*%.theme'] = 'conf', 17 | ['.*%.gradle'] = 'groovy', 18 | ['^.env%..*'] = 'bash', 19 | }, 20 | }) 21 | -------------------------------------------------------------------------------- /.config/nvim/init.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------------------------------- 2 | -- _/_/ _/ _/ 3 | -- _/ _/ _/ _/ Akin Sowemimo's dotfiles 4 | -- _/_/_/_/ _/_/ https://github.com/akinsho 5 | -- _/ _/ _/ _/ 6 | -- _/ _/ _/ _/ 7 | ---------------------------------------------------------------------------------------------------- 8 | 9 | local g, fn, opt, loop, env, cmd = vim.g, vim.fn, vim.opt, vim.uv, vim.env, vim.cmd 10 | 11 | ---------------------------------------------------------------------------------------------------- 12 | -- Leader bindings 13 | ---------------------------------------------------------------------------------------------------- 14 | g.mapleader = ',' -- Remap leader key 15 | g.maplocalleader = ' ' -- Local leader is 16 | ---------------------------------------------------------------------------------------------------- 17 | g.os = loop.os_uname().sysname 18 | g.open_command = g.os == 'Darwin' and 'open' or 'xdg-open' 19 | g.dotfiles = env.DOTFILES or fn.expand('~/.dotfiles') 20 | g.vim_dir = g.dotfiles .. '/.config/nvim' 21 | g.projects_dir = env.PROJECTS_DIR or fn.expand('~/projects') 22 | g.work_dir = g.projects_dir .. '/work' 23 | ---------------------------------------------------------------------------------------------------- 24 | if vim.loader then vim.loader.enable() end 25 | 26 | if vim.g.vscode then 27 | ---------------------------------------------------------------------------------------------------- 28 | -- GUI 29 | ---------------------------------------------------------------------------------------------------- 30 | require('as.vscode') 31 | else 32 | ---------------------------------------------------------------------------------------------------- 33 | -- Global namespace 34 | ---------------------------------------------------------------------------------------------------- 35 | local namespace = { 36 | ui = { 37 | winbar = { enable = false }, 38 | statuscolumn = { enable = true }, 39 | statusline = { enable = true }, 40 | }, 41 | -- some vim mappings require a mixture of commandline commands and function calls 42 | -- this table is place to store lua functions to be called in those mappings 43 | mappings = { enable = true }, 44 | } 45 | 46 | -- This table is a globally accessible store to facilitating accessing 47 | -- helper functions and variables throughout my config 48 | _G.as = as or namespace 49 | _G.map = vim.keymap.set 50 | _G.P = vim.print 51 | ---------------------------------------------------------------------------------------------------- 52 | -- TUI 53 | ---------------------------------------------------------------------------------------------------- 54 | -- Order matters here as globals needs to be instantiated first etc. 55 | require('as.globals') 56 | require('as.highlights') 57 | require('as.ui') 58 | require('as.settings') 59 | end 60 | 61 | ---------------------------------------------------------------------------------------------------- 62 | g.border = not vim.g.vscode and as.ui.current.border or 'single' 63 | ------------------------------------------------------------------------------------------------------ 64 | -- Plugins 65 | ------------------------------------------------------------------------------------------------------ 66 | local data = fn.stdpath('data') 67 | local lazypath = data .. '/lazy/lazy.nvim' 68 | if not loop.fs_stat(lazypath) then 69 | fn.system({ 70 | 'git', 71 | 'clone', 72 | '--filter=blob:none', 73 | '--single-branch', 74 | 'https://github.com/folke/lazy.nvim.git', 75 | lazypath, 76 | }) 77 | vim.notify('Installed lazy.nvim') 78 | end 79 | opt.runtimepath:prepend(lazypath) 80 | ---------------------------------------------------------------------------------------------------- 81 | -- $NVIM 82 | ---------------------------------------------------------------------------------------------------- 83 | -- NOTE: this must happen after the lazy path is setup 84 | -- If opening from inside neovim terminal then do not load other plugins 85 | if env.NVIM then return require('lazy').setup({ { 'willothy/flatten.nvim', config = true } }) end 86 | ------------------------------------------------------------------------------------------------------ 87 | require('lazy').setup({ 88 | { import = 'as.plugins', cond = function() return not vim.g.vscode end }, 89 | { import = 'as.vscode.plugins', cond = function() return vim.g.vscode end }, 90 | }, { 91 | ui = { border = g.border }, 92 | defaults = { lazy = true }, 93 | change_detection = { notify = false }, 94 | checker = { 95 | enabled = true, 96 | concurrency = 30, 97 | notify = false, 98 | frequency = 3600, -- check for updates every hour 99 | }, 100 | performance = { 101 | rtp = { 102 | paths = { data .. '/site' }, 103 | disabled_plugins = { 'netrw', 'netrwPlugin' }, 104 | }, 105 | }, 106 | dev = { 107 | path = g.projects_dir .. '/personal/', 108 | patterns = { 'akinsho' }, 109 | fallback = true, 110 | }, 111 | }) 112 | 113 | ------------------------------------------------------------------------------------------------------ 114 | -- Builtin Packages 115 | ------------------------------------------------------------------------------------------------------ 116 | -- cfilter plugin allows filtering down an existing quickfix list 117 | cmd.packadd('cfilter') 118 | if not vim.g.vscode then 119 | map('n', 'pm', 'Lazy', { desc = 'manage' }) 120 | ------------------------------------------------------------------------------------------------------ 121 | -- Colour Scheme {{{1 122 | ------------------------------------------------------------------------------------------------------ 123 | vim.g.high_contrast_theme = true -- set to true for themes like github_dark or night-owl 124 | as.pcall('theme failed to load because', cmd.colorscheme, 'github_dark_default') 125 | end 126 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/completion.lua: -------------------------------------------------------------------------------- 1 | local highlight, ui = as.highlight, as.ui 2 | local fn = vim.fn 3 | local border = ui.current.border 4 | 5 | return { 6 | { 7 | 'saghen/blink.cmp', 8 | dependencies = 'rafamadriz/friendly-snippets', 9 | version = '*', 10 | init = function() 11 | highlight.plugin('blink', { 12 | { BlinkCmpMenuBorder = { link = 'PickerBorder' } }, 13 | { BlinkCmpDocBorder = { link = 'PickerBorder' } }, 14 | { BlinkCmpMenu = { link = 'Normal' } }, 15 | }) 16 | end, 17 | ---@module 'blink.cmp' 18 | ---@type blink.cmp.Config 19 | opts = { 20 | keymap = { preset = 'enter' }, 21 | appearance = { nerd_font_variant = 'mono', use_nvim_cmp_as_default = true }, 22 | sources = { 23 | default = { 'lsp', 'path', 'snippets', 'buffer' }, 24 | providers = { 25 | markdown = { 26 | name = 'RenderMarkdown', 27 | module = 'render-markdown.integ.blink', 28 | fallbacks = { 'lsp' }, 29 | }, 30 | }, 31 | }, 32 | signature = { window = { border = border } }, 33 | completion = { 34 | menu = { border = border }, 35 | documentation = { 36 | auto_show = true, 37 | auto_show_delay_ms = 500, 38 | window = { border = border }, 39 | }, 40 | list = { 41 | selection = { 42 | auto_insert = function(ctx) return ctx.mode == 'cmdline' and false or true end, 43 | }, 44 | }, 45 | }, 46 | }, 47 | opts_extend = { 'sources.default' }, 48 | }, 49 | { 50 | 'github/copilot.vim', 51 | event = 'InsertEnter', 52 | init = function() vim.g.copilot_no_tab_map = true end, 53 | config = function() 54 | local function accept_word() 55 | fn['copilot#Accept']('') 56 | local output = fn['copilot#TextQueuedForInsertion']() 57 | return fn.split(output, [[[ .]\zs]])[1] 58 | end 59 | 60 | local function accept_line() 61 | fn['copilot#Accept']('') 62 | local output = fn['copilot#TextQueuedForInsertion']() 63 | return fn.split(output, [[[\n]\zs]])[1] 64 | end 65 | map('i', '(as-copilot-accept)', "copilot#Accept('')", { 66 | expr = true, 67 | remap = true, 68 | silent = true, 69 | }) 70 | map('i', '', '(copilot-next)', { desc = 'next suggestion' }) 71 | map('i', '', '(copilot-previous)', { desc = 'previous suggestion' }) 72 | map('i', '', 'vertical Copilot panel', { desc = 'open copilot panel' }) 73 | map('i', '', accept_word, { expr = true, remap = false, desc = 'accept word' }) 74 | map('i', '', accept_line, { expr = true, remap = false, desc = 'accept line' }) 75 | vim.g.copilot_filetypes = { 76 | ['*'] = true, 77 | gitcommit = false, 78 | NeogitCommitMessage = false, 79 | DressingInput = false, 80 | TelescopePrompt = false, 81 | ['neo-tree-popup'] = false, 82 | ['dap-repl'] = false, 83 | } 84 | highlight.plugin('copilot', { { CopilotSuggestion = { link = 'Comment' } } }) 85 | end, 86 | }, 87 | } 88 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/debugger.lua: -------------------------------------------------------------------------------- 1 | local fn = vim.fn 2 | local icons, highlight, border, palette = as.ui.icons, as.highlight, as.ui.current.border, as.ui.palette 3 | 4 | as.debug = { layout = { ft = { dart = 2 } } } 5 | 6 | return { 7 | { 8 | 'mfussenegger/nvim-dap', 9 | keys = { 10 | { 11 | 'dL', 12 | function() require('dap').set_breakpoint(nil, nil, fn.input('Log point message: ')) end, 13 | desc = 'dap: log breakpoint', 14 | }, 15 | { 16 | 'db', 17 | function() require('dap').toggle_breakpoint() end, 18 | desc = 'dap: toggle breakpoint', 19 | }, 20 | { 21 | 'dB', 22 | function() require('dap').set_breakpoint(fn.input('Breakpoint condition: ')) end, 23 | desc = 'dap: set conditional breakpoint', 24 | }, 25 | { 26 | 'dc', 27 | function() require('dap').continue() end, 28 | desc = 'dap: continue or start debugging', 29 | }, 30 | { 31 | 'duc', 32 | function() require('dapui').close(as.debug.layout.ft[vim.bo.ft]) end, 33 | desc = 'dap ui: close', 34 | }, 35 | { 36 | 'dut', 37 | function() require('dapui').toggle(as.debug.layout.ft[vim.bo.ft]) end, 38 | desc = 'dap ui: toggle', 39 | }, 40 | { 'dt', function() require('dap').repl.toggle() end, desc = 'dap: toggle repl' }, 41 | { 'de', function() require('dap').step_out() end, desc = 'dap: step out' }, 42 | { 'di', function() require('dap').step_into() end, desc = 'dap: step into' }, 43 | { 'do', function() require('dap').step_over() end, desc = 'dap: step over' }, 44 | { 'dl', function() require('dap').run_last() end, desc = 'dap REPL: run last' }, 45 | }, 46 | config = function() 47 | local dap = require('dap') -- NOTE: must be loaded before the signs can be tweaked 48 | local ui_ok, dapui = pcall(require, 'dapui') 49 | 50 | highlight.plugin('dap', { 51 | { DapBreakpoint = { fg = palette.light_red } }, 52 | { DapStopped = { fg = palette.green } }, 53 | }) 54 | 55 | fn.sign_define({ 56 | { name = 'DapBreakpoint', texthl = 'DapBreakpoint', text = icons.misc.bug, linehl = '', numhl = '' }, 57 | { name = 'DapStopped', texthl = 'DapStopped', text = icons.misc.bookmark, linehl = '', numhl = '' }, 58 | }) 59 | 60 | -- DON'T automatically stop at exceptions 61 | -- dap.defaults.fallback.exception_breakpoints = {} 62 | 63 | if not ui_ok then return end 64 | dap.listeners.before.event_exited['dapui_config'] = function() dapui.close() end 65 | dap.listeners.before.event_terminated['dapui_config'] = function() dapui.close() end 66 | dap.listeners.after.event_initialized['dapui_config'] = function() dapui.open(as.debug.layout.ft[vim.bo.ft]) end 67 | end, 68 | dependencies = { 69 | { 70 | { 71 | 'rcarriga/nvim-dap-ui', 72 | opts = { 73 | windows = { indent = 2 }, 74 | floating = { border = border }, 75 | layouts = { 76 | { 77 | elements = { 78 | { id = 'scopes', size = 0.25 }, 79 | { id = 'breakpoints', size = 0.25 }, 80 | { id = 'stacks', size = 0.25 }, 81 | { id = 'watches', size = 0.25 }, 82 | }, 83 | position = 'left', 84 | size = 20, 85 | }, 86 | { elements = { { id = 'repl', size = 0.9 } }, position = 'bottom', size = 10 }, 87 | }, 88 | }, 89 | }, 90 | { 'theHamsta/nvim-dap-virtual-text', opts = { all_frames = true } }, 91 | }, 92 | }, 93 | }, 94 | { 95 | 'mxsdev/nvim-dap-vscode-js', 96 | ft = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' }, 97 | dependencies = { 'mfussenegger/nvim-dap' }, 98 | opts = { 99 | adapters = { 'chrome', 'pwa-node', 'pwa-chrome', 'node-terminal', 'pwa-extensionHost' }, 100 | node_path = 'node', 101 | debugger_cmd = { 'js-debug-adapter' }, 102 | }, 103 | config = function(_, opts) 104 | require('dap-vscode-js').setup(opts) 105 | for _, language in ipairs({ 'typescript', 'typescriptreact', 'javascript' }) do 106 | require('dap').configurations[language] = { 107 | { 108 | type = 'chrome', 109 | request = 'launch', 110 | name = 'Launch Chrome against localhost', 111 | url = 'http://localhost:3000', 112 | webRoot = '${workspaceFolder}', 113 | }, 114 | { 115 | type = 'pwa-node', 116 | request = 'attach', 117 | name = 'Attach', 118 | processId = require('dap.utils').pick_process, 119 | cwd = '${workspaceFolder}', 120 | }, 121 | } 122 | end 123 | end, 124 | }, 125 | } 126 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/editing.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | 'gbprod/substitute.nvim', 4 | config = true, 5 | keys = { 6 | { 'S', function() require('substitute').visual() end, mode = 'x' }, 7 | { 'S', function() require('substitute').operator() end, mode = 'n' }, 8 | { 'X', function() require('substitute.exchange').operator() end, mode = 'n' }, 9 | { 'X', function() require('substitute.exchange').visual() end, mode = 'x' }, 10 | { 'Xc', function() require('substitute.exchange').cancel() end, mode = { 'n', 'x' } }, 11 | }, 12 | }, 13 | { 14 | 'monaqa/dial.nvim', 15 | keys = { 16 | { '', '(dial-increment)', mode = 'n' }, 17 | { '', '(dial-decrement)', mode = 'n' }, 18 | { '', '(dial-increment)', mode = 'v' }, 19 | { '', '(dial-decrement)', mode = 'v' }, 20 | { 'g', 'g(dial-increment)', mode = 'v' }, 21 | { 'g', 'g(dial-decrement)', mode = 'v' }, 22 | }, 23 | config = function() 24 | local augend = require('dial.augend') 25 | local config = require('dial.config') 26 | 27 | local operators = augend.constant.new({ 28 | elements = { '&&', '||' }, 29 | word = false, 30 | cyclic = true, 31 | }) 32 | 33 | local casing = augend.case.new({ 34 | types = { 'camelCase', 'snake_case', 'PascalCase', 'SCREAMING_SNAKE_CASE' }, 35 | cyclic = true, 36 | }) 37 | 38 | config.augends:register_group({ 39 | default = { 40 | augend.integer.alias.decimal, 41 | augend.integer.alias.hex, 42 | augend.date.alias['%Y/%m/%d'], 43 | augend.constant.alias.bool, 44 | casing, 45 | }, 46 | }) 47 | 48 | config.augends:on_filetype({ 49 | go = { 50 | augend.integer.alias.decimal, 51 | augend.integer.alias.hex, 52 | augend.constant.alias.bool, 53 | operators, 54 | }, 55 | typescript = { 56 | augend.integer.alias.decimal, 57 | augend.integer.alias.hex, 58 | augend.constant.alias.bool, 59 | augend.constant.new({ elements = { 'let', 'const' } }), 60 | casing, 61 | }, 62 | markdown = { 63 | augend.integer.alias.decimal, 64 | augend.misc.alias.markdown_header, 65 | }, 66 | yaml = { 67 | augend.integer.alias.decimal, 68 | augend.semver.alias.semver, 69 | }, 70 | toml = { 71 | augend.integer.alias.decimal, 72 | augend.semver.alias.semver, 73 | }, 74 | }) 75 | end, 76 | }, 77 | { 78 | 'yetone/avante.nvim', 79 | event = 'VeryLazy', 80 | opts = { 81 | windows = { 82 | input = { 83 | prefix = '▷', 84 | }, 85 | width = 40, 86 | }, 87 | }, 88 | build = 'make', 89 | dependencies = { 90 | 'nvim-treesitter/nvim-treesitter', 91 | 'stevearc/dressing.nvim', 92 | 'nvim-lua/plenary.nvim', 93 | 'MunifTanjim/nui.nvim', 94 | 'nvim-tree/nvim-web-devicons', 95 | { 96 | 'HakonHarnes/img-clip.nvim', -- support for image pasting 97 | event = 'VeryLazy', 98 | opts = { 99 | default = { 100 | embed_image_as_base64 = false, 101 | prompt_for_file_name = false, 102 | drag_and_drop = { insert_mode = true }, 103 | }, 104 | }, 105 | }, 106 | { 107 | 'MeanderingProgrammer/render-markdown.nvim', 108 | ---@module 'render-markdown' 109 | ---@type render.md.UserConfig 110 | opts = { file_types = { 'markdown', 'Avante' } }, 111 | ft = { 'markdown', 'Avante' }, 112 | }, 113 | }, 114 | }, 115 | } 116 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/flutter-tools.lua: -------------------------------------------------------------------------------- 1 | local function config() 2 | local is_nightly = as.nightly() 3 | require('flutter-tools').setup({ 4 | ui = { border = as.ui.current.border }, 5 | debugger = { 6 | enabled = is_nightly, 7 | run_via_dap = is_nightly, 8 | exception_breakpoints = {}, 9 | }, 10 | outline = { auto_open = false }, 11 | decorations = { 12 | statusline = { device = true, app_version = true }, 13 | }, 14 | widget_guides = { enabled = true, debug = false }, 15 | dev_log = { enabled = not is_nightly, open_cmd = 'tabedit' }, 16 | lsp = { 17 | color = { 18 | enabled = true, 19 | background = true, 20 | virtual_text = false, 21 | }, 22 | settings = { 23 | showTodos = false, 24 | renameFilesWithClasses = 'always', 25 | updateImportsOnRename = true, 26 | completeFunctionCalls = true, 27 | lineLength = 100, 28 | }, 29 | }, 30 | }) 31 | end 32 | 33 | return { 34 | { 35 | 'akinsho/flutter-tools.nvim', 36 | lazy = false, 37 | dev = true, 38 | config = config, 39 | dependencies = { 40 | 'nvim-lua/plenary.nvim', 41 | { 'RobertBrunhage/flutter-riverpod-snippets', lazy = false }, 42 | }, 43 | }, 44 | } 45 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/git.lua: -------------------------------------------------------------------------------- 1 | local cwd = vim.fn.getcwd 2 | local highlight = as.highlight 3 | local border = as.ui.current.border 4 | local icons = as.ui.icons.separators 5 | 6 | local neogit = as.reqidx('neogit') 7 | local gitlinker = as.reqidx('gitlinker') 8 | 9 | local function browser_open() return { action_callback = require('gitlinker.actions').open_in_browser } end 10 | 11 | return { 12 | { 13 | 'NeogitOrg/neogit', 14 | cmd = 'Neogit', 15 | dependencies = { 'nvim-lua/plenary.nvim' }, 16 | enabled = false, 17 | keys = { 18 | { 'gs', function() neogit.open() end, desc = 'open status buffer' }, 19 | { 'gc', function() neogit.open({ 'commit' }) end, desc = 'open commit buffer' }, 20 | { 'gl', function() neogit.popups.pull.create() end, desc = 'open pull popup' }, 21 | { 'gp', function() neogit.popups.push.create() end, desc = 'open push popup' }, 22 | }, 23 | opts = { 24 | disable_signs = false, 25 | disable_hint = true, 26 | disable_commit_confirmation = false, 27 | disable_builtin_notifications = true, 28 | disable_insert_on_commit = false, 29 | signs = { 30 | section = { '', '󰘕' }, -- "󰁙", "󰁊" 31 | item = { '▸', '▾' }, 32 | hunk = { '󰐕', '󰍴' }, 33 | }, 34 | integrations = { diffview = true }, 35 | }, 36 | }, 37 | { 38 | 'sindrets/diffview.nvim', 39 | cmd = { 'DiffviewOpen', 'DiffviewFileHistory' }, 40 | keys = { 41 | { 'gd', 'DiffviewOpen', desc = 'diffview: open', mode = 'n' }, 42 | { 'gh', [[:'<'>DiffviewFileHistory]], desc = 'diffview: file history', mode = 'v' }, 43 | { 44 | 'gh', 45 | 'DiffviewFileHistory', 46 | desc = 'diffview: file history', 47 | mode = 'n', 48 | }, 49 | }, 50 | opts = { 51 | default_args = { DiffviewFileHistory = { '%' } }, 52 | enhanced_diff_hl = true, 53 | hooks = { 54 | diff_buf_read = function() 55 | local opt = vim.opt_local 56 | opt.wrap, opt.list, opt.relativenumber = false, false, false 57 | opt.colorcolumn = '' 58 | end, 59 | }, 60 | keymaps = { 61 | view = { q = 'DiffviewClose' }, 62 | file_panel = { q = 'DiffviewClose' }, 63 | file_history_panel = { q = 'DiffviewClose' }, 64 | }, 65 | }, 66 | config = function(_, opts) 67 | highlight.plugin('diffview', { 68 | { DiffAddedChar = { bg = 'NONE', fg = { from = 'diffAdded', attr = 'bg', alter = 0.3 } } }, 69 | { DiffChangedChar = { bg = 'NONE', fg = { from = 'diffChanged', attr = 'bg', alter = 0.3 } } }, 70 | { DiffviewStatusAdded = { link = 'DiffAddedChar' } }, 71 | { DiffviewStatusModified = { link = 'DiffChangedChar' } }, 72 | { DiffviewStatusRenamed = { link = 'DiffChangedChar' } }, 73 | { DiffviewStatusUnmerged = { link = 'DiffChangedChar' } }, 74 | { DiffviewStatusUntracked = { link = 'DiffAddedChar' } }, 75 | }) 76 | require('diffview').setup(opts) 77 | end, 78 | }, 79 | { 80 | 'ruifm/gitlinker.nvim', 81 | dependencies = { 'nvim-lua/plenary.nvim' }, 82 | keys = { 83 | { 84 | 'gu', 85 | function() gitlinker.get_buf_range_url('n') end, 86 | desc = 'gitlinker: copy line to clipboard', 87 | mode = 'n', 88 | }, 89 | { 90 | 'gu', 91 | function() gitlinker.get_buf_range_url('v') end, 92 | desc = 'gitlinker: copy range to clipboard', 93 | mode = 'v', 94 | }, 95 | { 96 | 'go', 97 | function() gitlinker.get_repo_url(browser_open()) end, 98 | desc = 'gitlinker: open in browser', 99 | }, 100 | { 101 | 'go', 102 | function() gitlinker.get_buf_range_url('n', browser_open()) end, 103 | desc = 'gitlinker: open current line in browser', 104 | }, 105 | { 106 | 'go', 107 | function() gitlinker.get_buf_range_url('v', browser_open()) end, 108 | desc = 'gitlinker: open current selection in browser', 109 | mode = 'v', 110 | }, 111 | }, 112 | opts = { 113 | mappings = nil, 114 | callbacks = { 115 | ['github-work'] = function(url_data) -- Resolve the host for work repositories 116 | url_data.host = 'github.com' 117 | return require('gitlinker.hosts').get_github_type_url(url_data) 118 | end, 119 | }, 120 | }, 121 | }, 122 | { 123 | 'lewis6991/gitsigns.nvim', 124 | event = { 'BufReadPre', 'BufNewFile' }, 125 | opts = { 126 | signs = { 127 | add = { text = icons.right_block }, 128 | change = { text = icons.right_block }, 129 | delete = { text = icons.right_block }, 130 | topdelete = { text = icons.right_block }, 131 | changedelete = { text = icons.right_block }, 132 | untracked = { text = icons.light_shade_block }, 133 | }, 134 | current_line_blame = not cwd():match('dotfiles'), 135 | current_line_blame_formatter = ' , · ', 136 | preview_config = { border = border }, 137 | on_attach = function(bufnr) 138 | local gs = package.loaded.gitsigns 139 | 140 | local function bmap(mode, l, r, opts) 141 | opts = opts or {} 142 | opts.buffer = bufnr 143 | map(mode, l, r, opts) 144 | end 145 | 146 | map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage' }) 147 | map('n', 'hp', gs.preview_hunk_inline, { desc = 'preview current hunk' }) 148 | map('n', 'hb', gs.toggle_current_line_blame, { desc = 'toggle current line blame' }) 149 | map('n', 'hd', gs.toggle_deleted, { desc = 'show deleted lines' }) 150 | map('n', 'hw', gs.toggle_word_diff, { desc = 'toggle word diff' }) 151 | map('n', 'gw', gs.stage_buffer, { desc = 'stage entire buffer' }) 152 | map('n', 'gre', gs.reset_buffer, { desc = 'reset entire buffer' }) 153 | map('n', 'gbl', gs.blame_line, { desc = 'blame current line' }) 154 | map('n', 'lm', function() gs.setqflist('all') end, { desc = 'list modified in quickfix' }) 155 | bmap({ 'n', 'v' }, 'hs', 'Gitsigns stage_hunk', { desc = 'stage hunk' }) 156 | bmap({ 'n', 'v' }, 'hr', 'Gitsigns reset_hunk', { desc = 'reset hunk' }) 157 | bmap({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select hunk' }) 158 | 159 | map('n', '[h', function() 160 | vim.schedule(function() gs.next_hunk() end) 161 | return '' 162 | end, { expr = true, desc = 'go to next git hunk' }) 163 | 164 | map('n', ']h', function() 165 | vim.schedule(function() gs.prev_hunk() end) 166 | return '' 167 | end, { expr = true, desc = 'go to previous git hunk' }) 168 | end, 169 | }, 170 | }, 171 | } 172 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/navigation.lua: -------------------------------------------------------------------------------- 1 | local fn, api = vim.fn, vim.api 2 | local highlight = as.highlight 3 | local icons = as.ui.icons 4 | local autocmd = api.nvim_create_autocmd 5 | 6 | return { 7 | { 8 | 'nvim-neo-tree/neo-tree.nvim', 9 | branch = 'v3.x', 10 | cmd = { 'Neotree' }, 11 | keys = { { '', 'Neotree toggle reveal', desc = 'NeoTree' } }, 12 | init = function() 13 | autocmd('BufEnter', { 14 | desc = 'Load NeoTree if entering a directory', 15 | callback = function(args) 16 | if fn.isdirectory(api.nvim_buf_get_name(args.buf)) > 0 then 17 | require('lazy').load({ plugins = { 'neo-tree.nvim' } }) 18 | api.nvim_del_autocmd(args.id) 19 | end 20 | end, 21 | }) 22 | end, 23 | config = function() 24 | highlight.plugin('NeoTree', { 25 | { NeoTreeWinSeparator = { fg = { from = 'Normal', attr = 'bg' } } }, 26 | { NeoTreeNormal = { link = 'PanelBackground' } }, 27 | { NeoTreeNormalNC = { link = 'PanelBackground' } }, 28 | { NeoTreeCursorLine = { link = 'Visual' } }, 29 | { NeoTreeRootName = { underline = true } }, 30 | { NeoTreeStatusLine = { link = 'PanelSt' } }, 31 | { NeoTreeTabActive = { bg = { from = 'PanelBackground' }, bold = true } }, 32 | { NeoTreeTabInactive = { bg = { from = 'PanelDarkBackground', alter = 0.15 }, fg = { from = 'Comment' } } }, 33 | { NeoTreeTabSeparatorActive = { inherit = 'PanelBackground', fg = { from = 'Comment' } } }, 34 | { NeoTreeDirectoryIcon = { link = 'WarningMsg' } }, 35 | { NeoTreeTabActive = { bg = { from = 'PanelHeading', alter = 0.6 }, italic = true, bold = true } }, 36 | { NeoTreeTabInactive = { bg = { from = 'PanelHeading', alter = 0.3 }, fg = { from = 'Comment' } } }, 37 | { NeoTreeTabSeparatorActive = { inherit = 'PanelHeading', fg = { from = 'Comment' } } }, 38 | { NeoTreeTabSeparatorInactive = { inherit = 'NeoTreeTabInactive', fg = { from = 'Dim' } } }, 39 | }) 40 | 41 | local symbols = require('lspkind').symbol_map 42 | local lsp_kinds = as.ui.lsp.highlights 43 | 44 | require('neo-tree').setup({ 45 | sources = { 'filesystem', 'git_status', 'document_symbols' }, 46 | source_selector = { 47 | winbar = true, 48 | separator_active = '', 49 | sources = { 50 | { source = 'filesystem' }, 51 | { source = 'git_status' }, 52 | }, 53 | }, 54 | enable_git_status = true, 55 | git_status_async = true, 56 | nesting_rules = { 57 | ['dart'] = { 'freezed.dart', 'g.dart' }, 58 | ['go'] = { 59 | pattern = '(.*)%.go$', 60 | files = { '%1_test.go' }, 61 | }, 62 | ['docker'] = { 63 | pattern = '^dockerfile$', 64 | ignore_case = true, 65 | files = { '.dockerignore', 'docker-compose.*', 'dockerfile*' }, 66 | }, 67 | }, 68 | event_handlers = { 69 | { 70 | event = 'neo_tree_buffer_enter', 71 | handler = function() highlight.set('Cursor', { blend = 100 }) end, 72 | }, 73 | { 74 | event = 'neo_tree_popup_buffer_enter', 75 | handler = function() highlight.set('Cursor', { blend = 0 }) end, 76 | }, 77 | { 78 | event = 'neo_tree_buffer_leave', 79 | handler = function() highlight.set('Cursor', { blend = 0 }) end, 80 | }, 81 | { 82 | event = 'neo_tree_popup_buffer_leave', 83 | handler = function() highlight.set('Cursor', { blend = 100 }) end, 84 | }, 85 | { 86 | event = 'neo_tree_window_after_close', 87 | handler = function() highlight.set('Cursor', { blend = 0 }) end, 88 | }, 89 | { 90 | event = 'neo_tree_popup_input_ready', 91 | handler = function() vim.cmd('stopinsert') end, 92 | }, 93 | }, 94 | filesystem = { 95 | hijack_netrw_behavior = 'open_current', 96 | use_libuv_file_watcher = true, 97 | group_empty_dirs = false, 98 | follow_current_file = { 99 | enabled = true, 100 | leave_dirs_open = true, 101 | }, 102 | filtered_items = { 103 | visible = true, 104 | hide_dotfiles = false, 105 | hide_gitignored = true, 106 | never_show = { '.DS_Store' }, 107 | }, 108 | window = { 109 | mappings = { 110 | ['/'] = 'noop', 111 | ['g/'] = 'fuzzy_finder', 112 | }, 113 | }, 114 | }, 115 | default_component_configs = { 116 | icon = { folder_empty = icons.documents.open_folder }, 117 | name = { highlight_opened_files = true }, 118 | document_symbols = { 119 | follow_cursor = true, 120 | kinds = vim.iter(symbols):fold({}, function(acc, k, v) 121 | acc[k] = { icon = v, hl = lsp_kinds[k] } 122 | return acc 123 | end), 124 | }, 125 | modified = { symbol = icons.misc.circle .. ' ' }, 126 | git_status = { 127 | symbols = { 128 | added = icons.git.add, 129 | deleted = icons.git.remove, 130 | modified = icons.git.mod, 131 | renamed = icons.git.rename, 132 | untracked = icons.git.untracked, 133 | ignored = icons.git.ignored, 134 | unstaged = icons.git.unstaged, 135 | staged = icons.git.staged, 136 | conflict = icons.git.conflict, 137 | }, 138 | }, 139 | file_size = { 140 | required_width = 50, 141 | }, 142 | }, 143 | window = { 144 | mappings = { 145 | ['o'] = 'toggle_node', 146 | [''] = 'open_with_window_picker', 147 | [''] = 'split_with_window_picker', 148 | [''] = 'vsplit_with_window_picker', 149 | [''] = 'revert_preview', 150 | ['P'] = { 'toggle_preview', config = { use_float = false } }, 151 | }, 152 | }, 153 | }) 154 | end, 155 | dependencies = { 156 | 'nvim-lua/plenary.nvim', 157 | 'MunifTanjim/nui.nvim', 158 | 'nvim-tree/nvim-web-devicons', 159 | { 160 | 'ten3roberts/window-picker.nvim', 161 | name = 'window-picker', 162 | config = function() 163 | local picker = require('window-picker') 164 | picker.setup() 165 | picker.pick_window = function() 166 | return picker.select( 167 | { hl = 'WindowPicker', prompt = 'Pick window: ' }, 168 | function(winid) return winid or nil end 169 | ) 170 | end 171 | end, 172 | }, 173 | }, 174 | }, 175 | } 176 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/projects.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'tpope/vim-projectionist', 3 | lazy = false, 4 | init = function() 5 | vim.g.projectionist_heuristics = { 6 | ['*.go'] = { 7 | ['*.go'] = { 8 | alternate = '{}_test.go', 9 | type = 'source', 10 | template = { 11 | 'package {basename|camelcase}', 12 | }, 13 | }, 14 | ['*_test.go'] = { 15 | alternate = '{}.go', 16 | type = 'test', 17 | template = { 18 | 'package {basename|camelcase}', 19 | }, 20 | }, 21 | }, 22 | ['src/'] = { 23 | ['*.ts'] = { 24 | alternate = '{}.test.ts', 25 | type = 'source', 26 | }, 27 | ['*.test.ts'] = { 28 | alternate = '{}.ts', 29 | type = 'test', 30 | template = { 31 | "import {basename|camelcase|capitalize} from '@/{dirname}/{basename}';", 32 | '', 33 | "describe('{basename|camelcase|capitalize}', () => {open}", 34 | " it('works', () => {open}", 35 | ' expect(true).toBe(true);', 36 | ' {close});', 37 | '{close});', 38 | }, 39 | }, 40 | ['*.tsx'] = { 41 | alternate = '{}.test.tsx', 42 | type = 'source', 43 | template = { 44 | "import type React, {open} FC {close} from 'react';", 45 | '', 46 | 'type {basename|camelcase|capitalize}Props = {open}', 47 | ' property?: unknown;', 48 | '{close};', 49 | '', 50 | 'const {basename|camelcase|capitalize}: FC<{basename|camelcase|capitalize}Props> = _props => {', 51 | ' return
{basename|camelcase|capitalize}
;', 52 | '};', 53 | '', 54 | 'export default {basename|camelcase|capitalize};', 55 | }, 56 | }, 57 | ['*.test.tsx'] = { 58 | alternate = '{}.tsx', 59 | type = 'test', 60 | template = { 61 | "import {open} render {close} from '@/test-utils';", 62 | "import {basename|camelcase|capitalize} from '@/{dirname}/{basename}';", 63 | '', 64 | "describe('{basename|camelcase|capitalize}', () => {open}", 65 | " it('matches snapshot', () => {open}", 66 | ' const {open} asFragment {close} = render(<{basename|camelcase|capitalize} />, {open}{close});', 67 | ' expect(asFragment()).toMatchSnapshot();', 68 | ' {close});', 69 | '{close});', 70 | }, 71 | }, 72 | }, 73 | ['src/routes/*'] = { 74 | ['*.svelte'] = { 75 | alternate = { '{}.server.ts', '{}.ts' }, 76 | type = 'view', 77 | }, 78 | ['*.server.ts'] = { 79 | alternate = { '{}.svelte', '{}.ts' }, 80 | type = 'server', 81 | template = { 82 | "import type { PageServerLoad } from './$types';", 83 | "import { redirect } from '@sveltejs/kit';", 84 | '', 85 | 'export const load: PageServerLoad = async ({ url, locals: { getSession } }) => {', 86 | 'const session = await getSession();', 87 | "// TODO: hard part's done", 88 | '};', 89 | }, 90 | }, 91 | ['*.ts'] = { 92 | alternate = { '{}.svelte' }, 93 | type = 'client', 94 | }, 95 | }, 96 | ['lib/*.dart'] = { 97 | ['lib/screens/*.dart'] = { 98 | alternate = 'lib/view_models/{}_view_model.dart', 99 | type = 'view', 100 | }, 101 | ['lib/view_models/*_view_model.dart'] = { 102 | alternate = { 'lib/screens/{}.dart', 'lib/widgets/{}.dart' }, 103 | type = 'model', 104 | template = { 'class {camelcase|capitalize}ViewModel extends BaseViewModel {', '}' }, 105 | }, 106 | ['test/view_models/*_view_model_test.dart'] = { 107 | alternate = 'lib/view_models/{}_view_model.dart', 108 | type = 'test', 109 | template = { 110 | "import 'package:test/test.dart';", 111 | '', 112 | 'void main() async {', 113 | " group('TODO', () {", 114 | ' // TODO:', 115 | ' })', 116 | '}', 117 | }, 118 | }, 119 | ['test/services/*_test.dart'] = { 120 | alternate = 'lib/services/{}.dart', 121 | type = 'test', 122 | template = { 123 | "import 'package:test/test.dart';", 124 | '', 125 | 'void main() async {', 126 | " group('TODO', () {", 127 | ' // TODO:', 128 | ' })', 129 | '}', 130 | }, 131 | }, 132 | ['test/widget/*_test.dart'] = { 133 | alternate = 'lib/screens/{}.dart', 134 | type = 'test', 135 | template = { 136 | "import 'package:test/test.dart';", 137 | '', 138 | 'void main() async {', 139 | " group('TODO', () {", 140 | ' // TODO:', 141 | ' })', 142 | '}', 143 | }, 144 | }, 145 | }, 146 | } 147 | end, 148 | keys = { 149 | { 'A', 'A', desc = 'projectionist: edit alternate' }, 150 | { 'av', 'AV', desc = 'projectionist: vsplit alternate' }, 151 | { 'at', 'AT', desc = 'projectionist: vsplit test' }, 152 | }, 153 | } 154 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/snippets.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- FIXME: https://github.com/L3MON4D3/LuaSnip/issues/129 3 | -- causes formatting bugs on save when update events are TextChanged{I} 4 | { 5 | 'L3MON4D3/LuaSnip', 6 | version = 'v2.*', 7 | event = 'InsertEnter', 8 | build = 'make install_jsregexp', 9 | dependencies = { 'rafamadriz/friendly-snippets' }, 10 | config = function() 11 | local ls = require('luasnip') 12 | local types = require('luasnip.util.types') 13 | local extras = require('luasnip.extras') 14 | local fmt = require('luasnip.extras.fmt').fmt 15 | 16 | ls.config.set_config({ 17 | history = false, 18 | region_check_events = 'CursorMoved,CursorHold,InsertEnter', 19 | delete_check_events = 'InsertLeave', 20 | ext_opts = { 21 | [types.choiceNode] = { 22 | active = { 23 | hl_mode = 'combine', 24 | virt_text = { { '●', 'Operator' } }, 25 | }, 26 | }, 27 | [types.insertNode] = { 28 | active = { 29 | hl_mode = 'combine', 30 | virt_text = { { '●', 'Type' } }, 31 | }, 32 | }, 33 | }, 34 | enable_autosnippets = true, 35 | snip_env = { 36 | fmt = fmt, 37 | m = extras.match, 38 | t = ls.text_node, 39 | f = ls.function_node, 40 | c = ls.choice_node, 41 | d = ls.dynamic_node, 42 | i = ls.insert_node, 43 | l = extras.lamda, 44 | snippet = ls.snippet, 45 | }, 46 | }) 47 | 48 | as.command('LuaSnipEdit', function() require('luasnip.loaders.from_lua').edit_snippet_files() end) 49 | 50 | -- is selecting within a list of options. 51 | map({ 's', 'i' }, '', function() 52 | if ls.choice_active() then ls.change_choice(1) end 53 | end) 54 | 55 | map({ 's', 'i' }, '', function() 56 | if not ls.expand_or_jumpable() then return '' end 57 | ls.expand_or_jump() 58 | end, { expr = true }) 59 | 60 | -- is easier to hit but swallows the digraph key 61 | map({ 's', 'i' }, '', function() 62 | if not ls.jumpable(-1) then return '' end 63 | ls.jump(-1) 64 | end, { expr = true }) 65 | 66 | require('luasnip.loaders.from_lua').lazy_load() 67 | -- NOTE: the loader is called twice so it picks up the defaults first then my custom textmate snippets. 68 | -- see: https://github.com/L3MON4D3/LuaSnip/issues/364 69 | require('luasnip.loaders.from_vscode').lazy_load() 70 | require('luasnip.loaders.from_vscode').lazy_load({ paths = './snippets/textmate' }) 71 | 72 | ls.filetype_extend('typescriptreact', { 'javascript', 'typescript' }) 73 | ls.filetype_extend('dart', { 'flutter' }) 74 | ls.filetype_extend('NeogitCommitMessage', { 'gitcommit' }) 75 | end, 76 | }, 77 | } 78 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/terminal.lua: -------------------------------------------------------------------------------- 1 | local fn = vim.fn 2 | 3 | return { 4 | 'akinsho/toggleterm.nvim', 5 | event = 'VeryLazy', 6 | dev = true, 7 | opts = { 8 | open_mapping = [[]], 9 | shade_filetypes = {}, 10 | direction = 'horizontal', 11 | autochdir = true, 12 | persist_mode = true, 13 | insert_mappings = false, 14 | start_in_insert = true, 15 | winbar = { enabled = as.ui.winbar.enable }, 16 | highlights = { 17 | FloatBorder = { link = 'FloatBorder' }, 18 | NormalFloat = { link = 'NormalFloat' }, 19 | }, 20 | float_opts = { 21 | border = as.ui.current.border, 22 | winblend = 3, 23 | }, 24 | size = function(term) 25 | if term.direction == 'horizontal' then 26 | return 15 27 | elseif term.direction == 'vertical' then 28 | return math.floor(vim.o.columns * 0.4) 29 | end 30 | end, 31 | }, 32 | config = function(_, opts) 33 | require('toggleterm').setup(opts) 34 | 35 | local float_handler = function(term) 36 | if not as.falsy(fn.mapcheck('jk', 't')) then 37 | vim.keymap.del('t', 'jk', { buffer = term.bufnr }) 38 | vim.keymap.del('t', '', { buffer = term.bufnr }) 39 | end 40 | end 41 | 42 | local Terminal = require('toggleterm.terminal').Terminal 43 | 44 | local lazygit = Terminal:new({ 45 | cmd = 'lazygit', 46 | dir = 'git_dir', 47 | hidden = true, 48 | direction = 'float', 49 | on_open = float_handler, 50 | }) 51 | 52 | local lazydocker = Terminal:new({ 53 | cmd = 'lazydocker', 54 | dir = 'git_dir', 55 | hidden = true, 56 | direction = 'float', 57 | on_open = float_handler, 58 | }) 59 | 60 | local btop = Terminal:new({ 61 | cmd = 'btop', 62 | hidden = true, 63 | direction = 'float', 64 | on_open = float_handler, 65 | highlights = { 66 | FloatBorder = { guibg = 'Black', guifg = 'DarkGray' }, 67 | NormalFloat = { guibg = 'Black' }, 68 | }, 69 | }) 70 | 71 | local gh_dash = Terminal:new({ 72 | cmd = 'gh dash', 73 | hidden = true, 74 | direction = 'float', 75 | on_open = float_handler, 76 | float_opts = { 77 | height = function() return math.floor(vim.o.lines * 0.8) end, 78 | width = function() return math.floor(vim.o.columns * 0.95) end, 79 | }, 80 | }) 81 | 82 | map('n', 'lh', function() gh_dash:toggle() end, { 83 | desc = 'toggleterm: toggle github dashboard', 84 | }) 85 | map('n', 'lg', function() lazygit:toggle() end, { 86 | desc = 'toggleterm: toggle lazygit', 87 | }) 88 | map('n', 'ld', function() lazydocker:toggle() end, { 89 | desc = 'toggleterm: toggle lazydocker', 90 | }) 91 | as.command('Btop', function() btop:toggle() end) 92 | end, 93 | } 94 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/testing.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: missing-fields 2 | local function neotest() return require('neotest') end 3 | local function open() neotest().output.open({ enter = true, short = false }) end 4 | local function run_file() neotest().run.run(vim.fn.expand('%')) end 5 | local function run_file_sync() neotest().run.run({ vim.fn.expand('%'), concurrent = false }) end 6 | local function nearest() neotest().run.run() end 7 | local function next_failed() neotest().jump.prev({ status = 'failed' }) end 8 | local function prev_failed() neotest().jump.next({ status = 'failed' }) end 9 | local function toggle_summary() neotest().summary.toggle() end 10 | local function cancel() neotest().run.stop({ interactive = true }) end 11 | 12 | return { 13 | { 14 | 'nvim-neotest/neotest', 15 | keys = { 16 | { 'ts', toggle_summary, desc = 'neotest: toggle summary' }, 17 | { 'to', open, desc = 'neotest: output' }, 18 | { 'tn', nearest, desc = 'neotest: run' }, 19 | { 'tf', run_file, desc = 'neotest: run file' }, 20 | { 'tF', run_file_sync, desc = 'neotest: run file synchronously' }, 21 | { 'tc', cancel, desc = 'neotest: cancel' }, 22 | { '[n', next_failed, desc = 'jump to next failed test' }, 23 | { ']n', prev_failed, desc = 'jump to previous failed test' }, 24 | }, 25 | config = function() 26 | local namespace = vim.api.nvim_create_namespace('neotest') 27 | vim.diagnostic.config({ 28 | virtual_text = { 29 | format = function(diagnostic) 30 | local value = diagnostic.message:gsub('\n', ' '):gsub('\t', ' '):gsub('%s+', ' '):gsub('^%s+', '') 31 | return value 32 | end, 33 | }, 34 | }, namespace) 35 | 36 | require('neotest').setup({ 37 | discovery = { enabled = true }, 38 | diagnostic = { enabled = true }, 39 | floating = { border = as.ui.current.border }, 40 | quickfix = { enabled = false, open = true }, 41 | adapters = { 42 | require('neotest-plenary'), 43 | require('neotest-go'), 44 | }, 45 | }) 46 | end, 47 | dependencies = { 48 | 'nvim-neotest/nvim-nio', 49 | { 'neotest/neotest-go', enabled = false }, 50 | { 'rcarriga/neotest-plenary', dependencies = { 'nvim-lua/plenary.nvim' } }, 51 | }, 52 | }, 53 | } 54 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/themes.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | 'akinsho/horizon.nvim', 4 | dev = true, 5 | lazy = false, 6 | priority = 1000, 7 | }, 8 | { 'projekt0n/github-nvim-theme', lazy = false, priority = 1000 }, 9 | { 'oxfist/night-owl.nvim', lazy = false, priority = 1000 }, 10 | } 11 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/tools.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | 'stevearc/conform.nvim', 4 | event = 'BufReadPre', 5 | opts = { 6 | formatters_by_ft = { 7 | lua = { 'stylua' }, 8 | javascript = { 'prettier' }, 9 | markdown = { 'prettier' }, 10 | go = { 'goimports', 'gofumpt' }, 11 | pgsql = { 'sql_formatter' }, 12 | sql = { 'sql_formatter' }, 13 | }, 14 | format_on_save = function(buf) 15 | if vim.g.formatting_disabled or vim.b[buf].formatting_disabled then return end 16 | return { timeout_ms = 500, lsp_fallback = true } 17 | end, 18 | }, 19 | config = function(_, opts) 20 | require('conform').setup(opts) 21 | require('conform.formatters.sql_formatter').args = function(ctx) 22 | local config_path = ctx.dirname .. '/.sql-formatter.json' 23 | if vim.uv.fs_stat(config_path) then return { '--config', config_path } end 24 | return { '--language', 'postgresql' } 25 | end 26 | end, 27 | }, 28 | { 29 | 'mfussenegger/nvim-lint', 30 | event = 'BufReadPre', 31 | init = function() 32 | vim.api.nvim_create_autocmd({ 'TextChanged' }, { 33 | callback = function() require('lint').try_lint() end, 34 | }) 35 | end, 36 | config = function() 37 | require('lint').linters_by_ft = { 38 | javascript = { 'eslint' }, 39 | markdown = { 'markdownlint' }, 40 | go = { 'golangcilint' }, 41 | } 42 | end, 43 | }, 44 | } 45 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/treesitter.lua: -------------------------------------------------------------------------------- 1 | local highlight = as.highlight 2 | 3 | return { 4 | { 5 | 'nvim-treesitter/nvim-treesitter', 6 | event = 'VeryLazy', 7 | build = ':TSUpdate', 8 | config = function() 9 | ---@diagnostic disable-next-line: missing-fields 10 | require('nvim-treesitter.configs').setup({ 11 | -- stylua: ignore 12 | ensure_installed = { 13 | 'c', 'vim', 'vimdoc', 'query', 'lua', 'luadoc', 'luap', 14 | 'diff', 'regex', 'gitcommit', 'git_config', 'git_rebase', 'markdown', 'markdown_inline', 15 | }, 16 | auto_install = true, 17 | highlight = { 18 | enable = true, 19 | additional_vim_regex_highlighting = { 'org', 'sql' }, 20 | }, 21 | incremental_selection = { 22 | enable = true, 23 | disable = { 'help' }, 24 | keymaps = { 25 | init_selection = '', -- maps in normal mode to init the node/scope selection 26 | node_incremental = '', -- increment to the upper named parent 27 | node_decremental = '', -- decrement to the previous node 28 | }, 29 | }, 30 | indent = { 31 | enable = true, 32 | disable = { 'yaml' }, 33 | }, 34 | textobjects = { 35 | lookahead = true, 36 | select = { 37 | enable = true, 38 | include_surrounding_whitespace = true, 39 | keymaps = { 40 | ['af'] = { query = '@function.outer', desc = 'ts: all function' }, 41 | ['if'] = { query = '@function.inner', desc = 'ts: inner function' }, 42 | ['ac'] = { query = '@class.outer', desc = 'ts: all class' }, 43 | ['ic'] = { query = '@class.inner', desc = 'ts: inner class' }, 44 | ['aC'] = { query = '@conditional.outer', desc = 'ts: all conditional' }, 45 | ['iC'] = { query = '@conditional.inner', desc = 'ts: inner conditional' }, 46 | ['aL'] = { query = '@assignment.lhs', desc = 'ts: assignment lhs' }, 47 | ['aR'] = { query = '@assignment.rhs', desc = 'ts: assignment rhs' }, 48 | }, 49 | }, 50 | move = { 51 | enable = true, 52 | set_jumps = true, 53 | goto_next_start = { [']m'] = '@function.outer', [']M'] = '@class.outer' }, 54 | goto_previous_start = { ['[m'] = '@function.outer', ['[M'] = '@class.outer' }, 55 | }, 56 | }, 57 | autopairs = { enable = true }, 58 | playground = { persist_queries = true }, 59 | query_linter = { 60 | enable = true, 61 | use_virtual_text = true, 62 | lint_events = { 'BufWrite', 'CursorHold' }, 63 | }, 64 | }) 65 | end, 66 | dependencies = { { 'nvim-treesitter/nvim-treesitter-textobjects' } }, 67 | }, 68 | { 69 | 'nvim-treesitter/nvim-treesitter-context', 70 | event = 'VeryLazy', 71 | init = function() 72 | highlight.plugin('treesitter-context', { 73 | { TreesitterContextSeparator = { link = 'Dim' } }, 74 | { TreesitterContext = { inherit = 'Normal' } }, 75 | { TreesitterContextLineNumber = { inherit = 'LineNr' } }, 76 | }) 77 | end, 78 | opts = { 79 | multiline_threshold = 4, 80 | separator = '─', -- alternatives: ▁ ─ ▄ 81 | mode = 'cursor', 82 | }, 83 | }, 84 | } 85 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/plugins/whichkey.lua: -------------------------------------------------------------------------------- 1 | local highlight = as.highlight 2 | 3 | return { 4 | 'folke/which-key.nvim', 5 | event = 'VeryLazy', 6 | config = function() 7 | highlight.plugin('whichkey', { 8 | theme = { 9 | ['*'] = { { WhichkeyFloat = { link = 'NormalFloat' } } }, 10 | horizon = { { WhichKeySeparator = { link = 'Todo' } } }, 11 | }, 12 | }) 13 | 14 | local wk = require('which-key') 15 | wk.setup({ 16 | plugins = { spelling = { enabled = true } }, 17 | win = { border = as.ui.current.border }, 18 | preset = 'modern', 19 | }) 20 | 21 | wk.add({ 22 | { ']', group = 'next' }, 23 | { '[', group = 'prev' }, 24 | { 'gc', group = 'comment' }, 25 | { 'gb', group = 'bufferline' }, 26 | { 'a', group = 'projectionist' }, 27 | { 'c', group = 'code-action' }, 28 | { 'd', group = 'debugprint' }, 29 | { 'm', group = 'marks' }, 30 | { 'f', group = 'picker' }, 31 | { 'h', group = 'git-action' }, 32 | { 'n', group = 'new' }, 33 | { 'j', group = 'jump' }, 34 | { 'p', group = 'packages' }, 35 | { 'q', group = 'quit' }, 36 | { 'l', group = 'list' }, 37 | { 'i', group = 'iswap' }, 38 | { 'e', group = 'edit' }, 39 | { 'r', group = 'lsp-refactor' }, 40 | { 'o', group = 'only' }, 41 | { 't', group = 'tab' }, 42 | { 's', group = 'source/swap' }, 43 | { 'y', group = 'yank' }, 44 | { 'O', group = 'options' }, 45 | { '', group = 'local leader' }, 46 | { 'd', group = 'dap' }, 47 | { 'g', group = 'git' }, 48 | { 'o', group = 'neorg' }, 49 | { 't', group = 'neotest' }, 50 | { 'w', group = 'window' }, 51 | }) 52 | end, 53 | } 54 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/servers.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: missing-fields 2 | -----------------------------------------------------------------------------// 3 | -- Language servers 4 | -----------------------------------------------------------------------------// 5 | -- svelte requires the additional installation of the typescript-svelte-plugin, per project 6 | -- https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin#usage 7 | 8 | ---@type lspconfig.options 9 | local servers = { 10 | sqlls = false, 11 | eslint = {}, 12 | ccls = {}, 13 | jsonls = { 14 | settings = { 15 | json = { 16 | schemas = require('schemastore').json.schemas(), 17 | validate = { enable = true }, 18 | }, 19 | }, 20 | }, 21 | bashls = {}, 22 | vimls = {}, 23 | terraformls = {}, 24 | marksman = {}, 25 | pyright = {}, 26 | buf_ls = {}, 27 | prosemd_lsp = {}, 28 | docker_compose_language_service = function() 29 | local lspconfig = require('lspconfig') 30 | return { 31 | root_dir = lspconfig.util.root_pattern('docker-compose.yml'), 32 | filetypes = { 'yaml', 'dockerfile' }, 33 | } 34 | end, 35 | graphql = { 36 | on_attach = function(client) 37 | -- Disable workspaceSymbolProvider because this prevents 38 | -- searching for symbols in typescript files which this server 39 | -- is also enabled for. 40 | -- @see: https://github.com/nvim-telescope/telescope.nvim/issues/964 41 | client.server_capabilities.workspaceSymbolProvider = false 42 | end, 43 | }, 44 | --- https://github.com/golang/tools/blob/master/gopls/doc/settings.md 45 | gopls = { 46 | settings = { 47 | gopls = { 48 | gofumpt = true, 49 | codelenses = { 50 | generate = true, 51 | gc_details = false, 52 | test = true, 53 | tidy = true, 54 | }, 55 | hints = { 56 | assignVariableTypes = false, 57 | compositeLiteralFields = true, 58 | constantValues = true, 59 | parameterNames = true, 60 | functionTypeParameters = false, 61 | rangeVariableTypes = false, 62 | }, 63 | analyses = { 64 | unusedparams = true, 65 | }, 66 | semanticTokens = true, 67 | usePlaceholders = true, 68 | completeUnimported = true, 69 | staticcheck = true, 70 | directoryFilters = { '-node_modules', '-vendor' }, 71 | }, 72 | }, 73 | }, 74 | jdtls = {}, 75 | yamlls = { 76 | settings = { 77 | yaml = { 78 | customTags = { 79 | '!reference sequence', -- necessary for gitlab-ci.yaml files 80 | }, 81 | }, 82 | }, 83 | }, 84 | lua_ls = { 85 | settings = { 86 | Lua = { 87 | codeLens = { enable = true }, 88 | hint = { enable = true, arrayIndex = 'Disable', setType = false, paramName = 'Disable', paramType = true }, 89 | format = { enable = false }, 90 | diagnostics = { 91 | globals = { 'vim', 'P', 'describe', 'it', 'before_each', 'after_each', 'packer_plugins', 'pending' }, 92 | }, 93 | completion = { keywordSnippet = 'Replace', callSnippet = 'Replace' }, 94 | workspace = { checkThirdParty = false }, 95 | telemetry = { enable = false }, 96 | }, 97 | }, 98 | }, 99 | } 100 | 101 | ---Get the configuration for a specific language server 102 | ---@param name string? 103 | ---@return table? 104 | return function(name) 105 | local config = name and servers[name] or {} 106 | if not config then return end 107 | if type(config) == 'function' then config = config() end 108 | config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) 109 | return config 110 | end 111 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/vscode/init.lua: -------------------------------------------------------------------------------- 1 | local vscode = require('vscode') 2 | local map = function(...) vim.keymap.set(...) end 3 | 4 | vim.notify = vscode.notify 5 | vim.g.clipboard = vim.g.vscode_clipboard 6 | 7 | vim.opt.clipboard = 'unnamedplus' 8 | vim.opt.undofile = true 9 | vim.opt.undolevels = 1000 10 | vim.opt.undolevels = 10000 11 | vim.opt.virtualedit = 'block' 12 | vim.opt.wildmode = 'longest:full,full' 13 | vim.opt.scrolloff = 5 14 | 15 | local function vscode_action(cmd) 16 | return function() vscode.action(cmd) end 17 | end 18 | 19 | map('n', 'qq', 'Tabclose') 20 | map('n', ']', "put =repeat(nr2char(10), v:count1) '[-1") 21 | map('n', '[', "put! =repeat(nr2char(10), v:count1) ']+1") 22 | map('n', 'l', 'nohlsearch') 23 | map('n', '', vscode_action('workbench.action.nextEditor')) 24 | map('n', '', vscode_action('workbench.action.previousEditor')) 25 | map({ 'n', 'x' }, '', vscode_action('workbench.action.navigateLeft')) 26 | map({ 'n', 'x' }, '', vscode_action('workbench.action.navigateDown')) 27 | map({ 'n', 'x' }, '', vscode_action('workbench.action.navigateUp')) 28 | map({ 'n', 'x' }, '', vscode_action('workbench.action.navigateRight')) 29 | map('n', '[d', vscode_action('editor.action.marker.prev')) 30 | map('n', ']d', vscode_action('editor.action.marker.next')) 31 | map('n', 'fo', vscode_action('workbench.action.showAllEditors')) 32 | map('n', 'ff', vscode_action('workbench.action.quickOpen')) 33 | map('n', 'ca', vscode_action('editor.action.quickFix')) 34 | map('n', 'rn', vscode_action('editor.action.rename')) 35 | map('n', 'rf', vscode_action('editor.action.formatDocument')) 36 | map('v', 'rf', vscode_action('editor.action.formatSelection')) 37 | map('n', 'gr', vscode_action('editor.action.goToReferences')) 38 | map({ 'n', 'v' }, 'nd', vscode_action('notifications.clearAll')) 39 | map({ 'n', 'x', 'i' }, '', function() 40 | vscode.with_insert(function() vscode.action('editor.action.addSelectionToNextFindMatch') end) 41 | end) 42 | -------------------------------------------------------------------------------- 43 | -- PLUGINS 44 | -------------------------------------------------------------------------------- 45 | map('n', 'gs', vscode_action('magit.status')) 46 | -------------------------------------------------------------------------------- 47 | map({ 'n' }, 'm;', vscode_action('bookmarks.toggle'), { desc = 'Toogle Bookmark' }) 48 | map({ 'n' }, 'm:', vscode_action('bookmarks.toggleLabeled'), { desc = 'Toogle Bookmark Label' }) 49 | map({ 'n' }, 'm/', vscode_action('bookmarks.listFromAllFiles'), { desc = 'List All Bookmarks' }) 50 | -------------------------------------------------------------------------------- 51 | map('n', 'sv', function() 52 | vscode.action('vscode-neovim.restart') 53 | vim.notify('Restarting Neovim', vim.log.levels.INFO, { title = 'vscode' }) 54 | end, { silent = true }) 55 | 56 | map('n', 'ev', function() 57 | vim.cmd('edit $HOME/.config/nvim/init.lua') 58 | vim.notify('Opening NVIM config file', vim.log.levels.INFO, { title = 'vscode' }) 59 | end, { silent = true }) 60 | -------------------------------------------------------------------------------- 61 | -- better up/down 62 | -------------------------------------------------------------------------------- 63 | map({ 'n', 'x' }, 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) 64 | map({ 'n', 'x' }, 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) 65 | -------------------------------------------------------------------------------- 66 | map('n', 'nf', vscode_action('workbench.action.files.newUntitledFile'), { desc = 'New file' }) 67 | map('n', 'ff', vscode_action('workbench.action.quickOpen'), { desc = 'Open file finder' }) 68 | map('n', 'fs', vscode_action('workbench.action.findInFiles'), { desc = 'Search in files' }) 69 | map('n', '[h', vscode_action('workbench.action.editor.previousChange'), { desc = 'Previous change' }) 70 | map('n', ']h', vscode_action('workbench.action.editor.nextChange'), { desc = 'Next change' }) 71 | 72 | local manageEditorSize = function(...) 73 | local count = select(1, ...) 74 | local to = select(2, ...) 75 | for i = 1, (count and count > 0 and count or 1) do 76 | vscode.call(to == 'increase' and 'workbench.action.increaseViewSize' or 'workbench.action.decreaseViewSize') 77 | end 78 | end 79 | 80 | -- These keys represent alt left and right 81 | map('n', '¬', function() manageEditorSize(vim.v.count, 'increase') end, { noremap = true, silent = true }) 82 | map('n', '˙', function() manageEditorSize(vim.v.count, 'decrease') end, { noremap = true, silent = true }) 83 | 84 | map('n', '>', function() manageEditorSize(vim.v.count, 'increase') end, { noremap = true, silent = true }) 85 | map('x', '>', function() manageEditorSize(vim.v.count, 'increase') end, { noremap = true, silent = true }) 86 | map('n', '+', function() manageEditorSize(vim.v.count, 'increase') end, { noremap = true, silent = true }) 87 | map('x', '+', function() manageEditorSize(vim.v.count, 'increase') end, { noremap = true, silent = true }) 88 | map('n', '<', function() manageEditorSize(vim.v.count, 'decrease') end, { noremap = true, silent = true }) 89 | map('x', '<', function() manageEditorSize(vim.v.count, 'decrease') end, { noremap = true, silent = true }) 90 | map('n', '-', function() manageEditorSize(vim.v.count, 'decrease') end, { noremap = true, silent = true }) 91 | map('x', '-', function() manageEditorSize(vim.v.count, 'decrease') end, { noremap = true, silent = true }) 92 | -------------------------------------------------------------------------------- /.config/nvim/lua/as/vscode/plugins.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | 'vscode-neovim/vscode-multi-cursor.nvim', 4 | event = 'VeryLazy', 5 | opts = {}, 6 | }, 7 | { 8 | 'chaoren/vim-wordmotion', 9 | lazy = false, 10 | init = function() vim.g.wordmotion_spaces = { '-', '_', '\\/', '\\.' } end, 11 | }, 12 | { 13 | 'kylechui/nvim-surround', 14 | version = '*', 15 | keys = { { 's', mode = 'v' }, 's', 'S', 'ys', 'yss', 'yS', 'cs', 'ds' }, 16 | opts = { move_cursor = true, keymaps = { visual = 's' } }, 17 | }, 18 | { 19 | 'windwp/nvim-autopairs', 20 | event = 'InsertEnter', 21 | config = function() 22 | require('nvim-autopairs').setup({ 23 | close_triple_quotes = true, 24 | disable_filetype = { 'neo-tree-popup' }, 25 | check_ts = true, 26 | fast_wrap = { map = '' }, 27 | ts_config = { 28 | lua = { 'string' }, 29 | dart = { 'string' }, 30 | javascript = { 'template_string' }, 31 | }, 32 | }) 33 | end, 34 | }, 35 | -------------------------------------------------------------------------------- 36 | -- TPOPE {{{1 37 | -------------------------------------------------------------------------------- 38 | { 'tpope/vim-repeat', event = 'VeryLazy' }, 39 | { 40 | 'tpope/vim-abolish', 41 | keys = { 42 | { 43 | '[', 44 | ':S///', 45 | mode = 'n', 46 | silent = false, 47 | desc = 'abolish: replace word under the cursor (line)', 48 | }, 49 | { 50 | ']', 51 | ':%S///c', 52 | mode = 'n', 53 | silent = false, 54 | desc = 'abolish: replace word under the cursor (file)', 55 | }, 56 | { 57 | '[', 58 | [["zy:'<'>S/"//c]], 59 | mode = 'x', 60 | silent = false, 61 | desc = 'abolish: replace word under the cursor (visual)', 62 | }, 63 | }, 64 | }, 65 | { 66 | 'echasnovski/mini.ai', 67 | event = 'VeryLazy', 68 | config = function() require('mini.ai').setup({ mappings = { around_last = '', inside_last = '' } }) end, 69 | }, 70 | { 71 | 'glts/vim-textobj-comment', 72 | dependencies = { { 'kana/vim-textobj-user', dependencies = { 'kana/vim-operator-user' } } }, 73 | init = function() vim.g.textobj_comment_no_default_key_mappings = 1 end, 74 | keys = { 75 | { 'ax', '(textobj-comment-a)', mode = { 'x', 'o' } }, 76 | { 'ix', '(textobj-comment-i)', mode = { 'x', 'o' } }, 77 | }, 78 | }, 79 | } 80 | -------------------------------------------------------------------------------- /.config/nvim/luasnippets/all.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: undefined-global 2 | 3 | return { 4 | snippet({ trig = 'td', name = 'TODO' }, { 5 | d(1, function() 6 | local function with_cmt(cmt) return string.format(vim.bo.commentstring, ' ' .. cmt) end 7 | return snippet('', { 8 | c(1, { 9 | t(with_cmt('TODO: ')), 10 | t(with_cmt('FIXME: ')), 11 | t(with_cmt('HACK: ')), 12 | t(with_cmt('BUG: ')), 13 | }), 14 | }) 15 | end), 16 | i(0), 17 | }), 18 | snippet( 19 | { trig = 'hr', name = 'Header' }, 20 | fmt( 21 | [[ 22 | {1} 23 | {2} {3} 24 | {1} 25 | {4} 26 | ]], 27 | { 28 | f(function() 29 | local comment = string.format(vim.bo.commentstring:gsub(' ', '') or '#%s', '-') 30 | local col = vim.bo.textwidth or 80 31 | return comment .. string.rep('-', col - #comment) 32 | end), 33 | f(function() return vim.bo.commentstring:gsub('%%s', '') end), 34 | i(1, 'HEADER'), 35 | i(0), 36 | } 37 | ) 38 | ), 39 | } 40 | -------------------------------------------------------------------------------- /.config/nvim/luasnippets/dart.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: undefined-global 2 | 3 | return { 4 | snippet( 5 | { 6 | trig = 'pr', 7 | name = 'print', 8 | dscr = 'print a variable optionally wrapping it with braces', 9 | }, 10 | fmt([[print('{}: ${}');]], { 11 | i(1, { 'label' }), 12 | m(1, '%.', '{' .. l._1 .. '}', l._1), 13 | }) 14 | ), 15 | } 16 | -------------------------------------------------------------------------------- /.config/nvim/luasnippets/gitcommit.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: undefined-global 2 | return { 3 | snippet({ trig = 'lz', name = 'Lazy lockfile' }, { 4 | t('chore(lazy): update lockfile'), 5 | }), 6 | } 7 | -------------------------------------------------------------------------------- /.config/nvim/luasnippets/go.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: undefined-global 2 | return { 3 | snippet( 4 | { trig = 'pr', name = 'print var', dscr = 'Print a variable' }, 5 | fmt('fmt.Println({})', { 6 | i(1, 'value'), 7 | }) 8 | ), 9 | } 10 | -------------------------------------------------------------------------------- /.config/nvim/luasnippets/help.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: undefined-global 2 | 3 | return { 4 | snippet({ trig = 'con', wordTrig = true }, { 5 | i(1), 6 | f(function(args) return { ' ' .. string.rep('.', 80 - (#args[1][1] + #args[2][1] + 2 + 2)) .. ' ' } end, { 1, 2 }), 7 | t({ '|' }), 8 | i(2), 9 | t({ '|' }), 10 | i(0), 11 | }), 12 | } 13 | -------------------------------------------------------------------------------- /.config/nvim/luasnippets/lua.lua: -------------------------------------------------------------------------------- 1 | local fn, api = vim.fn, vim.api 2 | 3 | local function import_suffix(import_name) 4 | local parts = vim.split(import_name[1][1], '.', true) 5 | return parts[#parts] or '' 6 | end 7 | 8 | ---@diagnostic disable: undefined-global 9 | return { 10 | snippet( 11 | { 12 | trig = 'cfg', 13 | name = 'config key', 14 | dscr = 'package manager config key', 15 | }, 16 | fmt( 17 | [[ 18 | , config = function() 19 | require("{}").setup() 20 | end 21 | ]], 22 | { i(1) } 23 | ) 24 | ), 25 | snippet( 26 | { 27 | trig = 'vs', 28 | name = 'vim schedule', 29 | dscr = 'Schedule a function on the vim event loop', 30 | }, 31 | fmt( 32 | [[ 33 | vim.schedule(function() 34 | {} 35 | end) 36 | ]], 37 | { i(1) } 38 | ) 39 | ), 40 | snippet( 41 | { 42 | trig = 'req', 43 | name = 'require module', 44 | dscr = 'Require a module and set the import to the last word', 45 | }, 46 | fmt([[local {} = require("{}")]], { 47 | f(import_suffix, { 1 }), 48 | i(1), 49 | }) 50 | ), 51 | snippet( 52 | { 53 | trig = 'lreq', 54 | name = 'lazy require module', 55 | dscr = 'Lazy require a module and set the import to the last word', 56 | }, 57 | fmt( 58 | [[ 59 | local {1} = lazy.require("{2}") ---@module "{3}" 60 | ]], 61 | { 62 | f(import_suffix, { 1 }), 63 | i(1), 64 | rep(1), 65 | } 66 | ) 67 | ), 68 | snippet( 69 | { 70 | trig = 'plg', 71 | name = 'plugin spec', 72 | dscr = { 73 | 'plugin spec block', 74 | 'e.g.', 75 | "{'author/plugin'}", 76 | }, 77 | }, 78 | fmt([[{{"{}"{}}}]], { 79 | d(1, function() 80 | -- Get the author and URL in the clipboard and auto populate the author and project 81 | local default = snippet('', { i(1, 'author'), t('/'), i(2, 'plugin') }) 82 | local clip = fn.getreg('*') 83 | if not vim.startswith(clip, 'https://github.com/') then return default end 84 | local parts = vim.split(clip, '/') 85 | if #parts < 2 then return default end 86 | local author, project = parts[#parts - 1], parts[#parts] 87 | return snippet('', { t(author .. '/' .. project) }) 88 | end), 89 | c(2, { 90 | fmt( 91 | [[ 92 | , config = function() 93 | require("{}").setup() 94 | end 95 | ]], 96 | { i(1, 'module') } 97 | ), 98 | t(''), 99 | }), 100 | }) 101 | ), 102 | }, { 103 | s( 104 | { 105 | trig = 'if', 106 | condition = function() 107 | local ignored_nodes = { 'string', 'comment' } 108 | local pos = api.nvim_win_get_cursor(0) 109 | local row, col = pos[1] - 1, pos[2] - 1 110 | local node_type = vim.treesitter.get_node({ pos = { row, col } }):type() 111 | return not vim.tbl_contains(ignored_nodes, node_type) 112 | end, 113 | }, 114 | fmt( 115 | [[ 116 | if {} then 117 | {} 118 | end 119 | ]], 120 | { i(1), i(2) } 121 | ) 122 | ), 123 | } 124 | -------------------------------------------------------------------------------- /.config/nvim/luasnippets/vim.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: undefined-global 2 | return { 3 | snippet( 4 | { 5 | trig = 'eof', 6 | name = 'Create Heredoc', 7 | dscr = 'Create a heredoc', 8 | }, 9 | fmt( 10 | [[ 11 | EOF << lua 12 | {} 13 | EOF 14 | ]], 15 | { i(1) } 16 | ) 17 | ), 18 | } 19 | -------------------------------------------------------------------------------- /.config/nvim/plugin/env.lua: -------------------------------------------------------------------------------- 1 | if not as then return end 2 | 3 | local api, fn, fs = vim.api, vim.fn, vim.fs 4 | local fmt = string.format 5 | 6 | local function read_file(file, line_handler) 7 | for line in io.lines(file) do 8 | line_handler(line) 9 | end 10 | end 11 | 12 | api.nvim_create_user_command('DotEnv', function() 13 | local files = fs.find('.env', { 14 | upward = true, 15 | stop = fn.fnamemodify(fn.getcwd(), ':p:h:h'), 16 | path = fn.expand('%:p:h'), 17 | type = 'file', 18 | limit = 1, 19 | }) 20 | if vim.tbl_isempty(files) then return end 21 | local filename, lines = files[1], {} 22 | read_file(filename, function(line) 23 | if #line > 0 then table.insert(lines, line) end 24 | if not vim.startswith(line, '#') then 25 | local name, value = unpack(vim.split(line, '=')) 26 | fn.setenv(name, value) 27 | end 28 | end) 29 | local markdown = table.concat(vim.iter({ '', '```sh', lines, '```', '' }):flatten():totable(), '\n') 30 | vim.notify(fmt('Read **%s**\n', filename) .. markdown, 'info', { 31 | title = 'Nvim Env', 32 | on_open = function(win) 33 | local buf = api.nvim_win_get_buf(win) 34 | if not api.nvim_buf_is_valid(buf) then return end 35 | vim.bo[buf].filetype = 'markdown' 36 | end, 37 | }) 38 | end, {}) 39 | -------------------------------------------------------------------------------- /.config/nvim/plugin/filetypes.lua: -------------------------------------------------------------------------------- 1 | if not as then return end 2 | local settings, highlight = as.filetype_settings, as.highlight 3 | local cmd, fn = vim.cmd, vim.fn 4 | 5 | vim.treesitter.language.register('gitcommit', 'NeogitCommitMessage') 6 | 7 | settings({ 8 | checkhealth = { 9 | opt = { spell = false }, 10 | }, 11 | ['dap-repl'] = { 12 | opt = { 13 | buflisted = false, 14 | winfixheight = true, 15 | signcolumn = 'yes:2', 16 | }, 17 | function() as.adjust_split_height(12, math.floor(vim.o.lines * 0.3)) end, 18 | }, 19 | fzf = { 20 | function(args) 21 | -- remove the default terminal mappings 22 | vim.keymap.del('t', '', { buffer = args.buf }) 23 | vim.keymap.del('t', 'jk', { buffer = args.buf }) 24 | end, 25 | }, 26 | [{ 'gitcommit', 'gitrebase' }] = { 27 | bo = { bufhidden = 'delete' }, 28 | opt = { 29 | list = false, 30 | spell = true, 31 | spelllang = 'en_gb', 32 | }, 33 | }, 34 | go = { 35 | bo = { 36 | expandtab = false, 37 | softtabstop = 0, 38 | tabstop = 4, 39 | shiftwidth = 4, 40 | textwidth = 120, 41 | }, 42 | opt = { spell = true }, 43 | mappings = { 44 | { 'n', 'gb', 'GoBuild', desc = 'build' }, 45 | { 'n', 'gfs', 'GoFillStruct', desc = 'fill struct' }, 46 | { 'n', 'gfp', 'GoFixPlurals', desc = 'fix plurals' }, 47 | { 'n', 'gie', 'GoIfErr', desc = 'if err' }, 48 | }, 49 | }, 50 | ['Neogit*'] = { 51 | wo = { winbar = '' }, 52 | }, 53 | NeogitCommitMessage = { 54 | opt = { 55 | spell = true, 56 | spelllang = 'en_gb', 57 | list = false, 58 | }, 59 | function() 60 | vim.schedule(function() 61 | -- Schedule this call as highlights are not set correctly if there is not a delay 62 | highlight.set_winhl('gitcommit', 0, { { VirtColumn = { fg = { from = 'Variable' } } } }) 63 | end) 64 | end, 65 | }, 66 | netrw = { 67 | g = { 68 | netrw_liststyle = 3, 69 | netrw_banner = 0, 70 | netrw_browse_split = 0, 71 | netrw_winsize = 25, 72 | netrw_altv = 1, 73 | netrw_fastbrowse = 0, 74 | }, 75 | bo = { bufhidden = 'wipe' }, 76 | mappings = { 77 | { 'n', 'q', 'q' }, 78 | { 'n', 'l', '' }, 79 | { 'n', 'h', '' }, 80 | { 'n', 'o', '' }, 81 | }, 82 | }, 83 | norg = { 84 | plugins = { 85 | ['nvim-surround'] = function(surround) 86 | surround.buffer_setup({ 87 | surrounds = { 88 | l = { add = function() return { { '[' }, { ']{' .. vim.fn.getreg('*') .. '}' } } end }, 89 | }, 90 | }) 91 | end, 92 | }, 93 | }, 94 | org = { 95 | opt = { 96 | spell = true, 97 | signcolumn = 'yes', 98 | }, 99 | plugins = { 100 | ['nvim-surround'] = function(surround) 101 | surround.buffer_setup({ 102 | surrounds = { 103 | l = { 104 | add = function() return { { ('[[%s]['):format(fn.getreg('*')) }, { ']]' } } end, 105 | }, 106 | }, 107 | }) 108 | end, 109 | }, 110 | }, 111 | [{ 'javascript', 'javascriptreact' }] = { 112 | bo = { textwidth = 100 }, 113 | opt = { spell = true }, 114 | }, 115 | startuptime = { 116 | function() cmd.wincmd('H') end, -- open startup time to the left 117 | }, 118 | [{ 'typescript', 'typescriptreact' }] = { 119 | bo = { textwidth = 100 }, 120 | opt = { spell = true }, 121 | mappings = { 122 | { 'n', 'gd', 'TypescriptGoToSourceDefinition', desc = 'typescript: go to source definition' }, 123 | }, 124 | }, 125 | [{ 'lua', 'python', 'rust' }] = { opt = { spell = true } }, 126 | }) 127 | -------------------------------------------------------------------------------- /.config/nvim/plugin/lastplace.lua: -------------------------------------------------------------------------------- 1 | if not as then return end 2 | local fn = vim.fn 3 | -- adapted from https://github.com/ethanholz/nvim-lastplace/blob/main/lua/nvim-lastplace/init.lua 4 | local ignore_buftype = { 'quickfix', 'nofile', 'help', 'terminal' } 5 | local ignore_filetype = { 'gitcommit', 'gitrebase', 'svn', 'hgcommit' } 6 | 7 | as.augroup('LastPlace', { 8 | event = { 'BufWinEnter', 'FileType' }, 9 | command = function() 10 | if vim.tbl_contains(ignore_buftype, vim.bo.buftype) then return end 11 | 12 | if vim.tbl_contains(ignore_filetype, vim.bo.filetype) then 13 | -- reset cursor to first line 14 | vim.cmd('normal! gg') 15 | return 16 | end 17 | 18 | -- If a line has already been specified on the command line, we are done e.g. nvim file +num 19 | if fn.line('.') > 1 then return end 20 | 21 | local last_line = fn.line([['"]]) 22 | local buff_last_line = fn.line('$') 23 | 24 | -- If the last line is set and the less than the last line in the buffer 25 | if last_line > 0 and last_line <= buff_last_line then 26 | local win_last_line = fn.line('w$') 27 | local win_first_line = fn.line('w0') 28 | -- Check if the last line of the buffer is the same as the win 29 | if win_last_line == buff_last_line then 30 | vim.cmd('normal! g`"') -- Set line to last line edited 31 | -- Try to center 32 | elseif buff_last_line - last_line > ((win_last_line - win_first_line) / 2) - 1 then 33 | vim.cmd('normal! g`"zz') 34 | else 35 | vim.cmd([[normal! G'"]]) 36 | end 37 | end 38 | end, 39 | }) 40 | -------------------------------------------------------------------------------- /.config/nvim/plugin/numbers.lua: -------------------------------------------------------------------------------- 1 | if not as then return end 2 | local ui = as.ui 3 | 4 | -- Inspiration 5 | -- 1. vim-relativity 6 | -- 2. numbers.vim - https://github.com/myusuf3/numbers.vim/blob/master/plugin/numbers.vim 7 | 8 | local api, fn = vim.api, vim.fn 9 | local M = {} 10 | 11 | local function is_floating_win() return fn.win_gettype() == 'popup' end 12 | 13 | local is_enabled = true 14 | 15 | ---Determines whether or not a window should be ignored by this plugin 16 | ---@return boolean 17 | local function is_ignored() return is_floating_win() end 18 | 19 | -- block list certain plugins and buffer types 20 | local function is_blocked() 21 | local win_type = fn.win_gettype() 22 | if not api.nvim_buf_is_valid(0) and not api.nvim_buf_is_loaded(0) then return true end 23 | if win_type == 'command' or vim.wo.diff or vim.wo.previewwindow then return true end 24 | 25 | local decs = ui.decorations.get({ ft = vim.bo.ft, bt = vim.bo.bt, setting = 'number' }) 26 | return decs.ft == false or decs.bt == false 27 | end 28 | 29 | local function enable_relative_number() 30 | if not is_enabled then return end 31 | if is_ignored() then return end 32 | local enabled = not is_blocked() 33 | vim.wo.number, vim.wo.relativenumber = enabled, enabled 34 | end 35 | 36 | local function disable_relative_number() 37 | if is_ignored() then return end 38 | vim.wo.number, vim.wo.relativenumber = not is_blocked(), false 39 | end 40 | 41 | as.command('ToggleRelativeNumber', function() 42 | is_enabled = not is_enabled 43 | if is_enabled then 44 | enable_relative_number() 45 | else 46 | disable_relative_number() 47 | end 48 | end) 49 | 50 | as.augroup('ToggleRelativeLineNumbers', { 51 | event = { 'BufEnter', 'FileType', 'FocusGained', 'InsertLeave' }, 52 | command = enable_relative_number, 53 | }, { 54 | event = { 'FocusLost', 'BufLeave', 'InsertEnter', 'TermOpen' }, 55 | command = disable_relative_number, 56 | }) 57 | 58 | return M 59 | -------------------------------------------------------------------------------- /.config/nvim/plugin/rooter.lua: -------------------------------------------------------------------------------- 1 | if not as then return end 2 | local fn, fs, api = vim.fn, vim.fs, vim.api 3 | 4 | ---------------------------------------------------------------------------------------------------- 5 | -- Project root finder 6 | ---------------------------------------------------------------------------------------------------- 7 | 8 | local root_names = { '.git', 'Makefile', 'go.mod', 'go.sum' } 9 | 10 | -- Cache to use for speed up (at cost of possibly outdated results) 11 | local root_cache = {} 12 | 13 | ---@param buf number 14 | ---@return string? 15 | ---@return string? 16 | local function get_lsp_root(buf) 17 | local clients = vim.lsp.get_clients({ bufnr = buf }) 18 | if not next(clients) then return end 19 | 20 | for _, client in pairs(clients) do 21 | local filetypes = client.config.filetypes 22 | if filetypes and vim.tbl_contains(filetypes, vim.bo[buf].ft) then return client.config.root_dir, client.name end 23 | end 24 | end 25 | 26 | ---@param args AutocmdArgs 27 | local function set_root(args) 28 | local path = api.nvim_buf_get_name(args.buf) 29 | if path == '' then return end 30 | path = fs.dirname(path) 31 | 32 | -- Try cache and resort to searching upward for root directory 33 | local root = root_cache[path] 34 | if not root then 35 | -- Currently this prefers marker files over the lsp root but swapping the order will change that 36 | local root_file = fs.find(root_names, { 37 | path = path, 38 | upward = true, 39 | })[1] 40 | 41 | root = fs.dirname(root_file) or get_lsp_root(args.buf) 42 | end 43 | if not root or not path then return end 44 | root_cache[path] = root 45 | if root == fn.getcwd() then return end 46 | 47 | fn.chdir(root) 48 | end 49 | 50 | as.augroup('FindProjectRoot', { event = 'BufEnter', command = set_root }) 51 | -------------------------------------------------------------------------------- /.config/nvim/plugin/statuscolumn.lua: -------------------------------------------------------------------------------- 1 | if not as or not as.ui.statuscolumn.enable then return end 2 | 3 | ---@alias ExtmarkSign {[1]: number, [2]: number, [3]: number, [4]: {sign_text: string, sign_hl_group: string}} 4 | 5 | local str = require('as.strings') 6 | local section, spacer, display = str.section, str.spacer, str.display 7 | local fn, v, api, opt = vim.fn, vim.v, vim.api, vim.opt 8 | local ui, sep, falsy = as.ui, as.ui.icons.separators, as.falsy 9 | 10 | local MIN_SIGN_WIDTH, space = 1, ' ' 11 | local fcs = opt.fillchars:get() 12 | local shade, separator = sep.light_shade_block, sep.left_thin_block -- '│' 13 | 14 | local function fdm(lnum) 15 | if fn.foldlevel(lnum) <= fn.foldlevel(lnum - 1) then return space end 16 | return fn.foldclosed(lnum) == -1 and fcs.foldopen or fcs.foldclose 17 | end 18 | 19 | ---@param win integer 20 | ---@param line_count integer 21 | ---@param lnum integer 22 | ---@param relnum integer 23 | ---@param virtnum integer 24 | ---@return string 25 | local function nr(win, lnum, relnum, virtnum, line_count) 26 | local col_width = api.nvim_strwidth(tostring(line_count)) 27 | if virtnum and virtnum ~= 0 then return space:rep(col_width - 1) .. (virtnum < 0 and shade or space) end -- virtual line 28 | local num = vim.wo[win].relativenumber and not falsy(relnum) and relnum or lnum 29 | if line_count > 999 then col_width = col_width + 1 end 30 | local ln = tostring(num):reverse():gsub('(%d%d%d)', '%1,'):reverse():gsub('^,', '') 31 | local num_width = col_width - api.nvim_strwidth(ln) 32 | return string.rep(space, num_width) .. ln 33 | end 34 | 35 | ---@generic T:table 36 | ---@param t T the object to format 37 | ---@param k string the key to format 38 | ---@return T? 39 | local function format_text(t, k) 40 | local txt = (t and t[k]) and t[k]:gsub('%s', '') or '' 41 | if #txt < 1 then return end 42 | t[k] = txt 43 | return t 44 | end 45 | 46 | ---@param curbuf integer 47 | ---@return StringComponent[], StringComponent[] 48 | local function extmark_signs(curbuf, lnum) 49 | lnum = lnum - 1 50 | ---@type ExtmarkSign[] 51 | local signs = api.nvim_buf_get_extmarks(curbuf, -1, { lnum, 0 }, { lnum, -1 }, { details = true, type = 'sign' }) 52 | local sns = vim 53 | .iter(signs) 54 | :map(function(item) return format_text(item[4], 'sign_text') end) 55 | :fold({ git = {}, other = {} }, function(acc, item) 56 | local txt, hl = item.sign_text, item.sign_hl_group 57 | local is_git = hl:match('^Git') 58 | local target = is_git and acc.git or acc.other 59 | table.insert(target, { { { txt, hl } }, after = '' }) 60 | return acc 61 | end) 62 | if #sns.git == 0 then sns.git = { str.spacer(1) } end 63 | return sns.git, sns.other 64 | end 65 | 66 | --- The vast majority of the complexity in this statuscolumn is due to the fact 67 | --- that you cannot place signs in a particular separate column in neovim e.g. gitsigns 68 | --- cannot be placed in the same column as other git signs which means they have to be manually 69 | --- split out and placed. 70 | function ui.statuscolumn.render() 71 | local lnum, relnum, virtnum = v.lnum, v.relnum, v.virtnum 72 | local win = api.nvim_get_current_win() 73 | local buf = api.nvim_win_get_buf(win) 74 | local line_count = api.nvim_buf_line_count(buf) 75 | 76 | local gitsign, sns = extmark_signs(buf, lnum) 77 | while #sns < MIN_SIGN_WIDTH do 78 | table.insert(sns, spacer(1)) 79 | end 80 | 81 | local r1 = section:new(spacer(1), { { { nr(win, lnum, relnum, virtnum, line_count) } } }, unpack(gitsign)) 82 | local r2 = section:new({ { { separator, 'StatusColSep' } }, after = '' }, { { { fdm(lnum) } } }) 83 | 84 | return display({ sns, r1 + r2 }) 85 | end 86 | 87 | opt.statuscolumn = '%{%v:lua.as.ui.statuscolumn.render()%}' 88 | 89 | as.augroup('StatusCol', { 90 | event = { 'BufEnter', 'FileType' }, 91 | command = function(args) 92 | local buf = args.buf 93 | local d = ui.decorations.get({ ft = vim.bo[buf].ft, fname = fn.bufname(buf), setting = 'statuscolumn' }) 94 | if d.ft == false or d.fname == false then vim.opt_local.statuscolumn = '' end 95 | end, 96 | }) 97 | -------------------------------------------------------------------------------- /.config/nvim/plugin/whitespace.lua: -------------------------------------------------------------------------------- 1 | if not as then return end 2 | 3 | ---------------------------------------------------------------------------------- 4 | -- Whitespace highlighting 5 | ---------------------------------------------------------------------------------- 6 | --@source: https://vim.fandom.com/wiki/Highlight_unwanted_spaces (comment at the bottom) 7 | --@implementation: https://github.com/inkarkat/vim-ShowTrailingWhitespace 8 | 9 | local fn = vim.fn 10 | 11 | local function is_floating_win() return fn.win_gettype() == 'popup' end 12 | 13 | local function is_invalid_buf() return vim.bo.filetype == '' or vim.bo.buftype ~= '' or not vim.bo.modifiable end 14 | 15 | local function toggle_trailing(mode) 16 | if is_invalid_buf() or is_floating_win() then 17 | vim.wo.list = false 18 | return 19 | end 20 | if not vim.wo.list then vim.wo.list = true end 21 | local pattern = mode == 'i' and [[\s\+\%#\@\nPlug 'akinsho/$1'\n<\n\n\n\t\t==============================================================================\n\t\tUSAGE *$1-usage*\n\n\t\tTODO\n\n\n\t\t==============================================================================\n\t\tSETTINGS *$1-settings*\n\n\t\tTODO\n\n\n\t\t==============================================================================\n\t\tINTERNALS *$1-internals*\n\n\t\tTODO\n\n\t\t==============================================================================\n\t\tISSUES *$1-issues*\n\n\t\tAny issues and suggestions are very welcome on the github bugtracker:\n\t\thttps://github.com/akinsho/$1.vim/issues\n\n\nvim:tw=78:sw=4:ft=help:norl:" 12 | }, 13 | "code": { 14 | "prefix": "code", 15 | "body": ">\n${1}\n<" 16 | }, 17 | "section": { 18 | "prefix": "section", 19 | "body": "==============================================================================\n${1:SECTION} *${2:plugin}-${3:section}*" 20 | }, 21 | "subsection": { 22 | "prefix": "subsection", 23 | "body": "${1:Subsection} ~\n\n${1}" 24 | }, 25 | "setting": { 26 | "prefix": "setting", 27 | "body": "*g:${1:setting_name}*\n>\nlet g:$1 = 'TODO'\n<\nDefault value: TODO\n\n${2}" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.config/nvim/snippets/textmate/json.json: -------------------------------------------------------------------------------- 1 | { 2 | "s": { 3 | "prefix": "s", 4 | "body": "\"${1:key}\": \"${0:value}\",", 5 | "description": "String" 6 | }, 7 | "n": { 8 | "prefix": "n", 9 | "body": "\"${1:key}\": ${0:value},", 10 | "description": "Number" 11 | }, 12 | "a": { 13 | "prefix": "a", 14 | "body": "[\n\t${VISUAL}$0\n],", 15 | "description": "Array" 16 | }, 17 | "na": { 18 | "prefix": "na", 19 | "body": "\"${1:key}\": [\n\t${VISUAL}$0\n],", 20 | "description": "Named array" 21 | }, 22 | "o": { 23 | "prefix": "o", 24 | "body": "{\n\t${VISUAL}$0\n},", 25 | "description": "Object" 26 | }, 27 | "no": { 28 | "prefix": "no", 29 | "body": "\"${1:key}\": {\n\t${VISUAL}$0\n},", 30 | "description": "Named object" 31 | }, 32 | "null": { 33 | "prefix": "null", 34 | "body": "\"${0:key}\": null,", 35 | "description": "Null" 36 | } 37 | } -------------------------------------------------------------------------------- /.config/nvim/snippets/textmate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "contributes": { 3 | "snippets": [ 4 | { 5 | "language": [ 6 | "global" 7 | ], 8 | "path": "./global.json" 9 | }, 10 | { 11 | "language": "dart", 12 | "path": "./dart.json" 13 | }, 14 | { 15 | "language": "help", 16 | "path": "./help.json" 17 | }, 18 | { 19 | "language": "lua", 20 | "path": "./lua.json" 21 | }, 22 | { 23 | "language": "vim", 24 | "path": "./vim.json" 25 | }, 26 | { 27 | "language": "tmux", 28 | "path": "./tmux.json" 29 | }, 30 | { 31 | "language": "reason", 32 | "path": "./reason.json" 33 | }, 34 | { 35 | "language": "vimwiki", 36 | "path": "./vimwiki.json" 37 | }, 38 | { 39 | "language": "elm", 40 | "path": "./elm.json" 41 | }, 42 | { 43 | "language": "markdown", 44 | "path": "./markdown.json" 45 | }, 46 | { 47 | "language": "html", 48 | "path": "./html.json" 49 | }, 50 | { 51 | "language": "javascript", 52 | "path": "./javascript.json" 53 | }, 54 | { 55 | "language": "json", 56 | "path": "./json.json" 57 | } 58 | ] 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /.config/nvim/spell/en.utf-8.add: -------------------------------------------------------------------------------- 1 | gitignore 2 | well 3 | tmux 4 | shortcut 5 | emoji 6 | graphql 7 | tsserver 8 | emoji 9 | eslint 10 | vimlsp 11 | tabnine 12 | filetypes 13 | ccls 14 | objc 15 | objcpp 16 | ocaml 17 | gopls 18 | codelens 19 | languageserver 20 | autocommands 21 | plugin 22 | prev 23 | gotos 24 | localleader 25 | funcobj 26 | codeaction 27 | autofix 28 | refactor 29 | prevchunk 30 | nextchunk 31 | diff 32 | chunkinfo 33 | nargs 34 | dotfiles 35 | kspell 36 | autocompletion 37 | metadata 38 | timestamp 39 | standin 40 | contactless 41 | magstripe 42 | mastercard 43 | acquirer 44 | cardholder 45 | fincrime 46 | lifecycle 47 | transferwise 48 | timestamp 49 | dedupe 50 | metadata 51 | args 52 | lifecycle 53 | proto 54 | chatproto 55 | proto 56 | monzo 57 | sess 58 | omitempty 59 | eventf 60 | uuid 61 | signup 62 | graphql 63 | accum 64 | autosave 65 | autosaved 66 | nofile 67 | jinzhu 68 | gorm 69 | postgres 70 | dbname 71 | sslmode 72 | foreignkey 73 | autogenerate 74 | formik 75 | backend 76 | API 77 | readme 78 | cruft 79 | statusline 80 | wiki 81 | vim 82 | dotfiles 83 | Setup 84 | config 85 | setup 86 | armageddon 87 | plugins 88 | filetype 89 | symlinked 90 | init 91 | onboarding 92 | onboard 93 | sqlite 94 | app 95 | async 96 | nvim 97 | var 98 | placeholder 99 | dropdown 100 | Todo 101 | Neovim 102 | lua 103 | symlinks 104 | online 105 | zsh 106 | alacritty 107 | quickfix 108 | macOS 109 | Github 110 | submodules 111 | autocommand 112 | screenshots 113 | gitcommit 114 | macOS 115 | spellfile 116 | tabline 117 | tabpage 118 | screenshot 119 | TLDR 120 | runbook 121 | firebase 122 | Symlink 123 | usb 124 | SSD 125 | Offline 126 | offline 127 | api 128 | UI 129 | fulfill 130 | Changelog 131 | Ubuntu 132 | onboarded 133 | env 134 | png 135 | ios 136 | jpg 137 | github 138 | struct 139 | Middleware 140 | unmarshal 141 | blog 142 | undercurl 143 | loclist 144 | versioning 145 | iOS 146 | treesitter 147 | grep 148 | ftplugin 149 | neovim 150 | fzf 151 | vimrc 152 | keepalt 153 | buftype 154 | BufRead 155 | Ctags 156 | dev 157 | hardcoded 158 | zshrc 159 | Namespace 160 | Neovim's 161 | vim's 162 | CLI 163 | Ctrl 164 | admin 165 | FIXME 166 | Todos 167 | onedark 168 | monokai 169 | coc 170 | cassandra 171 | json 172 | formatexpr 173 | refetch 174 | linux 175 | spellbad 176 | vimscript 177 | unstash 178 | unstashed 179 | chmod 180 | unstaged 181 | textmate 182 | ultisnips 183 | vimwiki 184 | mixin 185 | Ok 186 | Buf 187 | buf 188 | fallback 189 | bool 190 | Wipeout 191 | ui 192 | Levenshtein 193 | utils 194 | levenshtein 195 | guifg 196 | gui 197 | yaml 198 | regex 199 | alright 200 | lsp 201 | lua 202 | bufferline 203 | param 204 | Automagically 205 | upvalues 206 | TODO 207 | pip3 208 | extmarks 209 | org 210 | Sowemimo 211 | toggleterm 212 | lspconfig 213 | winhighlight 214 | colorscheme 215 | cfilter 216 | globbing 217 | popup 218 | vsplit 219 | textwidth 220 | adhoc 221 | allowlist 222 | multibyte 223 | vararg 224 | commandline 225 | autoload 226 | func 227 | num 228 | luarocks 229 | packpath 230 | fzy 231 | VIMRUNTIME 232 | rplugin 233 | dir 234 | nvim's 235 | enum 236 | homebrew 237 | app 238 | extmark 239 | bufnr 240 | lnum 241 | libuv 242 | userdata 243 | OAuth 244 | runtimepath 245 | namespaced 246 | protobuf 247 | Cognito 248 | istio 249 | GRPC 250 | winbar 251 | structs 252 | Sumneko 253 | dartls 254 | submodule 255 | augroups 256 | strikethrough 257 | ascii 258 | localhost 259 | neo 260 | stylua 261 | prometheus 262 | metatable 263 | akinsho 264 | Javascript 265 | augroup 266 | msg 267 | termguicolors 268 | cterm 269 | gotchas 270 | ripgrep 271 | dap 272 | REPL 273 | url 274 | auth 275 | Spotify 276 | colorcolumn 277 | statuscolumn 278 | autocmd 279 | arg 280 | neorg 281 | startup 282 | lockfile 283 | signcolumn 284 | hls 285 | Paren 286 | hl 287 | underdotted 288 | shiftwidth 289 | foldmethod 290 | rgb 291 | RGBA 292 | rgba 293 | params 294 | stackoverflow 295 | pos 296 | guibg 297 | diffview 298 | WYSIWYG 299 | autoloaded 300 | grepping 301 | vscode 302 | sveltejs 303 | supabase 304 | sveltekit 305 | src 306 | fallbacks 307 | Netlify 308 | netlify 309 | vite 310 | Vue 311 | Tiptap 312 | hlsearch 313 | Orgmode 314 | css 315 | realtime 316 | stdout 317 | stderr 318 | goroutine 319 | mutex 320 | webhook 321 | paystub 322 | unmarshalling 323 | ideavim 324 | -------------------------------------------------------------------------------- /.config/rg/.ripgreprc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | 3 | --smart-case 4 | --hidden 5 | --glob=!.git/ 6 | -------------------------------------------------------------------------------- /.config/stylua/stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 100 2 | indent_type = 'Spaces' 3 | quote_style = 'AutoPreferSingle' 4 | indent_width = 2 5 | call_parentheses = 'Always' 6 | collapse_simple_statement = 'Always' 7 | -------------------------------------------------------------------------------- /.config/zsh/.zprofile: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Homebrew 3 | #------------------------------------------------------------------------------- 4 | eval "$(/opt/homebrew/bin/brew shellenv)" 5 | 6 | #------------------------------------------------------------------------------- 7 | # $PATH Updates 8 | #------------------------------------------------------------------------------- 9 | # NOTE: this is here because it must be loaded after homebrew is added to the 10 | # path which is done in the .zprofile which loads after the .zshenv 11 | 12 | # MacOS ships with an older version of Ruby which is built against an X86 13 | # system rather than ARM i.e. for M1+. So replace the system ruby with an 14 | # updated one from Homebrew and ensure it is before /usr/bin/ruby 15 | # Prepend to PATH 16 | export BREW_PREFIX="$(brew --prefix)" 17 | path=( 18 | "$BREW_PREFIX/opt/ruby/bin" 19 | "$BREW_PREFIX/lib/ruby/gems/3.0.0/bin" 20 | # NOTE: Add coreutils which make commands like ls run as they do on Linux rather than the BSD flavoured variant macos ships with 21 | "$BREW_PREFIX/opt/coreutils/libexec/gnubin" 22 | $path 23 | ) 24 | export DYLD_LIBRARY_PATH="$(brew --prefix)/lib:$DYLD_LIBRARY_PATH" 25 | 26 | export MANPATH="$BREW_PREFIX/opt/coreutils/libexec/gnuman:${MANPATH}" 27 | -------------------------------------------------------------------------------- /.config/zsh/.zshenv: -------------------------------------------------------------------------------- 1 | # vim:ft=zsh 2 | #------------------------------------------------------------------------------- 3 | # ENV VARIABLES 4 | #------------------------------------------------------------------------------- 5 | # PATH. 6 | # (N-/): do not register if the directory does not exists 7 | # (Nn[-1]-/) 8 | # 9 | # N : NULL_GLOB option (ignore path if the path does not match the glob) 10 | # n : Sort the output 11 | # [-1]: Select the last item in the array 12 | # - : follow the symbol links 13 | # / : ignore files 14 | # t : tail of the path 15 | # CREDIT: @ahmedelgabri 16 | #-------------------------------------------------------------------------------- 17 | export CLICOLOR=1 # enable color support for ls. 18 | export XDG_CONFIG_HOME="$HOME/.config" 19 | export XDG_CACHE_HOME="$HOME/.cache" 20 | 21 | export ZDOTDIR="$XDG_CONFIG_HOME/zsh" 22 | export ZSH_CACHE_DIR="$XDG_CACHE_HOME/zsh" 23 | 24 | export SYNC_DIR=${HOME}/Dropbox 25 | export DOTFILES=${HOME}/.dotfiles 26 | export PROJECTS_DIR=${HOME}/projects 27 | export PERSONAL_PROJECTS_DIR=${PROJECTS_DIR}/personal 28 | 29 | # @see: https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#configuration-file 30 | if which rg >/dev/null; then 31 | export RIPGREP_CONFIG_PATH=${DOTFILES}/.config/rg/.ripgreprc 32 | fi 33 | 34 | [ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env" 35 | #------------------------------------------------------------------------------- 36 | # Go 37 | #------------------------------------------------------------------------------- 38 | export GOPATH=$HOME/go 39 | #------------------------------------------------------------------------------- 40 | 41 | path+=( 42 | /usr/local/bin 43 | ${HOME}/.npm/bin(N-/) 44 | ${HOME}/.local/bin(N-/) 45 | ${GOPATH}/bin(N-/) 46 | # Add local build of neovim to path for development 47 | ${HOME}/nvim/bin(N-/) 48 | # package manager for neovim 49 | ${HOME}/.local/share/bob/nvim-bin(N-/) 50 | ) 51 | 52 | 53 | case `uname` in 54 | Darwin) 55 | export ANDROID_SDK_ROOT=${HOME}/Library/Android/sdk/ 56 | ;; 57 | esac 58 | 59 | export MANPATH="/usr/local/man:$MANPATH" 60 | if which nvim >/dev/null; then 61 | export MANPAGER='nvim +Man!' 62 | fi 63 | 64 | # you may need to manually set your language environment 65 | export LC_ALL=en_GB.UTF-8 66 | export LANG=en_GB.UTF-8 67 | 68 | # preferred editor for local and remote sessions 69 | export VISUAL="nvim --cmd 'let g:flatten_wait=1'" 70 | export EDITOR="nvim" 71 | 72 | export USE_EDITOR=$EDITOR 73 | 74 | if [ -f "$HOME/.environment.secret.sh" ]; then 75 | source $HOME/.environment.secret.sh 76 | fi 77 | 78 | if [ -f "$HOME/.environment.local.sh" ]; then 79 | source $HOME/.environment.local.sh 80 | fi 81 | 82 | export SSH_KEY_PATH="~/.ssh/rsa_id" 83 | 84 | #------------------------------------------------------------------------------- 85 | # FZF Settings 86 | #------------------------------------------------------------------------------- 87 | # --files: List files that would be searched but do not search 88 | # --no-ignore: Do not respect .gitignore, etc... 89 | # --hidden: Search hidden files and folders 90 | export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden' 91 | export FZF_DEFAULT_OPTS="--reverse \ 92 | --cycle \ 93 | --bind=esc:abort \ 94 | --height 60% \ 95 | --border sharp \ 96 | --prompt '∷ ' \ 97 | --marker ' ' \ 98 | --pointer ▶ " 99 | 100 | # CTRL-/ to toggle small preview window to see the full command 101 | # CTRL-Y to copy the command into clipboard using pbcopy 102 | export FZF_CTRL_R_OPTS=" 103 | --preview 'echo {}' --preview-window up:3:hidden:wrap 104 | --bind 'ctrl-/:toggle-preview' 105 | --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' 106 | --color header:italic 107 | --header 'Press CTRL-Y to copy command into clipboard'" 108 | 109 | export FZF_TMUX_OPTS='-p80%,60%' -------------------------------------------------------------------------------- /.config/zsh/funcs/last_working_dir: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | # Flag indicating if we've previously jumped to last directory 4 | typeset -g ZSH_LAST_WORKING_DIRECTORY 5 | 6 | # Updates the last directory once directory is changed 7 | # autoload -U add-zsh-hook 8 | # add-zsh-hook chpwd chpwd_last_working_dir 9 | 10 | chpwd_last_working_dir() { 11 | # Don't run in subshells 12 | [[ "$ZSH_SUBSHELL" -eq 0 ]] || return 0 13 | # Add ".$SSH_USER" suffix to cache file if $SSH_USER is set and non-empty 14 | local cache_file="$ZSH_CACHE_DIR/last-working-dir${SSH_USER:+.$SSH_USER}" 15 | builtin pwd >| "$cache_file" 16 | } 17 | 18 | # Changes directory to the last working directory 19 | lwd() { 20 | # Add ".$SSH_USER" suffix to cache file if $SSH_USER is set and non-empty 21 | local cache_file="$ZSH_CACHE_DIR/last-working-dir${SSH_USER:+.$SSH_USER}" 22 | [[ -r "$cache_file" ]] && cd "$(cat "$cache_file")" 23 | } 24 | 25 | # Jump to last directory automatically unless: 26 | # - this isn't the first time the plugin is loaded 27 | # - it's not in $HOME directory 28 | [[ -n "$ZSH_LAST_WORKING_DIRECTORY" ]] && return 29 | [[ "$PWD" != "$HOME" ]] && return 30 | lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true 31 | -------------------------------------------------------------------------------- /.config/zsh/funcs/zsh_add_plugin: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | #------------------------------------------------------------------------------- 3 | # PLUGIN MANAGEMENT 4 | #------------------------------------------------------------------------------- 5 | ZSH_PLUGIN_DIR="$DOTFILES/.config/zsh/plugins" 6 | 7 | zsh_add_file() { 8 | [ -f "$ZDOTDIR/$1" ] && source "$ZDOTDIR/$1" 9 | } 10 | 11 | zsh_source_plugin () { 12 | zsh_add_file "plugins/$1.zsh" 13 | } 14 | 15 | PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2) 16 | if [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then 17 | zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh" || \ 18 | zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh" || \ 19 | zsh_add_file "plugins/$PLUGIN_NAME/$2.zsh" 20 | else 21 | cd $DOTFILES 22 | git submodule add "git@github.com:$1.git" "$ZSH_PLUGIN_DIR/$PLUGIN_NAME" 23 | cd - 24 | fi 25 | -------------------------------------------------------------------------------- /.config/zsh/scripts/alias.zsh: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # ALIASES 3 | #------------------------------------------------------------------------------ 4 | #-- gls is GNU ls 5 | if [[ $+commands[gls] ]]; then 6 | alias ls="gls --color=auto --hyperlink=auto $@" 7 | fi 8 | if [[ $+commands[eza] ]]; then 9 | alias l="eza --long --git-repos --all --git --color=always --group-directories-first --icons $@" 10 | alias lt="eza --icons --all --color=always -T $@" 11 | else 12 | alias l='ls -lFh' # size,show type,human readable 13 | fi 14 | alias ez="${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc" 15 | alias et="${=EDITOR} ${XDG_CONFIG_HOME}/tmux/tmux.conf" 16 | alias grep='grep --color' 17 | alias x="exit" 18 | alias del="rm -rf" 19 | alias md="mkdir -p" 20 | alias dots="cd $DOTFILES" 21 | alias cl='clear' 22 | alias src="exec $SHELL" 23 | alias dnd='do-not-disturb toggle' 24 | 25 | alias kitty-icon="$DOTFILES/macos/kitty-icon.zsh" 26 | #------------------------------------------------------------------------------- 27 | # APP ALIASES 28 | #------------------------------------------------------------------------------- 29 | (( $+commands[npm] )) && alias ns="clear && npm start" 30 | (( $+commands[npm] )) && alias nt="clear && npm test" 31 | (( $+commands[yarn] )) && alias yt="clear && yarn test" 32 | (( $+commands[yarn] )) && alias ys="clear && yarn start" 33 | (( $+commands[bat] )) && alias cat='bat' 34 | (( $+commands[lazygit] )) && alias lg='lazygit' 35 | (( $+commands[fuck] )) && alias fuckit='export THEFUCK_REQUIRE_CONFIRMATION=False; fuck; export THEFUCK_REQUIRE_CONFIRMATION=True' 36 | (( $+commands[kitty] )) && alias icat="kitty +kitten icat" 37 | if [[ $+commands[docker] ]]; then 38 | alias dcd="docker compose down" 39 | alias dcu="docker compose up -d --build" 40 | fi 41 | #------------------------------------------------------------------------------- 42 | # NEOVIM 43 | #------------------------------------------------------------------------------- 44 | alias v='nvim' 45 | alias vi='nvim' 46 | alias vim='nvim' 47 | alias dv='DEVELOPING=1 nvim' 48 | alias lvim="VIMRUNTIME=runtime $PROJECTS_DIR/contributing/neovim/build/bin/nvim" 49 | alias minimalvim="nvim -u ~/minimal.vim" 50 | alias notes="cd $SYNC_DIR/notes/neorg/ && nvim" 51 | #------------------------------------------------------------------------------- 52 | # DIRECTORIES 53 | #------------------------------------------------------------------------------- 54 | alias ...="cd ../../.." 55 | alias ....="cd ../../../.." 56 | # @see: https://thevaluable.dev/zsh-install-configure-mouseless/ 57 | # These mappings allow listing the directory stack and jumping to an entry 58 | # based on it's number in the list 59 | alias d='dirs -v' 60 | for index ({1..9}) alias "$index"="cd +${index}"; unset index 61 | #------------------------------------------------------------------------------ 62 | # TMUX 63 | #------------------------------------------------------------------------------ 64 | alias ta="tmux attach -t" 65 | alias td="tmux detach" 66 | alias tls="tmux ls" 67 | alias tkss="killall tmux" 68 | alias tkill="tmux kill-session -t" 69 | #------------------------------------------------------------------------------ 70 | # IP ADDRESSES 71 | #------------------------------------------------------------------------------ 72 | alias ip="dig +short myip.opendns.com @resolver1.opendns.com" 73 | alias localip="ipconfig getifaddr en0" 74 | #------------------------------------------------------------------------------ 75 | # suffix aliases set the program type to use to open a particular file with an extension 76 | alias -s {js,html,js,ts,css,md}=nvim 77 | 78 | # ------------------------------------------------------------------------------- 79 | # GIT ALIASES 80 | # ------------------------------------------------------------------------------- 81 | if [[ `uname` == 'Linux' ]]; then 82 | alias o='a -e xdg-open' # quick opening files with xdg-open 83 | alias open='xdg-open' 84 | elif [[ `uname` == 'Darwin' ]]; then 85 | alias brewfile="brew bundle dump --describe --global --force" 86 | fi 87 | 88 | # Check if main exists and use instead of master 89 | function git_main_branch() { 90 | local branch 91 | for branch in main trunk; do 92 | if command git show-ref -q --verify refs/heads/$branch; then 93 | echo $branch 94 | return 95 | fi 96 | done 97 | echo master 98 | } 99 | # source: https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/git/git.plugin.zsh#L53 100 | # NOTE: a lot of these commands are single quoted ON PURPOSE to prevent them 101 | # from being evaluated immediately rather than in the shell when the alias is 102 | # expanded 103 | alias g="git" 104 | alias gs="git status" 105 | alias glog="git log" 106 | alias gss="git status -s" 107 | alias gst="git status" 108 | alias gc="git commit" 109 | alias gd="git diff" 110 | alias gco="git checkout" 111 | alias ga='git add' 112 | alias gaa='git add --all' 113 | alias gcb='git checkout -b' 114 | alias gb='git branch' 115 | alias gbD='git branch -D' 116 | alias gbl='git blame -b -w' 117 | alias gbr='git branch --remote' 118 | alias gc='git commit -v' 119 | alias gd='git diff' 120 | alias gf='git fetch' 121 | alias gfa='git fetch --all --prune' 122 | alias gfo='git fetch origin' 123 | alias gm='git merge' 124 | alias gma='git merge --abort' 125 | alias gmom='git merge origin/$(git_main_branch)' 126 | alias gp='git push' 127 | alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d' 128 | alias gpristine='git reset --hard && git clean -dffx' 129 | alias gcl='git clone --recurse-submodules' 130 | alias gcw="git clone git@github-work:$@.git" 131 | alias gl='git pull' 132 | alias glum='git pull upstream $(git_main_branch)' 133 | alias grhh='git reset --hard' 134 | alias groh='git reset origin/$(git_current_branch) --hard' 135 | alias grbi='git rebase -i' 136 | alias grbc='git rebase --continue' 137 | alias grbm='git rebase $(git_main_branch)' 138 | alias gcm='git checkout $(git_main_branch)' 139 | alias gcd="git checkout dev" 140 | alias gcb="git checkout -b" 141 | alias gstp="git stash pop" 142 | alias gsts="git stash show -p" 143 | 144 | function grename() { 145 | if [[ -z "$1" || -z "$2" ]]; then 146 | echo "Usage: $0 old_branch new_branch" 147 | return 1 148 | fi 149 | 150 | # Rename branch locally 151 | git branch -m "$1" "$2" 152 | # Rename branch in origin remote 153 | if git push origin :"$1"; then 154 | git push --set-upstream origin "$2" 155 | fi 156 | } 157 | 158 | function y() { 159 | local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd 160 | yazi "$@" --cwd-file="$tmp" 161 | if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then 162 | builtin cd -- "$cwd" 163 | fi 164 | rm -f -- "$tmp" 165 | } 166 | -------------------------------------------------------------------------------- /.config/zsh/scripts/functions.zsh: -------------------------------------------------------------------------------- 1 | # A Handful of very useful functions courtesy of 2 | # https://github.com/jdsimcoe/dotfiles/blob/master/.zshrc 3 | function port() { 4 | lsof -n -i ":$@" | grep LISTEN 5 | } 6 | 7 | # Helper function to run a diff against a branch and exclude a file 8 | function gdmin() { 9 | local branchname=${1:-develop} 10 | local ignore=${2:-package\-lock.json} 11 | git diff $branchname -- ":(exclude)"$ignore 12 | } 13 | 14 | # Used for ignoring changes to files tracked in git 15 | function ignore() { 16 | git update-index --skip-worktree $1 17 | } 18 | function unignore() { 19 | git update-index --no-skip-worktree $1 20 | } 21 | 22 | function colours() { 23 | for i in {0..255}; do 24 | printf "\x1b[38;5;${i}m colour${i}" 25 | if (( $i % 5 == 0 )); then 26 | printf "\n" 27 | else 28 | printf "\t" 29 | fi 30 | done 31 | } 32 | 33 | 34 | function build-nvim() { 35 | neovim_dir="$PROJECTS_DIR/contributing/neovim" 36 | [ ! -d $neovim_dir ] && git clone git@github.com:neovim/neovim.git $neovim_dir 37 | pushd $neovim_dir 38 | git checkout master 39 | git pull upstream master 40 | [ -d "$neovim_dir/build/" ] && rm -r ./build/ # clear the CMake cache 41 | make CMAKE_BUILD_TYPE=Release CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/neovim" 42 | make install 43 | popd 44 | } 45 | 46 | fancy-ctrl-z () { 47 | if [[ $#BUFFER -eq 0 ]]; then 48 | BUFFER="fg" 49 | zle accept-line 50 | else 51 | zle push-input 52 | zle clear-screen 53 | fi 54 | } 55 | zle -N fancy-ctrl-z 56 | bindkey '^Z' fancy-ctrl-z 57 | 58 | sudo-command-line() { 59 | [[ -z $BUFFER ]] && zle up-history 60 | if [[ $BUFFER == sudo\ * ]]; then 61 | LBUFFER="${LBUFFER#sudo }" 62 | elif [[ $BUFFER == $EDITOR\ * ]]; then 63 | LBUFFER="${LBUFFER#$EDITOR }" 64 | LBUFFER="sudoedit $LBUFFER" 65 | elif [[ $BUFFER == sudoedit\ * ]]; then 66 | LBUFFER="${LBUFFER#sudoedit }" 67 | LBUFFER="$EDITOR $LBUFFER" 68 | else 69 | LBUFFER="sudo $LBUFFER" 70 | fi 71 | } 72 | zle -N sudo-command-line 73 | # Defined shortcut keys: [Esc] [Esc] 74 | bindkey "\e\e" sudo-command-line 75 | -------------------------------------------------------------------------------- /.config/zsh/scripts/fzf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #============================================================================================================= 3 | # FUNCTIONS 4 | #============================================================================================================= 5 | # tm with no sessions open it will create a session called "new". 6 | # tm irc it will attach to the irc session (if it exists), else it will create it. 7 | # tm with one session open, it will attach to that session. 8 | # tm with more than one session open it will let you select the session via fzf. 9 | tm() { 10 | [[ -n "$TMUX" ]] && change="switch-client" || change="attach-session" 11 | if [ $1 ]; then 12 | tmux $change -t "$1" 2>/dev/null || (tmux new-session -d -s $1 && tmux $change -t "$1"); return 13 | fi 14 | session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --exit-0) && tmux $change -t "$session" || echo "No sessions found." 15 | } 16 | 17 | # Install (one or multiple) selected application(s) 18 | # using "brew search" as source input 19 | # mnemonic [B]rew [I]nstall [P]lugin 20 | bip() { 21 | local inst=$(brew search | fzf -m) 22 | 23 | if [[ $inst ]]; then 24 | for prog in $(echo $inst); 25 | do brew install "$prog"; done; 26 | fi 27 | } 28 | 29 | # fshow - git commit browser 30 | fshow() { 31 | git log --graph --color=always \ 32 | --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | 33 | fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ 34 | --bind "ctrl-m:execute: 35 | (grep -o '[a-f0-9]\{7\}' | head -1 | 36 | xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' 37 | {} 38 | FZF-EOF" 39 | } 40 | 41 | # Another function which is not based on grep or locate 42 | cdf() { 43 | local file 44 | local dir 45 | file=$(fzf +m -q "$1") && dir=$(dirname "$file") && cd "$dir" || exit 46 | } 47 | 48 | # fbr - checkout git branch (including remote branches), sorted by most recent commit, limit 30 last branches 49 | fbr() { 50 | local branches branch 51 | branches=$(git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format="%(refname:short)") && 52 | branch=$(echo "$branches" | 53 | fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m) && 54 | git checkout "$(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##")" 55 | } 56 | 57 | vmod(){ 58 | ${EDITOR:-vim} "$(git status -s | fzf -m)" 59 | } 60 | 61 | # fs [FUZZY PATTERN] - Select selected tmux session 62 | # - Bypass fuzzy finder if there's only one match (--select-1) 63 | # - Exit if there's no match (--exit-0) 64 | fs() { 65 | local session 66 | session=$(tmux list-sessions -F "#{session_name}" | \ 67 | fzf --query="$1" --select-1 --exit-0) && 68 | tmux switch-client -t "$session" 69 | } 70 | 71 | # fe [FUZZY PATTERN] - Open the selected file with the default editor 72 | # - Bypass fuzzy finder if there's only one match (--select-1) 73 | # - Exit if there's no match (--exit-0) 74 | fe() { 75 | local files 76 | IFS=$'\n' files=($(fzf-tmux --query="$1" --multi --select-1 --exit-0 --preview\ 77 | 'bat --color "always" {}' --preview-window=right:60% )) 78 | [[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}" 79 | } 80 | 81 | # fstash - easier way to deal with stashes 82 | # type fstash to get a list of your stashes 83 | # enter shows you the contents of the stash 84 | # ctrl-d shows a diff of the stash against your current HEAD 85 | # ctrl-b checks the stash out as a branch, for easier merging 86 | fstash() { 87 | local out q k sha 88 | while out=$( 89 | git stash list --pretty="%C(yellow)%h %>(14)%Cgreen%cr %C(blue)%gs" | 90 | fzf --ansi --no-sort --query="$q" --print-query \ 91 | --expect=ctrl-d,ctrl-b); 92 | do 93 | mapfile -t out <<< "$out" 94 | q="${out[0]}" 95 | k="${out[1]}" 96 | sha="${out[-1]}" 97 | sha="${sha%% *}" 98 | [[ -z "$sha" ]] && continue 99 | if [[ "$k" == 'ctrl-d' ]]; then 100 | git diff "$sha" 101 | elif [[ "$k" == 'ctrl-b' ]]; then 102 | git stash branch "stash-$sha" "$sha" 103 | break; 104 | else 105 | git stash show -p "$sha" 106 | fi 107 | done 108 | } 109 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | /alfred/Alfred.alfredpreferences/* linguist-vendored 2 | /.config/iterm2/* linguist-vendored 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | tags 2 | node_modules 3 | .DS_Store 4 | *~ 5 | .netrwhist 6 | *.code-workspace 7 | session/ 8 | packer_compiled.vim 9 | automatic_backups/ 10 | .config/tmux/plugins/ 11 | 12 | .zsh_history 13 | .zcompdump 14 | .zcompcache 15 | .chpwd-recent-dirs 16 | .zsh_sessions 17 | !.nvim.lua 18 | .config/ghostty/local 19 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dotbot"] 2 | path = dotbot 3 | url = https://github.com/anishathalye/dotbot 4 | ignore = dirty 5 | [submodule "alias-tips"] 6 | path = .config/zsh/plugins/alias-tips 7 | url = https://github.com/djui/alias-tips 8 | [submodule "zsh-syntax-highlighting"] 9 | path = .config/zsh/plugins/zsh-syntax-highlighting 10 | url = https://github.com/zsh-users/zsh-syntax-highlighting 11 | [submodule "zsh-autosuggestions"] 12 | path = .config/zsh/plugins/zsh-autosuggestions 13 | url = https://github.com/zsh-users/zsh-autosuggestions 14 | [submodule "zsh-completions"] 15 | path = .config/zsh/plugins/zsh-completions 16 | url = https://github.com/zsh-users/zsh-completions 17 | [submodule "zsh/plugins/zsh-auto-notify"] 18 | path = .config/zsh/plugins/zsh-auto-notify 19 | url = git@github.com:MichaelAquilina/zsh-auto-notify.git 20 | [submodule "zsh/plugins/zsh-autopair"] 21 | path =.config/zsh/plugins/zsh-autopair 22 | url = git@github.com:hlissner/zsh-autopair.git 23 | -------------------------------------------------------------------------------- /.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", 3 | "diagnostics.disable": ["missing-parameter", "missing-fields", "inject-field"] 4 | } 5 | -------------------------------------------------------------------------------- /.psqlrc: -------------------------------------------------------------------------------- 1 | -- @reference: https://github.com/baburdick/psqlrc-files/blob/master/.psqlrc 2 | -- Prevent noisy loading of psqlrc file 3 | \set QUIET yes 4 | 5 | -- Customize prompt 6 | -- http://i-dba.blogspot.se/2014/02/colorizing-psql-prompt-guide.html 7 | -- %m -> short hostname; %M -> full hostname 8 | \set PROMPT1 '\n%[%033[1;31m%]➤ %[%033[2;37m%]%`\! date "+%F %I:%M %p %Z"`%[%033[0m%] %[%033[1;36m%]%n%[%033[34m%]@%[%033[1;36m%]%M:%>%[%033[1;33m%]/%/ %[%033[1;31m%]%x %[%033[K%]%[%033[0m%]\n%[%033[1;33m%]%R%#%[%033[0m%] ' 9 | \set PROMPT2 '%[%033[1;33m%]%R%#%[%033[0m%] ' 10 | -- Consider: http://petereisentraut.blogspot.c 11 | 12 | \x auto 13 | \set ON_ERROR_STOP on 14 | \set ON_ERROR_ROLLBACK interactive 15 | \set HISTFILE ~/.psql_history-:DBNAME 16 | 17 | -- \set VERBOSITY verbose 18 | 19 | \pset border 2 20 | \pset linestyle 'unicode' 21 | 22 | \pset unicode_border_linestyle single 23 | \pset unicode_column_linestyle single 24 | \pset unicode_header_linestyle single 25 | 26 | -- Show timing info for queries 27 | \timing 28 | 29 | -- Pager settings to support color 30 | \pset pager always 31 | 32 | -- Allow pasting of values to avoid stupid indenting 33 | \set paste 34 | 35 | -- Get rid of duplicates in history 36 | \set HISTCONTROL ignoredups 37 | 38 | -- Protect against results floods 39 | --\set FETCH_COUNT 1000 40 | 41 | -- Automatically upcase keywords (works only intermittently) 42 | --\set COMP_KEYWORD_CASE upper 43 | 44 | -- Show NULLs as: [NULL] 45 | --\pset null '[NULL]' 46 | 47 | -- Set noisyness back to normal 48 | \unset QUIET 49 | -------------------------------------------------------------------------------- /.rgignore: -------------------------------------------------------------------------------- 1 | .git/* 2 | zsh/plugins/* 3 | dotbot/* 4 | node_modules/* 5 | .yarn 6 | -------------------------------------------------------------------------------- /.styluaignore: -------------------------------------------------------------------------------- 1 | lazy-lock.json 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🏠 .dotfiles 2 | 3 | dotfiles: explorer and editor 4 | 5 | My dotfiles including _zsh_, _(n)vim_ and _tmux_ config files (stashed away in case of laptop armageddon). 6 | 7 | Please don't scrape my repo to train our AI overlords Microsoft 👀… 8 | 9 | Please **DO NOT** fork or clone this repo. It isn't a distro. It's intended for my personal usage, and perhaps 10 | some inspiration, _not complete duplication_. If you see something weird or wrong please raise an issue instead. 11 | 12 | **NOTE**: Some of this stuff is overwrought 🤷🏾‍♂️, it's my house and I can overengineer if I want to 😅 13 | 14 | #### Dependencies: 15 | 16 | - `neovim` 17 | - `homebrew` 18 | - `ripgrep` 19 | - `fzf` 20 | - `delta` 21 | - `fnm` 22 | - `zoxide` 23 | 24 | ### Highlights / Tools 25 | 26 | - [kitty](https://sw.kovidgoyal.net/kitty/index.html)/[alacritty](https://github.com/alacritty/alacritty) GPU-accelerated terminal emulators 27 | - [neovim](https://github.com/neovim/neovim) 28 | - language server support using [`Neovim's LSP`](https://neovim.io/doc/user/lsp.html) 29 | - minimal `zsh` config without `oh-my-zsh`, async prompt for large monorepos. 30 | 31 | Zsh Prompt 32 | 33 | ### Setup 34 | 35 | I manage my setup using [dotbot](https://github.com/anishathalye/dotbot). To set up symlinks run `./install` in the root directory of the repository 36 | This package manages symlinking my config files to the correct directories. It's a little more complex than `GNU Stow` but much less than `Ansible`. 37 | 38 | #### Fonts 39 | 40 | - [Cartograph CF](https://connary.com/cartograph.html) — This beautiful font is not patched as it is a paid font. 41 | - [Fira Code Mono](https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode) — This is my fallback font and is patched with Nerd Fonts, so literally works as a fallback for Cartograph when used with Kitty Terminal 42 | -------------------------------------------------------------------------------- /git/.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = "Akin Sowemimo" 3 | email = 22454918+akinsho@users.noreply.github.com 4 | 5 | [include] 6 | path = ~/.gitconfig.local 7 | 8 | [includeIf "gitdir:~/projects/work/"] 9 | path = ~/projects/work/.gitconfig.work 10 | 11 | [status] 12 | submoduleSummary = true 13 | 14 | [commit] 15 | template = ~/.gitmessage 16 | 17 | [color] 18 | ui = auto 19 | status = auto 20 | diff = auto 21 | branch = auto 22 | showBranch = auto 23 | interactive = auto 24 | 25 | [core] 26 | editor = "nvim" 27 | excludesfile ="~/.gitignore" 28 | pager = delta 29 | autocrlf = input 30 | 31 | # Make `git rebase` safer on macOS. 32 | # More info: 33 | trustctime = false 34 | 35 | # Speed up commands involving untracked files such as `git status`. 36 | # https://git-scm.com/docs/git-update-index#_untracked_cache 37 | untrackedCache = true 38 | 39 | [format] 40 | pretty = format:%C(yellow)%h %Cblue%>(15)%ad %Cgreen%<(15)%aN%Cred%d %Creset%s 41 | 42 | [alias] 43 | # View abbreviated SHA, description, and history graph of the latest 20 commits. 44 | l = log --pretty=oneline -n 20 --graph --abbrev-commit 45 | 46 | # View the current working tree status using the short format. 47 | s = status -s 48 | 49 | # Show the diff between the latest commit and the current state. 50 | d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" 51 | 52 | # `git di $number` shows the diff between the state `$number` revisions ago and the current state. 53 | di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" 54 | 55 | # Pull in remote changes for the current repository and all its submodules. 56 | pl = pull --recurse-submodules 57 | 58 | # Commit all changes. 59 | ca = !git add -A && git commit -av 60 | 61 | # Switch to a branch, creating it if necessary. 62 | br = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" 63 | 64 | # Show verbose output about tags, branches or remotes 65 | tags = tag -l 66 | branches = branch --all 67 | remotes = remote --verbose 68 | 69 | fix='$EDITOR `git diff --name-only | uniq`' 70 | 71 | # List all aliases. Stolen from here: https://twitter.com/TrevorBramble/status/774292970681937920 72 | aliases = "!git config -l | grep ^alias | cut -c 7- | sort" 73 | 74 | fall = fetch --all 75 | 76 | # Destroy all local changes and reset to HEAD. 77 | hreset = reset --hard HEAD 78 | 79 | # Reset previous commit, but keep all the associated changes. Useful for avoiding nasty git merge commits. 80 | uncommit = reset --soft HEAD^ 81 | 82 | reset-up = reset --hard $(git upstream) 83 | 84 | # Remove branches that have already been merged with main. 85 | # a.k.a. ‘delete merged’ 86 | dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" 87 | 88 | # Show the user email for the current repository. 89 | whoami = config user.email 90 | [branch] 91 | # Show most recently changed branches first. 92 | sort = -committerdate 93 | 94 | [diff] 95 | colorMoved = default 96 | navigate = true # use n and N to move between diff sections 97 | renames = copies # Detect copies as well as renames. 98 | 99 | [merge] 100 | # Include summaries of merged commits in newly created merge commit messages 101 | log = true 102 | 103 | [delta] 104 | features = line-numbers decorations 105 | 106 | [delta "decorations"] 107 | commit-decoration-style = bold yellow box ul 108 | file-style = bold yellow ul 109 | 110 | [interactive] 111 | diffFilter = delta --color-only 112 | 113 | [push] 114 | default = current 115 | followTags = true 116 | 117 | [pull] 118 | rebase = true 119 | 120 | [rebase] 121 | autoStash = true 122 | 123 | [fetch] 124 | prune = true 125 | 126 | [gitsh] 127 | prompt = "\n%D %c(%b%#)%w ➜" 128 | 129 | [rerere] 130 | enabled = false 131 | 132 | [help] 133 | # Automatically correct and execute mistyped commands. 134 | autocorrect = 1 135 | 136 | # URL shorthands 137 | [url "git@github.com:"] 138 | insteadOf = "gh:" 139 | pushInsteadOf = "github:" 140 | pushInsteadOf = "git://github.com/" 141 | 142 | [url "git://github.com/"] 143 | insteadOf = "github:" 144 | 145 | [url "git@gist.github.com:"] 146 | insteadOf = "gst:" 147 | pushInsteadOf = "gist:" 148 | pushInsteadOf = "git://gist.github.com/" 149 | 150 | [url "git://gist.github.com/"] 151 | insteadOf = "gist:" 152 | 153 | [init] 154 | defaultBranch = main 155 | -------------------------------------------------------------------------------- /git/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | [._]*.s[a-w][a-z] 3 | [._]s[a-w][a-z] 4 | *~ 5 | tags 6 | tags.lock 7 | tags.temp 8 | *.un~ 9 | Session.vim 10 | # Compiled source 11 | *.com 12 | *.class 13 | *.dll 14 | *.o 15 | *.so 16 | .lvimrc 17 | .idea 18 | 19 | # Logs and databases 20 | *.log 21 | *.sqlite 22 | 23 | # OS generated files 24 | .DS_Store 25 | .DS_Store? 26 | ._* 27 | .Spotlight-V100 28 | .Trashes 29 | ehthumbs.db 30 | Thumbs.db 31 | gin-bin 32 | .tern-port 33 | 34 | # VSCode workspaces 35 | *.code-workspace 36 | .vscode 37 | *.doc# 38 | :merlin-log: 39 | 40 | CMakeLists.txt.user 41 | CMakeCache.txt 42 | CMakeFiles 43 | CMakeScripts 44 | Testing 45 | cmake_install.cmake 46 | install_manifest.txt 47 | compile_commands.json 48 | CTestTestfile.cmake 49 | _deps 50 | .vim/ 51 | .nvimrc 52 | .projections.json 53 | .classpath 54 | .factorypath 55 | .settings/ 56 | *.iml 57 | bin/ 58 | 59 | # Spell files (ignore all but those my personal dictionary) 60 | *.add 61 | *.add.spl 62 | !/.dotfiles/**/*.add 63 | 64 | # Vim Wiki tag files 65 | .vimwiki_tags 66 | 67 | .nvim.lua 68 | .localrc.lua 69 | .exrc 70 | .ignore 71 | .fvm/ 72 | .gonvim/ 73 | 74 | .ccls-cache/ 75 | .project 76 | # vim:filetype=conf 77 | -------------------------------------------------------------------------------- /git/.gitmessage: -------------------------------------------------------------------------------- 1 | 2 | 3 | # [(optional scope)]: 4 | # 5 | # [optional body] 6 | # 7 | # [optional footer(s)] 8 | 9 | # type 10 | # fix: A bug fix 11 | # feat: A new features 12 | # docs: Documentation only changes 13 | # style: Changes that do not affect the meaning of the code 14 | # refactor: A code change that neither fixes a bug nor adds a feature 15 | # perf: A code change that improves performance 16 | # test: Adding missing or correcting existing tests 17 | # build: Changes that affect the build system or external dependencies 18 | # ci: Changes to our CI configuration files and scripts 19 | # chore: Other changes that don't modify src or test files 20 | # revert: Reverts a previous commit 21 | 22 | # optional scope 23 | # init: Initialize commit 24 | # security: Security to invite users to upgrade in case of vulnerabilities 25 | # deps: Dependencies upgrading or downgrading 26 | # config: Configuration changes 27 | # i18n: Internationalization and localization 28 | # ... 29 | 30 | # subject: Short summary 31 | # - Do nt end with a period 32 | # - Not cased 33 | # - Start writing in lower case 34 | # - 100 chars or less 35 | # - Use the imperative mood 36 | 37 | # optional body: Explain why this change is being made. 38 | # - Wrap it to about 100 characters or so 39 | # - Can use multiple lines with "-" for bullet points 40 | # - Explain what and why vs. how 41 | 42 | # optional footer(s): Provide links or keys to any relevant tickets 43 | # - Wrap it to about 100 characters or so 44 | # Linking a pull request to an issue using a keyword 45 | # - close #ISSUE-NUMBER 46 | # - fix #ISSUE-NUMBER 47 | # - resolve #ISSUE-NUMBER 48 | 49 | # -------------------- 50 | # Conventional Commits 51 | # A specification for adding human and machine readable meaning to commit messages 52 | # Ref: https://www.conventionalcommits.org 53 | # -------------------- 54 | -------------------------------------------------------------------------------- /git/config.template: -------------------------------------------------------------------------------- 1 | [user] 2 | email = "akin@email.com" 3 | 4 | # vim:fileencoding=utf-8:ft=gitconfig 5 | -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | CONFIG="install.conf.yaml" 6 | DOTBOT_DIR="dotbot" 7 | 8 | DOTBOT_BIN="bin/dotbot" 9 | BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 10 | 11 | cd "${BASEDIR}" 12 | git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive 13 | git submodule update --init --recursive "${DOTBOT_DIR}" 14 | 15 | "${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}" 16 | -------------------------------------------------------------------------------- /install.conf.yaml: -------------------------------------------------------------------------------- 1 | - defaults: 2 | link: 3 | create: true 4 | relink: true 5 | 6 | - create: 7 | - ~/.ssh 8 | - ~/.config 9 | - ~/projects 10 | 11 | - clean: [ "~" ] 12 | 13 | - link: 14 | ~/.dotfiles: "" 15 | # ~/.ssh/config: ssh/config # TODO: HOME ONLY 16 | # ~/.config/stylua: .config/stylua # TODO: HOME ONLY 17 | ~/.gitignore: git/.gitignore 18 | ~/.gitconfig: git/.gitconfig 19 | ~/.gitmessage: git/.gitmessage 20 | ~/.zshenv: .config/zsh/.zshenv 21 | ~/.config/tmux: .config/tmux 22 | ~/.config/zsh: .config/zsh 23 | ~/.config/nvim: .config/nvim 24 | ~/.config/ideavim: .config/ideavim 25 | ~/.config/ghostty: .config/ghostty 26 | ~/.config/kitty: .config/kitty 27 | ~/.config/lazygit: .config/lazygit 28 | ~/.config/karabiner: .config/karabiner 29 | ~/.Brewfile: 30 | if: "[ `uname` = Darwin ]" 31 | path: macos/Brewfile 32 | ~/Library/Application Support/lazygit/config.yml: 33 | if: "[ `uname` = Darwin ]" 34 | path: .config/lazygit/config.yml 35 | ~/Library/Application Support/com.mitchellh.ghostty/: 36 | if: "[ `uname` = Darwin ]" 37 | path: .config/ghostty/config 38 | 39 | - shell: 40 | - [ 41 | git submodule update --init --recursive, 42 | Installing submodules 43 | ] 44 | - [ cp -n ./git/config.template ~/.gitconfig.local ] 45 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # add required dependencies 4 | # * GCC 5 | # * python 6 | # * delta 7 | # * bat 8 | # * thefuck 9 | 10 | packages=( 11 | "curl", 12 | "git", 13 | "gcc", 14 | "delta", 15 | "bat", 16 | "thefuck", 17 | "python" 18 | "zoxide" 19 | "lazygit" 20 | "ripgrep" 21 | ) 22 | 23 | exists() { 24 | type "$1" &> /dev/null; 25 | } 26 | 27 | install_missing_packages() { 28 | for p in "${packages[@]}"; do 29 | if hash "$p" 2>/dev/null; then 30 | echo "$p is installed" 31 | else 32 | echo "$p is not installed" 33 | # Detect the platform (similar to $OSTYPE) 34 | OS="`uname`" 35 | case $OS in 36 | 'Linux') 37 | apt install "$1" || echo "$p failed to install" 38 | ;; 39 | 'Darwin') 40 | brew install "$1" || echo "$p failed to install" 41 | ;; 42 | *) ;; 43 | esac 44 | echo "---------------------------------------------------------" 45 | echo "Done " 46 | echo "---------------------------------------------------------" 47 | fi 48 | done 49 | } 50 | 51 | 52 | create_dir() { 53 | if [ ! -d "$1" ]; then 54 | echo "Creating $1" 55 | mkdir -p $1 56 | fi 57 | } 58 | 59 | # Might as well ask for password up-front, right? 60 | echo "Starting install script, please grant me sudo access..." 61 | sudo -v 62 | 63 | # Keep-alive: update existing sudo time stamp if set, otherwise do nothing. 64 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 65 | 66 | if [ "$(uname)" == "Darwin" ]; then 67 | brew="/usr/local/bin/brew" 68 | if [ -f "$brew" ]; then 69 | echo "Homebrew is installed, nothing to do here" 70 | else 71 | echo "Homebrew is not installed, installing now" 72 | echo "This may take a while" 73 | echo "Homebrew requires osx command lines tools, please download xcode first" 74 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 75 | fi 76 | fi 77 | 78 | install_missing_packages || echo "failed to install missing packages" 79 | 80 | # Clone my dotfiles repo into ~/.dotfiles/ if needed 81 | echo "---------------------------------------------------------" 82 | echo "dotfiles" 83 | echo "---------------------------------------------------------" 84 | 85 | export DOTFILES="$HOME/.dotfiles" 86 | 87 | if [ -f "$DOTFILES" ]; then 88 | echo "Dotfiles have already been cloned into the home dir" 89 | else 90 | echo "Cloning dotfiles" 91 | git clone https://github.com/akinsho/dotfiles.git ~/.dotfiles 92 | fi 93 | 94 | cd "$DOTFILES" || "Didn't cd into dotfiles this will be bad :(" 95 | git submodule update --init --recursive 96 | 97 | cd "$HOME" || exit 98 | echo "---------------------------------------------------------" 99 | echo "You'll need to log out for this to take effect" 100 | echo "---------------------------------------------------------" 101 | 102 | if [ "$(uname)" == "Darwin" ]; then 103 | echo "---------------------------------------------------------" 104 | echo "running macos defaults" 105 | echo "this may take a while.. as well" 106 | echo "---------------------------------------------------------" 107 | source "$DOTFILES/configs/macos/install.sh" 108 | echo "Installing brew bundle" 109 | brew tap Homebrew/bundle 110 | brew bundle --global 111 | echo "Installing Homebrew apps from Brewfile" 112 | fi 113 | 114 | if [ ! -d "$HOME/.tmux/plugins/tpm" ]; then 115 | git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm 116 | fi 117 | 118 | # Install n node version manager program 119 | curl -L https://git.io/n-install | bash 120 | 121 | # Install rust 122 | curl https://sh.rustup.rs -sSf | sh 123 | 124 | # These are handled by homebrew on macos 125 | if [ "$(uname)" == "Linux" ] 126 | if exists cargo; then 127 | cargo install stylua 128 | cargo install git-delta 129 | cargo install topgrade 130 | # cargo install cargo-update # requires libopenssl-dev on ubuntu 131 | 132 | # install ripgrep via cargo in case it failed via apt or brew 133 | if ! exists rg; then 134 | cargo install ripgrep 135 | fi 136 | fi 137 | fi 138 | 139 | # TODO install 140 | # * lazygit for linux 141 | 142 | # TODO pip3 dependencies 143 | # * pip3 install neovim --upgrade 144 | # * pip3 install --user neovim-remote 145 | 146 | # Install fzf 147 | git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf 148 | ~/.fzf/install 149 | 150 | echo "---------------------------------------------------------" 151 | echo "Changing to zsh" 152 | echo "---------------------------------------------------------" 153 | chsh -s "$(which zsh)" 154 | 155 | $DOTFILES/install 156 | 157 | echo 'done' 158 | echo "---------------------------------------------------------" 159 | echo "All done!" 160 | echo "Cheers" 161 | echo "---------------------------------------------------------" 162 | 163 | exit 0 164 | -------------------------------------------------------------------------------- /macos/Brewfile: -------------------------------------------------------------------------------- 1 | tap "bufbuild/buf" 2 | tap "buo/cask-upgrade" 3 | tap "craciuncezar/tap" 4 | tap "datawire/blackbird" 5 | tap "homebrew/bundle" 6 | tap "homebrew/services" 7 | tap "jesseduffield/lazygit" 8 | tap "neovim/neovim" 9 | tap "romkatv/powerlevel10k" 10 | # General-purpose data compression with high compression ratio 11 | brew "xz" 12 | # Color management engine supporting ICC profiles 13 | brew "little-cms2" 14 | # Tool for generating GNU Standards-compliant Makefiles 15 | brew "automake" 16 | # Clone of cat(1) with syntax highlighting and Git integration 17 | brew "bat" 18 | # GNU compiler collection 19 | brew "gcc" 20 | # Resource monitor. C++ version and continuation of bashtop and bpytop 21 | brew "btop" 22 | # GNU internationalization (i18n) and localization (l10n) library 23 | brew "gettext" 24 | # Manage compile and link flags for libraries 25 | brew "pkg-config" 26 | # Interpreted, interactive, object-oriented programming language 27 | brew "python@3.9" 28 | # Vector graphics library with cross-device output support 29 | brew "cairo" 30 | # Next-gen compiler infrastructure 31 | brew "llvm" 32 | # C/C++/ObjC language server 33 | brew "ccls" 34 | # Cross-platform make 35 | brew "cmake" 36 | # GNU File, Shell, and Text utilities 37 | brew "coreutils" 38 | # OpenType text shaping engine 39 | brew "harfbuzz" 40 | # LLVM bytecode to JavaScript compiler 41 | brew "emscripten" 42 | # Modern replacement for 'ls' 43 | brew "exa" 44 | # Simple, fast and user-friendly alternative to find 45 | brew "fd" 46 | # Fast and simple Node.js version manager 47 | brew "fnm" 48 | # Generic library support script 49 | brew "libtool" 50 | # Command-line outline and bitmap font editor/converter 51 | brew "fontforge" 52 | # Infamous electronic fortune-cookie generator 53 | brew "fortune" 54 | # GNU compiler collection 55 | brew "gcc@11" 56 | # GitHub command-line tool 57 | brew "gh" 58 | # Automatic git commit --fixup 59 | brew "git-absorb" 60 | # Syntax-highlighting pager for git and diff output 61 | brew "git-delta" 62 | # Extensions to follow Vincent Driessen's branching model 63 | brew "git-flow" 64 | # Open-source GitLab command-line tool 65 | brew "glab" 66 | # GNU Pretty Good Privacy (PGP) package 67 | brew "gnupg" 68 | # Open source programming language to build simple/reliable/efficient software 69 | brew "go" 70 | # Interpreted, interactive, object-oriented programming language 71 | brew "python@3.10" 72 | # Database migrations CLI tool 73 | brew "golang-migrate" 74 | # Fast linters runner for Go 75 | brew "golangci-lint" 76 | # Post-modern modal text editor 77 | brew "helix" 78 | # CLI email client written in Rust 79 | brew "himalaya" 80 | # Improved top (interactive process viewer) 81 | brew "htop" 82 | # Configurable static site generator 83 | brew "hugo" 84 | # Database of common MIME types 85 | brew "shared-mime-info" 86 | # Tools and libraries to manipulate images in many formats 87 | brew "imagemagick" 88 | # Kubernetes CLI To Manage Your Clusters In Style! 89 | brew "k9s" 90 | # Generic command-line non-JVM Apache Kafka producer and consumer 91 | brew "kcat" 92 | # Kubernetes command-line interface 93 | brew "kubernetes-cli" 94 | # Template-free customization of Kubernetes YAML manifests 95 | brew "kustomize" 96 | # Simple terminal UI for git commands 97 | brew "lazygit" 98 | # Library that implements the rsync remote-delta algorithm 99 | brew "librsync" 100 | # YAML Parser 101 | brew "libyaml" 102 | # Powerful, lightweight programming language (v5.1.5) 103 | brew "lua@5.1" 104 | # Just-In-Time Compiler (JIT) for the Lua programming language 105 | brew "luajit" 106 | # Keep your Mac's application settings in sync 107 | brew "mackup" 108 | # Mac App Store command-line interface 109 | brew "mas" 110 | # Node version management 111 | brew "n" 112 | # Parser generator tool and incremental parsing library 113 | brew "tree-sitter" 114 | # Control nvim processes using `nvr` command-line tool 115 | brew "neovim-remote" 116 | # Small build system for use with gyp or CMake 117 | brew "ninja" 118 | # Cryptography and SSL/TLS Toolkit 119 | brew "openssl@3" 120 | # Swiss-army knife of markup format conversion 121 | brew "pandoc" 122 | # PostgreSQL syntax beautifier 123 | brew "pgformatter" 124 | # Pinentry for GPG on Mac 125 | brew "pinentry-mac" 126 | # 📦🚀 Fast, disk space efficient package manager 127 | brew "pnpm" 128 | # Object-relational database system 129 | brew "postgresql@14" 130 | # Python version management 131 | brew "pyenv" 132 | # Search tool like grep and The Silver Searcher 133 | brew "ripgrep" 134 | # Powerful, clean, object-oriented scripting language 135 | brew "ruby" 136 | # Generate type safe Go from SQL 137 | brew "sqlc" 138 | # CLI utility for manipulating SQLite databases 139 | brew "sqlite-utils" 140 | # Opinionated Lua code formatter 141 | brew "stylua" 142 | # Send macOS User Notifications from the command-line 143 | brew "terminal-notifier" 144 | # Tool to build, change, and version infrastructure 145 | brew "terraform" 146 | # Programmatically correct mistyped console commands 147 | brew "thefuck" 148 | # Simplified and community-driven man pages 149 | brew "tldr" 150 | # Terminal multiplexer 151 | brew "tmux" 152 | # Display directories as trees (with optional color/HTML output) 153 | brew "tree" 154 | # Internet file retriever 155 | brew "wget" 156 | # Generate your Xcode project from a spec file and your folder structure 157 | brew "xcodegen" 158 | # General-purpose lossless data-compression library 159 | brew "zlib" 160 | # Shell extension to navigate your filesystem faster 161 | brew "zoxide" 162 | # Additional completion definitions for zsh 163 | brew "zsh-completions" 164 | # A git command extension for switching git branches more efficiently. 165 | brew "craciuncezar/tap/git-smart-checkout" 166 | # Enable Windows-like alt-tab 167 | cask "alt-tab" 168 | # Open links in any browser 169 | cask "choosy" 170 | # API documentation browser and code snippet manager 171 | cask "dash" 172 | # App to build and share containerized applications and microservices 173 | cask "docker" 174 | # Tool to hide status bar icons 175 | cask "dozer" 176 | # Matrix collaboration client 177 | cask "element" 178 | # UI toolkit for building applications for mobile, web and desktop 179 | cask "flutter" 180 | # Web browser 181 | cask "google-chrome" 182 | # Set of tools to manage resources and applications hosted on Google Cloud 183 | cask "google-cloud-sdk" 184 | # Desktop automation application 185 | cask "hammerspoon" 186 | # Free and open-source media player 187 | cask "iina" 188 | # GPU-based terminal emulator 189 | cask "kitty" 190 | # Meet, chat, call, and collaborate in just one place 191 | cask "microsoft-teams" 192 | # Collaboration platform for API development 193 | cask "postman" 194 | # Team communication and collaboration software 195 | cask "slack" 196 | # Music streaming service 197 | cask "spotify" 198 | # System monitor for the menu bar 199 | cask "stats" 200 | # Desktop client for Telegram messenger 201 | cask "telegram-desktop" 202 | # Multimedia player 203 | cask "vlc" 204 | # Torrent streaming application 205 | cask "webtorrent" 206 | # HTML to PDF renderer 207 | cask "wkhtmltopdf" 208 | mas "Amphetamine", id: 937984704 209 | mas "Color Picker", id: 1545870783 210 | mas "Dropover", id: 1355679052 211 | mas "GIF Brewery 3", id: 1081413713 212 | mas "Hand Mirror", id: 1502839586 213 | mas "Microsoft Outlook", id: 985367838 214 | mas "Numbers", id: 409203825 215 | mas "Pages", id: 409201541 216 | mas "Prime Video", id: 545519333 217 | mas "Shortery", id: 1594183810 218 | mas "Xcode", id: 497799835 219 | -------------------------------------------------------------------------------- /macos/install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # CREDIT: Mathias Byens 4 | # ~/.macos — https://mths.be/macos 5 | 6 | # Close any open System Preferences panes, to prevent them from overriding 7 | # settings we’re about to change 8 | osascript -e 'tell application "System Preferences" to quit' 9 | 10 | # Ask for the administrator password upfront 11 | sudo -v 12 | 13 | # Keep-alive: update existing `sudo` time stamp until `.macos` has finished 14 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 15 | 16 | ############################################################################### 17 | # General UI/UX # 18 | ############################################################################### 19 | # Disable accent menu on holding key 20 | defaults write -g ApplePressAndHoldEnabled -bool false 21 | 22 | # Enable automatically hiding menubar 23 | # defaults write NSGlobalDomain _HIHideMenuBar -bool true 24 | 25 | # Expand save panel by default 26 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 27 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 28 | 29 | # Expand print panel by default 30 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 31 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 32 | 33 | # Save to disk (not to iCloud) by default 34 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 35 | 36 | # Automatically quit printer app once the print jobs complete 37 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 38 | 39 | # Disable the “Are you sure you want to open this application?” dialog 40 | defaults write com.apple.LaunchServices LSQuarantine -bool false 41 | 42 | # Disable Resume system-wide 43 | defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 44 | 45 | # Restart automatically if the computer freezes 46 | sudo systemsetup -setrestartfreeze on 47 | 48 | # Disable smart dashes as they’re annoying when typing code 49 | defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 50 | 51 | # Disable automatic period substitution as it’s annoying when typing code 52 | defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false 53 | 54 | # Disable smart quotes as they’re annoying when typing code 55 | defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 56 | 57 | # Disable auto-correct 58 | defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 59 | 60 | ############################################################################### 61 | # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 62 | ############################################################################### 63 | 64 | # Trackpad: enable tap to click for this user and for the login screen 65 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 66 | defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 67 | defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 68 | 69 | # Trackpad: map bottom right corner to right-click 70 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 71 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 72 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 73 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 74 | 75 | # Set a blazingly fast keyboard repeat rate 76 | defaults write NSGlobalDomain KeyRepeat -int 1 77 | defaults write NSGlobalDomain InitialKeyRepeat -int 10 78 | 79 | ############################################################################### 80 | # Screen # 81 | ############################################################################### 82 | 83 | # Stop iTunes from responding to the keyboard media keys 84 | launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null 85 | 86 | # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 87 | defaults write com.apple.finder QuitMenuItem -bool true 88 | 89 | # Finder: show hidden files by default 90 | defaults write com.apple.finder AppleShowAllFiles -bool true 91 | 92 | # Finder: show all filename extensions 93 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 94 | 95 | # Disable the warning before emptying the Trash 96 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 97 | 98 | ############################################################################### 99 | # Dock, Dashboard, and hot corners # 100 | ############################################################################### 101 | 102 | # Show indicator lights for open applications in the Dock 103 | defaults write com.apple.dock show-process-indicators -bool true 104 | 105 | # Automatically hide and show the Dock 106 | defaults write com.apple.dock autohide -bool true 107 | 108 | # Save screenshots to the desktop 109 | defaults write com.apple.screencapture location -string "$HOME/Desktop" 110 | 111 | # Show hidden apps in the dock 112 | defaults write com.apple.Dock showhidden -bool yes 113 | 114 | ############################################################################### 115 | # Activity Monitor # 116 | ############################################################################### 117 | 118 | # Show the main window when launching Activity Monitor 119 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 120 | 121 | # Visualize CPU usage in the Activity Monitor Dock icon 122 | defaults write com.apple.ActivityMonitor IconType -int 5 123 | 124 | # Show all processes in Activity Monitor 125 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 126 | 127 | # Sort Activity Monitor results by CPU usage 128 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 129 | defaults write com.apple.ActivityMonitor SortDirection -int 0 130 | ############################################################################### 131 | # Kill affected applications # 132 | ############################################################################### 133 | 134 | for app in "Activity Monitor" \ 135 | "Address Book" \ 136 | "Calendar" \ 137 | "cfprefsd" \ 138 | "Contacts" \ 139 | "Dock" \ 140 | "Finder" \ 141 | "Google Chrome" \ 142 | "Photos" \ 143 | "SystemUIServer"; do 144 | killall "${app}" &> /dev/null 145 | done 146 | echo "Done. Note that some of these changes require a logout/restart to take effect." 147 | 148 | # vim:filetype=bash 149 | -------------------------------------------------------------------------------- /macos/kitty-icon-automation.norg: -------------------------------------------------------------------------------- 1 | @document.meta 2 | title: kitty-icon-automation 3 | description: Auto updating kitty's Icon 4 | authors: akin 5 | categories: Productivity 6 | created: 2022-07-29 7 | version: 0.0.11 8 | @end 9 | 10 | ** Manual script update 11 | Manually run the following script 12 | #tangle ./macos/kitty-icon.zsh 13 | @code zsh 14 | cp $SYNC_DIR/kitty/icons/kitty-light.icns /Applications/kitty.app/Contents/Resources/kitty.icns 15 | rm /var/folders/*/*/*/com.apple.dock.iconcache 16 | touch /Applications/kitty.app 17 | killall Dock && killall Finder 18 | @end 19 | ** Automated update using Automator 20 | To automatically change the icon for kitty following updates I created an `Automator Folder Action` 21 | 22 | The steps include: 23 | ~ Open `Automator` 24 | ~ Create a new action specifying a `Folder Action` 25 | ~ Set `/Users//Applications/` as the target folder 26 | ~ Choose `Run Shell Script as the action` 27 | ~ Set the input to be passed in as `Arguments` 28 | ~ Paste the block below into the space for the script 29 | @code zsh 30 | for f in "$@" 31 | do 32 | if [[ $f == *"kitty"* ]] then 33 | cp $SYNC_DIR/kitty/icons/kitty-light.icns /Applications/kitty.app/Contents/Resources/kitty.icns 34 | rm /var/folders/*/*/*/com.apple.dock.iconcache 35 | touch /Applications/kitty.app 36 | killall Dock && killall Finder 37 | 38 | osascript -e "display notification \"Updated Kitty icon\"" 39 | fi 40 | done 41 | @end 42 | 43 | *NOTE:* This is still WIP as installing kitty does not always trigger a folder action 44 | 45 | ** References: 46 | - https://www.sethvargo.com/replace-icons-osx 47 | - https://github.com/DinkDonk/kitty-icon#installation 48 | -------------------------------------------------------------------------------- /macos/kitty-icon.zsh: -------------------------------------------------------------------------------- 1 | cp $SYNC_DIR/kitty/icons/kitty-light.icns /Applications/kitty.app/Contents/Resources/kitty.icns 2 | rm /var/folders/*/*/*/com.apple.dock.iconcache 3 | touch /Applications/kitty.app 4 | killall Dock && killall Finder 5 | -------------------------------------------------------------------------------- /macos/limit.maxfiles.plist: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Label 7 | limit.maxfiles 8 | ProgramArguments 9 | 10 | launchctl 11 | limit 12 | maxfiles 13 | 64000 14 | 524288 15 | 16 | RunAtLoad 17 | 18 | ServiceIPC 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /neorg/macos.norg: -------------------------------------------------------------------------------- 1 | @document.meta 2 | title: macos 3 | description: All things Mac specific 4 | authors: akin 5 | categories: OS 6 | created: 2022-07-08 7 | version: 0.0.11 8 | @end 9 | 10 | * TODO: 11 | - [ ] Symlink `limit.maxfiles.plist` to /Library/LaunchDaemons/ 12 | 13 | * OS Development Tweaks 14 | ** Fixing the "too many open files" issue in macOS 15 | ~ Create a file called {@ /Library/LaunchDaemons/limit.maxfiles.plist}[limit.maxfiles.plist] in `/Library/LaunchDaemons/` 16 | ~ Add the following content 17 | #tangle ./macos/limit.maxfiles.plist 18 | @code xml 19 | 20 | 22 | 23 | 24 | Label 25 | limit.maxfiles 26 | ProgramArguments 27 | 28 | launchctl 29 | limit 30 | maxfiles 31 | 64000 32 | 524288 33 | 34 | RunAtLoad 35 | 36 | ServiceIPC 37 | 38 | 39 | 40 | @end 41 | ~ `sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist` 42 | ~ `sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist` 43 | ~ Restart your mac 44 | 45 | **** Resources: 46 | - https://discussions.apple.com/thread/253001317 47 | - https://superuser.com/questions/1634286/how-do-i-increase-the-max-open-files-in-macos-big-sur 48 | - https://unix.stackexchange.com/questions/108174/how-to-persistently-control-maximum-system-resource-consumption-on-mac/221988#221988 49 | -------------------------------------------------------------------------------- /ssh/config: -------------------------------------------------------------------------------- 1 | # personal 2 | Host github.com 3 | HostName github.com 4 | IdentityFile ~/.ssh/id_ed25519 5 | IdentitiesOnly yes 6 | 7 | Host gitlab.com 8 | HostName gitlab.com 9 | IdentityFile ~/.ssh/id_ed25519_gitlab 10 | IdentitiesOnly yes 11 | 12 | # work 13 | Host github-work 14 | HostName github.com 15 | IdentityFile ~/.ssh/id_ed25519_work 16 | IdentitiesOnly yes 17 | # vim: ft=sshconfig 18 | -------------------------------------------------------------------------------- /stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 120 2 | indent_type = 'Spaces' 3 | quote_style = 'AutoPreferSingle' 4 | indent_width = 2 5 | call_parentheses = 'Always' 6 | collapse_simple_statement = 'Always' 7 | -------------------------------------------------------------------------------- /vim/.vimrc: -------------------------------------------------------------------------------- 1 | "-------------------------------------------------------------------------------- 2 | " Plug Setup {{{1 3 | "-------------------------------------------------------------------------------- 4 | if empty(glob('~/.vim/autoload/plug.vim')) 5 | silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs 6 | \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 7 | autocmd VimEnter * PlugInstall --sync | source $MYVIMRC 8 | endif 9 | Plug 'airblade/vim-rooter' 10 | Plug 'junegunn/fzf', #{dir: '~/.fzf', do: './install --all'} 11 | Plug 'junegunn/fzf.vim' 12 | Plug 'mhinz/vim-startify' 13 | if exists('$TMUX') 14 | Plug 'christoomey/vim-tmux-navigator' 15 | endif 16 | Plug 'neoclide/coc.nvim' 17 | Plug 'honza/vim-snippets' 18 | Plug 'mbbill/undotree', {'on:' ['UndotreeToggle']} 19 | Plug 'mhinz/vim-sayonara', {'on:''Sayonara' } 20 | Plug 'itchyny/vim-highlighturl' 21 | Plug 'kshenoy/vim-signature' 22 | Plug 'tpope/vim-commentary' 23 | Plug 'tpope/vim-surround' 24 | Plug 'tpope/vim-eunuch' 25 | Plug 'tpope/vim-repeat' 26 | Plug 'tpope/vim-abolish' 27 | Plug 'tpope/vim-apathy' 28 | Plug 'Yggdroot/indentLine' 29 | Plug 'sheerun/vim-polyglot' 30 | Plug 'tpope/vim-fugitive' 31 | Plug 'chaoren/vim-wordmotion' 32 | Plug 'tommcdo/vim-exchange' 33 | Plug 'wellle/targets.vim' 34 | Plug 'kana/vim-textobj-user' 35 | \ | Plug 'kana/vim-operator-user' 36 | Plug 'justinmk/vim-sneak' 37 | Plug 'junegunn/goyo.vim', #{for: ['vimwiki','markdown']} 38 | Plug 'ryanoasis/vim-devicons' 39 | Plug 'bagrat/vim-buffet' 40 | Plug 'rakr/vim-one' 41 | 42 | call plug#end() 43 | 44 | " cfilter plugin allows filter down an existing quickfix list 45 | packadd! cfilter 46 | packadd! matchit 47 | 48 | nnoremap pi :PlugInstall 49 | nnoremap ps :PlugStatus 50 | nnoremap pc :PlugClean 51 | nnoremap pu :PlugUpdate 52 | tnoremap h 53 | tnoremap j 54 | tnoremap k 55 | tnoremap l 56 | tnoremap q! 57 | " vim:foldmethod=marker 58 | --------------------------------------------------------------------------------