From c80a54e42b52ce297f0f2f71af23c562832025c7 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Fri, 24 Jan 2025 20:35:27 +0900 Subject: init --- ar/.config/LazyVim/.gitignore | 8 + ar/.config/LazyVim/.neoconf.json | 15 + ar/.config/LazyVim/LICENSE | 201 ++ ar/.config/LazyVim/README.md | 4 + ar/.config/LazyVim/db_ui/connections.json | 1 + ar/.config/LazyVim/init.lua | 3 + ar/.config/LazyVim/lua/config/autocmds.lua | 157 + ar/.config/LazyVim/lua/config/keymaps.lua | 275 ++ ar/.config/LazyVim/lua/config/lazy.lua | 105 + ar/.config/LazyVim/lua/config/options.lua | 105 + ar/.config/LazyVim/lua/plugins/better-escape.lua | 6 + ar/.config/LazyVim/lua/plugins/bqf.lua | 9 + ar/.config/LazyVim/lua/plugins/catppuccin.lua | 92 + ar/.config/LazyVim/lua/plugins/cmp.lua | 50 + ar/.config/LazyVim/lua/plugins/colorscheme.lua | 11 + ar/.config/LazyVim/lua/plugins/comment.lua | 23 + ar/.config/LazyVim/lua/plugins/dadbod.lua | 25 + ar/.config/LazyVim/lua/plugins/dashboard-nvim.lua | 68 + ar/.config/LazyVim/lua/plugins/example.lua | 265 ++ ar/.config/LazyVim/lua/plugins/file-browser.lua | 15 + ar/.config/LazyVim/lua/plugins/glow.lua | 8 + ar/.config/LazyVim/lua/plugins/goyo.lua | 53 + ar/.config/LazyVim/lua/plugins/harpoon.lua | 19 + ar/.config/LazyVim/lua/plugins/impatient.lua | 6 + ar/.config/LazyVim/lua/plugins/jukit.lua | 79 + ar/.config/LazyVim/lua/plugins/jupyter.lua | 345 ++ ar/.config/LazyVim/lua/plugins/lspconfig.lua | 77 + ar/.config/LazyVim/lua/plugins/lualine.lua | 105 + ar/.config/LazyVim/lua/plugins/magma.lua | 23 + .../LazyVim/lua/plugins/markdown-preview.lua | 23 + ar/.config/LazyVim/lua/plugins/mason.lua | 92 + ar/.config/LazyVim/lua/plugins/neogen.lua | 33 + ar/.config/LazyVim/lua/plugins/notify.lua | 6 + ar/.config/LazyVim/lua/plugins/nvim-neo-tree.lua | 16 + ar/.config/LazyVim/lua/plugins/obsidian.lua | 319 ++ ar/.config/LazyVim/lua/plugins/oil.lua | 13 + ar/.config/LazyVim/lua/plugins/playground.lua | 38 + ar/.config/LazyVim/lua/plugins/project.lua | 6 + ar/.config/LazyVim/lua/plugins/refactoring.lua | 35 + ar/.config/LazyVim/lua/plugins/seoul256.lua | 3 + ar/.config/LazyVim/lua/plugins/tagbar.lua | 12 + ar/.config/LazyVim/lua/plugins/telescope.lua | 24 + ar/.config/LazyVim/lua/plugins/tmux-navigator.lua | 19 + ar/.config/LazyVim/lua/plugins/tokyonight.lua | 10 + ar/.config/LazyVim/lua/plugins/treesj.lua | 32 + ar/.config/LazyVim/lua/plugins/vimwiki.lua | 37 + ar/.config/LazyVim/lua/plugins/which-key.lua | 55 + ar/.config/LazyVim/lua/plugins/yanky.lua | 31 + ar/.config/LazyVim/lua/plugins/zen-mode.lua | 11 + ar/.config/LazyVim/stylua.toml | 3 + ar/.config/LazyVim/vscode/easymotion-config.vim | 2 + ar/.config/LazyVim/vscode/plugins.lua | 153 + ar/.config/LazyVim/vscode/remap.lua | 32 + ar/.config/LazyVim/vscode/settings.vim | 49 + ar/.config/NvChad/.ignore | 1 + ar/.config/NvChad/.stylua.toml | 6 + ar/.config/NvChad/LICENSE | 674 ++++ ar/.config/NvChad/db_ui/connections.json | 1 + ar/.config/NvChad/db_ui/si/safTEST | 1 + ar/.config/NvChad/init.lua | 21 + ar/.config/NvChad/lua/core/bootstrap.lua | 62 + ar/.config/NvChad/lua/core/default_config.lua | 92 + ar/.config/NvChad/lua/core/init.lua | 116 + ar/.config/NvChad/lua/core/mappings.lua | 468 +++ ar/.config/NvChad/lua/core/utils.lua | 118 + ar/.config/NvChad/lua/custom/README.md | 3 + ar/.config/NvChad/lua/custom/chadrc.lua | 54 + .../NvChad/lua/custom/configs/cell_marker.lua | 159 + ar/.config/NvChad/lua/custom/configs/dadbod.lua | 29 + ar/.config/NvChad/lua/custom/configs/lspconfig.lua | 71 + ar/.config/NvChad/lua/custom/configs/null-ls.lua | 45 + ar/.config/NvChad/lua/custom/configs/overrides.lua | 247 ++ ar/.config/NvChad/lua/custom/highlights.lua | 21 + ar/.config/NvChad/lua/custom/init.lua | 55 + ar/.config/NvChad/lua/custom/mappings.lua | 740 ++++ ar/.config/NvChad/lua/custom/plugins.lua | 862 +++++ ar/.config/NvChad/lua/plugins/configs/cmp.lua | 120 + .../NvChad/lua/plugins/configs/lazy_nvim.lua | 47 + .../NvChad/lua/plugins/configs/lspconfig.lua | 67 + ar/.config/NvChad/lua/plugins/configs/mason.lua | 28 + ar/.config/NvChad/lua/plugins/configs/nvimtree.lua | 77 + ar/.config/NvChad/lua/plugins/configs/others.lua | 66 + .../NvChad/lua/plugins/configs/telescope.lua | 63 + .../NvChad/lua/plugins/configs/treesitter.lua | 12 + ar/.config/NvChad/lua/plugins/init.lua | 273 ++ ar/.config/NvChad/vim_cheatsheet.webp | Bin 0 -> 671056 bytes ar/.config/NvChad/vim_cheatsheet2.webp | Bin 0 -> 283702 bytes ar/.config/NvChad/vscode/easymotion-config.vim | 2 + ar/.config/NvChad/vscode/plugins.lua | 153 + ar/.config/NvChad/vscode/remap.lua | 32 + ar/.config/NvChad/vscode/settings.vim | 49 + .../after/queries/markdown/textobjects.scm | 3 + ar/.config/TheSiahxyz/ftplugin/markdown.lua | 440 +++ ar/.config/TheSiahxyz/ftplugin/quarto.lua | 6 + ar/.config/TheSiahxyz/init.lua | 1 + .../TheSiahxyz/lua/thesiahxyz/core/autocmds.lua | 381 ++ .../TheSiahxyz/lua/thesiahxyz/core/keymaps.lua | 806 +++++ ar/.config/TheSiahxyz/lua/thesiahxyz/core/lazy.lua | 17 + .../TheSiahxyz/lua/thesiahxyz/core/options.lua | 42 + ar/.config/TheSiahxyz/lua/thesiahxyz/health.lua | 45 + ar/.config/TheSiahxyz/lua/thesiahxyz/init.lua | 15 + .../TheSiahxyz/lua/thesiahxyz/plugins/ai.lua | 286 ++ .../TheSiahxyz/lua/thesiahxyz/plugins/cloak.lua | 42 + .../TheSiahxyz/lua/thesiahxyz/plugins/cmp.lua | 326 ++ .../lua/thesiahxyz/plugins/colorschemes.lua | 268 ++ .../TheSiahxyz/lua/thesiahxyz/plugins/comment.lua | 50 + .../TheSiahxyz/lua/thesiahxyz/plugins/compiler.lua | 53 + .../TheSiahxyz/lua/thesiahxyz/plugins/context.lua | 26 + .../TheSiahxyz/lua/thesiahxyz/plugins/csv.lua | 88 + .../TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua | 52 + .../TheSiahxyz/lua/thesiahxyz/plugins/dap.lua | 295 ++ .../TheSiahxyz/lua/thesiahxyz/plugins/docker.lua | 222 ++ .../TheSiahxyz/lua/thesiahxyz/plugins/git.lua | 221 ++ .../TheSiahxyz/lua/thesiahxyz/plugins/goyo.lua | 39 + .../TheSiahxyz/lua/thesiahxyz/plugins/harpoon2.lua | 103 + .../TheSiahxyz/lua/thesiahxyz/plugins/image.lua | 210 ++ .../TheSiahxyz/lua/thesiahxyz/plugins/init.lua | 83 + .../TheSiahxyz/lua/thesiahxyz/plugins/keys.lua | 278 ++ .../TheSiahxyz/lua/thesiahxyz/plugins/lf.lua | 121 + .../TheSiahxyz/lua/thesiahxyz/plugins/lsp.lua | 643 ++++ .../TheSiahxyz/lua/thesiahxyz/plugins/lualine.lua | 259 ++ .../TheSiahxyz/lua/thesiahxyz/plugins/markdown.lua | 454 +++ .../TheSiahxyz/lua/thesiahxyz/plugins/marks.lua | 16 + .../TheSiahxyz/lua/thesiahxyz/plugins/mini.lua | 1132 ++++++ .../TheSiahxyz/lua/thesiahxyz/plugins/navic.lua | 52 + .../TheSiahxyz/lua/thesiahxyz/plugins/obsidian.lua | 616 ++++ .../TheSiahxyz/lua/thesiahxyz/plugins/outline.lua | 11 + .../TheSiahxyz/lua/thesiahxyz/plugins/project.lua | 12 + .../TheSiahxyz/lua/thesiahxyz/plugins/python.lua | 59 + .../TheSiahxyz/lua/thesiahxyz/plugins/quickfix.lua | 76 + .../lua/thesiahxyz/plugins/refactoring.lua | 60 + .../TheSiahxyz/lua/thesiahxyz/plugins/sessions.lua | 32 + .../TheSiahxyz/lua/thesiahxyz/plugins/silicon.lua | 145 + .../TheSiahxyz/lua/thesiahxyz/plugins/snippets.lua | 72 + .../TheSiahxyz/lua/thesiahxyz/plugins/surround.lua | 14 + .../lua/thesiahxyz/plugins/telescope.lua | 1041 ++++++ .../lua/thesiahxyz/plugins/textobject.lua | 140 + .../lua/thesiahxyz/plugins/treesitter.lua | 62 + .../TheSiahxyz/lua/thesiahxyz/plugins/ufo.lua | 56 + .../TheSiahxyz/lua/thesiahxyz/plugins/urlview.lua | 103 + .../TheSiahxyz/lua/thesiahxyz/plugins/vimwiki.lua | 64 + .../TheSiahxyz/lua/thesiahxyz/plugins/zenmode.lua | 46 + .../lua/thesiahxyz/snippets/markdown.lua | 187 + .../lua/thesiahxyz/snippets/neetcode1.lua | 103 + .../lua/thesiahxyz/snippets/neetcode2.lua | 104 + .../TheSiahxyz/lua/thesiahxyz/snippets/quarto.lua | 28 + .../lua/thesiahxyz/snippets/whichkey.lua | 18 + .../TheSiahxyz/lua/thesiahxyz/spells/en.utf-8.add | 113 + .../lua/thesiahxyz/spells/en.utf-8.add.spl | Bin 0 -> 1365 bytes .../TheSiahxyz/lua/thesiahxyz/utils/cheatsheet.lua | 13 + .../lua/thesiahxyz/utils/cheatsheet/grid.lua | 105 + .../lua/thesiahxyz/utils/cheatsheet/init.lua | 116 + .../TheSiahxyz/lua/thesiahxyz/utils/icons.lua | 168 + .../TheSiahxyz/lua/thesiahxyz/utils/markdown.lua | 26 + .../TheSiahxyz/lua/thesiahxyz/utils/snippet.lua | 38 + .../TheSiahxyz/lua/thesiahxyz/utils/tasks.lua | 227 ++ .../TheSiahxyz/lua/thesiahxyz/utils/tmux.lua | 63 + .../TheSiahxyz/lua/thesiahxyz/utils/utils.lua | 112 + ar/.config/asus_jack_audio_issue.txt | 7 + ar/.config/atuin/config.toml | 210 ++ ar/.config/auto-cpufreq/auto-cpufreq.conf | 61 + ar/.config/bash/bash_profile | 40 + ar/.config/bash/bashrc | 703 ++++ ar/.config/bat/config | 8 + ar/.config/bat/themes/Catppuccin Frappe.tmTheme | 2059 +++++++++++ ar/.config/bat/themes/Catppuccin Latte.tmTheme | 2059 +++++++++++ ar/.config/bat/themes/Catppuccin Macchiato.tmTheme | 2059 +++++++++++ ar/.config/bat/themes/Catppuccin Mocha.tmTheme | 2059 +++++++++++ ar/.config/blacklist.conf | 1 + ar/.config/calcurse/conf | 33 + ar/.config/calcurse/keys | 56 + ar/.config/crons | 14 + ar/.config/dunst/dunstrc | 76 + ar/.config/fastfetch/config.jsonc | 167 + ar/.config/fcitx5/conf/cached_layouts | 3670 +++++++++++++++++++ ar/.config/fcitx5/conf/clipboard.conf | 7 + ar/.config/fcitx5/conf/hangul.conf | 19 + ar/.config/fcitx5/conf/keyboard.conf | 27 + ar/.config/fcitx5/conf/notifications.conf | 3 + ar/.config/fcitx5/conf/quickphrase.conf | 9 + ar/.config/fcitx5/conf/waylandim.conf | 5 + ar/.config/fcitx5/conf/xcb.conf | 5 + ar/.config/fcitx5/conf/xim.conf | 3 + ar/.config/fcitx5/config | 79 + ar/.config/fcitx5/profile | 23 + ar/.config/firefox/chrome/userChrome.css | 106 + ar/.config/firefox/enhanceforyoutube.json | 109 + ar/.config/firefox/thesiah.js | 79 + ar/.config/firefox/vdh-settings.json | 90 + ar/.config/firefox/vimium-options.json | 25 + ar/.config/fontconfig/fonts.conf | 70 + ar/.config/gem/gemrc | 3 + ar/.config/git/attributes | 98 + ar/.config/git/config | 81 + ar/.config/git/gitk | 64 + ar/.config/git/ignore | 112 + ar/.config/gitmux/gitmux.conf | 86 + ar/.config/gtk-2.0/gtkrc-2.0 | 21 + ar/.config/gtk-3.0/settings.ini | 20 + ar/.config/lazygit/config.yml | 15 + ar/.config/lf/cleaner | 4 + ar/.config/lf/icons | 305 ++ ar/.config/lf/lfrc | 607 ++++ ar/.config/lf/rooticons | 336 ++ ar/.config/lf/scope | 83 + ar/.config/mimeapps.list | 26 + ar/.config/mpd/mpd.conf | 19 + ar/.config/mpd/playlists/entire.m3u | 890 +++++ ar/.config/mpd/playlists/jpop.m3u | 156 + ar/.config/mpd/playlists/kpop.m3u | 113 + ar/.config/mpd/playlists/pop.m3u | 56 + ar/.config/mpv/input.conf | 114 + ar/.config/mpv/lua_settings/blur_edges.conf | 26 + ar/.config/mpv/lua_settings/gallery_worker.conf | 18 + ar/.config/mpv/lua_settings/mpv_crop_script.conf | 2 + .../mpv/lua_settings/mpv_thumbnail_script.conf | 3 + ar/.config/mpv/lua_settings/playlist_view.conf | 123 + ar/.config/mpv/mpv.conf | 11 + ar/.config/mpv/osc.conf | 1 + ar/.config/mpv/script-modules/extended-menu.lua | 1214 +++++++ ar/.config/mpv/script-modules/gallery.lua | 581 +++ ar/.config/mpv/script-modules/input-console.lua | 935 +++++ ar/.config/mpv/script-modules/mpvSockets.lua | 36 + ar/.config/mpv/script-modules/scroll-list.lua | 293 ++ ar/.config/mpv/script-modules/sha1.lua | 334 ++ .../mpv/script-modules/user-input-module.lua | 126 + ar/.config/mpv/script-modules/utf8/LICENSE | 21 + ar/.config/mpv/script-modules/utf8/README.md | 93 + .../utf8/begins/compiletime/parser.lua | 17 + .../utf8/begins/compiletime/vanilla.lua | 60 + .../utf8/charclass/compiletime/builder.lua | 128 + .../utf8/charclass/compiletime/parser.lua | 21 + .../utf8/charclass/compiletime/range.lua | 44 + .../utf8/charclass/compiletime/stub.lua | 9 + .../utf8/charclass/compiletime/vanilla.lua | 131 + .../script-modules/utf8/charclass/runtime/base.lua | 184 + .../utf8/charclass/runtime/dummy.lua | 41 + .../script-modules/utf8/charclass/runtime/init.lua | 22 + .../utf8/charclass/runtime/native.lua | 47 + .../script-modules/utf8/context/compiletime.lua | 18 + .../mpv/script-modules/utf8/context/runtime.lua | 112 + .../utf8/ends/compiletime/parser.lua | 17 + .../utf8/ends/compiletime/vanilla.lua | 46 + .../mpv/script-modules/utf8/functions/lua53.lua | 152 + ar/.config/mpv/script-modules/utf8/init.lua | 71 + .../utf8/modifier/compiletime/frontier.lua | 50 + .../utf8/modifier/compiletime/parser.lua | 20 + .../utf8/modifier/compiletime/simple.lua | 23 + .../utf8/modifier/compiletime/stub.lua | 28 + .../utf8/modifier/compiletime/vanilla.lua | 270 ++ .../mpv/script-modules/utf8/primitives/dummy.lua | 555 +++ .../mpv/script-modules/utf8/primitives/init.lua | 23 + .../mpv/script-modules/utf8/primitives/native.lua | 57 + .../script-modules/utf8/primitives/tarantool.lua | 13 + .../mpv/script-modules/utf8/regex_parser.lua | 80 + ar/.config/mpv/script-modules/utf8/test.sh | 23 + .../utf8/test/charclass_compiletime.lua | 165 + .../script-modules/utf8/test/charclass_runtime.lua | 116 + .../script-modules/utf8/test/context_runtime.lua | 82 + ar/.config/mpv/script-modules/utf8/test/strict.lua | 42 + ar/.config/mpv/script-modules/utf8/test/test.lua | 205 ++ .../mpv/script-modules/utf8/test/test_compat.lua | 109 + .../mpv/script-modules/utf8/test/test_pm.lua | 392 ++ .../mpv/script-modules/utf8/test/test_utf8data.lua | 15 + ar/.config/mpv/script-modules/utf8/test/util.lua | 75 + ar/.config/mpv/script-modules/utf8/util.lua | 64 + ar/.config/mpv/script-modules/utf8_data.lua | 1865 ++++++++++ ar/.config/mpv/script-opts/SimpleBookmark.conf | 311 ++ ar/.config/mpv/script-opts/SmartCopyPaste_II.conf | 343 ++ ar/.config/mpv/script-opts/SmartSkip.conf | 221 ++ ar/.config/mpv/script-opts/command_palette.conf | 19 + ar/.config/mpv/script-opts/mdmenu.conf | 13 + ar/.config/mpv/script-opts/playlist_view.conf | 123 + ar/.config/mpv/script-opts/thumbfast.conf | 41 + ar/.config/mpv/scripts/Rename.lua | 99 + ar/.config/mpv/scripts/SimpleBookmark.lua | 2907 +++++++++++++++ ar/.config/mpv/scripts/SmartCopyPaste_II.lua | 3797 ++++++++++++++++++++ ar/.config/mpv/scripts/SmartSkip.lua | 1936 ++++++++++ ar/.config/mpv/scripts/UndoRedo.lua | 212 ++ ar/.config/mpv/scripts/blackout.lua | 73 + ar/.config/mpv/scripts/blur-edges.lua | 174 + ar/.config/mpv/scripts/change-OSD-media-title.lua | 36 + ar/.config/mpv/scripts/command_palette.lua | 1229 +++++++ ar/.config/mpv/scripts/cycle-video-rotate.lua | 36 + ar/.config/mpv/scripts/delete_current_file.lua | 168 + ar/.config/mpv/scripts/fuzzydir.lua | 278 ++ ar/.config/mpv/scripts/gallery-thumbgen.lua | 342 ++ ar/.config/mpv/scripts/history.lua | 138 + ar/.config/mpv/scripts/mdmenu.lua | 285 ++ ar/.config/mpv/scripts/misc.lua | 594 +++ ar/.config/mpv/scripts/modules.lua | 5 + ar/.config/mpv/scripts/mpv_crop_script.lua | 3173 ++++++++++++++++ ar/.config/mpv/scripts/navigator.lua | 603 ++++ ar/.config/mpv/scripts/osc-show-hide.lua | 40 + ar/.config/mpv/scripts/osc.lua | 3109 ++++++++++++++++ ar/.config/mpv/scripts/playlist-view.lua | 925 +++++ ar/.config/mpv/scripts/playlistmanager.lua | 1755 +++++++++ ar/.config/mpv/scripts/reload.lua | 19 + ar/.config/mpv/scripts/sponsorblock_minimal.lua | 141 + ar/.config/mpv/scripts/subtitle-search.lua | 682 ++++ ar/.config/mpv/scripts/thumbfast.lua | 951 +++++ ar/.config/mpv/scripts/user-input.lua | 890 +++++ ar/.config/mpv/scripts/xscreensaver.lua | 24 + ar/.config/mpv/scripts/youtube-search.lua | 419 +++ ar/.config/mpv/scripts/ytdl-preload.lua | 433 +++ ar/.config/mpv/unused_scipts/xrandr.lua | 382 ++ ar/.config/mutt/README.md | 414 +++ ar/.config/ncmpcpp/bindings | 468 +++ ar/.config/ncmpcpp/config | 261 ++ ar/.config/newsboat/config | 60 + ar/.config/newsboat/urls | 27 + ar/.config/npm/.npmrc | 2 + ar/.config/nsxiv/exec/key-handler | 67 + ar/.config/nvidia.hook | 15 + ar/.config/openvpn/thesiah.ovpn | 78 + ar/.config/pam-gnupg | 2 + ar/.config/pinentry/preexec | 5 + ar/.config/pip/pip.conf | 2 + .../pipewire/pipewire.conf.d/user-session.conf | 4 + ar/.config/profanity/profrc | 94 + ar/.config/pulse/daemon.conf | 4 + ar/.config/python/pythonrc | 2 + ar/.config/sesh/sesh.toml | 43 + ar/.config/shell/aliasrc | 467 +++ ar/.config/shell/bm-dirs | 108 + ar/.config/shell/bm-files | 51 + ar/.config/shell/git-aliasrc | 415 +++ ar/.config/shell/inputrc | 31 + ar/.config/shell/profile | 231 ++ ar/.config/starship/starship.toml | 204 ++ ar/.config/stig/rc | 1 + ar/.config/stig/themerc | 600 ++++ ar/.config/task/taskrc | 191 + ar/.config/taskopen/taskopenrc | 30 + ar/.config/tmux/tmux.conf | 303 ++ ar/.config/transmission-daemon/settings.json | 83 + ar/.config/user-dirs.dirs | 11 + ar/.config/vim/UltiSnips/all.snippets | 30 + ar/.config/vim/init.vim | 430 +++ ar/.config/vim/plugins.vim | 42 + ar/.config/vim/vimrc | 586 +++ ar/.config/vscode/argv.json | 21 + ar/.config/wal/postrun | 33 + ar/.config/wal/templates/dunstrc | 27 + ar/.config/wal/templates/zathurarc | 46 + ar/.config/wget/wgetrc | 1 + ar/.config/x11/xinitrc | 19 + ar/.config/x11/xprofile | 49 + ar/.config/x11/xresources | 386 ++ ar/.config/youtube-viewer/youtube-viewer.conf | 141 + ar/.config/zsh/.zshrc | 114 + ar/.config/zsh/autocomplete.zsh | 70 + ar/.config/zsh/git.zsh | 7 + ar/.config/zsh/keymaps.zsh | 342 ++ ar/.config/zsh/p10k.zsh | 1721 +++++++++ ar/.config/zsh/packages.zsh | 22 + ar/.config/zsh/plugins.zsh | 101 + ar/.config/zsh/scripts.zsh | 836 +++++ ar/.gitmodules | 3 + ar/.local/bin/arkenfox-auto-update | 26 + ar/.local/bin/bash-preexec | 380 ++ ar/.local/bin/bookmarks | 164 + ar/.local/bin/booksplit | 45 + ar/.local/bin/browse | 85 + ar/.local/bin/browserprofile | 102 + ar/.local/bin/clonerepo | 61 + ar/.local/bin/compiler | 104 + ar/.local/bin/concatvideo | 56 + ar/.local/bin/createsh | 104 + ar/.local/bin/cron/README.md | 11 + ar/.local/bin/cron/checkup | 16 + ar/.local/bin/cron/crontog | 26 + ar/.local/bin/cron/mediaup | 34 + ar/.local/bin/cron/newsup | 15 + ar/.local/bin/cutvideo | 41 + ar/.local/bin/displayselect | 92 + ar/.local/bin/dmenubrowse | 44 + ar/.local/bin/dmenudelmusic | 44 + ar/.local/bin/dmenuhandler | 24 + ar/.local/bin/dmenuman | 5 + ar/.local/bin/dmenumountcifs | 19 + ar/.local/bin/dmenupass | 6 + ar/.local/bin/dmenurecord | 129 + ar/.local/bin/dmenusmbadd | 58 + ar/.local/bin/dmenusmbdel | 55 + ar/.local/bin/dmenuunicode | 18 + ar/.local/bin/dmenuupgrade | 115 + ar/.local/bin/dvdburn | 44 + ar/.local/bin/ecrypt | 35 + ar/.local/bin/emojiupdate | 65 + ar/.local/bin/ethwifi | 16 + ar/.local/bin/extractkeys | 142 + ar/.local/bin/fzffiles | 45 + ar/.local/bin/fzffns | 74 + ar/.local/bin/fzfpass | 89 + ar/.local/bin/getbib | 14 + ar/.local/bin/getcomproot | 9 + ar/.local/bin/getkeys | 6 + ar/.local/bin/gitfiles | 72 + ar/.local/bin/gitopenbranch | 24 + ar/.local/bin/gitstagedfiles | 11 + ar/.local/bin/gitupdate | 91 + ar/.local/bin/gpt | 26 + ar/.local/bin/gracefulkill | 25 + ar/.local/bin/ifinstalled | 12 + ar/.local/bin/iwaf | 96 + ar/.local/bin/lastnvim | 77 + ar/.local/bin/lfub | 24 + ar/.local/bin/linkhandler | 31 + ar/.local/bin/maimpick | 23 + ar/.local/bin/mbackup | 14 + ar/.local/bin/monitorbright | 24 + ar/.local/bin/mounter | 181 + ar/.local/bin/mpdmenu | 111 + ar/.local/bin/mpvplay | 189 + ar/.local/bin/noisereduce | 81 + ar/.local/bin/openfiles | 34 + ar/.local/bin/opensessions | 37 + ar/.local/bin/opentasktui | 27 + ar/.local/bin/opout | 16 + ar/.local/bin/otp | 54 + ar/.local/bin/ovpn | 22 + ar/.local/bin/pacerror | 27 + ar/.local/bin/partlabel | 85 + ar/.local/bin/passmenu2 | 38 + ar/.local/bin/pauseallmpv | 10 + ar/.local/bin/peertubetorrent | 9 + ar/.local/bin/podentr | 7 + ar/.local/bin/qndl | 108 + ar/.local/bin/queueandnotify | 14 + ar/.local/bin/rbackup | 185 + ar/.local/bin/remapd | 8 + ar/.local/bin/remaps | 66 + ar/.local/bin/restartnvim | 25 + ar/.local/bin/rgafiles | 120 + ar/.local/bin/rotdir | 12 + ar/.local/bin/rssadd | 18 + ar/.local/bin/schedule | 22 + ar/.local/bin/screenshotactivewindow | 37 + ar/.local/bin/sd | 22 + ar/.local/bin/sessionizer | 36 + ar/.local/bin/setbg | 71 + ar/.local/bin/setlock | 23 + ar/.local/bin/setmonitor | 35 + ar/.local/bin/shortcuts | 86 + ar/.local/bin/slider | 132 + ar/.local/bin/sshadd | 31 + ar/.local/bin/statusbar/sb-battery | 68 + ar/.local/bin/statusbar/sb-bghitness | 19 + ar/.local/bin/statusbar/sb-brightness | 11 + ar/.local/bin/statusbar/sb-clock | 77 + ar/.local/bin/statusbar/sb-cpu | 12 + ar/.local/bin/statusbar/sb-cpubars | 44 + ar/.local/bin/statusbar/sb-disk | 27 + ar/.local/bin/statusbar/sb-ecrypt | 12 + ar/.local/bin/statusbar/sb-forecast | 402 +++ ar/.local/bin/statusbar/sb-help-icon | 22 + ar/.local/bin/statusbar/sb-internet | 42 + ar/.local/bin/statusbar/sb-iplocate | 15 + ar/.local/bin/statusbar/sb-keyboard | 35 + ar/.local/bin/statusbar/sb-mailbox | 23 + ar/.local/bin/statusbar/sb-memory | 18 + ar/.local/bin/statusbar/sb-mpdup | 8 + ar/.local/bin/statusbar/sb-music | 78 + ar/.local/bin/statusbar/sb-nettraf | 29 + ar/.local/bin/statusbar/sb-news | 17 + ar/.local/bin/statusbar/sb-packages | 37 + ar/.local/bin/statusbar/sb-popupgrade | 9 + ar/.local/bin/statusbar/sb-price | 67 + ar/.local/bin/statusbar/sb-queues | 40 + ar/.local/bin/statusbar/sb-repos | 130 + ar/.local/bin/statusbar/sb-tasks | 84 + ar/.local/bin/statusbar/sb-torrent | 33 + ar/.local/bin/statusbar/sb-volume | 43 + ar/.local/bin/stw | 87 + ar/.local/bin/syncdot | 46 + ar/.local/bin/synctime | 22 + ar/.local/bin/sysact | 26 + ar/.local/bin/tablet | 39 + ar/.local/bin/tag | 49 + .../task/taskwarrior-tui/annotate-with-new-note | 41 + .../bin/task/taskwarrior-tui/annotate-with-note | 41 + ar/.local/bin/task/taskwarrior-tui/cycle-priority | 35 + .../bin/task/taskwarrior-tui/cycle-tmux-projects | 31 + .../bin/task/taskwarrior-tui/decrease-priority | 15 + ar/.local/bin/task/taskwarrior-tui/git-issue-sync | 185 + .../bin/task/taskwarrior-tui/increase-priority | 60 + .../bin/task/taskwarrior-tui/lib-task-interop | 82 + .../bin/task/taskwarrior-tui/task-switch-context | 23 + .../bin/task/taskwarrior-tui/taskopen-annotation | 11 + ar/.local/bin/task/taskwarrior-tui/taskopen-line | 51 + ar/.local/bin/task/taskwarrior-tui/tasks-sync | 11 + .../bin/task/taskwarrior-tui/toggle-review-label | 13 + ar/.local/bin/td-toggle | 11 + ar/.local/bin/texclear | 8 + ar/.local/bin/timer | 14 + ar/.local/bin/timer_ | 14 + ar/.local/bin/timezones | 21 + ar/.local/bin/tmuxcreate | 42 + ar/.local/bin/tmuxopen | 193 + ar/.local/bin/tmuxtogglebar | 6 + ar/.local/bin/tmuxtoggleterm | 11 + ar/.local/bin/tordone | 10 + ar/.local/bin/torwrap | 8 + ar/.local/bin/transadd | 29 + ar/.local/bin/tutorialvids | 26 + ar/.local/bin/unewsboat | 16 + ar/.local/bin/unix | 26 + ar/.local/bin/unmounter | 44 + ar/.local/bin/vipy | 42 + ar/.local/bin/wallset | 295 ++ ar/.local/bin/weath | 46 + ar/.local/bin/whereami | 24 + ar/.local/bin/xdg-terminal-exec | 3 + ar/.local/bin/xinputconf | 39 + ar/.lynxrc | 344 ++ ar/.stow-local-ignore | 34 + 517 files changed, 90256 insertions(+) create mode 100644 ar/.config/LazyVim/.gitignore create mode 100644 ar/.config/LazyVim/.neoconf.json create mode 100644 ar/.config/LazyVim/LICENSE create mode 100644 ar/.config/LazyVim/README.md create mode 100644 ar/.config/LazyVim/db_ui/connections.json create mode 100644 ar/.config/LazyVim/init.lua create mode 100644 ar/.config/LazyVim/lua/config/autocmds.lua create mode 100644 ar/.config/LazyVim/lua/config/keymaps.lua create mode 100644 ar/.config/LazyVim/lua/config/lazy.lua create mode 100644 ar/.config/LazyVim/lua/config/options.lua create mode 100644 ar/.config/LazyVim/lua/plugins/better-escape.lua create mode 100644 ar/.config/LazyVim/lua/plugins/bqf.lua create mode 100644 ar/.config/LazyVim/lua/plugins/catppuccin.lua create mode 100644 ar/.config/LazyVim/lua/plugins/cmp.lua create mode 100644 ar/.config/LazyVim/lua/plugins/colorscheme.lua create mode 100644 ar/.config/LazyVim/lua/plugins/comment.lua create mode 100644 ar/.config/LazyVim/lua/plugins/dadbod.lua create mode 100644 ar/.config/LazyVim/lua/plugins/dashboard-nvim.lua create mode 100644 ar/.config/LazyVim/lua/plugins/example.lua create mode 100644 ar/.config/LazyVim/lua/plugins/file-browser.lua create mode 100644 ar/.config/LazyVim/lua/plugins/glow.lua create mode 100644 ar/.config/LazyVim/lua/plugins/goyo.lua create mode 100644 ar/.config/LazyVim/lua/plugins/harpoon.lua create mode 100644 ar/.config/LazyVim/lua/plugins/impatient.lua create mode 100644 ar/.config/LazyVim/lua/plugins/jukit.lua create mode 100644 ar/.config/LazyVim/lua/plugins/jupyter.lua create mode 100644 ar/.config/LazyVim/lua/plugins/lspconfig.lua create mode 100644 ar/.config/LazyVim/lua/plugins/lualine.lua create mode 100644 ar/.config/LazyVim/lua/plugins/magma.lua create mode 100644 ar/.config/LazyVim/lua/plugins/markdown-preview.lua create mode 100644 ar/.config/LazyVim/lua/plugins/mason.lua create mode 100644 ar/.config/LazyVim/lua/plugins/neogen.lua create mode 100644 ar/.config/LazyVim/lua/plugins/notify.lua create mode 100644 ar/.config/LazyVim/lua/plugins/nvim-neo-tree.lua create mode 100644 ar/.config/LazyVim/lua/plugins/obsidian.lua create mode 100644 ar/.config/LazyVim/lua/plugins/oil.lua create mode 100644 ar/.config/LazyVim/lua/plugins/playground.lua create mode 100644 ar/.config/LazyVim/lua/plugins/project.lua create mode 100644 ar/.config/LazyVim/lua/plugins/refactoring.lua create mode 100644 ar/.config/LazyVim/lua/plugins/seoul256.lua create mode 100644 ar/.config/LazyVim/lua/plugins/tagbar.lua create mode 100644 ar/.config/LazyVim/lua/plugins/telescope.lua create mode 100644 ar/.config/LazyVim/lua/plugins/tmux-navigator.lua create mode 100644 ar/.config/LazyVim/lua/plugins/tokyonight.lua create mode 100644 ar/.config/LazyVim/lua/plugins/treesj.lua create mode 100644 ar/.config/LazyVim/lua/plugins/vimwiki.lua create mode 100644 ar/.config/LazyVim/lua/plugins/which-key.lua create mode 100644 ar/.config/LazyVim/lua/plugins/yanky.lua create mode 100644 ar/.config/LazyVim/lua/plugins/zen-mode.lua create mode 100644 ar/.config/LazyVim/stylua.toml create mode 100644 ar/.config/LazyVim/vscode/easymotion-config.vim create mode 100644 ar/.config/LazyVim/vscode/plugins.lua create mode 100644 ar/.config/LazyVim/vscode/remap.lua create mode 100644 ar/.config/LazyVim/vscode/settings.vim create mode 100644 ar/.config/NvChad/.ignore create mode 100644 ar/.config/NvChad/.stylua.toml create mode 100644 ar/.config/NvChad/LICENSE create mode 100644 ar/.config/NvChad/db_ui/connections.json create mode 100644 ar/.config/NvChad/db_ui/si/safTEST create mode 100644 ar/.config/NvChad/init.lua create mode 100644 ar/.config/NvChad/lua/core/bootstrap.lua create mode 100644 ar/.config/NvChad/lua/core/default_config.lua create mode 100644 ar/.config/NvChad/lua/core/init.lua create mode 100644 ar/.config/NvChad/lua/core/mappings.lua create mode 100644 ar/.config/NvChad/lua/core/utils.lua create mode 100644 ar/.config/NvChad/lua/custom/README.md create mode 100644 ar/.config/NvChad/lua/custom/chadrc.lua create mode 100644 ar/.config/NvChad/lua/custom/configs/cell_marker.lua create mode 100644 ar/.config/NvChad/lua/custom/configs/dadbod.lua create mode 100644 ar/.config/NvChad/lua/custom/configs/lspconfig.lua create mode 100644 ar/.config/NvChad/lua/custom/configs/null-ls.lua create mode 100644 ar/.config/NvChad/lua/custom/configs/overrides.lua create mode 100644 ar/.config/NvChad/lua/custom/highlights.lua create mode 100644 ar/.config/NvChad/lua/custom/init.lua create mode 100644 ar/.config/NvChad/lua/custom/mappings.lua create mode 100644 ar/.config/NvChad/lua/custom/plugins.lua create mode 100644 ar/.config/NvChad/lua/plugins/configs/cmp.lua create mode 100644 ar/.config/NvChad/lua/plugins/configs/lazy_nvim.lua create mode 100644 ar/.config/NvChad/lua/plugins/configs/lspconfig.lua create mode 100644 ar/.config/NvChad/lua/plugins/configs/mason.lua create mode 100644 ar/.config/NvChad/lua/plugins/configs/nvimtree.lua create mode 100644 ar/.config/NvChad/lua/plugins/configs/others.lua create mode 100644 ar/.config/NvChad/lua/plugins/configs/telescope.lua create mode 100644 ar/.config/NvChad/lua/plugins/configs/treesitter.lua create mode 100644 ar/.config/NvChad/lua/plugins/init.lua create mode 100644 ar/.config/NvChad/vim_cheatsheet.webp create mode 100644 ar/.config/NvChad/vim_cheatsheet2.webp create mode 100644 ar/.config/NvChad/vscode/easymotion-config.vim create mode 100644 ar/.config/NvChad/vscode/plugins.lua create mode 100644 ar/.config/NvChad/vscode/remap.lua create mode 100644 ar/.config/NvChad/vscode/settings.vim create mode 100644 ar/.config/TheSiahxyz/after/queries/markdown/textobjects.scm create mode 100644 ar/.config/TheSiahxyz/ftplugin/markdown.lua create mode 100644 ar/.config/TheSiahxyz/ftplugin/quarto.lua create mode 100644 ar/.config/TheSiahxyz/init.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/core/autocmds.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/core/keymaps.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/core/lazy.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/core/options.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/health.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/init.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/ai.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/cloak.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/cmp.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/colorschemes.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/comment.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/compiler.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/context.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/csv.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dap.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/docker.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/git.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/goyo.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/harpoon2.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/image.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/init.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/keys.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lf.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lsp.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lualine.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/markdown.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/marks.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/mini.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/navic.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/obsidian.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/outline.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/project.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/python.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/quickfix.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/refactoring.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/sessions.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/silicon.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/snippets.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/surround.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/telescope.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/textobject.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/treesitter.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/ufo.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/urlview.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/vimwiki.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/zenmode.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/markdown.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/neetcode1.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/neetcode2.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/quarto.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/whichkey.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/spells/en.utf-8.add create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/spells/en.utf-8.add.spl create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/utils/cheatsheet.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/utils/cheatsheet/grid.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/utils/cheatsheet/init.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/utils/icons.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/utils/markdown.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/utils/snippet.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/utils/tasks.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/utils/tmux.lua create mode 100644 ar/.config/TheSiahxyz/lua/thesiahxyz/utils/utils.lua create mode 100644 ar/.config/asus_jack_audio_issue.txt create mode 100644 ar/.config/atuin/config.toml create mode 100644 ar/.config/auto-cpufreq/auto-cpufreq.conf create mode 100644 ar/.config/bash/bash_profile create mode 100644 ar/.config/bash/bashrc create mode 100644 ar/.config/bat/config create mode 100644 ar/.config/bat/themes/Catppuccin Frappe.tmTheme create mode 100644 ar/.config/bat/themes/Catppuccin Latte.tmTheme create mode 100644 ar/.config/bat/themes/Catppuccin Macchiato.tmTheme create mode 100644 ar/.config/bat/themes/Catppuccin Mocha.tmTheme create mode 100644 ar/.config/blacklist.conf create mode 100644 ar/.config/calcurse/conf create mode 100644 ar/.config/calcurse/keys create mode 100644 ar/.config/crons create mode 100644 ar/.config/dunst/dunstrc create mode 100644 ar/.config/fastfetch/config.jsonc create mode 100644 ar/.config/fcitx5/conf/cached_layouts create mode 100644 ar/.config/fcitx5/conf/clipboard.conf create mode 100644 ar/.config/fcitx5/conf/hangul.conf create mode 100644 ar/.config/fcitx5/conf/keyboard.conf create mode 100644 ar/.config/fcitx5/conf/notifications.conf create mode 100644 ar/.config/fcitx5/conf/quickphrase.conf create mode 100644 ar/.config/fcitx5/conf/waylandim.conf create mode 100644 ar/.config/fcitx5/conf/xcb.conf create mode 100644 ar/.config/fcitx5/conf/xim.conf create mode 100644 ar/.config/fcitx5/config create mode 100644 ar/.config/fcitx5/profile create mode 100644 ar/.config/firefox/chrome/userChrome.css create mode 100644 ar/.config/firefox/enhanceforyoutube.json create mode 100644 ar/.config/firefox/thesiah.js create mode 100644 ar/.config/firefox/vdh-settings.json create mode 100644 ar/.config/firefox/vimium-options.json create mode 100644 ar/.config/fontconfig/fonts.conf create mode 100644 ar/.config/gem/gemrc create mode 100644 ar/.config/git/attributes create mode 100644 ar/.config/git/config create mode 100644 ar/.config/git/gitk create mode 100644 ar/.config/git/ignore create mode 100644 ar/.config/gitmux/gitmux.conf create mode 100644 ar/.config/gtk-2.0/gtkrc-2.0 create mode 100644 ar/.config/gtk-3.0/settings.ini create mode 100644 ar/.config/lazygit/config.yml create mode 100755 ar/.config/lf/cleaner create mode 100644 ar/.config/lf/icons create mode 100644 ar/.config/lf/lfrc create mode 100644 ar/.config/lf/rooticons create mode 100755 ar/.config/lf/scope create mode 100644 ar/.config/mimeapps.list create mode 100644 ar/.config/mpd/mpd.conf create mode 100644 ar/.config/mpd/playlists/entire.m3u create mode 100644 ar/.config/mpd/playlists/jpop.m3u create mode 100644 ar/.config/mpd/playlists/kpop.m3u create mode 100644 ar/.config/mpd/playlists/pop.m3u create mode 100644 ar/.config/mpv/input.conf create mode 100644 ar/.config/mpv/lua_settings/blur_edges.conf create mode 100644 ar/.config/mpv/lua_settings/gallery_worker.conf create mode 100644 ar/.config/mpv/lua_settings/mpv_crop_script.conf create mode 100644 ar/.config/mpv/lua_settings/mpv_thumbnail_script.conf create mode 100644 ar/.config/mpv/lua_settings/playlist_view.conf create mode 100644 ar/.config/mpv/mpv.conf create mode 100644 ar/.config/mpv/osc.conf create mode 100644 ar/.config/mpv/script-modules/extended-menu.lua create mode 100644 ar/.config/mpv/script-modules/gallery.lua create mode 100644 ar/.config/mpv/script-modules/input-console.lua create mode 100644 ar/.config/mpv/script-modules/mpvSockets.lua create mode 100644 ar/.config/mpv/script-modules/scroll-list.lua create mode 100644 ar/.config/mpv/script-modules/sha1.lua create mode 100644 ar/.config/mpv/script-modules/user-input-module.lua create mode 100644 ar/.config/mpv/script-modules/utf8/LICENSE create mode 100644 ar/.config/mpv/script-modules/utf8/README.md create mode 100644 ar/.config/mpv/script-modules/utf8/begins/compiletime/parser.lua create mode 100644 ar/.config/mpv/script-modules/utf8/begins/compiletime/vanilla.lua create mode 100644 ar/.config/mpv/script-modules/utf8/charclass/compiletime/builder.lua create mode 100644 ar/.config/mpv/script-modules/utf8/charclass/compiletime/parser.lua create mode 100644 ar/.config/mpv/script-modules/utf8/charclass/compiletime/range.lua create mode 100644 ar/.config/mpv/script-modules/utf8/charclass/compiletime/stub.lua create mode 100644 ar/.config/mpv/script-modules/utf8/charclass/compiletime/vanilla.lua create mode 100644 ar/.config/mpv/script-modules/utf8/charclass/runtime/base.lua create mode 100644 ar/.config/mpv/script-modules/utf8/charclass/runtime/dummy.lua create mode 100644 ar/.config/mpv/script-modules/utf8/charclass/runtime/init.lua create mode 100644 ar/.config/mpv/script-modules/utf8/charclass/runtime/native.lua create mode 100644 ar/.config/mpv/script-modules/utf8/context/compiletime.lua create mode 100644 ar/.config/mpv/script-modules/utf8/context/runtime.lua create mode 100644 ar/.config/mpv/script-modules/utf8/ends/compiletime/parser.lua create mode 100644 ar/.config/mpv/script-modules/utf8/ends/compiletime/vanilla.lua create mode 100644 ar/.config/mpv/script-modules/utf8/functions/lua53.lua create mode 100644 ar/.config/mpv/script-modules/utf8/init.lua create mode 100644 ar/.config/mpv/script-modules/utf8/modifier/compiletime/frontier.lua create mode 100644 ar/.config/mpv/script-modules/utf8/modifier/compiletime/parser.lua create mode 100644 ar/.config/mpv/script-modules/utf8/modifier/compiletime/simple.lua create mode 100644 ar/.config/mpv/script-modules/utf8/modifier/compiletime/stub.lua create mode 100644 ar/.config/mpv/script-modules/utf8/modifier/compiletime/vanilla.lua create mode 100644 ar/.config/mpv/script-modules/utf8/primitives/dummy.lua create mode 100644 ar/.config/mpv/script-modules/utf8/primitives/init.lua create mode 100644 ar/.config/mpv/script-modules/utf8/primitives/native.lua create mode 100644 ar/.config/mpv/script-modules/utf8/primitives/tarantool.lua create mode 100644 ar/.config/mpv/script-modules/utf8/regex_parser.lua create mode 100755 ar/.config/mpv/script-modules/utf8/test.sh create mode 100644 ar/.config/mpv/script-modules/utf8/test/charclass_compiletime.lua create mode 100644 ar/.config/mpv/script-modules/utf8/test/charclass_runtime.lua create mode 100644 ar/.config/mpv/script-modules/utf8/test/context_runtime.lua create mode 100644 ar/.config/mpv/script-modules/utf8/test/strict.lua create mode 100644 ar/.config/mpv/script-modules/utf8/test/test.lua create mode 100644 ar/.config/mpv/script-modules/utf8/test/test_compat.lua create mode 100644 ar/.config/mpv/script-modules/utf8/test/test_pm.lua create mode 100644 ar/.config/mpv/script-modules/utf8/test/test_utf8data.lua create mode 100644 ar/.config/mpv/script-modules/utf8/test/util.lua create mode 100644 ar/.config/mpv/script-modules/utf8/util.lua create mode 100644 ar/.config/mpv/script-modules/utf8_data.lua create mode 100644 ar/.config/mpv/script-opts/SimpleBookmark.conf create mode 100644 ar/.config/mpv/script-opts/SmartCopyPaste_II.conf create mode 100644 ar/.config/mpv/script-opts/SmartSkip.conf create mode 100644 ar/.config/mpv/script-opts/command_palette.conf create mode 100644 ar/.config/mpv/script-opts/mdmenu.conf create mode 100644 ar/.config/mpv/script-opts/playlist_view.conf create mode 100644 ar/.config/mpv/script-opts/thumbfast.conf create mode 100644 ar/.config/mpv/scripts/Rename.lua create mode 100644 ar/.config/mpv/scripts/SimpleBookmark.lua create mode 100644 ar/.config/mpv/scripts/SmartCopyPaste_II.lua create mode 100644 ar/.config/mpv/scripts/SmartSkip.lua create mode 100644 ar/.config/mpv/scripts/UndoRedo.lua create mode 100644 ar/.config/mpv/scripts/blackout.lua create mode 100644 ar/.config/mpv/scripts/blur-edges.lua create mode 100644 ar/.config/mpv/scripts/change-OSD-media-title.lua create mode 100644 ar/.config/mpv/scripts/command_palette.lua create mode 100644 ar/.config/mpv/scripts/cycle-video-rotate.lua create mode 100644 ar/.config/mpv/scripts/delete_current_file.lua create mode 100644 ar/.config/mpv/scripts/fuzzydir.lua create mode 100644 ar/.config/mpv/scripts/gallery-thumbgen.lua create mode 100644 ar/.config/mpv/scripts/history.lua create mode 100644 ar/.config/mpv/scripts/mdmenu.lua create mode 100644 ar/.config/mpv/scripts/misc.lua create mode 100644 ar/.config/mpv/scripts/modules.lua create mode 100644 ar/.config/mpv/scripts/mpv_crop_script.lua create mode 100644 ar/.config/mpv/scripts/navigator.lua create mode 100644 ar/.config/mpv/scripts/osc-show-hide.lua create mode 100644 ar/.config/mpv/scripts/osc.lua create mode 100644 ar/.config/mpv/scripts/playlist-view.lua create mode 100644 ar/.config/mpv/scripts/playlistmanager.lua create mode 100644 ar/.config/mpv/scripts/reload.lua create mode 100644 ar/.config/mpv/scripts/sponsorblock_minimal.lua create mode 100644 ar/.config/mpv/scripts/subtitle-search.lua create mode 100644 ar/.config/mpv/scripts/thumbfast.lua create mode 100644 ar/.config/mpv/scripts/user-input.lua create mode 100644 ar/.config/mpv/scripts/xscreensaver.lua create mode 100644 ar/.config/mpv/scripts/youtube-search.lua create mode 100644 ar/.config/mpv/scripts/ytdl-preload.lua create mode 100644 ar/.config/mpv/unused_scipts/xrandr.lua create mode 100644 ar/.config/mutt/README.md create mode 100644 ar/.config/ncmpcpp/bindings create mode 100644 ar/.config/ncmpcpp/config create mode 100644 ar/.config/newsboat/config create mode 100644 ar/.config/newsboat/urls create mode 100644 ar/.config/npm/.npmrc create mode 100755 ar/.config/nsxiv/exec/key-handler create mode 100644 ar/.config/nvidia.hook create mode 100644 ar/.config/openvpn/thesiah.ovpn create mode 100644 ar/.config/pam-gnupg create mode 100755 ar/.config/pinentry/preexec create mode 100644 ar/.config/pip/pip.conf create mode 100644 ar/.config/pipewire/pipewire.conf.d/user-session.conf create mode 100644 ar/.config/profanity/profrc create mode 100644 ar/.config/pulse/daemon.conf create mode 100644 ar/.config/python/pythonrc create mode 100644 ar/.config/sesh/sesh.toml create mode 100644 ar/.config/shell/aliasrc create mode 100644 ar/.config/shell/bm-dirs create mode 100644 ar/.config/shell/bm-files create mode 100644 ar/.config/shell/git-aliasrc create mode 100644 ar/.config/shell/inputrc create mode 100644 ar/.config/shell/profile create mode 100644 ar/.config/starship/starship.toml create mode 100644 ar/.config/stig/rc create mode 100644 ar/.config/stig/themerc create mode 100644 ar/.config/task/taskrc create mode 100644 ar/.config/taskopen/taskopenrc create mode 100644 ar/.config/tmux/tmux.conf create mode 100644 ar/.config/transmission-daemon/settings.json create mode 100644 ar/.config/user-dirs.dirs create mode 100644 ar/.config/vim/UltiSnips/all.snippets create mode 100644 ar/.config/vim/init.vim create mode 100644 ar/.config/vim/plugins.vim create mode 100644 ar/.config/vim/vimrc create mode 100644 ar/.config/vscode/argv.json create mode 100755 ar/.config/wal/postrun create mode 100644 ar/.config/wal/templates/dunstrc create mode 100644 ar/.config/wal/templates/zathurarc create mode 100644 ar/.config/wget/wgetrc create mode 100644 ar/.config/x11/xinitrc create mode 100644 ar/.config/x11/xprofile create mode 100644 ar/.config/x11/xresources create mode 100644 ar/.config/youtube-viewer/youtube-viewer.conf create mode 100644 ar/.config/zsh/.zshrc create mode 100644 ar/.config/zsh/autocomplete.zsh create mode 100644 ar/.config/zsh/git.zsh create mode 100644 ar/.config/zsh/keymaps.zsh create mode 100644 ar/.config/zsh/p10k.zsh create mode 100644 ar/.config/zsh/packages.zsh create mode 100644 ar/.config/zsh/plugins.zsh create mode 100644 ar/.config/zsh/scripts.zsh create mode 100644 ar/.gitmodules create mode 100755 ar/.local/bin/arkenfox-auto-update create mode 100755 ar/.local/bin/bash-preexec create mode 100755 ar/.local/bin/bookmarks create mode 100755 ar/.local/bin/booksplit create mode 100755 ar/.local/bin/browse create mode 100755 ar/.local/bin/browserprofile create mode 100755 ar/.local/bin/clonerepo create mode 100755 ar/.local/bin/compiler create mode 100755 ar/.local/bin/concatvideo create mode 100755 ar/.local/bin/createsh create mode 100644 ar/.local/bin/cron/README.md create mode 100755 ar/.local/bin/cron/checkup create mode 100755 ar/.local/bin/cron/crontog create mode 100755 ar/.local/bin/cron/mediaup create mode 100755 ar/.local/bin/cron/newsup create mode 100755 ar/.local/bin/cutvideo create mode 100755 ar/.local/bin/displayselect create mode 100755 ar/.local/bin/dmenubrowse create mode 100755 ar/.local/bin/dmenudelmusic create mode 100755 ar/.local/bin/dmenuhandler create mode 100755 ar/.local/bin/dmenuman create mode 100755 ar/.local/bin/dmenumountcifs create mode 100755 ar/.local/bin/dmenupass create mode 100755 ar/.local/bin/dmenurecord create mode 100755 ar/.local/bin/dmenusmbadd create mode 100755 ar/.local/bin/dmenusmbdel create mode 100755 ar/.local/bin/dmenuunicode create mode 100755 ar/.local/bin/dmenuupgrade create mode 100755 ar/.local/bin/dvdburn create mode 100755 ar/.local/bin/ecrypt create mode 100755 ar/.local/bin/emojiupdate create mode 100755 ar/.local/bin/ethwifi create mode 100755 ar/.local/bin/extractkeys create mode 100755 ar/.local/bin/fzffiles create mode 100755 ar/.local/bin/fzffns create mode 100755 ar/.local/bin/fzfpass create mode 100755 ar/.local/bin/getbib create mode 100755 ar/.local/bin/getcomproot create mode 100755 ar/.local/bin/getkeys create mode 100755 ar/.local/bin/gitfiles create mode 100755 ar/.local/bin/gitopenbranch create mode 100755 ar/.local/bin/gitstagedfiles create mode 100755 ar/.local/bin/gitupdate create mode 100755 ar/.local/bin/gpt create mode 100755 ar/.local/bin/gracefulkill create mode 100755 ar/.local/bin/ifinstalled create mode 100755 ar/.local/bin/iwaf create mode 100755 ar/.local/bin/lastnvim create mode 100755 ar/.local/bin/lfub create mode 100755 ar/.local/bin/linkhandler create mode 100755 ar/.local/bin/maimpick create mode 100755 ar/.local/bin/mbackup create mode 100755 ar/.local/bin/monitorbright create mode 100755 ar/.local/bin/mounter create mode 100755 ar/.local/bin/mpdmenu create mode 100755 ar/.local/bin/mpvplay create mode 100755 ar/.local/bin/noisereduce create mode 100755 ar/.local/bin/openfiles create mode 100755 ar/.local/bin/opensessions create mode 100755 ar/.local/bin/opentasktui create mode 100755 ar/.local/bin/opout create mode 100755 ar/.local/bin/otp create mode 100755 ar/.local/bin/ovpn create mode 100755 ar/.local/bin/pacerror create mode 100755 ar/.local/bin/partlabel create mode 100755 ar/.local/bin/passmenu2 create mode 100755 ar/.local/bin/pauseallmpv create mode 100755 ar/.local/bin/peertubetorrent create mode 100755 ar/.local/bin/podentr create mode 100755 ar/.local/bin/qndl create mode 100755 ar/.local/bin/queueandnotify create mode 100755 ar/.local/bin/rbackup create mode 100755 ar/.local/bin/remapd create mode 100755 ar/.local/bin/remaps create mode 100755 ar/.local/bin/restartnvim create mode 100755 ar/.local/bin/rgafiles create mode 100755 ar/.local/bin/rotdir create mode 100755 ar/.local/bin/rssadd create mode 100755 ar/.local/bin/schedule create mode 100755 ar/.local/bin/screenshotactivewindow create mode 100755 ar/.local/bin/sd create mode 100755 ar/.local/bin/sessionizer create mode 100755 ar/.local/bin/setbg create mode 100755 ar/.local/bin/setlock create mode 100755 ar/.local/bin/setmonitor create mode 100755 ar/.local/bin/shortcuts create mode 100755 ar/.local/bin/slider create mode 100755 ar/.local/bin/sshadd create mode 100755 ar/.local/bin/statusbar/sb-battery create mode 100755 ar/.local/bin/statusbar/sb-bghitness create mode 100755 ar/.local/bin/statusbar/sb-brightness create mode 100755 ar/.local/bin/statusbar/sb-clock create mode 100755 ar/.local/bin/statusbar/sb-cpu create mode 100755 ar/.local/bin/statusbar/sb-cpubars create mode 100755 ar/.local/bin/statusbar/sb-disk create mode 100755 ar/.local/bin/statusbar/sb-ecrypt create mode 100755 ar/.local/bin/statusbar/sb-forecast create mode 100755 ar/.local/bin/statusbar/sb-help-icon create mode 100755 ar/.local/bin/statusbar/sb-internet create mode 100755 ar/.local/bin/statusbar/sb-iplocate create mode 100755 ar/.local/bin/statusbar/sb-keyboard create mode 100755 ar/.local/bin/statusbar/sb-mailbox create mode 100755 ar/.local/bin/statusbar/sb-memory create mode 100755 ar/.local/bin/statusbar/sb-mpdup create mode 100755 ar/.local/bin/statusbar/sb-music create mode 100755 ar/.local/bin/statusbar/sb-nettraf create mode 100755 ar/.local/bin/statusbar/sb-news create mode 100755 ar/.local/bin/statusbar/sb-packages create mode 100755 ar/.local/bin/statusbar/sb-popupgrade create mode 100755 ar/.local/bin/statusbar/sb-price create mode 100755 ar/.local/bin/statusbar/sb-queues create mode 100755 ar/.local/bin/statusbar/sb-repos create mode 100755 ar/.local/bin/statusbar/sb-tasks create mode 100755 ar/.local/bin/statusbar/sb-torrent create mode 100755 ar/.local/bin/statusbar/sb-volume create mode 100755 ar/.local/bin/stw create mode 100755 ar/.local/bin/syncdot create mode 100755 ar/.local/bin/synctime create mode 100755 ar/.local/bin/sysact create mode 100755 ar/.local/bin/tablet create mode 100755 ar/.local/bin/tag create mode 100755 ar/.local/bin/task/taskwarrior-tui/annotate-with-new-note create mode 100755 ar/.local/bin/task/taskwarrior-tui/annotate-with-note create mode 100755 ar/.local/bin/task/taskwarrior-tui/cycle-priority create mode 100755 ar/.local/bin/task/taskwarrior-tui/cycle-tmux-projects create mode 100755 ar/.local/bin/task/taskwarrior-tui/decrease-priority create mode 100755 ar/.local/bin/task/taskwarrior-tui/git-issue-sync create mode 100755 ar/.local/bin/task/taskwarrior-tui/increase-priority create mode 100755 ar/.local/bin/task/taskwarrior-tui/lib-task-interop create mode 100755 ar/.local/bin/task/taskwarrior-tui/task-switch-context create mode 100755 ar/.local/bin/task/taskwarrior-tui/taskopen-annotation create mode 100755 ar/.local/bin/task/taskwarrior-tui/taskopen-line create mode 100755 ar/.local/bin/task/taskwarrior-tui/tasks-sync create mode 100755 ar/.local/bin/task/taskwarrior-tui/toggle-review-label create mode 100755 ar/.local/bin/td-toggle create mode 100755 ar/.local/bin/texclear create mode 100755 ar/.local/bin/timer create mode 100755 ar/.local/bin/timer_ create mode 100755 ar/.local/bin/timezones create mode 100755 ar/.local/bin/tmuxcreate create mode 100755 ar/.local/bin/tmuxopen create mode 100755 ar/.local/bin/tmuxtogglebar create mode 100755 ar/.local/bin/tmuxtoggleterm create mode 100755 ar/.local/bin/tordone create mode 100755 ar/.local/bin/torwrap create mode 100755 ar/.local/bin/transadd create mode 100755 ar/.local/bin/tutorialvids create mode 100755 ar/.local/bin/unewsboat create mode 100755 ar/.local/bin/unix create mode 100755 ar/.local/bin/unmounter create mode 100755 ar/.local/bin/vipy create mode 100755 ar/.local/bin/wallset create mode 100755 ar/.local/bin/weath create mode 100755 ar/.local/bin/whereami create mode 100755 ar/.local/bin/xdg-terminal-exec create mode 100755 ar/.local/bin/xinputconf create mode 100644 ar/.lynxrc create mode 100644 ar/.stow-local-ignore (limited to 'ar') diff --git a/ar/.config/LazyVim/.gitignore b/ar/.config/LazyVim/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/ar/.config/LazyVim/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/ar/.config/LazyVim/.neoconf.json b/ar/.config/LazyVim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/ar/.config/LazyVim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/ar/.config/LazyVim/LICENSE b/ar/.config/LazyVim/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/ar/.config/LazyVim/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/ar/.config/LazyVim/README.md b/ar/.config/LazyVim/README.md new file mode 100644 index 0000000..185280b --- /dev/null +++ b/ar/.config/LazyVim/README.md @@ -0,0 +1,4 @@ +# 💤 LazyVim + +A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). +Refer to the [documentation](https://lazyvim.github.io/installation) to get started. diff --git a/ar/.config/LazyVim/db_ui/connections.json b/ar/.config/LazyVim/db_ui/connections.json new file mode 100644 index 0000000..e80cf62 --- /dev/null +++ b/ar/.config/LazyVim/db_ui/connections.json @@ -0,0 +1 @@ +[{"url": "mysql://si@localhost:3306/si", "name": "si"}, {"url": "mysql://root@localhost/test", "name": "test"}] diff --git a/ar/.config/LazyVim/init.lua b/ar/.config/LazyVim/init.lua new file mode 100644 index 0000000..bf21bdc --- /dev/null +++ b/ar/.config/LazyVim/init.lua @@ -0,0 +1,3 @@ +-- bootstrap lazy.nvim, LazyVim and your plugins +-- In init.lua +require("config.lazy") diff --git a/ar/.config/LazyVim/lua/config/autocmds.lua b/ar/.config/LazyVim/lua/config/autocmds.lua new file mode 100644 index 0000000..6550daf --- /dev/null +++ b/ar/.config/LazyVim/lua/config/autocmds.lua @@ -0,0 +1,157 @@ +-------------------------------------------------------------- +-- ######################################################## -- +-- ################## Custom #################### -- +-- ######################################################## -- +-------------------------------------------------------------- + +-- Save file as sudo on files that require root permission +vim.api.nvim_create_user_command("SudoWrite", function() + vim.cmd("write !sudo tee % >/dev/null") + vim.cmd("edit!") +end, {}) + +-- Enable Goyo by default for mutt writing +local goyo_group = vim.api.nvim_create_augroup("GoyoForMutt", { clear = true }) +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = "/tmp/neomutt*", + group = goyo_group, + callback = function() + vim.g.goyo_width = 80 + vim.cmd("Goyo") + vim.cmd("set bg=light") + vim.cmd("set linebreak") + vim.cmd("set wrap") + vim.cmd("set textwidth=0") + vim.cmd("set wrapmargin=0") + vim.cmd("colorscheme seoul256") + vim.api.nvim_buf_set_keymap( + 0, + "n", + "gx", + ":Goyo|x!", + { noremap = true, silent = true, desc = "Goyo Quit" } + ) + vim.api.nvim_buf_set_keymap( + 0, + "n", + "gq", + ":Goyo|q!", + { noremap = true, silent = true, desc = "Goyo Abort" } + ) + end, +}) + +-- Vimwiki +-- Ensure files are read with the desired filetype +vim.g.vimwiki_ext2syntax = { + [".Rmd"] = "markdown", + [".rmd"] = "markdown", + [".md"] = "markdown", + [".markdown"] = "markdown", + [".mdown"] = "markdown", +} +-- Set up Vimwiki list +vim.g.vimwiki_list = { { + path = vim.fn.expand("~/.local/share/vimwiki"), + syntax = "markdown", + ext = ".md", +} } +-- Markdown for specific files and directories +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "/tmp/calcurse*", "~/.calcurse/notes/*" }, + command = "set filetype=markdown", +}) + +-- Groff for specific file extensions +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "*.ms", "*.me", "*.mom", "*.man" }, + command = "set filetype=groff", +}) + +-- TeX for .tex files +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "*.tex" }, + command = "set filetype=tex", +}) + +-- When shortcut files are updated, renew bash and lf configs with new material: +local config_group = vim.api.nvim_create_augroup("ConfigUpdate", { clear = true }) +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = { "bm-files", "bm-dirs" }, + group = config_group, + callback = function() + -- Execute the 'shortcuts' shell command + vim.fn.system("shortcuts") + + -- Check if the 'shortcuts' command was successful + if vim.v.shell_error == 0 then + -- Display a message in Neovim + vim.api.nvim_echo({ { "shortcuts updated", "None" } }, true, {}) + else + -- Optional: Display an error message if the 'shortcuts' command fails + vim.api.nvim_echo({ { "failed to update shortcuts", "ErrorMsg" } }, true, {}) + end + end, +}) + +-- Run xrdb whenever Xdefaults or Xresources are updated. +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, + group = config_group, + callback = function() + vim.bo.filetype = "xdefaults" + end, +}) +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, + group = config_group, + callback = function() + vim.cmd("!xrdb %") + end, +}) + +-- Recompile dwmblocks on config edit. +local home = os.getenv("HOME") -- Gets the home directory +local dwmblocks_path = home .. "/.local/src/suckless/dwmblocks/config.h" +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = dwmblocks_path, + group = vim.api.nvim_create_augroup("DwmblocksConfigGroup", { clear = true }), + callback = function() + vim.cmd( + "!cd " + .. home + .. "/.local/src/suckless/dwmblocks/ && sudo make install && { killall -q dwmblocks; setsid -f dwmblocks; }" + ) + end, +}) + +-- Autocommand group for DWM +vim.api.nvim_create_augroup("DwmConfigGroup", { clear = true }) +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = home .. "/.local/src/suckless/dwm/config.h", + group = "DwmConfigGroup", + callback = function() + vim.cmd("!extractkeys") + end, +}) + +-- Autocommand group for ST +vim.api.nvim_create_augroup("StConfigGroup", { clear = true }) +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = home .. "/.local/src/suckless/st/config.h", + group = "StConfigGroup", + callback = function() + vim.cmd("!extractkeys") + end, +}) + +vim.api.nvim_create_autocmd({ "BufRead", "BufEnter" }, { + pattern = { "*.c", "*.cpp", "*.h", "*.hpp" }, + callback = function() + local suckless_path = vim.fn.expand("~/.local/src"):gsub("/+$", "") + local file_path = vim.fn.expand("%:p"):gsub("/+$", "") + if file_path == suckless_path or file_path:find("^" .. suckless_path .. "/") then + vim.b.autoformat = false + end + end, +}) diff --git a/ar/.config/LazyVim/lua/config/keymaps.lua b/ar/.config/LazyVim/lua/config/keymaps.lua new file mode 100644 index 0000000..e985c9d --- /dev/null +++ b/ar/.config/LazyVim/lua/config/keymaps.lua @@ -0,0 +1,275 @@ +local function word_definition(input) + if input == "" then + input = vim.fn.getreg(vim.fn.visualmode(), 1, 1) + end + + local escaped_input = vim.fn.shellescape(input) + local output = vim.fn.system("dict " .. escaped_input) + + vim.api.nvim_out_write(output) +end + +-- source shortcuts from bm-files and bm-folders +local shortcuts_file = vim.fn.expand("~/.config/nvim/shortcuts.lua") +local file = io.open(shortcuts_file, "r") +if file then + file:close() -- It's important to close the file after opening it. + vim.cmd("silent! source " .. shortcuts_file) +end + +-- word definition +vim.api.nvim_set_keymap( + "n", + "fd", + ":lua word_definition(vim.fn.expand(''))", + { noremap = true, silent = true, desc = "Word Definition" } +) +vim.api.nvim_set_keymap( + "x", + "fd", + ":lua word_definition(vim.fn.getreg('v', 1, 1))", + { noremap = true, silent = true, desc = "Word Definition in Visual Mode" } +) + +-------------------------------------- +-- Disable +vim.keymap.del("n", "") +vim.keymap.del("n", "]") +vim.keymap.del("n", "d") +vim.keymap.del("n", "[") +vim.keymap.del("n", "wd") +vim.keymap.del("n", "ww") + +-- vim.keymap.set( "n", "J", "", { noremap = true, silent = true }) +vim.keymap.set("n", "Q", "") + +-- ESC +vim.keymap.set("i", "jk", "", { desc = "" }) + +-- : +vim.keymap.set("n", "", ":", { desc = "Enter Command Mode", nowait = true }) + +-- Check Health +vim.keymap.set("n", "ch", ":checkhealth", { desc = "Check Health" }) + +-- Copy & Cut & Paste +vim.keymap.set("n", "x", '"_x') +-- vim.keymap.set("n", "d", '"_d') +-- vim.keymap.set("n", "D", '"_D') +-- vim.keymap.set("v", "d", '"_d') +-- vim.keymap.set("n", "d", '""d') +-- vim.keymap.set("n", "D", '""D') +-- vim.keymap.set("v", "d", '""d') +vim.keymap.set("n", "a", "ggVG", { desc = "Select Whole File" }) +vim.keymap.set("n", "cpa", "%y+", { desc = "Copy Whole File" }) +vim.keymap.set("x", "p", 'p:let @+=@0:let @"=@0', { silent = true }) + +-- Lines +vim.keymap.set("i", "", "$o", { nowait = true, silent = true }) +vim.keymap.set("i", "", "o", { noremap = true, nowait = true, silent = true, desc = "Next Line" }) +vim.keymap.set("i", "", "O", { noremap = true, nowait = true, silent = true, desc = "Previous Line" }) +-- vim.keymap.set( +-- "v", +-- "", +-- ":m '>+1gv=gv", +-- { noremap = true, nowait = true, silent = true, desc = "Move A Line To Bottom" } +-- ) +-- vim.keymap.set( +-- "v", +-- "", +-- ":m '<-2gv=gv", +-- { noremap = true, nowait = true, silent = true, desc = "Move A Line To Up" } +-- ) + +-- Navigation +vim.keymap.set("i", "", "I", { desc = "Beginning of Line" }) +vim.keymap.set("i", "", "", { desc = "End of Line" }) +vim.keymap.set("i", "", "", { desc = "Move Left" }) +vim.keymap.set("i", "", "", { desc = "Move Right" }) +vim.keymap.set("i", "", "", { desc = "Move Down" }) +vim.keymap.set("i", "", "", { desc = "Move Up" }) + +-- better up/down +vim.keymap.set({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true, desc = "Better Down" }) +vim.keymap.set( + { "n", "x" }, + "", + "v:count == 0 ? 'gj' : 'j'", + { expr = true, silent = true, desc = "Better Down" } +) +vim.keymap.set({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true, desc = "Better Up" }) +vim.keymap.set({ "n", "x" }, "", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true, desc = "Better Up" }) + +-- -- Move to window using the hjkl keys +-- vim.keymap.set("n", "", "h", { desc = "Go to left window", remap = true }) +-- vim.keymap.set("n", "", "j", { desc = "Go to lower window", remap = true }) +-- vim.keymap.set("n", "", "k", { desc = "Go to upper window", remap = true }) +-- vim.keymap.set("n", "", "l", { desc = "Go to right window", remap = true }) +-- +-- -- Resize window using arrow keys +-- vim.keymap.set("n", "", "resize +2", { desc = "Increase window height" }) +-- vim.keymap.set("n", "", "resize -2", { desc = "Decrease window height" }) +-- vim.keymap.set("n", "", "vertical resize -2", { desc = "Decrease window width" }) +-- vim.keymap.set("n", "", "vertical resize +2", { desc = "Increase window width" }) +-- +-- -- Move Lines +-- vim.keymap.set("n", "", "m .+1==", { desc = "Move down" }) +-- vim.keymap.set("n", "", "m .-2==", { desc = "Move up" }) +-- vim.keymap.set("i", "", "m .+1==gi", { desc = "Move down" }) +-- vim.keymap.set("i", "", "m .-2==gi", { desc = "Move up" }) +-- vim.keymap.set("v", "", ":m '>+1gv=gv", { desc = "Move down" }) +-- vim.keymap.set("v", "", ":m '<-2gv=gv", { desc = "Move up" }) +-- vim.keymap.set("n", "", "m .+1==", { desc = "Move down" }) +-- vim.keymap.set("n", "", "m .-2==", { desc = "Move up" }) +-- vim.keymap.set("i", "", "m .+1==gi", { desc = "Move down" }) +-- vim.keymap.set("i", "", "m .-2==gi", { desc = "Move up" }) +-- vim.keymap.set("v", "", ":m '>+1gv=gv", { desc = "Move down" }) +-- vim.keymap.set("v", "", ":m '<-2gv=gv", { desc = "Move up" }) +vim.keymap.set("n", "", "m .+1==", { desc = "Move down" }) +vim.keymap.set("n", "", "m .-2==", { desc = "Move up" }) +vim.keymap.set("i", "", "m .+1==gi", { desc = "Move down" }) +vim.keymap.set("i", "", "m .-2==gi", { desc = "Move up" }) +vim.keymap.set("v", "", ":m '>+1gv=gv", { desc = "Move down" }) +vim.keymap.set("v", "", ":m '<-2gv=gv", { desc = "Move up" }) +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +-- +-- -- buffers +-- vim.keymap.set("n", "", "bprevious", { desc = "Prev buffer" }) +-- vim.keymap.set("n", "", "bnext", { desc = "Next buffer" }) +-- vim.keymap.set("n", "[b", "bprevious", { desc = "Prev buffer" }) +-- vim.keymap.set("n", "]b", "bnext", { desc = "Next buffer" }) +-- vim.keymap.set("n", "bb", "e #", { desc = "Switch to Other Buffer" }) +-- vim.keymap.set("n", "`", "e #", { desc = "Switch to Other Buffer" }) +-- +-- -- Clear search with +-- vim.keymap.set({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) +-- +-- -- Clear search, diff update and redraw +-- -- taken from runtime/lua/_editor.lua +-- vim.keymap.set( +-- "n", +-- "ur", +-- "nohlsearchdiffupdatenormal! ", +-- { desc = "Redraw / clear hlsearch / diff update" } +-- ) +-- +-- -- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n +-- vim.keymap.set("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result" }) +-- vim.keymap.set("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +-- vim.keymap.set("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +-- vim.keymap.set("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev search result" }) +-- vim.keymap.set("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +-- vim.keymap.set("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +-- +-- -- Add undo break-points +-- vim.keymap.set("i", ",", ",u") +-- vim.keymap.set("i", ".", ".u") +-- vim.keymap.set("i", ";", ";u") +-- +-- -- save file +-- vim.keymap.set({ "i", "x", "n", "s" }, "", "w", { desc = "Save file" }) +vim.keymap.set({ "n" }, "W", "SudoWrite", { desc = "Save readonly file" }) +-- +-- --keywordprg +-- vim.keymap.set("n", "K", "norm! K", { desc = "Keywordprg" }) +-- +-- -- better indenting +-- vim.keymap.set("v", "<", "", ">gv") +-- +-- -- lazy +-- vim.keymap.set("n", "l", "Lazy", { desc = "Lazy" }) +-- +-- -- new file +-- vim.keymap.set("n", "fn", "enew", { desc = "New File" }) +-- +-- vim.keymap.set("n", "xl", "lopen", { desc = "Location List" }) +-- vim.keymap.set("n", "xq", "copen", { desc = "Quickfix List" }) +-- +-- vim.keymap.set("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) +-- vim.keymap.set("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) +-- +-- -- formatting +-- vim.keymap.set({ "n", "v" }, "cf", function() +-- Util.format({ force = true }) +-- end, { desc = "Format" }) +-- +-- -- diagnostic +-- local diagnostic_goto = function(next, severity) +-- local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev +-- severity = severity and vim.diagnostic.severity[severity] or nil +-- return function() +-- go({ severity = severity }) +-- end +-- end +-- vim.keymap.set("n", "cd", vim.diagnostic.open_float, { desc = "Line Diagnostics" }) +-- vim.keymap.set("n", "]d", diagnostic_goto(true), { desc = "Next Diagnostic" }) +-- vim.keymap.set("n", "[d", diagnostic_goto(false), { desc = "Prev Diagnostic" }) +-- vim.keymap.set("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next Error" }) +-- vim.keymap.set("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Prev Error" }) +-- vim.keymap.set("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next Warning" }) +-- vim.keymap.set("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" }) +-- +-- -- stylua: ignore start +-- +-- -- toggle options +-- vim.keymap.set("n", "uf", function() Util.format.toggle() end, { desc = "Toggle auto format (global)" }) +-- vim.keymap.set("n", "uF", function() Util.format.toggle(true) end, { desc = "Toggle auto format (buffer)" }) +-- vim.keymap.set("n", "us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" }) +-- vim.keymap.set("n", "uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" }) +-- vim.keymap.set("n", "uL", function() Util.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" }) +-- vim.keymap.set("n", "ul", function() Util.toggle.number() end, { desc = "Toggle Line Numbers" }) +-- vim.keymap.set("n", "ud", function() Util.toggle.diagnostics() end, { desc = "Toggle Diagnostics" }) +-- local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 +-- vim.keymap.set("n", "uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) +-- if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then +-- map( "n", "uh", function() Util.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" }) +-- end +-- vim.keymap.set("n", "uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" }) +-- +-- -- lazygit +-- vim.keymap.set("n", "gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" }) +-- vim.keymap.set("n", "gG", function() Util.terminal({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" }) +-- +-- -- quit +-- vim.keymap.set("n", "qq", "qa", { desc = "Quit all" }) +-- +-- -- highlights under cursor +-- vim.keymap.set("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) +-- +-- -- LazyVim Changelog +-- vim.keymap.set("n", "L", function() Util.news.changelog() end, { desc = "LazyVim Changelog" }) +-- +-- -- floating terminal +-- local lazyterm = function() Util.terminal(nil, { cwd = Util.root() }) end +-- vim.keymap.set("n", "ft", lazyterm, { desc = "Terminal (root dir)" }) +-- vim.keymap.set("n", "fT", function() Util.terminal() end, { desc = "Terminal (cwd)" }) +-- vim.keymap.set("n", "", lazyterm, { desc = "Terminal (root dir)" }) +-- vim.keymap.set("n", "", lazyterm, { desc = "which_key_ignore" }) +-- +-- -- Terminal Mappings +-- vim.keymap.set("t", "", "", { desc = "Enter Normal Mode" }) +-- vim.keymap.set("t", "", "wincmd h", { desc = "Go to left window" }) +-- vim.keymap.set("t", "", "wincmd j", { desc = "Go to lower window" }) +-- vim.keymap.set("t", "", "wincmd k", { desc = "Go to upper window" }) +-- vim.keymap.set("t", "", "wincmd l", { desc = "Go to right window" }) +-- vim.keymap.set("t", "", "close", { desc = "Hide Terminal" }) +-- vim.keymap.set("t", "", "close", { desc = "which_key_ignore" }) +-- +-- -- windows +vim.keymap.set("n", "w=", "=", { desc = "Equal window", remap = true }) +vim.keymap.set("n", "wo", "p", { desc = "Other window", remap = true }) +vim.keymap.set("n", "wx", "c", { desc = "Close window", remap = true }) +-- vim.keymap.set("n", "w-", "s", { desc = "Split window below", remap = true }) +-- vim.keymap.set("n", "w|", "v", { desc = "Split window right", remap = true }) +-- vim.keymap.set("n", "-", "s", { desc = "Split window below", remap = true }) +-- vim.keymap.set("n", "|", "v", { desc = "Split window right", remap = true }) +-- +-- -- tabs +-- vim.keymap.set("n", "l", "tablast", { desc = "Last Tab" }) +-- vim.keymap.set("n", "f", "tabfirst", { desc = "First Tab" }) +-- vim.keymap.set("n", "", "tabnew", { desc = "New Tab" }) +vim.keymap.set("n", "n", "tabnext", { desc = "Next Tab" }) +vim.keymap.set("n", "x", "tabclose", { desc = "Close Tab" }) +vim.keymap.set("n", "p", "tabprevious", { desc = "Previous Tab" }) diff --git a/ar/.config/LazyVim/lua/config/lazy.lua b/ar/.config/LazyVim/lua/config/lazy.lua new file mode 100644 index 0000000..b52de86 --- /dev/null +++ b/ar/.config/LazyVim/lua/config/lazy.lua @@ -0,0 +1,105 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import any extras modules here + -- coding + -- { import = "lazyvim.plugins.extras.coding.codeium" }, + -- { import = "lazyvim.plugins.extras.coding.copilot" }, + -- { import = "lazyvim.plugins.extras.coding.native_snippets" }, + -- { import = "lazyvim.plugins.extras.coding.tabnine" }, + -- { import = "lazyvim.plugins.extras.coding.yanky" }, + -- dap + { import = "lazyvim.plugins.extras.dap.core" }, + { import = "lazyvim.plugins.extras.dap.nlua" }, + -- editor + -- { import = "lazyvim.plugins.extras.editor.aerial" }, + { import = "lazyvim.plugins.extras.editor.harpoon2" }, + { import = "lazyvim.plugins.extras.editor.leap" }, + { import = "lazyvim.plugins.extras.editor.mini-files" }, + -- { import = "lazyvim.plugins.extras.editor.navic" }, + -- { import = "lazyvim.plugins.extras.editor.outline" }, + -- formatting + { import = "lazyvim.plugins.extras.formatting.black" }, + { import = "lazyvim.plugins.extras.formatting.prettier" }, + -- lang + { import = "lazyvim.plugins.extras.lang.ansible" }, + { import = "lazyvim.plugins.extras.lang.clangd" }, + -- { import = "lazyvim.plugins.extras.lang.cmake" }, + { import = "lazyvim.plugins.extras.lang.docker" }, + -- { import = "lazyvim.plugins.extras.lang.elixir" }, + -- { import = "lazyvim.plugins.extras.lang.go" }, + -- { import = "lazyvim.plugins.extras.lang.haskell" }, + -- { import = "lazyvim.plugins.extras.lang.helm" }, + { import = "lazyvim.plugins.extras.lang.java" }, + { import = "lazyvim.plugins.extras.lang.json" }, + { import = "lazyvim.plugins.extras.lang.markdown" }, + -- { import = "lazyvim.plugins.extras.lang.omnisharp" }, + -- { import = "lazyvim.plugins.extras.lang.python-semshi" }, + { import = "lazyvim.plugins.extras.lang.python" }, + -- { import = "lazyvim.plugins.extras.lang.ruby" }, + -- { import = "lazyvim.plugins.extras.lang.rust" }, + -- { import = "lazyvim.plugins.extras.lang.scala" }, + -- { import = "lazyvim.plugins.extras.lang.tailwind" }, + -- { import = "lazyvim.plugins.extras.lang.terraform" }, + -- { import = "lazyvim.plugins.extras.lang.tex" }, + -- { import = "lazyvim.plugins.extras.lang.typescript" }, + { import = "lazyvim.plugins.extras.lang.yaml" }, + -- linting + { import = "lazyvim.plugins.extras.linting.eslint" }, + -- lsp + { import = "lazyvim.plugins.extras.lsp.none-ls" }, + -- test + { import = "lazyvim.plugins.extras.test.core" }, + -- ui + -- { import = "lazyvim.plugins.extras.ui.alpha" }, + { import = "lazyvim.plugins.extras.ui.edgy" }, + -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, + -- { import = "lazyvim.plugins.extras.ui.mini-starter" }, + -- util + -- { import = "lazyvim.plugins.extras.util.dot" }, + -- { import = "lazyvim.plugins.extras.util.gitui" }, + { import = "lazyvim.plugins.extras.util.mini-hipatterns" }, + { import = "lazyvim.plugins.extras.util.project" }, + -- extras + { import = "lazyvim.plugins.extras.lazyrc" }, + { import = "lazyvim.plugins.extras.vscode" }, + + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/ar/.config/LazyVim/lua/config/options.lua b/ar/.config/LazyVim/lua/config/options.lua new file mode 100644 index 0000000..1172763 --- /dev/null +++ b/ar/.config/LazyVim/lua/config/options.lua @@ -0,0 +1,105 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here + +-- vim.g.mapleader = " " +vim.g.maplocalleader = "\\" +-- vim.g.autoformat = true +-- vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } +-- vim.g.netrw_banner = 0 +-- vim.g.netrw_mouse = 2 + +-- vim.opt.autowrite = true -- Enable auto write +vim.opt.backup = false -- creates a backup file +-- vim.opt.clipboard = "" -- "unnamedplus" -- Sync with system clipboard +vim.opt.cmdheight = 1 +vim.opt.colorcolumn = "85" +-- vim.opt.completeopt = "menu,menuone,noselect" +vim.opt.conceallevel = 1 -- default = 3, Hide * markup for bold and italic +-- vim.opt.confirm = true -- Confirm to save changes before exiting modified buffer +-- vim.opt.cursorline = true -- Enable highlighting of the current line +-- vim.opt.expandtab = true -- Use spaces instead of tabs +-- vim.opt.fileencoding = "utf-8" +vim.opt.hlsearch = true +-- vim.opt.formatoptions = "jcroqlnt" -- tcqj +-- vim.opt.grepformat = "%f:%l:%c:%m" +-- vim.opt.grepprg = "rg --vimgrep" +-- vim.opt.guifont = "monospace:h17" +-- vim.opt.ignorecase = true -- Ignore case +-- vim.opt.inccommand = "nosplit" -- preview incremental substitute +-- vim.opt.laststatus = 3 -- global statusline +-- vim.opt.list = true -- Show some invisible characters (tabs... +-- vim.opt.mouse = "a" -- Enable mouse mode +-- vim.opt.number = true -- Print line number +-- vim.opt.numberwidth = 4 +-- vim.opt.pumblend = 10 -- Popup blend +-- vim.opt.pumheight = 10 -- Maximum number of entries in a popup +-- vim.opt.relativenumber = true -- Relative line numbers +vim.opt.ruler = false +vim.opt.scrolloff = 8 -- Lines of context +-- vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" } +-- vim.opt.shiftround = true -- Round indent +-- vim.opt.shiftwidth = 2 -- Size of an indent +-- vim.opt.shortmess:append({ W = true, I = true, c = true, C = true }) +vim.opt.showcmd = false +-- vim.opt.showmode = false -- Dont show mode since we have a statusline +vim.opt.showtabline = 1 +-- vim.opt.sidescrolloff = 8 -- Columns of context +-- vim.opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time +-- vim.opt.smartcase = true -- Don't ignore case with capitals +-- vim.opt.smartindent = true -- Insert indents automatically +-- vim.opt.spelllang = { "en" } +-- vim.opt.splitbelow = true -- Put new windows below current +-- vim.opt.splitkeep = "screen" +-- vim.opt.splitright = true -- Put new windows right of current +vim.opt.swapfile = false +vim.opt.tabstop = 4 -- Number of spaces tabs count for +-- vim.opt.termguicolors = true -- True color support +-- vim.opt.timeoutlen = 300 +vim.opt.title = false +-- vim.opt.undofile = true +-- vim.opt.undolevels = 10000 +-- vim.opt.updatetime = 200 -- Save swap file and trigger CursorHold +-- vim.opt.virtualedit = "block" -- Allow cursor to move where there is no text in visual block mode +-- vim.opt.wildmode = "longest:full,full" -- Command-line completion mode +-- vim.opt.winminwidth = 5 -- Minimum window width +-- vim.opt.wrap = false -- Disable line wrap +vim.opt.writebackup = false + +vim.cmd("set whichwrap+=<,>,[,],h,l") +vim.cmd([[set iskeyword+=-]]) + +-- vim.opt.fillchars = { +-- foldopen = "", +-- foldclose = "", +-- -- fold = "⸱", +-- fold = " ", +-- foldsep = " ", +-- diff = "╱", +-- eob = " ", +-- } +-- +-- if vim.fn.has("nvim-0.10") == 1 then +-- vim.opt.smoothscroll = true +-- end +-- +-- -- Folding +-- vim.opt.foldlevel = 99 +-- vim.opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()" +-- +-- if vim.fn.has("nvim-0.9.0") == 1 then +-- vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] +-- end +-- +-- -- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now +-- if vim.fn.has("nvim-0.10") == 1 then +-- vim.opt.foldmethod = "expr" +-- vim.opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" +-- else +-- vim.opt.foldmethod = "indent" +-- end +-- +-- vim.o.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()" +-- +-- -- Fix markdown indentation settings +-- vim.g.markdown_recommended_style = 0 diff --git a/ar/.config/LazyVim/lua/plugins/better-escape.lua b/ar/.config/LazyVim/lua/plugins/better-escape.lua new file mode 100644 index 0000000..8980a09 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/better-escape.lua @@ -0,0 +1,6 @@ +return { + "max397574/better-escape.nvim", + config = function() + require("better_escape").setup() + end, +} diff --git a/ar/.config/LazyVim/lua/plugins/bqf.lua b/ar/.config/LazyVim/lua/plugins/bqf.lua new file mode 100644 index 0000000..529c06d --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/bqf.lua @@ -0,0 +1,9 @@ +return { + "kevinhwang91/nvim-bqf", + ft = "qf", + keys = { + -- { "zn", false }, + -- { "zN", false }, + -- { "zf", false }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/catppuccin.lua b/ar/.config/LazyVim/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..fa451bd --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/catppuccin.lua @@ -0,0 +1,92 @@ +return { + "catppuccin/nvim", + lazy = true, + name = "catppuccin", + priority = 1000, + opts = { + integrations = { + aerial = true, + alpha = true, + cmp = true, + dashboard = true, + flash = true, + gitsigns = true, + headlines = true, + illuminate = true, + indent_blankline = { enabled = true }, + leap = true, + lsp_trouble = true, + mason = true, + markdown = true, + mini = true, + native_lsp = { + enabled = true, + underlines = { + errors = { "undercurl" }, + hints = { "undercurl" }, + warnings = { "undercurl" }, + information = { "undercurl" }, + }, + }, + navic = { enabled = true, custom_bg = "lualine" }, + neotest = true, + neotree = true, + noice = true, + notify = true, + semantic_tokens = true, + telescope = true, + treesitter = true, + treesitter_context = true, + which_key = true, + }, + }, + config = function() + require("catppuccin").setup({ + transparent_background = true, -- disables setting the background color. + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { "italic" }, -- Change the style of comments + conditionals = {}, + loops = {}, + functions = {}, + keywords = { "bold" }, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + }, + color_overrides = { + mocha = { + rosewater = "#f5e0dc", + flamingo = "#f2cdcd", + pink = "#f5c2e7", + mauve = "#cba6f7", + red = "#f38ba8", + maroon = "#eba0ac", + peach = "#fab387", + yellow = "#f9e2af", + green = "#a6e3a1", + teal = "#94e2d5", + sky = "#89dceb", + sapphire = "#74c7ec", + blue = "#89b4fa", + lavender = "#b4befe", + text = "#cdd6f4", + subtext1 = "#bac2de", + subtext0 = "#a6adc8", + overlay2 = "#9399b2", + overlay1 = "#7f849c", + overlay0 = "#696D86", + surface2 = "#585b70", + surface1 = "#45475a", + surface0 = "#232728", + base = "#282828", + mantle = "#181825", + crust = "#11111b", + }, + }, + }) + end, +} diff --git a/ar/.config/LazyVim/lua/plugins/cmp.lua b/ar/.config/LazyVim/lua/plugins/cmp.lua new file mode 100644 index 0000000..3121e90 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/cmp.lua @@ -0,0 +1,50 @@ +return { + { + "L3MON4D3/LuaSnip", + keys = function() + return {} + end, + }, + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-emoji", + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + local luasnip = require("luasnip") + local cmp = require("cmp") + + opts.mapping = vim.tbl_extend("force", opts.mapping, { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- this way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + end, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/colorscheme.lua b/ar/.config/LazyVim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..6acb3d3 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/colorscheme.lua @@ -0,0 +1,11 @@ +return { + { "catppuccin/nvim", name = "catppuccin", opts = { transparent_background = true }, priority = 1000 }, + { + "LazyVim/LazyVim", + opts = { + -- colorscheme = "tokyonight", + colorscheme = "catppuccin", + -- colorscheme = "gruvbox", + }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/comment.lua b/ar/.config/LazyVim/lua/plugins/comment.lua new file mode 100644 index 0000000..1979d56 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/comment.lua @@ -0,0 +1,23 @@ +return { + "numToStr/Comment.nvim", + lazy = "false", + keys = { + { + mode = "n", + "/", + function() + require("Comment.api").toggle.linewise.current() + end, + desc = "Toggle comment", + }, + { + mode = "v", + "/", + "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", + desc = "Toggle comment", + }, + }, + config = function(_, opts) + require("Comment").setup(opts) + end, +} diff --git a/ar/.config/LazyVim/lua/plugins/dadbod.lua b/ar/.config/LazyVim/lua/plugins/dadbod.lua new file mode 100644 index 0000000..b3e8275 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/dadbod.lua @@ -0,0 +1,25 @@ +return { + "kristijanhusak/vim-dadbod-ui", + dependencies = { + { "tpope/vim-dadbod", lazy = true }, + { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true }, + }, + cmd = { + "DBUI", + "DBUIToggle", + "DBUIAddConnection", + "DBUIFindBuffer", + }, + init = function() + -- Your DBUI configuration + vim.g.db_ui_use_nerd_fonts = 1 + end, + keys = { + { "ddb", "DBUI", desc = "DB UI" }, + { "ddu", "DBUIToggle", desc = "Toggle DB UI" }, + { "dda", "DBUIAddConnection", desc = "Add Connection" }, + { "ddf", "DBUIFindBuffer", desc = "Find buffer" }, + { "ddr", "DBUIRenameBuffer", desc = "Rename buffer" }, + { "ddl", "DBUILastQueryInfo", desc = "Last query info" }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/dashboard-nvim.lua b/ar/.config/LazyVim/lua/plugins/dashboard-nvim.lua new file mode 100644 index 0000000..8a1ffd6 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/dashboard-nvim.lua @@ -0,0 +1,68 @@ +local Util = require("lazyvim.util") +return { + "nvimdev/dashboard-nvim", + opts = function(_, opts) + local logo = [[ + ┌──────────────────────────────────────────────────────┐ + │ │ + │ ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ │ + │ ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ │ + │ ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ │ + │ ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ │ + │ ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ │ + │ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ │ + └──────────────────────────────────────────────────────┘ + ]] + + logo = string.rep("\n", 5) .. logo .. "\n" + + local opts = { + theme = "doom", + hide = { + -- this is taken care of by lualine + -- enabling this messes up the actual laststatus setting after loading a file + statusline = false, + }, + + config = { + header = vim.split(logo, "\n"), + -- stylua: ignore + center = { + { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" }, + { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" }, + { action = "Telescope projects", desc = " Projects", icon = " ", key = "p" }, + { action = Util.telescope("files"), desc = " Find file", icon = " ", key = "f" }, + { action = "Telescope live_grep", desc = " Find word", icon = " ", key = "g" }, + { action = [[lua require("lazyvim.util").telescope.config_files()()]], desc = " Config", icon = " ", key = "c" }, + { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, + { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "e" }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + { action = "Mason", desc = " Mason", icon = "◍ ", key = "m" }, + { action = "qa", desc = " Quit", icon = " ", key = "q" }, + }, + footer = function() + local stats = require("lazy").stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } + end, + }, + } + + for _, button in ipairs(opts.config.center) do + button.desc = button.desc .. string.rep(" ", 43 - #button.desc) + button.key_format = " %s" + end + + -- close Lazy and re-open when the dashboard is ready + if vim.o.filetype == "lazy" then + vim.cmd.close() + vim.api.nvim_create_autocmd("User", { + pattern = "DashboardLoaded", + callback = function() + require("lazy").show() + end, + }) + end + return opts + end, +} diff --git a/ar/.config/LazyVim/lua/plugins/example.lua b/ar/.config/LazyVim/lua/plugins/example.lua new file mode 100644 index 0000000..f84ebdc --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/example.lua @@ -0,0 +1,265 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- add symbols-outline + { + "simrat39/symbols-outline.nvim", + cmd = "SymbolsOutline", + keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, + config = true, + }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, { name = "emoji" }) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add telescope-fzf-native + { + "telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + config = function() + require("telescope").load_extension("fzf") + end, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, "😄") + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, + + -- Use for completion and snippets (supertab) + -- first: disable default and behavior in LuaSnip + { + "L3MON4D3/LuaSnip", + keys = function() + return {} + end, + }, + -- then: setup supertab in cmp + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-emoji", + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + local luasnip = require("luasnip") + local cmp = require("cmp") + + opts.mapping = vim.tbl_extend("force", opts.mapping, { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- this way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + end, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/file-browser.lua b/ar/.config/LazyVim/lua/plugins/file-browser.lua new file mode 100644 index 0000000..9a9ea2f --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/file-browser.lua @@ -0,0 +1,15 @@ +return { + "nvim-telescope/telescope-file-browser.nvim", + dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }, + keys = { + { + mode = "n", + "sB", + ":Telescope file_browser path=%:p:h=%:p:h", + desc = "Browse Files", + }, + }, + config = function() + require("telescope").load_extension("file_browser") + end, +} diff --git a/ar/.config/LazyVim/lua/plugins/glow.lua b/ar/.config/LazyVim/lua/plugins/glow.lua new file mode 100644 index 0000000..e4702d2 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/glow.lua @@ -0,0 +1,8 @@ +return { + "ellisonleao/glow.nvim", + cmd = "Glow", + config = true, + keys = { + { mode = "n", "mf", "Glow", desc = "Markdown Preview float" }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/goyo.lua b/ar/.config/LazyVim/lua/plugins/goyo.lua new file mode 100644 index 0000000..9d0f860 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/goyo.lua @@ -0,0 +1,53 @@ +vim.g.is_goyo_active = false + +vim.g.goyo_enter = function() + if vim.fn.executable("tmux") == 1 and vim.fn.strlen(vim.env.TMUX) > 0 then + vim.fn.system("tmux set status off") + if not string.find(vim.fn.system("tmux list-panes -F '#F'"), "Z") then + vim.fn.system("tmux resize-pane -Z") + end + end + + vim.g.default_colorscheme = vim.g.colors_name or "default" + vim.o.background = "light" + vim.wo.linebreak = true + vim.wo.wrap = true + vim.bo.textwidth = 0 + vim.bo.wrapmargin = 0 + vim.cmd("Goyo 80x85%") + vim.cmd("colorscheme seoul256") + vim.g.is_goyo_active = true +end + +vim.g.goyo_leave = function() + if vim.fn.executable("tmux") == 1 and vim.fn.strlen(vim.env.TMUX) > 0 then + vim.fn.system("tmux set status on") + if string.find(vim.fn.system("tmux list-panes -F '#F'"), "Z") then + vim.fn.system("tmux resize-pane -Z") + end + end + vim.cmd("Goyo!") + vim.cmd("colorscheme " .. vim.g.default_colorscheme) + vim.g.is_goyo_active = false +end + +vim.g.toggle_goyo = function() + if vim.g.is_goyo_active then + vim.g.goyo_leave() + else + vim.g.goyo_enter() + end +end + +return { + "junegunn/goyo.vim", + cmd = "Goyo", + keys = { + vim.api.nvim_set_keymap( + "n", + "gy", + "lua vim.g.toggle_goyo()", + { noremap = true, silent = true, desc = "Toggle Goyo" } + ), + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/harpoon.lua b/ar/.config/LazyVim/lua/plugins/harpoon.lua new file mode 100644 index 0000000..a156e1d --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/harpoon.lua @@ -0,0 +1,19 @@ +return { + "ThePrimeagen/harpoon", + branch = "harpoon2", + opts = { + menu = { + width = vim.api.nvim_win_get_width(0) - 4, + }, + }, + keys = { + { + "", + function() + local harpoon = require("harpoon") + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, + desc = "Harpoon quick menu", + }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/impatient.lua b/ar/.config/LazyVim/lua/plugins/impatient.lua new file mode 100644 index 0000000..d0877c9 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/impatient.lua @@ -0,0 +1,6 @@ +return { + "lewis6991/impatient.nvim", + config = function() + require("impatient") + end, +} diff --git a/ar/.config/LazyVim/lua/plugins/jukit.lua b/ar/.config/LazyVim/lua/plugins/jukit.lua new file mode 100644 index 0000000..f5ad24f --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/jukit.lua @@ -0,0 +1,79 @@ +return { + -- "luk400/vim-jukit", + -- lazy = false, + -- keys = { + -- { "os", false }, + -- { "ts", false }, + -- { "hs", false }, + -- { "ohs", false }, + -- { "hd", false }, + -- { "od", false }, + -- { "ohd", false }, + -- { "so", false }, + -- { "j", false }, + -- { "k", false }, + -- { "ah", false }, + -- { "sl", false }, + -- { "", false }, + -- { "", false }, + -- { "", false }, + -- { "cc", false }, + -- { "all", false }, + -- { "co", false }, + -- { "cO", false }, + -- { "ct", false }, + -- { "cT", false }, + -- { "cd", false }, + -- { "cs", false }, + -- { "cM", false }, + -- { "cm", false }, + -- { "ck", false }, + -- { "cj", false }, + -- { "J", false }, + -- { "K", false }, + -- { "ddo", false }, + -- { "dda", false }, + -- { "np", false }, + -- { "ht", false }, + -- { "rht", false }, + -- { "pd", false }, + -- { "rpd", false }, + -- + -- { "os", ":call jukit#splits#output()", desc = "", mode = "n" }, + -- { "ts", ":call jukit#splits#term()", desc = "", mode = "n" }, + -- { "hs", ":call jukit#splits#history()", desc = "", mode = "n" }, + -- { "ohs", ":call jukit#splits#output_and_history()", desc = "", mode = "n" }, + -- { "hd", ":call jukit#splits#close_history()", desc = "", mode = "n" }, + -- { "od", ":call jukit#splits#close_output_split()", desc = "", mode = "n" }, + -- { "ohd", ":call jukit#splits#close_output_and_history(1)", desc = "", mode = "n" }, + -- { "so", ":call jukit#splits#show_last_cell_output(1)", desc = "", mode = "n" }, + -- { "j", ":call jukit#splits#out_hist_scroll(1)", desc = "", mode = "n" }, + -- { "k", ":call jukit#splits#out_hist_scroll(0)", desc = "", mode = "n" }, + -- { "ah", ":call jukit#splits#toggle_auto_hist()", desc = "", mode = "n" }, + -- { "sl", ":call jukit#layouts#set_layout()", desc = "", mode = "n" }, + -- { "", ":call jukit#send#section(0)", desc = "", mode = "n" }, + -- { "", ":call jukit#send#line()", desc = "", mode = "n" }, + -- { "", ":call jukit#send#selection()", desc = "", mode = "v" }, + -- { "cc", ":call jukit#send#until_current_section()", desc = "", mode = "n" }, + -- { "all", ":call jukit#send#all()", desc = "", mode = "n" }, + -- { "co", ":call jukit#cells#create_below(0)", desc = "", mode = "n" }, + -- { "cO", ":call jukit#cells#create_above(0)", desc = "", mode = "n" }, + -- { "ct", ":call jukit#cells#create_below(1)", desc = "", mode = "n" }, + -- { "cT", ":call jukit#cells#create_above(1)", desc = "", mode = "n" }, + -- { "cd", ":call jukit#cells#delete()", desc = "", mode = "n" }, + -- { "cs", ":call jukit#cells#split()", desc = "", mode = "n" }, + -- { "cM", ":call jukit#cells#merge_above()", desc = "", mode = "n" }, + -- { "cm", ":call jukit#cells#merge_below()", desc = "", mode = "n" }, + -- { "ck", ":call jukit#cells#move_up()", desc = "", mode = "n" }, + -- { "cj", ":call jukit#cells#move_down()", desc = "", mode = "n" }, + -- { "J", ":call jukit#cells#jump_to_next_cell()", desc = "", mode = "n" }, + -- { "K", ":call jukit#cells#jump_to_previous_cell()", desc = "", mode = "n" }, + -- { "ddo", ":call jukit#cells#delete_outputs(0)", desc = "", mode = "n" }, + -- { "dda", ":call jukit#cells#delete_outputs(1)", desc = "", mode = "n" }, + -- { "np", ":call jukit#convert#notebook_convert('jupyter-notebook')", desc = "", mode = "n" }, + -- { "ht", ":call jukit#convert#save_nb_to_file(0,1,'html')", desc = "", mode = "n" }, + -- { "rht", ":call jukit#convert#save_nb_to_file(1,1,'html')", desc = "", mode = "n" }, + -- { "pd", ":call jukit#convert#save_nb_to_file(0,1,'pdf')", desc = "", mode = "n" }, + -- { "rpd", ":call jukit#convert#save_nb_to_file(1,1,'pdf')", desc = "", mode = "n" }, + -- }, +} diff --git a/ar/.config/LazyVim/lua/plugins/jupyter.lua b/ar/.config/LazyVim/lua/plugins/jupyter.lua new file mode 100644 index 0000000..0cb684b --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/jupyter.lua @@ -0,0 +1,345 @@ +local function get_commenter() + local commenter = { python = "# ", lua = "-- ", julia = "# ", fennel = ";; ", scala = "// ", r = "# " } + local bufnr = vim.api.nvim_get_current_buf() + local ft = vim.api.nvim_buf_get_option(bufnr, "filetype") + if ft == nil or ft == "" then + return commenter["python"] + elseif commenter[ft] == nil then + return commenter["python"] + end + + return commenter[ft] +end + +local CELL_MARKER = get_commenter() .. "%%" +vim.api.nvim_set_hl(0, "CellMarkerHl", { default = true, bg = "#c5c5c5", fg = "#111111" }) + +local function miniai_spec(mode) + local start_line = vim.fn.search("^" .. CELL_MARKER, "bcnW") + + if start_line == 0 then + start_line = 1 + else + if mode == "i" then + start_line = start_line + 1 + end + end + + local end_line = vim.fn.search("^" .. CELL_MARKER, "nW") - 1 + if end_line == -1 then + end_line = vim.fn.line("$") + end + + local last_col = math.max(vim.fn.getline(end_line):len(), 1) + + local from = { line = start_line, col = 1 } + local to = { line = end_line, col = last_col } + + return { from = from, to = to } +end + +local function show_cell_markers() + require("mini.hipatterns").enable(0, { + highlighters = { + marker = { pattern = "^" .. get_commenter() .. "%%%%", group = "CellMarkerHl" }, + }, + }) +end + +local function select_cell() + local bufnr = vim.api.nvim_get_current_buf() + local current_row = vim.api.nvim_win_get_cursor(0)[1] + local current_col = vim.api.nvim_win_get_cursor(0)[2] + + local start_line = nil + local end_line = nil + + for line = current_row, 1, -1 do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:find("^" .. CELL_MARKER) then + start_line = line + break + end + end + local line_count = vim.api.nvim_buf_line_count(bufnr) + for line = current_row + 1, line_count do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:find("^" .. CELL_MARKER) then + end_line = line + break + end + end + + if not start_line then + start_line = 1 + end + if not end_line then + end_line = line_count + end + return current_row, current_col, start_line, end_line +end + +local function execute_cell() + local current_row, current_col, start_line, end_line = select_cell() + if start_line and end_line then + vim.fn.setpos("'<", { 0, start_line + 1, 0, 0 }) + vim.fn.setpos("'>", { 0, end_line - 1, 0, 0 }) + require("iron.core").visual_send() + vim.api.nvim_win_set_cursor(0, { current_row, current_col }) + end +end + +local function delete_cell() + local _, _, start_line, end_line = select_cell() + if start_line and end_line then + local rows_to_select = end_line - start_line - 1 + vim.api.nvim_win_set_cursor(0, { start_line, 0 }) + vim.cmd("normal!V " .. rows_to_select .. "j") + vim.cmd("normal!d") + vim.cmd("normal!k") + end +end + +local function navigate_cell(up) + local is_up = up or false + local _, _, start_line, end_line = select_cell() + if is_up and start_line ~= 1 then + vim.api.nvim_win_set_cursor(0, { start_line - 1, 0 }) + elseif end_line then + local bufnr = vim.api.nvim_get_current_buf() + local line_count = vim.api.nvim_buf_line_count(bufnr) + if end_line ~= line_count then + vim.api.nvim_win_set_cursor(0, { end_line + 1, 0 }) + _, _, start_line, end_line = select_cell() + vim.api.nvim_win_set_cursor(0, { end_line - 1, 0 }) + end + end +end + +local function move_cell(dir) + local search_res + local result + if dir == "d" then + search_res = vim.fn.search("^" .. CELL_MARKER, "W") + if search_res == 0 then + result = "last" + end + else + search_res = vim.fn.search("^" .. CELL_MARKER, "bW") + if search_res == 0 then + result = "first" + vim.api.nvim_win_set_cursor(0, { 1, 0 }) + end + end + + return result +end + +local function insert_cell_before(content) + content = content or CELL_MARKER + local cell_object = miniai_spec("a") + vim.api.nvim_buf_set_lines(0, cell_object.from.line - 1, cell_object.from.line - 1, false, { content, "" }) + move_cell("u") +end + +local function insert_cell_after(content) + content = content or CELL_MARKER + vim.print(content) + local cell_object = miniai_spec("a") + vim.api.nvim_buf_set_lines(0, cell_object.to.line, cell_object.to.line, false, { content, "" }) + move_cell("d") +end + +local function insert_markdown_cell() + insert_cell_after(CELL_MARKER .. " [markdown]") +end + +local function repl_menu() + local cmd = require("hydra.keymap-util").cmd + + local hint = [[ + ^ + _a_: Insert Cell After + _b_: Insert Cell Before + _e_: Execute Cell + _j_: Next Cell + _k_: Previous Cell + _m_: Insert Markdown Cell + _x_: Delete Cell + ^ + _s_: Send Motion + _l_: Send Line + _t_: Send Until Cursor + _f_: Send File + ^ + _R_: Show REPL + _C_: Close REPL + _S_: Restart REPL + _F_: Focus + _H_: Hide + ^ + _c_: Clear + _L_: Clear Highlight + __: ENTER + _I_: Interrupt + ^ + ^ ^ _q_: Quit +]] + + return { + name = "REPL", + hint = hint, + config = { + color = "pink", + invoke_on_body = true, + hint = { + border = "rounded", + position = "bottom-middle", + }, + }, + mode = "n", + body = "", + -- stylua: ignore + heads = { + { "a", insert_cell_after, desc = "Insert Cell After", }, + { "b", insert_cell_before, desc = "Insert Cell Before", }, + { "e", execute_cell, desc = "Execute Cell", }, + { "j", navigate_cell , desc = "Next Cell", }, + { "k", function() navigate_cell(true) end, desc = "Previous Cell", }, + { "m", insert_markdown_cell, desc = "Insert Markdown Cell", }, + { "x", delete_cell, desc = "Delete Cell", }, + { "s", function() require("iron.core").run_motion("send_motion") end, desc = "Send Motion" }, + { "l", function() require("iron.core").send_line() end, desc = "Send Line" }, + { "t", function() require("iron.core").send_until_cursor() end, desc = "Send Until Cursor" }, + { "f", function() require("iron.core").send_file() end, desc = "Send File" }, + { "L", function() require("iron.marks").clear_hl() end, mode = {"v"}, desc = "Clear Highlight" }, + { "", function() require("iron.core").send(nil, string.char(13)) end, desc = "ENTER" }, + { "I", function() require("iron.core").send(nil, string.char(03)) end, desc = "Interrupt" }, + { "C", function() require("iron.core").close_repl() end, desc = "Close REPL" }, + { "c", function() require("iron.core").send(nil, string.char(12)) end, desc = "Clear" }, + { "R", cmd("IronRepl"), desc = "REPL" }, + { "S", cmd("IronRestart"), desc = "Restart" }, + { "F", cmd("IronFocus"), desc = "Focus" }, + { "H", cmd("IronHide"), desc = "Hide" }, + { "q", nil, { exit = true, nowait = true, desc = "Exit" } }, + }, + } +end + +return { + { + "goerz/jupytext.vim", + build = "pip install jupytext", + event = "VeryLazy", + dependencies = { "neovim/nvim-lspconfig" }, + opts = {}, + config = function() + -- The destination format: 'ipynb', 'markdown' or 'script', or a file extension: 'md', 'Rmd', 'jl', 'py', 'R', ..., 'auto' (script + -- extension matching the notebook language), or a combination of an extension and a format name, e.g. md:markdown, md:pandoc, + -- md:myst or py:percent, py:light, py:nomarker, py:hydrogen, py:sphinx. The default format for scripts is the 'light' format, + -- which uses few cell markers (none when possible). Alternatively, a format compatible with many editors is the 'percent' format, + -- which uses '# %%' as cell markers. The main formats (markdown, light, percent) preserve notebooks and text documents in a + -- roundtrip. Use the --test and and --test-strict commands to test the roundtrip on your files. Read more about the available + -- formats at https://jupytext.readthedocs.io/en/latest/formats.html (default: None) + vim.g.jupytext_fmt = "py:percent" + + -- Autocmd to set cell markers + vim.api.nvim_create_autocmd({ "BufEnter" }, { -- "BufWriteCmd" + group = vim.api.nvim_create_augroup("au_show_cell_markers", { clear = true }), + pattern = { "*.py", "*.r", "*.ipynb", "*.jl", "*.scala", "*.lua", "*.fnl" }, + callback = function(event) + show_cell_markers() + end, + }) + end, + }, + { + "Vigemus/iron.nvim", + event = "VeryLazy", + opts = function() + return { + config = { + -- Whether a repl should be discarded or not + scratch_repl = true, + -- Your repl definitions come here + + repl_definition = { + python = require("iron.fts.python").ipython, + scala = require("iron.fts.scala").scala, + }, + -- How the repl window will be displayed + -- See below for more information + repl_open_cmd = require("iron.view").right("50%"), + }, + -- If the highliht is on, you can change how it looks + -- For the available options, check nvim_set_hl + highlight = { + italic = true, + }, + ignore_blank_lines = true, -- ignore blank lines when sending visual select lines + } + end, + -- stylua: ignore + keys = { + { "i", function() end, mode = {"n", "x"}, desc = "+REPL" }, + { "im", function() end, mode = {"n", "x"}, desc = "+Mark" }, + { "ire>", execute_cell, desc = "Execute Cell" }, + { "irx", delete_cell, desc = "Delete Cell" }, + { "ir]", navigate_cell, desc = "Next Cell" }, + { "ir[", function() navigate_cell(true) end, desc = "Previous Cell" }, + { "is", function() require("iron.core").run_motion("send_motion") end, desc = "Send Motion" }, + { "is", function() require("iron.core").visual_send() end, mode = {"v"}, desc = "Send" }, + { "il", function() require("iron.core").send_line() end, desc = "Send Line" }, + { "it", function() require("iron.core").send_until_cursor() end, desc = "Send Until Cursor" }, + { "if", function() require("iron.core").send_file() end, desc = "Send File" }, + { "iL", function() require("iron.marks").clear_hl() end, mode = {"v"}, desc = "Clear Highlight" }, + { "i", function() require("iron.core").send(nil, string.char(13)) end, desc = "ENTER" }, + { "iI", function() require("iron.core").send(nil, string.char(03)) end, desc = "Interrupt" }, + { "iC", function() require("iron.core").close_repl() end, desc = "Close REPL" }, + { "ic", function() require("iron.core").send(nil, string.char(12)) end, desc = "Clear" }, + { "ims", function() require("iron.core").send_mark() end, desc = "Send Mark" }, + { "imm", function() require("iron.core").run_motion("mark_motion") end, desc = "Mark Motion" }, + { "imv", function() require("iron.core").mark_visual() end, mode = {"v"}, desc = "Mark Visual" }, + { "imr", function() require("iron.marks").drop_last() end, desc = "Remove Mark" }, + { "iR", "IronRepl", desc = "REPL" }, + { "iS", "IronRestart", desc = "Restart" }, + { "iF", "IronFocus", desc = "Focus" }, + { "iH", "IronHide", desc = "Hide" }, + }, + config = function(_, opts) + local iron = require("iron.core") + iron.setup(opts) + end, + }, + { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + defaults = { + ["i"] = { name = "+REPL" }, + ["im"] = { name = "+Mark" }, + }, + }, + }, + { + "anuvyklack/hydra.nvim", + event = { "VeryLazy" }, + opts = { + specs = { + repl = repl_menu, + }, + }, + config = function(_, opts) + local hydra = require("hydra") + for s, _ in pairs(opts.specs) do + hydra(opts.specs[s]()) + end + end, + }, + { + "echasnovski/mini.ai", + opts = function(_, opts) + opts.custom_textobjects = vim.tbl_extend("force", opts.custom_textobjects, { h = miniai_spec }) + end, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/lspconfig.lua b/ar/.config/LazyVim/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..4d8db1c --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/lspconfig.lua @@ -0,0 +1,77 @@ +return { + "neovim/nvim-lspconfig", + init = function() + local keys = require("lazyvim.plugins.lsp.keymaps").get() + -- change a keymap + -- keys[#keys + 1] = { "K", "echo 'hello'" } + -- keys[#keys + 1] = { "", mode = { "i" }, false } + + -- disable a keymap + -- keys[#keys + 1] = { "K", false } + keys[#keys + 1] = { mode = { "i" }, "", false } + + -- add a keymap + -- keys[#keys + 1] = { "H", "echo 'hello'" } + end, + opts = { + servers = { + -- Ensure mason installs the server + clangd = { + keys = { + { "cR", "ClangdSwitchSourceHeader", desc = "Switch Source/Header (C/C++)" }, + }, + root_dir = function(fname) + return require("lspconfig.util").root_pattern( + "Makefile", + "configure.ac", + "configure.in", + "config.h.in", + "meson.build", + "meson_options.txt", + "build.ninja" + )(fname) or require("lspconfig.util").root_pattern("compile_commands.json", "compile_flags.txt")( + fname + ) or require("lspconfig.util").find_git_ancestor(fname) + end, + capabilities = { + offsetEncoding = { "utf-16" }, + }, + cmd = { + "clangd", + "--background-index", + "--clang-tidy", + "--header-insertion=iwyu", + "--completion-style=detailed", + "--function-arg-placeholders", + "--fallback-style=llvm", + }, + init_options = { + usePlaceholders = true, + completeUnimported = true, + clangdFileStatus = true, + }, + }, + }, + setup = { + clangd = function(_, opts) + local clangd_ext_opts = require("lazyvim.util").opts("clangd_extensions.nvim") + require("clangd_extensions").setup(vim.tbl_deep_extend("force", clangd_ext_opts or {}, { server = opts })) + return false + end, + }, + }, + keys = { + { + -- mode = "n", + "rr", + ":w | :TermExec cmd='compiler \"%\"' size=50 direction=tab go_back=0", + desc = "Run Code", + }, + { + -- mode = "n", + "rd", + ":w | :TermExec cmd='compiler \"%\" -d' size=50 direction=tab go_back=0", + desc = "Debug Code", + }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/lualine.lua b/ar/.config/LazyVim/lua/plugins/lualine.lua new file mode 100644 index 0000000..7c64086 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/lualine.lua @@ -0,0 +1,105 @@ +return { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + init = function() + vim.g.lualine_laststatus = vim.o.laststatus + if vim.fn.argc(-1) > 0 then + -- set an empty statusline till lualine loads + vim.o.statusline = " " + else + -- hide the statusline on the starter page + vim.o.laststatus = 0 + end + end, + opts = function() + -- PERF: we don't need this lualine require madness 🤷 + local lualine_require = require("lualine_require") + lualine_require.require = require + + local icons = require("lazyvim.config").icons + + vim.o.laststatus = vim.g.lualine_laststatus + + return { + options = { + theme = "auto", + component_separators = { left = " ", right = " " }, + section_separators = { left = " ", right = " " }, + globalstatus = true, + disabled_filetypes = { statusline = { "dashboard", "alpha", "starter" } }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch" }, + + lualine_c = { + LazyVim.lualine.root_dir(), + { + "diagnostics", + symbols = { + error = icons.diagnostics.Error, + warn = icons.diagnostics.Warn, + info = icons.diagnostics.Info, + hint = icons.diagnostics.Hint, + }, + }, + { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, + { LazyVim.lualine.pretty_path() }, + }, + lualine_x = { + -- stylua: ignore + { + function() return require("noice").api.status.command.get() end, + cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, + color = LazyVim.ui.fg("Statement"), + }, + -- stylua: ignore + { + function() return require("noice").api.status.mode.get() end, + cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end, + color = LazyVim.ui.fg("Constant"), + }, + -- stylua: ignore + { + function() return " " .. require("dap").status() end, + cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end, + color = LazyVim.ui.fg("Debug"), + }, + { + require("lazy.status").updates, + cond = require("lazy.status").has_updates, + color = LazyVim.ui.fg("Special"), + }, + { + "diff", + symbols = { + added = icons.git.added, + modified = icons.git.modified, + removed = icons.git.removed, + }, + source = function() + local gitsigns = vim.b.gitsigns_status_dict + if gitsigns then + return { + added = gitsigns.added, + modified = gitsigns.changed, + removed = gitsigns.removed, + } + end + end, + }, + }, + lualine_y = { + { "progress", separator = " ", padding = { left = 1, right = 0 } }, + { "location", padding = { left = 0, right = 1 } }, + }, + lualine_z = { + function() + return " " .. os.date("%R") + end, + }, + }, + extensions = { "neo-tree", "lazy" }, + } + end, +} diff --git a/ar/.config/LazyVim/lua/plugins/magma.lua b/ar/.config/LazyVim/lua/plugins/magma.lua new file mode 100644 index 0000000..f648762 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/magma.lua @@ -0,0 +1,23 @@ +return { + "dccsillag/magma-nvim", + build = ":UpdateRemotePlugins", + keys = { + { + "r", + ":MagmaEvaluateOperator", + expr = true, + silent = true, + desc = "Evaluate Operator", + mode = "n", + }, + { "rr", ":MagmaEvaluateLine", silent = true, desc = "Evaluate Line", mode = "n" }, + { "rv", ":MagmaEvaluateVisual", silent = true, desc = "Evaluate Visual", mode = "x" }, + { "rc", ":MagmaReevaluateCell", silent = true, desc = "Reevaluate Cell", mode = "n" }, + { "rd", ":MagmaDelete", silent = true, desc = "Delete", mode = "n" }, + { "ro", ":MagmaShowOutput", silent = true, desc = "Show Output", mode = "n" }, + { "ri", ":MagmaInit python3", silent = true, desc = "Init", mode = "n" }, + -- let g:magma_automatically_open_output = v:false + -- let g:magma_image_provider = "ueberzug" + -- let g:magma_image_provider = "kitty" + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/markdown-preview.lua b/ar/.config/LazyVim/lua/plugins/markdown-preview.lua new file mode 100644 index 0000000..328f2e9 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/markdown-preview.lua @@ -0,0 +1,23 @@ +return { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + -- build = function() + -- vim.fn["mkdp#util#install"]() + -- end, + keys = { + { + "cp", + false, + }, + { + mode = "n", + "mp", + ft = "markdown", + "MarkdownPreviewToggle", + desc = "Markdown Preview", + }, + }, + -- config = function() + -- vim.cmd([[do FileType]]) + -- end, +} diff --git a/ar/.config/LazyVim/lua/plugins/mason.lua b/ar/.config/LazyVim/lua/plugins/mason.lua new file mode 100644 index 0000000..96e320d --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/mason.lua @@ -0,0 +1,92 @@ +local options = { + ensure_installed = { + "black", + "clangd", + "codelldb", + "debugpy", + "docker-compose-language-service", + "dockerfile-language-server", + "eslint-lsp", + "hadolint", + "java-debug-adapter", + "java-test", + "jdtls", + "json-lsp", + "lua-language-server", + "markdownlint", + "marksman", + "prettier", + "pyright", + "ruff", + "shfmt", + "stylua", + "yaml-language-server", + }, + + max_concurrent_installers = 10, +} + +return { + "williamboman/mason.nvim", + cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" }, + opts = function() + return options + end, + build = ":MasonUpdate", + ---@param opts MasonSettings | {ensure_installed: string[]} + config = function(_, opts) + require("mason").setup(opts) + local mr = require("mason-registry") + mr:on("package:install:success", function() + vim.defer_fn(function() + -- trigger FileType event to possibly load this newly installed LSP server + require("lazy.core.handler.event").trigger({ + event = "FileType", + buf = vim.api.nvim_get_current_buf(), + }) + end, 100) + end) + local function ensure_installed() + for _, tool in ipairs(opts.ensure_installed) do + local p = mr.get_package(tool) + if not p:is_installed() then + p:install() + end + end + end + if mr.refresh then + mr.refresh(ensure_installed) + else + ensure_installed() + end + require("mason").setup(opts) + vim.api.nvim_create_user_command("MasonInstallAll", function() + if opts.ensure_installed and #opts.ensure_installed > 0 then + vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " ")) + end + end, {}) + + vim.g.mason_binaries_list = opts.ensure_installed + end, + keys = { + { "cm", false }, + { + mode = "n", + "ms", + "Mason", + desc = "Mason", + }, + { + mode = "n", + "mu", + "MasonUpdate", + desc = "Mason Update", + }, + { + mode = "n", + "mi", + "MasonInstallAll", + desc = "Mason Install All", + }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/neogen.lua b/ar/.config/LazyVim/lua/plugins/neogen.lua new file mode 100644 index 0000000..0fbe48a --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/neogen.lua @@ -0,0 +1,33 @@ +local opts = { noremap = true, silent = true } +return { + "danymat/neogen", + dependencies = "nvim-treesitter/nvim-treesitter", + config = true, + version = "*", + keys = { + vim.api.nvim_set_keymap( + "n", + "nf", + ":lua require('neogen').generate({type = 'file'})", + { desc = "generate file", noremap = true, silent = true } + ), + vim.api.nvim_set_keymap( + "n", + "nn", + ":lua require('neogen').generate({type = 'func'})", + { desc = "generate function", noremap = true, silent = true } + ), + vim.api.nvim_set_keymap( + "n", + "nc", + ":lua require('neogen').generate({ type = 'class' })", + { desc = "generate class", noremap = true, silent = true } + ), + vim.api.nvim_set_keymap( + "n", + "nt", + ":lua require('neogen').generate({ type = 'type' })", + { desc = "generate type", noremap = true, silent = true } + ), + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/notify.lua b/ar/.config/LazyVim/lua/plugins/notify.lua new file mode 100644 index 0000000..828aaf1 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/notify.lua @@ -0,0 +1,6 @@ +return { + "rcarriga/nvim-notify", + opts = { + background_colour = "#000000", + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/nvim-neo-tree.lua b/ar/.config/LazyVim/lua/plugins/nvim-neo-tree.lua new file mode 100644 index 0000000..ebb7387 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/nvim-neo-tree.lua @@ -0,0 +1,16 @@ +local Util = require("lazyvim.util") +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + cmd = "Neotree", + opts = {}, + keys = { + { + "", + function() + require("neo-tree.command").execute({ toggle = false }) + end, + desc = "Focus Explorer NeoTree (root dir)", + }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/obsidian.lua b/ar/.config/LazyVim/lua/plugins/obsidian.lua new file mode 100644 index 0000000..ed09f64 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/obsidian.lua @@ -0,0 +1,319 @@ +return { + "epwalsh/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + lazy = true, + ft = "markdown", + dependencies = { + "nvim-lua/plenary.nvim", + "hrsh7th/nvim-cmp", + "nvim-telescope/telescope.nvim", + "epwalsh/pomo.nvim", + }, + config = function() + require("obsidian").setup({ + workspaces = { + { + name = "SI", + path = "~/Obsidian/SI", + }, + }, + notes_subdir = "/Resource/Unsorted notes", + log_level = vim.log.levels.INFO, + daily_notes = { + folder = "Area/Journal/Daily", + date_format = "%Y-%m-%d", + alias_format = "%B %e, %Y", + template = "nvim-todo-daily-template.md", + }, + templates = { + subdir = "Resource/Templates/Notes", + date_format = "%Y-%m-%d", + time_format = "%H:%M", + substitutions = { + date_alias = function() + return os.date("%B %-e, %Y") + end, + folder_name = function() + local currentFilePath = vim.fn.expand("%:p:h") + local _, _, currentFolderName = currentFilePath:find("([^/]+)$") + currentFolderName = currentFolderName:gsub(" ", "-") + return currentFolderName + end, + }, + }, + completion = { + nvim_cmp = true, + min_chars = 2, + }, + note_id_func = function(title) + local suffix = "" + if title ~= nil then + suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() + else + for _ = 1, 4 do + -- suffix = suffix .. string.char(math.random(65, 90)) + suffix = tostring(os.date("%Y-%m-%d")) + end + end + -- return tostring(os.date("%Y-%M-%d")) .. "-" .. suffix + -- return tostring(os.date("%Y-%m-%d")) + return suffix + end, + disable_frontmatter = true, + note_frontmatter_func = function(note) + local currentDate = os.date("%B %d, %Y") + -- local _, _, filename, parentPath = note.id:find("([^/]+)[^/]*$") + local _, _, parentPath = note.id:find(".*/(.*)/[^/]*$") + + parentPath = parentPath or "unsorted_notes" + note:add_alias(currentDate) + -- note:add_tag(filename) + note:add_tag(parentPath) + + local out = { id = os.date("%Y-%m-%d"), aliases = note.aliases, tags = note.tags } + if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then + for k, v in pairs(note.metadata) do + out[k] = v + end + end + + return out + end, + follow_url_func = function(url) + vim.fn.jobstart({ "open", url }) -- Mac OS + -- vim.fn.jobstart({"xdg-open", url}) -- linux + end, + use_advanced_uri = false, + open_app_foreground = true, + finder = "telescope.nvim", + finder_mappings = {}, + sort_by = "modified", + sort_reversed = true, + open_notes_in = "current", + ui = { + tick = 0, + enable = true, -- set to false to disable all additional syntax features + update_debounce = 200, -- update delay after a text change (in milliseconds) + checkboxes = { + [" "] = { char = "󰄱", hl_group = "ObsidianTodo" }, + ["x"] = { char = "", hl_group = "ObsidianDone" }, + [">"] = { char = "", hl_group = "ObsidianRightArrow" }, + ["~"] = { char = "󰰱", hl_group = "ObsidianTilde" }, + }, + external_link_icon = { char = "", hl_group = "ObsidianExtLinkIcon" }, + reference_text = { hl_group = "ObsidianRefText" }, + highlight_text = { hl_group = "ObsidianHighlightText" }, + tags = { hl_group = "ObsidianTag" }, + hl_groups = { + ObsidianTodo = { bold = true, fg = "#f78c6c" }, + ObsidianDone = { bold = true, fg = "#89ddff" }, + ObsidianRightArrow = { bold = true, fg = "#f78c6c" }, + ObsidianTilde = { bold = true, fg = "#ff5370" }, + ObsidianRefText = { underline = true, fg = "#c792ea" }, + ObsidianExtLinkIcon = { fg = "#c792ea" }, + ObsidianTag = { italic = true, fg = "#89ddff" }, + ObsidianHighlightText = { bg = "#75662e" }, + }, + }, + attachments = { + img_folder = "assets/imgs", -- This is the default + ---@param client obsidian.Client + ---@param path Path the absolute path to the image file + ---@return string + img_text_func = function(client, path) + local link_path + local vault_relative_path = client:vault_relative_path(path) + if vault_relative_path ~= nil then + link_path = vault_relative_path + else + link_path = tostring(path) + end + local display_name = vim.fs.basename(link_path) + return string.format("![%s](%s)", display_name, link_path) + end, + }, + yaml_parser = "native", + mappings = {}, + }) + end, + cmd = { + "ObsidianOpen", + "ObsidianNew", + "ObsidianQuickSwitch", + "ObsidianFollowLink", + "ObsidianBacklinks", + "ObsidianToday", + "ObsidianYesterday", + "ObsidianTomorrow", + "ObsidianTemplate", + "ObsidianSearch", + "ObsidianWorkspace", + "ObsidianPasteImg", + "ObsidianRename", + "ObsidianLink", + "ObsidianLinkNew", + }, + keys = { + { + mode = { "i", "n" }, + "gf", + function() + return require("obsidian").util.gf_passthrough() + end, + desc = "goto file", + noremap = false, + expr = true, + buffer = true, + }, + { + mode = "n", + "cb", + function() + return require("obsidian").util.toggle_checkbox() + end, + buffer = true, + desc = "Check Box", + }, + { + mode = "n", + "ono", + function() + local query = vim.fn.input("Enter query: ") + if query and #query > 0 then + vim.cmd("ObsidianOpen " .. query) + end + end, + desc = "Open Note", + }, + { + mode = "n", + "onn", + function() + local title = vim.fn.input("Enter title: ") + if title and #title > 0 then + vim.cmd("ObsidianNew " .. title) + end + end, + desc = "New Note", + }, + { + mode = "n", + "os", + " ObsidianQuickSwitch ", + desc = "Quick Switch", + }, + { + mode = "n", + "o]", + " ObsidianFollowLink ", + desc = "Follow Link", + }, + { + mode = "n", + "o[", + " ObsidianBacklinks ", + desc = "Back Link", + }, + { + mode = "n", + "ont", + function() + local offset = vim.fn.input("Enter offset: ") + if offset and #offset > 0 then + vim.cmd("ObsidianToday " .. offset) + else + vim.cmd("ObsidianToday") + end + end, + desc = "Today Note", + }, + { + mode = "n", + "onh", + " ObsidianYesterday ", + desc = "Yesterday Note", + }, + { + mode = "n", + "onl", + " ObsidianTomorrow ", + desc = "Tomorrow Note", + }, + { + mode = "n", + "oti", + "ObsidianTemplate", + desc = "Insert Templates", + }, + { + mode = "n", + "onf", + function() + local note = vim.fn.input("Enter note: ") + if note and #note > 0 then + vim.cmd("ObsidianSearch " .. note) + end + end, + desc = "Search Note", + }, + { + mode = "n", + "ow", + function() + local name = vim.fn.input("Enter name: ") + if name and #name > 0 then + vim.cmd("ObsidianWorkspace " .. name) + end + end, + desc = "Workspace Name", + }, + { + mode = "n", + "opi", + function() + local image = vim.fn.input("Enter image: ") + if image and #image > 0 then + vim.cmd("ObsidianPasteImg " .. image) + end + end, + desc = "Paste Image", + }, + { + mode = "n", + "onr", + function() + local name = vim.fn.input("Enter name: ") + if name and #name > 0 then + vim.cmd("ObsidianRename " .. name) + end + end, + desc = "Rename Note", + }, + { + mode = "v", + "ol", + function() + local query = vim.fn.input("Enter query: ") + if query and #query > 0 then + vim.cmd("ObsidianLink " .. query) + else + vim.cmd("ObsidianLink") + end + end, + desc = "Link Query", + }, + { + mode = "v", + "onl", + function() + local note = vim.fn.input("Enter note: ") + if note and #note > 0 then + vim.cmd("ObsidianLinkNew " .. note) + else + vim.cmd("ObsidianLinkNew") + end + end, + desc = "New Link Note", + }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/oil.lua b/ar/.config/LazyVim/lua/plugins/oil.lua new file mode 100644 index 0000000..ffbbfe9 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/oil.lua @@ -0,0 +1,13 @@ +return { + "stevearc/oil.nvim", + opts = {}, + -- Optional dependencies + dependencies = { "nvim-tree/nvim-web-devicons" }, + cmd = { "Oil" }, + config = function() + require("oil").setup() + end, + keys = { + vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }), + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/playground.lua b/ar/.config/LazyVim/lua/plugins/playground.lua new file mode 100644 index 0000000..e696828 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/playground.lua @@ -0,0 +1,38 @@ +return { + "nvim-treesitter/playground", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + cmd = { "TSPlaygroundToggle" }, + config = function() + require("nvim-treesitter.configs").setup({ + playground = { + enable = true, + disable = {}, + updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code + persist_queries = false, -- Whether the query persists across vim sessions + keybindings = { + toggle_query_editor = "o", + toggle_hl_groups = "i", + toggle_injected_languages = "t", + toggle_anonymous_nodes = "a", + toggle_language_display = "I", + focus_language = "f", + unfocus_language = "F", + update = "R", + goto_node = "", + show_help = "?", + }, + }, + + query_linter = { + enable = true, + use_virtual_text = true, + lint_events = { "BufWrite", "CursorHold" }, + }, + }) + end, + keys = { + { mode = "n", "pg", " TSPlaygroundToggle ", desc = "Toggle Playground" }, + { mode = "n", "pc", " TSHighlightCapturesUnderCurso ", desc = "Highlight Captures" }, + { mode = "n", "pn", " TSNodeUnderCursor ", desc = "Node Under Cursor" }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/project.lua b/ar/.config/LazyVim/lua/plugins/project.lua new file mode 100644 index 0000000..313c8f8 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/project.lua @@ -0,0 +1,6 @@ +return { + "ahmedkhalf/project.nvim", + keys = { + { "pr", "ProjectRoot", desc = "Project Root" }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/refactoring.lua b/ar/.config/LazyVim/lua/plugins/refactoring.lua new file mode 100644 index 0000000..a7bdf99 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/refactoring.lua @@ -0,0 +1,35 @@ +return { + "ThePrimeagen/refactoring.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("refactoring").setup() + end, + keys = { + vim.keymap.set("x", "re", function() + require("refactoring").refactor("Extract Function") + end, { desc = "Extract Function" }), + vim.keymap.set({ "x", "n" }, "rf", function() + require("refactoring").refactor("Extract Function To File") + end, { desc = "Extract Function To File" }), + -- Extract function supports only visual mode + vim.keymap.set("x", "rv", function() + require("refactoring").refactor("Extract Variable") + end, { desc = "Extract Variable" }), + -- Extract variable supports only visual mode + vim.keymap.set("n", "rI", function() + require("refactoring").refactor("Inline Function") + end, { desc = "Inline Function" }), + -- Inline func supports only normal + vim.keymap.set({ "n", "x" }, "ri", function() + require("refactoring").refactor("Inline Variable") + end, { desc = "Inline Variable" }), + -- Inline var supports both normal and visual mode + + vim.keymap.set("n", "rb", function() + require("refactoring").refactor("Extract Block") + end, { desc = "Extract Block" }), + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/seoul256.lua b/ar/.config/LazyVim/lua/plugins/seoul256.lua new file mode 100644 index 0000000..ddbc87b --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/seoul256.lua @@ -0,0 +1,3 @@ +return { + "junegunn/seoul256.vim", +} diff --git a/ar/.config/LazyVim/lua/plugins/tagbar.lua b/ar/.config/LazyVim/lua/plugins/tagbar.lua new file mode 100644 index 0000000..3824cfd --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/tagbar.lua @@ -0,0 +1,12 @@ +return { + "preservim/tagbar", + cmd = "TagbarToggle", + keys = { + { + mode = "n", + "tb", + "TagbarToggle", + desc = "Toggle Tagbar", + }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/telescope.lua b/ar/.config/LazyVim/lua/plugins/telescope.lua new file mode 100644 index 0000000..0a96a09 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/telescope.lua @@ -0,0 +1,24 @@ +return { + "nvim-telescope/telescope.nvim", + keys = { + { "/", false }, + { "", false }, + { "", false }, + }, + opts = function() + local actions = require("telescope.actions") + + return { + defaults = { + mappings = { + i = { + [""] = actions.preview_scrolling_down, + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_left, + [""] = actions.preview_scrolling_right, + }, + }, + }, + } + end, +} diff --git a/ar/.config/LazyVim/lua/plugins/tmux-navigator.lua b/ar/.config/LazyVim/lua/plugins/tmux-navigator.lua new file mode 100644 index 0000000..7b37cf7 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/tmux-navigator.lua @@ -0,0 +1,19 @@ +return { + { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + }, + keys = { + { "", "TmuxNavigateLeft", desc = "Tmux Navigate Left" }, + { "", "TmuxNavigateDown", desc = "Tmux Navigate Down" }, + { "", "TmuxNavigateUp", desc = "Tmux Navigate Up" }, + { "", "TmuxNavigateRight", desc = "Tmux Navigate Right" }, + { "", "TmuxNavigatePrevious", desc = "Tmux Navigate Previous" }, + }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/tokyonight.lua b/ar/.config/LazyVim/lua/plugins/tokyonight.lua new file mode 100644 index 0000000..6dcb72f --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/tokyonight.lua @@ -0,0 +1,10 @@ +return { + "folke/tokyonight.nvim", + opts = { + transparent = true, + styles = { + sidebars = "transparent", + floats = "transparent", + }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/treesj.lua b/ar/.config/LazyVim/lua/plugins/treesj.lua new file mode 100644 index 0000000..9cfb3ff --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/treesj.lua @@ -0,0 +1,32 @@ +return { + "Wansmer/treesj", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + config = function() + require("treesj").setup({ + ---@type boolean Use default keymaps (m - toggle, j - join, s - split) + use_default_keymaps = false, + ---@type boolean Node with syntax error will not be formatted + check_syntax_error = true, + ---If line after join will be longer than max value, + ---@type number If line after join will be longer than max value, node will not be formatted + max_join_length = 300, + ---Cursor behavior: + ---hold - cursor follows the node/place on which it was called + ---start - cursor jumps to the first symbol of the node being formatted + ---end - cursor jumps to the last symbol of the node being formatted + ---@type 'hold'|'start'|'end' + cursor_behavior = "hold", + ---@type boolean Notify about possible problems or not + notify = true, + ---@type boolean Use `dot` for repeat action + dot_repeat = true, + ---@type nil|function Callback for treesj error handler. func (err_text, level, ...other_text) + on_error = nil, + ---@type table Presets for languages + -- langs = {}, -- See the default presets in lua/treesj/langs + }) + end, + keys = { + { "j", "TSJToggle", desc = "Toggle Treesj" }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/vimwiki.lua b/ar/.config/LazyVim/lua/plugins/vimwiki.lua new file mode 100644 index 0000000..697ef70 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/vimwiki.lua @@ -0,0 +1,37 @@ +return { + "vimwiki/vimwiki", + cmd = { "VimwikiIndex", "Vimwiki2HTML", "VimwikiAll2HTML" }, + keys = { + vim.api.nvim_set_keymap("n", "|", ":VimwikiSplitLink", { silent = true, desc = "Horizontal Split" }), + vim.api.nvim_set_keymap("n", "-", ":VimwikiVSplitLink", { silent = true, desc = "Vertical Split" }), + vim.api.nvim_set_keymap("n", "va", ":VimwikiAll2HTML", { silent = true, desc = "All Vimwiki to HTML" }), + vim.api.nvim_set_keymap( + "n", + "vc", + ":VimwikiColorize", + { silent = true, desc = "Colorize line or selection" } + ), + vim.api.nvim_set_keymap("n", "vd", ":VimwikiDeleteFile", { silent = true, desc = "Delete Wiki Page" }), + vim.api.nvim_set_keymap("n", "vh", ":Vimwiki2HTML", { silent = true, desc = "Vimwiki to HTML" }), + vim.api.nvim_set_keymap( + "n", + "vH", + ":Vimwiki2HTMLBrowse", + { silent = true, desc = "Convert current wiki to HTML" } + ), + vim.api.nvim_set_keymap("n", "vw", ":VimwikiIndex", { silent = true, desc = "Vimwiki Index" }), + vim.api.nvim_set_keymap( + "n", + "vn", + ":VimwikiGoto", + { silent = true, desc = "Goto or Create New Wiki Page" } + ), + vim.api.nvim_set_keymap("n", "vr", ":VimwikiRenameFile", { silent = true, desc = "Rename Wiki Page" }), + vim.api.nvim_set_keymap( + "n", + "vu", + ":VimwikiDiaryGenerateLinks", + { silent = true, desc = "Update Diary" } + ), + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/which-key.lua b/ar/.config/LazyVim/lua/plugins/which-key.lua new file mode 100644 index 0000000..94a6b3f --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/which-key.lua @@ -0,0 +1,55 @@ +return { + "folke/which-key.nvim", + opts = { + plugins = { spelling = true }, + defaults = { + mode = { "n", "v" }, + ["g"] = { name = "+goto" }, + ["gz"] = { name = "+surround" }, + ["z"] = { name = "+fold" }, + ["]"] = { name = "+next" }, + ["["] = { name = "+prev" }, + ["="] = { name = "+line paste" }, + ["\\"] = { name = "+local leader" }, + [""] = { name = "+leader" }, + ["<"] = { name = "+B/A paste & L/R indent" }, + ["="] = { name = "+paste & B/A filtter" }, + [">"] = { name = "+B/A paste & L/R indent" }, + ["["] = { name = "+indent B/A cursor" }, + ["]"] = { name = "+indent B/A cursor" }, + [""] = { name = "+tabs" }, + ["b"] = { name = "+buffer" }, + ["c"] = { name = "+code" }, + ["cp"] = { name = "+copy" }, + ["dd"] = { name = "+db" }, + ["dP"] = { name = "+class/method" }, + ["f"] = { name = "+file/find" }, + ["h"] = { name = "+harpoon" }, + ["g"] = { name = "+git" }, + ["gh"] = { name = "+hunks" }, + ["gz"] = { name = "+surround" }, + ["m"] = { name = "+mason" }, + ["n"] = { name = "+annotation" }, + ["o"] = { name = "+obsidian" }, + ["on"] = { name = "+note" }, + ["op"] = { name = "+paste" }, + ["ot"] = { name = "+template" }, + ["p"] = { name = "+playground" }, + ["q"] = { name = "+quit/session" }, + ["r"] = { name = "+refactoring" }, + ["s"] = { name = "+search" }, + ["u"] = { name = "+ui" }, + ["w"] = { name = "+windows/which-key" }, + ["x"] = { name = "+trouble/quickfix" }, + }, + }, + keys = { + vim.keymap.set("n", "wK", function() + vim.cmd("WhichKey") + end, { desc = "Which-key All Key" }), + vim.keymap.set("n", "wk", function() + local input = vim.fn.input("WhichKey: ") + vim.cmd("WhichKey " .. input) + end, { desc = "Which-key Query Lookup" }), + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/yanky.lua b/ar/.config/LazyVim/lua/plugins/yanky.lua new file mode 100644 index 0000000..fb8ac2d --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/yanky.lua @@ -0,0 +1,31 @@ +return { + { + "gbprod/yanky.nvim", + dependencies = not jit.os:find("Windows") and { "kkharji/sqlite.lua" } or {}, + opts = { + highlight = { timer = 250 }, + ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" }, + }, + keys = { + -- stylua: ignore + { "h", function() require("telescope").extensions.yank_history.yank_history({ }) end, desc = "Open Yank History" }, + { "y", "(YankyYank)", mode = { "n", "x" }, desc = "Yank text" }, + { "p", "(YankyPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after cursor" }, + { "P", "(YankyPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before cursor" }, + { "gp", "(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after selection" }, + { "gP", "(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before selection" }, + { "[y", "(YankyCycleForward)", desc = "Cycle forward through yank history" }, + { "]y", "(YankyCycleBackward)", desc = "Cycle backward through yank history" }, + { "]p", "(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" }, + { "[p", "(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" }, + { "]P", "(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" }, + { "[P", "(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" }, + { ">p", "(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" }, + { "(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" }, + { ">P", "(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" }, + { "(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" }, + { "=p", "(YankyPutAfterFilter)", desc = "Put after applying a filter" }, + { "=P", "(YankyPutBeforeFilter)", desc = "Put before applying a filter" }, + }, + }, +} diff --git a/ar/.config/LazyVim/lua/plugins/zen-mode.lua b/ar/.config/LazyVim/lua/plugins/zen-mode.lua new file mode 100644 index 0000000..823aa94 --- /dev/null +++ b/ar/.config/LazyVim/lua/plugins/zen-mode.lua @@ -0,0 +1,11 @@ +return { + "folke/zen-mode.nvim", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = { + { "", "ZenMode", desc = "Zen mode" }, + }, +} diff --git a/ar/.config/LazyVim/stylua.toml b/ar/.config/LazyVim/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/ar/.config/LazyVim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file diff --git a/ar/.config/LazyVim/vscode/easymotion-config.vim b/ar/.config/LazyVim/vscode/easymotion-config.vim new file mode 100644 index 0000000..89c1f90 --- /dev/null +++ b/ar/.config/LazyVim/vscode/easymotion-config.vim @@ -0,0 +1,2 @@ +let g:EasyMotion_smartcase = 1 +nmap f (easymotion-bd-f) diff --git a/ar/.config/LazyVim/vscode/plugins.lua b/ar/.config/LazyVim/vscode/plugins.lua new file mode 100644 index 0000000..920d80f --- /dev/null +++ b/ar/.config/LazyVim/vscode/plugins.lua @@ -0,0 +1,153 @@ +-- plugins.lua + +return { + + -- Alpha (Dashboard) + { + "goolord/alpha-nvim", + lazy = true, + }, + + -- Auto Pairs + { + "windwp/nvim-autopairs", + }, + + -- Bufferline + { + "akinsho/bufferline.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + }, + + -- Colorscheme + { + "folke/tokyonight.nvim", + }, + + -- Comments + { + "numToStr/Comment.nvim", + config = function() + require("Comment").setup() + end, + }, + + -- Easymotion (VScode) + { + "ChristianChiarulli/vscode-easymotion", + }, + + -- Git Integration + { + "lewis6991/gitsigns.nvim", + }, + + -- Hop (Better Navigation) + { + "phaazon/hop.nvim", + lazy = true, + }, + + -- Indentation Highlighting + { + "lukas-reineke/indent-blankline.nvim", + }, + + -- Rainbow Highlighting + { + "HiPhish/nvim-ts-rainbow2", + }, + + -- Lualine + { + "nvim-lualine/lualine.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + }, + + -- Language Support + { + "VonHeikemen/lsp-zero.nvim", + lazy = true, + branch = "v1.x", + dependencies = { + -- LSP Support + { "neovim/nvim-lspconfig" }, -- Required + { "williamboman/mason.nvim" }, -- Optional + { "williamboman/mason-lspconfig.nvim" }, -- Optional + + -- Autocompletion + { "hrsh7th/nvim-cmp" }, -- Required + { "hrsh7th/cmp-nvim-lsp" }, -- Required + { "hrsh7th/cmp-buffer" }, -- Optional + { "hrsh7th/cmp-path" }, -- Optional + { "saadparwaiz1/cmp_luasnip" }, -- Optional + { "hrsh7th/cmp-nvim-lua" }, -- Optional + + -- Snippets + { "L3MON4D3/LuaSnip" }, -- Required + { "rafamadriz/friendly-snippets" }, -- Optional + }, + }, + + -- Nvim-tree (File Explorer) + { + "nvim-tree/nvim-tree.lua", + lazy = true, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + }, + + -- Nvim-Surround (Manipulating Surroundings) + { + "kylechui/nvim-surround", + config = function() + require("nvim-surround").setup { + -- Configuration here, or leave empty to use defaults + } + end, + }, + + -- -- Quick-Scope + -- { + -- "unblevable/quick-scope", + -- }, + + -- Telescope (Fuzzy Finder) + { + "nvim-telescope/telescope.nvim", + lazy = true, + dependencies = { + { "nvim-lua/plenary.nvim" }, + }, + }, + + -- Treesitter + { + "nvim-treesitter/nvim-treesitter", + }, + + -- Toggle Term + { + "akinsho/toggleterm.nvim", + config = true, + }, + + -- Undo-Tree + { + "jiaoshijie/undotree", + dependencies = { + "nvim-lua/plenary.nvim", + }, + }, + + -- Which-key + { + "folke/which-key.nvim", + lazy = true, + }, +} diff --git a/ar/.config/LazyVim/vscode/remap.lua b/ar/.config/LazyVim/vscode/remap.lua new file mode 100644 index 0000000..e0b47c4 --- /dev/null +++ b/ar/.config/LazyVim/vscode/remap.lua @@ -0,0 +1,32 @@ +vim.keymap.set("n", "pv", vim.cmd.Ex) + +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +-- greatest remap ever +vim.keymap.set("x", "p", [["_dP]]) + +-- next greatest remap ever : asbjornHaland +vim.keymap.set({ "n", "v" }, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +vim.keymap.set({ "n", "v" }, "d", [["_d]]) + +-- This is going to get me cancelled +vim.keymap.set("i", "jk", "") + +vim.keymap.set("n", "Q", "") + +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") +vim.keymap.set("n", "k", "lnextzz") +vim.keymap.set("n", "j", "lprevzz") + +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) diff --git a/ar/.config/LazyVim/vscode/settings.vim b/ar/.config/LazyVim/vscode/settings.vim new file mode 100644 index 0000000..c48a73c --- /dev/null +++ b/ar/.config/LazyVim/vscode/settings.vim @@ -0,0 +1,49 @@ +function! s:closeOtherEditors() + call VSCodeNotify('workbench.action.closeEditorsInOtherGroups') + call VSCodeNotify('workbench.action.closeOtherEditors') +endfunction + +function! s:manageEditorSize(...) + let count = a:1 + let to = a:2 + for i in range(1, count ? count : 1) + call VSCodeNotify(to == 'increase' ? 'workbench.action.increaseViewSize' : 'workbench.action.decreaseViewSize') + endfor +endfunction + +command! -bang Only if == '!' | call closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif + +nnoremap = :call VSCodeNotify('workbench.action.evenEditorWidths') +xnoremap = :call VSCodeNotify('workbench.action.evenEditorWidths') +nnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') +xnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') + +" nnoremap > :call manageEditorSize(v:count, 'increase') +" xnoremap > :call manageEditorSize(v:count, 'increase') +" nnoremap + :call manageEditorSize(v:count, 'increase') +" xnoremap + :call manageEditorSize(v:count, 'increase') +" nnoremap < :call manageEditorSize(v:count, 'decrease') +" xnoremap < :call manageEditorSize(v:count, 'decrease') +" nnoremap - :call manageEditorSize(v:count, 'decrease') +" xnoremap - :call manageEditorSize(v:count, 'decrease') + +" Better Navigation +nnoremap :call VSCodeNotify('workbench.action.navigateDown') +xnoremap :call VSCodeNotify('workbench.action.navigateDown') +nnoremap :call VSCodeNotify('workbench.action.navigateUp') +xnoremap :call VSCodeNotify('workbench.action.navigateUp') +nnoremap :call VSCodeNotify('workbench.action.navigateLeft') +xnoremap :call VSCodeNotify('workbench.action.navigateLeft') +nnoremap :call VSCodeNotify('workbench.action.navigateRight') +xnoremap :call VSCodeNotify('workbench.action.navigateRight') + +" Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors +xnoremap :call Comment() +nnoremap :call Comment() + +nnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') + +nnoremap :call VSCodeNotify('whichkey.show') +xnoremap :call VSCodeNotify('whichkey.show') + +" nnoremap :call VSCodeNotify('workbench.view.explorer') \ No newline at end of file diff --git a/ar/.config/NvChad/.ignore b/ar/.config/NvChad/.ignore new file mode 100644 index 0000000..42677fb --- /dev/null +++ b/ar/.config/NvChad/.ignore @@ -0,0 +1 @@ +!/lua/custom/ diff --git a/ar/.config/NvChad/.stylua.toml b/ar/.config/NvChad/.stylua.toml new file mode 100644 index 0000000..ecb6dca --- /dev/null +++ b/ar/.config/NvChad/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/ar/.config/NvChad/LICENSE b/ar/.config/NvChad/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/ar/.config/NvChad/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/ar/.config/NvChad/db_ui/connections.json b/ar/.config/NvChad/db_ui/connections.json new file mode 100644 index 0000000..b9034fe --- /dev/null +++ b/ar/.config/NvChad/db_ui/connections.json @@ -0,0 +1 @@ +[{"url": "mysql://si@localhost:3306/si", "name": "si"}] diff --git a/ar/.config/NvChad/db_ui/si/safTEST b/ar/.config/NvChad/db_ui/si/safTEST new file mode 100644 index 0000000..8370f6c --- /dev/null +++ b/ar/.config/NvChad/db_ui/si/safTEST @@ -0,0 +1 @@ +SELECT * FROM test; diff --git a/ar/.config/NvChad/init.lua b/ar/.config/NvChad/init.lua new file mode 100644 index 0000000..21f0b6f --- /dev/null +++ b/ar/.config/NvChad/init.lua @@ -0,0 +1,21 @@ +require "core" + +local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1] + +if custom_init_path then + dofile(custom_init_path) +end + +require("core.utils").load_mappings() + +local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" + +-- bootstrap lazy.nvim! +if not vim.loop.fs_stat(lazypath) then + require("core.bootstrap").gen_chadrc_template() + require("core.bootstrap").lazy(lazypath) +end + +dofile(vim.g.base46_cache .. "defaults") +vim.opt.rtp:prepend(lazypath) +require "plugins" diff --git a/ar/.config/NvChad/lua/core/bootstrap.lua b/ar/.config/NvChad/lua/core/bootstrap.lua new file mode 100644 index 0000000..b727ba8 --- /dev/null +++ b/ar/.config/NvChad/lua/core/bootstrap.lua @@ -0,0 +1,62 @@ +local M = {} +local fn = vim.fn + +M.echo = function(str) + vim.cmd "redraw" + vim.api.nvim_echo({ { str, "Bold" } }, true, {}) +end + +local function shell_call(args) + local output = fn.system(args) + assert(vim.v.shell_error == 0, "External call failed with error code: " .. vim.v.shell_error .. "\n" .. output) +end + +M.lazy = function(install_path) + ------------- base46 --------------- + local lazy_path = fn.stdpath "data" .. "/lazy/base46" + + M.echo " Compiling base46 theme to bytecode ..." + + local base46_repo = "https://github.com/NvChad/base46" + shell_call { "git", "clone", "--depth", "1", "-b", "v2.0", base46_repo, lazy_path } + vim.opt.rtp:prepend(lazy_path) + + require("base46").compile() + + --------- lazy.nvim --------------- + M.echo " Installing lazy.nvim & plugins ..." + local repo = "https://github.com/folke/lazy.nvim.git" + shell_call { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path } + vim.opt.rtp:prepend(install_path) + + -- install plugins + require "plugins" + + -- mason packages & show post_bootstrap screen + require "nvchad.post_install"() +end + +M.gen_chadrc_template = function() + local path = fn.stdpath "config" .. "/lua/custom" + + if fn.isdirectory(path) ~= 1 then + local input = fn.input "Do you want to install example custom config? (y/N): " + + if input:lower() == "y" then + M.echo "Cloning example custom config repo..." + shell_call { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path } + fn.delete(path .. "/.git", "rf") + else + -- use very minimal chadrc + fn.mkdir(path, "p") + + local file = io.open(path .. "/chadrc.lua", "w") + if file then + file:write "---@type ChadrcConfig\nlocal M = {}\n\nM.ui = { theme = 'onedark' }\n\nreturn M" + file:close() + end + end + end +end + +return M diff --git a/ar/.config/NvChad/lua/core/default_config.lua b/ar/.config/NvChad/lua/core/default_config.lua new file mode 100644 index 0000000..639916a --- /dev/null +++ b/ar/.config/NvChad/lua/core/default_config.lua @@ -0,0 +1,92 @@ +local M = {} + +M.options = { + nvchad_branch = "v2.0", +} + +M.ui = { + ------------------------------- base46 ------------------------------------- + -- hl = highlights + hl_add = {}, + hl_override = {}, + changed_themes = {}, + theme_toggle = { "onedark", "one_light" }, + theme = "onedark", -- default theme + transparency = false, + lsp_semantic_tokens = false, -- needs nvim v0.9, just adds highlight groups for lsp semantic tokens + + -- https://github.com/NvChad/base46/tree/v2.0/lua/base46/extended_integrations + extended_integrations = {}, -- these aren't compiled by default, ex: "alpha", "notify" + + -- cmp themeing + cmp = { + icons = true, + lspkind_text = true, + style = "default", -- default/flat_light/flat_dark/atom/atom_colored + border_color = "grey_fg", -- only applicable for "default" style, use color names from base30 variables + selected_item_bg = "colored", -- colored / simple + }, + + telescope = { style = "borderless" }, -- borderless / bordered + + ------------------------------- nvchad_ui modules ----------------------------- + statusline = { + theme = "default", -- default/vscode/vscode_colored/minimal + -- default/round/block/arrow separators work only for default statusline theme + -- round and block will work for minimal theme only + separator_style = "default", + overriden_modules = nil, + }, + + -- lazyload it when there are 1+ buffers + tabufline = { + show_numbers = false, + enabled = true, + lazyload = true, + overriden_modules = nil, + }, + + -- nvdash (dashboard) + nvdash = { + load_on_startup = false, + + header = { + " ▄ ▄ ", + " ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ", + " █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ", + " ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ ", + " ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ", + " █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄", + "▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █", + "█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █", + " █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ", + }, + + buttons = { + { " Find File", "Spc f f", "Telescope find_files" }, + { "󰈚 Recent Files", "Spc f o", "Telescope oldfiles" }, + { "󰈭 Find Word", "Spc f w", "Telescope live_grep" }, + { " Bookmarks", "Spc m a", "Telescope marks" }, + { " Themes", "Spc t h", "Telescope themes" }, + { " Mappings", "Spc c h", "NvCheatsheet" }, + }, + }, + + cheatsheet = { theme = "grid" }, -- simple/grid + + lsp = { + -- show function signatures i.e args as you type + signature = { + disabled = false, + silent = true, -- silences 'no signature help available' message from appearing + }, + }, +} + +M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file + +M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options + +M.mappings = require "core.mappings" + +return M diff --git a/ar/.config/NvChad/lua/core/init.lua b/ar/.config/NvChad/lua/core/init.lua new file mode 100644 index 0000000..2316f1b --- /dev/null +++ b/ar/.config/NvChad/lua/core/init.lua @@ -0,0 +1,116 @@ +local opt = vim.opt +local g = vim.g +local config = require("core.utils").load_config() + +-------------------------------------- globals ----------------------------------------- +g.nvchad_theme = config.ui.theme +g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/" +g.toggle_theme_icon = "  " +g.transparency = config.ui.transparency + +-------------------------------------- options ------------------------------------------ +opt.laststatus = 3 -- global statusline +opt.showmode = false + +opt.clipboard = "unnamedplus" +opt.cursorline = true + +-- Indenting +opt.expandtab = true +opt.shiftwidth = 2 +opt.smartindent = true +opt.tabstop = 2 +opt.softtabstop = 2 + +opt.fillchars = { eob = " " } +opt.ignorecase = true +opt.smartcase = true +opt.mouse = "a" + +-- Numbers +opt.number = true +opt.numberwidth = 2 +opt.ruler = false + +-- disable nvim intro +opt.shortmess:append "sI" + +opt.signcolumn = "yes" +opt.splitbelow = true +opt.splitright = true +opt.termguicolors = true +opt.timeoutlen = 400 +opt.undofile = true + +-- interval for writing swap file to disk, also used by gitsigns +opt.updatetime = 250 + +-- go to previous/next line with h,l,left arrow and right arrow +-- when cursor reaches end/beginning of line +opt.whichwrap:append "<>[]hl" + +g.mapleader = " " + +-- disable some default providers +-- for _, provider in ipairs { "node", "perl", "python3", "ruby" } do +for _, provider in ipairs { "node", "perl", "ruby" } do + vim.g["loaded_" .. provider .. "_provider"] = 0 +end + +-- add binaries installed by mason.nvim to path +local is_windows = vim.loop.os_uname().sysname == "Windows_NT" +vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH + +-------------------------------------- autocmds ------------------------------------------ +local autocmd = vim.api.nvim_create_autocmd + +-- dont list quickfix buffers +autocmd("FileType", { + pattern = "qf", + callback = function() + vim.opt_local.buflisted = false + end, +}) + +-- reload some chadrc options on-save +autocmd("BufWritePost", { + pattern = vim.tbl_map(function(path) + return vim.fs.normalize(vim.loop.fs_realpath(path)) + end, vim.fn.glob(vim.fn.stdpath "config" .. "/lua/custom/**/*.lua", true, true, true)), + group = vim.api.nvim_create_augroup("ReloadNvChad", {}), + + callback = function(opts) + local fp = vim.fn.fnamemodify(vim.fs.normalize(vim.api.nvim_buf_get_name(opts.buf)), ":r") --[[@as string]] + local app_name = vim.env.NVIM_APPNAME and vim.env.NVIM_APPNAME or "nvim" + local module = string.gsub(fp, "^.*/" .. app_name .. "/lua/", ""):gsub("/", ".") + + require("plenary.reload").reload_module "base46" + require("plenary.reload").reload_module(module) + require("plenary.reload").reload_module "custom.chadrc" + + config = require("core.utils").load_config() + + vim.g.nvchad_theme = config.ui.theme + vim.g.transparency = config.ui.transparency + + -- statusline + require("plenary.reload").reload_module("nvchad.statusline." .. config.ui.statusline.theme) + vim.opt.statusline = "%!v:lua.require('nvchad.statusline." .. config.ui.statusline.theme .. "').run()" + + -- tabufline + if config.ui.tabufline.enabled then + require("plenary.reload").reload_module "nvchad.tabufline.modules" + vim.opt.tabline = "%!v:lua.require('nvchad.tabufline.modules').run()" + end + + require("base46").load_all_highlights() + -- vim.cmd("redraw!") + end, +}) + +-------------------------------------- commands ------------------------------------------ +local new_cmd = vim.api.nvim_create_user_command + +new_cmd("NvChadUpdate", function() + require "nvchad.updater"() +end, {}) diff --git a/ar/.config/NvChad/lua/core/mappings.lua b/ar/.config/NvChad/lua/core/mappings.lua new file mode 100644 index 0000000..4154bde --- /dev/null +++ b/ar/.config/NvChad/lua/core/mappings.lua @@ -0,0 +1,468 @@ +-- n, v, i, t = mode names + +local M = {} + +M.general = { + i = { + -- go to beginning and end + [""] = { "^i", "Beginning Of Line" }, + [""] = { "", "End Of Line" }, + + -- navigate within insert mode + [""] = { "", "Move Left" }, + [""] = { "", "Move Right" }, + [""] = { "", "Move Down" }, + [""] = { "", "Move Up" }, + }, + + n = { + [""] = { " noh ", "Clear Highlights" }, + -- switch between windows + [""] = { "h", "Window Left" }, + [""] = { "l", "Window Right" }, + [""] = { "j", "Window Down" }, + [""] = { "k", "Window Up" }, + + -- save + [""] = { " w ", "Save File" }, + + -- Copy all + [""] = { " %y+ ", "Copy whole file" }, + + -- line numbers + ["n"] = { " set nu! ", "Toggle Line Number" }, + ["rn"] = { " set rnu! ", "Toggle Relative Number" }, + + -- Allow moving the cursor through wrapped lines with j, k, and + -- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/ + -- empty mode is same as using :map + -- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour + ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move Down", opts = { expr = true } }, + ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move Up", opts = { expr = true } }, + [""] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move Up", opts = { expr = true } }, + [""] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move Down", opts = { expr = true } }, + + -- new buffer + ["b"] = { " enew ", "New Buffer" }, + ["ch"] = { " NvCheatsheet ", "Mapping Cheatsheet" }, + + ["fm"] = { + function() + vim.lsp.buf.format { async = true } + end, + "LSP Formatting", + }, + }, + + t = { + [""] = { vim.api.nvim_replace_termcodes("", true, true, true), "Escape Terminal Mode" }, + }, + + v = { + [""] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move Up", opts = { expr = true } }, + [""] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move Down", opts = { expr = true } }, + ["<"] = { ""] = { ">gv", "Indent line" }, + }, + + x = { + ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move Down", opts = { expr = true } }, + ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move Up", opts = { expr = true } }, + -- Don't copy the replaced text after pasting in visual mode + -- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste + ["p"] = { 'p:let @+=@0:let @"=@0', "Dont Copy Replaced Text", opts = { silent = true } }, + }, +} + +M.tabufline = { + plugin = true, + + n = { + -- cycle through buffers + [""] = { + function() + require("nvchad.tabufline").tabuflineNext() + end, + "Goto Next Buffer", + }, + + [""] = { + function() + require("nvchad.tabufline").tabuflinePrev() + end, + "Goto Prev Buffer", + }, + + -- close buffer + hide terminal buffer + ["x"] = { + function() + require("nvchad.tabufline").close_buffer() + end, + "Close Buffer", + }, + }, +} + +M.comment = { + plugin = true, + + -- toggle comment in both modes + n = { + ["/"] = { + function() + require("Comment.api").toggle.linewise.current() + end, + "Toggle Comment", + }, + }, + + v = { + ["/"] = { + "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", + "Toggle Comment", + }, + }, +} + +M.lspconfig = { + plugin = true, + + -- See ` :help vim.lsp.*` for documentation on any of the below functions + + n = { + ["gD"] = { + function() + vim.lsp.buf.declaration() + end, + "LSP Declaration", + }, + + ["gd"] = { + function() + vim.lsp.buf.definition() + end, + "LSP Definition", + }, + + ["K"] = { + function() + vim.lsp.buf.hover() + end, + "LSP Hover", + }, + + ["gi"] = { + function() + vim.lsp.buf.implementation() + end, + "LSP Implementation", + }, + + ["ls"] = { + function() + vim.lsp.buf.signature_help() + end, + "LSP Signature Help", + }, + + ["D"] = { + function() + vim.lsp.buf.type_definition() + end, + "LSP Definition Type", + }, + + ["ra"] = { + function() + require("nvchad.renamer").open() + end, + "LSP Rename", + }, + + ["ca"] = { + function() + vim.lsp.buf.code_action() + end, + "LSP Code Action", + }, + + ["gr"] = { + function() + vim.lsp.buf.references() + end, + "LSP References", + }, + + ["lf"] = { + function() + vim.diagnostic.open_float { border = "rounded" } + end, + "Floating Diagnostic", + }, + + ["[d"] = { + function() + vim.diagnostic.goto_prev { float = { border = "rounded" } } + end, + "Goto Prev", + }, + + ["]d"] = { + function() + vim.diagnostic.goto_next { float = { border = "rounded" } } + end, + "Goto Next", + }, + + ["q"] = { + function() + vim.diagnostic.setloclist() + end, + "Diagnostic Setloclist", + }, + + ["wa"] = { + function() + vim.lsp.buf.add_workspace_folder() + end, + "Add Workspace Folder", + }, + + ["wr"] = { + function() + vim.lsp.buf.remove_workspace_folder() + end, + "Remove Workspace Folder", + }, + + ["wl"] = { + function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, + "List Workspace Folders", + }, + }, + + v = { + ["ca"] = { + function() + vim.lsp.buf.code_action() + end, + "LSP Code Action", + }, + }, +} + +M.nvimtree = { + plugin = true, + + n = { + -- toggle + [""] = { " NvimTreeToggle ", "Toggle Nvimtree" }, + + -- focus + ["e"] = { " NvimTreeFocus ", "Focus Nvimtree" }, + }, +} + +M.telescope = { + plugin = true, + + n = { + -- find + ["ff"] = { " Telescope find_files ", "Find Files" }, + ["fa"] = { " Telescope find_files follow=true no_ignore=true hidden=true ", "Find All" }, + ["fw"] = { " Telescope live_grep ", "Live Grep" }, + ["fb"] = { " Telescope buffers ", "Find Buffers" }, + ["fh"] = { " Telescope help_tags ", "Help Page" }, + ["fo"] = { " Telescope oldfiles ", "Find Oldfiles" }, + ["fz"] = { " Telescope current_buffer_fuzzy_find ", "Find in Current Buffer" }, + + -- git + ["cm"] = { " Telescope git_commits ", "Git Commits" }, + ["gt"] = { " Telescope git_status ", "Git Status" }, + + -- pick a hidden term + ["pt"] = { " Telescope terms ", "Pick Hidden Term" }, + + -- theme switcher + ["th"] = { " Telescope themes ", "Nvchad Themes" }, + + ["ma"] = { " Telescope marks ", "Telescope Bookmarks" }, + }, +} + +M.nvterm = { + plugin = true, + + t = { + -- toggle in terminal mode + [""] = { + function() + require("nvterm.terminal").toggle "float" + end, + "Toggle Floating Term", + }, + + [""] = { + function() + require("nvterm.terminal").toggle "horizontal" + end, + "Toggle Horizontal Term", + }, + + [""] = { + function() + require("nvterm.terminal").toggle "vertical" + end, + "Toggle Vertical Term", + }, + }, + + n = { + -- toggle in normal mode + [""] = { + function() + require("nvterm.terminal").toggle "float" + end, + "Toggle Floating Term", + }, + + [""] = { + function() + require("nvterm.terminal").toggle "horizontal" + end, + "Toggle Horizontal Term", + }, + + [""] = { + function() + require("nvterm.terminal").toggle "vertical" + end, + "Toggle Vertical Term", + }, + + -- new + ["h"] = { + function() + require("nvterm.terminal").new "horizontal" + end, + "New Horizontal Term", + }, + + ["v"] = { + function() + require("nvterm.terminal").new "vertical" + end, + "New Vertical Term", + }, + }, +} + +M.whichkey = { + plugin = true, + + n = { + ["wK"] = { + function() + vim.cmd "WhichKey" + end, + "Which-key All Keymaps", + }, + ["wk"] = { + function() + local input = vim.fn.input "WhichKey: " + vim.cmd("WhichKey " .. input) + end, + "Which-key Query Lookup", + }, + }, +} + +M.blankline = { + plugin = true, + + n = { + ["cc"] = { + function() + local ok, start = require("indent_blankline.utils").get_current_context( + vim.g.indent_blankline_context_patterns, + vim.g.indent_blankline_use_treesitter_scope + ) + + if ok then + vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 }) + vim.cmd [[normal! _]] + end + end, + + "Jump To Current Context", + }, + }, +} + +M.gitsigns = { + plugin = true, + + n = { + -- Navigation through hunks + ["]c"] = { + function() + if vim.wo.diff then + return "]c" + end + vim.schedule(function() + require("gitsigns").next_hunk() + end) + return "" + end, + "Jump To Next Hunk", + opts = { expr = true }, + }, + + ["[c"] = { + function() + if vim.wo.diff then + return "[c" + end + vim.schedule(function() + require("gitsigns").prev_hunk() + end) + return "" + end, + "Jump To Prev Hunk", + opts = { expr = true }, + }, + + -- Actions + ["rh"] = { + function() + require("gitsigns").reset_hunk() + end, + "Reset Hunk", + }, + + ["ph"] = { + function() + require("gitsigns").preview_hunk() + end, + "Preview Hunk", + }, + + ["gb"] = { + function() + package.loaded.gitsigns.blame_line() + end, + "Blame Line", + }, + + ["td"] = { + function() + require("gitsigns").toggle_deleted() + end, + "Toggle Deleted", + }, + }, +} + +return M diff --git a/ar/.config/NvChad/lua/core/utils.lua b/ar/.config/NvChad/lua/core/utils.lua new file mode 100644 index 0000000..8b2a03d --- /dev/null +++ b/ar/.config/NvChad/lua/core/utils.lua @@ -0,0 +1,118 @@ +local M = {} +local merge_tb = vim.tbl_deep_extend + +M.load_config = function() + local config = require "core.default_config" + local chadrc_path = vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1] + + if chadrc_path then + local chadrc = dofile(chadrc_path) + + config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings) + config = merge_tb("force", config, chadrc) + config.mappings.disabled = nil + end + + return config +end + +M.remove_disabled_keys = function(chadrc_mappings, default_mappings) + if not chadrc_mappings then + return default_mappings + end + + -- store keys in a array with true value to compare + local keys_to_disable = {} + for _, mappings in pairs(chadrc_mappings) do + for mode, section_keys in pairs(mappings) do + if not keys_to_disable[mode] then + keys_to_disable[mode] = {} + end + section_keys = (type(section_keys) == "table" and section_keys) or {} + for k, _ in pairs(section_keys) do + keys_to_disable[mode][k] = true + end + end + end + + -- make a copy as we need to modify default_mappings + for section_name, section_mappings in pairs(default_mappings) do + for mode, mode_mappings in pairs(section_mappings) do + mode_mappings = (type(mode_mappings) == "table" and mode_mappings) or {} + for k, _ in pairs(mode_mappings) do + -- if key if found then remove from default_mappings + if keys_to_disable[mode] and keys_to_disable[mode][k] then + default_mappings[section_name][mode][k] = nil + end + end + end + end + + return default_mappings +end + +M.load_mappings = function(section, mapping_opt) + vim.schedule(function() + local function set_section_map(section_values) + if section_values.plugin then + return + end + + section_values.plugin = nil + + for mode, mode_values in pairs(section_values) do + local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {}) + for keybind, mapping_info in pairs(mode_values) do + -- merge default + user opts + local opts = merge_tb("force", default_opts, mapping_info.opts or {}) + + mapping_info.opts, opts.mode = nil, nil + opts.desc = mapping_info[2] + + vim.keymap.set(mode, keybind, mapping_info[1], opts) + end + end + end + + local mappings = require("core.utils").load_config().mappings + + if type(section) == "string" then + mappings[section]["plugin"] = nil + mappings = { mappings[section] } + end + + for _, sect in pairs(mappings) do + set_section_map(sect) + end + end) +end + +M.lazy_load = function(plugin) + vim.api.nvim_create_autocmd({ "BufRead", "BufWinEnter", "BufNewFile" }, { + group = vim.api.nvim_create_augroup("BeLazyOnFileOpen" .. plugin, {}), + callback = function() + local file = vim.fn.expand "%" + local condition = file ~= "NvimTree_1" and file ~= "[lazy]" and file ~= "" + + if condition then + vim.api.nvim_del_augroup_by_name("BeLazyOnFileOpen" .. plugin) + + -- dont defer for treesitter as it will show slow highlighting + -- This deferring only happens only when we do "nvim filename" + if plugin ~= "nvim-treesitter" then + vim.schedule(function() + require("lazy").load { plugins = plugin } + + if plugin == "nvim-lspconfig" then + vim.cmd "silent! do FileType" + end + end, 0) + else + require("lazy").load { plugins = plugin } + end + end + end, + }) +end + +return M diff --git a/ar/.config/NvChad/lua/custom/README.md b/ar/.config/NvChad/lua/custom/README.md new file mode 100644 index 0000000..0cc616c --- /dev/null +++ b/ar/.config/NvChad/lua/custom/README.md @@ -0,0 +1,3 @@ +# Example_config + +This can be used as an example custom config for NvChad. Do check the https://github.com/NvChad/nvcommunity diff --git a/ar/.config/NvChad/lua/custom/chadrc.lua b/ar/.config/NvChad/lua/custom/chadrc.lua new file mode 100644 index 0000000..598bc65 --- /dev/null +++ b/ar/.config/NvChad/lua/custom/chadrc.lua @@ -0,0 +1,54 @@ +---@type ChadrcConfig +local M = {} + +-- Path to overriding theme and highlights files +local highlights = require "custom.highlights" + +M.ui = { + -- theme + theme = "catppuccin", + theme_toggle = { "catppuccin", "everblush" }, + transparency = true, + + -- highlights + hl_override = highlights.override, + hl_add = highlights.add, + + -- Nvdash + nvdash = { + load_on_startup = false, + + header = { + " ", + " ██████╗ ██████╗ ██████╗ ███████ ", + " ██╔════╝██╔═══██╗██╔══██╗██╔════╝ ", + " ██║ ██║ ██║██║ ██║█████╗ ", + " ██║ ██║ ██║██║ ██║██╔══╝ ", + " ╚██████╗╚██████╔╝██████╔╝███████╗ ", + " ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝ ", + }, + + buttons = { + { "󰺯 Find File", "Spc f f", "Telescope find_files" }, + { "󱋡 Recent Files", "Spc f o", "Telescope oldfiles" }, + { "󱩾 Find Word", "Spc f w", "Telescope live_grep" }, + { "󰃀 Bookmarks", "Spc m a", "Telescope marks" }, + { "󰏘 Themes", "Spc t h", "Telescope themes" }, + { "󰌌 Mappings", "Spc c h", "NvCheatsheet" }, + }, + }, + + -- status line + statusline = { + theme = "minimal", + separator_style = "block", + overriden_modules = nil, + }, +} + +M.plugins = "custom.plugins" + +-- check core.mappings for table structure +M.mappings = require "custom.mappings" + +return M diff --git a/ar/.config/NvChad/lua/custom/configs/cell_marker.lua b/ar/.config/NvChad/lua/custom/configs/cell_marker.lua new file mode 100644 index 0000000..1d71dfb --- /dev/null +++ b/ar/.config/NvChad/lua/custom/configs/cell_marker.lua @@ -0,0 +1,159 @@ +local M = {} + +M.get_commenter = function() + local commenter = { python = "# ", lua = "-- ", julia = "# ", fennel = ";; ", scala = "// ", r = "# " } + local bufnr = vim.api.nvim_get_current_buf() + local ft = vim.api.nvim_buf_get_option(bufnr, "filetype") + if ft == nil or ft == "" then + return commenter["python"] + elseif commenter[ft] == nil then + return commenter["python"] + end + + return commenter[ft] +end + +local CELL_MARKER = M.get_commenter() .. "%%" +vim.api.nvim_set_hl(0, "CellMarkerHl", { default = true, bg = "#c5c5c5", fg = "#111111" }) + +M.miniai_spec = function(mode) + local start_line = vim.fn.search("^" .. CELL_MARKER, "bcnW") + + if start_line == 0 then + start_line = 1 + else + if mode == "i" then + start_line = start_line + 1 + end + end + + local end_line = vim.fn.search("^" .. CELL_MARKER, "nW") - 1 + if end_line == -1 then + end_line = vim.fn.line "$" + end + + local last_col = math.max(vim.fn.getline(end_line):len(), 1) + + local from = { line = start_line, col = 1 } + local to = { line = end_line, col = last_col } + + return { from = from, to = to } +end + +M.show_cell_markers = function() + require("mini.hipatterns").enable(0, { + highlighters = { + marker = { pattern = "^" .. M.get_commenter() .. "%%%%", group = "CellMarkerHl" }, + }, + }) +end + +M.select_cell = function() + local bufnr = vim.api.nvim_get_current_buf() + local current_row = vim.api.nvim_win_get_cursor(0)[1] + local current_col = vim.api.nvim_win_get_cursor(0)[2] + + local start_line = nil + local end_line = nil + + for line = current_row, 1, -1 do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:find("^" .. CELL_MARKER) then + start_line = line + break + end + end + local line_count = vim.api.nvim_buf_line_count(bufnr) + for line = current_row + 1, line_count do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:find("^" .. CELL_MARKER) then + end_line = line + break + end + end + + if not start_line then + start_line = 1 + end + if not end_line then + end_line = line_count + end + return current_row, current_col, start_line, end_line +end + +M.execute_cell = function() + local current_row, current_col, start_line, end_line = M.select_cell() + if start_line and end_line then + vim.fn.setpos("'<", { 0, start_line + 1, 0, 0 }) + vim.fn.setpos("'>", { 0, end_line - 1, 0, 0 }) + require("iron.core").visual_send() + vim.api.nvim_win_set_cursor(0, { current_row, current_col }) + end +end + +M.delete_cell = function() + local _, _, start_line, end_line = M.select_cell() + if start_line and end_line then + local rows_to_select = end_line - start_line - 1 + vim.api.nvim_win_set_cursor(0, { start_line, 0 }) + vim.cmd("normal!V " .. rows_to_select .. "j") + vim.cmd "normal!d" + vim.cmd "normal!k" + end +end + +M.navigate_cell = function(up) + local is_up = up or false + local _, _, start_line, end_line = M.select_cell() + if is_up and start_line ~= 1 then + vim.api.nvim_win_set_cursor(0, { start_line - 1, 0 }) + elseif end_line then + local bufnr = vim.api.nvim_get_current_buf() + local line_count = vim.api.nvim_buf_line_count(bufnr) + if end_line ~= line_count then + vim.api.nvim_win_set_cursor(0, { end_line + 1, 0 }) + _, _, start_line, end_line = M.select_cell() + vim.api.nvim_win_set_cursor(0, { end_line - 1, 0 }) + end + end +end + +M.move_cell = function(dir) + local search_res + local result + if dir == "d" then + search_res = vim.fn.search("^" .. CELL_MARKER, "W") + if search_res == 0 then + result = "last" + end + else + search_res = vim.fn.search("^" .. CELL_MARKER, "bW") + if search_res == 0 then + result = "first" + vim.api.nvim_win_set_cursor(0, { 1, 0 }) + end + end + + return result +end + +M.insert_cell_before = function(content) + content = content or CELL_MARKER + local cell_object = M.miniai_spec "a" + vim.api.nvim_buf_set_lines(0, cell_object.from.line - 1, cell_object.from.line - 1, false, { content, "" }) + M.move_cell "u" +end + +M.insert_cell_after = function(content) + content = content or CELL_MARKER + vim.print(content) + local cell_object = M.miniai_spec "a" + vim.api.nvim_buf_set_lines(0, cell_object.to.line, cell_object.to.line, false, { content, "" }) + M.move_cell "d" +end + +M.insert_markdown_cell = function() + M.insert_cell_after(CELL_MARKER .. " [markdown]") +end + +return M diff --git a/ar/.config/NvChad/lua/custom/configs/dadbod.lua b/ar/.config/NvChad/lua/custom/configs/dadbod.lua new file mode 100644 index 0000000..90c13fb --- /dev/null +++ b/ar/.config/NvChad/lua/custom/configs/dadbod.lua @@ -0,0 +1,29 @@ +local M = {} + +local function db_completion() + require("cmp").setup.buffer { sources = { { name = "vim-dadbod-completion" } } } +end + +function M.setup() + vim.g.db_ui_save_location = vim.fn.stdpath "config" .. require("plenary.path").path.sep .. "db_ui" + + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "sql", + }, + command = [[setlocal omnifunc=vim_dadbod_completion#omni]], + }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "sql", + "mysql", + "plsql", + }, + callback = function() + vim.schedule(db_completion) + end, + }) +end + +return M diff --git a/ar/.config/NvChad/lua/custom/configs/lspconfig.lua b/ar/.config/NvChad/lua/custom/configs/lspconfig.lua new file mode 100644 index 0000000..c4fd1db --- /dev/null +++ b/ar/.config/NvChad/lua/custom/configs/lspconfig.lua @@ -0,0 +1,71 @@ +local on_attach = require("plugins.configs.lspconfig").on_attach +local capabilities = require("plugins.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" + +-- if you just want default config for the servers then put them in a table +local servers = { "clangd", "cssls", "emmet_language_server", "html", "julials", "sqlls", "tsserver" } + +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + capabilities = capabilities, + } +end + +-- +-- lspconfig.pyright.setup { blabla} +local on_attach_qmd = function(client, bufnr) + local function buf_set_keymap(...) + vim.api.nvim_buf_set_keymap(bufnr, ...) + end + local function buf_set_option(...) + vim.api.nvim_buf_set_option(bufnr, ...) + end + + buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") + local opts = { noremap = true, silent = true } +end + +local lsp_flags = { + allow_incremental_sync = true, + debounce_text_changes = 150, +} + +local cmp_nvim_lsp = require "cmp_nvim_lsp" +local util = require "lspconfig.util" + +lspconfig.marksman.setup { + on_attach = on_attach_qmd, + capabilities = capabilities, + filetypes = { "markdown", "quarto" }, + root_dir = util.root_pattern(".git", ".marksman.toml", "_quarto.yml"), +} + +-- lspconfig.r_language_server.setup { +-- on_attach = on_attach, +-- capabilities = capabilities, +-- flags = lsp_flags, +-- settings = { +-- r = { +-- lsp = { +-- rich_documentation = false, +-- }, +-- }, +-- }, +-- } + +lspconfig.yamlls.setup { + on_attach = on_attach, + capabilities = capabilities, + flags = lsp_flags, + settings = { + yaml = { + schemas = { + -- add custom schemas here + -- e.g. + ["https://raw.githubusercontent.com/hits-mbm-dev/kimmdy/main/src/kimmdy/kimmdy-yaml-schema.json"] = "kimmdy.yml", + }, + }, + }, +} diff --git a/ar/.config/NvChad/lua/custom/configs/null-ls.lua b/ar/.config/NvChad/lua/custom/configs/null-ls.lua new file mode 100644 index 0000000..d703736 --- /dev/null +++ b/ar/.config/NvChad/lua/custom/configs/null-ls.lua @@ -0,0 +1,45 @@ +local null_ls = require "null-ls" +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + +local b = null_ls.builtins + +local sources = { + -- cpp + b.formatting.clang_format, + + -- Lua + b.formatting.stylua, + + -- python + b.code_actions.refactoring, + b.diagnostics.mypy, + b.diagnostics.ruff, + b.diagnostics.vulture, + b.formatting.black, + -- b.formatting.pyflyby, + -- b.formatting.reorder_python_imports, + + -- webdev stuff + b.formatting.deno_fmt, -- choosed deno for ts/js files cuz its very fast! + b.formatting.prettier.with { filetypes = { "html", "markdown", "css" } }, -- so prettier works only on these filetypes +} + +null_ls.setup { + debug = true, + sources = sources, + on_attach = function(client, bufnr) + if client.supports_method "textDocument/formatting" then + vim.api.nvim_clear_autocmds { + group = augroup, + buffer = bufnr, + } + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format { bufnr = bufnr } + end, + }) + end + end, +} diff --git a/ar/.config/NvChad/lua/custom/configs/overrides.lua b/ar/.config/NvChad/lua/custom/configs/overrides.lua new file mode 100644 index 0000000..13a0aa1 --- /dev/null +++ b/ar/.config/NvChad/lua/custom/configs/overrides.lua @@ -0,0 +1,247 @@ +local M = {} + +M.blankline = { + -- show_trailing_blankline_indent = true, + -- show_first_indent_level = true, + context_patterns = { + "block", + "else_clause", + "catch_clause", + "class", + "function", + "import_statement", + "jsx_element", + "jsx_self_closing_element", + "method", + "return", + "try_statement", + "^for", + "^if", + "^object", + "^table", + "^while", + }, +} + +M.treesitter = { + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + "nvim-treesitter/nvim-treesitter-context", + }, + + ensure_installed = { + "bash", + "c", + "css", + "html", + "javascript", + "julia", + "latex", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + -- "r", + "scala", + "tsx", + "typescript", + "vim", + "vimdoc", + "yaml", + }, + + highlight = { enable = true }, + + indent = { + enable = true, + -- disable = { + -- "python" + -- }, + }, +} + +M.mason = { + ensure_installed = { + -- c/cpp stuff + "clangd", + "clang-format", + + -- julia + "julia-lsp", + + -- lua stuff + "lua-language-server", + "stylua", + + -- markdown + "markdownlint", + "markdown-toc", + "marksman", + + -- -- python + "black", + "debugpy", + "mypy", + "ruff", + "pyright", + "vulture", + + -- R + -- "r-languageserver", + + -- -- solidity + -- "solidity", + + -- SQL + "sqlls", + "sqlfluff", + "sql-formatter", + + -- web dev stuff + "css-lsp", + "html-lsp", + "typescript-language-server", + "deno", + "prettier", + }, +} + +-- git support in nvimtree +M.nvimtree = { + git = { + enable = true, + }, + + renderer = { + highlight_git = true, + icons = { + show = { + git = true, + }, + }, + }, +} + +M.cmp = { + branch = "main", + dependencies = { + "hrsh7th/cmp-nvim-lsp-signature-help", + "hrsh7th/cmp-calc", + "hrsh7th/cmp-emoji", + "f3fora/cmp-spell", + "ray-x/cmp-treesitter", + "kdheepak/cmp-latex-symbols", + "jmbuhr/cmp-pandoc-references", + "rafamadriz/friendly-snippets", + "onsails/lspkind-nvim", + }, + config = function() + local cmp = require "cmp" + local luasnip = require "luasnip" + local lspkind = require "lspkind" + lspkind.init() + + local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil + end + + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = { + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping(function(fallback) + if luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm { + select = true, + }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { "i", "s" }), + }, + autocomplete = false, + formatting = { + format = lspkind.cmp_format { + with_text = true, + menu = { + otter = "[🦦]", + nvim_lsp = "[LSP]", + luasnip = "[snip]", + buffer = "[buf]", + path = "[path]", + spell = "[spell]", + pandoc_references = "[ref]", + tags = "[tag]", + treesitter = "[TS]", + calc = "[calc]", + latex_symbols = "[tex]", + emoji = "[emoji]", + }, + }, + }, + sources = { + { name = "otter" }, -- for code chunks in quarto + { name = "path" }, + { name = "nvim_lsp" }, + { name = "nvim_lsp_signature_help" }, + { name = "luasnip", keyword_length = 3, max_item_count = 3 }, + { name = "pandoc_references" }, + { name = "buffer", keyword_length = 5, max_item_count = 3 }, + { name = "spell" }, + { name = "treesitter", keyword_length = 5, max_item_count = 3 }, + { name = "calc" }, + { name = "latex_symbols" }, + { name = "emoji" }, + }, + view = { + entries = "native", + }, + window = { + documentation = { + border = require("misc.style").border, + }, + }, + } + + -- for friendly snippets + require("luasnip.loaders.from_vscode").lazy_load() + -- for custom snippets + require("luasnip.loaders.from_vscode").lazy_load { paths = { vim.fn.stdpath "config" .. "/snips" } } + -- link quarto and rmarkdown to markdown snippets + luasnip.filetype_extend("quarto", { "markdown" }) + luasnip.filetype_extend("rmarkdown", { "markdown" }) + end, +} + +return M diff --git a/ar/.config/NvChad/lua/custom/highlights.lua b/ar/.config/NvChad/lua/custom/highlights.lua new file mode 100644 index 0000000..efe8be1 --- /dev/null +++ b/ar/.config/NvChad/lua/custom/highlights.lua @@ -0,0 +1,21 @@ +-- To find any highlight groups: " Telescope highlights" +-- Each highlight group can take a table with variables fg, bg, bold, italic, etc +-- base30 variable names can also be used as colors + +local M = {} + +---@type Base46HLGroupsList +M.override = { + Comment = { + italic = true, + }, +} + +---@type HLTable +M.add = { + NvimTreeOpenedFolderName = { fg = "green", bold = true }, + HarpoonHl = { fg = "cyan", bg = "statusline_bg" }, + HarpoonBorder = { fg = "cyan" }, +} + +return M diff --git a/ar/.config/NvChad/lua/custom/init.lua b/ar/.config/NvChad/lua/custom/init.lua new file mode 100644 index 0000000..3dea148 --- /dev/null +++ b/ar/.config/NvChad/lua/custom/init.lua @@ -0,0 +1,55 @@ +-- local autocmd = vim.api.nvim_create_autocmd + +-- Auto resize panes when resizing nvim window +-- autocmd("VimResized", { +-- pattern = "*", +-- command = "tabdo wincmd =", +-- }) + +-- Visual Studio Code +if vim.g.vscode then + -- Plug 'asvetliakov/vim-easymotion', has('nvim') ? {} : { 'on': [] } + vim.cmd [[source $HOME/.config/nvim/vscode/settings.vim]] + vim.cmd [[source $HOME/.config/nvim/vscode/easymotion-config.vim]] +end + +vim.g.python3_host_prog = "/usr/bin/python3" +-- vim.g.loaded_python3_provider = 1 + +local opt = vim.opt +local api = vim.api + +-- Background +-- opt.background = "dark" + +-- Backspace +opt.backspace = "indent,eol,start" + +-- Clipboard +opt.clipboard:append "unnamedplus" + +-- Column +opt.colorcolumn = "110" + +-- Disable persistent undo for files in /private directory +api.nvim_create_autocmd("BufReadPre", { pattern = "/private/*", command = "set noundofile" }) + +-- Indenting +opt.autoindent = true + +-- line numbers +opt.number = true -- shows absolute line number on cursor line (when relative number is on)local +opt.relativenumber = true -- show relative line numbers +opt.scrolloff = 9 + +-- Swap file disable +opt.swapfile = false + +-- Words +-- opt.iskeyword:append "-" -- consider string-string as whole word + +-- Wrap +opt.wrap = false + +-- Undo persistent enable for other files +opt.undofile = true diff --git a/ar/.config/NvChad/lua/custom/mappings.lua b/ar/.config/NvChad/lua/custom/mappings.lua new file mode 100644 index 0000000..6ae8646 --- /dev/null +++ b/ar/.config/NvChad/lua/custom/mappings.lua @@ -0,0 +1,740 @@ +---@type MappingsTable +local M = {} +local opts = { noremap = false, expr = true, buffer = true } + +M.disabled = { + n = { + [""] = "", + [""] = "", + [""] = "", + [""] = "", + ["b"] = "", + ["ca"] = "", + ["fm"] = "", + ["n"] = "", + ["rn"] = "", + ["td"] = "", + [""] = "", + [""] = "", + }, + + t = { + [""] = "", + }, +} + +M.general = { + i = { + -- ESC + ["jk"] = { "", "Exit Insert Mode" }, + + -- Navigation + [""] = { "^i", "Beginning Of Line" }, + + -- Lines + [""] = { "o", "Next Line", opts = { nowait = true } }, + [""] = { "O", "Previous Line", opts = { nowait = true } }, + ["ln"] = { " set nu! ", "Toggle Line Number" }, + ["lrn"] = { " set rnu! ", "Toggle Relative Number" }, + }, + + n = { + -- General + [""] = { ":", "Enter Command Mode", opts = { nowait = true } }, + -- ["x"] = { "_x", "No Register x" }, + ["Q"] = { "", "Nothing" }, + + -- Copy & Paste + ["cpa"] = { " %y+ ", "Copy Whole File" }, + ["y"] = { '"+y', "yank in Vim" }, + ["Y"] = { '"+Y', "Yank in Clipboard" }, + -- ["s"] = { [[:%s/\<\>//gI]], "Replace char on cursor" }, + + -- Formatting + ["lfm"] = { + function() + vim.lsp.buf.format { async = true } + end, + "LSP Formatting", + }, + + -- Line + -- [""] = { "o", "Blank line after", opts = { nowait = true } }, + -- [""] = { "O", "Blank line before", opts = { nowait = true } }, + + -- Navigation + ["J"] = { "mzJ`z", "Join A Line To Pre-line" }, + ["n"] = { "nzzzv", "Down Search with Mid Cursor" }, + ["N"] = { "Nzzzv", "Up Search with Mid Cursor" }, + [""] = { "zz", "Jump 1/2 Page with Mid Cursor" }, + [""] = { "zz", "Up 1/2 Page with Mid Cursor" }, + [""] = { "zz", "Page Down with Mid Cursor" }, + [""] = { "zz", "Page Up with Mid Cursor" }, + -- [""] = { "cnextzz", "reset cursor" }, + -- [""] = { "cprevzz", "reset cursor" }, + [""] = { " TmuxNavigateLeft ", "Window Left" }, + [""] = { " TmuxNavigateRight ", "Window Right" }, + [""] = { " TmuxNavigateDown ", "Window Down" }, + [""] = { " TmuxNavigateUp ", "Window Up" }, + ["tg"] = { + function() + require("base46").toggle_theme() + end, + "Theme Toggle", + }, + + -- New Buffer + ["bf"] = { " enew ", "New Buffer" }, + + -- Split + ["sv"] = { "v", "Split Vertically" }, + ["sh"] = { "h", "Split Horizontally" }, + ["se"] = { "=", "Equal Width" }, + ["sx"] = { " close ", "Close Split Window" }, + }, + v = { + [";"] = { ":", "Enter Command Mode", opts = { nowait = true } }, + [">"] = { ">gv", "Indent" }, + [""] = { " ", "Exit Visual Mode" }, + ["J"] = { ":m '>+1gv=gv", "Move A Line To Bottom" }, + ["K"] = { ":m '<-2gv=gv", "Move A Line To Up" }, + ["y"] = { '"+y', "yank in Vim" }, + }, +} + +-- more keybinds! +M.browse = { + n = { + ["bs"] = { + function() + require("browse").input_search() + end, + "Search Bookmarks", + }, + + ["bm"] = { + function() + require("browse").open_bookmarks() + end, + "Browse Bookmarks", + }, + + ["bb"] = { + function() + require("browse").browse() + end, + "Browse Bookmarks", + }, + + ["bd"] = { + function() + require("browse.devdocs").search() + end, + "Search Devdocs", + }, + + ["bn"] = { + function() + require("browse.mdn").search() + end, + "Search MDN", + }, + }, +} + +M.chatgpt = { + n = { + ["cg"] = { " ChatGPT ", "ChatGPT" }, + ["cgc"] = { " ChatGPTCompleteCode ", "ChatGPT Complete Code" }, + ["cgt"] = { " ChatGPTRun add_tests ", "ChatGPT Add Test" }, + ["cgf"] = { " ChatGPTRun fix_bugs ", "ChatGPT Fix Bugs" }, + ["cga"] = { " ChatGPTActAs ", "ChatGPT Act As" }, + ["cgi"] = { " ChatGPTEditWithInstructions ", "ChatGPT Edit" }, + }, + + v = { + ["cge"] = { " ChatGPTRun explain_code ", "ChatGPT Explain Code" }, + }, +} + +M.dadbod = { + n = { + ["db"] = { " DBUI ", "DB UI" }, + ["du"] = { " DBUIToggle ", "Toggle UI" }, + ["da"] = { " DBUIAddConnection ", "Add Connection" }, + ["df"] = { " DBUIFindBuffer ", "Find buffer" }, + ["dr"] = { " DBUIRenameBuffer ", "Rename buffer" }, + ["dl"] = { " DBUILastQueryInfo ", "Last query info" }, + }, +} + +M.gitsigns = { + n = { + ["gd"] = { + function() + require("gitsigns").toggle_deleted() + end, + "Toggle Deleted", + }, + }, +} + +M.harpoon = { + n = { + ["a"] = { + function() + require("harpoon.mark").add_file() + end, + "Harpoon Add File", + }, + ["ta"] = { " Telescope harpoon marks ", "Toggle Quick Menu" }, + [""] = { + function() + require("harpoon.ui").toggle_quick_menu() + end, + "Harpoon Menu", + }, + ["1"] = { + function() + require("harpoon.ui").nav_file(1) + end, + "Navigate to File 1", + }, + ["2"] = { + function() + require("harpoon.ui").nav_file(2) + end, + "Navigate to File 2", + }, + ["3"] = { + function() + require("harpoon.ui").nav_file(3) + end, + "Navigate to File 3", + }, + ["4"] = { + function() + require("harpoon.ui").nav_file(4) + end, + "Navigate to File 4", + }, + }, +} + +M.iron = { + n = { + ["ir"] = { " IronRepl ", "REPL" }, + ["iS"] = { " IronRestart ", "Restart" }, + ["iF"] = { " IronFocus ", "Focus" }, + ["iH"] = { " IronHide ", "Hide" }, + ["ism"] = { + function() + require("iron.core").run_motion "send_motion" + end, + "Send Motion", + }, + ["isl"] = { + function() + require("iron.core").send_line() + end, + "Send Line", + }, + ["ist"] = { + function() + require("iron.core").send_until_cursor() + end, + "Send Until Cursor", + }, + ["isf"] = { + function() + require("iron.core").send_file() + end, + "Send File", + }, + ["i"] = { + function() + require("iron.core").send(nil, string.char(13)) + end, + "ENTER", + }, + ["ii"] = { + function() + require("iron.core").send(nil, string.char(03)) + end, + "Interrupt", + }, + ["id"] = { + function() + require("iron.core").close_repl() + end, + "Close REPL", + }, + ["ic"] = { + function() + require("iron.core").send(nil, string.char(12)) + end, + "Clear", + }, + ["ims"] = { + function() + require("iron.core").send_mark() + end, + "Send Mark", + }, + ["imm"] = { + function() + require("iron.core").run_motion "mark_motion" + end, + "Mark Motion", + }, + ["imr"] = { + function() + require("iron.marks").drop_last() + end, + "Remove Mark", + }, + -- ["iar"] = { + -- function() end, + -- "+ REPL", + -- }, + -- ["iam"] = { + -- function() end, + -- "+ Mark", + -- }, + + -- cell + ["ca"] = { + function() + require("custom.configs.cell_marker").insert_cell_after() + end, + "Insert Cell After", + }, + ["cb"] = { + function() + require("custom.configs.cell_marker").insert_cell_before() + end, + "Insert Cell Before", + }, + ["cm"] = { + function() + require("custom.configs.cell_marker").insert_markdown_cell() + end, + "Insert Markdown Cell", + }, + ["cd"] = { + function() + require("custom.configs.cell_marker").delete_cell() + end, + "Delete Cell", + }, + ["cj"] = { + function() + require("custom.configs.cell_marker").navigate_cell() + end, + "Next Cell", + }, + ["ck"] = { + function() + require("custom.configs.cell_marker").navigate_cell(true) + end, + "Previous Cell", + }, + ["cr"] = { + function() + require("custom.configs.cell_marker").execute_cell() + end, + "Cell Run", + }, + }, + + v = { + ["ihc"] = { + function() + require("iron.marks").clear_hl() + end, + "Clear Highlight", + }, + ["imv"] = { + function() + require("iron.core").mark_visual() + end, + "Mark Visual", + }, + ["is"] = { + function() + require("iron.core").visual_send() + end, + "Send", + }, + }, +} + +M.lspconfig = { + v = { + ["ca"] = { + function() + vim.lsp.buf.code_action() + end, + "LSP code action", + }, + }, +} + +M.markdown = { + n = { + ["mp"] = { " MarkdownPreview ", "Markdown Preview" }, + ["ms"] = { " MarkdownPreviewStop ", "Markdown Stop" }, + ["mt"] = { " MarkdownPreviewToggle ", "Markdown Toggle" }, + }, +} + +M.media = { + n = { + ["fm"] = { " Telescope media_files ", "Media Files" }, + }, +} + +M.nvterm = { + t = { + [""] = { + function() + require("nvterm.terminal").toggle "float" + end, + "Toggle Floating Term", + }, + }, +} + +M.playground = { + n = { + ["pg"] = { " TSPlaygroundToggle ", "Toggle Playground" }, + ["pc"] = { " TSHighlightCapturesUnderCurso ", "Highlight Captures" }, + ["pn"] = { " TSNodeUnderCursor ", "Node Under Cursor" }, + }, +} + +M.portal = { + n = { + ["pj"] = { " Portal jumplist backward ", "Portal Jumplist" }, + ["ph"] = { + function() + require("portal.builtin").harpoon.tunnel() + end, + "Portal Harpoon", + }, + }, +} + +M.project = { + n = { + ["fp"] = { " Telescope projects ", "Find Project" }, + }, +} + +M.refactoring = { + n = { + -- refactoring + ["ri"] = { " Refactor inline_var ", "Refactor Inline Var" }, + ["rI"] = { " Refactor inline_func ", "Refactor Inline Function" }, + + ["rb"] = { " Refactor extract_block ", "Refactor Extract Block" }, + ["rbf"] = { " Refactor extract_block_to_file ", "Refactor Extrack Block To File" }, + }, + + x = { + -- copy & paste + -- ["p"] = { '"_dp', "preserve cut" }, + + -- refactoring + ["re"] = { " Refactor extract ", "Refactor Extract" }, + ["rf"] = { " Refactor extract_to_file ", "Refactor Extract To File" }, + ["rv"] = { " Refactor extract_var ", "Refactor Extract Var" }, + ["ri"] = { " Refactor inline_var ", "Refactor Inline Var" }, + }, +} + +M.sniprun = { + n = { + ["sr"] = { + "lua require('sniprun').run()", + "Run Code", + }, + + ["ss"] = { + "lua require('sniprun').reset()", + "Reset Code", + }, + + ["sc"] = { + "lua require('sniprun').clear_repl()", + "Clean Repl Meomory", + }, + + ["sd"] = { + "lua require('sniprun.display').close_all()", + "Close Display", + }, + }, + + v = { + [""] = { + "lua require('sniprun').run('v')", + "Run Code", + }, + }, +} + +M.tagbar = { + n = { + ["tb"] = { " TagbarToggle ", "Toggle Tagbar" }, + }, +} + +M.telescope = { + n = { + ["u"] = { + function() + require("telescope").extensions.undo.undo() + end, + "Undo Tree", + }, + + ["fc"] = { " Telescope frecency ", "Frequent Files" }, + }, +} + +M.todo = { + n = { + ["tdo"] = { " Todo ", "Todo" }, + ["tds"] = { " TodoTelescope ", "Todo Telescope" }, + ["tdt"] = { " TodoTrouble ", "Todo Trouble" }, + ["tdl"] = { " TodoLocList ", "Todo Loclist" }, + ["tdf"] = { " TodoQuickFix ", "Todo Fix" }, + }, +} + +M.treesitter = { + n = { + -- ["tc"] = { " TSContextEnable ", "Toggle treesitter context" }, + ["gc"] = { + function() + require("treesitter-context").go_to_context() + end, + "Go To Context", + }, + }, +} + +M.trouble = { + n = { + ["trb"] = { + function() + require("trouble").toggle() + end, + "Trouble", + }, + ["trw"] = { + function() + require("trouble").toggle "workspace_diagnostics" + end, + "Trouble Workspace Diagnostics", + }, + ["trd"] = { + function() + require("trouble").toggle "document_diagnostics" + end, + "Trouble Document Diagnostics", + }, + ["trq"] = { + function() + require("trouble").toggle "quickfix" + end, + "Trouble Quickfix", + }, + ["trl"] = { + function() + require("trouble").toggle "loclist" + end, + "Trouble Loclist", + }, + ["gR"] = { + function() + require("trouble").toggle "lsp_references" + end, + "Trouble Lsp References", + }, + ["trc"] = { + function() + require("trouble").close() + end, + "Trouble Close", + }, + ["tro"] = { + function() + require("trouble").next { skip_groups = true, jump = true } + end, + "Trouble Next", + }, + ["tri"] = { + function() + require("trouble").previous { skip_groups = true, jump = true } + end, + "Trouble Previous", + }, + ["trf"] = { + function() + require("trouble").first { skip_groups = true, jump = true } + end, + "Trouble First", + }, + ["tre"] = { + function() + require("trouble").last { skip_groups = true, jump = true } + end, + "Trouble Last", + }, + -- ["trt"] = { + -- function() + -- require("trouble.providers.telescope").open_with_trouble() + -- end, + -- "Trouble Telescope", + -- }, + }, +} + +M.obsidian = { + i = { + ["gf"] = { + function() + require("obsidian").util.gf_passthrough() + end, + "gf", + opts, + }, + }, + + n = { + ["gf"] = { + function() + require("obsidian").util.gf_passthrough() + end, + "gf", + opts, + }, + ["op"] = { + function() + local query = vim.fn.input "Enter query: " + if query and #query > 0 then + vim.cmd("ObsidianOpen " .. query) + end + end, + "Open Notes", + }, + ["on"] = { + function() + local title = vim.fn.input "Enter title: " + if title and #title > 0 then + vim.cmd("ObsidianNew " .. title) + end + end, + "New Notes", + }, + ["ot"] = { + function() + local offset = vim.fn.input "Enter offset: " + if offset and #offset > 0 then + vim.cmd("ObsidianToday " .. offset) + else + vim.cmd "ObsidianToday" + end + end, + "Today Note", + }, + ["of"] = { + function() + local note = vim.fn.input "Enter note: " + if note and #note > 0 then + vim.cmd("ObsidianSearch " .. note) + end + end, + "Search Note", + }, + ["ow"] = { + function() + local name = vim.fn.input "Enter name: " + if name and #name > 0 then + vim.cmd("ObsidianWorkspace " .. name) + end + end, + "Workspace Name", + }, + ["oi"] = { + function() + local image = vim.fn.input "Enter image: " + if image and #image > 0 then + vim.cmd("ObsidianPasteImg " .. image) + end + end, + "Paste Image", + }, + ["or"] = { + function() + local name = vim.fn.input "Enter name: " + if name and #name > 0 then + vim.cmd("ObsidianRename " .. name) + end + end, + "Rename", + }, + ["o["] = { " ObsidianBacklinks ", "Back Link" }, + ["o]"] = { " ObsidianFollowLink ", "Follow Link" }, + ["os"] = { " ObsidianQuickSwitch ", "Quick Switch" }, + ["ol"] = { " ObsidianTomorrow ", "Tomorrow Note" }, + ["oh"] = { " ObsidianYesterday ", "Yesterday Note" }, + }, + + v = { + ["ol"] = { + function() + local query = vim.fn.input "Enter query: " + if query and #query > 0 then + vim.cmd("ObsidianLink " .. query) + else + vim.cmd "ObsidianLink" + end + end, + "Link Query", + }, + ["on"] = { + function() + local note = vim.fn.input "Enter note: " + if note and #note > 0 then + vim.cmd("ObsidianLinkNew " .. note) + else + vim.cmd "ObsidianLinkNew" + end + end, + "New Link Note", + }, + }, +} + +M.tabufline = { + n = { + ["L"] = { + function() + require("nvchad.tabufline").tabuflineNext() + end, + "Goto next buffer", + }, + + ["H"] = { + function() + require("nvchad.tabufline").tabuflinePrev() + end, + "Goto prev buffer", + }, + }, +} + +return M diff --git a/ar/.config/NvChad/lua/custom/plugins.lua b/ar/.config/NvChad/lua/custom/plugins.lua new file mode 100644 index 0000000..38a8880 --- /dev/null +++ b/ar/.config/NvChad/lua/custom/plugins.lua @@ -0,0 +1,862 @@ +local overrides = require "custom.configs.overrides" + +---@type NvPluginSpec[] +local plugins = { + + -- Override plugin definition options + + { + "neovim/nvim-lspconfig", + dependencies = { + -- format & linting + { + "jose-elias-alvarez/null-ls.nvim", + config = function() + require "custom.configs.null-ls" + end, + }, + }, + config = function() + require "plugins.configs.lspconfig" + require "custom.configs.lspconfig" + end, -- Override to setup mason-lspconfig + }, + + -- override plugin configs + { + "lukas-reineke/indent-blankline.nvim", + opts = overrides.blankline, + }, + { + "williamboman/mason.nvim", + opts = overrides.mason, + }, + + { + "nvim-treesitter/nvim-treesitter", + opts = overrides.treesitter, + }, + + { + "nvim-tree/nvim-tree.lua", + opts = overrides.nvimtree, + }, + + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-calc", + "hrsh7th/cmp-cmdline", + "rafamadriz/friendly-snippets", + "honza/vim-snippets", + "jmbuhr/otter.nvim", + }, + opts = function(_, opts) + -- -@param opts cmp.ConfigSchema + local cmp = require "cmp" + opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "otter" } })) + end, + }, + + ---------------------- + -- Install a plugin + ---------------------- + + -- better-escape + { + "max397574/better-escape.nvim", + event = "InsertEnter", + config = function() + require("better_escape").setup() + end, + }, + + -- better quick fix + { + "kevinhwang91/nvim-bqf", + config = function() + require("bqf").setup() + end, + }, + + -- browse + { + "lalitmee/browse.nvim", + dependencies = { "nvim-telescope/telescope.nvim" }, + config = function() + require("browse").setup { + -- search provider you want to use + provider = "google", -- duckduckgo, bing + + -- either pass it here or just pass the table to the functions + -- see below for more + bookmarks = { + ["github"] = { + ["name"] = "search github from neovim", + ["code_search"] = "https://github.com/search?q=%s&type=code", + ["repo_search"] = "https://github.com/search?q=%s&type=repositories", + ["issues_search"] = "https://github.com/search?q=%s&type=issues", + ["pulls_search"] = "https://github.com/search?q=%s&type=pullrequests", + }, + }, + } + end, + }, + + -- bullets + { + "dkarter/bullets.vim", + }, + + -- chafa + { + "princejoogie/chafa.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "m00qek/baleia.nvim", + }, + cmd = "ViewImage", + config = function() + require("chafa").setup { + render = { + min_padding = 5, + show_label = true, + }, + events = { + update_on_nvim_resize = true, + }, + } + end, + }, + + -- chatGPT + { + "dreamsofcode-io/ChatGPT.nvim", + event = "VeryLazy", + dependencies = { + "MunifTanjim/nui.nvim", + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + }, + config = function() + require("chatgpt").setup { + async_api_key_cmd = "pass show api/chatGPT/nvim", + } + end, + }, + + -- cinnamon + { + "declancm/cinnamon.nvim", + config = function() + require("cinnamon").setup() + end, + }, + + -- diff + { + "sindrets/diffview.nvim", + dependencies = "nvim-lua/plenary.nvim", + }, + + -- doge + { + "kkoomen/vim-doge", + }, + + -- fzf + { + "junegunn/fzf", + }, + + -- hardhat-vscode + { + "NomicFoundation/hardhat-vscode", + }, + + -- harpoon + { + "ThePrimeagen/harpoon", + cmd = "Harpoon", + }, + + -- hologram + { + "edluffy/hologram.nvim", + config = function() + require("hologram").setup { + auto_display = true, + } + end, + }, + + -- impatient + { + "lewis6991/impatient.nvim", + config = function() + require "impatient" + end, + }, + + -- iron + { + "hkupty/iron.nvim", + event = "VeryLazy", + opts = function() + return { + config = { + scratch_repl = true, + repl_definition = { + sh = { command = { "zsh" } }, + python = require("iron.fts.python").ipython, + }, + repl_open_cmd = require("iron.view").right "40%", + }, + highlight = { + italic = true, + }, + ignore_blank_lines = true, -- ignore blank lines when sending visual select lines + } + end, + config = function(_, opts) + local iron = require "iron.core" + iron.setup(opts) + end, + }, + + -- glow + { + "ellisonleao/glow.nvim", + config = true, + cmd = "Glow", + }, + + -- -- jukit + -- { + -- "luk400/vim-jukit", + -- config = function() + -- require("jukit").setup() + -- -- vim.cmd "source /Users/si/.local/nvim/lazy/vim-jukit/autoload/jukit.vim" + -- end, + -- }, + + -- jupytext + { + "GCBallesteros/jupytext.nvim", + config = true, + lazy = false, + -- event = "VeryLazy", + }, + + -- jupytext + { + "goerz/jupytext.vim", + build = "pip3 install jupytext", + -- lazy = false, + event = "VeryLazy", + dependencies = { "neovim/nvim-lspconfig" }, + opts = {}, + config = function() + vim.g.jupytext_fmt = "py:percent" + + -- Autocmd to set cell markers + vim.api.nvim_create_autocmd({ "BufEnter" }, { -- "BufWriteCmd" + group = vim.api.nvim_create_augroup("au_show_cell_markers", { clear = true }), + pattern = { "*.py", "*.r", "*.ipynb", "*.jl", "*.scala", "*.lua", "*.fnl" }, + callback = function(event) + require("custom.configs.cell_marker").show_cell_markers() + end, + }) + end, + }, + + -- latex + { + "lervag/vimtex", + ft = { "tex" }, + opts = { patterns = { "*.tex" } }, + config = function(_, opts) + vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = opts.patterns, + callback = function() + vim.cmd [[VimtexCompile]] + end, + }) + + -- Live compilation + vim.g.vimtex_compiler_latexmk = { + build_dir = ".out", + options = { + "-shell-escape", + "-verbose", + "-file-line-error", + "-interaction=nonstopmode", + "-synctex=1", + }, + } + vim.g.vimtex_view_method = "zathura" + vim.g.vimtex_fold_enabled = true + vim.g.vimtex_syntax_conceal = { + accents = 1, + ligatures = 1, + cites = 1, + fancy = 1, + spacing = 0, -- default: 1 + greek = 1, + math_bounds = 1, + math_delimiters = 1, + math_fracs = 1, + math_super_sub = 1, + math_symbols = 1, + sections = 0, + styles = 1, + } + end, + }, + + -- leap + { + "ggandor/leap.nvim", + config = function() + require("leap").add_default_mappings() + end, + }, + + -- markdown + { + "preservim/vim-markdown", + branch = "master", + dependencies = { "godlygeek/tabular" }, + config = function() + vim.g.vim_markdown_folding_style_pythonic = 1 + vim.g.vim_markdown_folding_level = 6 + end, + }, + + -- markdown preview + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + build = "cd app && yarn install", + init = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, + }, + + -- marksman + -- { + -- "artempyanykh/marksman", + -- }, + + -- magma + -- { + -- "dccsillag/magma-nvim", + -- }, + + -- media + { + "nvim-telescope/telescope-media-files.nvim", + dependencies = { + "nvim-lua/popup.nvim", + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + "nvim-telescope/telescope-media-files.nvim", + }, + config = function() + require("telescope").setup { + extensions = { + media_files = { + filetypes = { "png", "webp", "jpg", "jpeg" }, + find_cmd = "rg", + }, + }, + } + end, + }, + + -- metals + { + "scalameta/nvim-metals", + dependencies = { "nvim-lua/plenary.nvim" }, + ft = { "scala" }, + opts = {}, + config = function(_, opts) + local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true }) + vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = { "*.scala", "*.sbt", "*.sc" }, + callback = function() + local metals_config = require("metals").bare_config() + metals_config.on_attach = function(client, bufnr) + require("metals").setup_dap() + end + metals_config.init_options.statusBarProvider = "on" + metals_config.settings = { + showImplicitArguments = false, + showInferredType = true, + excludedPackages = {}, + } + require("metals").initialize_or_attach(metals_config) + end, + group = nvim_metals_group, + }) + end, + }, + + -- mini + { "echasnovski/mini.nvim" }, + + -- mini ai + { + "echasnovski/mini.ai", + opts = function(_, opts) + opts.custom_textobjects = + vim.tbl_extend("force", opts.custom_textobjects, { h = require("custom.configs.cell_marker").miniai_spec }) + end, + }, + + -- neotest + { + "nvim-neotest/neotest", + dependencies = { + "stevanmilic/neotest-scala", + }, + opts = function(_, opts) + vim.list_extend(opts.adapters, { + require "neotest-scala", + }) + end, + }, + + -- obisidian + { + "epwalsh/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + lazy = true, + ft = "markdown", + dependencies = { + "nvim-lua/plenary.nvim", + "hrsh7th/nvim-cmp", + "nvim-telescope/telescope.nvim", + "epwalsh/pomo.nvim", + }, + config = function() + require("obsidian").setup { + workspaces = { + { + name = "SI", + path = "~/Obsidian/SI", + }, + }, + detect_cwd = false, + notes_subdir = "Area/Journal", + log_level = vim.log.levels.INFO, + daily_notes = { + folder = "Area/Journal/Daily", + date_format = "%Y-%m-%d", + alias_format = "%B %-d, %Y", + template = nil, + }, + completion = { + nvim_cmp = true, + min_chars = 2, + new_notes_location = "current_dir", + prepend_note_id = true, + prepend_note_path = false, + use_path_only = false, + }, + note_id_func = function(title) + local suffix = "" + if title ~= nil then + suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() + else + for _ = 1, 4 do + suffix = suffix .. string.char(math.random(65, 90)) + end + end + return tostring(os.time()) .. "-" .. suffix + end, + disable_frontmatter = false, + note_frontmatter_func = function(note) + local out = { id = note.id, aliases = note.aliases, tags = note.tags } + if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then + for k, v in pairs(note.metadata) do + out[k] = v + end + end + return out + end, + templates = { + subdir = "templates", + date_format = "%Y-%m-%d", + time_format = "%H:%M", + substitutions = {}, + }, + backlinks = { + height = 10, + wrap = true, + }, + follow_url_func = function(url) + vim.fn.jobstart { "open", url } -- Mac OS + -- vim.fn.jobstart({"xdg-open", url}) -- linux + end, + use_advanced_uri = false, + open_app_foreground = false, + finder = "telescope.nvim", + sort_by = "modified", + sort_reversed = true, + open_notes_in = "current", + ui = { + enable = true, -- set to false to disable all additional syntax features + update_debounce = 200, -- update delay after a text change (in milliseconds) + checkboxes = { + [" "] = { char = "󰄱", hl_group = "ObsidianTodo" }, + ["x"] = { char = "", hl_group = "ObsidianDone" }, + [">"] = { char = "", hl_group = "ObsidianRightArrow" }, + ["~"] = { char = "󰰱", hl_group = "ObsidianTilde" }, + }, + external_link_icon = { char = "", hl_group = "ObsidianExtLinkIcon" }, + reference_text = { hl_group = "ObsidianRefText" }, + highlight_text = { hl_group = "ObsidianHighlightText" }, + tags = { hl_group = "ObsidianTag" }, + hl_groups = { + ObsidianTodo = { bold = true, fg = "#f78c6c" }, + ObsidianDone = { bold = true, fg = "#89ddff" }, + ObsidianRightArrow = { bold = true, fg = "#f78c6c" }, + ObsidianTilde = { bold = true, fg = "#ff5370" }, + ObsidianRefText = { underline = true, fg = "#c792ea" }, + ObsidianExtLinkIcon = { fg = "#c792ea" }, + ObsidianTag = { italic = true, fg = "#89ddff" }, + ObsidianHighlightText = { bg = "#75662e" }, + }, + }, + attachments = { + img_folder = "assets/imgs", -- This is the default + ---@param client obsidian.Client + ---@param path Path the absolute path to the image file + ---@return string + img_text_func = function(client, path) + local link_path + local vault_relative_path = client:vault_relative_path(path) + if vault_relative_path ~= nil then + link_path = vault_relative_path + else + link_path = tostring(path) + end + local display_name = vim.fs.basename(link_path) + return string.format("![%s](%s)", display_name, link_path) + end, + }, + yaml_parser = "native", + } + end, + }, + + -- otter + { + "jmbuhr/otter.nvim", + opts = { + buffers = { + set_filetype = true, + }, + }, + }, + + -- playground + { + "nvim-treesitter/playground", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + cmd = { "TSPlaygroundToggle" }, + config = function() + require("nvim-treesitter.configs").setup { + playground = { + enable = true, + disable = {}, + updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code + persist_queries = false, -- Whether the query persists across vim sessions + keybindings = { + toggle_query_editor = "o", + toggle_hl_groups = "i", + toggle_injected_languages = "t", + toggle_anonymous_nodes = "a", + toggle_language_display = "I", + focus_language = "f", + unfocus_language = "F", + update = "R", + goto_node = "", + show_help = "?", + }, + }, + + query_linter = { + enable = true, + use_virtual_text = true, + lint_events = { "BufWrite", "CursorHold" }, + }, + } + end, + }, + + -- portal + -- { + -- "cbochs/portal.nvim", + -- keys = { "pj", "ph" }, + -- }, + + -- project + { + "ahmedkhalf/project.nvim", + config = function() + require("project_nvim").setup() + require("nvim-tree").setup { + sync_root_with_cwd = true, + respect_buf_cwd = true, + update_focused_file = { + enable = true, + update_root = true, + }, + } + end, + }, + + -- refactoring + { + "ThePrimeagen/refactoring.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("refactoring").setup() + end, + }, + + -- slime + -- { + -- "jpalardy/vim-slime", + -- init = function() + -- vim.b["quarto_is_" .. "python" .. "_chunk"] = false + -- Quarto_is_in_python_chunk = function() + -- require("otter.tools.functions").is_otter_language_context "python" + -- end + -- + -- vim.cmd [[ + -- let g:slime_dispatch_ipython_pause = 100 + -- function SlimeOverride_EscapeText_quarto(text) + -- call v:lua.Quarto_is_in_python_chunk() + -- if exists('g:slime_python_ipython') && len(split(a:text,"\n")) > 1 && b:quarto_is_python_chunk + -- return ["%cpaste -q\n", g:slime_dispatch_ipython_pause, a:text, "--", "\n"] + -- else + -- return a:text + -- end + -- endfunction + -- ]] + -- + -- local function mark_terminal() + -- vim.g.slime_last_channel = vim.b.terminal_job_id + -- vim.print(vim.g.slime_last_channel) + -- end + -- + -- local function set_terminal() + -- vim.b.slime_config = { jobid = vim.g.slime_last_channel } + -- end + -- + -- -- slime, neovvim terminal + -- vim.g.slime_target = "neovim" + -- vim.g.slime_python_ipython = 1 + -- + -- require("which-key").register { + -- ["cm"] = { mark_terminal, "mark terminal" }, + -- ["cs"] = { set_terminal, "set terminal" }, + -- } + -- end, + -- }, + + -- sniprun + { + "michaelb/sniprun", + -- run = "sh ./install.sh 1", + config = function() + require("sniprun").setup { + -- repl_enable = { "Python3_original" }, --# enable REPL-like behavior for the given interpreters + -- repl_disable = {}, --# disable REPL-like behavior for the given interpretersepl_enable = { "Python3_original" }, + -- interpreter_options = { --# interpreter-specific options, see doc / :SnipInfo + -- + -- --# use the interpreter name as key + -- GFM_original = { + -- use_on_filetypes = { "markdown.pandoc" }, --# the 'use_on_filetypes' configuration key is + -- --# available for every interpreter + -- }, + -- Python3_original = { + -- error_truncate = "auto", --# Truncate runtime errors 'long', 'short' or 'auto' # the hint is available for every interpreter # but may not be always respected + -- interpreter = "python3.9", + -- venv = { "" }, + -- }, + -- }, + borders = "single", + } + end, + }, + + -- surround + { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() + require("nvim-surround").setup { + -- Configuration here, or leave empty to use defaults + } + end, + }, + + -- SQL + { + "tpope/vim-dadbod", + lazy = true, + dependencies = { + "kristijanhusak/vim-dadbod-ui", + { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true }, + }, + opts = {}, + config = function() + require("custom.configs.dadbod").setup() + end, + cmd = { "DBUI", "DBUIToggle", "DBUIAddConnection", "DBUIFindBuffer", "DBUIRenameBuffer", "DBUILastQueryInfo" }, + }, + -- { + -- "kristijanhusak/vim-dadbod-ui", + -- dependencies = { + -- { "tpope/vim-dadbod", lazy = true }, + -- { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true }, + -- }, + -- cmd = { + -- "DBUI", + -- "DBUIToggle", + -- "DBUIAddConnection", + -- "DBUIFindBuffer", + -- }, + -- init = function() + -- -- Your DBUI configuration + -- vim.g.db_ui_use_nerd_fonts = 1 + -- end, + -- }, + + -- tagbar + { + "preservim/tagbar", + dependencies = { "nvim-telescope/telescope.nvim" }, + cmd = "TagbarToggle", + }, + + -- telescope-frecency + { + "nvim-telescope/telescope-frecency.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + }, + config = function() + require("telescope").load_extension "frecency" + end, + }, + + -- telescope-fzf-native + -- { + -- "nvim-telescope/telescope-fzf-native.nvim", + -- build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build", + -- }, + + -- telescope-undo + { + "debugloop/telescope-undo.nvim", + dependencies = { -- note how they're inverted to above example + { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + }, + keys = { + { -- lazy style key map + "u", + "Telescope undo", + desc = "undo history", + }, + }, + opts = { + -- don't use `defaults = { }` here, do this in the main telescope spec + extensions = { + undo = { + -- telescope-undo.nvim config, see below + }, + -- no other extensions here, they can have their own spec too + }, + }, + config = function(_, opts) + -- Calling telescope's setup from multiple specs does not hurt, it will happily merge the + -- configs for us. We won't use data, as everything is in it's own namespace (telescope + -- defaults, as well as each extension). + require("telescope").setup(opts) + require("telescope").load_extension "undo" + end, + }, + + -- tmux + { + "christoomey/vim-tmux-navigator", + lazy = false, + }, + + -- todo + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = {}, + config = function() + require("todo-comments").setup() + end, + cmd = { + "Todo", + "TodoTrouble", + "TodoTelescope", + "TodoLocList", + "TodoQuickFix", + }, + }, + + -- trouble + { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = {}, + config = function() + require("trouble").setup() + end, + }, + + -- visual multi + { "mg979/vim-visual-multi" }, + + -- quarto + -- { + -- "quarto-dev/quarto-nvim", + -- dependencies = { + -- "jmbuhr/otter.nvim", + -- "neovim/nvim-lspconfig", + -- }, + -- opts = { + -- lspFeatures = { + -- languages = { "r", "python", "julia", "bash", "html", "lua" }, + -- }, + -- }, + -- ft = "quarto", + -- cmd = { + -- "QuartoPreview", + -- "QuartoClosePreview", + -- "QuartoActivate", + -- "QuartoHelp", + -- "QuartoHover", + -- }, + -- }, +} + +return plugins diff --git a/ar/.config/NvChad/lua/plugins/configs/cmp.lua b/ar/.config/NvChad/lua/plugins/configs/cmp.lua new file mode 100644 index 0000000..444da73 --- /dev/null +++ b/ar/.config/NvChad/lua/plugins/configs/cmp.lua @@ -0,0 +1,120 @@ +local cmp = require "cmp" + +dofile(vim.g.base46_cache .. "cmp") + +local cmp_ui = require("core.utils").load_config().ui.cmp +local cmp_style = cmp_ui.style + +local field_arrangement = { + atom = { "kind", "abbr", "menu" }, + atom_colored = { "kind", "abbr", "menu" }, +} + +local formatting_style = { + -- default fields order i.e completion word + item.kind + item.kind icons + fields = field_arrangement[cmp_style] or { "abbr", "kind", "menu" }, + + format = function(_, item) + local icons = require "nvchad.icons.lspkind" + local icon = (cmp_ui.icons and icons[item.kind]) or "" + + if cmp_style == "atom" or cmp_style == "atom_colored" then + icon = " " .. icon .. " " + item.menu = cmp_ui.lspkind_text and " (" .. item.kind .. ")" or "" + item.kind = icon + else + icon = cmp_ui.lspkind_text and (" " .. icon .. " ") or icon + item.kind = string.format("%s %s", icon, cmp_ui.lspkind_text and item.kind or "") + end + + return item + end, +} + +local function border(hl_name) + return { + { "╭", hl_name }, + { "─", hl_name }, + { "╮", hl_name }, + { "│", hl_name }, + { "╯", hl_name }, + { "─", hl_name }, + { "╰", hl_name }, + { "│", hl_name }, + } +end + +local options = { + completion = { + completeopt = "menu,menuone", + }, + + window = { + completion = { + side_padding = (cmp_style ~= "atom" and cmp_style ~= "atom_colored") and 1 or 0, + winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:None", + scrollbar = false, + }, + documentation = { + border = border "CmpDocBorder", + winhighlight = "Normal:CmpDoc", + }, + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + + formatting = formatting_style, + + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Insert, + select = true, + }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expand_or_jumpable() then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require("luasnip").jumpable(-1) then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") + else + fallback() + end + end, { + "i", + "s", + }), + }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "nvim_lua" }, + { name = "path" }, + }, +} + +if cmp_style ~= "atom" and cmp_style ~= "atom_colored" then + options.window.completion.border = border "CmpBorder" +end + +return options diff --git a/ar/.config/NvChad/lua/plugins/configs/lazy_nvim.lua b/ar/.config/NvChad/lua/plugins/configs/lazy_nvim.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/ar/.config/NvChad/lua/plugins/configs/lazy_nvim.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/ar/.config/NvChad/lua/plugins/configs/lspconfig.lua b/ar/.config/NvChad/lua/plugins/configs/lspconfig.lua new file mode 100644 index 0000000..18e84ad --- /dev/null +++ b/ar/.config/NvChad/lua/plugins/configs/lspconfig.lua @@ -0,0 +1,67 @@ +dofile(vim.g.base46_cache .. "lsp") +require "nvchad.lsp" + +local M = {} +local utils = require "core.utils" + +-- export on_attach & capabilities for custom lspconfigs + +M.on_attach = function(client, bufnr) + client.server_capabilities.documentFormattingProvider = false + client.server_capabilities.documentRangeFormattingProvider = false + + utils.load_mappings("lspconfig", { buffer = bufnr }) + + if client.server_capabilities.signatureHelpProvider then + require("nvchad.signature").setup(client) + end + + if not utils.load_config().ui.lsp_semantic_tokens and client.supports_method "textDocument/semanticTokens" then + client.server_capabilities.semanticTokensProvider = nil + end +end + +M.capabilities = vim.lsp.protocol.make_client_capabilities() + +M.capabilities.textDocument.completion.completionItem = { + documentationFormat = { "markdown", "plaintext" }, + snippetSupport = true, + preselectSupport = true, + insertReplaceSupport = true, + labelDetailsSupport = true, + deprecatedSupport = true, + commitCharactersSupport = true, + tagSupport = { valueSet = { 1 } }, + resolveSupport = { + properties = { + "documentation", + "detail", + "additionalTextEdits", + }, + }, +} + +require("lspconfig").lua_ls.setup { + on_attach = M.on_attach, + capabilities = M.capabilities, + + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = { + [vim.fn.expand "$VIMRUNTIME/lua"] = true, + [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true, + [vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types"] = true, + [vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true, + }, + maxPreload = 100000, + preloadFileSize = 10000, + }, + }, + }, +} + +return M diff --git a/ar/.config/NvChad/lua/plugins/configs/mason.lua b/ar/.config/NvChad/lua/plugins/configs/mason.lua new file mode 100644 index 0000000..3692a15 --- /dev/null +++ b/ar/.config/NvChad/lua/plugins/configs/mason.lua @@ -0,0 +1,28 @@ +local options = { + ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim + + PATH = "skip", + + ui = { + icons = { + package_pending = " ", + package_installed = "󰄳 ", + package_uninstalled = " 󰚌", + }, + + keymaps = { + toggle_server_expand = "", + install_server = "i", + update_server = "u", + check_server_version = "c", + update_all_servers = "U", + check_outdated_servers = "C", + uninstall_server = "X", + cancel_installation = "", + }, + }, + + max_concurrent_installers = 10, +} + +return options diff --git a/ar/.config/NvChad/lua/plugins/configs/nvimtree.lua b/ar/.config/NvChad/lua/plugins/configs/nvimtree.lua new file mode 100644 index 0000000..b4a8aee --- /dev/null +++ b/ar/.config/NvChad/lua/plugins/configs/nvimtree.lua @@ -0,0 +1,77 @@ +local options = { + filters = { + dotfiles = false, + exclude = { vim.fn.stdpath "config" .. "/lua/custom" }, + }, + disable_netrw = true, + hijack_netrw = true, + hijack_cursor = true, + hijack_unnamed_buffer_when_opening = false, + sync_root_with_cwd = true, + update_focused_file = { + enable = true, + update_root = false, + }, + view = { + adaptive_size = false, + side = "left", + width = 30, + preserve_window_proportions = true, + }, + git = { + enable = false, + ignore = true, + }, + filesystem_watchers = { + enable = true, + }, + actions = { + open_file = { + resize_window = true, + }, + }, + renderer = { + root_folder_label = false, + highlight_git = false, + highlight_opened_files = "none", + + indent_markers = { + enable = false, + }, + + icons = { + show = { + file = true, + folder = true, + folder_arrow = true, + git = false, + }, + + glyphs = { + default = "󰈚", + symlink = "", + folder = { + default = "", + empty = "", + empty_open = "", + open = "", + symlink = "", + symlink_open = "", + arrow_open = "", + arrow_closed = "", + }, + git = { + unstaged = "✗", + staged = "✓", + unmerged = "", + renamed = "➜", + untracked = "★", + deleted = "", + ignored = "◌", + }, + }, + }, + }, +} + +return options diff --git a/ar/.config/NvChad/lua/plugins/configs/others.lua b/ar/.config/NvChad/lua/plugins/configs/others.lua new file mode 100644 index 0000000..dafd5a4 --- /dev/null +++ b/ar/.config/NvChad/lua/plugins/configs/others.lua @@ -0,0 +1,66 @@ +local M = {} +local utils = require "core.utils" + +M.blankline = { + indentLine_enabled = 1, + filetype_exclude = { + "help", + "terminal", + "lazy", + "lspinfo", + "TelescopePrompt", + "TelescopeResults", + "mason", + "nvdash", + "nvcheatsheet", + "", + }, + buftype_exclude = { "terminal" }, + show_trailing_blankline_indent = false, + show_first_indent_level = false, + show_current_context = true, + show_current_context_start = true, +} + +M.luasnip = function(opts) + require("luasnip").config.set_config(opts) + + -- vscode format + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" } + + -- snipmate format + require("luasnip.loaders.from_snipmate").load() + require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" } + + -- lua format + require("luasnip.loaders.from_lua").load() + require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" } + + vim.api.nvim_create_autocmd("InsertLeave", { + callback = function() + if + require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] + and not require("luasnip").session.jump_active + then + require("luasnip").unlink_current() + end + end, + }) +end + +M.gitsigns = { + signs = { + add = { text = "│" }, + change = { text = "│" }, + delete = { text = "󰍵" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "│" }, + }, + on_attach = function(bufnr) + utils.load_mappings("gitsigns", { buffer = bufnr }) + end, +} + +return M diff --git a/ar/.config/NvChad/lua/plugins/configs/telescope.lua b/ar/.config/NvChad/lua/plugins/configs/telescope.lua new file mode 100644 index 0000000..91c1d3a --- /dev/null +++ b/ar/.config/NvChad/lua/plugins/configs/telescope.lua @@ -0,0 +1,63 @@ +local options = { + defaults = { + vimgrep_arguments = { + "rg", + "-L", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + }, + prompt_prefix = "  ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + preview_width = 0.55, + results_width = 0.8, + }, + vertical = { + mirror = false, + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, + file_sorter = require("telescope.sorters").get_fuzzy_file, + file_ignore_patterns = { "node_modules" }, + generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + path_display = { "truncate" }, + winblend = 0, + border = {}, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + color_devicons = true, + set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, + file_previewer = require("telescope.previewers").vim_buffer_cat.new, + grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, + mappings = { + n = { ["q"] = require("telescope.actions").close }, + }, + }, + + extensions_list = { "themes", "terms", "fzf" }, + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + }, + }, +} + +return options diff --git a/ar/.config/NvChad/lua/plugins/configs/treesitter.lua b/ar/.config/NvChad/lua/plugins/configs/treesitter.lua new file mode 100644 index 0000000..b21b55d --- /dev/null +++ b/ar/.config/NvChad/lua/plugins/configs/treesitter.lua @@ -0,0 +1,12 @@ +local options = { + ensure_installed = { "lua" }, + + highlight = { + enable = true, + use_languagetree = true, + }, + + indent = { enable = true }, +} + +return options diff --git a/ar/.config/NvChad/lua/plugins/init.lua b/ar/.config/NvChad/lua/plugins/init.lua new file mode 100644 index 0000000..a97e753 --- /dev/null +++ b/ar/.config/NvChad/lua/plugins/init.lua @@ -0,0 +1,273 @@ +-- All plugins have lazy=true by default,to load a plugin on startup just lazy=false +-- List of all default plugins & their definitions +local default_plugins = { + + "nvim-lua/plenary.nvim", + + { + "NvChad/base46", + branch = "v2.0", + build = function() + require("base46").load_all_highlights() + end, + }, + + { + "NvChad/ui", + branch = "v2.0", + lazy = false, + }, + + { + "NvChad/nvterm", + init = function() + require("core.utils").load_mappings "nvterm" + end, + config = function(_, opts) + require "base46.term" + require("nvterm").setup(opts) + end, + }, + + { + "NvChad/nvim-colorizer.lua", + init = function() + require("core.utils").lazy_load "nvim-colorizer.lua" + end, + config = function(_, opts) + require("colorizer").setup(opts) + + -- execute colorizer as soon as possible + vim.defer_fn(function() + require("colorizer").attach_to_buffer(0) + end, 0) + end, + }, + + { + "nvim-tree/nvim-web-devicons", + opts = function() + return { override = require "nvchad.icons.devicons" } + end, + config = function(_, opts) + dofile(vim.g.base46_cache .. "devicons") + require("nvim-web-devicons").setup(opts) + end, + }, + + { + "lukas-reineke/indent-blankline.nvim", + version = "3.5.1", + init = function() + require("core.utils").lazy_load "indent-blankline.nvim" + end, + opts = function() + return require("plugins.configs.others").blankline + end, + config = function(_, opts) + require("core.utils").load_mappings "blankline" + dofile(vim.g.base46_cache .. "blankline") + require("indent_blankline").setup(opts) + end, + }, + + { + "nvim-treesitter/nvim-treesitter", + init = function() + require("core.utils").lazy_load "nvim-treesitter" + end, + cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, + build = ":TSUpdate", + opts = function() + return require "plugins.configs.treesitter" + end, + config = function(_, opts) + dofile(vim.g.base46_cache .. "syntax") + require("nvim-treesitter.configs").setup(opts) + end, + }, + + -- git stuff + { + "lewis6991/gitsigns.nvim", + ft = { "gitcommit", "diff" }, + init = function() + -- load gitsigns only when a git file is opened + vim.api.nvim_create_autocmd({ "BufRead" }, { + group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }), + callback = function() + vim.fn.system("git -C " .. '"' .. vim.fn.expand "%:p:h" .. '"' .. " rev-parse") + if vim.v.shell_error == 0 then + vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad" + vim.schedule(function() + require("lazy").load { plugins = { "gitsigns.nvim" } } + end) + end + end, + }) + end, + opts = function() + return require("plugins.configs.others").gitsigns + end, + config = function(_, opts) + dofile(vim.g.base46_cache .. "git") + require("gitsigns").setup(opts) + end, + }, + + -- lsp stuff + { + "williamboman/mason.nvim", + cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" }, + opts = function() + return require "plugins.configs.mason" + end, + config = function(_, opts) + dofile(vim.g.base46_cache .. "mason") + require("mason").setup(opts) + + -- custom nvchad cmd to install all mason binaries listed + vim.api.nvim_create_user_command("MasonInstallAll", function() + vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " ")) + end, {}) + + vim.g.mason_binaries_list = opts.ensure_installed + end, + }, + + { + "neovim/nvim-lspconfig", + init = function() + require("core.utils").lazy_load "nvim-lspconfig" + end, + config = function() + require "plugins.configs.lspconfig" + end, + }, + + -- load luasnips + cmp related in insert mode only + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + { + -- snippet plugin + "L3MON4D3/LuaSnip", + dependencies = "rafamadriz/friendly-snippets", + opts = { history = true, updateevents = "TextChanged,TextChangedI" }, + config = function(_, opts) + require("plugins.configs.others").luasnip(opts) + end, + }, + + -- autopairing of (){}[] etc + { + "windwp/nvim-autopairs", + opts = { + fast_wrap = {}, + disable_filetype = { "TelescopePrompt", "vim" }, + }, + config = function(_, opts) + require("nvim-autopairs").setup(opts) + + -- setup cmp for autopairs + local cmp_autopairs = require "nvim-autopairs.completion.cmp" + require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end, + }, + + -- cmp sources plugins + { + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, + }, + opts = function() + return require "plugins.configs.cmp" + end, + config = function(_, opts) + require("cmp").setup(opts) + end, + }, + + { + "numToStr/Comment.nvim", + keys = { + { "gcc", mode = "n", desc = "Comment toggle current line" }, + { "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" }, + { "gc", mode = "x", desc = "Comment toggle linewise (visual)" }, + { "gbc", mode = "n", desc = "Comment toggle current block" }, + { "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" }, + { "gb", mode = "x", desc = "Comment toggle blockwise (visual)" }, + }, + init = function() + require("core.utils").load_mappings "comment" + end, + config = function(_, opts) + require("Comment").setup(opts) + end, + }, + + -- file managing , picker etc + { + "nvim-tree/nvim-tree.lua", + cmd = { "NvimTreeToggle", "NvimTreeFocus" }, + init = function() + require("core.utils").load_mappings "nvimtree" + end, + opts = function() + return require "plugins.configs.nvimtree" + end, + config = function(_, opts) + dofile(vim.g.base46_cache .. "nvimtree") + require("nvim-tree").setup(opts) + end, + }, + + { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-treesitter/nvim-treesitter", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" } }, + cmd = "Telescope", + init = function() + require("core.utils").load_mappings "telescope" + end, + opts = function() + return require "plugins.configs.telescope" + end, + config = function(_, opts) + dofile(vim.g.base46_cache .. "telescope") + local telescope = require "telescope" + telescope.setup(opts) + + -- load extensions + for _, ext in ipairs(opts.extensions_list) do + telescope.load_extension(ext) + end + end, + }, + + -- Only load whichkey after all the gui + { + "folke/which-key.nvim", + keys = { "", "", "", '"', "'", "`", "c", "v", "g" }, + init = function() + require("core.utils").load_mappings "whichkey" + end, + cmd = "WhichKey", + config = function(_, opts) + dofile(vim.g.base46_cache .. "whichkey") + require("which-key").setup(opts) + end, + }, +} + +local config = require("core.utils").load_config() + +if #config.plugins > 0 then + table.insert(default_plugins, { import = config.plugins }) +end + +require("lazy").setup(default_plugins, config.lazy_nvim) diff --git a/ar/.config/NvChad/vim_cheatsheet.webp b/ar/.config/NvChad/vim_cheatsheet.webp new file mode 100644 index 0000000..d8bf593 Binary files /dev/null and b/ar/.config/NvChad/vim_cheatsheet.webp differ diff --git a/ar/.config/NvChad/vim_cheatsheet2.webp b/ar/.config/NvChad/vim_cheatsheet2.webp new file mode 100644 index 0000000..b64e63c Binary files /dev/null and b/ar/.config/NvChad/vim_cheatsheet2.webp differ diff --git a/ar/.config/NvChad/vscode/easymotion-config.vim b/ar/.config/NvChad/vscode/easymotion-config.vim new file mode 100644 index 0000000..89c1f90 --- /dev/null +++ b/ar/.config/NvChad/vscode/easymotion-config.vim @@ -0,0 +1,2 @@ +let g:EasyMotion_smartcase = 1 +nmap f (easymotion-bd-f) diff --git a/ar/.config/NvChad/vscode/plugins.lua b/ar/.config/NvChad/vscode/plugins.lua new file mode 100644 index 0000000..920d80f --- /dev/null +++ b/ar/.config/NvChad/vscode/plugins.lua @@ -0,0 +1,153 @@ +-- plugins.lua + +return { + + -- Alpha (Dashboard) + { + "goolord/alpha-nvim", + lazy = true, + }, + + -- Auto Pairs + { + "windwp/nvim-autopairs", + }, + + -- Bufferline + { + "akinsho/bufferline.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + }, + + -- Colorscheme + { + "folke/tokyonight.nvim", + }, + + -- Comments + { + "numToStr/Comment.nvim", + config = function() + require("Comment").setup() + end, + }, + + -- Easymotion (VScode) + { + "ChristianChiarulli/vscode-easymotion", + }, + + -- Git Integration + { + "lewis6991/gitsigns.nvim", + }, + + -- Hop (Better Navigation) + { + "phaazon/hop.nvim", + lazy = true, + }, + + -- Indentation Highlighting + { + "lukas-reineke/indent-blankline.nvim", + }, + + -- Rainbow Highlighting + { + "HiPhish/nvim-ts-rainbow2", + }, + + -- Lualine + { + "nvim-lualine/lualine.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + }, + + -- Language Support + { + "VonHeikemen/lsp-zero.nvim", + lazy = true, + branch = "v1.x", + dependencies = { + -- LSP Support + { "neovim/nvim-lspconfig" }, -- Required + { "williamboman/mason.nvim" }, -- Optional + { "williamboman/mason-lspconfig.nvim" }, -- Optional + + -- Autocompletion + { "hrsh7th/nvim-cmp" }, -- Required + { "hrsh7th/cmp-nvim-lsp" }, -- Required + { "hrsh7th/cmp-buffer" }, -- Optional + { "hrsh7th/cmp-path" }, -- Optional + { "saadparwaiz1/cmp_luasnip" }, -- Optional + { "hrsh7th/cmp-nvim-lua" }, -- Optional + + -- Snippets + { "L3MON4D3/LuaSnip" }, -- Required + { "rafamadriz/friendly-snippets" }, -- Optional + }, + }, + + -- Nvim-tree (File Explorer) + { + "nvim-tree/nvim-tree.lua", + lazy = true, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + }, + + -- Nvim-Surround (Manipulating Surroundings) + { + "kylechui/nvim-surround", + config = function() + require("nvim-surround").setup { + -- Configuration here, or leave empty to use defaults + } + end, + }, + + -- -- Quick-Scope + -- { + -- "unblevable/quick-scope", + -- }, + + -- Telescope (Fuzzy Finder) + { + "nvim-telescope/telescope.nvim", + lazy = true, + dependencies = { + { "nvim-lua/plenary.nvim" }, + }, + }, + + -- Treesitter + { + "nvim-treesitter/nvim-treesitter", + }, + + -- Toggle Term + { + "akinsho/toggleterm.nvim", + config = true, + }, + + -- Undo-Tree + { + "jiaoshijie/undotree", + dependencies = { + "nvim-lua/plenary.nvim", + }, + }, + + -- Which-key + { + "folke/which-key.nvim", + lazy = true, + }, +} diff --git a/ar/.config/NvChad/vscode/remap.lua b/ar/.config/NvChad/vscode/remap.lua new file mode 100644 index 0000000..e0b47c4 --- /dev/null +++ b/ar/.config/NvChad/vscode/remap.lua @@ -0,0 +1,32 @@ +vim.keymap.set("n", "pv", vim.cmd.Ex) + +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +-- greatest remap ever +vim.keymap.set("x", "p", [["_dP]]) + +-- next greatest remap ever : asbjornHaland +vim.keymap.set({ "n", "v" }, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +vim.keymap.set({ "n", "v" }, "d", [["_d]]) + +-- This is going to get me cancelled +vim.keymap.set("i", "jk", "") + +vim.keymap.set("n", "Q", "") + +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") +vim.keymap.set("n", "k", "lnextzz") +vim.keymap.set("n", "j", "lprevzz") + +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) diff --git a/ar/.config/NvChad/vscode/settings.vim b/ar/.config/NvChad/vscode/settings.vim new file mode 100644 index 0000000..c48a73c --- /dev/null +++ b/ar/.config/NvChad/vscode/settings.vim @@ -0,0 +1,49 @@ +function! s:closeOtherEditors() + call VSCodeNotify('workbench.action.closeEditorsInOtherGroups') + call VSCodeNotify('workbench.action.closeOtherEditors') +endfunction + +function! s:manageEditorSize(...) + let count = a:1 + let to = a:2 + for i in range(1, count ? count : 1) + call VSCodeNotify(to == 'increase' ? 'workbench.action.increaseViewSize' : 'workbench.action.decreaseViewSize') + endfor +endfunction + +command! -bang Only if == '!' | call closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif + +nnoremap = :call VSCodeNotify('workbench.action.evenEditorWidths') +xnoremap = :call VSCodeNotify('workbench.action.evenEditorWidths') +nnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') +xnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') + +" nnoremap > :call manageEditorSize(v:count, 'increase') +" xnoremap > :call manageEditorSize(v:count, 'increase') +" nnoremap + :call manageEditorSize(v:count, 'increase') +" xnoremap + :call manageEditorSize(v:count, 'increase') +" nnoremap < :call manageEditorSize(v:count, 'decrease') +" xnoremap < :call manageEditorSize(v:count, 'decrease') +" nnoremap - :call manageEditorSize(v:count, 'decrease') +" xnoremap - :call manageEditorSize(v:count, 'decrease') + +" Better Navigation +nnoremap :call VSCodeNotify('workbench.action.navigateDown') +xnoremap :call VSCodeNotify('workbench.action.navigateDown') +nnoremap :call VSCodeNotify('workbench.action.navigateUp') +xnoremap :call VSCodeNotify('workbench.action.navigateUp') +nnoremap :call VSCodeNotify('workbench.action.navigateLeft') +xnoremap :call VSCodeNotify('workbench.action.navigateLeft') +nnoremap :call VSCodeNotify('workbench.action.navigateRight') +xnoremap :call VSCodeNotify('workbench.action.navigateRight') + +" Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors +xnoremap :call Comment() +nnoremap :call Comment() + +nnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') + +nnoremap :call VSCodeNotify('whichkey.show') +xnoremap :call VSCodeNotify('whichkey.show') + +" nnoremap :call VSCodeNotify('workbench.view.explorer') \ No newline at end of file diff --git a/ar/.config/TheSiahxyz/after/queries/markdown/textobjects.scm b/ar/.config/TheSiahxyz/after/queries/markdown/textobjects.scm new file mode 100644 index 0000000..2882dd2 --- /dev/null +++ b/ar/.config/TheSiahxyz/after/queries/markdown/textobjects.scm @@ -0,0 +1,3 @@ +;; extends + +(fenced_code_block (code_fence_content) @code_cell.inner) @code_cell.outer diff --git a/ar/.config/TheSiahxyz/ftplugin/markdown.lua b/ar/.config/TheSiahxyz/ftplugin/markdown.lua new file mode 100644 index 0000000..266bcc9 --- /dev/null +++ b/ar/.config/TheSiahxyz/ftplugin/markdown.lua @@ -0,0 +1,440 @@ +-- Function to check if the current file is in the Obsidian repository +local function is_in_obsidian_repo() + local current_file_path = vim.fn.expand("%:p:h") + local user = os.getenv("USER") -- Get the current user's name from the environment variable + local obsidian_path = "/home/" .. user .. "/Private/repos/Obsidian/" + + return string.find(current_file_path, obsidian_path) ~= nil +end + +function BoldMe() + -- Get the start and end positions of the visual selection + local start_pos = vim.fn.getpos("'<") + local end_pos = vim.fn.getpos("'>") + local start_line, start_col = start_pos[2], start_pos[3] + local end_line, end_col = end_pos[2], end_pos[3] + local lines = vim.api.nvim_buf_get_lines(0, start_line - 1, end_line, false) + + if start_line == end_line then + lines[1] = lines[1]:sub(1, start_col - 1) + .. "**" + .. lines[1]:sub(start_col, end_col) + .. "**" + .. lines[1]:sub(end_col + 1) + else + lines[1] = lines[1]:sub(1, start_col - 1) .. "**" .. lines[1]:sub(start_col) + lines[#lines] = lines[#lines]:sub(1, end_col) .. "**" .. lines[#lines]:sub(end_col + 1) + end + vim.api.nvim_buf_set_lines(0, start_line - 1, end_line, false, lines) +end + +-- Function to fold all headings of a specific level +local function set_foldmethod_expr() + -- These are lazyvim.org defaults but setting them just in case a file + -- doesn't have them set + if vim.fn.has("nvim-0.10") == 1 then + vim.opt.foldmethod = "expr" + vim.wo.foldexpr = "v:lua.require'thesiahxyz.utils.markdown'.foldexpr()" + vim.opt.foldtext = "" + else + vim.opt.foldmethod = "indent" + vim.wo.foldtext = "v:lua.require'thesiahxyz.utils.markdown'.foldexpr()" + end + vim.opt.foldlevel = 99 +end + +local function fold_headings_of_level(level) + -- Move to the top of the file + vim.cmd("normal! gg") + -- Get the total number of lines + local total_lines = vim.fn.line("$") + for line = 1, total_lines do + -- Get the content of the current line + local line_content = vim.fn.getline(line) + -- "^" -> Ensures the match is at the start of the line + -- string.rep("#", level) -> Creates a string with 'level' number of "#" characters + -- "%s" -> Matches any whitespace character after the "#" characters + -- So this will match `## `, `### `, `#### ` for example, which are markdown headings + if line_content:match("^" .. string.rep("#", level) .. "%s") then + -- Move the cursor to the current line + vim.fn.cursor(line, 1) + -- Fold the heading if it matches the level + if vim.fn.foldclosed(line) == -1 then + vim.cmd("normal! za") + end + end + end +end + +local function fold_markdown_headings(levels) + set_foldmethod_expr() + -- I save the view to know where to jump back after folding + local saved_view = vim.fn.winsaveview() + for _, level in ipairs(levels) do + fold_headings_of_level(level) + end + vim.cmd("nohlsearch") + -- Restore the view to jump to where I was + vim.fn.winrestview(saved_view) +end + +local function make_heading_content() + -- Get the total number of lines in the buffer + local total_lines = vim.api.nvim_buf_line_count(0) + + -- Iterate through all lines + for line = 1, total_lines do + -- Get the content of the current line + local line_content = vim.api.nvim_buf_get_lines(0, line - 1, line, false)[1] + -- Match headings with at least two '#' characters + local heading = line_content:match("^(##+)%s(.+)") + if heading then + -- Extract the heading text + local heading_text = line_content:match("^#+%s(.+)") + if heading_text then + -- Create the content line with markdown link syntax + local content_line = string.format("%s [%s]()", heading, heading_text) + -- Replace the current line with the modified content + vim.api.nvim_buf_set_lines(0, line - 1, line, false, { content_line }) + end + end + end + -- Notify the user that the headings have been updated + vim.notify("Headings transformed into content format", vim.log.levels.INFO) +end + +-- Generate/update a Markdown TOC +-- To generate the TOC I use the markdown-toc plugin +-- https://github.com/jonschlinkert/markdown-toc +-- And the markdown-toc plugin installed as a LazyExtra +-- Function to update the Markdown TOC with customizable headings +local function update_markdown_toc(heading2, heading3) + -- local path = vim.fn.expand("%") -- Expands the current file name to a full path + local path = vim.api.nvim_buf_get_name(0) + local bufnr = 0 -- The current buffer number, 0 references the current active buffer + -- Save the current view + -- If I don't do this, my folds are lost when I run this keymap + vim.cmd("mkview") + -- Retrieves all lines from the current buffer + local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) + local toc_exists = false -- Flag to check if TOC marker exists + local frontmatter_end = 0 -- To store the end line number of frontmatter + -- Check for frontmatter and TOC marker + for i, line in ipairs(lines) do + if i == 1 and line:match("^---$") then + -- Frontmatter start detected, now find the end + for j = i + 1, #lines do + if lines[j]:match("^---$") then + frontmatter_end = j + break + end + end + end + -- Checks for the TOC marker + if line:match("^%s*%s*$") then + toc_exists = true + break + end + end + -- Inserts H2 and H3 headings and at the appropriate position + if not toc_exists then + local insertion_line = 1 -- Default insertion point after first line + if frontmatter_end > 0 then + -- Find H1 after frontmatter + for i = frontmatter_end + 1, #lines do + if lines[i]:match("^#%s+") then + insertion_line = i + 1 + break + end + end + else + -- Find H1 from the beginning + for i, line in ipairs(lines) do + if line:match("^#%s+") then + insertion_line = i + 1 + break + end + end + end + -- Insert the specified headings and without blank lines + -- Insert the TOC inside a H2 and H3 heading right below the main H1 at the top lamw25wmal + vim.api.nvim_buf_set_lines(bufnr, insertion_line, insertion_line, false, { heading2, heading3, "" }) + end + -- Silently save the file, in case TOC is being created for the first time + vim.cmd("silent write") + -- Silently run markdown-toc to update the TOC without displaying command output + -- vim.fn.system('markdown-toc -i "' .. path .. '"') + -- I want my bulletpoints to be created only as "-" so passing that option as + -- an argument according to the docs + -- https://github.com/jonschlinkert/markdown-toc?tab=readme-ov-file#optionsbullets + vim.fn.system('markdown-toc --bullets "-" -i "' .. path .. '"') + vim.cmd("edit!") -- Reloads the file to reflect the changes made by markdown-toc + vim.cmd("silent write") -- Silently save the file + vim.notify("TOC updated and file saved", vim.log.levels.INFO) + -- -- In case a cleanup is needed, leaving this old code here as a reference + -- -- I used this code before I implemented the frontmatter check + -- -- Moves the cursor to the top of the file + -- vim.api.nvim_win_set_cursor(bufnr, { 1, 0 }) + -- -- Deletes leading blank lines from the top of the file + -- while true do + -- -- Retrieves the first line of the buffer + -- local line = vim.api.nvim_buf_get_lines(bufnr, 0, 1, false)[1] + -- -- Checks if the line is empty + -- if line == "" then + -- -- Deletes the line if it's empty + -- vim.api.nvim_buf_set_lines(bufnr, 0, 1, false, {}) + -- else + -- -- Breaks the loop if the line is not empty, indicating content or TOC marker + -- break + -- end + -- end + -- Restore the saved view (including folds) + vim.cmd("loadview") +end + +-- this setting makes markdown auto-set the 80 text width limit when typing +-- vim.cmd('set fo+=a') +if is_in_obsidian_repo() then + vim.bo.textwidth = 175 -- No limit for Obsidian repository +end + +vim.cmd("set conceallevel=0") +vim.cmd("setlocal spell spelllang=en_us") +vim.cmd("setlocal expandtab shiftwidth=4 softtabstop=4 autoindent") +vim.cmd([[ + " arrows + iabbrev >> → + iabbrev << ← + iabbrev ^^ ↑ + iabbrev VV ↓ +]]) + +-- Makrdown.nvim settings +vim.g.vim_markdown_auto_insert_bullets = 0 +vim.g.vim_markdown_autowrite = 1 +vim.g.vim_markdown_conceal = 0 +vim.g.vim_markdown_conceal_code_blocks = 0 +vim.g.vim_markdown_folding_disabled = 0 +vim.g.vim_markdown_folding_level = 2 +vim.g.vim_markdown_folding_style_pythonic = 1 +vim.g.vim_markdown_follow_anchor = 1 +vim.g.vim_markdown_new_list_item_indent = 0 +vim.g.vim_markdown_no_extensions_in_markdown = 1 +vim.g.vim_markdown_toc_autofit = 1 + +-- MarkdownPreview settings +-- Get the BROWSER environment variable +local browser = os.getenv("BROWSER") +vim.g.mkdp_browser = browser or "/usr/bin/firefox" +vim.g.mkdp_echo_preview_url = 0 + +-- Save the cursor position globally to access it across different mappings +_G.saved_positions = {} + +local wk = require("which-key") +wk.add({ + mode = { "n", "v", "x" }, + { "ct", group = "Copy" }, + { "i", group = "Image" }, + { "m", group = "Markdown" }, + { "mh", group = "Headings" }, +}) + +-- bold +vim.api.nvim_buf_set_keymap( + 0, + "v", + "mb", + ":lua BoldMe()", + { noremap = true, silent = true, desc = "Bold selection" } +) + +-- copy +vim.keymap.set("n", "mcd", "4wvg$y", { desc = "Copy description" }) + +-- heading +vim.keymap.set("n", "mhi", function() + -- Save the current cursor position + local cursor_pos = vim.api.nvim_win_get_cursor(0) + -- I'm using [[ ]] to escape the special characters in a command + vim.cmd([[:g/\(^$\n\s*#\+\s.*\n^$\)/ .+1 s/^#\+\s/#&/]]) + -- Restore the cursor position + vim.api.nvim_win_set_cursor(0, cursor_pos) + -- Clear search highlight + vim.cmd("nohlsearch") +end, { desc = "Increase headings without confirmation" }) + +vim.keymap.set("n", "mhd", function() + -- Save the current cursor position + local cursor_pos = vim.api.nvim_win_get_cursor(0) + -- I'm using [[ ]] to escape the special characters in a command + vim.cmd([[:g/^\s*#\{2,}\s/ s/^#\(#\+\s.*\)/\1/]]) + -- Restore the cursor position + vim.api.nvim_win_set_cursor(0, cursor_pos) + -- Clear search highlight + vim.cmd("nohlsearch") +end, { desc = "Decrease headings without confirmation" }) +local function make_heading_content() + -- Get the total number of lines in the buffer + local total_lines = vim.api.nvim_buf_line_count(0) + + -- Iterate through all lines + for line = 1, total_lines do + -- Get the content of the current line + local line_content = vim.api.nvim_buf_get_lines(0, line - 1, line, false)[1] + -- Match headings with at least two '#' characters + local heading = line_content:match("^(##+)%s(.+)") + if heading then + -- Extract the heading text + local heading_text = line_content:match("^#+%s(.+)") + if heading_text then + -- Create the content line with markdown link syntax + local content_line = string.format("%s [%s]()", heading, heading_text) + -- Replace the current line with the modified content + vim.api.nvim_buf_set_lines(0, line - 1, line, false, { content_line }) + end + end + end + -- Notify the user that the headings have been updated + vim.notify("Headings transformed into content format", vim.log.levels.INFO) +end +vim.keymap.set("n", "mhl", make_heading_content, { desc = "Make heading content" }) + +-- line to list +vim.keymap.set( + "n", + "ml", + "^I-[]^j", + { remap = true, silent = false, desc = "Make a line into a list" } +) + +-- folding +-- Keymap for unfolding markdown headings of level 2 or above +-- Changed all the markdown folding and unfolding keymaps from mfj to +-- zj, zk, zl, z; and zu respectively lamw25wmal +vim.keymap.set("n", "zu", function() + -- vim.keymap.set("n", "mfu", function() + -- Reloads the file to reflect the changes + vim.cmd("edit!") + vim.cmd("normal! zR") -- Unfold all headings +end, { desc = "Unfold all headings level 2 or above" }) + +-- gk jummps to the markdown heading above and then folds it +-- zi by default toggles folding, but I don't need it lamw25wmal +vim.keymap.set("n", "zh", function() + -- Difference between normal and normal! + -- - `normal` executes the command and respects any mappings that might be defined. + -- - `normal!` executes the command in a "raw" mode, ignoring any mappings. + vim.cmd("normal gk") + -- This is to fold the line under the cursor + vim.cmd("normal! za") +end, { desc = "Fold the heading cursor currently on" }) + +-- Keymap for folding markdown headings of level 1 or above +vim.keymap.set("n", "zj", function() + -- vim.keymap.set("n", "mfj", function() + -- Reloads the file to refresh folds, otherwise you have to re-open neovim + vim.cmd("edit!") + -- Unfold everything first or I had issues + vim.cmd("normal! zR") + fold_markdown_headings({ 6, 5, 4, 3, 2, 1 }) +end, { desc = "Fold all headings level 1 or above" }) + +-- Keymap for folding markdown headings of level 2 or above +-- I know, it reads like "madafaka" but "k" for me means "2" +vim.keymap.set("n", "zk", function() + -- vim.keymap.set("n", "mfk", function() + -- Reloads the file to refresh folds, otherwise you have to re-open neovim + vim.cmd("edit!") + -- Unfold everything first or I had issues + vim.cmd("normal! zR") + fold_markdown_headings({ 6, 5, 4, 3, 2 }) +end, { desc = "Fold all headings level 2 or above" }) + +-- Keymap for folding markdown headings of level 3 or above +vim.keymap.set("n", "zl", function() + -- vim.keymap.set("n", "mfl", function() + -- Reloads the file to refresh folds, otherwise you have to re-open neovim + vim.cmd("edit!") + -- Unfold everything first or I had issues + vim.cmd("normal! zR") + fold_markdown_headings({ 6, 5, 4, 3 }) +end, { desc = "Fold all headings level 3 or above" }) + +-- Keymap for folding markdown headings of level 4 or above +vim.keymap.set("n", "z;", function() + -- vim.keymap.set("n", "mf;", function() + -- Reloads the file to refresh folds, otherwise you have to re-open neovim + vim.cmd("edit!") + -- Unfold everything first or I had issues + vim.cmd("normal! zR") + fold_markdown_headings({ 6, 5, 4 }) +end, { desc = "Fold all headings level 4 or above" }) + +-- link text objects for i and a +vim.keymap.set( + { "o", "x" }, + "il", + "lua require('various-textobjs').mdlink('inner')", + { buffer = true, desc = "Link" } +) +vim.keymap.set( + { "o", "x" }, + "al", + "lua require('various-textobjs').mdlink('outer')", + { buffer = true, desc = "Link" } +) + +-- preview +vim.keymap.set("n", "mp", ":MarkdownPreview", { desc = "Markdown preview" }) + +-- traversal +vim.keymap.set("n", "", "Markdown_Fold", { desc = "Tab is for moving around only" }) + +vim.keymap.set("n", "]]", "Markdown_MoveToNextHeader", { desc = "Go to next header" }) +vim.keymap.set("n", "[[", "Markdown_MoveToPreviousHeader", { desc = "Go to previous header. Contrast with ]c" }) +vim.keymap.set("n", "][", "Markdown_MoveToNextSiblingHeader", { desc = "Go to next sibling header if any" }) +vim.keymap.set( + "n", + "[]", + "Markdown_MoveToPreviousSiblingHeader", + { desc = "Go to previous sibling header if any" } +) +vim.keymap.set("n", "]c", "Markdown_MoveToCurHeader", { desc = "Go to Current header" }) +vim.keymap.set("n", "]u", "Markdown_MoveToParentHeader", { desc = "Go to parent header (Up)" }) +vim.keymap.set("n", "", "Markdown_Checkbox", { desc = "Toggle checkboxes" }) +vim.keymap.set("n", "Tab", "Markdown_Fold", { desc = "Fold headers/lists" }) +vim.keymap.set("n", "Return", "Markdown_FollowLink", { desc = "Follow links" }) +vim.keymap.set("i", "Tab", "Markdown_Jump", { desc = "Indent new bullets, jump through empty fields in links" }) +vim.keymap.set({ "i", "v" }, "", "Markdown_CreateLink", { desc = "Create new links" }) +vim.keymap.set("i", "", "Markdown_NewLineAbove", { desc = "New line above, overrides default" }) +vim.keymap.set("i", "", "Markdown_NewLineBelow", { desc = "New line below, overrides default" }) +vim.keymap.set("i", "Return", "Markdown_NewLineBelow", { desc = "New line below, overrides default" }) +-- jump to the first line of the TOC +vim.keymap.set("n", "mm", function() + -- Save the current cursor position + _G.saved_positions["toc_return"] = vim.api.nvim_win_get_cursor(0) + -- Perform a silent search for the marker and move the cursor two lines below it + vim.cmd("silent! /\\n\\n\\zs.*") + -- Clear the search highlight without showing the "search hit BOTTOM, continuing at TOP" message + vim.cmd("nohlsearch") + -- Retrieve the current cursor position (after moving to the TOC) + local cursor_pos = vim.api.nvim_win_get_cursor(0) + local row = cursor_pos[1] + -- local col = cursor_pos[2] + -- Move the cursor to column 15 (starts counting at 0) + -- I like just going down on the TOC and press gd to go to a section + vim.api.nvim_win_set_cursor(0, { row, 14 }) +end, { desc = "Jump to the first line of the TOC" }) +-- return to the previously saved cursor position +vim.keymap.set("n", "mn", function() + local pos = _G.saved_positions["toc_return"] + if pos then + vim.api.nvim_win_set_cursor(0, pos) + end +end, { desc = "Return to position before jumping" }) + +-- TOC (english) +vim.keymap.set("n", "mt", function() + update_markdown_toc("## Contents", "### Table of contents") +end, { desc = "Insert/update Markdown TOC (English)" }) diff --git a/ar/.config/TheSiahxyz/ftplugin/quarto.lua b/ar/.config/TheSiahxyz/ftplugin/quarto.lua new file mode 100644 index 0000000..92e0025 --- /dev/null +++ b/ar/.config/TheSiahxyz/ftplugin/quarto.lua @@ -0,0 +1,6 @@ +-- set some options for quarto files, but they're set on the window, so they'll apply to other +-- buffers too +vim.wo.linebreak = true +vim.wo.breakindent = true +vim.wo.showbreak = "|" +vim.wo.conceallevel = 0 diff --git a/ar/.config/TheSiahxyz/init.lua b/ar/.config/TheSiahxyz/init.lua new file mode 100644 index 0000000..caa926e --- /dev/null +++ b/ar/.config/TheSiahxyz/init.lua @@ -0,0 +1 @@ +require("thesiahxyz") diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/core/autocmds.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/core/autocmds.lua new file mode 100644 index 0000000..10c1085 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/core/autocmds.lua @@ -0,0 +1,381 @@ +local function augroup(name) + return vim.api.nvim_create_augroup("TheSiahxyz_" .. name, { clear = true }) +end + +local autocmd = vim.api.nvim_create_autocmd + +-- Change the color of symlink files to distinguish between directory and symlink files +autocmd("FileType", { + group = augroup("highlight_linked_files"), + pattern = "netrw", + callback = function() + vim.cmd("highlight NetrwSymlink guifg=#689D6A ctermfg=214") + end, +}) + +-- Check if we need to reload the file when it changed +autocmd({ "FocusGained", "TermClose", "TermLeave" }, { + group = augroup("check_time"), + callback = function() + if vim.o.buftype ~= "nofile" then + vim.cmd("checktime") + end + end, +}) + +-- Highlight on yank +autocmd("TextYankPost", { + group = augroup("highlight_yank"), + callback = function() + vim.highlight.on_yank() + end, +}) + +-- resize splits if window got resized +autocmd({ "VimResized" }, { + group = augroup("window_config"), + callback = function() + local current_tab = vim.fn.tabpagenr() + vim.cmd("tabdo wincmd =") + vim.cmd("tabnext " .. current_tab) + end, +}) + +-- go to last loc when opening a buffer +autocmd("BufReadPost", { + group = augroup("last_loc"), + callback = function(event) + local exclude = { "gitcommit" } + local buf = event.buf + if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].thesiahxyz_last_loc then + return + end + vim.b[buf].thesiahxyz_last_loc = true + local mark = vim.api.nvim_buf_get_mark(buf, '"') + local lcount = vim.api.nvim_buf_line_count(buf) + if mark[1] > 0 and mark[1] <= lcount then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, +}) + +-- close some filetypes with +autocmd("FileType", { + group = augroup("close_with_q"), + pattern = { + "checkhealth", + "help", + "lspinfo", + "neotest-output", + "neotest-output-panel", + "neotest-summary", + "notify", + "PlenaryTestPopup", + "qf", + "query", + "spectre_panel", + "startuptime", + "terminal", + "tsplayground", + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, +}) +autocmd("FileType", { + group = augroup("q_as_bd"), + pattern = "netrw", + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", function() + vim.cmd("bd") + end, { buffer = event.buf, silent = true }) + end, +}) + +-- Start insert mode in terminal +autocmd("TermOpen", { + group = augroup("terminal"), + pattern = "*", + callback = function() + vim.cmd("startinsert") + end, +}) + +-- Make it easier to close man-files when opened inline +autocmd("FileType", { + group = augroup("man_close"), + pattern = { "man" }, + callback = function(event) + vim.bo[event.buf].buflisted = false + end, +}) + +-- Wrap and check for spell in text filetypes +autocmd("FileType", { + group = augroup("wrap_spell"), + pattern = { "text", "plaintex", "typst", "gitcommit", "markdown" }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + vim.opt_local.spelllang = { "en", "cjk" } + vim.opt_local.spellsuggest = { "best", "9" } + end, +}) + +-- Fix conceallevel for json files +autocmd({ "FileType" }, { + group = augroup("json_config"), + pattern = { "json", "jsonc", "json5" }, + callback = function() + vim.opt_local.conceallevel = 0 + end, +}) + +-- Auto create dir when saving a file, in case some intermediate directory does not exist +autocmd({ "BufWritePre" }, { + group = augroup("create_dir"), + callback = function(event) + if event.match:match("^%w%w+:[\\/][\\/]") then + return + end + local file = vim.uv.fs_realpath(event.match) or event.match + vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") + end, +}) + +-- Automatically delete all trailing whitespace and newlines at end of file on save +local file_save = augroup("file_save") +autocmd("BufWritePre", { + group = file_save, + pattern = "*", + callback = function() + -- Remove trailing spaces + vim.cmd([[ %s/\s\+$//e ]]) + -- Remove trailing newlines + vim.cmd([[ %s/\n\+\%$//e ]]) + end, +}) + +-- Add a trailing newline for C files +autocmd("BufWritePre", { + group = file_save, + pattern = "*.[ch]", + callback = function() + vim.cmd([[ %s/\%$/\r/e ]]) + end, +}) + +-- Correct email signature delimiter in neomutt files +autocmd("BufWritePre", { + group = file_save, + pattern = "*neomutt*", + callback = function() + vim.cmd([[ %s/^--$/-- /e ]]) + end, +}) + +local function organize_imports() + local params = { + command = "pyright.organizeimports", + arguments = { vim.uri_from_bufnr(0) }, + } + vim.lsp.buf.execute_command(params) +end + +autocmd("LspAttach", { + group = augroup("lsp_attach"), + callback = function(e) + local client = vim.lsp.get_client_by_id(e.data.client_id) + if client and client.name == "pyright" then + vim.api.nvim_create_user_command( + "PyrightOrganizeImports", + organize_imports, + { desc = "Organize imports (lsp)" } + ) + end + vim.keymap.set("n", "gD", function() + vim.lsp.buf.definition() + end, { buffer = e.buf, desc = "Go to definition (lsp)" }) + vim.keymap.set("n", "K", function() + vim.lsp.buf.hover() + end, { buffer = e.buf, desc = "Go to keywords (lsp)" }) + vim.keymap.set("n", "ls", function() + vim.lsp.buf.workspace_symbol() + end, { buffer = e.buf, desc = "Workspace symbol (lsp)" }) + vim.keymap.set("n", "lo", function() + vim.diagnostic.open_float() + end, { buffer = e.buf, desc = "Open diagnostic" }) + vim.keymap.set("n", "lc", function() + vim.lsp.buf.code_action() + end, { buffer = e.buf, desc = "Code action (lsp)" }) + vim.keymap.set("n", "lr", function() + vim.lsp.buf.references() + end, { buffer = e.buf, desc = "References (lsp)" }) + vim.keymap.set("n", "ln", function() + vim.lsp.buf.rename() + end, { buffer = e.buf, desc = "Rename (lsp)" }) + vim.keymap.set("n", "lh", function() + vim.lsp.buf.signature_help() + end, { buffer = e.buf, desc = "Signature help (lsp)" }) + vim.keymap.set("n", "]d", function() + vim.diagnostic.goto_next() + end, { buffer = e.buf, desc = "Next diagnostic" }) + vim.keymap.set("n", "[d", function() + vim.diagnostic.goto_prev() + end, { buffer = e.buf, desc = "Previous diagnostic" }) + end, +}) + +-- Save file as sudo on files that require root permission +vim.api.nvim_create_user_command("SudoWrite", function() + vim.cmd([[ + write !sudo tee % 2>/dev/null + edit! + ]]) +end, {}) +vim.api.nvim_create_user_command("SudoWritequit", function() + vim.cmd([[ + write !sudo tee % 2>/dev/null + edit! + quit! + ]]) +end, {}) + +-- Markdown for specific files and directories +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "/tmp/calcurse*", "~/.calcurse/notes/*" }, + command = "set filetype=markdown", +}) + +-- Groff for specific file extensions +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "*.ms", "*.me", "*.mom", "*.man" }, + callback = function() + vim.cmd([[ + set columns=90 + set filetype=groff + set linebreak + set textwidth=0 + set wrap + set wrapmargin=0 + ]]) + end, +}) + +-- TeX for .tex files +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "*.tex" }, + command = "set filetype=tex", +}) + +-- When shortcut files are updated, renew bash and lf configs with new material: +vim.api.nvim_create_autocmd("BufWritePost", { + group = augroup("bookmarks"), + pattern = { "bm-files", "bm-dirs" }, + callback = function() + -- Execute the 'shortcuts' shell command + local result = vim.fn.system("shortcuts") + -- Display an error message only if the 'shortcuts' command fails + if vim.v.shell_error ~= 0 then + -- Display an error message if the 'shortcuts' command fails + vim.api.nvim_echo({ { "failed to update shortcuts: " .. result, "ErrorMsg" } }, true, {}) + end + end, +}) + +-- Source lfrc if it's edited +local lf_config = augroup("lf_config") +vim.api.nvim_create_autocmd("BufWritePost", { + group = lf_config, + pattern = { "lfrc" }, + callback = function() + vim.cmd("silent !source ~/.config/lf/lfrc") + end, +}) + +-- Run xrdb whenever Xdefaults or Xresources are updated. +local x_config = augroup("x_config") +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + group = x_config, + pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, + callback = function() + vim.bo.filetype = "xdefaults" + end, +}) +vim.api.nvim_create_autocmd("BufWritePost", { + group = x_config, + pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, + callback = function() + vim.cmd("silent !xrdb %") + end, +}) + +-- Recompile suckless programs on config edit. +local home = os.getenv("HOME") +local suckless_config = vim.api.nvim_create_augroup("suckless_config", { clear = true }) + +vim.api.nvim_create_autocmd("BufWritePost", { + group = suckless_config, + pattern = home .. "/.local/src/suckless/dmenu/config.h", + callback = function() + vim.cmd("silent !cd " .. home .. "/.local/src/suckless/dmenu/ && sudo make install") + end, +}) + +vim.api.nvim_create_autocmd("BufWritePost", { + group = suckless_config, + pattern = home .. "/.local/src/suckless/dwmblocks/config.h", + callback = function() + vim.cmd( + "silent !cd " + .. home + .. "/.local/src/suckless/dwmblocks/ && sudo make install && { killall -q dwmblocks; setsid -f dwmblocks; }" + ) + end, +}) + +vim.api.nvim_create_autocmd("BufWritePost", { + group = suckless_config, + pattern = home .. "/.local/src/suckless/slock/config.h", + callback = function() + vim.cmd("silent !cd " .. home .. "/.local/src/suckless/slock/ && sudo make install") + end, +}) + +local suckless_keys = augroup("suckless_keys") +vim.api.nvim_create_autocmd("BufWritePost", { + group = suckless_keys, + pattern = home .. "/.local/src/suckless/dwm/config.h", + callback = function() + vim.cmd("silent !" .. home .. "/.local/bin/extractkeys") + end, +}) + +vim.api.nvim_create_autocmd("BufWritePost", { + group = suckless_keys, + pattern = home .. "/.local/src/suckless/st/config.h", + callback = function() + vim.cmd("silent !" .. home .. "/.local/bin/extractkeys") + end, +}) + +vim.api.nvim_create_autocmd("BufWritePost", { + group = augroup("suckless_doc"), + pattern = home .. "/.local/src/suckless/dwm/thesiah-default.mom", + callback = function() + vim.cmd("silent !cd " .. home .. "/.local/src/suckless/dwm/ && rm -f thesiah.mom") + end, +}) + +vim.api.nvim_create_autocmd({ "BufRead", "BufEnter" }, { + pattern = { "*.c", "*.cpp", "*.h", "*.hpp" }, + callback = function() + local suckless_path = vim.fn.expand("~/.local/src/suckless"):gsub("/+$", "") + local file_path = vim.fn.expand("%:p"):gsub("/+$", "") + if file_path:sub(1, #suckless_path) == suckless_path then + vim.b.autoformat = false + end + end, +}) diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/core/keymaps.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/core/keymaps.lua new file mode 100644 index 0000000..162b71a --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/core/keymaps.lua @@ -0,0 +1,806 @@ +-- Init leader Keys +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Ascii +vim.keymap.set("n", "a1", ":.!toilet -w 200 -f bfraktur", { desc = "Ascii art bfraktur" }) +vim.keymap.set("n", "a2", ":.!toilet -w 200 -f emboss", { desc = "Ascii art emboss" }) +vim.keymap.set("n", "a3", ":.!toilet -w 200 -f emboss2", { desc = "Ascii art emboss2" }) +vim.keymap.set("n", "a4", ":.!toilet -w 200 -f future", { desc = "Ascii art future" }) +vim.keymap.set("n", "a5", ":.!toilet -w 200 -f pagga", { desc = "Ascii art pagga" }) +vim.keymap.set("n", "a6", ":.!toilet -w 200 -f wideterm", { desc = "Ascii art wideterm" }) +vim.keymap.set("n", "a7", ":.!figlet -w 200 -f standard", { desc = "Ascii art standard" }) +vim.keymap.set("n", "a8", ":.!figlet -w 200 -f slant", { desc = "Ascii art slant" }) +vim.keymap.set("n", "a9", ":.!figlet -w 200 -f big", { desc = "Ascii art big" }) +vim.keymap.set("n", "a0", ":.!figlet -w 200 -f shadow", { desc = "Ascii art shadow" }) + +-- Buffers +vim.keymap.set({ "n", "v", "x", "t" }, "", "bd!", { desc = "Delete buffer" }) +vim.keymap.set({ "i", "n", "t" }, "", "bprevious", { desc = "Previous buffer" }) +vim.keymap.set({ "i", "n", "t" }, "", "bnext", { desc = "Next buffer" }) +vim.keymap.set({ "n", "t" }, "", "bprevious", { desc = "Previous buffer" }) +vim.keymap.set({ "n", "t" }, "", "bnext", { desc = "Next buffer" }) +vim.keymap.set("n", "", "e #", { desc = "Switch to last buffer" }) +vim.keymap.set({ "n", "v", "x", "t" }, "bd", ":bd", { desc = "Close buffer" }) +vim.keymap.set({ "n", "v", "x", "t" }, "BD", ":bd!", { desc = "Force close buffer" }) +vim.keymap.set("n", "bn", "enew", { desc = "New buffer" }) +vim.keymap.set({ "i", "x", "n", "s" }, "", "w", { desc = "Save current buffer" }) +vim.keymap.set({ "n", "v" }, "wq", "wq", { desc = "Save current buffer and quit" }) +vim.keymap.set({ "n", "v" }, "WQ", "wqa", { desc = "Save all buffers and quit" }) +vim.keymap.set({ "n", "v" }, "qq", "q!", { desc = "Force quit" }) +vim.keymap.set({ "n", "v" }, "QQ", "qa!", { desc = "Force quit all" }) +vim.keymap.set("n", "rn", function() + local current_name = vim.fn.expand("%:p") -- Get the full path of the current file + local directory = vim.fn.expand("%:p:h") -- Get the directory of the current file + local new_name = vim.fn.input("New filename: ", directory .. "/") -- Prompt for the new name + if new_name == "" or new_name == current_name then + return -- Do nothing if no input or name hasn't changed + end + vim.cmd("silent !mv " .. vim.fn.shellescape(current_name) .. " " .. vim.fn.shellescape(new_name)) + vim.cmd("edit " .. vim.fn.fnameescape(new_name)) + vim.cmd("bdelete " .. vim.fn.bufnr(current_name)) +end, { noremap = true, silent = true, desc = "Rename file" }) +vim.keymap.set("n", "ms", function() + vim.cmd("new | put=execute('messages') | setlocal buftype=nofile") + local buf = vim.api.nvim_get_current_buf() + local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false) + local filtered_lines = {} + for _, line in ipairs(lines) do + local trimmed_line = line:match("^%s*(.-)%s*$") -- Remove leading and trailing whitespace + if trimmed_line ~= "" then + table.insert(filtered_lines, trimmed_line) -- Only add non-empty lines + end + end + vim.fn.setreg('"', table.concat(filtered_lines, "\n")) + vim.api.nvim_buf_set_lines(buf, 0, -1, false, filtered_lines) + vim.keymap.set("n", "q", function() + vim.api.nvim_buf_delete(buf, { force = true }) + end, { buffer = buf, desc = "Close message buffer" }) +end, { desc = "Open messages, trim, and copy content" }) + +-- Cd +vim.keymap.set("n", "gcd", ":cd %:p:h:pwd", { desc = "Go to current file path" }) +vim.keymap.set("n", "gcD", function() + local realpath = vim.fn.systemlist("readlink -f " .. vim.fn.shellescape(vim.fn.expand("%:p")))[1] + vim.cmd("cd " .. vim.fn.fnameescape(vim.fn.fnamemodify(realpath, ":h"))) + vim.cmd("pwd") +end, { desc = "Go to real path of current file" }) +vim.keymap.set("n", "gc.", ":cd ..:pwd", { desc = "Go to current file path" }) + +-- Check health +vim.keymap.set("n", "ch", ":checkhealth", { desc = "Check neovim health" }) + +-- Clear search with +vim.keymap.set({ "i", "n" }, "", "noh", { desc = "Clear search highlights" }) + +-- Clear search / diff update / redraw +vim.keymap.set( + "n", + "R", + "nohlsearchdiffupdatenormal! ", + { desc = "Redraw / Clear hlsearch / Diff Update" } +) + +-- Copy +vim.keymap.set("n", "cp", function() + local filepath = vim.fn.expand("%") -- Get the current filepath + local filename = vim.fn.expand("%:t") -- Get the current filename + local file_root = vim.fn.expand("%:r") -- Get the file root (without extension) + local file_ext = vim.fn.expand("%:e") -- Get the file extension + local new_filename = file_root .. "_copied" -- Start with the base for new filename + local num = 1 + while vim.fn.filereadable(new_filename .. "." .. file_ext) == 1 do + new_filename = file_root .. "_copied_" .. num + num = num + 1 + end + new_filename = new_filename .. "." .. file_ext + local cmd = "cp " .. filepath .. " " .. new_filename + + -- Wrap input in pcall to handle Ctrl-c interruptions + local ok, confirm = pcall(vim.fn.input, 'Do you want to copy "' .. filename .. '"? (y/n): ') + + -- If interrupted (Ctrl-c), return silently + if not ok or confirm == nil or confirm == "" then + return + end + + -- Handle positive confirmation + if confirm:lower() == "y" or confirm:lower() == "yes" then + vim.cmd("silent !" .. cmd) + vim.cmd("silent edit " .. new_filename) + end +end, { silent = true, desc = "Copy current file" }) +vim.keymap.set( + "n", + "cP", + ':let @+ = expand("%:p"):lua print("Copied path to: " .. vim.fn.expand("%:p"))', + { desc = "Copy current file name and path" } +) + +-- Cut, Yank & Paste +vim.keymap.set({ "n", "v" }, "y", [["+y]], { desc = "Yank to clipboard" }) +vim.keymap.set("n", "Y", [["+Y]], { desc = "Yank line to clipboard" }) +vim.keymap.set({ "n", "v" }, "", ":%y", { desc = "Yank current file to clipboard" }) +vim.keymap.set({ "n", "v", "x" }, "pp", [["+p]], { desc = "Paste from clipboard after cursor" }) +vim.keymap.set({ "n", "v", "x" }, "PP", [["+P]], { desc = "Paste from clipboard before cursor" }) +vim.keymap.set({ "n", "v", "x" }, "pP", [["_dP]], { desc = "Paste over and preserve clipboard" }) +vim.keymap.set({ "n", "v" }, "dd", [["+d]], { desc = "Delete and yank to clipboard" }) +vim.keymap.set({ "n", "v" }, "DD", [["_d]], { desc = "Delete without storing in clipboard" }) +vim.keymap.set("n", "", ":%d_", { desc = "Delete all to black hole register" }) + +-- Diagnostic +local diagnostic_goto = function(next, severity) + local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev + severity = severity and vim.diagnostic.severity[severity] or nil + return function() + go({ severity = severity }) + end +end +-- vim.keymap.set("n", "[d", diagnostic_goto(false), { desc = "Previous diagnostic" }) +-- vim.keymap.set("n", "]d", diagnostic_goto(true), { desc = "Next diagnostic" }) +vim.keymap.set("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Previous error" }) +vim.keymap.set("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next error" }) +vim.keymap.set("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Previous warning" }) +vim.keymap.set("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next warning" }) +vim.keymap.set("n", "od", vim.diagnostic.open_float, { desc = "Open diagnostic message" }) +vim.keymap.set("n", "la", vim.diagnostic.setloclist, { desc = "Add diagnostics to location list" }) + +-- Disable +vim.keymap.set("n", "Q", "", { desc = "Disable q command" }) + +-- Explore +vim.keymap.set("n", "ex", vim.cmd.Ex, { desc = "Open explorer" }) +vim.keymap.set("n", "es", vim.cmd.Sex, { desc = "Open explorer (horizontal split)" }) +vim.keymap.set("n", "ev", vim.cmd.Vex, { desc = "Open explorer (vertical split)" }) +vim.keymap.set("n", "qe", function() + if vim.bo.filetype == "netrw" then + vim.cmd("bd") + end +end, { desc = "Close explorer (netrw)" }) + +-- Files +vim.keymap.set("n", "fn", "enew", { desc = "Open new buffer" }) + +-- Fix List & Trouble +vim.keymap.set("n", "[o", "lprevzz", { desc = "Previous location" }) +vim.keymap.set("n", "]o", "lnextzz", { desc = "Next location" }) +vim.keymap.set("n", "[q", "cprevzz", { desc = "Previous quickfix" }) +vim.keymap.set("n", "]q", "cnextzz", { desc = "Next quickfix" }) +vim.keymap.set( + "n", + "rw", + [[:%s/\<\>//gI]], + { desc = "Search and replace word under cursor" } +) +vim.keymap.set("n", "oo", "lopen", { desc = "Open location list" }) +vim.keymap.set("n", "oq", "copen", { desc = "Open quickfix list" }) + +-- Formats +vim.keymap.set("n", "cF", vim.lsp.buf.format, { desc = "Format buffer by default lsp" }) + +-- Git +-- create repository +vim.keymap.set("n", "gR", function() + -- Check if GitHub CLI is installed + local gh_installed = vim.fn.system("command -v gh") + if gh_installed == "" then + print("GitHub CLI is not installed. Please install it using 'brew install gh'.") + return + end + -- Get the current working directory and extract the repository name + local cwd = vim.fn.getcwd() + local repo_name = vim.fn.fnamemodify(cwd, ":t") + if repo_name == "" then + print("Failed to extract repository name from the current directory.") + return + end + -- Display the message and ask for confirmation + local confirmation = vim.fn.input('The name of the repo will be: "' .. repo_name .. '"\nType "yes" to continue: ') + if confirmation:lower() ~= "yes" then + print("Operation canceled.") + return + end + -- Check if the repository already exists on GitHub + local check_repo_command = + string.format("gh repo view %s/%s", vim.fn.system("gh api user --jq '.login'"):gsub("%s+", ""), repo_name) + local check_repo_result = vim.fn.systemlist(check_repo_command) + if not string.find(table.concat(check_repo_result), "Could not resolve to a Repository") then + print("Repository '" .. repo_name .. "' already exists on GitHub.") + return + end + -- Prompt for repository type + local repo_type = vim.fn.input("Enter the repository type (private/public): "):lower() + if repo_type ~= "private" and repo_type ~= "public" then + print("Invalid repository type. Please enter 'private' or 'public'.") + return + end + -- Set the repository type flag + local repo_type_flag = repo_type == "private" and "--private" or "--public" + -- Initialize the git repository and create the GitHub repository + local init_command = string.format("cd %s && git init", vim.fn.shellescape(cwd)) + vim.fn.system(init_command) + local create_command = + string.format("cd %s && gh repo create %s %s --source=.", vim.fn.shellescape(cwd), repo_name, repo_type_flag) + local create_result = vim.fn.system(create_command) + -- Print the result of the repository creation command + if string.find(create_result, "https://github.com") then + print("Repository '" .. repo_name .. "' created successfully.") + else + print("Failed to create the repository: " .. create_result) + end +end, { desc = "Create GitHub repository" }) +-- open repository +local function open_github_link(use_root) + -- Get the full path of the current file + local file_path = vim.fn.expand("%:p") + if file_path == "" then + print("No file is currently open") + return + end + + -- Get the Git repository root + local git_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1] + if not git_root or git_root == "" then + print("Could not determine the root directory for the GitHub repository") + return + end + + -- Get the origin URL of the repository + local origin_url = vim.fn.systemlist("git config --get remote.origin.url")[1] + if not origin_url or origin_url == "" then + print("Could not determine the origin URL for the GitHub repository") + return + end + + -- Get the current branch name + local branch_name = vim.fn.systemlist("git rev-parse --abbrev-ref HEAD")[1] + if not branch_name or branch_name == "" then + print("Could not determine the current branch name") + return + end + + -- Convert the origin URL to a GitHub HTTPS URL + local repo_url = origin_url:gsub("git@github.com:", "https://github.com/"):gsub("%.git$", "") + + local github_url + if use_root then + -- Use the root repository URL + github_url = repo_url + else + -- Generate the link for the current file + local relative_path = file_path:sub(#git_root + 2) -- Extract the relative path + github_url = repo_url .. "/blob/" .. branch_name .. "/" .. relative_path + end + + -- Open the URL in the default browser + local command = "xdg-open " .. vim.fn.shellescape(github_url) + vim.fn.system(command) + + -- Print the opened URL + print("Opened GitHub link: " .. github_url) +end + +-- Keybinding for opening the current file link +vim.keymap.set("n", "go", function() + open_github_link(false) -- Use the current file link +end, { desc = "Open GitHub link for the current file" }) + +-- Keybinding for opening the repository root link +vim.keymap.set("n", "gO", function() + open_github_link(true) -- Use the root repository URL +end, { desc = "Open GitHub repository root" }) + +-- paste a github link and add it in this format +vim.keymap.set({ "n", "v", "i" }, "", function() + -- Insert the text in the desired format + vim.cmd('normal! a[](){:target="_blank"} ') + vim.cmd("normal! F(pv2F/lyF[p") + -- Leave me in normal mode or command mode + vim.cmd("stopinsert") +end, { desc = "Paste github link" }) + +-- Health +vim.keymap.set("n", "ch", ":checkhealth", { desc = "Check neovim health" }) + +-- Highlights under cursor +vim.keymap.set("n", "ip", vim.show_pos, { desc = "Inspect position" }) + +-- Keywordprg +vim.keymap.set("n", "K", "norm! K", { desc = "Look up keyword" }) + +-- Lines +-- vim.keymap.set("n", "", "m .-2==", { desc = "Move line up" }) +-- vim.keymap.set("n", "", "m .+1==", { desc = "Move line down" }) +vim.keymap.set( + "i", + "", + "m .-2==gi", + { noremap = true, silent = true, desc = "Move line up in insert mode" } +) +vim.keymap.set( + "i", + "", + "m .+1==gi", + { noremap = true, silent = true, desc = "Move line down in insert mode" } +) +vim.keymap.set("v", "", ":m '<-2gv=gv", { desc = "Move selected lines up" }) +vim.keymap.set("v", "", ":m '>+1gv=gv", { desc = "Move selected lines down" }) + +-- Markdown +vim.keymap.set({ "n", "v" }, "gk", function() + -- `?` - Start a search backwards from the current cursor position. + -- `^` - Match the beginning of a line. + -- `##` - Match 2 ## symbols + -- `\\+` - Match one or more occurrences of prev element (#) + -- `\\s` - Match exactly one whitespace character following the hashes + -- `.*` - Match any characters (except newline) following the space + -- `$` - Match extends to end of line + vim.cmd("silent! ?^##\\+\\s.*$") + -- Clear the search highlight + vim.cmd("nohlsearch") +end, { desc = "Go to previous markdown header" }) +vim.keymap.set({ "n", "v" }, "gj", function() + -- `/` - Start a search forwards from the current cursor position. + -- `^` - Match the beginning of a line. + -- `##` - Match 2 ## symbols + -- `\\+` - Match one or more occurrences of prev element (#) + -- `\\s` - Match exactly one whitespace character following the hashes + -- `.*` - Match any characters (except newline) following the space + -- `$` - Match extends to end of line + vim.cmd("silent! /^##\\+\\s.*$") + -- Clear the search highlight + vim.cmd("nohlsearch") +end, { desc = "Go to next markdown header" }) + +-- Marks +vim.keymap.set("n", "mD", function() + -- Delete all marks in the current buffer + vim.cmd("delmarks!") + print("All marks deleted.") +end, { desc = "Delete all marks" }) + +-- Ownerships +vim.keymap.set("n", "cx", "!chmod +x %", { silent = true, desc = "Make file executable" }) + +-- Remap Default +vim.keymap.set("i", "jk", "", { noremap = true, silent = true, desc = "Escape to normal mode" }) +vim.keymap.set("i", "", "", { noremap = true, silent = true, desc = "Escape to normal mode" }) +vim.keymap.set("i", "", "", { noremap = true, silent = true, desc = "Insert at beginning of line" }) +vim.keymap.set("i", "", "", { noremap = true, silent = true, desc = "Move to end of line" }) +vim.keymap.set("i", "", "", { noremap = true, silent = true, desc = "Move left" }) +vim.keymap.set("i", "", "", { noremap = true, silent = true, desc = "Move right" }) +vim.keymap.set("i", "", "", { noremap = true, silent = true, desc = "Move down" }) +vim.keymap.set("i", "", "", { noremap = true, silent = true, desc = "Move up" }) +vim.keymap.set("i", "", "", { noremap = true, silent = true, desc = "New line above" }) +vim.keymap.set("i", "", "", { noremap = true, silent = true, desc = "New line below" }) +vim.keymap.set("n", "", ":", { noremap = true, desc = "Enter command mode" }) +vim.keymap.set("n", "J", "mzJ`z", { noremap = true, desc = "Join lines and keep cursor position" }) +vim.keymap.set("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result and center" }) +vim.keymap.set("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result in visual mode" }) +vim.keymap.set("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result in operator-pending mode" }) +vim.keymap.set("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Previous search result and center" }) +vim.keymap.set("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Previous search result in visual mode" }) +vim.keymap.set( + "o", + "N", + "'nN'[v:searchforward]", + { expr = true, desc = "Previous search result in operator-pending mode" } +) +vim.keymap.set("n", "x", '"_x', { desc = "Delete character without yanking" }) +local scroll_percentage = 0.50 +vim.keymap.set("n", "", function() + local lines = math.floor(vim.api.nvim_win_get_height(0) * scroll_percentage) + vim.cmd("normal! " .. lines .. "jzz") +end, { noremap = true, silent = true, desc = "Scroll down and center" }) +vim.keymap.set("n", "", function() + local lines = math.floor(vim.api.nvim_win_get_height(0) * scroll_percentage) + vim.cmd("normal! " .. lines .. "kzz") +end, { noremap = true, silent = true, desc = "Scroll up and center" }) +-- vim.keymap.set("n", "", "zz", { noremap = true, silent = true, desc = "Scroll down and center" }) +-- vim.keymap.set("n", "", "zz", { noremap = true, silent = true, desc = "Scroll up and center" }) +vim.keymap.set("n", "", "zz", { noremap = true, silent = true, desc = "Page up and center" }) +vim.keymap.set("n", "", "zz", { noremap = true, silent = true, desc = "Page down and center" }) +vim.keymap.set("n", "{", "{zz", { noremap = true, silent = true, desc = "Move to previous paragraph and center" }) +vim.keymap.set("n", "}", "}zz", { noremap = true, silent = true, desc = "Move to next paragraph and center" }) +vim.keymap.set("n", "G", "Gzz", { noremap = true, silent = true, desc = "Go to bottom of file and center" }) +vim.keymap.set("n", "gg", "ggzz", { noremap = true, silent = true, desc = "Go to top of file and center" }) +vim.keymap.set("n", "gd", "gdzz", { noremap = true, silent = true, desc = "Go to definition and center" }) +vim.keymap.set("n", "", "zz", { noremap = true, silent = true, desc = "Jump forward in jumplist and center" }) +vim.keymap.set( + "n", + "", + "zz", + { noremap = true, silent = true, desc = "Jump backward in jumplist and center" } +) +vim.keymap.set( + "n", + "%", + "%zz", + { noremap = true, silent = true, desc = "Jump to matching pair (e.g. brackets) and center" } +) +vim.keymap.set( + "n", + "*", + "*zz", + { noremap = true, silent = true, desc = "Search for next occurrence of word under cursor and center" } +) +vim.keymap.set( + "n", + "#", + "#zz", + { noremap = true, silent = true, desc = "Search for previous occurrence of word under cursor and center" } +) + +vim.keymap.set( + { "n", "x" }, + "j", + "v:count == 0 ? 'gj' : 'j'", + { expr = true, silent = true, desc = "Move down (visual line)" } +) +vim.keymap.set( + { "n", "x" }, + "", + "v:count == 0 ? 'gj' : 'j'", + { expr = true, silent = true, desc = "Move down (visual line)" } +) +vim.keymap.set( + { "n", "x" }, + "k", + "v:count == 0 ? 'gk' : 'k'", + { expr = true, silent = true, desc = "Move up (visual line)" } +) +vim.keymap.set( + { "n", "x" }, + "", + "v:count == 0 ? 'gk' : 'k'", + { expr = true, silent = true, desc = "Move up (visual line)" } +) +vim.keymap.set("v", "<", "", ">gv", { desc = "Indent right and stay in visual mode" }) +vim.keymap.set("v", "J", ":m '>+1gv=gv", { desc = "Move line down in visual mode" }) +vim.keymap.set("v", "K", ":m '<-2gv=gv", { desc = "Move line up in visual mode" }) +vim.keymap.set("n", "sl", "vg_", { desc = "Select to end of line" }) +vim.keymap.set("n", "sp", "ggVGp", { desc = "Select all and paste" }) +vim.keymap.set("n", "sv", "ggVG", { desc = "Select all" }) +vim.keymap.set("n", "gp", "`[v`]", { desc = "Select pasted text" }) +vim.keymap.set("n", "ss", ":s/\\v", { desc = "Search and replace on line" }) +vim.keymap.set("n", "SS", ":%s/\\v", { desc = "Search and replace in file" }) +vim.keymap.set("v", "", ":s/\\%V", { desc = "Search only in visual selection using %V atom" }) +vim.keymap.set("v", "", '"hy:%s/\\vh//g', { desc = "Change selection" }) + +-- Remove +local function delete_current_file() + local filepath = vim.fn.expand("%:p") + local filename = vim.fn.expand("%:t") -- Get the current filename + if filepath and filepath ~= "" then + -- Check if trash utility is installed + if vim.fn.executable("trash") == 0 then + vim.api.nvim_echo({ + { "- Trash utility not installed. Make sure to install it first\n", "ErrorMsg" }, + { "- Install `trash-cli`\n", nil }, + }, false, {}) + return + end + -- Prompt for confirmation before deleting the file + vim.ui.input({ + prompt = 'Do you want to delete "' .. filename .. '"? (y/n): ', + }, function(input) + if input == nil then + return + end + + if input:lower() == "y" or input:lower() == "yes" then + -- Delete the file using trash app + local success, _ = pcall(function() + vim.fn.system({ "trash", vim.fn.fnameescape(filepath) }) + end) + if success then + vim.api.nvim_echo({ + { "File deleted from disk:\n", "Normal" }, + { filepath, "Normal" }, + }, false, {}) + -- Close the buffer after deleting the file + vim.cmd("bd!") + else + vim.api.nvim_echo({ + { "Failed to delete file:\n", "ErrorMsg" }, + { filepath, "ErrorMsg" }, + }, false, {}) + end + else + vim.api.nvim_echo({ + { "File deletion canceled.", "Normal" }, + }, false, {}) + end + end) + else + vim.api.nvim_echo({ + { "No file to delete", "WarningMsg" }, + }, false, {}) + end +end + +vim.keymap.set("n", "rm", function() + delete_current_file() +end, { desc = "Remove current file" }) + +-- Scripts +vim.api.nvim_set_keymap( + "n", + "rr", + ':w!:lua vim.cmd("split | resize 10 | terminal compiler " .. vim.fn.expand("%:p"))', + { noremap = true, silent = true, desc = "Run compiler interactively" } +) +vim.api.nvim_set_keymap( + "n", + "ov", + ":!opout %", + { noremap = true, silent = true, desc = "Docs viewer" } +) + +-- Source +-- source nvim config +vim.keymap.set("n", "SO", function() + vim.cmd("so") +end, { desc = "Source current file" }) +-- reload zsh configuration by sourcing ~/.config/zsh/.zshrc in a separate shell +vim.keymap.set("n", "SZ", function() + -- Define the command to source zshrc + local command = "source ~/.config/zsh/.zshrc" + -- Execute the command in a new Zsh shell + local full_command = "zsh -c '" .. command .. "'" + -- Run the command and capture the output + local output = vim.fn.system(full_command) + -- Check the exit status of the command + local exit_code = vim.v.shell_error + if exit_code == 0 then + vim.api.nvim_echo({ { "Successfully sourced ~/.config/zsh/.zshrc", "NormalMsg" } }, false, {}) + else + vim.api.nvim_echo({ + { "Failed to source ~/.config/zsh/.zshrc:", "ErrorMsg" }, + { output, "ErrorMsg" }, + }, false, {}) + end +end, { desc = "Source zshrc" }) +-- source shortcuts from bm-files and bm-folders +local shortcuts_file = vim.fn.expand("~/.config/nvim/shortcuts.lua") +local file = io.open(shortcuts_file, "r") +if file then + file:close() + vim.cmd("silent! source " .. shortcuts_file) +end + +-- Spell +vim.keymap.set("n", "zp", function() + vim.opt.spelllang = { "en", "cjk" } + vim.cmd("echo 'Spell language set to English and CJK'") +end, { desc = "Spelling language English and CJK" }) +-- repeat the replacement done by |z=| for all matches with the replaced word in the current window. +vim.keymap.set("n", "z.", function() + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(":spellr\n", true, false, true), "m", true) +end, { desc = "Spelling repeat" }) + +-- Sudo +vim.keymap.set("n", "SW", "SudoWrite", { silent = true, desc = "Save file with sudo" }) +vim.keymap.set("n", "SWQ", "SudoWritequit", { silent = true, desc = "Save and quit with sudo" }) + +-- Surround +vim.keymap.set("n", "sau", function() + local line = vim.api.nvim_get_current_line() + local col = vim.api.nvim_win_get_cursor(0)[2] + 1 -- Adjust for 0-index in Lua + -- This makes the `s` optional so it matches both http and https + local pattern = "https?://[^ ,;'\"<>%s)]*" + -- Find the starting and ending positions of the URL + local s, e = string.find(line, pattern) + while s and e do + if s <= col and e >= col then + -- When the cursor is within the URL + local url = string.sub(line, s, e) + -- Update the line with backticks around the URL + local new_line = string.sub(line, 1, s - 1) .. "`" .. url .. "`" .. string.sub(line, e + 1) + vim.api.nvim_set_current_line(new_line) + vim.cmd("silent write") + return + end + -- Find the next URL in the line + s, e = string.find(line, pattern, e + 1) + -- Save the file to update trouble list + end + print("No URL found under cursor") +end, { desc = "Add surrounding to URL" }) +vim.keymap.set("v", "bl", function() + -- Get the selected text range + local start_row, start_col = unpack(vim.fn.getpos("'<"), 2, 3) + local end_row, end_col = unpack(vim.fn.getpos("'>"), 2, 3) + -- Get the selected lines + local lines = vim.api.nvim_buf_get_lines(0, start_row - 1, end_row, false) + local selected_text = table.concat(lines, "\n"):sub(start_col, #lines == 1 and end_col or -1) + if selected_text:match("^%*%*.*%*%*$") then + vim.notify("Text already bold", vim.log.levels.INFO) + else + vim.cmd("normal 2gsa*") + end +end, { desc = "Bold current selection" }) +vim.keymap.set("n", "gbd", function() + local cursor_pos = vim.api.nvim_win_get_cursor(0) + local current_buffer = vim.api.nvim_get_current_buf() + local start_row = cursor_pos[1] - 1 + local col = cursor_pos[2] + -- Get the current line + local line = vim.api.nvim_buf_get_lines(current_buffer, start_row, start_row + 1, false)[1] + -- Check if the cursor is on an asterisk + if line:sub(col + 1, col + 1):match("%*") then + vim.notify("Cursor is on an asterisk, run inside the bold text", vim.log.levels.WARN) + return + end + -- Search for '**' to the left of the cursor position + local left_text = line:sub(1, col) + local bold_start = left_text:reverse():find("%*%*") + if bold_start then + bold_start = col - bold_start + end + -- Search for '**' to the right of the cursor position and in following lines + local right_text = line:sub(col + 1) + local bold_end = right_text:find("%*%*") + local end_row = start_row + while not bold_end and end_row < vim.api.nvim_buf_line_count(current_buffer) - 1 do + end_row = end_row + 1 + local next_line = vim.api.nvim_buf_get_lines(current_buffer, end_row, end_row + 1, false)[1] + if next_line == "" then + break + end + right_text = right_text .. "\n" .. next_line + bold_end = right_text:find("%*%*") + end + if bold_end then + bold_end = col + bold_end + end + -- Remove '**' markers if found, otherwise bold the word + if bold_start and bold_end then + -- Extract lines + local text_lines = vim.api.nvim_buf_get_lines(current_buffer, start_row, end_row + 1, false) + local text = table.concat(text_lines, "\n") + -- Calculate positions to correctly remove '**' + -- vim.notify("bold_start: " .. bold_start .. ", bold_end: " .. bold_end) + local new_text = text:sub(1, bold_start - 1) .. text:sub(bold_start + 2, bold_end - 1) .. text:sub(bold_end + 2) + local new_lines = vim.split(new_text, "\n") + -- Set new lines in buffer + vim.api.nvim_buf_set_lines(current_buffer, start_row, end_row + 1, false, new_lines) + -- vim.notify("Unbolded text", vim.log.levels.INFO) + else + -- Bold the word at the cursor position if no bold markers are found + local before = line:sub(1, col) + local after = line:sub(col + 1) + local inside_surround = before:match("%*%*[^%*]*$") and after:match("^[^%*]*%*%*") + if inside_surround then + vim.cmd("normal gsd*.") + else + vim.cmd("normal viw") + vim.cmd("normal 2gsa*") + end + vim.notify("Bolded current word", vim.log.levels.INFO) + end +end, { desc = "Toggle bold" }) + +-- Tab +vim.keymap.set("n", "l", "tablast", { desc = "Last Tab" }) +vim.keymap.set("n", "]]", "tablast", { desc = "Last Tab" }) +vim.keymap.set("n", "o", "tabonly", { desc = "Close Other Tabs" }) +vim.keymap.set("n", "f", "tabfirst", { desc = "First Tab" }) +vim.keymap.set("n", "[[", "tabfirst", { desc = "First Tab" }) +vim.keymap.set("n", "", "tabnew", { desc = "New Tab" }) +vim.keymap.set("n", "n", "tabnext", { desc = "Next Tab" }) +vim.keymap.set("n", "]", "tabnext", { desc = "Next Tab" }) +vim.keymap.set("n", "d", "tabclose", { desc = "Close Tab" }) +vim.keymap.set("n", "p", "tabprevious", { desc = "Previous Tab" }) +vim.keymap.set("n", "[", "tabprevious", { desc = "Previous Tab" }) + +-- Terminal +vim.keymap.set("n", "te", "term", { desc = "Open terminal" }) +vim.keymap.set("n", "t-", "sp term://zsh | startinsert", { desc = "Split terminal (horizontal)" }) +vim.keymap.set("n", "t|", "vsp term://zsh | startinsert", { desc = "Split terminal (vertical)" }) +vim.keymap.set("t", "", "", { desc = "Escape terminal mode" }) +vim.keymap.set("t", "", "wincmd h", { desc = "Move to left window" }) +vim.keymap.set("t", "", "wincmd j", { desc = "Move to window below" }) +vim.keymap.set("t", "", "wincmd k", { desc = "Move to window above" }) +vim.keymap.set("t", "", "wincmd l", { desc = "Move to right window" }) +vim.keymap.set("t", "l", "clear", { silent = true, desc = "Clear terminal" }) +vim.keymap.set("t", "", "iexit", { desc = "Close terminal" }) +vim.keymap.set("t", "", "close", { desc = "Close terminal" }) +vim.keymap.set("t", "", "close", { desc = "Close terminal" }) + +-- Tmux +if vim.env.TMUX then + vim.keymap.set( + "n", + "tm", + "silent !~/.config/tmux/plugins/tmux-fzf/scripts/session.sh", + { desc = "Find tmux session" } + ) + vim.keymap.set("n", "RS", function() + vim.fn.system("restartnvim") + end, { noremap = true, silent = true, desc = "Restart nvim (tmux)" }) +end + +-- Todo +-- detect todos and toggle between ":" and ";", or show a message if not found +-- this is to "mark them as done" +vim.keymap.set("n", "td", function() + -- Get the current line + local current_line = vim.fn.getline(".") + -- Get the current line number + local line_number = vim.fn.line(".") + if string.find(current_line, "TODO:") then + -- Replace the first occurrence of ":" with ";" + local new_line = current_line:gsub("TODO:", "TODO;") + -- Set the modified line + vim.fn.setline(line_number, new_line) + elseif string.find(current_line, "TODO;") then + -- Replace the first occurrence of ";" with ":" + local new_line = current_line:gsub("TODO;", "TODO:") + -- Set the modified line + vim.fn.setline(line_number, new_line) + else + vim.cmd("echo 'todo item not detected'") + end +end, { desc = "Toggle TODO item done or not" }) + +-- Windows +vim.keymap.set("n", "", "", { desc = "Move to left window" }) +vim.keymap.set("n", "", "", { desc = "Move to window below" }) +vim.keymap.set("n", "", "", { desc = "Move to window above" }) +vim.keymap.set("n", "", "", { desc = "Move to right window" }) +-- vim.keymap.set("n", "", "resize +2", { desc = "Increase window height" }) +-- vim.keymap.set("n", "", "resize -2", { desc = "Decrease window height" }) +-- vim.keymap.set("n", "", "vertical resize -2", { desc = "Decrease window width" }) +-- vim.keymap.set("n", "", "vertical resize +2", { desc = "Increase window width" }) + +function WordDefinition(input) + -- Function to run the dict command and return its output + local function get_output(word) + local escaped_word = vim.fn.shellescape(word) + return vim.fn.system("dict " .. escaped_word) + end + + -- Function to process the word for singular/plural handling + local function get_definition(word) + -- Attempt to derive the singular form + local singular = word + if word:sub(-2) == "es" then + singular = word:sub(1, -3) -- Remove 'es' + elseif word:sub(-1) == "s" then + singular = word:sub(1, -2) -- Remove 's' + end + + -- Fetch output for both singular and original word + local singular_output = get_output(singular) + local original_output = get_output(word) + + -- Determine which output to prioritize + if singular ~= word and not vim.startswith(singular_output, "No definitions found") then + return singular_output -- Use singular if valid and different + else + return original_output -- Otherwise, use the original word + end + end + + -- Get the definition and output for the word + local output = get_definition(input) + + -- Create a new buffer and display the result + local bufnr = vim.api.nvim_create_buf(false, true) + vim.api.nvim_set_current_buf(bufnr) + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, vim.split(output, "\n")) +end +vim.api.nvim_set_keymap( + "n", + "k", + ":lua WordDefinition(vim.fn.expand(''))", + { noremap = true, silent = true, desc = "Word definition" } +) + +-- Lazy +vim.keymap.set("n", "L", "Lazy", { desc = "Open lazy plugin manager" }) + +-- Mason +vim.keymap.set("n", "M", "Mason", { desc = "Open mason" }) diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/core/lazy.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/core/lazy.lua new file mode 100644 index 0000000..8097325 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/core/lazy.lua @@ -0,0 +1,17 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) +end ---@diagnostic disable-next-line: undefined-field +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + { import = "thesiahxyz.plugins" }, + }, + install = { + colorscheme = { "catppuccin" }, + }, + change_detection = { notify = false }, + checker = { enabled = false }, +}) diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/core/options.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/core/options.lua new file mode 100644 index 0000000..9c1a6a6 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/core/options.lua @@ -0,0 +1,42 @@ +vim.g.have_nerd_font = true +-- vim.g.netrw_browse_split = 0 +-- vim.g.netrw_banner = 1 +-- vim.g.netrw_browsex_viewer = "xdg-open" +-- vim.g.netrw_liststyle = 0 +-- vim.g.netrw_list_hide = "^.git" +-- vim.g.netrw_winsize = 25 +-- vim.g.loaded_netrw = 1 +-- vim.g.loaded_netrwPlugin = 1 +vim.opt.backup = false +vim.opt.breakindent = true +vim.opt.conceallevel = 1 +vim.opt.cursorline = true +vim.opt.expandtab = true +vim.opt.hlsearch = true +vim.opt.ignorecase = true +vim.opt.inccommand = "split" +vim.opt.incsearch = true +vim.opt.isfname:append("@-@") +vim.opt.list = true +vim.opt.listchars = { tab = " ", trail = " ", nbsp = " " } +vim.opt.mouse = "a" +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.scrolloff = 8 +vim.opt.shiftwidth = 2 +vim.opt.showmode = false +vim.opt.signcolumn = "yes" +vim.opt.smartcase = true +vim.opt.smartindent = true +vim.opt.softtabstop = 2 +vim.opt.spellfile = vim.fn.expand(vim.fn.stdpath("config") .. "/lua/thesiahxyz/spells/en.utf-8.add") +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.swapfile = false +vim.opt.tabstop = 2 +vim.opt.termguicolors = true +vim.opt.timeoutlen = 300 +vim.opt.updatetime = 300 +vim.opt.undofile = true +vim.opt.undodir = os.getenv("HOME") .. "/.local/share/history/vim_history" +vim.opt.wrap = false diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/health.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/health.lua new file mode 100644 index 0000000..dba5f3a --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/health.lua @@ -0,0 +1,45 @@ +local check_version = function() + local verstr = string.format("%s.%s.%s", vim.version().major, vim.version().minor, vim.version().patch) + if not vim.version.cmp then + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + return + end + + if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then + vim.health.ok(string.format("Neovim version is: '%s'", verstr)) + else + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + end +end + +local check_external_reqs = function() + -- Basic utils: `git`, `make`, `unzip` + for _, exe in ipairs({ "git", "make", "unzip", "rg" }) do + local is_executable = vim.fn.executable(exe) == 1 + if is_executable then + vim.health.ok(string.format("Found executable: '%s'", exe)) + else + vim.health.warn(string.format("Could not find executable: '%s'", exe)) + end + end + + return true +end + +return { + check = function() + vim.health.start("TheSiahxyz") + + vim.health.info([[NOTE: Not every warning is a 'must-fix' in `:checkhealth` + + Fix only warnings for plugins and languages you intend to use. + Mason will give warnings for languages that are not installed. + You do not need to install, unless you want to use those languages!]]) + + local uv = vim.uv or vim.loop + vim.health.info("System Information: " .. vim.inspect(uv.os_uname())) + + check_version() + check_external_reqs() + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/init.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/init.lua new file mode 100644 index 0000000..2a8bc78 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/init.lua @@ -0,0 +1,15 @@ +-- Core +require("thesiahxyz.core.autocmds") +require("thesiahxyz.core.keymaps") +require("thesiahxyz.core.options") +require("thesiahxyz.core.lazy") + +-- Custom +for _, file in ipairs(vim.fn.readdir(vim.fn.stdpath("config") .. "/lua/thesiahxyz/utils", [[v:val =~ '\.lua$']])) do + require("thesiahxyz.utils." .. file:gsub("%.lua$", "")) +end + +-- Plenary +function R(name) + require("plenary.reload").reload_module(name) +end diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/ai.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/ai.lua new file mode 100644 index 0000000..2fca9f7 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/ai.lua @@ -0,0 +1,286 @@ +return { + { + "robitx/gp.nvim", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "G", group = "GPT" }, + { "Gg", group = "Gp" }, + { "GW", group = "Whisper" }, + }) + end, + config = function() + local function keymapOptions(desc) + return { + noremap = true, + silent = true, + nowait = true, + desc = desc, + } + end + + local conf = { + -- For customization, refer to Install > Configuration in the Documentation/Readme + -- openai_api_key = { "pass", "show", "api/chatGPT/nvim" }, + openai_api_key = { "pass", "show", "api/chatGPT/nvim" }, + providers = { + openai = { + disable = false, + endpoint = "https://api.openai.com/v1/chat/completions", + -- secret = { "pass", "show", "api/chatGPT/nvim" }, + }, + }, + hooks = { + -- GpInspectPlugin provides a detailed inspection of the plugin state + InspectPlugin = function(plugin, params) + local bufnr = vim.api.nvim_create_buf(false, true) + local copy = vim.deepcopy(plugin) + local key = copy.config.openai_api_key or "" + copy.config.openai_api_key = key:sub(1, 3) .. string.rep("*", #key - 6) .. key:sub(-3) + local plugin_info = string.format("Plugin structure:\n%s", vim.inspect(copy)) + local params_info = string.format("Command params:\n%s", vim.inspect(params)) + local lines = vim.split(plugin_info .. "\n" .. params_info, "\n") + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) + vim.api.nvim_win_set_buf(0, bufnr) + end, + + -- GpInspectLog for checking the log file + InspectLog = function(plugin, params) + local log_file = plugin.config.log_file + local buffer = plugin.helpers.get_buffer(log_file) + if not buffer then + vim.cmd("e " .. log_file) + else + vim.cmd("buffer " .. buffer) + end + end, + + -- GpImplement rewrites the provided selection/range based on comments in it + Implement = function(gp, params) + local template = "Having following from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please rewrite this according to the contained instructions." + .. "\n\nRespond exclusively with the snippet that should replace the selection above." + + local agent = gp.get_command_agent() + gp.logger.info("Implementing selection with agent: " .. agent.name) + + gp.Prompt( + params, + gp.Target.rewrite, + agent, + template, + nil, -- command will run directly without any prompting for user input + nil -- no predefined instructions (e.g. speech-to-text from Whisper) + ) + end, + + -- your own functions can go here, see README for more examples like + -- :GpExplain, :GpUnitTests.., :GpTranslator etc. + + -- example of making :%GpChatNew a dedicated command which + -- opens new chat with the entire current buffer as a context + BufferChatNew = function(gp, _) + -- call GpChatNew command in range mode on whole buffer + vim.api.nvim_command("%" .. gp.config.cmd_prefix .. "ChatNew") + end, + + -- example of adding command which opens new chat dedicated for translation + Translator = function(gp, params) + local chat_system_prompt = "You are a Translator, please translate between English and Korean." + gp.cmd.ChatNew(params, chat_system_prompt) + + -- -- you can also create a chat with a specific fixed agent like this: + -- local agent = gp.get_chat_agent("ChatGPT4o") + -- gp.cmd.ChatNew(params, chat_system_prompt, agent) + end, + + -- example of adding command which writes unit tests for the selected code + UnitTests = function(gp, params) + local template = "I have the following code from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please respond by writing table driven unit tests for the code above." + local agent = gp.get_command_agent() + gp.Prompt(params, gp.Target.enew, agent, template) + end, + + -- example of adding command which explains the selected code + Explain = function(gp, params) + local template = "I have the following code from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please respond by explaining the code above." + local agent = gp.get_chat_agent() + gp.Prompt(params, gp.Target.popup, agent, template) + end, + + -- example of usig enew as a function specifying type for the new buffer + CodeReview = function(gp, params) + local template = "I have the following code from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please analyze for code smells and suggest improvements." + local agent = gp.get_chat_agent() + gp.Prompt(params, gp.Target.enew("markdown"), agent, template) + end, + }, + } + require("gp").setup(conf) + + -- Setup shortcuts here (see Usage > Shortcuts in the Documentation/Readme) + vim.keymap.set({ "n", "i" }, "Gc", "GpChatNew", keymapOptions("New chat")) + vim.keymap.set({ "n", "i" }, "Gb", "GpBufferChatNew", keymapOptions("New buffer chat")) + vim.keymap.set({ "n", "i" }, "Gt", "GpChatToggle", keymapOptions("Toggle chat")) + vim.keymap.set({ "n", "i" }, "Gf", "GpChatFinder", keymapOptions("Chat finder")) + + vim.keymap.set("v", "Gc", ":'<,'>GpChatNew", keymapOptions("Chat new")) + vim.keymap.set("v", "Gb", ":'<,'>GpBufferChatNew", keymapOptions("Buffer chat new")) + vim.keymap.set("v", "Gp", ":'<,'>GpChatPaste", keymapOptions("Chat paste")) + vim.keymap.set("v", "Gt", ":'<,'>GpChatToggle", keymapOptions("Toggle chat")) + + vim.keymap.set({ "n", "i" }, "Gh", "gpchatnew split", keymapOptions("New chat split")) + vim.keymap.set({ "n", "i" }, "Gv", "gpchatnew vsplit", keymapOptions("New chat vsplit")) + vim.keymap.set({ "n", "i" }, "Gn", "gpchatnew tabnew", keymapOptions("New chat tabnew")) + + vim.keymap.set("v", "Gh", ":'<,'>GpChatNew split", keymapOptions("Chat new split")) + vim.keymap.set("v", "Gv", ":'<,'>GpChatNew vsplit", keymapOptions("Chat new vsplit")) + vim.keymap.set("v", "Gn", ":'<,'>GpChatNew tabnew", keymapOptions("Chat new tabnew")) + + -- Prompt commands + vim.keymap.set({ "n", "i" }, "Gw", "GpRewrite", keymapOptions("Inline rewrite")) + vim.keymap.set({ "n", "i" }, "Gr", "GpCodeReview", keymapOptions("Code review")) + vim.keymap.set({ "n", "i" }, "G]", "GpAppend", keymapOptions("Append (after)")) + vim.keymap.set({ "n", "i" }, "G[", "GpPrepend", keymapOptions("Prepend (before)")) + + vim.keymap.set("v", "Gw", ":'<,'>GpRewrite", keymapOptions("Rewrite")) + vim.keymap.set("v", "Gr", ":'<,'>GpCodeReview", keymapOptions("Code review")) + vim.keymap.set("v", "G]", ":'<,'>GpAppend", keymapOptions("Append (after)")) + vim.keymap.set("v", "G[", ":'<,'>GpPrepend", keymapOptions("Prepend (before)")) + vim.keymap.set("v", "Gi", ":'<,'>GpImplement", keymapOptions("Implement selection")) + + vim.keymap.set({ "n", "i" }, "Ggp", "GpPopup", keymapOptions("Popup")) + vim.keymap.set({ "n", "i" }, "Gge", "GpEnew", keymapOptions("GpEnew")) + vim.keymap.set({ "n", "i" }, "Ggc", "GpNew", keymapOptions("GpNew")) + vim.keymap.set({ "n", "i" }, "Ggv", "GpVnew", keymapOptions("GpVnew")) + vim.keymap.set({ "n", "i" }, "Ggn", "GpTabnew", keymapOptions("GpTabnew")) + + vim.keymap.set("v", "Ggp", ":'<,'>GpPopup", keymapOptions("Popup")) + vim.keymap.set("v", "Gge", ":'<,'>GpEnew", keymapOptions("GpEnew")) + vim.keymap.set("v", "Ggc", ":'<,'>GpNew", keymapOptions("GpNew")) + vim.keymap.set("v", "Ggv", ":'<,'>GpVnew", keymapOptions("GpVnew")) + vim.keymap.set("v", "Ggn", ":'<,'>GpTabnew", keymapOptions("GpTabnew")) + + vim.keymap.set({ "n", "i" }, "Gx", "GpContext", keymapOptions("Toggle context")) + vim.keymap.set("v", "Gx", ":'<,'>GpContext", keymapOptions("Toggle context")) + + vim.keymap.set({ "n", "i", "v", "x" }, "Ggs", "GpStop", keymapOptions("Stop")) + vim.keymap.set({ "n", "i", "v", "x" }, "Gg]", "GpNextAgent", keymapOptions("Next agent")) + + -- optional Whisper commands with prefix w + vim.keymap.set({ "n", "i" }, "GWw", "GpWhisper", keymapOptions("Whisper")) + vim.keymap.set("v", "GWw", ":'<,'>GpWhisper", keymapOptions("Whisper")) + + vim.keymap.set({ "n", "i" }, "GWr", "GpWhisperRewrite", keymapOptions("Inline rewrite")) + vim.keymap.set({ "n", "i" }, "GW]", "GpWhisperAppend", keymapOptions("Append (after)")) + vim.keymap.set({ "n", "i" }, "GW[", "GpWhisperPrepend", keymapOptions("Prepend (before) ")) + + vim.keymap.set("v", "GWr", ":'<,'>GpWhisperRewrite", keymapOptions("Rewrite")) + vim.keymap.set("v", "GW]", ":'<,'>GpWhisperAppend", keymapOptions("Append (after)")) + vim.keymap.set("v", "GW[", ":'<,'>GpWhisperPrepend", keymapOptions("Prepend (before)")) + + vim.keymap.set({ "n", "i" }, "GWp", "GpWhisperPopup", keymapOptions("Popup")) + vim.keymap.set({ "n", "i" }, "GWe", "GpWhisperEnew", keymapOptions("Enew")) + vim.keymap.set({ "n", "i" }, "GWc", "GpWhisperNew", keymapOptions("New")) + vim.keymap.set({ "n", "i" }, "GWv", "GpWhisperVnew", keymapOptions("Vnew")) + vim.keymap.set({ "n", "i" }, "GWn", "GpWhisperTabnew", keymapOptions("Tabnew")) + + vim.keymap.set("v", "GWp", ":'<,'>GpWhisperPopup", keymapOptions("Popup")) + vim.keymap.set("v", "GWe", ":'<,'>GpWhisperEnew", keymapOptions("Enew")) + vim.keymap.set("v", "GWc", ":'<,'>GpWhisperNew", keymapOptions("New")) + vim.keymap.set("v", "GWv", ":'<,'>GpWhisperVnew", keymapOptions("Vnew")) + vim.keymap.set("v", "GWn", ":'<,'>GpWhisperTabnew", keymapOptions("Tabnew")) + end, + }, + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + build = ":Copilot auth", + event = "InsertEnter", + dependencies = { + "hrsh7th/nvim-cmp", + { "AndreM222/copilot-lualine" }, + { + "zbirenbaum/copilot-cmp", + config = function() + require("copilot_cmp").setup() + end, + }, + }, + config = function() + require("copilot").setup({ + panel = { + enabled = true, + auto_refresh = true, + keymap = { + jump_prev = "[a", + jump_next = "]a", + accept = "", + refresh = "gr", + open = "", + }, + layout = { + position = "right", -- | top | left | right + ratio = 0.4, + }, + }, + suggestion = { + enabled = true, + auto_trigger = true, + hide_during_completion = true, + debounce = 75, + keymap = { + accept = "", + accept_word = false, + accept_line = false, + next = "", + prev = "", + dismiss = "", + }, + }, + filetypes = { + cvs = false, + gitcommit = false, + gitrebase = false, + help = true, + hgcommit = false, + markdown = true, + sh = function() + if string.match(vim.fs.basename(vim.api.nvim_buf_get_name(0)), "^%.env.*") then + -- disable for .env files + return false + end + return true + end, + svn = false, + yaml = false, + ["."] = false, + ["*"] = true, + }, + copilot_node_command = "node", -- Node.js version must be > 18.x + server_opts_overrides = {}, + }) + + local cmp = require("cmp") + cmp.event:on("menu_opened", function() + vim.b.copilot_suggestion_hidden = true + end) + + cmp.event:on("menu_closed", function() + vim.b.copilot_suggestion_hidden = false + end) + end, + + vim.keymap.set("n", "ct", function() + require("copilot.suggestion").toggle_auto_trigger() + end, { noremap = true, silent = true, desc = "Toggle copilot" }), + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/cloak.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/cloak.lua new file mode 100644 index 0000000..09b14d8 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/cloak.lua @@ -0,0 +1,42 @@ +return { + "laytan/cloak.nvim", + lazy = false, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "c", group = "Cloak" }, + }) + end, + config = function() + require("cloak").setup({ + enabled = true, + cloak_character = "*", + -- The applied highlight group (colors) on the cloaking, see `:h highlight`. + highlight_group = "Comment", + patterns = { + { + -- Match any file starting with ".env". + -- This can be a table to match multiple file patterns. + file_pattern = { + ".env*", + "wrangler.toml", + ".dev.vars", + "address*", + "*api*", + }, + -- Match an equals sign and any character after it. + -- This can also be a table of patterns to cloak, + -- example: cloak_pattern = { ":.+", "-.+" } for yaml files. + cloak_pattern = { "=.+", ":.+", "-.+" }, + }, + }, + }) + end, + keys = { + { "ce", "CloakEnable", desc = "Enable cloak" }, + { "cd", "CloakDisable", desc = "Disable cloak" }, + { "cl", "CloakPreviewLine", desc = "Preview line cloak" }, + { "zC", "CloakToggle", desc = "Toggle cloak" }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/cmp.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/cmp.lua new file mode 100644 index 0000000..276215d --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/cmp.lua @@ -0,0 +1,326 @@ +local trigger_text = ";" + +return { + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", -- source for text in buffer + "hrsh7th/cmp-path", -- source for file system paths + { + "L3MON4D3/LuaSnip", + version = "v2.*", -- Replace by the latest released major (first number of latest release) + build = "make install_jsregexp", + }, + "saadparwaiz1/cmp_luasnip", -- for autocompletion + "rafamadriz/friendly-snippets", -- useful snippets + "onsails/lspkind.nvim", -- vs-code like pictograms + "uga-rosa/cmp-dictionary", -- dictionary & spell + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 + and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + completion = { + completeopt = "menu,menuone,preview,noselect", + }, + snippet = { -- configure how nvim-cmp interacts with snippet engine + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), -- previous suggestion + [""] = cmp.mapping.select_next_item(), -- next suggestion + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), -- show completion suggestions + [""] = cmp.mapping.abort(), -- close completion window + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- this way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "buffer" }, -- text within current buffer + { name = "crates" }, + { name = "copilot" }, + { name = "dictionary", keyword_length = 2 }, + { name = "emoji" }, + { name = "luasnip" }, -- snippets + { name = "nvim_lsp" }, + { name = "nvim_lua", priority = 100 }, + { name = "path" }, -- file system paths + { name = "projects", priority = 100 }, + { name = "snippets" }, + { name = "vim-dadbod-completion" }, -- Enable dadbod completion source + { name = "vsnip" }, + }), + + -- configure lspkind for vs-code like pictograms in completion menu + formatting = { + expandable_indicator = true, + fields = { + "abbr", + "kind", + "menu", + }, + format = require("lspkind").cmp_format({ + mode = "symbol_text", + maxwidth = 50, + ellipsis_char = "...", + menu = { + buffer = "[Buffer]", + luasnip = "[LuaSnip]", + nvim_lsp = "[LSP]", + nvim_lua = "[Lua]", + projects = "[Projects]", + emoji = "[Emoji]", + vsnip = "[Snippet]", + }, + }), + }, + }) + + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + matching = { disallow_symbol_nonprefix_matching = false }, + }) + + -- sql + cmp.setup.filetype({ "sql" }, { + sources = { + { name = "vim-dadbod-completion" }, + { name = "buffer" }, + }, + }) + + local lspkind = require("lspkind") + lspkind.init({ + symbol_map = { + Copilot = "", + }, + }) + + vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) + + require("cmp_dictionary").setup({ + paths = { + "/usr/share/dict/words", + vim.fn.expand(vim.fn.stdpath("config") .. "/lua/thesiahxyz/spells/en.utf-8.add"), + }, + exact_length = 2, + }) + end, + }, + -- { + -- "saghen/blink.cmp", + -- version = "*", + -- -- build = "cargo build --release", + -- opts_extend = { + -- "sources.completion.enabled_providers", + -- "sources.compat", + -- "sources.default", + -- }, + -- enabled = true, + -- dependencies = { + -- { + -- "L3MON4D3/LuaSnip", + -- version = "v2.*", + -- build = "make install_jsregexp", + -- }, + -- "rafamadriz/friendly-snippets", + -- { + -- "saghen/blink.compat", + -- optional = true, -- make optional so it's only enabled if any extras need it + -- opts = {}, + -- version = "*", + -- }, + -- "kristjanhusak/vim-dadbod-completion", + -- "giuxtaposition/blink-cmp-copilot", + -- }, + -- event = "InsertEnter", + -- opts = function(_, opts) + -- opts.sources = vim.tbl_deep_extend("force", opts.sources or {}, { + -- default = { "lsp", "path", "snippets", "buffer", "copilot", "luasnip", "dadbod" }, + -- providers = { + -- lsp = { + -- name = "lsp", + -- enabled = true, + -- module = "blink.cmp.sources.lsp", + -- fallbacks = { "snippets", "luasnip", "buffer" }, + -- score_offset = 90, -- the higher the number, the higher the priority + -- }, + -- luasnip = { + -- name = "luasnip", + -- enabled = true, + -- module = "blink.cmp.sources.luasnip", + -- min_keyword_length = 2, + -- fallbacks = { "snippets" }, + -- score_offset = 85, + -- max_items = 8, + -- }, + -- path = { + -- name = "Path", + -- module = "blink.cmp.sources.path", + -- score_offset = 3, + -- -- When typing a path, I would get snippets and text in the + -- -- suggestions, I want those to show only if there are no path + -- -- suggestions + -- fallbacks = { "snippets", "luasnip", "buffer" }, + -- opts = { + -- trailing_slash = false, + -- label_trailing_slash = true, + -- get_cwd = function(context) + -- return vim.fn.expand(("#%d:p:h"):format(context.bufnr)) + -- end, + -- show_hidden_files_by_default = true, + -- }, + -- }, + -- buffer = { + -- name = "Buffer", + -- enabled = true, + -- max_items = 3, + -- module = "blink.cmp.sources.buffer", + -- min_keyword_length = 4, + -- }, + -- snippets = { + -- name = "Snippets", + -- enabled = true, + -- max_items = 3, + -- module = "blink.cmp.sources.snippets", + -- min_keyword_length = 4, + -- score_offset = 80, -- the higher the number, the higher the priority + -- }, + -- -- Example on how to configure dadbod found in the main repo + -- -- https://github.com/kristijanhusak/vim-dadbod-completion + -- dadbod = { + -- name = "Dadbod", + -- module = "vim_dadbod_completion.blink", + -- score_offset = 85, -- the higher the number, the higher the priority + -- }, + -- -- Third class citizen mf always talking shit + -- copilot = { + -- name = "Copilot", + -- enabled = true, + -- module = "blink-cmp-copilot", + -- min_keyword_length = 6, + -- score_offset = -100, -- the higher the number, the higher the priority + -- async = true, + -- }, + -- }, + -- -- command line completion, thanks to dpetka2001 in reddit + -- -- https://www.reddit.com/r/neovim/comments/1hjjf21/comment/m37fe4d/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button + -- cmdline = function() + -- local type = vim.fn.getcmdtype() + -- if type == "/" or type == "?" then + -- return { "buffer" } + -- end + -- if type == ":" then + -- return { "cmdline" } + -- end + -- return {} + -- end, + -- }) + -- + -- -- This comes from the luasnip extra, if you don't add it, won't be able to + -- -- jump forward or backward in luasnip snippets + -- opts.snippets = { + -- expand = function(snippet) + -- require("luasnip").lsp_expand(snippet) + -- end, + -- active = function(filter) + -- if filter and filter.direction then + -- return require("luasnip").jumpable(filter.direction) + -- end + -- return require("luasnip").in_snippet() + -- end, + -- jump = function(direction) + -- require("luasnip").jump(direction) + -- end, + -- } + -- + -- opts.appearance = { + -- -- sets the fallback highlight groups to nvim-cmp's highlight groups + -- -- useful for when your theme doesn't support blink.cmp + -- -- will be removed in a future release, assuming themes add support + -- use_nvim_cmp_as_default = false, + -- -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- -- adjusts spacing to ensure icons are aligned + -- nerd_font_variant = "mono", + -- } + -- + -- opts.completion = { + -- accept = { + -- -- experimental auto-brackets support + -- auto_brackets = { + -- enabled = true, + -- }, + -- }, + -- menu = { + -- draw = { + -- treesitter = { "lsp" }, + -- }, + -- }, + -- documentation = { + -- auto_show = true, + -- auto_show_delay_ms = 200, + -- }, + -- ghost_text = { enabled = true }, + -- } + -- + -- opts.keymap = { + -- preset = "super-tab", + -- } + -- + -- return opts + -- end, + -- }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/colorschemes.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/colorschemes.lua new file mode 100644 index 0000000..dd6296d --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/colorschemes.lua @@ -0,0 +1,268 @@ +function ColorMyPencils(color) + color = color or "catppuccin" + vim.cmd.colorscheme(color) + vim.api.nvim_set_hl(0, "Normal", { bg = "NONE" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "NONE" }) +end + +return { + { "junegunn/seoul256.vim" }, + { + "catppuccin/nvim", + name = "catppuccin", + config = function() + require("catppuccin").setup({ + flavour = "auto", -- latte, frappe, macchiato, mocha + background = { -- :h background + light = "latte", + dark = "mocha", + }, + transparent_background = true, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = true, -- dims the background color of inactive window + shade = "dark", + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { "italic" }, -- Change the style of comments + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + -- miscs = {}, -- Uncomment to turn off hard-coded styles + }, + color_overrides = {}, + custom_highlights = {}, + default_integrations = true, + integrations = { + aerial = true, + alpha = true, + blink_cmp = true, + cmp = true, + dashboard = true, + flash = true, + gitsigns = true, + headlines = true, + illuminate = true, + indent_blankline = { enabled = true, scope_color = "peach", colored_indent_levels = true }, + leap = true, + lsp_trouble = true, + mason = true, + markdown = true, + mini = true, + native_lsp = { + enabled = true, + underlines = { + errors = { "undercurl" }, + hints = { "undercurl" }, + warnings = { "undercurl" }, + information = { "undercurl" }, + }, + }, + navic = { enabled = true, custom_bg = "NONE" }, + neotest = true, + neotree = true, + noice = true, + notify = true, + semantic_tokens = true, + telescope = true, + treesitter = true, + treesitter_context = true, + which_key = true, + }, + highlight_overrides = { + mocha = function(mocha) + return { + LineNr = { fg = mocha.overlay2 }, + CursorLineNr = { fg = mocha.sky }, + Normal = { bg = "NONE" }, -- normal text + NormalNC = { bg = "NONE" }, + } + end, + }, + }) + + ColorMyPencils() + end, + }, + { + "ellisonleao/gruvbox.nvim", + priority = 1000, + -- opts = ..., + config = function() + require("gruvbox").setup({ + terminal_colors = true, -- add neovim terminal colors + undercurl = true, + underline = true, + bold = true, + italic = { + strings = true, + emphasis = true, + comments = true, + operators = false, + folds = true, + }, + strikethrough = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + inverse = true, -- invert background for search, diffs, statuslines and errors + contrast = "", -- can be "hard", "soft" or empty string + palette_overrides = { + dark1 = "NONE", + }, + overrides = {}, + dim_inactive = true, + transparent_mode = true, + }) + end, + }, + { + "rose-pine/neovim", + name = "rose-pine", + config = function() + require("rose-pine").setup({ + variant = "auto", -- auto, main, moon, or dawn + dark_variant = "main", -- main, moon, or dawn + dim_inactive_windows = false, + extend_background_behind_borders = true, + enable = { + terminal = true, + legacy_highlights = true, -- Improve compatibility for previous versions of Neovim + migrations = true, -- Handle deprecated options automatically + }, + styles = { + bold = true, + italic = false, + transparency = true, + }, + groups = { + border = "muted", + link = "iris", + panel = "surface", + + error = "love", + hint = "iris", + info = "foam", + note = "pine", + todo = "rose", + warn = "gold", + + git_add = "foam", + git_change = "rose", + git_delete = "love", + git_dirty = "rose", + git_ignore = "muted", + git_merge = "iris", + git_rename = "pine", + git_stage = "iris", + git_text = "rose", + git_untracked = "subtle", + + h1 = "iris", + h2 = "foam", + h3 = "rose", + h4 = "gold", + h5 = "pine", + h6 = "foam", + }, + palette = { + -- Override the builtin palette per variant + -- moon = { + -- base = '#18191a', + -- overlay = '#363738', + -- }, + }, + highlight_groups = { + -- Comment = { fg = "foam" }, + -- VertSplit = { fg = "muted", bg = "muted" }, + }, + before_highlight = function(group, highlight, palette) + -- Disable all undercurls + -- if highlight.undercurl then + -- highlight.undercurl = false + -- end + -- + -- Change palette colour + -- if highlight.fg == palette.pine then + -- highlight.fg = palette.foam + -- end + end, + }) + -- vim.cmd("colorscheme rose-pine") + -- vim.cmd("colorscheme rose-pine-main") + -- vim.cmd("colorscheme rose-pine-moon") + -- vim.cmd("colorscheme rose-pine-dawn") + end, + }, + { + "Mofiqul/dracula.nvim", + config = function() + local dracula = require("dracula") + dracula.setup({ + -- customize dracula color palette + colors = { + bg = "#282A36", + fg = "#F8F8F2", + selection = "#44475A", + comment = "#6272A4", + red = "#FF5555", + orange = "#FFB86C", + yellow = "#F1FA8C", + green = "#50fa7b", + purple = "#BD93F9", + cyan = "#8BE9FD", + pink = "#FF79C6", + bright_red = "#FF6E6E", + bright_green = "#69FF94", + bright_yellow = "#FFFFA5", + bright_blue = "#D6ACFF", + bright_magenta = "#FF92DF", + bright_cyan = "#A4FFFF", + bright_white = "#FFFFFF", + menu = "#21222C", + visual = "#3E4452", + gutter_fg = "#4B5263", + nontext = "#3B4048", + white = "#ABB2BF", + black = "#191A21", + }, + -- show the '~' characters after the end of buffers + show_end_of_buffer = true, -- default false + -- use transparent background + transparent_bg = true, -- default false + -- set custom lualine background color + lualine_bg_color = "#44475a", -- default nil + -- set italic comment + italic_comment = true, -- default false + -- overrides the default highlights with table see `:h synIDattr` + overrides = {}, + -- You can use overrides as table like this + -- overrides = { + -- NonText = { fg = "white" }, -- set NonText fg to white + -- NvimTreeIndentMarker = { link = "NonText" }, -- link to NonText highlight + -- Nothing = {} -- clear highlight of Nothing + -- }, + -- Or you can also use it like a function to get color from theme + -- overrides = function (colors) + -- return { + -- NonText = { fg = colors.white }, -- set NonText fg to white of theme + -- } + -- end, + }) + end, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/comment.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/comment.lua new file mode 100644 index 0000000..fe82b02 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/comment.lua @@ -0,0 +1,50 @@ +return { + { + "numToStr/Comment.nvim", + lazy = false, + opts = {}, + config = function() + require("Comment").setup() + end, + }, + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = {}, + cmd = { "TodoTrouble", "TodoTelescope" }, + config = function() + require("todo-comments").setup() + end, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "t", group = "TODO" }, + }) + end, + keys = { + { + "]t", + function() + require("todo-comments").jump_next() + end, + desc = "Next Todo Comment", + }, + { + "[t", + function() + require("todo-comments").jump_prev() + end, + desc = "Previous Todo Comment", + }, + { "tt", "Trouble todo toggle", desc = "Toggle TODO (Trouble)" }, + { + "tT", + "Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}", + desc = "Toggle Todo/Fix/Fixme (Trouble)", + }, + { "ft", "TodoTelescope", desc = "Find Todo" }, + { "fT", "TodoTelescope keywords=TODO,FIX,FIXME", desc = "Find Todo/Fix/Fixme" }, + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/compiler.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/compiler.lua new file mode 100644 index 0000000..d760594 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/compiler.lua @@ -0,0 +1,53 @@ +return { + { -- This plugin + "Zeioth/compiler.nvim", + cmd = { "CompilerOpen", "CompilerToggleResults", "CompilerRedo" }, + dependencies = { "stevearc/overseer.nvim", "nvim-telescope/telescope.nvim" }, + opts = {}, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "r", group = "Compiler/Refactoring" }, + }) + end, + keys = { + -- Open compiler + vim.api.nvim_set_keymap( + "n", + "ro", + "CompilerOpen", + { noremap = true, silent = true, desc = "Open compiler" } + ), + + -- Redo last selected option + vim.api.nvim_set_keymap( + "n", + "rc", + "CompilerStop" -- (Optional, to dispose all tasks before redo) + .. "CompilerRedo", + { noremap = true, silent = true, desc = "Recompile" } + ), + -- Toggle compiler results + vim.api.nvim_set_keymap( + "n", + "rt", + "CompilerToggleResults", + { noremap = true, silent = true, desc = "Toggle compiler" } + ), + }, + }, + { -- The task runner we use + "stevearc/overseer.nvim", + commit = "6271cab7ccc4ca840faa93f54440ffae3a3918bd", + cmd = { "CompilerOpen", "CompilerToggleResults", "CompilerRedo" }, + opts = { + task_list = { + direction = "bottom", + min_height = 25, + max_height = 25, + default_detail = 1, + }, + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/context.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/context.lua new file mode 100644 index 0000000..e8979c8 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/context.lua @@ -0,0 +1,26 @@ +return { + "nvim-treesitter/nvim-treesitter-context", + cmd = { "TSContextEnable", "TSContextDisable", "TSContextToggle" }, + config = function() + require("treesitter-context").setup({ + enable = false, -- Enable this plugin (Can be enabled/disabled later via commands) + max_lines = 3, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 1, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 20, -- Maximum number of lines to show for a single context + trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + zindex = 20, -- The Z-index of the context window + on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching + }) + end, + keys = { + vim.keymap.set("n", "[t", function() + require("treesitter-context").go_to_context(vim.v.count1) + end, { silent = true, desc = "Go to context" }), + vim.keymap.set({ "n", "v" }, "zc", "TSContextToggle", { desc = "Toggle context" }), + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/csv.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/csv.lua new file mode 100644 index 0000000..0805d1d --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/csv.lua @@ -0,0 +1,88 @@ +return { + { + "cameron-wags/rainbow_csv.nvim", + config = function() + require("rainbow_csv").setup() + -- vim.g.rcsv_colorpairs = { + -- { "red", "red" }, + -- { "blue", "blue" }, + -- { "green", "green" }, + -- { "magenta", "magenta" }, + -- { "NONE", "NONE" }, + -- { "darkred", "darkred" }, + -- { "darkblue", "darkblue" }, + -- { "darkgreen", "darkgreen" }, + -- { "darkmagenta", "darkmagenta" }, + -- { "darkcyan", "darkcyan" }, + -- } + end, + ft = { + "csv", + "tsv", + "csv_semicolon", + "csv_whitespace", + "csv_pipe", + "rfc_csv", + "rfc_semicolon", + }, + cmd = { + "RainbowDelim", + "RainbowDelimSimple", + "RainbowDelimQuoted", + "RainbowMultiDelim", + }, + }, + { + "hat0uma/csvview.nvim", + cmd = { "CsvViewEnable", "CsvViewDisable", "CsvViewToggle" }, + event = { "BufReadPre *.csv" }, -- Lazy-load the plugin when a CSV file is about to be read + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "cs", group = "csv" }, + }) + end, + config = function() + require("csvview").setup() + + vim.api.nvim_create_autocmd("BufRead", { + pattern = "*.csv", + callback = function() + vim.cmd("CsvViewEnable") + end, + }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = "csv", + callback = function() + vim.keymap.set( + "n", + "zv", + "CsvViewToggle", + { desc = "Toggle CSV view", buffer = true } + ) + end, + }) + end, + keys = { + { + "csv", + function() + local delimiter = vim.fn.input("Delimiter (e.g., ,): ") + local quote_char = vim.fn.input("Quote char (e.g., '): ") + local comment = vim.fn.input("Comment char (e.g., #): ") + local command = string.format( + ":CsvViewToggle delimiter=%s quote_char=%s comment=%s", + delimiter, + quote_char, + comment + ) + + vim.cmd(command) + end, + desc = "Toggle CSV view", + }, + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua new file mode 100644 index 0000000..41adb5a --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua @@ -0,0 +1,52 @@ +return { + "kristijanhusak/vim-dadbod-ui", + dependencies = { + { "tpope/vim-dadbod", lazy = true }, + { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true }, + }, + cmd = { + "DBUI", + "DBUIToggle", + "DBUIAddConnection", + "DBUIFindBuffer", + }, + init = function() + -- Your DBUI configuration + vim.g.db_ui_use_nerd_fonts = 1 + local home = vim.fn.expand("~") + vim.g.dbs = { + firefox = "sqlite://" .. home .. "/.mozilla/firefox/si.default/places.sqlite", + mysql = "mariadb://user:password@localhost/mysql", + postsql = "postgresql://postgres:mypassword@localhost:5432/postgresql", + sqlite = "sqlite://" .. home .. "/.local/share/db/sqlite.db", + } + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "d", group = "DB" }, + }) + end, + config = function() + local function db_completion() + require("cmp").setup.buffer({ sources = { { name = "vim-dadbod-completion" } } }) + end + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "sql", + "mysql", + "plsql", + }, + callback = function() + vim.schedule(db_completion) + end, + }) + end, + keys = { + { "du", "DBUI", desc = "DB UI" }, + { "dt", "DBUIToggle", desc = "Toggle DB UI" }, + { "da", "DBUIAddConnection", desc = "Add connection" }, + { "df", "DBUIFindBuffer", desc = "Find buffer" }, + { "dr", "DBUIRenameBuffer", desc = "Rename buffer" }, + { "di", "DBUILastQueryInfo", desc = "Last query info" }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dap.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dap.lua new file mode 100644 index 0000000..d1ef5d7 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dap.lua @@ -0,0 +1,295 @@ +local function get_args(config) + local args = type(config.args) == "function" and (config.args() or {}) or config.args or {} + config = vim.deepcopy(config) + ---@cast args string[] + config.args = function() + local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]] + return vim.split(vim.fn.expand(new_args) --[[@as string]], " ") + end + return config +end + +return { + { + "mfussenegger/nvim-dap", + recommended = true, + desc = "Debugging support. Requires language specific adapters to be configured. (see lang extras)", + dependencies = { + "rcarriga/nvim-dap-ui", + -- virtual text for the debugger + { + "theHamsta/nvim-dap-virtual-text", + opts = {}, + }, + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "dp", group = "Debug" }, + { "dP", group = "Debug (Python)" }, + }) + end, + config = function() + -- load mason-nvim-dap here, after all adapters have been setup + vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" }) + + local dap = require("dap") + dap.configurations.java = { + { + type = "java", + request = "attach", + name = "Debug (Attach) - Remote", + hostName = "127.0.0.1", + port = 5005, + }, + } + + local dap_icons = { + Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" }, + Breakpoint = " ", + BreakpointCondition = " ", + BreakpointRejected = { " ", "DiagnosticError" }, + LogPoint = ".>", + } + + for name, sign in pairs(dap_icons) do + sign = type(sign) == "table" and sign or { sign } + vim.fn.sign_define( + "Dap" .. name, + { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } + ) + end + + -- setup dap config by VsCode launch.json file + local vscode = require("dap.ext.vscode") + local json = require("plenary.json") + vscode.json_decode = function(str) + return vim.json.decode(json.json_strip_comments(str)) + end + end, + keys = { + { + "dpB", + function() + require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) + end, + desc = "Dap breakpoint condition", + }, + { + "dpb", + function() + require("dap").toggle_breakpoint() + end, + desc = "Dap toggle breakpoint", + }, + { + "dpc", + function() + require("dap").continue() + end, + desc = "Dap continue", + }, + { + "dpa", + function() + require("dap").continue({ before = get_args }) + end, + desc = "Dap run with args", + }, + { + "dpC", + function() + require("dap").run_to_cursor() + end, + desc = "Dap run to cursor", + }, + { + "dpg", + function() + require("dap").goto_() + end, + desc = "Dap go to line (no execute)", + }, + { + "dpi", + function() + require("dap").step_into() + end, + desc = "Dap step into", + }, + { + "dpj", + function() + require("dap").down() + end, + desc = "Dap down", + }, + { + "dpk", + function() + require("dap").up() + end, + desc = "Dap up", + }, + { + "dpl", + function() + require("dap").run_last() + end, + desc = "Dap run last", + }, + { + "dpo", + function() + require("dap").step_out() + end, + desc = "Dap step out", + }, + { + "dpO", + function() + require("dap").step_over() + end, + desc = "Dap step over", + }, + { + "dpp", + function() + require("dap").pause() + end, + desc = "Dap pause", + }, + { + "dpr", + function() + require("dap").repl.toggle() + end, + desc = "Dap toggle repl", + }, + { + "dps", + function() + require("dap").session() + end, + desc = "Dap session", + }, + { + "dpt", + function() + require("dap").terminate() + end, + desc = "Dap terminate", + }, + { + "dpw", + function() + require("dap.ui.widgets").hover() + end, + desc = "Dap widgets", + }, + { + "dpR", + "lua require('dapui').open({ reset = true })", + desc = "Dap UI reset", + }, + }, + }, + { + "mfussenegger/nvim-dap-python", + ft = "python", + dependencies = { "mfussenegger/nvim-dap", "rcarriga/nvim-dap-ui" }, + config = function() + local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python" + require("dap-python").setup(path) + end, + keys = { + { + "dPt", + function() + require("dap-python").test_method() + end, + desc = "Dap debug method", + ft = "python", + }, + { + "dPc", + function() + require("dap-python").test_class() + end, + desc = "Dap debug class", + ft = "python", + }, + }, + }, + { + "rcarriga/nvim-dap-ui", + dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, + config = function() + local dap = require("dap") + local dapui = require("dapui") + dapui.setup() + + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + dap.listeners.after.event_terminated["dapui_config"] = function() + dapui.close() + end + dap.listeners.after.event_exited["dapui_config"] = function() + dapui.close() + end + end, + keys = { + { + "dpu", + function() + require("dapui").toggle() + end, + desc = "Dap UI", + }, + { + "dpe", + function() + require("dapui").eval() + end, + desc = "Dap eval", + }, + }, + }, + { + "jay-babu/mason-nvim-dap.nvim", + dependencies = "mason.nvim", + cmd = { "DapInstall", "DapUninstall" }, + opts = { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_installation = true, + + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = {}, + + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + }, + }, + -- mason-nvim-dap is loaded when nvim-dap loads + config = function() end, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/docker.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/docker.lua new file mode 100644 index 0000000..7bc26d5 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/docker.lua @@ -0,0 +1,222 @@ +return { + "https://codeberg.org/esensar/nvim-dev-container", + dependencies = "nvim-treesitter/nvim-treesitter", + config = function() + require("devcontainer").setup({ + config_search_start = function() + -- By default this function uses vim.loop.cwd() + -- This is used to find a starting point for .devcontainer.json file search + -- Since by default, it is searched for recursively + -- That behavior can also be disabled + end, + workspace_folder_provider = function() + -- By default this function uses first workspace folder for integrated lsp if available and vim.loop.cwd() as a fallback + -- This is used to replace `${localWorkspaceFolder}` in devcontainer.json + -- Also used for creating default .devcontainer.json file + end, + terminal_handler = function(command) + -- By default this function creates a terminal in a new tab using :terminal command + -- It also removes statusline when that tab is active, to prevent double statusline + -- It can be overridden to provide custom terminal handling + end, + nvim_installation_commands_provider = function(path_binaries, version_string) + -- Returns table - list of commands to run when adding neovim to container + -- Each command can either be a string or a table (list of command parts) + -- Takes binaries available in path on current container and version_string passed to the command or current version of neovim + end, + devcontainer_json_template = function() + -- Returns table - list of lines to set when creating new devcontainer.json files + -- As a template + -- Used only when using functions from commands module or created commands + end, + -- Can be set to false to prevent generating default commands + -- Default commands are listed below + generate_commands = true, + -- By default no autocommands are generated + -- This option can be used to configure automatic starting and cleaning of containers + autocommands = { + -- can be set to true to automatically start containers when devcontainer.json is available + init = false, + -- can be set to true to automatically remove any started containers and any built images when exiting vim + clean = false, + -- can be set to true to automatically restart containers when devcontainer.json file is updated + update = false, + }, + -- can be changed to increase or decrease logging from library + log_level = "info", + -- can be set to true to disable recursive search + -- in that case only .devcontainer.json and .devcontainer/devcontainer.json files will be checked relative + -- to the directory provided by config_search_start + disable_recursive_config_search = false, + -- can be set to false to disable image caching when adding neovim + -- by default it is set to true to make attaching to containers faster after first time + cache_images = true, + -- By default all mounts are added (config, data and state) + -- This can be changed to disable mounts or change their options + -- This can be useful to mount local configuration + -- And any other mounts when attaching to containers with this plugin + attach_mounts = { + neovim_config = { + -- enables mounting local config to /root/.config/nvim in container + enabled = false, + -- makes mount readonly in container + options = { "readonly" }, + }, + neovim_data = { + -- enables mounting local data to /root/.local/share/nvim in container + enabled = false, + -- no options by default + options = {}, + }, + -- Only useful if using neovim 0.8.0+ + neovim_state = { + -- enables mounting local state to /root/.local/state/nvim in container + enabled = false, + -- no options by default + options = {}, + }, + }, + -- This takes a list of mounts (strings) that should always be added to every run container + -- This is passed directly as --mount option to docker command + -- Or multiple --mount options if there are multiple values + always_mount = {}, + -- This takes a string (usually either "podman" or "docker") representing container runtime - "devcontainer-cli" is also partially supported + -- That is the command that will be invoked for container operations + -- If it is nil, plugin will use whatever is available (trying "podman" first) + container_runtime = nil, + -- Similar to container runtime, but will be used if main runtime does not support an action - useful for "devcontainer-cli" + backup_runtime = nil, + -- This takes a string (usually either "podman-compose" or "docker-compose") representing compose command - "devcontainer-cli" is also partially supported + -- That is the command that will be invoked for compose operations + -- If it is nil, plugin will use whatever is available (trying "podman-compose" first) + compose_command = nil, + -- Similar to compose command, but will be used if main command does not support an action - useful for "devcontainer-cli" + backup_compose_command = nil, + }) + end, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "d", group = "Docker" }, + { "db", group = "Build (docker)" }, + { "dc", group = "Compose (docker)" }, + { "do", group = "Open (docker)" }, + { "dr", group = "Run (docker)" }, + }) + end, + keys = { + { + "dcu", + function() + require("devcontainer.commands").compose_up() + end, + desc = "Compose up (docker)", + }, + { + "dcd", + function() + require("devcontainer.commands").compose_down() + end, + desc = "Compose down (docker)", + }, + { + "dcD", + function() + require("devcontainer.commands").compose_rm() + end, + desc = "Compose remove (docker)", + }, + { + "dbb", + function() + require("devcontainer.commands").docker_build() + end, + desc = "Build (docker)", + }, + { + "dri", + function() + require("devcontainer.commands").docker_image_run() + end, + desc = "Image run (docker)", + }, + { + "dbr", + function() + require("devcontainer.commands").docker_build_and_run() + end, + desc = "Build & run (docker)", + }, + { + "dba", + function() + require("devcontainer.commands").docker_build_run_and_attach() + end, + desc = "Build & attach (docker)", + }, + { + "ds", + function() + require("devcontainer.commands").start_auto() + end, + desc = "Start (docker)", + }, + { + "da", + function() + require("devcontainer.commands").attach_auto() + end, + desc = "Attach (docker)", + }, + { + "drr", + function() + require("devcontainer.commands").exec("devcontainer", "ls", { on_success = function(result) end }) + end, + desc = "Execute (docker)", + }, + { + "dx", + function() + require("devcontainer.commands").stop_auto() + end, + desc = "Stop (docker)", + }, + { + "dX", + function() + require("devcontainer.commands").stop_all() + end, + desc = "Stop all (docker)", + }, + { + "dD", + function() + require("devcontainer.commands").remove_all() + end, + desc = "Remove all (docker)", + }, + { + "dol", + function() + require("devcontainer.commands").open_logs() + end, + desc = "Open logs (docker)", + }, + { + "doc", + function() + require("devcontainer.commands").open_nearest_devcontainer_config() + end, + desc = "Open nearest config (docker)", + }, + { + "de", + function() + require("devcontainer.commands").edit_devcontainer_config() + end, + desc = "Edit nearest config (docker)", + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/git.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/git.lua new file mode 100644 index 0000000..9f856b6 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/git.lua @@ -0,0 +1,221 @@ +return { + { + "moyiz/git-dev.nvim", + event = "VeryLazy", + opts = {}, + config = function() + require("git-dev").setup() + + local function copy_git_repo_url() + -- Get the Git repository root + local git_root = vim.fn.system("git rev-parse --show-toplevel"):gsub("\n", "") + if git_root == "" then + vim.notify("Not inside a Git repository", vim.log.levels.WARN) + return nil + end + + -- Get the remote URL + local remote_url = vim.fn.system("git config --get remote.origin.url"):gsub("\n", "") + if remote_url == "" then + vim.notify("No remote URL found", vim.log.levels.WARN) + return nil + end + + -- Convert SSH URL to HTTPS if needed + if remote_url:match("^git@") then + remote_url = remote_url:gsub("git@", "https://"):gsub(":", "/") + end + + -- Remove `.git` from the remote URL + remote_url = remote_url:gsub("%.git$", "") + + -- Get the relative path of the current file + local file_path = vim.fn.expand("%:~:.") + if file_path == "" then + vim.notify("No file currently open", vim.log.levels.WARN) + return nil + end + + -- Get the relative path to the repository root + local relative_path = + vim.fn.system("git ls-files --full-name " .. vim.fn.shellescape(file_path)):gsub("\n", "") + + -- Combine the remote URL with the relative file path + local full_url = remote_url .. "/" .. relative_path + + -- Copy to clipboard + vim.fn.setreg("+", full_url) + vim.notify("Copied to clipboard: " .. full_url, vim.log.levels.INFO) + + return full_url + end + + -- Keybinding to copy the Git repository URL + vim.keymap.set("n", "cg", function() + copy_git_repo_url() + end, { desc = "Copy git repository URL to clipboard" }) + + -- Function to open a repository from the clipboard + vim.keymap.set("n", "er", function() + local url = vim.fn.getreg("+") -- Get URL from clipboard + if not url or url == "" then + vim.notify("Clipboard is empty. Copy a valid URL first.", vim.log.levels.WARN) + return + end + if url:match("^https://") then + require("git-dev").open(url) + else + vim.notify("Not a valid URL: " .. url, vim.log.levels.ERROR) + end + end, { desc = "Open Git repository from clipboard" }) + end, + }, + { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + signs_staged = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + }, + on_attach = function(buffer) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, desc) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + end + + -- stylua: ignore start + map("n", "]h", function() + if vim.wo.diff then + vim.cmd.normal({ "]c", bang = true }) + else + gs.nav_hunk("next") + end + end, "Next hunk") + map("n", "[h", function() + if vim.wo.diff then + vim.cmd.normal({ "[c", bang = true }) + else + gs.nav_hunk("prev") + end + end, "Previous hunk") + map("n", "]H", function() gs.nav_hunk("last") end, "Last hunk") + map("n", "[H", function() gs.nav_hunk("first") end, "First hunk") + map({ "n", "v" }, "gs", ":Gitsigns stage_hunk", "Stage hunk") + map({ "n", "v" }, "gr", ":Gitsigns reset_hunk", "Reset hunk") + map("n", "gS", gs.stage_buffer, "Stage buffer") + map("n", "gu", gs.undo_stage_hunk, "Undo stage hunk") + map("n", "gR", gs.reset_buffer, "Reset buffer") + map("n", "gpv", gs.preview_hunk_inline, "Preview hunk inline") + map("n", "gb", function() gs.blame_line({ full = true }) end, "Blame line") + map("n", "gB", function() gs.blame() end, "Blame buffer") + map("n", "gd", gs.diffthis, "Diff this") + map("n", "gD", function() gs.diffthis("~") end, "Diff this ~") + -- map("n", "gD", function() gs.diffthis("@") end, "Diff this @") + map({ "o", "x" }, "ih", ":Gitsigns select_hunk", "GitSigns select hunk") + map("n", "gtb", gs.toggle_current_line_blame, "Toggle line blame") + map("n", "gtd", gs.toggle_deleted, "Toggle delete") + end, + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "g", group = "Git" }, + }) + end, + }, + { + "kdheepak/lazygit.nvim", + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { "gg", "LazyGit", desc = "Lazygit" }, + }, + }, + { + "mbbill/undotree", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "gt", group = "Toggle" }, + }) + end, + config = function() + vim.keymap.set("n", "gtu", vim.cmd.UndotreeToggle, { desc = "Toggle undo tree" }) + end, + }, + { + "tpope/vim-fugitive", + config = function() + local TheSiahxyz_Fugitive = vim.api.nvim_create_augroup("TheSiahxyz_Fugitive", {}) + local autocmd = vim.api.nvim_create_autocmd + autocmd("BufWinEnter", { + group = TheSiahxyz_Fugitive, + pattern = "*", + callback = function() + if vim.bo.ft ~= "fugitive" then + return + end + + local bufnr = vim.api.nvim_get_current_buf() + vim.keymap.set("n", "P", function() + vim.cmd.Git("push") + end, { buffer = bufnr, remap = false, desc = "Git push" }) + vim.keymap.set("n", "p", function() + vim.cmd.Git({ "pull", "--rebase" }) + end, { buffer = bufnr, remap = false, desc = "Git pull" }) + vim.keymap.set( + "n", + "o", + ":Git push -u origin ", + { buffer = bufnr, remap = false, desc = "Git push origin" } + ) + vim.keymap.set( + "n", + "h", + ":Git push home ", + { buffer = bufnr, remap = false, desc = "Git push home" } + ) + end, + }) + autocmd("FileType", { + group = TheSiahxyz_Fugitive, + pattern = "fugitive", + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, + }) + end, + keys = { + { mode = "n", "g", ":Git ", desc = "Git" }, + { mode = "n", "gf", vim.cmd.Git, desc = "Git fugitive" }, + { mode = "n", "gm", "diffget //2", desc = "Git diff on my side" }, + { mode = "n", "go", "diffget //3", desc = "Git diff on their side" }, + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/goyo.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/goyo.lua new file mode 100644 index 0000000..d78fe5e --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/goyo.lua @@ -0,0 +1,39 @@ +return { + "junegunn/goyo.vim", + dependencies = "junegunn/seoul256.vim", + config = function() + -- Enable Goyo by default for mutt writing + vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + group = vim.api.nvim_create_augroup("TheSiahxyz_goyo_config", { clear = true }), + pattern = "/tmp/neomutt*", + callback = function() + vim.g.goyo_width = 80 + vim.g.seoul256_background = 235 + vim.cmd([[ + Goyo + set bg=light + set linebreak + set wrap + set textwidth=0 + set wrapmargin=0 + set background=dark + colorscheme seoul256 + ]]) + vim.api.nvim_buf_set_keymap( + 0, + "n", + "gd", + ":Goyo|x!", + { noremap = true, silent = true, desc = "Goyo quit" } + ) + vim.api.nvim_buf_set_keymap( + 0, + "n", + "gq", + ":Goyo|q!", + { noremap = true, silent = true, desc = "Goyo abort" } + ) + end, + }) + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/harpoon2.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/harpoon2.lua new file mode 100644 index 0000000..942f326 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/harpoon2.lua @@ -0,0 +1,103 @@ +return { + "ThePrimeagen/harpoon", + branch = "harpoon2", + opts = { + menu = { + width = vim.api.nvim_win_get_width(0) - 4, + }, + settings = { + save_on_toggle = true, + }, + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "h", group = "Harpoon" }, + { "hr", group = "Replace harpoon slot" }, + { "", group = "Harpoon list delete" }, + }) + end, + config = function(_, opts) + local harpoon = require("harpoon") + + -- Apply the base configuration + harpoon.setup(opts) + + -- Extend functionality + harpoon:extend({ + UI_CREATE = function(cx) + vim.keymap.set("n", "", function() + harpoon.ui:select_menu_item({ vsplit = true }) + end, { buffer = cx.bufnr }) + + vim.keymap.set("n", "", function() + harpoon.ui:select_menu_item({ split = true }) + end, { buffer = cx.bufnr }) + + vim.keymap.set("n", "", function() + harpoon.ui:select_menu_item({ tabedit = true }) + end, { buffer = cx.bufnr }) + end, + }) + end, + keys = function() + local keys = { + { + "ha", + function() + require("harpoon"):list():add() + end, + desc = "Add buffer to harpoon list", + }, + { + "", + function() + local harpoon = require("harpoon") + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, + desc = "Open harpoon list menu", + }, + { + "", + function() + require("harpoon"):list():prev({ ui_nav_wrap = false }) + end, + desc = "Previous harpoon list", + }, + { + "", + function() + require("harpoon"):list():next({ ui_nav_wrap = false }) + end, + desc = "Next harpoon list", + }, + } + + for i = 1, 5 do + table.insert(keys, { + "", + function() + require("harpoon"):list():select(i) + end, + desc = "Harpoon list " .. i, + }) + table.insert(keys, { + "h" .. i, + function() + require("harpoon"):list():select(i) + end, + desc = "Harpoon list " .. i, + }) + table.insert(keys, { + "hr" .. i, + function() + require("harpoon"):list():replace_at(i) + end, + desc = "Replace buffer at harpoon slot " .. i, + }) + end + + return keys + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/image.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/image.lua new file mode 100644 index 0000000..a117e28 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/image.lua @@ -0,0 +1,210 @@ +return { + "HakonHarnes/img-clip.nvim", + event = "VeryLazy", + opts = { + -- add options here + -- or leave it empty to use the default settings + }, + config = function(_, opts) + require("img-clip").setup(opts) + + vim.keymap.set({ "n", "v", "i" }, "", function() + local pasted_image = require("img-clip").paste_image() + if pasted_image then + -- "Update" saves only if the buffer has been modified since the last save + vim.cmd("silent! update") + -- Get the current line + local line = vim.api.nvim_get_current_line() + -- Move cursor to end of line + vim.api.nvim_win_set_cursor(0, { vim.api.nvim_win_get_cursor(0)[1], #line }) + -- I reload the file, otherwise I cannot view the image after pasted + vim.cmd("edit!") + end + end, { desc = "Paste image from clipboard" }) + + vim.keymap.set("n", "oi", function() + local function get_image_path() + -- Get the current line + local line = vim.api.nvim_get_current_line() + -- Patterns to match image paths + local patterns = { + "%[.-%]%((.-)%)", -- Markdown style: ![alt text](image_path) + "%[%[(.-)%]%]", -- Double square brackets: [[image_path]] + } + + for _, pattern in ipairs(patterns) do + local _, _, image_path = string.find(line, pattern) + if image_path then + return image_path + end + end + + return nil -- Return nil if no pattern matches + end + + local function file_exists(filepath) + -- Check if the file exists + local f = io.open(filepath, "r") + if f then + f:close() + return true + end + return false + end + + -- Get the image path + local image_path = get_image_path() + if image_path then + -- Check if the image path starts with "http" or "https" + if string.sub(image_path, 1, 4) == "http" then + print("URL image, use 'gx' to open it in the default browser.") + else + -- Construct absolute image path + local current_file_path = vim.fn.expand("%:p:h") + local absolute_image_path = current_file_path .. "/" .. image_path + -- Check if the image exists in the current path + if not file_exists(absolute_image_path) then + -- If not found, search ../Screenshots/ + local fallback_path = vim.fn.fnamemodify(current_file_path, ":h") + .. "/Screenshots/" + .. image_path + if file_exists(fallback_path) then + absolute_image_path = fallback_path + else + print("Image not found in either current directory or ../Screenshots/") + return + end + end + -- Construct command to open image in Preview + local command = "nsxiv -aiop " .. vim.fn.shellescape(absolute_image_path) + -- Execute the command + local success = os.execute(command) + if success then + print("Opened image: " .. absolute_image_path) + else + print("Failed to open image: " .. absolute_image_path) + end + end + else + print("No image found under the cursor") + end + end, { desc = "Open image under cursor" }) + + vim.keymap.set("n", "di", function() + local function get_image_path() + local line = vim.api.nvim_get_current_line() + -- Patterns to match image paths + local patterns = { + "%[.-%]%((.-)%)", -- Markdown style: ![alt text](image_path) + "%[%[(.-)%]%]", -- Double square brackets: [[image_path]] + } + + for _, pattern in ipairs(patterns) do + local _, _, image_path = string.find(line, pattern) + if image_path then + return image_path + end + end + + return nil -- Return nil if no pattern matches + end + + local function file_exists(filepath) + local f = io.open(filepath, "r") + if f then + f:close() + return true + end + return false + end + + local image_path = get_image_path() + if image_path then + if string.sub(image_path, 1, 4) == "http" then + vim.api.nvim_echo({ { "URL image cannot be deleted from disk.", "WarningMsg" } }, false, {}) + return + end + + local current_file_path = vim.fn.expand("%:p:h") + local absolute_image_path = current_file_path .. "/" .. image_path + + -- Check if file exists + if not file_exists(absolute_image_path) then + -- Search fallback directory + local fallback_path = vim.fn.fnamemodify(current_file_path, ":h") .. "/Screenshots/" .. image_path + if file_exists(fallback_path) then + absolute_image_path = fallback_path + else + print("Image not found in either current directory or ../Screenshots/") + return + end + end + + -- Verify if trash utility exists + if vim.fn.executable("trash") == 0 then + vim.api.nvim_echo({ + { "- Trash utility not installed. Install `trash-cli`.\n", "ErrorMsg" }, + }, false, {}) + return + end + + vim.ui.select({ "yes", "no" }, { prompt = "Delete image file? " }, function(choice) + if choice == "yes" then + -- Attempt to delete using trash + local command = { "trash", absolute_image_path } + local success, err = pcall(vim.fn.system, command) + + -- Debug message for troubleshooting + print("Debug: Trash command -", table.concat(command, " ")) + + if success and vim.fn.filereadable(absolute_image_path) == 0 then + vim.api.nvim_echo({ + { "Image file deleted using trash:\n", "Normal" }, + { absolute_image_path, "Normal" }, + }, false, {}) + require("image").clear() + vim.cmd("edit!") + vim.cmd("normal! dd") + else + -- If trash fails, log the error + vim.api.nvim_echo({ + { "Trash deletion failed. Error:\n", "ErrorMsg" }, + { err or "Unknown error", "ErrorMsg" }, + }, false, {}) + end + else + vim.api.nvim_echo({ { "Image deletion canceled.", "Normal" } }, false, {}) + end + end) + else + print("No image found under the cursor") + end + end, { desc = "Delete image file under cursor" }) + + -- Refresh the images in the current buffer + -- Useful if you delete an actual image file and want to see the changes + -- without having to re-open neovim + vim.keymap.set("n", "ir", function() + -- First I clear the images + require("image").clear() + -- I'm using [[ ]] to escape the special characters in a command + -- vim.cmd([[lua require("image").clear()]]) + -- Reloads the file to reflect the changes + vim.cmd("edit!") + print("Images refreshed") + end, { desc = "Refresh images" }) + + -- Set up a keymap to clear all images in the current buffer + vim.keymap.set("n", "ic", function() + -- This is the command that clears the images + require("image").clear() + -- I'm using [[ ]] to escape the special characters in a command + -- vim.cmd([[lua require("image").clear()]]) + print("Images cleared") + end, { desc = "Clear images" }) + end, + keys = { + -- suggested keymap + { "pi", "PasteImage", desc = "Paste image from clipboard" }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/init.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/init.lua new file mode 100644 index 0000000..0bcf162 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/init.lua @@ -0,0 +1,83 @@ +return { + { "nvim-lua/plenary.nvim" }, + { + "aserowy/tmux.nvim", + config = function() + require("tmux").setup({ + copy_sync = { + -- enables copy sync. by default, all registers are synchronized. + -- to control which registers are synced, see the `sync_*` options. + enable = false, + + -- ignore specific tmux buffers e.g. buffer0 = true to ignore the + -- first buffer or named_buffer_name = true to ignore a named tmux + -- buffer with name named_buffer_name :) + ignore_buffers = { empty = false }, + + -- TMUX >= 3.2: all yanks (and deletes) will get redirected to system + -- clipboard by tmux + redirect_to_clipboard = false, + + -- offset controls where register sync starts + -- e.g. offset 2 lets registers 0 and 1 untouched + register_offset = 0, + + -- overwrites vim.g.clipboard to redirect * and + to the system + -- clipboard using tmux. If you sync your system clipboard without tmux, + -- disable this option! + sync_clipboard = true, + + -- synchronizes registers *, +, unnamed, and 0 till 9 with tmux buffers. + sync_registers = true, + + -- synchronizes registers when pressing p and P. + sync_registers_keymap_put = true, + + -- synchronizes registers when pressing (C-r) and ". + sync_registers_keymap_reg = true, + + -- syncs deletes with tmux clipboard as well, it is adviced to + -- do so. Nvim does not allow syncing registers 0 and 1 without + -- overwriting the unnamed register. Thus, ddp would not be possible. + sync_deletes = true, + + -- syncs the unnamed register with the first buffer entry from tmux. + sync_unnamed = true, + }, + navigation = { + -- cycles to opposite pane while navigating into the border + cycle_navigation = false, + + -- enables default keybindings (C-hjkl) for normal mode + enable_default_keybindings = true, + + -- prevents unzoom tmux when navigating beyond vim border + persist_zoom = true, + }, + resize = { + -- enables default keybindings (A-hjkl) for normal mode + enable_default_keybindings = false, + + -- sets resize steps for x axis + resize_step_x = 2, + + -- sets resize steps for y axis + resize_step_y = 2, + }, + }) + + vim.keymap.set("n", "", function() + require("tmux").resize_left() + end, { desc = "Decrease window width" }) + vim.keymap.set("n", "", function() + require("tmux").resize_bottom() + end, { desc = "Decrease window height" }) + vim.keymap.set("n", "", function() + require("tmux").resize_top() + end, { desc = "Increase window height" }) + vim.keymap.set("n", "", function() + require("tmux").resize_right() + end, { desc = "Increase window width" }) + end, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/keys.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/keys.lua new file mode 100644 index 0000000..5927c53 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/keys.lua @@ -0,0 +1,278 @@ +return { + { + "nvzone/showkeys", + cmd = "ShowkeysToggle", + opts = {}, + keys = { + { "zk", "ShowkeysToggle", desc = "Toggle keys" }, + }, + }, + { + "folke/which-key.nvim", + event = "VeryLazy", + cmd = "WhichKey", + dependencies = { "echasnovski/mini.icons", "nvim-tree/nvim-web-devicons" }, + opts = {}, + config = function() + local wk = require("which-key") + wk.setup({ + ---@type false | "classic" | "modern" | "helix" + preset = "classic", + -- Delay before showing the popup. Can be a number or a function that returns a number. + ---@type number | fun(ctx: { keys: string, mode: string, plugin?: string }):number + delay = function(ctx) + return ctx.plugin and 0 or 200 + end, + ---@param mapping wk.Mapping + filter = function(mapping) + -- example to exclude mappings without a description + -- return mapping.desc and mapping.desc ~= "" + return true + end, + --- You can add any mappings here, or use `require('which-key').add()` later + ---@type wk.Spec + spec = {}, + -- show a warning when issues were detected with your mappings + notify = true, + -- Which-key automatically sets up triggers for your mappings. + -- But you can disable this and setup the triggers manually. + -- Check the docs for more info. + ---@type wk.Spec + triggers = { + { "", mode = "nxso" }, + }, + -- Start hidden and wait for a key to be pressed before showing the popup + -- Only used by enabled xo mapping modes. + ---@param ctx { mode: string, operator: string } + defer = function(ctx) + return ctx.mode == "V" or ctx.mode == "" + end, + plugins = { + marks = true, -- shows a list of your marks on ' and ` + registers = true, -- shows your registers on " in NORMAL or in INSERT mode + -- the presets plugin, adds help for a bunch of default keybindings in Neovim + -- No actual key bindings are created + spelling = { + enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions + suggestions = 20, -- how many suggestions should be shown in the list? + }, + presets = { + operators = true, -- adds help for operators like d, y, ... + motions = true, -- adds help for motions + text_objects = true, -- help for text objects triggered after entering an operator + windows = true, -- default bindings on + nav = true, -- misc bindings to work with windows + z = true, -- bindings for folds, spelling and others prefixed with z + g = true, -- bindings for prefixed with g + }, + }, + ---@type wk.Win.opts + win = { + -- don't allow the popup to overlap with the cursor + no_overlap = true, + -- width = 1, + -- height = { min = 4, max = 25 }, + -- col = 0, + -- row = math.huge, + -- border = "none", + padding = { 1, 2 }, -- extra window padding [top/bottom, right/left] + title = true, + title_pos = "center", + zindex = 1000, + -- Additional vim.wo and vim.bo options + bo = {}, + wo = { + -- winblend = 10, -- value between 0-100 0 for fully opaque and 100 for fully transparent + }, + }, + layout = { + width = { min = 20 }, -- min and max width of the columns + spacing = 3, -- spacing between columns + }, + keys = { + scroll_down = "", + scroll_up = "", + }, + ---@type (string|wk.Sorter)[] + --- Mappings are sorted using configured sorters and natural sort of the keys + --- Available sorters: + --- * local: buffer-local mappings first + --- * order: order of the items (Used by plugins like marks / registers) + --- * group: groups last + --- * alphanum: alpha-numerical first + --- * mod: special modifier keys last + --- * manual: the order the mappings were added + --- * case: lower-case first + sort = { "local", "order", "group", "alphanum", "mod" }, + ---@type number|fun(node: wk.Node):boolean? + expand = 0, -- expand groups when <= n mappings + -- expand = function(node) + -- return not node.desc -- expand all nodes without a description + -- end, + -- Functions/Lua Patterns for formatting the labels + ---@type table + replace = { + key = { + function(key) + return require("which-key.view").format(key) + end, + -- { "", "SPC" }, + }, + desc = { + { "%(?(.*)%)?", "%1" }, + { "^%+", "" }, + { "<[cC]md>", "" }, + { "<[cC][rR]>", "" }, + { "<[sS]ilent>", "" }, + { "^lua%s+", "" }, + { "^call%s+", "" }, + { "^:%s*", "" }, + }, + }, + icons = { + breadcrumb = "»", -- symbol used in the command line area that shows your active key combo + separator = "➜", -- symbol used between a key and it's label + group = "+", -- symbol prepended to a group + ellipsis = "…", + -- set to false to disable all mapping icons, + -- both those explicitly added in a mapping + -- and those from rules + mappings = true, + --- See `lua/which-key/icons.lua` for more details + --- Set to `false` to disable keymap icons from rules + ---@type wk.IconRule[]|false + rules = {}, + -- use the highlights from mini.icons + -- When `false`, it will use `WhichKeyIcon` instead + colors = true, + -- used by key format + keys = { + Up = " ", + Down = " ", + Left = " ", + Right = " ", + C = "󰘴 ", + M = "󰘵 ", + D = "󰘳 ", + S = "󰘶 ", + CR = "󰌑 ", + Esc = "󱊷 ", + ScrollWheelDown = "󱕐 ", + ScrollWheelUp = "󱕑 ", + NL = "󰌑 ", + BS = "󰁮", + Space = "󱁐 ", + Tab = "󰌒 ", + F1 = "󱊫", + F2 = "󱊬", + F3 = "󱊭", + F4 = "󱊮", + F5 = "󱊯", + F6 = "󱊰", + F7 = "󱊱", + F8 = "󱊲", + F9 = "󱊳", + F10 = "󱊴", + F11 = "󱊵", + F12 = "󱊶", + }, + }, + show_help = true, -- show a help message in the command line for using WhichKey + show_keys = true, -- show the currently pressed key and its label as a message in the command line + -- disable WhichKey for certain buf types and file types. + disable = { + ft = {}, + bt = {}, + }, + debug = false, -- enable wk.log in the current directory + }) + + wk.add({ + { + mode = { "n", "v" }, + { "g", group = "Goto" }, + { "g`", group = "Marks" }, + { "g'", group = "Marks" }, + { "gs", group = "Search/Surround" }, + { "s", group = "Surround/Search & replace on line" }, + { "S", group = "Surround/Search & replace in file" }, + { "z", group = "Fold" }, + { "`", group = "Marks" }, + { "'", group = "Marks" }, + { '"', group = "Registers" }, + { "]", group = "Next" }, + { "]]", group = "Next" }, + { "[", group = "Prev" }, + { "[[", group = "Prev" }, + { "=", group = "Line paste" }, + { "gx", desc = "Open with system app" }, + { "", group = "Windows" }, + { "", group = "Leader" }, + { "a", group = "Ascii" }, + { + "b", + group = "Buffer", + expand = function() + return require("which-key.extras").expand.buf() + end, + }, + { "B", group = "Buffer (force)" }, + { "C", group = "Goto realpath" }, + { "d", group = "Delete" }, + { "D", group = "Delete (blackhole)" }, + { "e", group = "Explorer" }, + { "i", group = "Inspect" }, + { "l", group = "Location" }, + { "L", group = "Lazy" }, + { "M", group = "Mason" }, + { "o", group = "Open" }, + { "p", group = "Paste" }, + { "P", group = "Paste" }, + { "q", group = "Quit" }, + { "sk", group = "Keys" }, + { "S", group = "Save/Source" }, + { "w", group = "Which-key" }, + { "W", group = "Save all" }, + { "z", group = "Toggle" }, + { "", group = "Tabs" }, + { "", group = "Local Leader (bookmarks)" }, + { "", group = "Bookmarks (explorer)" }, + { "", group = "Bookmarks (mini)" }, + { "t", group = "Task" }, + }, + { + mode = { "n", "v", "x" }, + { "gw", desc = "Visible in window" }, + { "g%", desc = "Match backward" }, + { "g;", desc = "Last change" }, + { "Q", group = "Quit all" }, + }, + }) + end, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer local keymaps (which-key)", + }, + { + "wk", + function() + local ok, input = pcall(vim.fn.input, "WhichKey: ") + if ok and input ~= "" then + vim.cmd("WhichKey " .. input) + end + end, + desc = "Which-key query lookup", + }, + { + mode = { "n", "v", "x" }, + "wK", + "WhichKey", + desc = "Which-key all key", + }, + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lf.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lf.lua new file mode 100644 index 0000000..b055c6b --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lf.lua @@ -0,0 +1,121 @@ +return { + "lmburns/lf.nvim", + dependencies = { + { + "akinsho/toggleterm.nvim", + version = "*", + config = function() + require("toggleterm").setup({ + open_mapping = [[]], -- or { [[]], [[]] } if you also use a Japanese keyboard. + }) + vim.keymap.set( + "n", + "", + "ToggleTerm direction=float name=Terminal", + { desc = "Toggle float terminal" } + ) + vim.keymap.set( + "n", + "", + "ToggleTermToggleAll", + { desc = "Toggle all float terminals" } + ) + vim.keymap.set("n", "", "TermSelect", { desc = "Select float terminal" }) + + local function set_opfunc(opfunc) + _G._opfunc = opfunc -- Define the function globally + vim.go.operatorfunc = "v:lua._opfunc" -- Assign the global function + end + + local trim_spaces = false + vim.keymap.set("v", "", function() + require("toggleterm").send_lines_to_terminal("single_line", trim_spaces, { args = vim.v.count }) + end, { desc = "Send line to terminal" }) + -- Replace with these for the other two options + -- require("toggleterm").send_lines_to_terminal("visual_lines", trim_spaces, { args = vim.v.count }) + -- require("toggleterm").send_lines_to_terminal("visual_selection", trim_spaces, { args = vim.v.count }) + + -- For use as an operator map: + -- Send motion to terminal + vim.keymap.set("n", "", function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("g@", "n", false) + end, { desc = "Send motions to terminal" }) + -- Double the command to send line to terminal + vim.keymap.set("n", "", function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("g@_", "n", false) + end, { desc = "Send double command to terminal" }) + -- Send whole file + vim.keymap.set("n", "", function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("ggg@G''", "n", false) + end, { desc = "Send whole file to terminal (clipboard)" }) + end, + }, + }, + config = function() + vim.g.lf_netrw = 1 + local fn = vim.fn + + -- Defaults + require("lf").setup({ + default_action = "drop", -- Default action when `Lf` opens a file + default_actions = { + ["e"] = "tabedit", + [""] = "tab drop", + [""] = "vsplit", + [""] = "split", + }, + winblend = 0, -- Pseudotransparency level + direction = "float", -- Window type + border = "rounded", -- Border kind + height = fn.float2nr(fn.round(0.75 * vim.o.lines)), -- Height of the *floating* window + width = fn.float2nr(fn.round(0.75 * vim.o.columns)), -- Width of the *floating* window + escape_quit = true, -- Map escape to the quit command + focus_on_open = true, -- Focus the current file when opening Lf + mappings = true, -- Enable terminal buffer mapping + tmux = true, -- Tmux statusline can be disabled + disable_netrw_warning = true, -- Don't display a message when opening a directory + highlights = { + Normal = { link = "Normal" }, -- Use normal highlighting + NormalFloat = { link = "NormalFloat" }, -- Use float highlighting + FloatBorder = { link = "@constant" }, -- Use constant highlighting + }, + + -- Layout configurations + layout_mapping = "", -- Resize window with this key + views = { + { width = 0.800, height = 0.800 }, + { width = 0.600, height = 0.600 }, + { width = 0.950, height = 0.950 }, + { width = 0.500, height = 0.500, col = 0, row = 0 }, + { width = 0.500, height = 0.500, col = 0, row = 0.5 }, + { width = 0.500, height = 0.500, col = 0.5, row = 0 }, + { width = 0.500, height = 0.500, col = 0.5, row = 0.5 }, + }, + }) + + vim.keymap.set("n", "el", "Lf") + + -- Autocommand to set key mapping in terminal buffer + vim.api.nvim_create_autocmd("User", { + pattern = "LfTermEnter", + callback = function(a) + vim.api.nvim_buf_set_keymap( + a.buf, + "t", + "q", + "q", + { nowait = true, noremap = true, silent = true } + ) + end, + }) + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lsp.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lsp.lua new file mode 100644 index 0000000..16b95fe --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lsp.lua @@ -0,0 +1,643 @@ +return { + { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/nvim-cmp", + { + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp", + }, + "mfussenegger/nvim-lint", + "saadparwaiz1/cmp_luasnip", + "j-hui/fidget.nvim", + { "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } }, + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, + "stevearc/conform.nvim", + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "tf", group = "Format" }, + }) + end, + config = function() + local cmp = require("cmp") + local cmp_lsp = require("cmp_nvim_lsp") + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + cmp_lsp.default_capabilities() + ) + local lspconfig = require("lspconfig") + + require("fidget").setup({ + progress = { + poll_rate = false, -- How and when to poll for progress messages + suppress_on_insert = true, -- Suppress new messages while in insert mode + ignore_done_already = true, -- Ignore new tasks that are already complete + ignore_empty_message = true, -- Ignore new tasks that don't contain a message + clear_on_detach = function(client_id) -- Clear notification group when LSP server detaches + local client = vim.lsp.get_client_by_id(client_id) + return client and client.name or nil + end, + -- ignore = { "lua_ls" }, + }, + notification = { + window = { + normal_hl = "Comment", -- Base highlight group in the notification window + winblend = 0, -- Background color opacity in the notification window + border = "none", -- Border around the notification window + zindex = 45, -- Stacking priority of the notification window + max_width = 0, -- Maximum width of the notification window + max_height = 0, -- Maximum height of the notification window + x_padding = 1, -- Padding from right edge of window boundary + y_padding = 0, -- Padding from bottom edge of window boundary + align = "bottom", -- How to align the notification window + relative = "editor", -- What the notification window position is relative to + }, + }, + integration = { + ["nvim-tree"] = { + enable = false, -- Integrate with nvim-tree/nvim-tree.lua (if installed) + }, + }, + }) + + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "dockerls", + "docker_compose_language_service", + "jdtls", + "jsonls", + "lua_ls", + "pyright", + "ruff", + }, + automatic_installation = true, + handlers = { + function(server_name) -- default handler (optional) + require("lspconfig")[server_name].setup({ + capabilities = capabilities, + }) + end, + ["dockerls"] = function() + lspconfig.dockerls.setup({ + capabilities = capabilities, + -- settings = { + -- python = { + -- disableLanguageServices = false, + -- disableOrganizeImports = false, + -- }, + -- }, + }) + end, + ["docker_compose_language_service"] = function() + lspconfig.docker_compose_language_service.setup({ + capabilities = capabilities, + -- settings = { + -- python = { + -- disableLanguageServices = false, + -- disableOrganizeImports = false, + -- }, + -- }, + }) + end, + ["lua_ls"] = function() + lspconfig.lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + runtime = { version = "Lua 5.4" }, + diagnostics = { + globals = { "bit", "vim", "it", "describe", "before_each", "after_each" }, + }, + }, + }, + }) + end, + ["pyright"] = function() + lspconfig.pyright.setup({ + capabilities = capabilities, + settings = { + python = { + disableLanguageServices = false, + disableOrganizeImports = false, + }, + }, + }) + end, + ["ruff"] = function() + lspconfig.ruff.setup({ + capabilities = capabilities, + -- settings = { + -- python = { + -- disableLanguageServices = false, + -- disableOrganizeImports = false, + -- }, + -- }, + }) + end, + ["jdtls"] = function() + lspconfig.jdtls.setup({ + capabilities = capabilities, + }) + end, + ["jsonls"] = function() + lspconfig.jsonls.setup({ + capabilities = capabilities, + settings = { + json = { + format = { + enable = true, + }, + validate = { enable = true }, + }, + }, + }) + end, + }, + }) + + local lint = require("lint") + lint.linters_by_ft = { + dockerfile = { "hadolint" }, + javascript = { "eslint_d" }, + typescript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + typescriptreact = { "eslint_d" }, + svelte = { "eslint_d" }, + python = { "pylint" }, + sh = { "shellcheck" }, + } + + local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) + vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave", "TextChanged" }, { + group = lint_augroup, + callback = function() + lint.try_lint() + end, + }) + + require("mason-tool-installer").setup({ + ensure_installed = { + "beautysh", -- zsh formatter + "black", -- python formatter + "debugpy", -- python debuger + "eslint_d", -- eslint linter + "hadolint", -- docker linter + "isort", -- python formatter + "java-debug-adapter", -- java debugger + "java-test", -- java test + "markdown-toc", -- markdown toc + "prettier", -- prettier formatter + "pylint", -- python linter + "ruff", -- python formatter + "shellcheck", -- bash lint + "shfmt", -- sh formatter + "stylua", -- lua formatter + }, + integrations = { + ["mason-lspconfig"] = true, + ["mason-null-ls"] = false, + ["mason-nvim-dap"] = true, + }, + }) + + local cmp_select = { behavior = cmp.SelectBehavior.Select } + local luasnip = require("luasnip") + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), -- Up + [""] = cmp.mapping.scroll_docs(4), -- Down + [""] = cmp.mapping.select_prev_item(cmp_select), + [""] = cmp.mapping.select_next_item(cmp_select), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- For luasnip users. + { name = "buffer" }, + }), + }) + + vim.diagnostic.config({ + -- update_in_insert = true, + float = { + header = "", + border = "rounded", + prefix = "", + source = "if_many", + }, + }) + + require("conform").setup({ + formatters_by_ft = { + bash = { "shfmt" }, + css = { "prettier" }, + graphql = { "prettier" }, + html = { "prettier" }, + javascript = { "prettier" }, + javascriptreact = { "prettier" }, + json = { "prettier" }, + liquid = { "prettier" }, + lua = { "stylua" }, + markdown = { "prettier" }, + python = { "ruff", "isort", "black" }, + sh = { "shfmt" }, + svelte = { "prettier" }, + typescript = { "prettier" }, + typescriptreact = { "prettier" }, + yaml = { "prettier" }, + zsh = { "beautysh" }, + }, + default_format_opts = {}, + format_on_save = function(bufnr) + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { lsp_format = "fallback", timeout_ms = 1000, async = false } + end, + }) + + vim.api.nvim_create_user_command("FormatDisable", function(args) + if args.bang then + vim.b.disable_autoformat = true + else + vim.g.disable_autoformat = true + end + end, { + desc = "Disable autoformat-on-save", + bang = true, + }) + vim.api.nvim_create_user_command("FormatEnable", function() + vim.b.disable_autoformat = false + vim.g.disable_autoformat = false + end, { + desc = "Re-enable autoformat-on-save", + }) + end, + keys = { + { + mode = { "n", "v" }, + "lf", + function() + require("conform").format({ async = true }) + end, + desc = "Format buffer by lsp", + }, + { + "ci", + "PyrightOrganizeImports", + desc = "Organize imports", + }, + { + "bl", + function() + require("lint").try_lint() + end, + desc = "Buffer lint", + }, + { + "le", + "FormatEnable", + desc = "Enable format", + }, + { + "ld", + "FormatDisable", + desc = "Disable format", + }, + { + "lD", + "FormatDisable!", + desc = "Disable current buffer format", + }, + }, + }, + -- { + -- "neovim/nvim-lspconfig", + -- event = { "BufReadPre", "BufNewFile" }, + -- dependencies = { + -- "williamboman/mason.nvim", + -- "williamboman/mason-lspconfig.nvim", + -- "WhoIsSethDaniel/mason-tool-installer.nvim", + -- "hrsh7th/cmp-nvim-lsp", + -- "hrsh7th/cmp-buffer", + -- "hrsh7th/cmp-path", + -- "hrsh7th/cmp-cmdline", + -- { + -- "L3MON4D3/LuaSnip", + -- version = "v2.*", + -- build = "make install_jsregexp", + -- }, + -- "mfussenegger/nvim-lint", + -- "saadparwaiz1/cmp_luasnip", + -- "j-hui/fidget.nvim", + -- { "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } }, + -- { + -- "folke/lazydev.nvim", + -- ft = "lua", -- only load on lua files + -- opts = { + -- library = { + -- -- See the configuration section for more details + -- -- Load luvit types when the `vim.uv` word is found + -- { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + -- }, + -- }, + -- }, + -- "stevearc/conform.nvim", + -- "saghen/blink.cmp", + -- }, + -- init = function() + -- local wk = require("which-key") + -- wk.add({ + -- mode = { "n", "v", "x" }, + -- { "tf", group = "Format" }, + -- }) + -- end, + -- opts = { + -- servers = { + -- lua_ls = { + -- settings = { + -- Lua = { + -- workspace = { + -- checkThirdParty = false, + -- }, + -- codeLens = { + -- enable = true, + -- }, + -- completion = { + -- callSnippet = "Replace", + -- }, + -- doc = { + -- privateName = { "^_" }, + -- }, + -- hint = { + -- enable = true, + -- setType = false, + -- paramType = true, + -- paramName = "Disable", + -- semicolon = "Disable", + -- arrayIndex = "Disable", + -- }, + -- runtime = { version = "Lua 5.4" }, + -- diagnostics = { + -- globals = { "bit", "vim", "it", "describe", "before_each", "after_each" }, + -- }, + -- }, + -- }, + -- }, + -- pyright = { + -- settings = { + -- python = { + -- disableLanguageServices = false, + -- disableOrganizeImports = false, + -- }, + -- }, + -- }, + -- }, + -- }, + -- config = function(_, opts) + -- local cmp = require("blink.cmp") + -- local lspconfig = require("lspconfig") + -- + -- require("mason").setup() + -- + -- for server, config in pairs(opts.servers) do + -- -- passing config.capabilities to blink.cmp merges with the capabilities in your + -- -- `opts[server].capabilities, if you've defined it + -- config.capabilities = cmp.get_lsp_capabilities(config.capabilities) + -- lspconfig[server].setup(config) + -- require("mason-lspconfig").setup({ + -- ensure_installed = { server }, + -- handlers = { + -- [server] = function() + -- lspconfig[server].setup(config) + -- end, + -- }, + -- }) + -- end + -- + -- require("fidget").setup({ + -- progress = { + -- poll_rate = 0, -- How and when to poll for progress messages + -- suppress_on_insert = true, -- Suppress new messages while in insert mode + -- ignore_done_already = true, -- Ignore new tasks that are already complete + -- ignore_empty_message = true, -- Ignore new tasks that don't contain a message + -- clear_on_detach = function(client_id) -- Clear notification group when LSP server detaches + -- local client = vim.lsp.get_client_by_id(client_id) + -- return client and client.name or nil + -- end, + -- ignore = { "lua_ls" }, + -- }, + -- notification = { + -- window = { + -- normal_hl = "Comment", -- Base highlight group in the notification window + -- winblend = 0, -- Background color opacity in the notification window + -- border = "none", -- Border around the notification window + -- zindex = 45, -- Stacking priority of the notification window + -- max_width = 0, -- Maximum width of the notification window + -- max_height = 0, -- Maximum height of the notification window + -- x_padding = 1, -- Padding from right edge of window boundary + -- y_padding = 0, -- Padding from bottom edge of window boundary + -- align = "bottom", -- How to align the notification window + -- relative = "editor", -- What the notification window position is relative to + -- }, + -- }, + -- integration = { + -- ["nvim-tree"] = { + -- enable = false, -- Integrate with nvim-tree/nvim-tree.lua (if installed) + -- }, + -- }, + -- }) + -- + -- local lint = require("lint") + -- lint.linters_by_ft = { + -- javascript = { "eslint_d" }, + -- typescript = { "eslint_d" }, + -- javascriptreact = { "eslint_d" }, + -- typescriptreact = { "eslint_d" }, + -- svelte = { "eslint_d" }, + -- python = { "pylint" }, + -- sh = { "shellcheck" }, + -- } + -- + -- local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) + -- vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave", "TextChanged" }, { + -- group = lint_augroup, + -- callback = function() + -- lint.try_lint() + -- end, + -- }) + -- + -- require("mason-tool-installer").setup({ + -- ensure_installed = { + -- "beautysh", -- zsh formatter + -- "black", -- python formatter + -- "debugpy", -- python debuger + -- "eslint_d", -- eslint linter + -- "isort", -- python formatter + -- "markdown-toc", -- markdown toc + -- "prettier", -- prettier formatter + -- "pylint", -- python linter + -- "ruff", -- python formatter + -- "shellcheck", -- bash lint + -- "shfmt", -- sh formatter + -- "stylua", -- lua formatter + -- }, + -- integrations = { + -- ["mason-lspconfig"] = true, + -- ["mason-null-ls"] = false, + -- ["mason-nvim-dap"] = true, + -- }, + -- }) + -- + -- vim.diagnostic.config({ + -- -- update_in_insert = true, + -- float = { + -- focusable = false, + -- style = "minimal", + -- border = "rounded", + -- source = "always", + -- header = "", + -- prefix = "", + -- }, + -- }) + -- + -- require("conform").setup({ + -- formatters_by_ft = { + -- bash = { "shfmt" }, + -- css = { "prettier" }, + -- graphql = { "prettier" }, + -- html = { "prettier" }, + -- javascript = { "prettier" }, + -- javascriptreact = { "prettier" }, + -- json = { "prettier" }, + -- liquid = { "prettier" }, + -- lua = { "stylua" }, + -- markdown = { "prettier" }, + -- python = { "ruff", "isort", "black" }, + -- sh = { "shfmt" }, + -- svelte = { "prettier" }, + -- typescript = { "prettier" }, + -- typescriptreact = { "prettier" }, + -- yaml = { "prettier" }, + -- zsh = { "beautysh" }, + -- }, + -- default_format_opts = {}, + -- format_on_save = function(bufnr) + -- -- Disable with a global or buffer-local variable + -- if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + -- return + -- end + -- return { lsp_format = "fallback", timeout_ms = 1000, async = false } + -- end, + -- }) + -- + -- vim.api.nvim_create_user_command("FormatDisable", function(args) + -- if args.bang then + -- vim.b.disable_autoformat = true + -- else + -- vim.g.disable_autoformat = true + -- end + -- end, { + -- desc = "Disable autoformat-on-save", + -- bang = true, + -- }) + -- vim.api.nvim_create_user_command("FormatEnable", function() + -- vim.b.disable_autoformat = false + -- vim.g.disable_autoformat = false + -- end, { + -- desc = "Re-enable autoformat-on-save", + -- }) + -- end, + -- keys = { + -- { + -- mode = { "n", "v" }, + -- "lf", + -- function() + -- require("conform").format({ async = true }) + -- end, + -- desc = "Format buffer by lsp", + -- }, + -- { + -- "ci", + -- "PyrightOrganizeImports", + -- desc = "Organize imports", + -- }, + -- { + -- "bl", + -- function() + -- require("lint").try_lint() + -- end, + -- desc = "Buffer lint", + -- }, + -- { + -- "le", + -- "FormatEnable", + -- desc = "Enable format", + -- }, + -- { + -- "ld", + -- "FormatDisable", + -- desc = "Disable format", + -- }, + -- { + -- "lD", + -- "FormatDisable!", + -- desc = "Disable current buffer format", + -- }, + -- }, + -- }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lualine.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lualine.lua new file mode 100644 index 0000000..e9323b5 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/lualine.lua @@ -0,0 +1,259 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local navic = require("nvim-navic") + require("lualine").setup({ + options = { + icons_enabled = true, + theme = "auto", + section_separators = { left = "", right = "" }, + component_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 100, + tabline = 100, + winbar = 100, + }, + }, + sections = { + lualine_a = { + { + "mode", + fmt = function(str) + return str:sub(1, 1) + end, + }, + { + function() + local has_noice, noice = pcall(require, "noice") + if has_noice and noice.api and noice.api.status and noice.api.status.mode then + return noice.api.status.mode.get() or "" + else + return "" + end + end, + cond = function() + local has_noice, noice = pcall(require, "noice") + return has_noice + and noice.api + and noice.api.status + and noice.api.status.mode + and noice.api.status.mode.has() + end, + color = { bg = "#ff9e64" }, + }, + }, + lualine_b = { + "branch", + { + "diff", + colored = true, -- Displays a colored diff status if set to true + diff_color = { + -- Same color values as the general color option can be used here. + added = "LuaLineDiffAdd", -- Changes the diff's added color + modified = "LuaLineDiffChange", -- Changes the diff's modified color + removed = "LuaLineDiffDelete", -- Changes the diff's removed color you + }, + symbols = { added = "+", modified = "~", removed = "-" }, -- Changes the symbols used by the diff. + source = nil, -- A function that works as a data source for diff. + -- It must return a table as such: + -- { added = add_count, modified = modified_count, removed = removed_count } + -- or nil on failure. count <= 0 won't be displayed. + }, + { + "diagnostics", + -- Table of diagnostic sources, available sources are: + -- 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic', 'coc', 'ale', 'vim_lsp'. + -- or a function that returns a table as such: + -- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt } + sources = { "nvim_lsp", "nvim_diagnostic", "nvim_workspace_diagnostic", "coc" }, + + -- Displays diagnostics for the defined severity types + sections = { "error", "warn", "info", "hint" }, + + diagnostics_color = { + -- Same values as the general color option can be used here. + error = "DiagnosticError", -- Changes diagnostics' error color. + warn = "DiagnosticWarn", -- Changes diagnostics' warn color. + info = "DiagnosticInfo", -- Changes diagnostics' info color. + hint = "DiagnosticHint", -- Changes diagnostics' hint color. + }, + symbols = { error = "E", warn = "W", info = "I", hint = "H" }, + colored = true, -- Displays diagnostics status in color if set to true. + update_in_insert = true, -- Update diagnostics in insert mode. + always_visible = false, -- Show diagnostics even if there are none. + }, + }, + lualine_c = { + { + "filename", + file_status = true, -- Displays file status (readonly status, modified status) + newfile_status = true, -- Display new file status (new file means no write after created) + path = 3, -- 0: Just the filename + -- 1: Relative path + -- 2: Absolute path + -- 3: Absolute path, with tilde as the home directory + -- 4: Filename and parent dir, with tilde as the home directory + + shorting_target = 40, -- Shortens path to leave 40 spaces in the window + -- for other components. (terrible name, any suggestions?) + symbols = { + modified = "[*]", -- Text to show when the file is modified. + readonly = "[r]", -- Text to show when the file is non-modifiable or readonly. + unnamed = "[?]", -- Text to show for unnamed buffers. + newfile = "[%%]", -- Text to show for newly created file before first write + }, + }, + }, + lualine_x = { + { + function() + local has_noice, noice = pcall(require, "noice") + if has_noice and noice.api and noice.api.status and noice.api.status.mode then + return noice.api.status.search.get() or "" + else + return "" + end + end, + cond = function() + local has_noice, noice = pcall(require, "noice") + return has_noice + and noice.api + and noice.api.status + and noice.api.status.search + and noice.api.status.search.has() + end, + color = { bg = "#ff9e64" }, + }, + "copilot", + { + function() + return require("molten.status").initialized() + end, + }, + "encoding", + "fileformat", + { + "filetype", + colored = true, -- Displays filetype icon in color if set to true + icon_only = true, -- Display only an icon for filetype + icon = { align = "right" }, -- Display filetype icon on the right hand side + -- icon = {'X', align='right'} + -- Icon string ^ in table is ignored in filetype component + }, + }, + lualine_y = { + "progress", + }, + lualine_z = { + { + function() + local is_tmux = os.getenv("TMUX") ~= nil + if is_tmux then + return "" + end + return os.date("%H:%M") + end, + }, + }, + }, + inactive_sections = {}, + tabline = { + lualine_a = { + { + "tabs", + tab_max_length = 40, -- Maximum width of each tab. The content will be shorten dynamically (example: apple/orange -> a/orange) + max_length = vim.o.columns / 3, -- Maximum width of tabs component. + -- Note: + -- It can also be a function that returns + -- the value of `max_length` dynamically. + mode = 0, -- 0: Shows tab_nr + -- 1: Shows tab_name + -- 2: Shows tab_nr + tab_name + + path = nil, -- 0: just shows the filename + -- 1: shows the relative path and shorten $HOME to ~ + -- 2: shows the full path + -- 3: shows the full path and shorten $HOME to ~ + + -- Automatically updates active tab color to match color of other components (will be overidden if buffers_color is set) + use_mode_colors = true, + + -- tabs_color = { + -- -- Same values as the general color option can be used here. + -- active = "lualine_{section}_normal", -- Color for active tab. + -- inactive = "lualine_{section}_inactive", -- Color for inactive tab. + -- }, + -- + show_modified_status = false, -- Shows a symbol next to the tab name if the file has been modified. + symbols = { + modified = "*", -- Text to show when the file is modified. + }, + + fmt = function(name, context) + -- Show + if buffer is modified in tab + local buflist = vim.fn.tabpagebuflist(context.tabnr) + local winnr = vim.fn.tabpagewinnr(context.tabnr) + local bufnr = buflist[winnr] + local mod = vim.fn.getbufvar(bufnr, "&mod") + + return name .. (mod == 1 and " +" or "") + end, + }, + }, + lualine_b = { + { + function() + local function buffer_status() + local buffers = vim.fn.getbufinfo({ buflisted = true }) + local current_buf = vim.fn.bufnr() + local current_buffer_index = 0 + local modified_symbol = vim.bo.modified and "●" or "" + for i, buf in ipairs(buffers) do + if buf.bufnr == current_buf then + current_buffer_index = i + break + end + end + return string.format("%s%d/%d", modified_symbol, current_buffer_index, #buffers) + end + return buffer_status() + end, + }, + }, + lualine_c = { + { + function() + return navic.get_location() + end, + cond = function() + return navic.is_available() + end, + }, + }, + lualine_x = {}, + lualine_y = {}, + lualine_z = {}, + }, + winbar = {}, + inactive_winbar = {}, + extensions = {}, + }) + + local lualine_hidden = true + vim.keymap.set({ "n", "v" }, "zl", function() + lualine_hidden = not lualine_hidden + require("lualine").hide({ + place = { "statusline", "tabline", "winbar" }, + unhide = lualine_hidden, + }) + end, { desc = "Toggle lualine" }) + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/markdown.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/markdown.lua new file mode 100644 index 0000000..fa5051e --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/markdown.lua @@ -0,0 +1,454 @@ +-- Select the current cell +local function select_cell() + local bufnr = vim.api.nvim_get_current_buf() + local current_row = vim.api.nvim_win_get_cursor(0)[1] + local current_col = vim.api.nvim_win_get_cursor(0)[2] + + local start_line = nil + local end_line = nil + local line_count = vim.api.nvim_buf_line_count(bufnr) + + -- Find the start of the cell (looking for opening markers or headers) + for line = current_row, 1, -1 do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:match("^```%s*[%w_%-]+") or line_content:match("^%s*#+%s") then + start_line = line + break + end + end + + -- If no start line is found, assume start of the file + if not start_line then + start_line = 1 + end + + -- Find the end of the cell (looking for the next opening marker or header) + for line = start_line + 1, line_count do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:match("^```%s*[%w_%-]+") or line_content:match("^%s*#+%s") then + end_line = line - 1 + break + end + end + + -- If no end line is found, assume end of the file + if not end_line then + end_line = line_count + end + + return current_row, current_col, start_line, end_line +end + +-- Delete the current cell +local function delete_cell() + local _, _, start_line, end_line = select_cell() -- Use select_cell to get start and end lines of the cell + if start_line and end_line then + -- Move cursor to the start of the cell + vim.api.nvim_win_set_cursor(0, { start_line, 0 }) + + -- Enter visual line mode to select the cell + vim.cmd("normal! V") + -- Move cursor to the end of the cell to extend selection + vim.api.nvim_win_set_cursor(0, { end_line, 0 }) + + -- Delete the selected lines + vim.cmd("normal! d") + end +end + +-- Navigate to the next or previous cell +local function navigate_cell(up) + local bufnr = vim.api.nvim_get_current_buf() + local line_count = vim.api.nvim_buf_line_count(bufnr) + local _, _, start_line, end_line = select_cell() -- Get the start and end lines of the current cell + + local target_line = nil + + if up then + -- Find the previous cell start, skipping any closing markers + for line = start_line - 1, 1, -1 do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:match("^```%s*[%w_%-]+") or line_content:match("^%s*#+%s") then + target_line = line + break + end + end + else + -- Find the next cell start, skipping any closing markers + for line = end_line + 1, line_count do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:match("^```%s*[%w_%-]+") or line_content:match("^%s*#+%s") then + target_line = line + break + end + end + end + + -- Navigate to the target line if found, otherwise stay at the current position + if target_line then + -- If the target is a code block, move cursor to the line right after the opening marker + local target_line_content = vim.api.nvim_buf_get_lines(bufnr, target_line - 1, target_line, false)[1] + if target_line_content:match("^```%s*[%w_%-]+") then + vim.api.nvim_win_set_cursor(0, { target_line + 1, 0 }) -- Move inside the code block + else + vim.api.nvim_win_set_cursor(0, { target_line, 0 }) -- Move to the markdown header line + end + else + if up then + vim.api.nvim_win_set_cursor(0, { 1, 0 }) -- Move to start of file if no previous cell found + else + vim.api.nvim_win_set_cursor(0, { line_count, 0 }) -- Move to end of file if no next cell found + end + end +end + +-- Insert a new cell with specific content +local function insert_cell(content) + local _, _, _, end_line = select_cell() + local bufnr = vim.api.nvim_get_current_buf() + local line = end_line + if end_line ~= 1 then + line = end_line - 1 + vim.api.nvim_win_set_cursor(0, { end_line - 1, 0 }) + else + line = end_line + vim.api.nvim_win_set_cursor(0, { end_line, 0 }) + end + + vim.cmd("normal!2o") + vim.api.nvim_buf_set_lines(bufnr, line, line + 1, false, { content }) + vim.cmd("normal!2o") + vim.cmd("normal!k") +end + +-- Insert a new code cell +local function insert_code_cell() + insert_cell("```python") -- For regular code cells +end + +return { + -- { + -- "ixru/nvim-markdown", + -- config = function() + -- vim.g.vim_markdown_no_default_key_mappings = 1 + -- end, + -- }, + { + "MeanderingProgrammer/render-markdown.nvim", + enabled = true, + -- dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite + dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.icons" }, -- if you use standalone mini plugins + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = {}, + config = function() + -- require("obsidian").get_client().opts.ui.enable = false + -- vim.api.nvim_buf_clear_namespace(0, vim.api.nvim_get_namespaces()["ObsidianUI"], 0, -1) + require("render-markdown").setup({ + bullet = { + -- Turn on / off list bullet rendering + enabled = true, + }, + heading = { + sign = false, + icons = { "󰎤 ", "󰎧 ", "󰎪 ", "󰎭 ", "󰎱 ", "󰎳 " }, + }, + file_types = { "markdown", "vimwiki" }, + }) + vim.treesitter.language.register("markdown", "vimwiki") + end, + }, + { + -- Install markdown preview, use npx if available. + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function(plugin) + if vim.fn.executable("npx") then + vim.cmd("!cd " .. plugin.dir .. " && cd app && npx --yes yarn install") + else + vim.cmd([[Lazy load markdown-preview.nvim]]) + vim.fn["mkdp#util#install"]() + end + end, + init = function() + if vim.fn.executable("npx") then + vim.g.mkdp_filetypes = { "markdown" } + end + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "m", group = "Markdown/Map" }, + }) + end, + keys = { + { "mp", "MarkdownPreview", desc = "Markdown Preview" }, + { "mx", "MarkdownPreviewStop", desc = "Markdown Stop" }, + { "md", "MarkdownPreviewToggle", desc = "Markdown Toggle" }, + }, + }, + { + "dhruvasagar/vim-open-url", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "g", group = "Search word under curosr" }, + { "gB", group = "Open url in browser" }, + { "gG", group = "Google search word under cursor" }, + { "gW", group = "Wikipedia search word under cursor" }, + }) + end, + }, + { + "AckslD/nvim-FeMaco.lua", + config = function() + require("femaco").setup() + end, + }, + { + "goerz/jupytext.vim", + lazy = false, + build = "pip install jupytext", + dependencies = { "neovim/nvim-lspconfig" }, + config = function() + -- The destination format: 'ipynb', 'markdown' or 'script', or a file extension: 'md', 'Rmd', 'jl', 'py', 'R', ..., 'auto' (script + -- extension matching the notebook language), or a combination of an extension and a format name, e.g. md:markdown, md:pandoc, + -- md:myst or py:percent, py:light, py:nomarker, py:hydrogen, py:sphinx. The default format for scripts is the 'light' format, + -- which uses few cell markers (none when possible). Alternatively, a format compatible with many editors is the 'percent' format, + -- which uses '# %%' as cell markers. The main formats (markdown, light, percent) preserve notebooks and text documents in a + -- roundtrip. Use the --test and and --test-strict commands to test the roundtrip on your files. Read more about the available + -- formats at https://jupytext.readthedocs.io/en/latest/formats.html (default: None) + vim.g.jupytext_fmt = "markdown" + end, + keys = { + { "", insert_code_cell, desc = "Insert Code Cell" }, + { "", delete_cell, desc = "Delete Cell" }, + { + "", + function() + navigate_cell(true) + end, + desc = "Previous Cell", + }, + { "", navigate_cell, desc = "Next Cell" }, + }, + }, + { + "vhyrro/luarocks.nvim", + priority = 1001, -- this plugin needs to run before anything else + init = function() + package.path = package.path + .. ";" + .. vim.fn.expand("$HOME") + .. "/.config/luarocks/share/lua/5.1/magick/init.lua;" + end, + opt = { + rocks = { "magick" }, + }, + }, + { "benlubas/image-save.nvim", cmd = "SaveImage" }, + { + "3rd/image.nvim", + dependencies = { "leafo/magick", "vhyrro/luarocks.nvim" }, + config = function() + require("image").setup({ + backend = "ueberzug", -- or "kitty", whatever backend you would like to use + processor = "magick_rock", -- or "magick_cli" + integrations = { + markdown = { + enabled = true, + clear_in_insert_mode = false, + download_remote_images = false, + only_render_image_at_cursor = false, + floating_windows = false, -- if true, images will be rendered in floating markdown windows + filetypes = { "markdown", "quarto" }, -- markdown extensions (ie. quarto) can go here + }, + neorg = { + enabled = true, + filetypes = { "norg" }, + }, + typst = { + enabled = true, + filetypes = { "typst" }, + }, + html = { + enabled = false, + }, + css = { + enabled = false, + }, + }, + max_width = 100, + max_height = 8, + max_height_window_percentage = math.huge, + max_width_window_percentage = math.huge, + window_overlap_clear_enabled = true, -- toggles images when windows are overlapped + window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "fidget", "" }, + editor_only_render_when_focused = true, -- auto show/hide images when the editor gains/looses focus + tmux_show_only_in_active_window = true, -- auto show/hide images in the correct Tmux window (needs visual-activity off) + hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened + }) + end, + }, + { + "quarto-dev/quarto-nvim", + dependencies = { + { + "jmbuhr/otter.nvim", + lazy = false, + dependencies = { + "nvim-treesitter/nvim-treesitter", + }, + opts = {}, + config = function() + require("otter").setup() + end, + }, + "nvim-cmp", + "neovim/nvim-lspconfig", + "nvim-treesitter/nvim-treesitter", + "otter.nvim", + }, + ft = { "quarto", "markdown" }, + command = "QuartoActivate", + config = function() + require("quarto").setup({ + lspFeatures = { + languages = { "r", "python", "rust", "lua" }, + chunks = "all", + diagnostics = { + enabled = true, + triggers = { "BufWritePost" }, + }, + completion = { + enabled = true, + }, + }, + keymap = { + hover = "H", + definition = "gd", + rename = "rn", + references = "gr", + format = "gf", + }, + codeRunner = { + enabled = true, + default_method = "molten", + ft_runners = { + bash = "slime", + python = "molten", + }, + never_run = { "yaml" }, -- filetypes which are never sent to a code runner + }, + }) + local runner = require("quarto.runner") + vim.keymap.set("n", "jc", runner.run_cell, { silent = true, desc = "Run cell" }) + vim.keymap.set("n", "jC", runner.run_above, { silent = true, desc = "Run above cell" }) + vim.keymap.set("n", "jl", runner.run_line, { silent = true, desc = "Run line" }) + vim.keymap.set("v", "jv", runner.run_range, { silent = true, desc = "Run block" }) + vim.keymap.set("n", "jA", runner.run_all, { silent = true, desc = "Run all" }) + vim.keymap.set( + "n", + "qp", + require("quarto").quartoPreview, + { noremap = true, silent = true, desc = "Preview the quarto document" } + ) + -- to create a cell in insert mode, I have the ` snippet + vim.keymap.set( + "n", + "cc", + "i```python\n```O", + { silent = true, desc = "Create a new code cell" } + ) + vim.keymap.set( + "n", + "cs", + "i```\r\r```{}", + { noremap = true, silent = true, desc = "Split code cell" } + ) + end, + }, + { + "benlubas/molten-nvim", + version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes + dependencies = { "3rd/image.nvim" }, + build = ":UpdateRemotePlugins", + init = function() + vim.g.molten_auto_image_popup = true + vim.g.molten_auto_init_behavior = "raise" + vim.g.molten_auto_open_html_in_browser = false + -- I find auto open annoying, keep in mind setting this option will require setting + -- a keybind for `:noautocmd MoltenEnterOutput` to open the output again + vim.g.molten_auto_open_output = true + vim.g.molten_cover_empty_lines = false + vim.g.molten_cover_lines_starting_with = {} + vim.g.molten_copy_output = false + vim.g.molten_enter_output_behavior = "open_then_enter" + -- this guide will be using image.nvim + -- Don't forget to setup and install the plugin if you want to view image outputs + vim.g.molten_image_provider = "image.nvim" + vim.g.molten_output_show_more = false + vim.g.molten_output_win_max_height = 30 + vim.g.molten_output_win_style = "minimal" + -- this will make it so the output shows up below the \`\`\` cell delimiter + vim.g.molten_virt_lines_off_by_1 = true + -- Output as virtual text. Allows outputs to always be shown, works with images, but can + -- be buggy with longer images + vim.g.molten_virt_text_output = true + -- optional, works for virt text and the output window + vim.g.molten_wrap_output = true + vim.g.molten_virt_text_max_lines = 20 + + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "j", group = "Molten (Jupyter)" }, + }) + end, + config = function() + -- image nvim options table. Pass to `require('image').setup` + vim.keymap.set("n", "jJ", ":MoltenInit", { silent = true, desc = "Init molten" }) + vim.keymap.set( + "n", + "jo", + ":MoltenEvaluateOperator", + { silent = true, desc = "Evaluate operator" } + ) + vim.keymap.set("n", "jL", ":MoltenEvaluateLine", { silent = true, desc = "Evaluate line" }) + vim.keymap.set("n", "jr", ":MoltenReevaluateCell", { silent = true, desc = "Re-evaluate cell" }) + vim.keymap.set( + "v", + "jV", + ":MoltenEvaluateVisualgv", + { silent = true, desc = "Evaluate visual block" } + ) + vim.keymap.set("n", "jd", ":MoltenDelete", { silent = true, desc = "Delete molten" }) + vim.keymap.set("n", "jh", ":MoltenHideOutput", { silent = true, desc = "Hide output" }) + vim.keymap.set( + "n", + "jm", + ":noautocmd MoltenEnterOutput", + { silent = true, desc = "Enter output" } + ) + vim.api.nvim_create_autocmd("User", { + pattern = "MoltenInitPost", + callback = function() + require("quarto").activate() + end, + }) + vim.keymap.set("n", "ji", ":MoltenImagePopup", { silent = true, desc = "Pop-up image" }) + vim.keymap.set("n", "jw", ":MoltenOpenInBrowser", { silent = true, desc = "Open in browser" }) + vim.keymap.set("n", "jj", function() + local venv = os.getenv("WORKON_HOME") + if venv ~= nil then + venv = string.match(venv, "/.+/(.+)") + vim.cmd(("MoltenInit %s"):format(venv)) + else + vim.cmd("MoltenInit python3") + end + end, { desc = "Init default molten" }) + end, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/marks.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/marks.lua new file mode 100644 index 0000000..d59d0f1 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/marks.lua @@ -0,0 +1,16 @@ +return { + "chentoast/marks.nvim", + config = function() + require("marks").setup() + end, + init = function() + local wk = require("which-key") + wk.add({ + { + mode = { "n", "v" }, + { "m", group = "Marks" }, + { "dm", desc = "Delete marks" }, + }, + }) + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/mini.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/mini.lua new file mode 100644 index 0000000..d520afc --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/mini.lua @@ -0,0 +1,1132 @@ +-- Updated pattern to match what Echasnovski has in the documentation +-- https://github.com/echasnovski/mini.nvim/blob/c6eede272cfdb9b804e40dc43bb9bff53f38ed8a/doc/mini-files.txt#L508-L529 + +-- Define a function to update MiniJump highlight based on Search +local function update_mini_jump_highlight() + local search_hl = vim.api.nvim_get_hl(0, { name = "Search" }) + vim.api.nvim_set_hl(0, "MiniJump", { + fg = search_hl.fg, + bg = search_hl.bg, + bold = search_hl.bold or false, + }) +end + +return { + { + "echasnovski/mini.ai", + version = false, + config = function() + require("mini.ai").setup({ + -- Table with textobject id as fields, textobject specification as values. + -- Also use this to disable builtin textobjects. See |MiniAi.config|. + custom_textobjects = nil, + + -- Module mappings. Use `''` (empty string) to disable one. + mappings = { + -- Main textobject prefixes + around = "a", + inside = "i", + + -- Next/last variants + around_next = "an", + inside_next = "in", + around_last = "al", + inside_last = "il", + + -- Move cursor to corresponding edge of `a` textobject + goto_left = "g[", + goto_right = "g]", + }, + + -- Number of lines within which textobject is searched + n_lines = 50, + + -- How to search for object (first inside current line, then inside + -- neighborhood). One of 'cover', 'cover_or_next', 'cover_or_prev', + -- 'cover_or_nearest', 'next', 'previous', 'nearest'. + search_method = "cover_or_next", + + -- Whether to disable showing non-error feedback + -- This also affects (purely informational) helper messages shown after + -- idle time if user input is required. + silent = false, + }) + end, + }, + { + "echasnovski/mini.bracketed", + version = false, + config = function() + require("mini.bracketed").setup({ + buffer = { suffix = "", options = {} }, + comment = { suffix = "", options = {} }, + conflict = { suffix = "", options = {} }, + diagnostic = { suffix = "", options = {} }, + file = { suffix = "", options = {} }, + indent = { suffix = "", options = {} }, + jump = { suffix = "", options = {} }, + location = { suffix = "", options = {} }, + oldfile = { suffix = "", options = {} }, + quickfix = { suffix = "", options = {} }, + treesitter = { suffix = "", options = {} }, + undo = { suffix = "", options = {} }, + window = { suffix = "", options = {} }, + yank = { suffix = "", options = {} }, + }) + + vim.keymap.set("n", "[B", "lua MiniBracketed.buffer('first')", { desc = "Buffer first" }) + vim.keymap.set( + "n", + "[b", + "lua MiniBracketed.buffer('backward')", + { desc = "Buffer backward" } + ) + vim.keymap.set( + "n", + "]b", + "lua MiniBracketed.buffer('forward')", + { desc = "Buffer forward" } + ) + vim.keymap.set("n", "]B", "lua MiniBracketed.buffer('last')", { desc = "Buffer last" }) + vim.keymap.set("n", "[C", "lua MiniBracketed.comment('first')", { desc = "Comment first" }) + vim.keymap.set( + "n", + "[c", + "lua MiniBracketed.comment('backward')", + { desc = "Comment backward" } + ) + vim.keymap.set( + "n", + "]c", + "lua MiniBracketed.comment('forward')", + { desc = "Comment forward" } + ) + vim.keymap.set("n", "]C", "lua MiniBracketed.comment('last')", { desc = "Comment last" }) + vim.keymap.set( + "n", + "[X", + "lua MiniBracketed.conflict('first')", + { desc = "Conflict first" } + ) + vim.keymap.set( + "n", + "[x", + "lua MiniBracketed.conflict('backward')", + { desc = "Conflict backward" } + ) + vim.keymap.set( + "n", + "]x", + "lua MiniBracketed.conflict('forward')", + { desc = "Conflict forward" } + ) + vim.keymap.set("n", "]X", "lua MiniBracketed.conflict('last')", { desc = "Conflict last" }) + vim.keymap.set( + "n", + "[D", + "lua MiniBracketed.diagnostic('first')", + { desc = "Diagnostic first" } + ) + vim.keymap.set( + "n", + "[d", + "lua MiniBracketed.diagnostic('backward')", + { desc = "Diagnostic backward" } + ) + vim.keymap.set( + "n", + "]d", + "lua MiniBracketed.diagnostic('forward')", + { desc = "Diagnostic forward" } + ) + vim.keymap.set( + "n", + "]D", + "lua MiniBracketed.diagnostic('last')", + { desc = "Diagnostic last" } + ) + vim.keymap.set("n", "[F", "lua MiniBracketed.file('first')", { desc = "File first" }) + vim.keymap.set("n", "[f", "lua MiniBracketed.file('backward')", { desc = "File backward" }) + vim.keymap.set("n", "]f", "lua MiniBracketed.file('forward')", { desc = "File forward" }) + vim.keymap.set("n", "]F", "lua MiniBracketed.file('last')", { desc = "File last" }) + vim.keymap.set("n", "[I", "lua MiniBracketed.indent('first')", { desc = "Indent first" }) + vim.keymap.set( + "n", + "[i", + "lua MiniBracketed.indent('backward')", + { desc = "Indent backward" } + ) + vim.keymap.set( + "n", + "]i", + "lua MiniBracketed.indent('forward')", + { desc = "Indent forward" } + ) + vim.keymap.set("n", "]I", "lua MiniBracketed.indent('last')", { desc = "Indent last" }) + vim.keymap.set("n", "[J", "lua MiniBracketed.jump('first')", { desc = "Jump first" }) + vim.keymap.set("n", "[j", "lua MiniBracketed.jump('backward')", { desc = "Jump backward" }) + vim.keymap.set("n", "]j", "lua MiniBracketed.jump('forward')", { desc = "Jump forward" }) + vim.keymap.set("n", "]J", "lua MiniBracketed.jump('last')", { desc = "Jump last" }) + vim.keymap.set( + "n", + "[L", + "lua MiniBracketed.location('first')", + { desc = "Location first" } + ) + vim.keymap.set( + "n", + "[l", + "lua MiniBracketed.location('backward')", + { desc = "Location backward" } + ) + vim.keymap.set( + "n", + "]l", + "lua MiniBracketed.location('forward')", + { desc = "Location forward" } + ) + vim.keymap.set("n", "]L", "lua MiniBracketed.location('last')", { desc = "Location last" }) + vim.keymap.set("n", "[O", "lua MiniBracketed.oldfile('first')", { desc = "Oldfile first" }) + vim.keymap.set( + "n", + "[o", + "lua MiniBracketed.oldfile('backward')", + { desc = "Oldfile backward" } + ) + vim.keymap.set( + "n", + "]o", + "lua MiniBracketed.oldfile('forward')", + { desc = "Oldfile forward" } + ) + vim.keymap.set("n", "]O", "lua MiniBracketed.oldfile('last')", { desc = "Oldfile last" }) + vim.keymap.set( + "n", + "[Q", + "lua MiniBracketed.quickfix('first')", + { desc = "Quickfix first" } + ) + vim.keymap.set( + "n", + "[q", + "lua MiniBracketed.quickfix('backward')", + { desc = "Quickfix backward" } + ) + vim.keymap.set( + "n", + "]q", + "lua MiniBracketed.quickfix('forward')", + { desc = "Quickfix forward" } + ) + vim.keymap.set("n", "]Q", "lua MiniBracketed.quickfix('last')", { desc = "Quickfix last" }) + vim.keymap.set( + "n", + "[T", + "lua MiniBracketed.treesitter('first')", + { desc = "Treesitter first" } + ) + vim.keymap.set( + "n", + "[t", + "lua MiniBracketed.treesitter('backward')", + { desc = "Treesitter backward" } + ) + vim.keymap.set( + "n", + "]t", + "lua MiniBracketed.treesitter('forward')", + { desc = "Treesitter forward" } + ) + vim.keymap.set( + "n", + "]T", + "lua MiniBracketed.treesitter('last')", + { desc = "Treesitter last" } + ) + vim.keymap.set("n", "[U", "lua MiniBracketed.undo('first')", { desc = "Undo first" }) + vim.keymap.set("n", "[u", "lua MiniBracketed.undo('backward')", { desc = "Undo backward" }) + vim.keymap.set("n", "]u", "lua MiniBracketed.undo('forward')", { desc = "Undo forward" }) + vim.keymap.set("n", "]U", "lua MiniBracketed.undo('last')", { desc = "Undo last" }) + vim.keymap.set("n", "w0", "lua MiniBracketed.window('first')", { desc = "Window first" }) + vim.keymap.set( + "n", + "w[", + "lua MiniBracketed.window('backward')", + { desc = "Window backward" } + ) + vim.keymap.set( + "n", + "w]", + "lua MiniBracketed.window('forward')", + { desc = "Window forward" } + ) + vim.keymap.set("n", "w$", "lua MiniBracketed.window('last')", { desc = "Window last" }) + vim.keymap.set("n", "[Y", "lua MiniBracketed.yank('first')", { desc = "Yank first" }) + vim.keymap.set("n", "[y", "lua MiniBracketed.yank('backward')", { desc = "Yank backward" }) + vim.keymap.set("n", "]y", "lua MiniBracketed.yank('forward')", { desc = "Yank forward" }) + vim.keymap.set("n", "]Y", "lua MiniBracketed.yank('last')", { desc = "Yank last" }) + end, + }, + { + "echasnovski/mini.files", + opts = { + -- I didn't like the default mappings, so I modified them + -- Module mappings created only inside explorer. + -- Use `''` (empty string) to not create one. + mappings = { + close = "q", + -- Use this if you want to open several files + go_in = "l", + -- This opens the file, but quits out of mini.files (default L) + go_in_plus = "", + -- I swapped the following 2 (default go_out: h) + -- go_out_plus: when you go out, it shows you only 1 item to the right + -- go_out: shows you all the items to the right + go_out = "H", + go_out_plus = "h", + -- Default + reset = ",", + -- Default @ + reveal_cwd = ".", + show_help = "g?", + -- Default = + synchronize = "s", + trim_left = "<", + trim_right = ">", + toggle_hidden = nil, + change_cwd = nil, + go_in_horizontal = nil, + go_in_vertical = nil, + go_in_horizontal_plus = nil, + go_in_vertical_plus = nil, + }, + options = { + use_as_default_explorer = true, + permanent_delete = false, + }, + windows = { + preview = true, + width_focus = 25, + width_preview = 40, + }, + }, + keys = { + { + "e", + function() + if not MiniFiles.close() then + require("mini.files").open(vim.api.nvim_buf_get_name(0), true) + end + end, + desc = "Open mini.files", + }, + { + "E", + function() + require("mini.files").open(vim.uv.cwd(), true) + end, + desc = "Open mini.files (cwd)", + }, + }, + config = function(_, opts) + require("mini.files").setup(opts) + + local show_dotfiles = true + local filter_show = function(fs_entry) + return true + end + local filter_hide = function(fs_entry) + return not vim.startswith(fs_entry.name, ".") + end + + local toggle_dotfiles = function() + show_dotfiles = not show_dotfiles + local new_filter = show_dotfiles and filter_show or filter_hide + require("mini.files").refresh({ content = { filter = new_filter } }) + end + + local map_split = function(buf_id, lhs, direction, close_on_file) + local rhs = function() + local new_target_window + local cur_target_window = require("mini.files").get_explorer_state().arget_window + + if cur_target_window ~= nil then + vim.api.nvim_win_call(cur_target_window, function() + vim.cmd("belowright " .. direction .. " split") + new_target_window = vim.api.nvim_get_current_win() + end) + + require("mini.files").set_target_window(new_target_window) + require("mini.files").go_in({ close_on_file = close_on_file }) + end + end + + local desc = "Open in " .. direction .. " split" + if close_on_file then + desc = desc .. " and close" + end + vim.keymap.set("n", lhs, rhs, { buffer = buf_id, desc = desc }) + end + + local files_set_cwd = function() + local cur_entry_path = MiniFiles.get_fs_entry().path + local cur_directory = vim.fs.dirname(cur_entry_path) + if cur_directory ~= nil then + vim.fn.chdir(cur_directory) + end + end + + local mini_files = require("mini.files") + local tmux_pane_function = require("thesiahxyz.utils.tmux").tmux_pane_function + + local open_tmux_pane = function() + local curr_entry = mini_files.get_fs_entry() + if curr_entry then + if curr_entry.fs_type == "directory" then + tmux_pane_function(curr_entry.path) + elseif curr_entry.fs_type == "file" then + local parent_dir = vim.fn.fnamemodify(curr_entry.path, ":h") + tmux_pane_function(parent_dir) + elseif curr_entry.fs_type == "link" then + local resolved_path = vim.fn.resolve(curr_entry.path) + if vim.fn.isdirectory(resolved_path) == 1 then + tmux_pane_function(resolved_path) + else + local parent_dir = vim.fn.fnamemodify(resolved_path, ":h") + tmux_pane_function(parent_dir) + end + else + vim.notify("Unsupported file system entry type", vim.log.levels.WARN) + end + else + vim.notify("No entry selected", vim.log.levels.WARN) + end + end + + local copy_to_clipboard = function() + local curr_entry = mini_files.get_fs_entry() + if curr_entry then + local path = curr_entry.path + -- Escape the path for shell command + local escaped_path = vim.fn.fnameescape(path) + local cmd = vim.fn.has("mac") == 1 + and string.format([[osascript -e 'set the clipboard to POSIX file "%s"']], escaped_path) + or string.format([[echo -n %s | xclip -selection clipboard]], escaped_path) + local result = vim.fn.system(cmd) + if vim.v.shell_error ~= 0 then + vim.notify("Copy failed: " .. result, vim.log.levels.ERROR) + else + vim.notify(vim.fn.fnamemodify(path, ":t"), vim.log.levels.INFO) + vim.notify("Copied to system clipboard", vim.log.levels.INFO) + end + else + vim.notify("No file or directory selected", vim.log.levels.WARN) + end + end + + local zip_and_copy_to_clipboard = function() + local curr_entry = require("mini.files").get_fs_entry() + if curr_entry then + local path = curr_entry.path + local name = vim.fn.fnamemodify(path, ":t") -- Extract the file or directory name + local parent_dir = vim.fn.fnamemodify(path, ":h") -- Get the parent directory + local timestamp = os.date("%y%m%d%H%M%S") -- Append timestamp to avoid duplicates + local zip_path = string.format("/tmp/%s_%s.zip", name, timestamp) -- Path in macOS's tmp directory + -- Create the zip file + local zip_cmd = string.format( + "cd %s && zip -r %s %s", + vim.fn.shellescape(parent_dir), + vim.fn.shellescape(zip_path), + vim.fn.shellescape(name) + ) + local result = vim.fn.system(zip_cmd) + if vim.v.shell_error ~= 0 then + vim.notify("Failed to create zip file: " .. result, vim.log.levels.ERROR) + return + end + -- Copy the zip file to the system clipboard + local copy_cmd = vim.fn.has("mac") == 1 + and string.format([[osascript -e 'set the clipboard to POSIX file "%s"']], zip_path) + or string.format([[echo -n %s | xclip -selection clipboard]], zip_path) + local copy_result = vim.fn.system(copy_cmd) + if vim.v.shell_error ~= 0 then + vim.notify("Failed to copy zip file to clipboard: " .. copy_result, vim.log.levels.ERROR) + return + end + vim.notify(zip_path, vim.log.levels.INFO) + vim.notify("Zipped and copied to clipboard: ", vim.log.levels.INFO) + else + vim.notify("No file or directory selected", vim.log.levels.WARN) + end + end + + local paste_from_clipboard = function() + -- vim.notify("Starting the paste operation...", vim.log.levels.INFO) + if not mini_files then + vim.notify("mini.files module not loaded.", vim.log.levels.ERROR) + return + end + local curr_entry = mini_files.get_fs_entry() -- Get the current file system entry + if not curr_entry then + vim.notify("Failed to retrieve current entry in mini.files.", vim.log.levels.ERROR) + return + end + local curr_dir = curr_entry.fs_type == "directory" and curr_entry.path + or vim.fn.fnamemodify(curr_entry.path, ":h") -- Use parent directory if entry is a file + -- vim.notify("Current directory: " .. curr_dir, vim.log.levels.INFO) + local script = [[ + tell application "System Events" + try + set theFile to the clipboard as alias + set posixPath to POSIX path of theFile + return posixPath + on error + return "error" + end try + end tell + ]] + local output = vim.fn.has("mac") == 1 and vim.fn.system("osascript -e " .. vim.fn.shellescape(script)) + or vim.fn.system("xclip -o -selection clipboard") + if vim.v.shell_error ~= 0 or output:find("error") then + vim.notify("Clipboard does not contain a valid file or directory.", vim.log.levels.WARN) + return + end + local source_path = output:gsub("%s+$", "") -- Trim whitespace from clipboard output + if source_path == "" then + vim.notify("Clipboard is empty or invalid.", vim.log.levels.WARN) + return + end + local dest_path = curr_dir .. "/" .. vim.fn.fnamemodify(source_path, ":t") -- Destination path in current directory + local copy_cmd = vim.fn.isdirectory(source_path) == 1 and { "cp", "-R", source_path, dest_path } + or { "cp", source_path, dest_path } -- Construct copy command + local result = vim.fn.system(copy_cmd) -- Execute the copy command + if vim.v.shell_error ~= 0 then + vim.notify("Paste operation failed: " .. result, vim.log.levels.ERROR) + return + end + -- vim.notify("Pasted " .. source_path .. " to " .. dest_path, vim.log.levels.INFO) + mini_files.synchronize() -- Refresh mini.files to show updated directory content + vim.notify("Pasted successfully.", vim.log.levels.INFO) + end + + local copy_path_to_clipboard = function() + -- Get the current entry (file or directory) + local curr_entry = mini_files.get_fs_entry() + if curr_entry then + -- Convert path to be relative to home directory + local home_dir = vim.fn.expand("~") + local relative_path = curr_entry.path:gsub("^" .. home_dir, "~") + vim.fn.setreg("+", relative_path) -- Copy the relative path to the clipboard register + vim.notify(vim.fn.fnamemodify(relative_path, ":t"), vim.log.levels.INFO) + vim.notify("Path copied to clipboard: ", vim.log.levels.INFO) + else + vim.notify("No file or directory selected", vim.log.levels.WARN) + end + end + + local preview_image = function() + local curr_entry = mini_files.get_fs_entry() + if curr_entry then + -- Preview the file using Quick Look + if vim.fn.has("mac") == 1 then + vim.system({ "qlmanage", "-p", curr_entry.path }, { + stdout = false, + stderr = false, + }) + vim.defer_fn(function() + vim.system({ "osascript", "-e", 'tell application "qlmanage" to activate' }) + end, 200) + else + -- TODO: add previewer for linux + vim.notify("Preview not supported on Linux.", vim.log.levels.WARN) + end + else + vim.notify("No file selected", vim.log.levels.WARN) + end + end + + local preview_image_popup = function() + -- Clear any existing images before rendering the new one + require("image").clear() + local curr_entry = mini_files.get_fs_entry() + if curr_entry and curr_entry.fs_type == "file" then + local ext = vim.fn.fnamemodify(curr_entry.path, ":e"):lower() + local supported_image_exts = { "png", "jpg", "jpeg", "gif", "bmp", "webp", "avif" } + -- Check if the file has a supported image extension + if vim.tbl_contains(supported_image_exts, ext) then + -- Save mini.files state (current path and focused entry) + local current_dir = vim.fn.fnamemodify(curr_entry.path, ":h") + local focused_entry = vim.fn.fnamemodify(curr_entry.path, ":t") -- Extract filename + -- Create a floating window for the image preview + local popup_width = math.floor(vim.o.columns * 0.6) + local popup_height = math.floor(vim.o.lines * 0.6) + local col = math.floor((vim.o.columns - popup_width) / 2) + local row = math.floor((vim.o.lines - popup_height) / 2) + local buf = vim.api.nvim_create_buf(false, true) -- Create a scratch buffer + local win = vim.api.nvim_open_win(buf, true, { + relative = "editor", + row = row, + col = col, + width = popup_width, + height = popup_height, + style = "minimal", + border = "rounded", + }) + -- Declare img_width and img_height at the top + local img_width, img_height + -- Get image dimensions using ImageMagick's identify command + local dimensions = vim.fn.systemlist( + string.format("identify -format '%%w %%h' %s", vim.fn.shellescape(curr_entry.path)) + ) + if #dimensions > 0 then + img_width, img_height = dimensions[1]:match("(%d+) (%d+)") + img_width = tonumber(img_width) + img_height = tonumber(img_height) + end + -- Calculate image display size while maintaining aspect ratio + local display_width = popup_width + local display_height = popup_height + if img_width and img_height then + local aspect_ratio = img_width / img_height + if aspect_ratio > (popup_width / popup_height) then + -- Image is wider than the popup window + display_height = math.floor(popup_width / aspect_ratio) + else + -- Image is taller than the popup window + display_width = math.floor(popup_height * aspect_ratio) + end + end + -- Center the image within the popup window + local image_x = math.floor((popup_width - display_width) / 2) + local image_y = math.floor((popup_height - display_height) / 2) + -- Use image.nvim to render the image + local img = require("image").from_file(curr_entry.path, { + id = curr_entry.path, -- Unique ID + window = win, -- Bind the image to the popup window + buffer = buf, -- Bind the image to the popup buffer + x = image_x, + y = image_y, + width = display_width, + height = display_height, + with_virtual_padding = true, + }) + -- Render the image + if img ~= nil then + img:render() + end + -- Use `stat` or `ls` to get the file size in bytes + local file_size_bytes = "" + if vim.fn.has("mac") == 1 or vim.fn.has("unix") == 1 then + -- For macOS or Linux systems + local handle = io.popen( + "stat -f%z " + .. vim.fn.shellescape(curr_entry.path) + .. " || ls -l " + .. vim.fn.shellescape(curr_entry.path) + .. " | awk '{print $5}'" + ) + if handle then + file_size_bytes = handle:read("*a"):gsub("%s+$", "") -- Trim trailing whitespace + handle:close() + end + else + -- Fallback message if the command isn't available + file_size_bytes = "0" + end + -- Convert the size to MB (if valid) + local file_size_mb = tonumber(file_size_bytes) and tonumber(file_size_bytes) / (1024 * 1024) + or 0 + local file_size_mb_str = string.format("%.2f", file_size_mb) -- Format to 2 decimal places as a string + -- Add image information (filename, size, resolution) + local image_info = {} + table.insert(image_info, "Image File: " .. focused_entry) -- Add only the filename + if tonumber(file_size_bytes) > 0 then + table.insert(image_info, "Size: " .. file_size_mb_str .. " MB") -- Use the formatted string + else + table.insert(image_info, "Size: Unable to detect") -- Fallback if size isn't found + end + if img_width and img_height then + table.insert(image_info, "Resolution: " .. img_width .. " x " .. img_height) + else + table.insert(image_info, "Resolution: Unable to detect") + end + -- Append the image information after the image + local line_count = vim.api.nvim_buf_line_count(buf) + vim.api.nvim_buf_set_lines(buf, line_count, -1, false, { "", "", "" }) -- Add 3 empty lines + vim.api.nvim_buf_set_lines(buf, -1, -1, false, image_info) + -- Keymap for closing the popup and reopening mini.files + local function reopen_mini_files() + if img ~= nil then + img:clear() + end + vim.api.nvim_win_close(win, true) + -- Reopen mini.files in the same directory + require("mini.files").open(current_dir, true) + vim.defer_fn(function() + -- Simulate navigation to the file by searching for the line matching the file + local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) -- Get all lines in the buffer + for i, line in ipairs(lines) do + if line:match(focused_entry) then + vim.api.nvim_win_set_cursor(0, { i, 0 }) -- Move cursor to the matching line + break + end + end + end, 50) -- Small delay to ensure mini.files is initialized + end + vim.keymap.set("n", "", reopen_mini_files, { buffer = buf, noremap = true, silent = true }) + else + vim.notify("Not an image file.", vim.log.levels.WARN) + end + else + vim.notify("No file selected or not a file.", vim.log.levels.WARN) + end + end + + local follow_symlink = function() + local curr_entry = mini_files.get_fs_entry() + if curr_entry and curr_entry.fs_type == "file" then + local resolved_path = vim.fn.resolve(curr_entry.path) -- Resolve symlink to original file + if resolved_path ~= curr_entry.path then + vim.notify("Following symlink to: " .. resolved_path, vim.log.levels.INFO) + mini_files.open(resolved_path, true) -- Open the original file in mini.files + else + vim.notify("The file is not a symlink.", vim.log.levels.WARN) + end + else + vim.notify("No file selected or not a valid file.", vim.log.levels.WARN) + end + end + + vim.api.nvim_create_autocmd("User", { + pattern = "MiniFilesBufferCreate", + callback = function() + local buf_id = vim.api.nvim_get_current_buf() + + vim.keymap.set( + "n", + opts.mappings and opts.mappings.toggle_hidden or "g.", + toggle_dotfiles, + { buffer = buf_id, desc = "Toggle hidden files" } + ) + + vim.keymap.set( + "n", + opts.mappings and opts.mappings.change_cwd or "gc", + files_set_cwd, + { buffer = buf_id, desc = "Set cwd" } + ) + + map_split(buf_id, opts.mappings and opts.mappings.go_in_horizontal or "s", "horizontal", false) + map_split(buf_id, opts.mappings and opts.mappings.go_in_vertical or "v", "vertical", false) + map_split( + buf_id, + opts.mappings and opts.mappings.go_in_horizontal_plus or "S", + "horizontal", + true + ) + map_split(buf_id, opts.mappings and opts.mappings.go_in_vertical_plus or "V", "vertical", true) + + vim.keymap.set( + "n", + "zt", + open_tmux_pane, + { buffer = buf_id, noremap = true, silent = true, desc = "Open tmux pane" } + ) + vim.keymap.set( + "n", + "zy", + copy_to_clipboard, + { buffer = buf_id, noremap = true, silent = true, desc = "Copy to clipboard" } + ) + vim.keymap.set( + "n", + "zY", + copy_path_to_clipboard, + { buffer = buf_id, desc = "Copy path to clipboard" } + ) + vim.keymap.set( + "n", + "zc", + zip_and_copy_to_clipboard, + { buffer = buf_id, noremap = true, silent = true, desc = "Zip and copy" } + ) + vim.keymap.set( + "n", + "zp", + paste_from_clipboard, + { buffer = buf_id, noremap = true, silent = true, desc = "Paste from clipboard" } + ) + vim.keymap.set( + "n", + "zi", + preview_image, + { buffer = buf_id, noremap = true, silent = true, desc = "Preview image" } + ) + vim.keymap.set( + "n", + "zI", + preview_image_popup, + { buffer = buf_id, noremap = true, silent = true, desc = "Pop-up preview image" } + ) + vim.keymap.set( + "n", + "gl", + follow_symlink, + { buffer = buf_id, noremap = true, silent = true, desc = "Follow link" } + ) + end, + }) + + -- Git status + local nsMiniFiles = vim.api.nvim_create_namespace("mini_files_git") + local autocmd = vim.api.nvim_create_autocmd + local _, MiniFiles = pcall(require, "mini.files") + + -- Cache for git status + local gitStatusCache = {} + local cacheTimeout = 2000 -- Cache timeout in milliseconds + + ---@type table + ---@param status string + ---@return string symbol, string hlGroup + local function mapSymbols(status) + local statusMap = { + -- stylua: ignore start + [" M"] = { symbol = "•", hlGroup = "GitSignsChange"}, -- Modified in the working directory + ["M "] = { symbol = "✹", hlGroup = "GitSignsChange"}, -- modified in index + ["MM"] = { symbol = "≠", hlGroup = "GitSignsChange"}, -- modified in both working tree and index + ["A "] = { symbol = "+", hlGroup = "GitSignsAdd" }, -- Added to the staging area, new file + ["AA"] = { symbol = "≈", hlGroup = "GitSignsAdd" }, -- file is added in both working tree and index + ["D "] = { symbol = "-", hlGroup = "GitSignsDelete"}, -- Deleted from the staging area + ["AM"] = { symbol = "⊕", hlGroup = "GitSignsChange"}, -- added in working tree, modified in index + ["AD"] = { symbol = "-•", hlGroup = "GitSignsChange"}, -- Added in the index and deleted in the working directory + ["R "] = { symbol = "→", hlGroup = "GitSignsChange"}, -- Renamed in the index + ["U "] = { symbol = "‖", hlGroup = "GitSignsChange"}, -- Unmerged path + ["UU"] = { symbol = "⇄", hlGroup = "GitSignsAdd" }, -- file is unmerged + ["UA"] = { symbol = "⊕", hlGroup = "GitSignsAdd" }, -- file is unmerged and added in working tree + ["??"] = { symbol = "?", hlGroup = "GitSignsDelete"}, -- Untracked files + ["!!"] = { symbol = "!", hlGroup = "GitSignsChange"}, -- Ignored files + -- stylua: ignore end + } + + local result = statusMap[status] or { symbol = "?", hlGroup = "NonText" } + return result.symbol, result.hlGroup + end + + ---@param cwd string + ---@param callback function + ---@return nil + local function fetchGitStatus(cwd, callback) + local function on_exit(content) + if content.code == 0 then + callback(content.stdout) + vim.g.content = content.stdout + end + end + vim.system({ "git", "status", "--ignored", "--porcelain" }, { text = true, cwd = cwd }, on_exit) + end + + ---@param str string? + local function escapePattern(str) + return str:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1") + end + + ---@param buf_id integer + ---@param gitStatusMap table + ---@return nil + local function updateMiniWithGit(buf_id, gitStatusMap) + vim.schedule(function() + local nlines = vim.api.nvim_buf_line_count(buf_id) + local cwd = vim.fs.root(buf_id, ".git") + local escapedcwd = escapePattern(cwd) + if vim.fn.has("win32") == 1 then + escapedcwd = escapedcwd:gsub("\\", "/") + end + + for i = 1, nlines do + local entry = MiniFiles.get_fs_entry(buf_id, i) + if not entry then + break + end + local relativePath = entry.path:gsub("^" .. escapedcwd .. "/", "") + local status = gitStatusMap[relativePath] + + if status then + local symbol, hlGroup = mapSymbols(status) + vim.api.nvim_buf_set_extmark(buf_id, nsMiniFiles, i - 1, 0, { + -- NOTE: if you want the signs on the right uncomment those and comment + -- the 3 lines after + -- virt_text = { { symbol, hlGroup } }, + -- virt_text_pos = "right_align", + sign_text = symbol, + sign_hl_group = hlGroup, + priority = 2, + }) + else + end + end + end) + end + + -- Thanks for the idea of gettings https://github.com/refractalize/oil-git-status.nvim signs for dirs + ---@param content string + ---@return table + local function parseGitStatus(content) + local gitStatusMap = {} + -- lua match is faster than vim.split (in my experience ) + for line in content:gmatch("[^\r\n]+") do + local status, filePath = string.match(line, "^(..)%s+(.*)") + -- Split the file path into parts + local parts = {} + for part in filePath:gmatch("[^/]+") do + table.insert(parts, part) + end + -- Start with the root directory + local currentKey = "" + for i, part in ipairs(parts) do + if i > 1 then + -- Concatenate parts with a separator to create a unique key + currentKey = currentKey .. "/" .. part + else + currentKey = part + end + -- If it's the last part, it's a file, so add it with its status + if i == #parts then + gitStatusMap[currentKey] = status + else + -- If it's not the last part, it's a directory. Check if it exists, if not, add it. + if not gitStatusMap[currentKey] then + gitStatusMap[currentKey] = status + end + end + end + end + return gitStatusMap + end + + ---@param buf_id integer + ---@return nil + local function updateGitStatus(buf_id) + if not vim.fs.root(vim.uv.cwd(), ".git") then + return + end + + local cwd = vim.fn.expand("%:p:h") + local currentTime = os.time() + if gitStatusCache[cwd] and currentTime - gitStatusCache[cwd].time < cacheTimeout then + updateMiniWithGit(buf_id, gitStatusCache[cwd].statusMap) + else + fetchGitStatus(cwd, function(content) + local gitStatusMap = parseGitStatus(content) + gitStatusCache[cwd] = { + time = currentTime, + statusMap = gitStatusMap, + } + updateMiniWithGit(buf_id, gitStatusMap) + end) + end + end + + ---@return nil + local function clearCache() + gitStatusCache = {} + end + + local function augroup(name) + return vim.api.nvim_create_augroup("MiniFiles_" .. name, { clear = true }) + end + + autocmd("User", { + group = augroup("start"), + pattern = "MiniFilesExplorerOpen", + callback = function() + local bufnr = vim.api.nvim_get_current_buf() + updateGitStatus(bufnr) + end, + }) + + autocmd("User", { + group = augroup("close"), + pattern = "MiniFilesExplorerClose", + callback = function() + clearCache() + end, + }) + + autocmd("User", { + group = augroup("update"), + pattern = "MiniFilesBufferUpdate", + callback = function(sii) + local bufnr = sii.data.buf_id + local cwd = vim.fn.expand("%:p:h") + if gitStatusCache[cwd] then + updateMiniWithGit(bufnr, gitStatusCache[cwd].statusMap) + end + end, + }) + end, + }, + { + "echasnovski/mini.hipatterns", + version = false, + config = function() + local hipatterns = require("mini.hipatterns") + hipatterns.setup({ + highlighters = { + -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' + fixme = { pattern = "%f[%w]()FIXME()%f[%W]", group = "MiniHipatternsFixme" }, + hack = { pattern = "%f[%w]()HACK()%f[%W]", group = "MiniHipatternsHack" }, + todo = { pattern = "%f[%w]()TODO()%f[%W]", group = "MiniHipatternsTodo" }, + note = { pattern = "%f[%w]()NOTE()%f[%W]", group = "MiniHipatternsNote" }, + + -- Highlight hex color strings (`#rrggbb`) using that color + hex_color = hipatterns.gen_highlighter.hex_color(), + }, + }) + end, + }, + { + "echasnovski/mini.indentscope", + version = false, -- wait till new 0.7.0 release to put it back on semver + event = "VeryLazy", + opts = { + mappings = { + -- Textobjects + object_scope = "i-", + object_scope_with_border = "a-", + + -- Motions (jump to respective border line; if not present - body line) + goto_top = "g,", + goto_bottom = "g;", + }, + draw = { + animation = function() + return 0 + end, + }, + options = { try_as_border = true }, + symbol = "│", + }, + init = function() + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "help", + "Trouble", + "trouble", + "lazy", + "mason", + }, + callback = function() + vim.b.miniindentscope_disable = true + end, + }) + end, + }, + { + "echasnovski/mini.map", + version = false, + config = function() + require("mini.map").setup( + -- No need to copy this inside `setup()`. Will be used automatically. + { + -- Highlight integrations (none by default) + integrations = nil, + + -- Symbols used to display data + symbols = { + -- Encode symbols. See `:h MiniMap.config` for specification and + -- `:h MiniMap.gen_encode_symbols` for pre-built ones. + -- Default: solid blocks with 3x2 resolution. + encode = nil, + + -- Scrollbar parts for view and line. Use empty string to disable any. + scroll_line = "█", + scroll_view = "┃", + }, + + -- Window options + window = { + -- Whether window is focusable in normal way (with `wincmd` or mouse) + focusable = true, + + -- Side to stick ('left' or 'right') + side = "right", + + -- Whether to show count of multiple integration highlights + show_integration_count = true, + + -- Total width + width = 10, + + -- Value of 'winblend' option + winblend = 25, + + -- Z-index + zindex = 10, + }, + } + ) + end, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "m", group = "Markdown/Map" }, + { "mt", group = "Toggle" }, + }) + end, + keys = { + { "mo", "lua MiniMap.open()", desc = "Open map" }, + { "mr", "lua MiniMap.refresh()", desc = "Refresh map" }, + { "mc", "lua MiniMap.close()", desc = "Close map" }, + { "mtm", "lua MiniMap.toggle()", desc = "Toggle map" }, + { "mts", "lua MiniMap.toggle_side()", desc = "Toggle side map" }, + }, + }, + { + "echasnovski/mini.move", + version = false, + config = function() + -- No need to copy this inside `setup()`. Will be used automatically. + require("mini.move").setup({ + -- Module mappings. Use `''` (empty string) to disable one. + mappings = { + -- Move visual selection in Visual mode. Defaults are Alt (Meta) + hjkl. + left = "", + right = "", + down = "", + up = "", + + -- Move current line in Normal mode + line_left = "", + line_right = "", + line_down = "", + line_up = "", + }, + + -- Options which control moving behavior + options = { + -- Automatically reindent selection during linewise vertical move + reindent_linewise = true, + }, + }) + end, + }, + { + "echasnovski/mini.pairs", + version = false, + event = "VeryLazy", + config = function() + require("mini.pairs").setup() + end, + keys = { + { + "zp", + function() + vim.g.minipairs_disable = not vim.g.minipairs_disable + end, + desc = "Toggle auto pairs", + }, + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/navic.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/navic.lua new file mode 100644 index 0000000..89cfa81 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/navic.lua @@ -0,0 +1,52 @@ +return { + "SmiteshP/nvim-navic", + dependencies = { + "neovim/nvim-lspconfig", + }, + config = function() + require("nvim-navic").setup({ + icons = { + File = "󰈙 ", + Module = " ", + Namespace = "󰌗 ", + Package = " ", + Class = "󰌗 ", + Method = "󰆧 ", + Property = " ", + Field = " ", + Constructor = " ", + Enum = "󰕘", + Interface = "󰕘", + Function = "󰊕 ", + Variable = "󰆧 ", + Constant = "󰏿 ", + String = "󰀬 ", + Number = "󰎠 ", + Boolean = "◩ ", + Array = "󰅪 ", + Object = "󰅩 ", + Key = "󰌋 ", + Null = "󰟢 ", + EnumMember = " ", + Struct = "󰌗 ", + Event = " ", + Operator = "󰆕 ", + TypeParameter = "󰊄 ", + }, + lsp = { + auto_attach = true, + preference = nil, + }, + highlight = true, + separator = " > ", + depth_limit = 5, + depth_limit_indicator = "..", + safe_output = true, + lazy_update_context = false, + click = true, + format_text = function(text) + return text + end, + }) + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/obsidian.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/obsidian.lua new file mode 100644 index 0000000..ea8e893 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/obsidian.lua @@ -0,0 +1,616 @@ +return { + "epwalsh/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + lazy = true, + ft = "markdown", + -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: + -- event = { + -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. + -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md" + -- -- refer to `:h file-pattern` for more examples + -- "BufReadPre path/to/my-vault/*.md", + -- "BufNewFile path/to/my-vault/*.md", + -- }, + dependencies = { + -- Required. + "nvim-lua/plenary.nvim", + -- see below for full list of optional dependencies 👇 + "hrsh7th/nvim-cmp", + "nvim-telescope/telescope.nvim", + "nvim-treesitter/nvim-treesitter", + { + "epwalsh/pomo.nvim", + dependencies = "nvim-lualine/lualine.nvim", + config = function() + require("lualine").setup({ + sections = { + lualine_x = { + function() + local ok, pomo = pcall(require, "pomo") + if not ok then + return "" + end + + local timer = pomo.get_first_to_finish() + if timer == nil then + return "" + end + + return "󰄉 " .. tostring(timer) + end, + "encoding", + "fileformat", + "filetype", + }, + }, + }) + + require("telescope").load_extension("pomodori") + + vim.keymap.set("n", "mp", function() + require("telescope").extensions.pomodori.timers() + end, { desc = "Manage pomodori" }) + end, + }, + }, + cmd = { + "ObsidianOpen", + "ObsidianNew", + "ObsidianQuickSwitch", + "ObsidianFollowLink", + "ObsidianBacklinks", + "ObsidianTags", + "ObsidianToday", + "ObsidianYesterday", + "ObsidianTomorrow", + "ObsidianDailies", + "ObsidianTemplate", + "ObsidianSearch", + "ObsidianLink", + "ObsidianLinkNew", + "ObsidianExtractNote", + "ObsidianWorkspace", + "ObsidianPasteImg", + "ObsidianRename", + "ObsidianToggleCheckbox", + "ObsidianNewFromTemplate", + "ObsidianTOC", + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "o", group = "Open/Obsidian" }, + { "of", group = "Find files (Obsidian)" }, + { "on", group = "Notes (Obsidian)" }, + { "op", group = "Paste (Obsidian)" }, + { "ot", group = "Templates (Obsidian)" }, + }) + end, + config = function() + require("obsidian").setup({ + -- A list of workspace names, paths, and configuration overrides. + -- If you use the Obsidian app, the 'path' of a workspace should generally be + -- your vault root (where the `.obsidian` folder is located). + -- When obsidian.nvim is loaded by your plugin manager, it will automatically set + -- the workspace to the first workspace in the list whose `path` is a parent of the + -- current markdown file being edited. + workspaces = { + { + name = "personal", + path = "~/Private/repos/Obsidian/SI", + -- Optional, override certain settings. + overrides = { + notes_subdir = "", + }, + }, + }, + + -- Alternatively - and for backwards compatibility - you can set 'dir' to a single path instead of + -- 'workspaces'. For example: + -- dir = "~/vaults/work", + + -- Optional, if you keep notes in a specific subdirectory of your vault. + notes_subdir = "", + + -- Optional, set the log level for obsidian.nvim. This is an integer corresponding to one of the log + -- levels defined by "vim.log.levels.*". + log_level = vim.log.levels.INFO, + + daily_notes = { + -- Optional, if you keep daily notes in a separate directory. + folder = "Area/Notes", + -- Optional, if you want to change the date format for the ID of daily notes. + date_format = "%Y-%m-%d", + -- Optional, if you want to change the date format of the default alias of daily notes. + alias_format = "%B %-d, %Y", + -- Optional, default tags to add to each new daily note created. + default_tags = { "daily-notes" }, + -- Optional, if you want to automatically insert a template from your template directory like 'daily.md' + template = nil, + }, + + -- Optional, completion of wiki links, local markdown links, and tags using nvim-cmp. + completion = { + -- Set to false to disable completion. + nvim_cmp = true, + -- Trigger completion at 2 chars. + min_chars = 2, + }, + + -- Optional, configure key mappings. These are the defaults. If you don't want to set any keymappings this + -- way then set 'mappings = {}'. + mappings = { + -- Smart action depending on context, either follow link or toggle checkbox. + [""] = { + action = function() + return require("obsidian").util.smart_action() + end, + opts = { buffer = true, expr = true }, + }, + }, + + -- Where to put new notes. Valid options are + -- * "current_dir" - put new notes in same directory as the current buffer. + -- * "notes_subdir" - put new notes in the default notes subdirectory. + new_notes_location = "current_dir", + + -- Optional, customize how note IDs are generated given an optional title. + ---@param title string|? + ---@return string + note_id_func = function(title) + -- Create note IDs in a Zettelkasten format with a timestamp and a suffix. + -- In this case a note with the title 'My new note' will be given an ID that looks + -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md' + local suffix = "" + if title ~= nil then + -- If title is given, transform it into valid file name. + suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() + else + -- If title is nil, just add 4 random uppercase letters to the suffix. + for _ = 1, 4 do + suffix = suffix .. string.char(math.random(65, 90)) + end + end + return suffix + end, + + -- Optional, customize how note file names are generated given the ID, target directory, and title. + ---@param spec { id: string, dir: obsidian.Path, title: string|? } + ---@return string|obsidian.Path The full path to the new note. + note_path_func = function(spec) + -- This is equivalent to the default behavior. + local path = spec.dir / "Contents" / tostring(spec.title) + return path:with_suffix(".md") + end, + + -- Optional, customize how wiki links are formatted. You can set this to one of: + -- * "use_alias_only", e.g. '[[Foo Bar]]' + -- * "prepend_note_id", e.g. '[[foo-bar|Foo Bar]]' + -- * "prepend_note_path", e.g. '[[foo-bar.md|Foo Bar]]' + -- * "use_path_only", e.g. '[[foo-bar.md]]' + -- Or you can set it to a function that takes a table of options and returns a string, like this: + wiki_link_func = function(opts) + return require("obsidian.util").wiki_link_path_prefix(opts) + end, + + -- Optional, customize how markdown links are formatted. + markdown_link_func = function(opts) + return require("obsidian.util").markdown_link(opts) + end, + + -- Either 'wiki' or 'markdown'. + preferred_link_style = "wiki", + + -- Optional, boolean or a function that takes a filename and returns a boolean. + -- `true` indicates that you don't want obsidian.nvim to manage frontmatter. + disable_frontmatter = false, + + -- -- Optional, alternatively you can customize the frontmatter data. + -- ---@return table + -- note_frontmatter_func = function(note) + -- -- Add the title of the note as an alias. + -- if note.title then + -- note:add_alias(note.title) + -- end + -- + -- local out = { id = note.id, aliases = note.aliases, tags = note.tags } + -- + -- -- `note.metadata` contains any manually added fields in the frontmatter. + -- -- So here we just make sure those fields are kept in the frontmatter. + -- if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then + -- for k, v in pairs(note.metadata) do + -- out[k] = v + -- end + -- end + -- + -- return out + -- end, + + -- Optional, for templates (see below). + templates = { + folder = "Resource/Templates", + date_format = "%Y-%m-%d", + time_format = "%H:%M", + -- A map for custom variables, the key should be the variable and the value a function + substitutions = {}, + }, + + -- Optional, by default when you use `:ObsidianFollowLink` on a link to an external + -- URL it will be ignored but you can customize this behavior here. + ---@param url string + follow_url_func = function(url) + -- Open the URL in the default web browser. + -- vim.fn.jobstart({ "open", url }) -- Mac OS + vim.fn.jobstart({ "xdg-open", url }) -- linux + -- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows + -- vim.ui.open(url) -- need Neovim 0.10.0+ + end, + + -- Optional, by default when you use `:ObsidianFollowLink` on a link to an image + -- file it will be ignored but you can customize this behavior here. + ---@param img string + follow_img_func = function(img) + -- vim.fn.jobstart({ "qlmanage", "-p", img }) -- Mac OS quick look preview + vim.fn.jobstart({ "nsxiv", "-aiop", img }) -- linux + -- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows + end, + + -- Optional, set to true if you use the Obsidian Advanced URI plugin. + -- https://github.com/Vinzent03/obsidian-advanced-uri + use_advanced_uri = false, + + -- Optional, set to true to force ':ObsidianOpen' to bring the app to the foreground. + open_app_foreground = false, + + picker = { + -- Set your preferred picker. Can be one of 'telescope.nvim', 'fzf-lua', or 'mini.pick'. + name = "telescope.nvim", + -- Optional, configure key mappings for the picker. These are the defaults. + -- Not all pickers support all mappings. + note_mappings = { + -- Create a new note from your query. + new = "", + -- Insert a link to the selected note. + insert_link = "", + }, + tag_mappings = { + -- Add tag(s) to current note. + tag_note = "", + -- Insert a tag at the current location. + insert_tag = "", + }, + }, + + -- Optional, sort search results by "path", "modified", "accessed", or "created". + -- The recommend value is "modified" and `true` for `sort_reversed`, which means, for example, + -- that `:ObsidianQuickSwitch` will show the notes sorted by latest modified time + sort_by = "modified", + sort_reversed = true, + + -- Set the maximum number of lines to read from notes on disk when performing certain searches. + search_max_lines = 1000, + + -- Optional, determines how certain commands open notes. The valid options are: + -- 1. "current" (the default) - to always open in the current window + -- 2. "vsplit" - to open in a vertical split if there's not already a vertical split + -- 3. "hsplit" - to open in a horizontal split if there's not already a horizontal split + open_notes_in = "current", + + -- Optional, define your own callbacks to further customize behavior. + callbacks = { + -- Runs at the end of `require("obsidian").setup()`. + ---@param client obsidian.Client + post_setup = function(client) end, + + -- Runs anytime you enter the buffer for a note. + ---@param client obsidian.Client + ---@param note obsidian.Note + enter_note = function(client, note) end, + + -- Runs anytime you leave the buffer for a note. + ---@param client obsidian.Client + ---@param note obsidian.Note + leave_note = function(client, note) end, + + -- Runs right before writing the buffer for a note. + ---@param client obsidian.Client + ---@param note obsidian.Note + pre_write_note = function(client, note) end, + + -- Runs anytime the workspace is set/changed. + ---@param client obsidian.Client + ---@param workspace obsidian.Workspace + post_set_workspace = function(client, workspace) end, + }, + + -- Optional, configure additional syntax highlighting / extmarks. + -- This requires you have `conceallevel` set to 1 or 2. See `:help conceallevel` for more details. + ui = { + enable = false, -- set to false to disable all additional syntax features + update_debounce = 200, -- update delay after a text change (in milliseconds) + max_file_length = 5000, -- disable UI features for files with more than this many lines + -- Define how various check-boxes are displayed + checkboxes = { + -- NOTE: the 'char' value has to be a single character, and the highlight groups are defined below. + [" "] = { char = "󰄱", hl_group = "ObsidianTodo" }, + ["x"] = { char = "", hl_group = "ObsidianDone" }, + [">"] = { char = "", hl_group = "ObsidianRightArrow" }, + ["~"] = { char = "󰰱", hl_group = "ObsidianTilde" }, + ["!"] = { char = "", hl_group = "ObsidianImportant" }, + -- Replace the above with this if you don't have a patched font: + -- [" "] = { char = "☐", hl_group = "ObsidianTodo" }, + -- ["x"] = { char = "✔", hl_group = "ObsidianDone" }, + + -- You can also add more custom ones... + }, + -- Use bullet marks for non-checkbox lists. + bullets = { char = "•", hl_group = "ObsidianBullet" }, + external_link_icon = { char = "", hl_group = "ObsidianExtLinkIcon" }, + -- Replace the above with this if you don't have a patched font: + -- external_link_icon = { char = "", hl_group = "ObsidianExtLinkIcon" }, + reference_text = { hl_group = "ObsidianRefText" }, + highlight_text = { hl_group = "ObsidianHighlightText" }, + tags = { hl_group = "ObsidianTag" }, + block_ids = { hl_group = "ObsidianBlockID" }, + hl_groups = { + -- The options are passed directly to `vim.api.nvim_set_hl()`. See `:help nvim_set_hl`. + ObsidianTodo = { bold = true, fg = "#f78c6c" }, + ObsidianDone = { bold = true, fg = "#89ddff" }, + ObsidianRightArrow = { bold = true, fg = "#f78c6c" }, + ObsidianTilde = { bold = true, fg = "#ff5370" }, + ObsidianImportant = { bold = true, fg = "#d73128" }, + ObsidianBullet = { bold = true, fg = "#89ddff" }, + ObsidianRefText = { underline = true, fg = "#c792ea" }, + ObsidianExtLinkIcon = { fg = "#c792ea" }, + ObsidianTag = { italic = true, fg = "#89ddff" }, + ObsidianBlockID = { italic = true, fg = "#89ddff" }, + ObsidianHighlightText = { bg = "#75662e" }, + }, + }, + + -- Specify how to handle attachments. + attachments = { + -- The default folder to place images in via `:ObsidianPasteImg`. + -- If this is a relative path it will be interpreted as relative to the vault root. + -- You can always override this per image by passing a full path to the command instead of just a filename. + img_folder = "assets/imgs", -- This is the default + + -- Optional, customize the default name or prefix when pasting images via `:ObsidianPasteImg`. + ---@return string + img_name_func = function() + -- Prefix image names with timestamp. + return string.format("%s-", os.time()) + end, + + -- A function that determines the text to insert in the note when pasting an image. + -- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file. + -- This is the default implementation. + ---@param client obsidian.Client + ---@param path obsidian.Path the absolute path to the image file + ---@return string + img_text_func = function(client, path) + path = client:vault_relative_path(path) or path + return string.format("![%s](%s)", path.name, path) + end, + }, + }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = "markdown", + callback = function() + vim.keymap.set("n", "gl", function() + if require("obsidian").util.cursor_on_markdown_link() then + return "ObsidianFollowLink" + else + return "gl" + end + end, { noremap = false, expr = true, desc = "Follow link (Obsidian)" }) + end, + }) + end, + keys = { + { + "zb", + function() + return require("obsidian").util.toggle_checkbox() + end, + buffer = true, + ft = "markdown", + desc = "Toggle check box (Obsidian)", + }, + { + "ob", + function() + local query = vim.fn.input("Enter query: ") + if query and #query > 0 then + vim.cmd("ObsidianOpen " .. query) + end + end, + ft = "markdown", + desc = "Open note (Obsidian)", + }, + { + "onn", + function() + local title = vim.fn.input("Enter title: ") + if title and #title > 0 then + vim.cmd("ObsidianNew " .. title) + end + end, + ft = "markdown", + desc = "New note (Obsidian)", + }, + { + "os", + "ObsidianQuickSwitch", + ft = "markdown", + desc = "Quick switch (Obsidian)", + }, + { + "oL", + "ObsidianFollowLink", + ft = "markdown", + desc = "Follow link (Obsidian)", + }, + { + "oH", + "ObsidianBacklinks", + ft = "markdown", + desc = "Back link (Obsidian)", + }, + { + "oft", + function() + local tags = vim.fn.input("Enter tag: ") + if tags and #tags > 0 then + vim.cmd("ObsidianTags " .. tags) + end + end, + ft = "markdown", + desc = "Search tag notes (Obsidian)", + }, + { + "ont", + function() + local offset = vim.fn.input("Enter offset: ") + if offset and #offset > 0 then + vim.cmd("ObsidianToday " .. offset) + else + vim.cmd("ObsidianToday") + end + end, + ft = "markdown", + desc = "Today note (Obsidian)", + }, + { + "ony", + "ObsidianYesterday", + ft = "markdown", + desc = "Yesterday note (Obsidian)", + }, + { + "ont", + "ObsidianTomorrow", + ft = "markdown", + desc = "Tomorrow note (Obsidian)", + }, + { + "ond", + function() + local offset = vim.fn.input("Enter offset: ") + if offset and #offset > 0 then + vim.cmd("ObsidianDailies " .. offset) + else + vim.cmd("ObsidianDailies") + end + end, + ft = "markdown", + desc = "Daily notes (Obsidian)", + }, + { + "oti", + "ObsidianTemplate", + ft = "markdown", + desc = "Insert templates (Obsidian)", + }, + { + "ofn", + function() + local note = vim.fn.input("Enter note: ") + if note and #note > 0 then + vim.cmd("ObsidianSearch " .. note) + end + end, + ft = "markdown", + desc = "Search note (Obsidian)", + }, + { + "ow", + function() + local name = vim.fn.input("Enter name: ") + if name and #name > 0 then + vim.cmd("ObsidianWorkspace " .. name) + end + end, + ft = "markdown", + desc = "Workspace name (Obsidian)", + }, + { + "opi", + function() + local image = vim.fn.input("Enter image: ") + if image and #image > 0 then + vim.cmd("ObsidianPasteImg " .. image) + end + end, + ft = "markdown", + desc = "Paste image (Obsidian)", + }, + { + "onr", + function() + local name = vim.fn.input("Enter name: ") + if name and #name > 0 then + vim.cmd("ObsidianRename " .. name) + end + end, + ft = "markdown", + desc = "Rename note (Obsidian)", + }, + { + mode = "v", + "ol", + function() + local query = vim.fn.input("Enter query: ") + if query and #query > 0 then + vim.cmd("ObsidianLink " .. query) + else + vim.cmd("ObsidianLink") + end + end, + ft = "markdown", + desc = "Link query (Obsidian)", + }, + { + mode = "v", + "onl", + function() + local note = vim.fn.input("Enter note: ") + if note and #note > 0 then + vim.cmd("ObsidianLinkNew " .. note) + else + vim.cmd("ObsidianLinkNew") + end + end, + ft = "markdown", + desc = "New link note (Obsidian)", + }, + { + mode = "v", + "ox", + function() + local note = vim.fn.input("Enter note: ") + if note and #note > 0 then + vim.cmd("ObsidianExtractNote " .. note) + else + vim.cmd("ObsidianExtractNote") + end + end, + ft = "markdown", + desc = "New extract text (Obsidian)", + }, + { + "otn", + "ObsidianNewFromTemplate", + ft = "markdown", + desc = "Open new note with template (Obsidian)", + }, + { + "oc", + "ObsidianTOC", + ft = "markdown", + desc = "Open contents (Obsidian)", + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/outline.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/outline.lua new file mode 100644 index 0000000..e5b98f8 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/outline.lua @@ -0,0 +1,11 @@ +return { + "hedyhli/outline.nvim", + lazy = true, + cmd = { "Outline", "OutlineOpen" }, + keys = { -- Example mapping to toggle outline + { "zo", "Outline", desc = "Toggle outline" }, + }, + opts = { + -- Your setup opts here + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/project.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/project.lua new file mode 100644 index 0000000..a27afd4 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/project.lua @@ -0,0 +1,12 @@ +return { + "ahmedkhalf/project.nvim", + dependencies = "nvim-telescope/telescope.nvim", + config = function() + require("project_nvim").setup() + require("telescope").load_extension("projects") + + vim.keymap.set("n", "fpj", function() + require("telescope").extensions.projects.projects() + end, { desc = "Find projects" }) + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/python.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/python.lua new file mode 100644 index 0000000..3e53ddb --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/python.lua @@ -0,0 +1,59 @@ +return { + -- { + -- "bps/vim-textobj-python", + -- dependencies = { "kana/vim-textobj-user" }, + -- }, + { + "nvim-neotest/neotest", + optional = true, + dependencies = { + "nvim-neotest/neotest-python", + }, + opts = { + adapters = { + ["neotest-python"] = { + -- Here you can specify the settings for the adapter, i.e. + -- runner = "pytest", + -- python = ".venv/bin/python", + }, + }, + }, + }, + { + "linux-cultist/venv-selector.nvim", + dependencies = { + "neovim/nvim-lspconfig", + "mfussenegger/nvim-dap", + "mfussenegger/nvim-dap-python", --optional + { "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } }, + }, + lazy = false, + branch = "regexp", -- This is the regexp branch, use this for the new version + ft = "python", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "v", group = "Virtual envs" }, + }) + end, + config = function() + require("venv-selector").setup({ + settings = { + options = { + notify_user_on_venv_activation = true, + }, + search = { + venvs = { + command = "fd /bin/python$ ~/.local/share/venvs --full-path", + }, + }, + }, + }) + end, + keys = { + { "vs", "VenvSelect", desc = "Select virtual env", ft = "python" }, + { "vc", "VenvSelectCached", desc = "Select venv (cache)", ft = "python" }, + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/quickfix.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/quickfix.lua new file mode 100644 index 0000000..9a3998e --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/quickfix.lua @@ -0,0 +1,76 @@ +return { + { + "folke/trouble.nvim", + cmd = { "Trouble" }, + opts = { + modes = { + lsp = { + win = { position = "right" }, + }, + preview_float = { + mode = "diagnostics", + preview = { + type = "float", + relative = "editor", + border = "rounded", + title = "Preview", + title_pos = "center", + position = { 0, -2 }, + size = { width = 0.3, height = 0.3 }, + zindex = 200, + }, + }, + }, + }, + config = function(_, opts) + require("trouble").setup(opts) + end, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "x", group = "Quickfix (trouble)" }, + }) + end, + keys = { + { "xd", "Trouble diagnostics toggle", desc = "Toggle diagnostics (Trouble)" }, + { + "xD", + "Trouble diagnostics toggle filter.buf=0", + desc = "Toggle buffer Diagnostics (Trouble)", + }, + { "xs", "Trouble symbols toggle", desc = "Toggle symbols (Trouble)" }, + { "xS", "Trouble lsp toggle", desc = "Toggle LSP def/ref/... (Trouble)" }, + { "xl", "Trouble loclist toggle", desc = "Toggle location List (Trouble)" }, + { "xq", "Trouble qflist toggle", desc = "Toggle quickfix List (Trouble)" }, + { + "[x", + function() + if require("trouble").is_open() then + require("trouble").prev({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cprev) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = "Previous quickfix (trouble)", + }, + { + "]x", + function() + if require("trouble").is_open() then + require("trouble").next({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cnext) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = "Next quickfix (trouble)", + }, + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/refactoring.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/refactoring.lua new file mode 100644 index 0000000..9c0603c --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/refactoring.lua @@ -0,0 +1,60 @@ +return { + "ThePrimeagen/refactoring.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "r", group = "Compiler/Refactoring" }, + }) + end, + config = function() + require("refactoring").setup({ + prompt_func_return_type = { + c = true, + cpp = true, + cxx = true, + go = true, + h = true, + hpp = true, + java = true, + lua = true, + python = true, + }, + prompt_func_param_type = { + c = true, + cpp = true, + cxx = true, + go = true, + h = true, + hpp = true, + java = true, + lua = true, + python = true, + }, + printf_statements = {}, + print_var_statements = {}, + show_success_message = false, + }) + vim.keymap.set("x", "re", ":Refactor extract ", { desc = "Extract" }) + vim.keymap.set("x", "rf", ":Refactor extract_to_file ", { desc = "Extract to file" }) + vim.keymap.set("x", "rv", ":Refactor extract_var ", { desc = "Extract variable" }) + vim.keymap.set({ "n", "x" }, "ri", ":Refactor inline_var", { desc = "Refactor inline variable" }) + vim.keymap.set("n", "rI", ":Refactor inline_func", { desc = "Refactor inline function" }) + vim.keymap.set("n", "rb", ":Refactor extract_block", { desc = "Extract block" }) + vim.keymap.set("n", "rbf", ":Refactor extract_block_to_file", { desc = "Extract block to file" }) + -- prompt for a refactor to apply when the remap is triggered + vim.keymap.set({ "n", "x" }, "rs", function() + require("refactoring").select_refactor() + end, { desc = "Refactor selection" }) + -- Note that not all refactor support both normal and visual mode + -- load refactoring Telescope extension + require("telescope").load_extension("refactoring") + vim.keymap.set({ "n", "x" }, "rf", function() + require("telescope").extensions.refactoring.refactors() + end, { desc = "Open refactor" }) + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/sessions.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/sessions.lua new file mode 100644 index 0000000..c0be47b --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/sessions.lua @@ -0,0 +1,32 @@ +return { + "folke/persistence.nvim", + event = "BufReadPre", -- this will only start session saving when an actual file was opened + config = function() + require("persistence").setup({ + dir = vim.fn.stdpath("state") .. "/sessions/", -- directory where session files are saved + -- minimum number of file buffers that need to be open to save + -- Set to 0 to always save + need = 0, + branch = true, -- use git branch to save session + }) + + vim.keymap.set("n", "qs", function() + require("persistence").load() + end, { desc = "Load session" }) + + -- select a session to load + vim.keymap.set("n", "fs", function() + require("persistence").select() + end, { desc = "Find session" }) + + -- load the last session + vim.keymap.set("n", "ql", function() + require("persistence").load({ last = true }) + end, { desc = "Last session" }) + + -- stop Persistence => session won't be saved on exit + vim.keymap.set("n", "qx", function() + require("persistence").stop() + end, { desc = "Stop session" }) + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/silicon.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/silicon.lua new file mode 100644 index 0000000..ed63558 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/silicon.lua @@ -0,0 +1,145 @@ +return { + "michaelrommel/nvim-silicon", + lazy = true, + cmd = "Silicon", + main = "nvim-silicon", + opts = { + -- Configuration here, or leave empty to use defaults + -- disable_defaults will disable all builtin default settings apart + -- from the base arguments, that are needed to call silicon at all, see + -- mandatory_options below, also those options can be overridden + -- all of the settings could be overridden in the lua setup call, + -- but this clashes with the use of an external silicon --config=file, + -- see issue #9 + disable_defaults = false, + -- turn on debug messages + debug = false, + -- most of them could be overridden with other + -- the font settings with size and fallback font + -- Example: font = "VictorMono NF=34;Noto Emoji", + font = nil, + -- the theme to use, depends on themes available to silicon + theme = "gruvbox-dark", + -- the background color outside the rendered os window + -- (in hexcode string e.g "#076678") + background = nil, + -- a path to a background image + background_image = nil, + -- the paddings to either side + pad_horiz = 100, + pad_vert = 80, + -- whether to have the os window rendered with rounded corners + no_round_corner = false, + -- whether to put the close, minimize, maximise traffic light + -- controls on the border + no_window_controls = false, + -- whether to turn off the line numbers + no_line_number = false, + -- with which number the line numbering shall start + line_offset = 1, + -- here a function is used to return the actual source code line number + -- line_offset = function(args) + -- return args.line1 + -- end, + + -- the distance between lines of code + line_pad = 0, + -- the rendering of tab characters as so many space characters + tab_width = 4, + -- with which language the syntax highlighting shall be done, should be + -- a function that returns either a language name or an extension like "js" + -- it is set to nil, so you can override it, if you do not set it, we try the + -- filetype first, and if that fails, the extension + language = nil, + -- language = function() + -- return vim.bo.filetype + -- end, + -- language = function() + -- return vim.fn.fnamemodify( + -- vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), + -- ":e" + -- ) + -- end, + + -- if the shadow below the os window should have be blurred + shadow_blur_radius = 16, + -- the offset of the shadow in x and y directions + shadow_offset_x = 8, + shadow_offset_y = 8, + -- the color of the shadow (in hexcode string e.g "#100808") + shadow_color = nil, + -- whether to strip of superfluous leading whitespace + gobble = true, + -- a string to pad each line with after gobbling removed larger indents, + num_separator = nil, + -- here a bar glyph is used to draw a vertial line and some space + -- num_separator = "\u{258f} ", + + -- whether to put the image onto the clipboard, may produce an error, + -- if run on WSL2 + to_clipboard = false, + -- a string or function returning a string that defines the title + -- showing in the image, only works in silicon versions greater than v0.5.1 + window_title = nil, + -- here a function is used to get the name of the current buffer + -- window_title = function() + -- return vim.fn.fnamemodify( + -- vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), + -- ":t" + -- ) + -- end, + + -- how to deal with the clipboard on WSL2 + -- possible values are: never, always, auto + wslclipboard = nil, + -- what to do with the temporary screenshot image file when using the Windows + -- clipboard from WSL2, possible values are: keep, delete + wslclipboardcopy = nil, + -- the silicon command, put an absolute location here, if the + -- command is not in your ${PATH} + command = "silicon", + -- a string or function that defines the path to the output image + -- output = nil, + -- here a function is used to create a file in the current directory + output = function() + local home_dir = vim.fn.expand("~") -- Get home directory + local timestamp = os.date("!%Y-%m-%d_%H-%M-%S") -- Get timestamp + local file_name = vim.fn.expand("%:t:r") -- Get the file name without extension + local file_extension = vim.fn.expand("%:e") + return home_dir .. "/" .. timestamp .. "_" .. file_name .. "_" .. file_extension .. ".png" + end, + }, + keys = { + { + mode = "v", + "sc", + function() + require("nvim-silicon").clip() + end, + desc = "Copy code screenshot to clipboard", + }, + { + mode = "v", + "sf", + function() + require("nvim-silicon").file() + end, + desc = "Save code screenshot as file", + }, + { + mode = "v", + "ss", + function() + require("nvim-silicon").shoot() + end, + desc = "Create code screenshot", + }, + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "v" }, + { "s", group = "Snapshot" }, + }) + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/snippets.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/snippets.lua new file mode 100644 index 0000000..eac9161 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/snippets.lua @@ -0,0 +1,72 @@ +return { + { + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp", + dependencies = { + "rafamadriz/friendly-snippets", + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + config = function() + local ls = require("luasnip") + ls.setup({ + link_children = true, + link_roots = false, + keep_roots = false, + update_events = { "TextChanged", "TextChangedI" }, + }) + local c = ls.choice_node + ls.choice_node = function(pos, choices, opts) + if opts then + opts.restore_cursor = true + else + opts = { restore_cursor = true } + end + return c(pos, choices, opts) + end + + require("luasnip.loaders.from_vscode").lazy_load({ + paths = { '"' .. vim.fn.stdpath("config") .. '/lua/thesiahxyz/snippets"' }, + }) + + vim.cmd.runtime({ args = { "lua/thesiahxyz/snippets/*.lua" }, bang = true }) -- load custom snippets + + vim.keymap.set({ "i", "x" }, "", function() + if ls.expand_or_jumpable() then + ls.expand_or_jump() + end + end, { silent = true, desc = "Expand snippet or jump to the next snippet node" }) + + vim.keymap.set({ "i", "x" }, "", function() + if ls.jumpable(-1) then + ls.jump(-1) + end + end, { silent = true, desc = "Previous spot in the snippet" }) + + vim.keymap.set({ "i", "x" }, "", function() + if ls.choice_active() then + ls.change_choice(1) + end + end, { silent = true, desc = "Next snippet choice" }) + + vim.keymap.set({ "i", "x" }, "", function() + if ls.choice_active() then + ls.change_choice(-1) + end + end, { silent = true, desc = "Previous snippet choice" }) + end, + keys = { + vim.keymap.set("i", "", function() + return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" + end, { expr = true, silent = true, desc = "Jump to next snippet" }), + vim.keymap.set("s", "", function() + require("luasnip").jump(1) + end, { desc = "Jump to next snippet" }), + vim.keymap.set({ "i", "s" }, "", function() + require("luasnip").jump(-1) + end, { desc = "Jump to Previous Snippet" }), + }, + }, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/surround.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/surround.lua new file mode 100644 index 0000000..f3e0174 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/surround.lua @@ -0,0 +1,14 @@ +return { + "echasnovski/mini.surround", + version = "*", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "s", group = "Surround/Search & replace on line" }, + }) + end, + config = function() + require("mini.surround").setup() + end, +} diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/telescope.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/telescope.lua new file mode 100644 index 0000000..ceb6872 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/telescope.lua @@ -0,0 +1,1041 @@ +local have_make = vim.fn.executable("make") == 1 +local have_cmake = vim.fn.executable("cmake") == 1 + +function vim.live_grep_from_project_git_root() + local function get_git_toplevel() + local path = vim.fn.system("git rev-parse --show-toplevel") + if vim.v.shell_error then + return nil + end + return path + end + + local opts = { cwd = get_git_toplevel() } + + require("telescope.builtin").live_grep(opts) +end + +local function find_nvim_plugin_files(prompt_bufnr) + local actions = require("telescope.actions") + local action_state = require("telescope.actions.state") + + actions.close(prompt_bufnr) + + local selection = action_state.get_selected_entry() + if selection and selection.value then + -- Construct the full path + local base_path = vim.fn.stdpath("data") + local full_path = vim.fn.resolve(base_path .. "/" .. selection.value) + + require("mini.files").open(full_path, true) + end +end + +return { + { + "nvim-telescope/telescope-file-browser.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + }, + -- init = function() + -- vim.api.nvim_create_autocmd("VimEnter", { + -- group = vim.api.nvim_create_augroup("TelescopeFileBrowserStartDirectory", { clear = true }), + -- desc = "Start telescope-file-browser with directory", + -- once = true, + -- callback = function() + -- if package.loaded["telescope-file-browser.nvim"] then + -- return + -- else + -- local stats = vim.uv.fs_stat(vim.fn.argv(0)) + -- if stats and stats.type == "directory" then + -- require("telescope").extensions.file_browser.file_browser() + -- end + -- end + -- end, + -- }) + -- end, + config = function() + local fb_actions = require("telescope._extensions.file_browser.actions") + + require("telescope").setup({ + extensions = { + file_browser = { + path = vim.uv.cwd(), + cwd = vim.uv.cwd(), + cwd_to_path = false, + grouped = true, + files = true, + add_dirs = true, + depth = 1, + auto_depth = true, + select_buffer = true, + hidden = { file_browser = false, folder_browser = false }, + respect_gitignore = vim.fn.executable("fd") == 1, + no_ignore = true, + follow_symlinks = true, + browse_files = require("telescope._extensions.file_browser.finders").browse_files, + browse_folders = require("telescope._extensions.file_browser.finders").browse_folders, + hide_parent_dir = false, + collapse_dirs = true, + prompt_path = true, + quiet = true, + dir_icon = "", + dir_icon_hl = "Default", + display_stat = { date = true, size = true, mode = true }, + hijack_netrw = false, + use_fd = true, + git_status = true, + mappings = { + ["i"] = { + [""] = fb_actions.create, + [""] = fb_actions.create_from_prompt, + [""] = fb_actions.rename, + [""] = fb_actions.move, + [""] = fb_actions.copy, + [""] = fb_actions.remove, + [""] = fb_actions.open, + [""] = fb_actions.goto_parent_dir, + [""] = fb_actions.goto_home_dir, + [""] = fb_actions.goto_cwd, + [""] = fb_actions.change_cwd, + [""] = fb_actions.toggle_browser, + [""] = fb_actions.toggle_hidden, + [""] = fb_actions.toggle_all, + [""] = fb_actions.backspace, + }, + ["n"] = { + ["a"] = fb_actions.create, + ["n"] = fb_actions.create_from_prompt, + ["r"] = fb_actions.rename, + ["d"] = fb_actions.move, + ["y"] = fb_actions.copy, + ["Del"] = fb_actions.remove, + ["o"] = fb_actions.open, + ["h"] = fb_actions.goto_parent_dir, + ["gh"] = fb_actions.goto_home_dir, + [""] = fb_actions.goto_cwd, + [""] = fb_actions.change_cwd, + ["f"] = fb_actions.toggle_browser, + ["/"] = fb_actions.toggle_hidden, + ["t"] = fb_actions.toggle_all, + }, + }, + results_title = vim.fn.fnamemodify(vim.uv.cwd(), ":~"), + }, + }, + }) + + require("telescope").load_extension("file_browser") + + vim.keymap.set( + "n", + "et", + ":Telescope file_browser path=%:p:h select_buffer=true", + { desc = "File browser (cwd)" } + ) + vim.keymap.set("n", "eT", ":Telescope file_browser", { desc = "File browser" }) + end, + }, + { + "nvim-telescope/telescope.nvim", + branch = "master", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { + "nvim-telescope/telescope-fzf-native.nvim", + build = have_make and "make" + or "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build", + enabled = have_make or have_cmake, + config = function() + require("telescope").load_extension("fzf") + end, + }, + { + "nvim-telescope/telescope-github.nvim", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "gh", group = "gh" }, + }) + end, + config = function() + require("telescope").load_extension("gh") + vim.keymap.set({ "n", "v" }, "gi", ":Telescope gh issues ", { desc = "Find gh issues" }) + vim.keymap.set( + { "n", "v" }, + "gp", + ":Telescope gh pull_request ", + { desc = "Find gh pull request" } + ) + vim.keymap.set({ "n", "v" }, "ght", ":Telescope gh gist ", { desc = "Find gh gist" }) + vim.keymap.set({ "n", "v" }, "ghr", ":Telescope gh run ", { desc = "Find gh run" }) + end, + }, + { + "nvim-telescope/telescope-ui-select.nvim", + config = function() + require("telescope").setup({ + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown({ + -- even more opts + }), + + -- pseudo code / specification for writing custom displays, like the one + -- for "codeactions" + -- specific_opts = { + -- make_indexed = function(items) -> indexed_items, width, + -- [kind] = { + -- make_displayer = function(widths) -> displayer + -- make_display = function(displayer) -> function(e) + -- make_ordinal = function(e) -> string + -- }, + -- -- for example to disable the custom builtin "codeactions" display + -- do the following + -- codeactions = false, + -- } + }, + }, + }) + require("telescope").load_extension("ui-select") + end, + }, + { + "jvgrootveld/telescope-zoxide", + dependencies = { "nvim-lua/popup.nvim" }, + config = function() + require("telescope").setup({ + extensions = { + zoxide = { + prompt_title = "[ TheSiahxyz ]", + mappings = { + default = { + action = function(selection) + vim.cmd.cd(selection.path) + end, + after_action = function(selection) + print("Update to (" .. selection.z_score .. ") " .. selection.path) + end, + }, + [""] = { + action = require("telescope._extensions.zoxide.utils").create_basic_command( + "split" + ), + opts = { desc = "split" }, + }, + [""] = { + action = require("telescope._extensions.zoxide.utils").create_basic_command( + "vsplit" + ), + }, + [""] = { + action = require("telescope._extensions.zoxide.utils").create_basic_command( + "edit" + ), + }, + [""] = { + keepinsert = true, + action = function(selection) + require("telescope").extensions.file_browser.file_browser({ + cwd = selection.path, + }) + end, + }, + }, + }, + }, + }) + require("telescope").load_extension("zoxide") + + vim.keymap.set("n", "fz", function() + require("telescope").extensions.zoxide.list() + end, { desc = "Find files (zoxide)" }) + end, + }, + { + "nvim-telescope/telescope-live-grep-args.nvim", + -- This will not install any breaking changes. + -- For major updates, this must be adjusted manually. + version = "^1.0.0", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "f", group = "Find" }, + { "fl", group = "Live grep" }, + }) + end, + config = function() + local lga_actions = require("telescope-live-grep-args.actions") + local actions = require("telescope.actions") + + require("telescope").setup({ + extensions = { + live_grep_args = { + auto_quoting = true, -- enable/disable auto-quoting + -- define mappings, e.g. + mappings = { -- extend mappings + i = { + [""] = lga_actions.quote_prompt(), + [""] = lga_actions.quote_prompt({ postfix = " --iglob " }), + -- freeze the current list and start a fuzzy search in the frozen list + [""] = actions.to_fuzzy_refine, + }, + }, + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + "--follow", + "--hidden", + "--no-ignore", + }, + -- ... also accepts theme settings, for example: + -- theme = "dropdown", -- use dropdown theme + -- theme = { }, -- use own theme spec + -- layout_config = { mirror=true }, -- mirror preview pane + }, + }, + }) + require("telescope").load_extension("live_grep_args") + vim.keymap.set( + "n", + "flf", + ":lua require('telescope').extensions.live_grep_args.live_grep_args()", + { desc = "Find live grep args" } + ) + + local live_grep_args_shortcuts = require("telescope-live-grep-args.shortcuts") + vim.keymap.set( + "n", + "ss", + live_grep_args_shortcuts.grep_word_under_cursor, + { desc = "Search shortcuts (Live grep)" } + ) + + local function search_git(visual) + -- Retrieve the git root path + local handle = io.popen("git rev-parse --show-toplevel") + if not handle then + print("Error: Unable to open git handle") + return + end + + local git_root_path = handle:read("*a"):gsub("%s+", "") + handle:close() + + if not git_root_path or git_root_path == "" then + print("Error: Unable to retrieve git root path") + return + end + + local opts = { + prompt_title = visual and ("Visual-Grep in " .. git_root_path) + or ("Live-Grep in " .. git_root_path), + shorten_path = false, + cwd = git_root_path, + file_ignore_patterns = { ".git", ".png", "tags" }, + initial_mode = "insert", + selection_strategy = "reset", + theme = require("telescope.themes").get_dropdown({}), + } + + if visual then + -- Capture the selected text in visual mode + vim.cmd('normal! "vy') + local visual_selection = vim.fn.getreg("v") + opts.search = visual_selection + require("telescope.builtin").grep_string(opts) + else + require("telescope.builtin").live_grep(opts) + end + end + + vim.keymap.set("n", "flg", function() + search_git(false) + end, { remap = true, silent = false, desc = "Live grep in the git root folder" }) + + vim.keymap.set("v", "flg", function() + search_git(true) + end, { remap = true, silent = false, desc = "Grep in the git root folder" }) + -- Retrieve the current tmux session path + -- This will not change when we navigate to a different pane + local function search_tmux(visual) + local handle = io.popen("tmux display-message -p '#{session_path}'") + if not handle then + print("Error: Unable to open tmux handle") + return + end + + local tmux_session_path = handle:read("*a"):gsub("%s+", "") + handle:close() + + if not tmux_session_path or tmux_session_path == "" then + print("Error: Unable to retrieve tmux session path") + return + end + + local opts = { + prompt_title = visual and ("Visual-Grep in " .. tmux_session_path) + or ("Live-Grep in " .. tmux_session_path), + shorten_path = false, + cwd = tmux_session_path, + file_ignore_patterns = { ".git", ".png", "tags" }, + initial_mode = "insert", + selection_strategy = "reset", + theme = require("telescope.themes").get_dropdown({}), + } + + if visual then + require("telescope.builtin").grep_string(opts) + else + require("telescope.builtin").live_grep(opts) + end + end + + vim.keymap.set("n", "flt", function() + search_tmux(false) + end, { remap = true, silent = false, desc = "Live grep in the current tmux session folder" }) + + vim.keymap.set("v", "flt", function() + search_tmux(true) + end, { remap = true, silent = false, desc = "Grep string in the current tmux session folder" }) + vim.api.nvim_set_keymap( + "v", + "fls", + 'y:Telescope live_grep default_text=0 search_dirs={"$PWD"}', + { noremap = true, silent = true, desc = "Live grep default text" } + ) + vim.keymap.set("n", "f/", function() + require("telescope.builtin").current_buffer_fuzzy_find( + require("telescope.themes").get_dropdown({ + winblend = 10, + previewer = false, + relative = "editor", + }) + ) + end, { desc = "Find in current buffer" }) + end, + }, + { + "xiyaowong/telescope-emoji.nvim", + config = function() + require("telescope").setup({ + extensions = { + emoji = { + action = function(emoji) + -- argument emoji is a table. + -- {name="", value="", cagegory="", description=""} + + vim.fn.setreg("*", emoji.value) + print([[Press p or "*p to paste this emoji]] .. emoji.value) + + -- insert emoji when picked + -- vim.api.nvim_put({ emoji.value }, 'c', false, true) + end, + }, + }, + }) + require("telescope").load_extension("emoji") + end, + keys = { + { "se", ":Telescope emoji", desc = "Search emoji" }, + }, + }, + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + { + "folke/trouble.nvim", + }, + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "f", group = "Find" }, + { "fp", group = "Private/Public" }, + { "s", group = "Search" }, + { "sb", group = "Buffer" }, + }) + end, + config = function() + local actions = require("telescope.actions") + local actions_state = require("telescope.actions.state") + local actions_layout = require("telescope.actions.layout") + local open_with_trouble = require("trouble.sources.telescope").open + local add_to_trouble = require("trouble.sources.telescope").add + + require("telescope").setup({ + defaults = { + mappings = { + i = { + [""] = add_to_trouble, + [""] = actions.complete_tag, + [""] = function(prompt_bufnr) + local selection = actions_state.get_selected_entry() + local dir = vim.fn.fnamemodify(selection.path, ":p:h") + actions.close(prompt_bufnr) + -- Depending on what you want put `cd`, `lcd`, `tcd` + vim.cmd(string.format("silent lcd %s", dir)) + end, + [""] = actions.nop, + [""] = actions.nop, + [""] = actions.nop, + [""] = actions_layout.toggle_preview, + [""] = actions.preview_scrolling_down, + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_left, + [""] = actions.preview_scrolling_right, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = open_with_trouble, + [""] = actions.select_horizontal, + [""] = { "", type = "command" }, + [""] = actions.insert_original_cword, + [""] = actions.insert_original_cWORD, + [""] = actions.insert_original_cfile, + [""] = actions.insert_original_cline, + [""] = actions.nop, + [""] = actions.nop, + }, + n = { + ["q"] = actions.close, + [""] = add_to_trouble, + [""] = actions.close, + [""] = actions.nop, + [""] = actions.nop, + [""] = actions_layout.toggle_preview, + [""] = actions.nop, + [""] = actions.complete_tag, + [""] = { + function(prompt_bufnr) + local selection = actions_state.get_selected_entry() + local dir = vim.fn.fnamemodify(selection.path, ":p:h") + actions.close(prompt_bufnr) + -- Depending on what you want put `cd`, `lcd`, `tcd` + vim.cmd(string.format("silent lcd %s", dir)) + end, + opts = { desc = "Change directory" }, + }, + [""] = actions.preview_scrolling_down, + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_left, + [""] = actions.preview_scrolling_right, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = open_with_trouble, + [""] = actions.select_horizontal, + ["