├── .gitattributes ├── .github └── workflows │ ├── lint.yml │ └── stylua.yml ├── .gitignore ├── LICENSE ├── README.md ├── after ├── ftplugin │ ├── cpp.lua │ └── norg.lua └── queries │ ├── cpp │ └── highlights.scm │ └── luaa │ └── highlights.scm ├── init.lua ├── lua ├── core │ ├── autocommand.lua │ ├── mappings.lua │ ├── settings.lua │ ├── theme.lua │ └── utils.lua ├── custom │ ├── abbrev.lua │ ├── dashboard.lua │ ├── overrides.lua │ └── statusline.lua └── plugins │ ├── config │ ├── alpha.lua │ ├── autopairs.lua │ ├── bufferline.lua │ ├── cmp.lua │ ├── comment.lua │ ├── dashboard.lua │ ├── explorer.lua │ ├── fidget.lua │ ├── gitsigns.lua │ ├── indent.lua │ ├── lightbulb.lua │ ├── lsp │ │ ├── capabilities.lua │ │ ├── config.lua │ │ ├── handlers.lua │ │ ├── init.lua │ │ ├── installer.lua │ │ ├── on_attach.lua │ │ └── settings │ │ │ ├── clang.lua │ │ │ ├── jsonls.lua │ │ │ └── sumneko_lua.lua │ ├── lualine.lua │ ├── neorg.lua │ ├── notify.lua │ ├── null-ls.lua │ ├── nvim-tree.lua │ ├── other.lua │ ├── presence.lua │ ├── snippets.lua │ ├── startup.lua │ ├── telescope.lua │ ├── toggleterm.lua │ ├── treesitter.lua │ ├── trouble.lua │ ├── twilight.lua │ └── zen-mode.lua │ └── plugins.lua ├── luasnippets ├── cpp.lua ├── html.lua ├── js.lua ├── lua.lua └── norg.lua ├── spell ├── en.utf-8.add └── en.utf-8.add.spl ├── stylua.toml ├── temporary └── bufferline.txt └── utils └── media ├── cmp.png ├── custom_statusline.png ├── file_explorer.png ├── lsp.png ├── startscreen.png ├── telescope.png └── trouble.png /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bryant-the-coder/NvHack/107c6eaca91b60d0e9a72efbbc7bf845a3733f61/.github/workflows/lint.yml -------------------------------------------------------------------------------- /.github/workflows/stylua.yml: -------------------------------------------------------------------------------- 1 | name: Formatting 2 | 3 | on: [push, pull_request_target] 4 | 5 | jobs: 6 | format-with-stylua: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: JohnnyMorganz/stylua-action@1.0.0 11 | with: 12 | token: ${{ secrets.GITHUB_TOKEN }} 13 | args: . 14 | - uses: stefanzweifel/git-auto-commit-action@v4 15 | with: 16 | commit_message: "chore: autoformat with stylua" 17 | branch: ${{ github.head_ref }} 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | plugin/ 2 | txt 3 | RULES.md 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to NvHack or my config repo 2 | 3 | ## Installation 4 | 5 | 1. cd into the directory of your nvim folder 6 | > Or not create a folder called as nvim 7 | 2. Run `git clone https://github.com/bryant-the-coder/NvHack.git` 8 | 3. Run `git clone https://github.com/wbthomason/packer.nvim "$env:LOCALAPPDATA\nvim-data\site\pack\packer\start\packer.nvim"` for windows users 9 | > `git clone --depth 1 https://github.com/wbthomason/packer.nvim\ ~/.local/share/nvim/site/pack/packer/start/packer.nvim` for unix users 10 | 4. Now run `nvim` and `:e lua/plugins/plugins.lua` 11 | 5. Then type `:source %` and run `:PackerSync` 12 | 6. Run `:checkhealth` 13 | 7. TADA~ Your done and setup 14 | 15 | ## Showcase 16 | 17 | Custom dashboard 18 | ![image](https://user-images.githubusercontent.com/92417638/164396371-e8859c10-7436-432a-b1e6-09c7fdbb5f5c.png) 19 | 20 | Custom telescope 21 | ![image](https://user-images.githubusercontent.com/92417638/164399112-1cd32c02-3539-4ea8-a72f-175d28c1eb3a.png) 22 | 23 | Base16 + Custom highlights for bufferline 24 | ![image](https://user-images.githubusercontent.com/92417638/164400472-4d0c3f22-6bc3-424a-a70c-c9dd23ffcd02.png) 25 | 26 | 27 | ## CREDITS 28 | 29 | Thanks to these wonderful people. Their config guided me into making my config. 30 | 31 | - [NvChad](https://github.com/NvChad/Nvchad) 32 | - [max397574](https://github.com/max397574/NeovimConfig) 33 | > Complicated config but you will find it very useful. 34 | - [abzcoding](https://github.com/abzcoding/lvim) 35 | > amazing config. recommend to check it out. 36 | - [tamton-aquib](https://github.com/tamton-aquib/nvim) 37 | > Remember to check his plugin. [staline](https://github.com/tamton-aquib/staline.nvim) 38 | - [vsedov](https://github.com/vsedov/nvim) 39 | - [tjdevseries](https://github.com/tjdevries/config_manager/tree/master/xdg_config/nvim) 40 | -------------------------------------------------------------------------------- /after/ftplugin/cpp.lua: -------------------------------------------------------------------------------- 1 | local options = { 2 | tabstop = 2, 3 | shiftwidth = 2, 4 | expandtab = true, 5 | smarttab = true, 6 | } 7 | 8 | for k, v in pairs(options) do 9 | vim.o[k] = v 10 | end 11 | 12 | -- Vertical split terminal 13 | vim.keymap.set("n", "vs", "90 vsp | :term") 14 | -------------------------------------------------------------------------------- /after/ftplugin/norg.lua: -------------------------------------------------------------------------------- 1 | vim.bo.shiftwidth = 2 2 | vim.o.conceallevel = 2 3 | vim.bo.commentstring = "#%s" 4 | vim.wo.spell = true 5 | vim.bo.spelllang = "en" 6 | vim.o.foldenable = false 7 | 8 | vim.keymap.set({ "n", "i" }, "", "w") 9 | vim.cmd([[hi link NeorgMarkupVerbatim Comment]]) 10 | -------------------------------------------------------------------------------- /after/queries/cpp/highlights.scm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bryant-the-coder/NvHack/107c6eaca91b60d0e9a72efbbc7bf845a3733f61/after/queries/cpp/highlights.scm -------------------------------------------------------------------------------- /after/queries/luaa/highlights.scm: -------------------------------------------------------------------------------- 1 | ;; Keywords 2 | (("local" @keyword) (#set! conceal "")) 3 | (("function" @keyword) (#set! conceal "ﬦ")) 4 | 5 | ;; Function names 6 | ((function_call name: (identifier) @function (#eq? @function "require")) (#set! conceal "")) 7 | ((function_call name: (identifier) @function (#eq? @function "print" )) (#set! conceal "朗")) 8 | 9 | ;; vim.* 10 | (((dot_index_expression) @keyword (#eq? @keyword "vim.cmd" )) (#set! conceal "")) 11 | (((dot_index_expression) @keyword (#eq? @keyword "vim.api" )) (#set! conceal "")) 12 | (((dot_index_expression) @keyword (#eq? @keyword "vim.fn" )) (#set! conceal "#")) 13 | (((dot_index_expression) @keyword (#eq? @keyword "vim.g" )) (#set! conceal "")) 14 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | require("core.settings") 2 | require("core.mappings") 3 | require("core.autocommand") 4 | require("core.theme") 5 | require("custom.abbrev") 6 | require("custom.overrides") 7 | require("custom.statusline") 8 | require("plugins.plugins") 9 | -------------------------------------------------------------------------------- /lua/core/autocommand.lua: -------------------------------------------------------------------------------- 1 | local cmd = vim.api.nvim_create_autocmd 2 | local augroup = vim.api.nvim_create_augroup 3 | local create_command = vim.api.nvim_create_user_command 4 | 5 | -- Disable autocommenting {{{ 6 | cmd("BufEnter", { 7 | desc = "Disable autocommenting in new lines", 8 | command = "set fp-=c fo-=r fo-=o", 9 | }) 10 | -- }}} 11 | 12 | -- Terminal {{{ 13 | augroup("_terminal", {}) 14 | cmd("TermOpen", { 15 | desc = "Terminal settings", 16 | group = "_terminal", 17 | command = "startinsert", 18 | }) 19 | cmd("TermOpen", { 20 | desc = "Terminal settings", 21 | group = "_terminal", 22 | command = "setlocal nonumber norelativenumber", 23 | }) 24 | -- }}} 25 | 26 | augroup("_buffer", {}) 27 | -- Trim whitespace {{{ 28 | local NoWhitespace = vim.api.nvim_exec( 29 | [[ 30 | function! NoWhitespace() 31 | let l:save = winsaveview() 32 | keeppatterns %s/\s\+$//e 33 | call winrestview(l:save) 34 | endfunction 35 | call NoWhitespace() 36 | ]], 37 | true 38 | ) 39 | 40 | cmd("BufWritePre", { 41 | desc = "Trim whitespace on save", 42 | group = "_buffer", 43 | command = [[call NoWhitespace()]], 44 | }) 45 | -- }}} 46 | 47 | -- Cursor position {{{ 48 | cmd("BufReadPost", { 49 | desc = "Restore cursor position upon reopening the file", 50 | group = "_buffer", 51 | command = [[ 52 | if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit' | execute "normal! g`\"zvzz" | endif 53 | ]], 54 | }) 55 | -- }}} 56 | 57 | -- Highlight while yanking {{{ 58 | cmd("TextYankPost", { 59 | pattern = "*", 60 | desc = "Highlight while yanking", 61 | group = "_buffer", 62 | callback = function() 63 | vim.highlight.on_yank({ higroup = "Visual", timeout = 200 }) 64 | end, 65 | }) 66 | -- }}} 67 | 68 | -- q as escape key {{{ 69 | cmd("FileType", { 70 | desc = "Quit with q in this filetypes", 71 | group = "_buffer", 72 | pattern = "qf,help,man,lspinfo,startuptime,Trouble", 73 | callback = function() 74 | vim.keymap.set("n", "q", "close") 75 | end, 76 | }) 77 | -- }}} 78 | 79 | -- Custom dashboard display {{{ 80 | cmd({ "VimEnter" }, { 81 | callback = function() 82 | require("custom.dashboard").display() 83 | end, 84 | }) 85 | -- }}} 86 | 87 | -- Nofity when file changes {{{ 88 | augroup("_auto_reload_file", {}) 89 | cmd("FileChangedShellPost", { 90 | desc = "Actions when the file is changed outside of Neovim", 91 | group = "_auto_reload_file", 92 | callback = function() 93 | vim.notify("File changed, reloading the buffer", vim.log.levels.ERROR) 94 | end, 95 | }) 96 | 97 | cmd({ "FocusGained", "CursorHold" }, { 98 | desc = "Actions when the file is changed outside of Neovim", 99 | group = "_auto_reload_file", 100 | command = [[if getcmdwintype() == '' | checktime | endif]], 101 | }) 102 | -- }}} 103 | 104 | augroup("_lsp", {}) 105 | -- Open float when there are diagnostics {{{ 106 | cmd({ "CursorHold" }, { 107 | desc = "Open float when there is diagnostics", 108 | group = "_lsp", 109 | callback = vim.diagnostic.open_float, 110 | }) 111 | --}}} 112 | 113 | augroup("git_repo_check", {}) 114 | -- Custom event {{{ 115 | cmd({ "VimEnter", "DirChanged" }, { 116 | group = "git_repo_check", 117 | callback = function() 118 | local is_git = vim.api.nvim_exec("!git rev-parse --is-inside-work-tree", true) 119 | if is_git:match("true") then 120 | vim.cmd("doautocmd User IsGit") 121 | return true 122 | else 123 | return false 124 | end 125 | end, 126 | }) 127 | -- }}} 128 | 129 | create_command("Sync", ":PackerSync", { desc = "PackerSync" }) 130 | -------------------------------------------------------------------------------- /lua/core/mappings.lua: -------------------------------------------------------------------------------- 1 | --- Defining normal & insert mode keymaps 2 | ---@param lhs string Keymaps 3 | ---@param rhs string Command 4 | ---@param opts string Options 5 | -- local function nimap(lhs, rhs, opts) 6 | -- local default_options = { noremap = true, silent = true } 7 | -- if opts then 8 | -- default_options = vim.tbl_extend("force", default_options, opts) 9 | -- end 10 | -- vim.keymap.set({ "n", "i" }, lhs, rhs, default_options) 11 | -- end 12 | 13 | -- local nimap = require("core.utils").normal_insert() 14 | 15 | local map = vim.keymap.set 16 | vim.api.nvim_set_keymap( 17 | "v", 18 | "re", 19 | [[ lua require('refactoring').refactor('Extract Function')]], 20 | { noremap = true, silent = true, expr = false } 21 | ) 22 | 23 | map("n", "ta", [[put! =repeat(nr2char(10), v:count1)'[]]) 24 | 25 | ----------------------------------- 26 | -- BASIC -- 27 | ----------------------------------- 28 | -- Quitting 29 | map("n", "", "q") 30 | 31 | -- Buffer 32 | map("n", "dd", "bdelete") 33 | 34 | -- Pasting stuff 35 | map("v", "p", 'p:let @+=@0:let @"=@0') 36 | 37 | -- Folding 38 | map("n", "", "za") 39 | 40 | -- Don't yank text upon delete (good mapping btw) 41 | map("v", "d", '"_d"') 42 | 43 | -- Don't yank text on cut 44 | map("n", "x", '"_x') 45 | 46 | -- Swap booleans 47 | map("n", "sb", function() 48 | require("core.utils").swap_boolean() 49 | end) 50 | 51 | -- ESC to clear all highlights 52 | map({ "n", "i", "v" }, "", "noh") 53 | -- map({ "n", "v" }, "", [[{-> v:hlsearch ? ":nohl\" : "\"}()]], { silent = true, expr = true }) 54 | 55 | -- Rename (easy way) 56 | map("n", "", function() 57 | require("core.utils").rename() 58 | end) 59 | 60 | -- Saving the traditional way 61 | map({ "n", "i" }, "", "w") 62 | -- nimap("", "w") 63 | map("n", "sf", "source % ") 64 | 65 | -- j = gj 66 | -- k = gk 67 | map({ "n", "v" }, "j", "gj") 68 | map({ "n", "v" }, "k", "gk") 69 | map("n", "l", function() 70 | require("core.utils").l_motion() 71 | end) 72 | map("n", "h", function() 73 | require("core.utils").h_motion() 74 | end) 75 | 76 | -- Indenting 77 | map("v", ">", ">gv") 78 | map("v", "<", "") 82 | map({ "i", "v" }, "JK", "") 83 | 84 | map("n", "n", "nzzzv") 85 | map("n", "N", "Nzzzv") 86 | --[[ map({ "n", "v" }, "j", "jzzzv") 87 | map({ "n", "v" }, "k", "kzzzv") ]] 88 | 89 | -- Go to url 90 | -- Windows user 91 | map("n", "tu", function() 92 | require("core.utils").url("start") 93 | end) 94 | -- Mac or linux user 95 | --[[ map("n", "tu", function() 96 | require("core.utils").go_to_url() 97 | end) ]] 98 | 99 | -- Disable arrow keys 100 | map({ "n", "v" }, "", "") 101 | map({ "n", "v" }, "", "") 102 | map({ "n", "v" }, "", "") 103 | map({ "n", "v" }, "", "") 104 | 105 | -- Terminal ESC key 106 | -- map("n", "vs", "90 vsp | :term") 107 | map("n", "v", "vsp | :term") 108 | map("n", "h", "17 sp | :term") 109 | map("t", "jk", "") 110 | map("t", "", " bd!") 111 | 112 | -- Resizing windows 113 | map("n", "", "+") 114 | map("n", "", "-") 115 | map("n", "", ">") 116 | map("n", "", "<") 117 | 118 | -- Window Navigation 119 | map("n", "J", "") 120 | map("n", "K", "") 121 | map("n", "L", "") 122 | map("n", "H", "") 123 | 124 | -- Buffer navigation 125 | map("n", "", "bnext") 126 | map("n", "", "bprevious") 127 | 128 | -- Moving lines up & down (complicated) 129 | map("n", "", "m .+1==") 130 | map("n", "", "m .-2==") 131 | map("v", "", "m '>+1gv=gv") 132 | map("v", "", "m '<-2gv=gv") 133 | 134 | -- Insert a new line 135 | -- Code from max 136 | map("n", "", "O", { desc = "Empty line above" }) 137 | map("n", "", "o", { desc = "Empty line below" }) 138 | map("n", "lb", "i", { desc = "Line break at cursor" }) 139 | map("n", "il", "i l", { desc = "Space before" }) 140 | map("n", "ih", "a h", { desc = "Space after" }) 141 | 142 | ----------------------------------- 143 | -- Plugins -- 144 | ----------------------------------- 145 | -- Nvim-tree 146 | map("n", "", "NvimTreeToggle") 147 | 148 | -- Zen-mode 149 | map("n", "zm", "ZenMode") 150 | 151 | -- Trouble 152 | map("n", "tt", "Trouble") 153 | 154 | -- Neogen 155 | map("n", "ng", "Neogen") 156 | 157 | -- TSPlayground 158 | map("n", "tp", "TSPlaygroundToggle") 159 | map("i", "tp", "TSPlaygroundToggle") 160 | 161 | -- Packer 162 | map("n", "pi", "PackerInstall") 163 | map("n", "pu", "PackerUpdate") 164 | map("n", "pc", "PackerClean") 165 | map("n", "ps", "PackerSync") 166 | 167 | -- LSP 168 | --[[ map("n", "lr", vim.lsp.buf.rename) 169 | map("n", "ld", vim.lsp.buf.definition) 170 | map("n", "lt", vim.lsp.buf.type_definition) 171 | map("n", "lh", vim.lsp.buf.signature_help) 172 | map("n", "ss", vim.lsp.buf.formatting_sync) 173 | map("n", "qf", vim.diagnostic.setqflist) 174 | map("n", "", vim.lsp.buf.references) 175 | -- map("n", "", vim.diagnostic.goto_prev) 176 | -- map("n", "", vim.diagnostic.goto_next) 177 | map("n", "", function() 178 | vim.diagnostic.goto_prev({ border = "rounded" }) 179 | end) 180 | map("n", "", function() 181 | vim.diagnostic.goto_next({ border = "rounded" }) 182 | end) ]] 183 | 184 | -- Harpooon 185 | map("n", "", function() 186 | require("harpoon.ui").toggle_quick_menu() 187 | end) 188 | map("n", "", function() 189 | require("harpoon.mark").add_file() 190 | end) 191 | map("n", "", function() 192 | require("harpoon.ui").nav_file(1) 193 | end) 194 | map("n", "", function() 195 | require("harpoon.ui").nav_file(1) 196 | end) 197 | map("n", "", function() 198 | require("harpoon.ui").nav_file(3) 199 | end) 200 | map("n", "", function() 201 | require("harpoon.ui").nav_file(4) 202 | end) 203 | 204 | -- Telescope 205 | map("n", "ff", function() 206 | require("plugins.config.telescope").find_files() 207 | -- require("telescope.builtin").find_files() 208 | end) 209 | map("n", "fw", function() 210 | require("plugins.config.telescope").live_grep() 211 | -- require("telescope.builtin").live_grep() 212 | end) 213 | map("n", "fd", function() 214 | require("plugins.config.telescope").diag() 215 | -- require("telescope.builtin").diagnostics() 216 | end) 217 | map("n", "fob", function() 218 | require("telescope.builtin").buffers() 219 | end) 220 | map("n", "fc", function() 221 | require("telescope.builtin").colorscheme() 222 | end) 223 | map("n", "fo", function() 224 | require("telescope.builtin").oldfiles() 225 | end) 226 | map("n", "fk", function() 227 | require("telescope.builtin").keymaps() 228 | end) 229 | map("n", "fm", function() 230 | require("telescope.builtin").current_buffer_fuzzy_find() 231 | end) 232 | map("n", "ft", function() 233 | require("telescope.builtin").treesitter() 234 | end) 235 | map("n", "fb", "Telescope file_browser") 236 | -------------------------------------------------------------------------------- /lua/core/settings.lua: -------------------------------------------------------------------------------- 1 | local g = vim.g 2 | local o = vim.opt 3 | 4 | --Cursor & cursorline 5 | o.guicursor = "n-v-c-sm:block,ci-ve:ver25,r-cr-o:hor20,i:block-blinkwait700-blinkoff400-blinkon250-Cursor/lCursor" 6 | o.cursorline = true 7 | o.cursorlineopt = { "number" } -- Highlighting the number where the cursor is on 8 | 9 | -- Mappings 10 | g.mapleader = "," 11 | o.mouse = "a" 12 | 13 | -- Theme 14 | o.termguicolors = true 15 | 16 | -- Number 17 | o.number = true 18 | o.relativenumber = true 19 | o.signcolumn = "yes:2" 20 | o.scrolloff = 1000 -- Stop scrolling on the number set 21 | 22 | -- Splits 23 | o.splitright = true 24 | o.splitbelow = true 25 | 26 | -- Command line 27 | o.shortmess:append("I") 28 | o.cmdheight = 1 29 | o.hidden = true 30 | o.history = 300 31 | o.updatetime = 200 32 | o.smd = false -- Don't show mode in cmdline 33 | 34 | -- Tabs & Indent 35 | o.expandtab = true 36 | o.tabstop = 4 37 | o.shiftwidth = 4 38 | o.smartindent = true 39 | o.autoindent = true 40 | o.smarttab = true 41 | o.linebreak = true 42 | o.breakindent = true 43 | 44 | -- Editor 45 | o.wrap = false 46 | o.clipboard = "unnamedplus" 47 | o.foldmethod = "marker" 48 | o.completeopt = "menuone,noselect,menu" 49 | o.lazyredraw = true 50 | o.confirm = true 51 | 52 | -- Search 53 | o.hlsearch = true 54 | o.incsearch = true 55 | o.ignorecase = true 56 | o.showmatch = true -- Shows show match 57 | o.smartcase = true -- Don't ignore when uppercase search 58 | 59 | -- Statusline 60 | o.laststatus = 3 61 | 62 | -- Conceal 63 | o.conceallevel = 2 64 | 65 | -- See :h fillchars 66 | local function window_separator(separators) 67 | if separators then 68 | o.fillchars = { 69 | eob = " ", 70 | fold = " ", 71 | vert = "║", 72 | horiz = "═", 73 | horizup = "╩", 74 | horizdown = "╦", 75 | vertleft = "╣", 76 | vertright = "╠", 77 | verthoriz = "╬", 78 | } 79 | else 80 | o.fillchars = { 81 | eob = " ", 82 | fold = " ", 83 | horiz = " ", 84 | horizup = " ", 85 | horizdown = " ", 86 | vert = " ", 87 | vertleft = " ", 88 | vertright = " ", 89 | verthoriz = " ", 90 | } 91 | end 92 | end 93 | 94 | window_separator(true) 95 | 96 | -- Backups / Undo 97 | o.backup = false -- Don't backup files 98 | o.writebackup = false -- Don't write backup 99 | o.undofile = false -- Don't write undofile 100 | o.swapfile = false -- Don't write swapfile 101 | 102 | -- Terminal 103 | if vim.fn.has("windows") == 1 then 104 | o.shell = "C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe" 105 | end 106 | 107 | -- Builtin plugins 108 | g.loaded_gzip = 1 109 | g.loaded_zip = 1 110 | g.loaded_zipPlugin = 1 111 | g.loaded_tar = 1 112 | g.loaded_tarPlugin = 1 113 | g.loaded_matchit = 1 114 | g.loaded_man = 1 115 | g.loaded_remote_plugins = 1 116 | g.loaded_getscript = 1 117 | g.loaded_getscriptPlugin = 1 118 | g.loaded_vimball = 1 119 | g.loaded_vimballPlugin = 1 120 | g.loaded_2html_plugin = 1 121 | g.loaded_logiPat = 1 122 | g.loaded_rrhelper = 1 123 | g.loaded_netrw = 1 124 | g.loaded_netrwPlugin = 1 125 | g.loaded_netrwSettings = 1 126 | g.loaded_netrwFileHandlers = 1 127 | g.loaded_matchparen = 1 128 | g.loaded_logiPat = 1 129 | g.loaded_rrhelper = 1 130 | g.did_load_filetypes = 0 131 | g.do_filetype_lua = 1 132 | -------------------------------------------------------------------------------- /lua/core/theme.lua: -------------------------------------------------------------------------------- 1 | -- require("themer").setup({ 2 | -- colorscheme = "gruvchad", 3 | -- transparent = false, 4 | -- disable_telescope_themes = { "ayu", "rose_pine_dawn" }, 5 | -- term_colors = true, 6 | -- dim_inactive = false, 7 | -- styles = { 8 | -- ["function"] = { italic = true }, 9 | -- functionBuiltIn = { italic = true }, 10 | -- comment = { italic = true, bold = true }, 11 | -- number = { italic = true }, 12 | -- constant = { bold = true }, 13 | -- diagnostic = { 14 | -- underline = { 15 | -- error = { underline = true }, 16 | -- warn = { underline = true }, 17 | -- }, 18 | -- virtual_text = { 19 | -- error = { italic = true }, 20 | -- warn = { italic = true }, 21 | -- }, 22 | -- }, 23 | -- }, 24 | -- }) 25 | 26 | local base16 = require("base16") 27 | 28 | -- Theme that I like 29 | -- A) everblush 30 | -- B) onedark 31 | -- C) UWU 32 | -- D) everforest 33 | -- E) rose_pine 34 | 35 | _G.theme = "onedark" 36 | 37 | local theme = _G.theme 38 | local time = os.date("*t") 39 | 40 | -- When its 7am or is equal or more than 9pm = onedark 41 | -- if time.hour < 7 or time.hour >= 21 then 42 | -- theme = "onedark" 43 | -- else 44 | -- theme = "everblush" 45 | -- end 46 | 47 | return base16(base16.themes(theme)) 48 | -------------------------------------------------------------------------------- /lua/core/utils.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | local cmd = vim.cmd 3 | 4 | --- Define bg color 5 | ---@param group string 6 | ---@param col string 7 | M.bg = function(group, col) 8 | cmd("hi " .. group .. " guibg=" .. col) 9 | end 10 | 11 | --- Define fg color 12 | ---@param gruop string 13 | ---@param col string 14 | M.fg = function(gruop, col) 15 | cmd("hi " .. gruop .. " guifg=" .. col) 16 | end 17 | 18 | --- Define fg & bg color 19 | ---@param group string 20 | ---@param fgcol string 21 | ---@param bgcol string 22 | M.fg_bg = function(group, fgcol, bgcol) 23 | cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol) 24 | end 25 | 26 | --- Getting color from base16 27 | -- Theme that i like 28 | -- A) everblush 29 | -- B) UWU 30 | -- C) everforest 31 | -- D) onedark 32 | -- E) gruvchad 33 | M.get = function() 34 | local theme = _G.theme 35 | -- local time = os.date("*t") 36 | -- if time.hour < 7 or time.hour >= 21 then 37 | -- theme = "onedark" 38 | -- else 39 | -- theme = "everblush" 40 | -- end 41 | return require("hl_themes." .. theme) 42 | end 43 | 44 | --- Go to url 45 | ---@param cmd thread https://github.com 46 | M.url = function(cmd) 47 | local url = vim.api.nvim_get_current_line():match([[%[.*]%((.*)%)]]) -- To work on md links 48 | if url == nil then 49 | url = vim.fn.expand("") 50 | if not string.match(url, "http") then 51 | url = "https://github.com/" .. url 52 | end 53 | if string.match(url, [[(.+)[,:]$]]) then 54 | url = url:sub(1, -2) 55 | end -- to check commas at the end 56 | end 57 | 58 | vim.notify("Going to " .. url, "info", { title = "Opening browser..." }) 59 | vim.cmd(":silent !" .. cmd .. " " .. url) 60 | -- vim.cmd(':silent !'..(cmd or "xdg-open")..' '..url..' 1>/dev/null') 61 | end 62 | 63 | --- Swap between booleans with ease 64 | M.swap_boolean = function() 65 | local c = vim.api.nvim_get_current_line() 66 | local subs = c:match("true") and c:gsub("true", "false") or c:gsub("false", "true") 67 | vim.api.nvim_set_current_line(subs) 68 | end 69 | 70 | --- Rename a variable (simple) 71 | ---@return string 72 | M.rename = function() 73 | -- local border = { 74 | -- { "┏", "FloatBorder" }, 75 | -- { "━", "FloatBorder" }, 76 | -- { "┓", "FloatBorder" }, 77 | -- { "┃", "FloatBorder" }, 78 | -- { "┛", "FloatBorder" }, 79 | -- { "━", "FloatBorder" }, 80 | -- { "┗", "FloatBorder" }, 81 | -- { "┃", "FloatBorder" }, 82 | -- } 83 | 84 | -- local border = { 85 | -- { "╔", "FloatBorder" }, 86 | -- { "═", "FloatBorder" }, 87 | -- { "╗", "FloatBorder" }, 88 | -- { "║", "FloatBorder" }, 89 | -- { "╝", "FloatBorder" }, 90 | -- { "═", "FloatBorder" }, 91 | -- { "╚", "FloatBorder" }, 92 | -- { "║", "FloatBorder" }, 93 | -- } 94 | 95 | local border = { 96 | { "╭", "CmpBorder" }, 97 | { "─", "CmpBorder" }, 98 | { "╮", "CmpBorder" }, 99 | { "│", "CmpBorder" }, 100 | { "╯", "CmpBorder" }, 101 | { "─", "CmpBorder" }, 102 | { "╰", "CmpBorder" }, 103 | { "│", "CmpBorder" }, 104 | } 105 | local function post(rename_old) 106 | vim.cmd("stopinsert!") 107 | local rename_new = vim.api.nvim_get_current_line() 108 | vim.schedule(function() 109 | vim.api.nvim_win_close(0, true) 110 | vim.lsp.buf.rename(vim.trim(rename_new)) 111 | end) 112 | -- Use notify.nvim, logs notification as warn, title as Variable Rename 113 | vim.notify(rename_old .. "  " .. rename_new, vim.log.levels.WARN, { title = "Variable Rename" }) 114 | end 115 | 116 | local rename_old = vim.fn.expand("") 117 | local created_buffer = vim.api.nvim_create_buf(false, true) 118 | vim.api.nvim_open_win(created_buffer, true, { 119 | relative = "cursor", 120 | style = "minimal", 121 | border = border, 122 | row = 1, 123 | col = 0, 124 | width = 30, 125 | height = 1, 126 | }) 127 | vim.cmd("startinsert") 128 | 129 | vim.keymap.set("i", "", function() 130 | vim.cmd("q") 131 | vim.cmd("stopinsert") 132 | end, { buffer = created_buffer }) 133 | 134 | vim.keymap.set("i", "", function() 135 | return post(rename_old) 136 | end, { buffer = created_buffer }) 137 | end 138 | 139 | M.l_motion = function() 140 | local cursorPosition = vim.api.nvim_win_get_cursor(0) 141 | vim.cmd("normal ^") 142 | local firstChar = vim.api.nvim_win_get_cursor(0) 143 | 144 | if cursorPosition[2] < firstChar[2] then 145 | vim.cmd("normal ^") 146 | else 147 | vim.api.nvim_win_set_cursor(0, cursorPosition) 148 | vim.cmd("normal! l") 149 | end 150 | end 151 | 152 | M.h_motion = function() 153 | local cursorPosition = vim.api.nvim_win_get_cursor(0) 154 | vim.cmd("normal ^") 155 | local firstChar = vim.api.nvim_win_get_cursor(0) 156 | 157 | if cursorPosition[2] <= firstChar[2] then 158 | vim.cmd("normal 0") 159 | else 160 | vim.api.nvim_win_set_cursor(0, cursorPosition) 161 | vim.cmd("normal! h") 162 | end 163 | end 164 | 165 | M.border = function() 166 | return { 167 | { "╭", "FloatBorder" }, 168 | { "─", "FloatBorder" }, 169 | { "╮", "FloatBorder" }, 170 | { "│", "FloatBorder" }, 171 | { "╯", "FloatBorder" }, 172 | { "─", "FloatBorder" }, 173 | { "╰", "FloatBorder" }, 174 | { "│", "FloatBorder" }, 175 | } 176 | end 177 | 178 | return M 179 | -------------------------------------------------------------------------------- /lua/custom/abbrev.lua: -------------------------------------------------------------------------------- 1 | vim.cmd([[ 2 | " Command line abbrev 3 | cnoreabbrev W! w! 4 | cnoreabbrev Q! q! 5 | cnoreabbrev Q q 6 | cnoreabbrev Qall! qall! 7 | cnoreabbrev Wq wq 8 | cnoreabbrev Wa wa 9 | cnoreabbrev wQ wq 10 | cnoreabbrev WQ wq 11 | cnoreabbrev PoackerSync PackerSync 12 | cnoreabbrev packersync PackerSync 13 | cnoreabbrev poackersync PackerSync 14 | cnoreabbrev pckersync PackerSync 15 | cnoreabbrev packerdsync PackerSync 16 | cnoreabbrev sync PackerSync 17 | cnoreabbrev Sync PackerSync 18 | cnoreabbrev vterm 90 vsp :term 19 | 20 | " Q / q to quit 21 | cnoreabbrev Q ((getcmdtype() is# ':' && getcmdline() is#'Q')?('q'):('Q')) 22 | " W / w to write 23 | cnoreabbrev W ((getcmdtype() is# ':' && getcmdline() is#'W')?('w'):('W')) 24 | 25 | 26 | " Insert mode abbrev 27 | inoreabbrev mornign morning 28 | inoreabbrev rev :silent! =printf(&commentstring, ' REVISIT '.$USER.' ('.strftime("%T - %d/%m/%y").'):') 29 | inoreabbrev todo =printf(&commentstring, ' TODO(vsedov) ('.strftime("%T - %d/%m/%y").'):') 30 | inoreabbrev hack =printf(&commentstring, ' HACK(vsedov) ('.strftime("%T - %d/%m/%y").'):') 31 | inoreabbrev fixme =printf(&commentstring, ' FIXME(vsedov) ('.strftime("%T - %d/%m/%y").'):') 32 | inoreabbrev bug =printf(&commentstring, ' BUG(vsedov) ('.strftime("%T - %d/%m/%y").'):') 33 | inoreabbrev teh the 34 | inoreabbrev funciton function 35 | inoreabbrev asycn async 36 | inoreabbrev cosnt const 37 | inoreabbrev ehco echo 38 | inoreabbrev flase false 39 | inoreabbrev functoin function 40 | inoreabbrev ocnst const 41 | inoreabbrev retunr return 42 | inoreabbrev reutnr return 43 | inoreabbrev reutrn return 44 | inoreabbrev strign string 45 | inoreabbrev treu true 46 | inoreabbrev undefiend undefined 47 | inoreabbrev unlabeled unlabelled 48 | inoreabbrev targetted targeted 49 | inoreabbrev targetting targeting 50 | inoreabbrev targetter targeter 51 | inoreabbrev threshhold threshold 52 | inoreabbrev threshholds thresholds 53 | inoreabbrev removeable removable 54 | inoreabbrev betwene between 55 | inoreabbrev nromal normal 56 | inoreabbrev teh the 57 | inoreabbrev Adn And 58 | inoreabbrev adn and 59 | inoreabbrev Execture Execute 60 | inoreabbrev execture execute 61 | inoreabbrev Exectures Executes 62 | inoreabbrev exectures executes 63 | inoreabbrev Nubmer Number 64 | inoreabbrev nubmer number 65 | inoreabbrev Nubmers Numbers 66 | inoreabbrev nubmers numbers 67 | inoreabbrev Reponse Response 68 | inoreabbrev reponse response 69 | inoreabbrev Reponses Responses 70 | inoreabbrev reponses responses 71 | inoreabbrev Resovle Resolve 72 | inoreabbrev resovle resolve 73 | inoreabbrev Resovled Resolved 74 | inoreabbrev resovled resolved 75 | inoreabbrev Resovles Resolves 76 | inoreabbrev resovles resolves 77 | inoreabbrev Resovling Resolving 78 | inoreabbrev resovling resolving 79 | inoreabbrev Serach Search 80 | inoreabbrev serach search 81 | inoreabbrev Serached Searched 82 | inoreabbrev serached searched 83 | inoreabbrev Seraches Searches 84 | inoreabbrev seraches searches 85 | inoreabbrev Seraching Searching 86 | inoreabbrev seraching searching 87 | inoreabbrev Shuold Should 88 | inoreabbrev shuold should 89 | inoreabbrev Soruce Source 90 | inoreabbrev soruce source 91 | inoreabbrev Soruces Sources 92 | inoreabbrev soruces sources 93 | inoreabbrev Sorucing Sourcing 94 | inoreabbrev sorucing sourcing 95 | inoreabbrev udner under 96 | inoreabbrev Udner Under 97 | inoreabbrev Udpate Update 98 | inoreabbrev udpate update 99 | inoreabbrev Udpated Updated 100 | inoreabbrev udpated updated 101 | inoreabbrev Udpates Updates 102 | inoreabbrev udpates updates 103 | inoreabbrev Udpating Updating 104 | inoreabbrev udpating updating 105 | inoreabbrev Widnow Window 106 | inoreabbrev widnow window 107 | inoreabbrev WidnoWing Windowing 108 | inoreabbrev Widnows Windows 109 | inoreabbrev widnows windows 110 | inoreabbrev rtfm read the fucking manual 111 | inoreabbrev Iam I am 112 | inoreabbrev Im I am 113 | inoreabbrev TEh The 114 | inoreabbrev THat That 115 | inoreabbrev THe The 116 | inoreabbrev Teh The 117 | inoreabbrev Theyare they are 118 | inoreabbrev Youre you are 119 | inoreabbrev abotu about 120 | inoreabbrev aboutit about it 121 | inoreabbrev acn can 122 | inoreabbrev aer are 123 | inoreabbrev agian again 124 | inoreabbrev ahev have 125 | inoreabbrev ahve have 126 | inoreabbrev alos also 127 | inoreabbrev alot a lot 128 | inoreabbrev alse else 129 | inoreabbrev alsot also 130 | inoreabbrev amde made 131 | inoreabbrev amke make 132 | inoreabbrev amkes makes 133 | inoreabbrev anbd and 134 | inoreabbrev andd and 135 | inoreabbrev anf and 136 | inoreabbrev ans and 137 | inoreabbrev aobut about 138 | inoreabbrev aslo also 139 | inoreabbrev asthe as the 140 | inoreabbrev atthe at the 141 | inoreabbrev awya away 142 | inoreabbrev aywa away 143 | inoreabbrev bakc back 144 | inoreabbrev baout about 145 | inoreabbrev bcak back 146 | inoreabbrev beacuse because 147 | inoreabbrev becuase because 148 | inoreabbrev bve be 149 | inoreabbrev cant cannot 150 | inoreabbrev chaneg change 151 | inoreabbrev chanegs changes 152 | inoreabbrev chekc check 153 | inoreabbrev chnage change 154 | inoreabbrev chnaged changed 155 | inoreabbrev chnages changes 156 | inoreabbrev claer clear 157 | inoreabbrev clss class 158 | inoreabbrev cmo com 159 | inoreabbrev cna can 160 | inoreabbrev coudl could 161 | inoreabbrev cpoy copy 162 | inoreabbrev dael deal 163 | inoreabbrev didnot did not 164 | inoreabbrev didnt did nott 165 | inoreabbrev diea idea 166 | inoreabbrev doens does 167 | inoreabbrev doese does 168 | inoreabbrev doesnt does not 169 | inoreabbrev doign doing 170 | inoreabbrev doimg doing 171 | inoreabbrev donig doing 172 | inoreabbrev dont do not 173 | inoreabbrev eahc each 174 | inoreabbrev efel feel 175 | inoreabbrev ehlp help 176 | inoreabbrev ehr her 177 | inoreabbrev emial email 178 | inoreabbrev ened need 179 | inoreabbrev enxt next 180 | inoreabbrev esle else 181 | inoreabbrev ew we 182 | inoreabbrev eyar year 183 | inoreabbrev eyt yet 184 | inoreabbrev fatc fact 185 | inoreabbrev fidn find 186 | inoreabbrev fiel file 187 | inoreabbrev firts first 188 | inoreabbrev flase false 189 | inoreabbrev fo of 190 | inoreabbrev fomr form 191 | inoreabbrev fora for a 192 | inoreabbrev forthe for the 193 | inoreabbrev foudn found 194 | inoreabbrev frmo from 195 | inoreabbrev fro for 196 | inoreabbrev frome from 197 | inoreabbrev fromthe from the 198 | inoreabbrev fwe few 199 | inoreabbrev gerat great 200 | inoreabbrev gievn given 201 | inoreabbrev goign going 202 | inoreabbrev gonig going 203 | inoreabbrev gruop group 204 | inoreabbrev grwo grow 205 | inoreabbrev haev have 206 | inoreabbrev eher here 207 | inoreabbrev hasa has a 208 | inoreabbrev havea have a 209 | inoreabbrev hda had 210 | inoreabbrev hge he 211 | inoreabbrev hlep help 212 | inoreabbrev holf hold 213 | inoreabbrev hsa has 214 | inoreabbrev hsi his 215 | inoreabbrev htan than 216 | inoreabbrev htat that 217 | inoreabbrev hte the 218 | inoreabbrev htem them 219 | inoreabbrev hten then 220 | inoreabbrev htere there 221 | inoreabbrev htese these 222 | inoreabbrev htey they 223 | inoreabbrev hting thing 224 | inoreabbrev htink think 225 | inoreabbrev htis this 226 | inoreabbrev hvae have 227 | inoreabbrev hvaing having 228 | inoreabbrev hvea have 229 | inoreabbrev hwich which 230 | inoreabbrev hwo how 231 | inoreabbrev idae idea 232 | inoreabbrev idaes ideas 233 | inoreabbrev ihs his 234 | inoreabbrev ina in a 235 | inoreabbrev inot into 236 | inoreabbrev inteh in the 237 | inoreabbrev inthe in the 238 | inoreabbrev inthese in these 239 | inoreabbrev inthis in this 240 | inoreabbrev inwhich in which 241 | inoreabbrev isthe is the 242 | inoreabbrev isze size 243 | inoreabbrev itis it is 244 | inoreabbrev itwas it was 245 | inoreabbrev iused used 246 | inoreabbrev iwll will 247 | inoreabbrev iwth with 248 | inoreabbrev jstu just 249 | inoreabbrev jsut just 250 | inoreabbrev knwo know 251 | inoreabbrev knwon known 252 | inoreabbrev knwos knows 253 | inoreabbrev konw know 254 | inoreabbrev konwn known 255 | inoreabbrev konws knows 256 | inoreabbrev kwno know 257 | inoreabbrev laod load 258 | inoreabbrev lastr last 259 | inoreabbrev layed laid 260 | inoreabbrev liek like 261 | inoreabbrev liekd liked 262 | inoreabbrev liev live 263 | inoreabbrev likly likely 264 | inoreabbrev ling long 265 | inoreabbrev liuke like 266 | inoreabbrev loev love 267 | inoreabbrev lsat last 268 | inoreabbrev lveo love 269 | inoreabbrev lvoe love 270 | inoreabbrev mcuh much 271 | inoreabbrev mear mere 272 | inoreabbrev mial mail 273 | inoreabbrev mkae make 274 | inoreabbrev mkaes makes 275 | inoreabbrev mkea make 276 | inoreabbrev moeny money 277 | inoreabbrev mroe more 278 | inoreabbrev msut must 279 | inoreabbrev muhc much 280 | inoreabbrev muts must 281 | inoreabbrev mysefl myself 282 | inoreabbrev myu my 283 | inoreabbrev nad and 284 | inoreabbrev niether neither 285 | inoreabbrev nkow know 286 | inoreabbrev nkwo know 287 | inoreabbrev nmae name 288 | inoreabbrev nowe now 289 | inoreabbrev nto not 290 | inoreabbrev nver never 291 | inoreabbrev nwe new 292 | inoreabbrev nwo now 293 | inoreabbrev ocur occur 294 | inoreabbrev ofa of a 295 | inoreabbrev ofits of its 296 | inoreabbrev ofthe of the 297 | inoreabbrev oging going 298 | inoreabbrev ohter other 299 | inoreabbrev omre more 300 | inoreabbrev oneof one of 301 | inoreabbrev onthe on the 302 | inoreabbrev onyl only 303 | inoreabbrev ot to 304 | inoreabbrev otehr other 305 | inoreabbrev otu out 306 | inoreabbrev outof out of 307 | inoreabbrev owrk work 308 | inoreabbrev owuld would 309 | inoreabbrev paide paid 310 | inoreabbrev peice piece 311 | inoreabbrev puhs push 312 | inoreabbrev pwoer power 313 | inoreabbrev rela real 314 | inoreabbrev rulle rule 315 | inoreabbrev rwite write 316 | inoreabbrev sasy says 317 | inoreabbrev seh she 318 | inoreabbrev shoudl should 319 | inoreabbrev sitll still 320 | inoreabbrev sleect select 321 | inoreabbrev smae same 322 | inoreabbrev smoe some 323 | inoreabbrev sned send 324 | inoreabbrev soem some 325 | inoreabbrev sohw show 326 | inoreabbrev soze size 327 | inoreabbrev stnad stand 328 | inoreabbrev stpo stop 329 | inoreabbrev si is 330 | inoreabbrev syas says 331 | inoreabbrev ta at 332 | inoreabbrev tahn than 333 | inoreabbrev taht that 334 | inoreabbrev tath that 335 | inoreabbrev tehir their 336 | inoreabbrev tehn then 337 | inoreabbrev tehre there 338 | inoreabbrev tehy they 339 | inoreabbrev tghe the 340 | inoreabbrev tghis this 341 | inoreabbrev thanit than it 342 | inoreabbrev thansk thanks 343 | inoreabbrev thast that 344 | inoreabbrev thats that is 345 | inoreabbrev thatthe that the 346 | inoreabbrev theh then 347 | inoreabbrev theri their 348 | inoreabbrev theyare they are 349 | inoreabbrev thgat that 350 | inoreabbrev thge the 351 | inoreabbrev thier their 352 | inoreabbrev thign thing 353 | inoreabbrev thme them 354 | inoreabbrev thn then 355 | inoreabbrev thna than 356 | inoreabbrev thne then 357 | inoreabbrev thnig thing 358 | inoreabbrev thre there 359 | inoreabbrev thsi this 360 | inoreabbrev thsoe those 361 | inoreabbrev thta that 362 | inoreabbrev thyat that 363 | inoreabbrev thye they 364 | inoreabbrev ti it 365 | inoreabbrev tiem time 366 | inoreabbrev tihs this 367 | inoreabbrev timne time 368 | inoreabbrev tiome time 369 | inoreabbrev tje the 370 | inoreabbrev tjhe the 371 | inoreabbrev tkae take 372 | inoreabbrev tkaes takes 373 | inoreabbrev tkaing taking 374 | inoreabbrev todya today 375 | inoreabbrev tothe to the 376 | inoreabbrev towrad toward 377 | inoreabbrev tthe the 378 | inoreabbrev ture true 379 | inoreabbrev twpo two 380 | inoreabbrev tyhat that 381 | inoreabbrev tyhe they 382 | inoreabbrev uise use 383 | inoreabbrev untill until 384 | inoreabbrev veyr very 385 | inoreabbrev vrey very 386 | inoreabbrev waht what 387 | inoreabbrev wass was 388 | inoreabbrev watn want 389 | inoreabbrev weas was 390 | inoreabbrev wehn when 391 | inoreabbrev werre were 392 | inoreabbrev whcih which 393 | inoreabbrev wherre where 394 | inoreabbrev whic which 395 | inoreabbrev whihc which 396 | inoreabbrev whn when 397 | inoreabbrev whta what 398 | inoreabbrev wih with 399 | inoreabbrev wihch which 400 | inoreabbrev wiht with 401 | inoreabbrev willbe will be 402 | inoreabbrev willk will 403 | inoreabbrev witha with a 404 | inoreabbrev withe with 405 | inoreabbrev withh with 406 | inoreabbrev withit with it 407 | inoreabbrev witht with 408 | inoreabbrev withthe with the 409 | inoreabbrev witn with 410 | inoreabbrev wiull will 411 | inoreabbrev wnat want 412 | inoreabbrev wnats wants 413 | inoreabbrev woh who 414 | inoreabbrev wohle whole 415 | inoreabbrev wokr work 416 | inoreabbrev woudl would 417 | inoreabbrev wrod word 418 | inoreabbrev wroet wrote 419 | inoreabbrev wrok work 420 | inoreabbrev wtih with 421 | inoreabbrev wuould would 422 | inoreabbrev wya way 423 | inoreabbrev yaer year 424 | inoreabbrev yera year 425 | inoreabbrev yoiu you 426 | inoreabbrev yoru your 427 | inoreabbrev youare you are 428 | inoreabbrev youre you are 429 | inoreabbrev youve you have 430 | inoreabbrev yrea year 431 | inoreabbrev ytou you 432 | inoreabbrev yuo you 433 | inoreabbrev realli really 434 | inoreabbrev sukc suck 435 | inoreabbrev zpeling spelling 436 | inoreabbrev yuor your 437 | 438 | ]]) 439 | -------------------------------------------------------------------------------- /lua/custom/dashboard.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local default = { 4 | colors = require("core.utils").get(), 5 | } 6 | 7 | -- Change this to your own name 8 | -- Another username can be found at line 124 9 | local username = { 10 | -- [[██████╗ ██████╗ ██╗ ██╗ █████╗ ███╗ ██╗████████╗]], 11 | -- [[██╔══██╗██╔══██╗╚██╗ ██╔╝██╔══██╗████╗ ██║╚══██╔══╝]], 12 | -- [[██████╔╝██████╔╝ ╚████╔╝ ███████║██╔██╗ ██║ ██║ ]], 13 | -- [[██╔══██╗██╔══██╗ ╚██╔╝ ██╔══██║██║╚██╗██║ ██║ ]], 14 | -- [[██████╔╝██║ ██║ ██║ ██║ ██║██║ ╚████║ ██║ ]], 15 | -- [[╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ]], 16 | [[Bryant]], 17 | } 18 | 19 | --- Center the header / ascii 20 | ---@param dict string 21 | local function center(dict) 22 | local new_dict = {} 23 | for _, v in pairs(dict) do 24 | local padding = vim.fn.max(vim.fn.map(dict, "strwidth(v:val)")) 25 | local columns = (" "):rep(math.floor((vim.o.columns - padding) / 2)) .. v 26 | table.insert(new_dict, columns) 27 | end 28 | return new_dict 29 | end 30 | 31 | local morning = { 32 | "", 33 | "", 34 | "", 35 | "", 36 | [[ ██████ ██████ ██████ ██████ ███ ███ ██████ ██████ ███ ██ ██ ███ ██ ██████]], 37 | [[██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ████ ██ ██ ████ ██ ██ ]], 38 | [[██ ███ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ███]], 39 | [[██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██]], 40 | [[ ██████ ██████ ██████ ██████ ██ ██ ██████ ██ ██ ██ ████ ██ ██ ████ ██████]], 41 | "", 42 | "", 43 | } 44 | 45 | local afternoon = { 46 | "", 47 | "", 48 | "", 49 | "", 50 | [[ ██████ ██████ ██████ ██████ █████ ███████ ████████ ███████ ██████ ███ ██ ██████ ██████ ███ ██]], 51 | [[██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ████ ██]], 52 | [[██ ███ ██ ██ ██ ██ ██ ██ ███████ █████ ██ █████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██]], 53 | [[██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██]], 54 | [[ ██████ ██████ ██████ ██████ ██ ██ ██ ██ ███████ ██ ██ ██ ████ ██████ ██████ ██ ████]], 55 | "", 56 | "", 57 | } 58 | 59 | local night = { 60 | "", 61 | "", 62 | "", 63 | "", 64 | "", 65 | [[ ██████ ██████ ██████ ██████ ███████ ██ ██ ███████ ███ ██ ██ ███ ██ ██████ ]], 66 | [[██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██ ██ ]], 67 | [[██ ███ ██ ██ ██ ██ ██ ██ █████ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██ ███ ]], 68 | [[██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ]], 69 | [[ ██████ ██████ ██████ ██████ ███████ ████ ███████ ██ ████ ██ ██ ████ ██████ ]], 70 | "", 71 | "", 72 | } 73 | 74 | local mid_night = { 75 | "", 76 | "", 77 | "", 78 | "", 79 | "", 80 | [[███████ ██ ███████ ███████ ██████ ██ ██ ]], 81 | [[██ ██ ██ ██ ██ ██ ██ ██ ]], 82 | [[███████ ██ █████ █████ ██████ ██ ██ ]], 83 | [[ ██ ██ ██ ██ ██ ]], 84 | [[███████ ███████ ███████ ███████ ██ ██ ██ ]], 85 | "", 86 | "", 87 | } 88 | 89 | local quotes = { 90 | "", 91 | "'Fight for what's right. No matter if it means standing all ALONE'", 92 | } 93 | 94 | function M.display() 95 | if 96 | not ( 97 | (vim.api.nvim_buf_get_number(0) > 1 or vim.api.nvim_buf_get_lines(0, 0, 1, false)[1]:len() == 0) 98 | and vim.api.nvim_buf_get_name(0):len() == 0 99 | ) 100 | then 101 | return 102 | end 103 | 104 | vim.api.nvim_buf_set_option(0, "bufhidden", "wipe") 105 | vim.api.nvim_buf_set_option(0, "buftype", "nofile") 106 | 107 | local time = os.date("*t") 108 | -- If the time is 5am / less than or equals to 11 then morning 109 | if time.hour == 5 or time.hour <= 11 then 110 | vim.api.nvim_put(center(morning), "l", true, true) 111 | vim.api.nvim_put(center(username), "l", true, true) 112 | elseif time.hour == 12 or time.hour <= 17 then 113 | vim.api.nvim_put(center(afternoon), "l", true, true) 114 | vim.api.nvim_put(center(username), "l", true, true) 115 | elseif time.hour == 18 or time.hour <= 21 then 116 | vim.api.nvim_put(center(night), "l", true, true) 117 | vim.api.nvim_put(center(username), "l", true, true) 118 | else 119 | vim.api.nvim_put(center(mid_night), "l", true, true) 120 | vim.api.nvim_put(center(username), "l", true, true) 121 | end 122 | 123 | vim.api.nvim_put(center(quotes), "l", true, true) 124 | 125 | vim.cmd([[1]]) 126 | -- DONT EVER USE AUTOCHDIR! USE IT AT YOUR OWN RISK! 127 | -- autochdir = auto change directory 128 | -- [[silent! setlocal nonu nornu autochdir ft=dashboard nocul laststatus=0 nowrap]] 129 | vim.cmd([[silent! setlocal nonu nornu ft=dashboard nocul nowrap]]) 130 | 131 | vim.api.nvim_set_hl(0, "Red", { fg = default.colors.green }) 132 | vim.api.nvim_set_hl(0, "Orange", { fg = default.colors.orange, italic = true, bold = true }) 133 | vim.api.nvim_set_hl(0, "Purple", { 134 | fg = default.colors.purple, 135 | italic = true, 136 | bold = true,--[[ , underline = true ]] 137 | }) 138 | vim.fn.matchadd("Red", "[██]") 139 | vim.fn.matchadd("Orange", "Bryant") 140 | vim.fn.matchadd("Purple", "'Fight for what's right. No matter if it means standing all ALONE'") 141 | vim.api.nvim_buf_set_keymap(0, "n", "q", "q!", { noremap = true, silent = true }) 142 | end 143 | 144 | return M 145 | -------------------------------------------------------------------------------- /lua/custom/overrides.lua: -------------------------------------------------------------------------------- 1 | local hl = vim.api.nvim_set_hl 2 | local colors = require("core.utils").get() 3 | 4 | -- Code from nvchad 5 | local black = colors.black 6 | local black2 = colors.black2 7 | local blue = colors.blue 8 | local darker_black = colors.darker_black 9 | local folder_bg = colors.folder_bg 10 | local green = colors.green 11 | local grey = colors.grey 12 | local grey_fg = colors.grey_fg 13 | local light_grey = colors.light_grey 14 | local line = colors.line 15 | local nord_blue = colors.nord_blue 16 | local one_bg = colors.one_bg 17 | local one_bg2 = colors.one_bg2 18 | local pmenu_bg = colors.pmenu_bg 19 | local purple = colors.purple 20 | local red = colors.red 21 | local white = colors.white 22 | local yellow = colors.yellow 23 | local orange = colors.orange 24 | local one_bg3 = colors.one_bg3 25 | local teal = colors.teal 26 | local grey_fg2 = colors.grey_fg2 27 | local cyan = colors.cyan 28 | 29 | -- Define bg color 30 | -- @param group Group 31 | -- @param color Color 32 | local function bg(group, color, args) 33 | local arg = {} 34 | if args then 35 | vim.tbl_extend("keep", arg, args) 36 | end 37 | arg["bg"] = color 38 | vim.api.nvim_set_hl(0, group, arg) 39 | end 40 | 41 | -- Define fg color 42 | -- @param group Group 43 | -- @param color Color 44 | local function fg(group, color, args) 45 | local arg = {} 46 | if args then 47 | arg = args 48 | end 49 | arg["fg"] = color 50 | vim.api.nvim_set_hl(0, group, arg) 51 | end 52 | 53 | -- Define bg and fg color 54 | -- @param group Group 55 | -- @param fgcol Fg Color 56 | -- @param bgcol Bg Color 57 | local function fg_bg(group, fgcol, bgcol, args) 58 | local arg = {} 59 | if args then 60 | arg = args 61 | end 62 | arg["fg"] = fgcol 63 | arg["bg"] = bgcol 64 | vim.api.nvim_set_hl(0, group, arg) 65 | end 66 | 67 | -- Toggle transparent / ui right here :D 68 | local ui = { 69 | transparency = false, 70 | italic = true, 71 | } 72 | hl(0, "StatusNormal", { fg = "#181a1f", bg = "#98c379" }) 73 | hl(0, "StatusReplace", { fg = "#181a1f", bg = "#E5C07B" }) 74 | hl(0, "StatusInsert", { fg = "#181a1f", bg = "#61AFEF" }) 75 | hl(0, "StatusCommand", { fg = "#181a1f", bg = "#56B6C2" }) 76 | hl(0, "StatusVisual", { fg = "#181a1f", bg = "#C678DD" }) 77 | hl(0, "StatusTerminal", { fg = "#181a1f", bg = "#E06C75" }) 78 | hl(0, "Filename", { fg = "#a9b1d6" }) 79 | hl(0, "Branch", { fg = "#181a1f", bg = "#ff69b4" }) 80 | hl(0, "Error", { fg = "#181a1f", bg = "#EE6D85", bold = true }) 81 | hl(0, "Warning", { fg = "#181a1f", bg = "#D7A65F", bold = true }) 82 | hl(0, "Clock", { fg = "#181a1f", bg = "#41a6b5" }) 83 | 84 | if ui.italic then 85 | -- local light_grey = "#a9a9a9" 86 | fg("Comment", light_grey, { italic = true, bold = true }) 87 | fg("DiagnosticHeader", "#2cb27f", { italic = true, bold = true }) 88 | fg("GitSignsCurrentLineBlame", light_grey, { italic = true, bold = true }) 89 | fg("CmpItemAbbr", white, { italic = true }) 90 | fg_bg("TelescopePreviewTitle", black, green, { italic = true }) 91 | fg_bg("TelescopePromptTitle", black, red, { italic = true }) 92 | fg_bg("BufferlineBufferSelected", white, black, { italic = true, bold = true }) 93 | fg_bg("BufferlineBufferVisible", light_grey, black2, { italic = true, bold = true }) 94 | fg_bg("BufferlineDuplicateSelected", white, grey, { italic = true, bold = true }) 95 | fg_bg("BufferlineDuplicateVisible", white, black2, { italic = true, bold = true }) 96 | else 97 | fg("Comment", light_grey, { bold = true }) 98 | fg("DiagnosticHeader", "#2cb27f", { bold = true }) 99 | fg("GitSignsCurrentLineBlame", light_grey, { bold = true }) 100 | fg("CmpItemAbbr", white) 101 | fg_bg("TelescopePreviewTitle", black, green) 102 | fg_bg("TelescopePromptTitle", black, red) 103 | fg_bg("BufferlineBufferSelected", white, black, { bold = true }) 104 | fg_bg("BufferlineBufferVisible", light_grey, black2, { bold = true }) 105 | fg_bg("BufferlineDuplicateSelected", white, grey, { bold = true }) 106 | fg_bg("BufferlineDuplicateVisible", white, black2, { bold = true }) 107 | end 108 | 109 | if ui.transparency then 110 | -- bg("Normal", "none") 111 | fg_bg("Normal", "NONE", "none") 112 | bg("StatuslineNC", "NONE") 113 | fg_bg("BufferlineFill", grey_fg, "NONE") 114 | fg_bg("Folded", white, "NONE") 115 | else 116 | fg_bg("StatusLineNC", "#15171c") 117 | fg_bg("BufferlineFill", grey_fg, darker_black) 118 | fg_bg("Folded", white, grey) 119 | end 120 | 121 | ----------------------------------- 122 | -- Basic -- 123 | ----------------------------------- 124 | -- Line Number 125 | fg("CursorLineNr", yellow) 126 | fg("LineNr", light_grey) 127 | 128 | -- Same as bg, so it doesn't appear 129 | fg("EndOfBuffer", black) 130 | 131 | -- For floating windows 132 | -- fg("FloatBorder", blue) 133 | bg("NormalFloat", darker_black) 134 | 135 | -- testing 136 | fg("FloatBorder", grey_fg) 137 | fg("WinSeparator", blue) 138 | 139 | -- Inactive statuslines as thin lines 140 | fg("StatuslineNC", one_bg3) 141 | fg("NvimInternalError", red) 142 | fg("VertSplit", one_bg2) 143 | 144 | -- Visual mode highlighting 145 | fg("Visual", blue) 146 | 147 | ----------------------------------- 148 | -- Plugins -- 149 | ----------------------------------- 150 | -- Neorg 151 | bg("NeorgCodeBlock", darker_black) 152 | 153 | -- Bufferline 154 | fg("BufferLineRightCustomAreaText1", red) 155 | 156 | -- Lsp diagnostics 157 | fg("DiagnosticHint", purple) 158 | fg("DiagnosticError", red) 159 | fg("DiagnosticWarn", yellow) 160 | fg("DiagnosticInformation", green) 161 | 162 | -- Pmenu 163 | bg("Pmenu", black) 164 | bg("PmenuSbar", one_bg) 165 | bg("PmenuThumb", grey) 166 | fg_bg("PmenuSel", black, pmenu_bg) 167 | 168 | -- GitSigns 169 | fg("GitSignsAdd", green) 170 | fg("GitSignsChange", orange) 171 | fg("GitSignsDelete", red) 172 | 173 | -- Neotree 174 | fg("NeoTreeDirectoryIcon", folder_bg) 175 | fg("NeoTreeDirectoryName", folder_bg) 176 | fg("NeoTreeRootName", red, { underline = true }) 177 | fg("NeoTreeDirectoryName", folder_bg) 178 | fg("NeoTreeFileNameOpened", folder_bg) 179 | 180 | -- CMP 181 | fg("CmpItemAbbrDeprecated", "#808080", { strikethrough = true }) 182 | 183 | -- fg("CmpItemAbbrMatch", "#569CD6") 184 | fg("CmpItemAbbrMatch", blue, { bold = true }) 185 | fg("CmpItemAbbrMatchFuzzy", "#569CD6") 186 | 187 | fg("CmpItemKindVariable", yellow) 188 | fg("CmpItemMenuInterface", "#9CDCFE") 189 | fg("CmpItemMenuText", light_grey) 190 | 191 | fg("CmpItemKindFunction", red) 192 | fg("CmpItemKindMethod", red) 193 | 194 | fg("CmpItemKindKeyword", orange) 195 | fg("CmpItemKindProperty", orange) 196 | fg("CmpItemKindUnit", orange) 197 | 198 | fg("CmpItemKindFile", blue) 199 | fg("CmpItemKindModule", blue) 200 | 201 | fg("CmpItemKindSnippet", purple) 202 | 203 | -- fg("CmpBorder", blue) 204 | fg("CmpBorder", grey) 205 | fg("CmpDocumentationWindowBorder", grey) 206 | 207 | -- Telescope 208 | bg("TelescopeNormal", darker_black) 209 | bg("TelescopeSelection", black2) 210 | fg_bg("TelescopeBorder", darker_black, darker_black) 211 | fg_bg("TelescopePromptBorder", black2, black2) 212 | fg_bg("TelescopePromptNormal", white, black2) 213 | fg_bg("TelescopePromptPrefix", red, black2) 214 | fg_bg("TelescopeResultsTitle", darker_black, darker_black) 215 | bg("TelescopePreviewLine", light_grey) 216 | 217 | -- Nvim-Tree 218 | bg("NvimTreeNormal", darker_black) 219 | bg("NvimTreeCursorLine", darker_black) 220 | bg("NvimTreeNormalNC", darker_black) 221 | fg("NvimTreeEmptyFolderName", folder_bg) 222 | fg("NvimTreeFolderName", folder_bg) 223 | fg("NvimTreeFolderIcon", folder_bg) 224 | fg("NvimTreeOpenedFolderName", folder_bg) 225 | fg("NvimTreeEndOfBuffer", darker_black) 226 | fg("NvimTreeGitDirty", red) 227 | fg("NvimTreeIndentMarker", grey_fg) 228 | fg("NvimTreeRootFolder", red, { underline = true }) 229 | fg_bg("NvimTreeStatuslineNc", darker_black, darker_black) 230 | fg_bg("NvimTreeVertSplit", darker_black, darker_black) 231 | fg_bg("NvimTreeWindowPicker", black2, red) 232 | -------------------------------------------------------------------------------- /lua/custom/statusline.lua: -------------------------------------------------------------------------------- 1 | local fn = vim.fn 2 | local api = vim.api 3 | local space = " " 4 | 5 | --Modes {{{ 6 | local modes = { 7 | ["n"] = "NORMAL", 8 | ["no"] = "NORMAL", 9 | ["v"] = "VISUAL", 10 | ["V"] = "VISUAL LINE", 11 | [""] = "VISUAL BLOCK", 12 | ["s"] = "SELECT", 13 | ["S"] = "SELECT LINE", 14 | [""] = "SELECT BLOCK", 15 | ["i"] = "INSERT", 16 | ["ic"] = "INSERT", 17 | ["R"] = "REPLACE", 18 | ["Rv"] = "VISUAL REPLACE", 19 | ["c"] = "COMMAND", 20 | ["cv"] = "VIM EX", 21 | ["ce"] = "EX", 22 | ["r"] = "PROMPT", 23 | ["rm"] = "MOAR", 24 | ["r?"] = "CONFIRM", 25 | ["!"] = "SHELL", 26 | ["t"] = "TERMINAL", 27 | } 28 | 29 | -- Making the modes name UPPERCASE 30 | local function mode() 31 | local current_mode = api.nvim_get_mode().mode 32 | return string.format(" %s ", modes[current_mode]):upper() 33 | end 34 | 35 | -- Change the color base on the modes 36 | --- Mode colors 37 | ---@return any modes | colors 38 | local function update_mode_colors() 39 | local current_mode = api.nvim_get_mode().mode 40 | local mode_color = "%#StatusLineAccent#" 41 | if current_mode == "n" then 42 | mode_color = "%#StatusNormal#" 43 | elseif current_mode == "i" or current_mode == "ic" then 44 | mode_color = "%#StatusInsert#" 45 | elseif current_mode == "v" or current_mode == "V" or current_mode == "" then 46 | mode_color = "%#StatusVisual#" 47 | elseif current_mode == "R" then 48 | mode_color = "%#StatusReplace#" 49 | elseif current_mode == "c" then 50 | mode_color = "%#StatusCommand#" 51 | elseif current_mode == "t" then 52 | mode_color = "%#StatusTerminal#" 53 | end 54 | return mode_color 55 | end 56 | --}}} 57 | 58 | -- Git Branch {{{ 59 | --- Using gitsigns for git 60 | ---@return string 61 | local vcs = function() 62 | local git_info = vim.b.gitsigns_status_dict 63 | if not git_info or git_info.head == "" then 64 | return "" 65 | end 66 | return table.concat({ 67 | "%#Branch#  ", 68 | git_info.head, 69 | " ", 70 | }) 71 | end 72 | -- }}} 73 | 74 | -- File {{{ 75 | --- Shorten filename 76 | ---@return string filename 77 | local function get_name() 78 | local filename = fn.expand("%:t") 79 | if filename == "" then 80 | return "" 81 | end 82 | return " " .. filename .. " " 83 | end 84 | 85 | --- Readonly icon 86 | ---@return string readonly 87 | local function get_readonly() 88 | if vim.bo.readonly then 89 | return "[RO]" 90 | end 91 | return "" 92 | end 93 | 94 | --- Edited file icon 95 | ---@return string save / written 96 | local function get_modified() 97 | if vim.bo.modified then 98 | return "[+]" 99 | end 100 | if not vim.bo.modifiable then 101 | return "[-]" 102 | end 103 | return "" 104 | end 105 | 106 | local function filename() 107 | local name = get_name() 108 | local flags = table.concat({ get_readonly(), get_modified() }) 109 | if flags ~= "" then 110 | flags = " " .. flags 111 | end 112 | return table.concat({ name, flags }) 113 | end 114 | -- }}} 115 | 116 | -- FIletype {{{ 117 | local function get_filetype() 118 | local file_name, file_ext = fn.expand("%:t"), fn.expand("%:e") 119 | local icon = require("nvim-web-devicons").get_icon(file_name, file_ext, { default = true }) 120 | local filetype = vim.bo.filetype 121 | 122 | if filetype == "" then 123 | return "" 124 | end 125 | return string.format(" %s %s ", icon, filetype):lower() 126 | end 127 | ---}}} 128 | 129 | -- Word counter {{{ 130 | local function word_counter() 131 | local wc = vim.api.nvim_eval("wordcount()") 132 | if wc["visual_words"] then 133 | return wc["visual_words"] 134 | else 135 | return wc["words"] 136 | end 137 | end 138 | -- }}} 139 | 140 | -- LSP {{{ 141 | local fmt = string.format 142 | 143 | --- Getting diagnostic 144 | ---@param prefix string Which is W as in warning 145 | ---@param severity number 146 | ---@return string W:1 147 | local function get_diagnostic(prefix, severity) 148 | local count 149 | if vim.fn.has("nvim-0.6") == 0 then 150 | count = vim.lsp.diagnostic.get_count(0, severity) 151 | else 152 | local severities = { 153 | ["Warning"] = vim.diagnostic.severity.WARN, 154 | ["Error"] = vim.diagnostic.severity.ERROR, 155 | ["Info"] = vim.diagnostic.severity.INFO, 156 | ["Hint"] = vim.diagnostic.severity.HINT, 157 | } 158 | count = #vim.diagnostic.get(0, { severity = severities[severity] }) 159 | end 160 | return fmt(" %s:%d ", prefix, count) 161 | end 162 | 163 | local function get_error() 164 | return get_diagnostic("X", "Error") 165 | end 166 | local function get_warning() 167 | return get_diagnostic("W", "Warning") 168 | end 169 | -- local function get_info() 170 | -- return get_diagnostic("I", "Info") 171 | -- end 172 | -- local function get_hint() 173 | -- return get_diagnostic("H", "Hint") 174 | -- end 175 | -- }}} 176 | 177 | -- Clock {{{ 178 | --- Creating a working clock 179 | ---@return string + icon 180 | local function clock() 181 | return " 什 " .. os.date("%H:%M ") 182 | end 183 | --}}} 184 | 185 | -- Main {{{ 186 | Statusline = {} 187 | 188 | Statusline.active = function() 189 | return table.concat({ 190 | "%#Statusline#", 191 | update_mode_colors(), -- Update mode colors 192 | mode(), -- Show mode 193 | "%#Normal#", 194 | vcs(), 195 | "%#Statusline#", 196 | "%=", 197 | "%#Filename#", 198 | filename(), -- Show filename 199 | "%#Statusline#", 200 | "%=", 201 | word_counter(), 202 | space, 203 | "%#Error#", 204 | get_error(), 205 | "%#Warning#", 206 | get_warning(), 207 | "%#Clock#", 208 | clock(), 209 | }) 210 | end 211 | 212 | function Statusline.inactive() 213 | return table.concat({ 214 | "%#StatusInactive#", 215 | "%=", 216 | filename(), 217 | 218 | "%=", 219 | }) 220 | end 221 | 222 | --- NvimTree text 223 | ---@return string NvimTree 224 | function Statusline.short() 225 | return "%#StatusLineNC#  NvimTree" 226 | end 227 | -- }}} 228 | 229 | -- Setting autocmd 230 | api.nvim_exec( 231 | [[ 232 | augroup Statusline 233 | au! 234 | au WinEnter,BufEnter * setlocal statusline=%!v:lua.Statusline.active() 235 | au WinLeave,BufLeave * setlocal statusline=%!v:lua.Statusline.inactive() 236 | au WinEnter,BufEnter,FileType NvimTree setlocal statusline=%!v:lua.Statusline.short() 237 | augroup END 238 | ]], 239 | false 240 | ) 241 | -------------------------------------------------------------------------------- /lua/plugins/config/alpha.lua: -------------------------------------------------------------------------------- 1 | local present, alpha = pcall(require, "alpha") 2 | if not present then 3 | return 4 | end 5 | 6 | local header = { 7 | type = "text", 8 | val = { 9 | [[]], 10 | [[ ███ ██ ██ ██ ██ ██ █████ ██████ ██ ██ ]], 11 | [[ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ]], 12 | [[ ██ ██ ██ ██ ██ ███████ ███████ ██ █████ ]], 13 | [[ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ]], 14 | [[ ██ ████ ████ ██ ██ ██ ██ ██████ ██ ██ ]], 15 | [[ ]], 16 | [[]], 17 | }, 18 | opts = { 19 | position = "center", 20 | hl = "AlphaHeader", 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /lua/plugins/config/autopairs.lua: -------------------------------------------------------------------------------- 1 | local status_ok, npairs = pcall(require, "nvim-autopairs") 2 | if not status_ok then 3 | return 4 | end 5 | 6 | local cmp_autopairs = require("nvim-autopairs.completion.cmp") 7 | local cmp = require("cmp") 8 | local Rule = require("nvim-autopairs.rule") 9 | local cond = require("nvim-autopairs.conds") 10 | 11 | npairs.setup({ 12 | check_ts = true, 13 | -- enable_check_bracket_line = true, 14 | }) 15 | cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } })) 16 | 17 | -- npairs.add_rules({ 18 | -- -- CPP < > 19 | -- Rule("<", ">", "cpp"), 20 | 21 | -- -- Alternative version of add space in parentheses 22 | -- Rule(" ", " ") 23 | -- :with_pair(function(opts) 24 | -- local pair = opts.line:sub(opts.col - 1, opts.col) 25 | -- return vim.tbl_contains({ "()", "{}", "[]" }, pair) 26 | -- end) 27 | -- :with_move(cond.none()) 28 | -- :with_cr(cond.none()) 29 | -- :with_del(function(opts) 30 | -- local col = vim.api.nvim_win_get_cursor(0)[2] 31 | -- local context = opts.line:sub(col - 1, col + 2) 32 | -- return vim.tbl_contains({ "( )", "{ }", "[ ]" }, context) 33 | -- end), 34 | -- Rule("", " )") 35 | -- :with_pair(cond.none()) 36 | -- :with_move(function(opts) 37 | -- return opts.char == ")" 38 | -- end) 39 | -- :with_cr(cond.none()) 40 | -- :with_del(cond.none()) 41 | -- :use_key(")"), 42 | -- Rule("", " }") 43 | -- :with_pair(cond.none()) 44 | -- :with_move(function(opts) 45 | -- return opts.char == "}" 46 | -- end) 47 | -- :with_cr(cond.none()) 48 | -- :with_del(cond.none()) 49 | -- :use_key("}"), 50 | -- Rule("", " ]") 51 | -- :with_pair(cond.none()) 52 | -- :with_move(function(opts) 53 | -- return opts.char == "]" 54 | -- end) 55 | -- :with_cr(cond.none()) 56 | -- :with_del(cond.none()) 57 | -- :use_key("]"), 58 | 59 | -- -- Arror key in js 60 | -- Rule("%(.*%)%s*%=>$", " { }", { "typescript", "typescriptreact", "javascript", "react" }) 61 | -- :use_regex(true) 62 | -- :set_end_pair_length(2), 63 | 64 | -- -- Auto addspace on = 65 | -- Rule("=", "") 66 | -- :with_pair(cond.not_inside_quote()) 67 | -- :with_pair(function(opts) 68 | -- local last_char = opts.line:sub(opts.col - 1, opts.col - 1) 69 | -- if last_char:match("[%w%=%s]") then 70 | -- return true 71 | -- end 72 | -- return false 73 | -- end) 74 | -- :replace_endpair(function(opts) 75 | -- local prev_2char = opts.line:sub(opts.col - 2, opts.col - 1) 76 | -- local next_char = opts.line:sub(opts.col, opts.col) 77 | -- next_char = next_char == " " and "" or " " 78 | -- if prev_2char:match("%w$") then 79 | -- return " =" .. next_char 80 | -- end 81 | -- if prev_2char:match("%=$") then 82 | -- return next_char 83 | -- end 84 | -- if prev_2char:match("=") then 85 | -- return "=" .. next_char 86 | -- end 87 | -- return "" 88 | -- end) 89 | -- :set_end_pair_length(0) 90 | -- :with_move(cond.none()) 91 | -- :with_del(cond.none()), 92 | -- }) 93 | -------------------------------------------------------------------------------- /lua/plugins/config/bufferline.lua: -------------------------------------------------------------------------------- 1 | local present, bufferline = pcall(require, "bufferline") 2 | if not present then 3 | return 4 | end 5 | 6 | local default = { 7 | colors = require("core.utils").get(), 8 | } 9 | local groups = require("bufferline.groups") 10 | local fn = vim.fn 11 | 12 | vim.cmd([[ 13 | function! Quit_vim(a,b,c,d) 14 | wqa 15 | endfunction 16 | ]]) 17 | 18 | -- Code from NvChad 19 | bufferline.setup({ 20 | options = { 21 | numbers = "none", 22 | themable = true, 23 | close_command = "bdelete! %d", 24 | right_mouse_command = "sbuffer %d", 25 | middle_mouse_command = "vertical sbuffer %d", 26 | indicator_icon = "▎", 27 | buffer_close_icon = "", 28 | modified_icon = "", 29 | close_icon = "", 30 | left_trunc_marker = "", 31 | right_trunc_marker = "", 32 | max_name_length = 14, 33 | max_prefix_length = 13, 34 | tab_size = 20, 35 | view = "multiwindow", 36 | diagnostics = "nvim_diagnostic", 37 | diagnostics_update_in_insert = true, 38 | -- diagnostics_indicator = function(count, level, diagnostics_dict, context) 39 | -- return "(" .. count .. ")" 40 | -- end, 41 | offsets = { { filetype = "NvimTree", text = "" } }, 42 | separator_style = "thin", 43 | show_buffer_icons = true, 44 | show_buffer_close_icons = true, 45 | show_close_icon = false, 46 | show_tab_indicators = true, 47 | enforce_regular_tabs = true, 48 | always_show_bufferline = true, 49 | custom_filter = function(buf_number) 50 | -- Func to filter out our managed/persistent split terms 51 | local present_type, type = pcall(function() 52 | return vim.api.nvim_buf_get_var(buf_number, "term_type") 53 | end) 54 | 55 | if present_type then 56 | if type == "vert" then 57 | return false 58 | elseif type == "hori" then 59 | return false 60 | end 61 | return true 62 | end 63 | 64 | return true 65 | end, 66 | 67 | custom_areas = { 68 | right = function() 69 | return { 70 | { text = "%@Quit_vim@  %X" }, 71 | } 72 | end, 73 | }, 74 | }, 75 | highlights = { 76 | background = { 77 | guifg = default.colors.grey_fg, 78 | guibg = default.colors.black2, 79 | }, 80 | 81 | -- buffers 82 | -- buffer_selected = { 83 | -- guifg = default.colors.white, 84 | -- guibg = default.colors.black, 85 | -- gui = "bold,italic", 86 | -- }, 87 | -- buffer_visible = { 88 | -- guifg = default.colors.light_grey, 89 | -- guibg = default.colors.black2, 90 | -- gui = "bold,italic", 91 | -- }, 92 | -- duplicate_selected = { 93 | -- guifg = default.colors.white, 94 | -- -- guibg = default.colors.black, 95 | -- guibg = default.colors.grey, 96 | -- gui = "bold,italic", 97 | -- }, 98 | -- duplicate_visible = { 99 | -- guifg = default.colors.white, 100 | -- guibg = default.colors.black2, 101 | -- gui = "bold,italic", 102 | -- }, 103 | 104 | -- for diagnostics = "nvim_lsp" 105 | error = { 106 | guifg = default.colors.light_grey, 107 | guibg = default.colors.black2, 108 | }, 109 | error_diagnostic = { 110 | guifg = default.colors.light_grey, 111 | guibg = default.colors.black2, 112 | }, 113 | 114 | -- close buttons 115 | close_button = { 116 | guifg = default.colors.light_grey, 117 | guibg = default.colors.black2, 118 | }, 119 | close_button_visible = { 120 | guifg = default.colors.light_grey, 121 | guibg = default.colors.black2, 122 | }, 123 | close_button_selected = { 124 | guifg = default.colors.red, 125 | guibg = default.colors.black, 126 | }, 127 | -- fill = { 128 | -- guifg = default.colors.grey_fg, 129 | -- guibg = "NONE", 130 | -- }, 131 | indicator_selected = { 132 | guifg = default.colors.black, 133 | guibg = default.colors.black, 134 | }, 135 | 136 | -- modified 137 | modified = { 138 | guifg = default.colors.red, 139 | guibg = default.colors.black2, 140 | }, 141 | modified_visible = { 142 | guifg = default.colors.red, 143 | guibg = default.colors.black2, 144 | }, 145 | modified_selected = { 146 | guifg = default.colors.green, 147 | guibg = default.colors.black, 148 | }, 149 | 150 | -- separators 151 | separator = { 152 | guifg = default.colors.black2, 153 | guibg = default.colors.black2, 154 | }, 155 | separator_visible = { 156 | guifg = default.colors.black2, 157 | guibg = default.colors.black2, 158 | }, 159 | separator_selected = { 160 | guifg = default.colors.black2, 161 | guibg = default.colors.black2, 162 | }, 163 | 164 | -- tabs 165 | tab = { 166 | guifg = default.colors.light_grey, 167 | guibg = default.colors.one_bg3, 168 | }, 169 | tab_selected = { 170 | guifg = default.colors.black2, 171 | guibg = default.colors.nord_blue, 172 | }, 173 | tab_close = { 174 | guifg = default.colors.red, 175 | guibg = default.colors.black, 176 | }, 177 | }, 178 | }) 179 | -------------------------------------------------------------------------------- /lua/plugins/config/cmp.lua: -------------------------------------------------------------------------------- 1 | local present, cmp = pcall(require, "cmp") 2 | if not present then 3 | return 4 | end 5 | 6 | -- luasnip 7 | local has_words_before = function() 8 | local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 9 | return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil 10 | end 11 | 12 | local luasnip = require("luasnip") 13 | 14 | local kind_icons = { 15 | Text = "", 16 | Method = "", 17 | Function = "", 18 | Constructor = "", 19 | Field = "ﰠ", 20 | Variable = "", 21 | Class = "ﴯ", 22 | Interface = "", 23 | Module = "", 24 | Property = "ﰠ", 25 | Unit = "塞", 26 | Value = "", 27 | Enum = "", 28 | Keyword = "", 29 | Snippet = "", 30 | Color = "", 31 | File = "", 32 | Reference = "", 33 | Folder = "", 34 | EnumMember = "", 35 | Constant = "", 36 | Struct = "פּ", 37 | Event = "", 38 | Operator = "", 39 | TypeParameter = "", 40 | } 41 | 42 | -- local border = { 43 | -- { "┏", "FloatBorder" }, 44 | -- { "━", "FloatBorder" }, 45 | -- { "┓", "FloatBorder" }, 46 | -- { "┃", "FloatBorder" }, 47 | -- { "┛", "FloatBorder" }, 48 | -- { "━", "FloatBorder" }, 49 | -- { "┗", "FloatBorder" }, 50 | -- { "┃", "FloatBorder" }, 51 | -- } 52 | 53 | -- local border = { 54 | -- { "╔", "FloatBorder" }, 55 | -- { "═", "FloatBorder" }, 56 | -- { "╗", "FloatBorder" }, 57 | -- { "║", "FloatBorder" }, 58 | -- { "╝", "FloatBorder" }, 59 | -- { "═", "FloatBorder" }, 60 | -- { "╚", "FloatBorder" }, 61 | -- { "║", "FloatBorder" }, 62 | -- } 63 | 64 | local border = { 65 | { "╭", "CmpBorder" }, 66 | { "─", "CmpBorder" }, 67 | { "╮", "CmpBorder" }, 68 | { "│", "CmpBorder" }, 69 | { "╯", "CmpBorder" }, 70 | { "─", "CmpBorder" }, 71 | { "╰", "CmpBorder" }, 72 | { "│", "CmpBorder" }, 73 | } 74 | cmp.setup({ 75 | window = { 76 | completion = { 77 | border = border, 78 | scrollbar = "┃", 79 | -- scrollbar = "║", 80 | }, 81 | documentation = { 82 | border = border, 83 | -- scrollbar = "║", 84 | scrollbar = "┃", 85 | }, 86 | }, 87 | snippet = { 88 | expand = function(args) 89 | require("luasnip").lsp_expand(args.body) 90 | end, 91 | }, 92 | mapping = cmp.mapping.preset.insert({ 93 | [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), 94 | [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), 95 | [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), 96 | [""] = cmp.config.disable, 97 | [""] = cmp.mapping({ 98 | i = cmp.mapping.abort(), 99 | c = cmp.mapping.close(), 100 | }), 101 | 102 | [""] = cmp.mapping({ 103 | i = cmp.mapping.confirm({ 104 | select = true, 105 | behavior = cmp.ConfirmBehavior.Insert, 106 | }), 107 | c = cmp.mapping.confirm({ 108 | select = false, 109 | behavior = cmp.ConfirmBehavior.Select, 110 | }), 111 | }), 112 | [""] = cmp.mapping(function(fallback) 113 | if cmp.visible() then 114 | cmp.select_next_item() 115 | elseif luasnip.expand_or_jumpable() then 116 | luasnip.expand_or_jump() 117 | elseif has_words_before() then 118 | cmp.complete() 119 | else 120 | fallback() 121 | end 122 | end, { "i", "s" }), 123 | 124 | [""] = cmp.mapping(function(fallback) 125 | if cmp.visible() then 126 | cmp.select_prev_item() 127 | elseif luasnip.jumpable(-1) then 128 | luasnip.jump(-1) 129 | else 130 | fallback() 131 | end 132 | end, { "i", "s" }), 133 | }), 134 | sorting = { 135 | comparators = { 136 | cmp.config.compare.offset, 137 | cmp.config.compare.exact, 138 | cmp.config.compare.recently_used, 139 | -- require("clangd_extensions.cmp_scores"), 140 | cmp.config.compare.kind, 141 | cmp.config.compare.sort_text, 142 | cmp.config.compare.length, 143 | cmp.config.compare.order, 144 | }, 145 | }, 146 | formatting = { 147 | -- fields = { "kind", "menu", "abbr" }, 148 | -- format = function(entry, vim_item) 149 | -- vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind) 150 | -- --[[ vim_item.menu = ({ 151 | -- buffer = "[BUF]", 152 | -- nvim_lsp = "[LSP]", 153 | -- nvim_lua = "[API]", 154 | -- path = "[PATH]", 155 | -- luasnip = "[SNIP]", 156 | -- npm = "[NPM]", 157 | -- neorg = "[NEORG]", 158 | -- })[entry.source.name] ]] 159 | -- return vim_item 160 | -- end, 161 | fields = { "kind", "abbr", "menu" }, 162 | format = function(_, vim_item) 163 | vim_item.menu = vim_item.kind 164 | vim_item.kind = kind_icons[vim_item.kind] 165 | return vim_item 166 | end, 167 | }, 168 | sources = cmp.config.sources({ 169 | { name = "nvim_lsp", priority = "9" }, 170 | { name = "luasnip", priority = "8" }, 171 | { name = "buffer", keyword_length = 5 }, 172 | { name = "npm", keyword_length = 2 }, 173 | { name = "neorg" }, 174 | }), 175 | }) 176 | 177 | -- cmp.setup.cmdline("/", { 178 | -- sources = { 179 | -- { name = "buffer" }, 180 | -- }, 181 | -- }) 182 | 183 | -- cmp.setup.cmdline(":", { 184 | -- sources = { 185 | -- { name = "cmdline" }, 186 | -- }, 187 | -- }) 188 | 189 | cmp.setup.cmdline(":", { 190 | sources = { 191 | { name = "cmdline", group_index = 1 }, 192 | -- { name = "cmdline" }, 193 | { name = "cmdline_history", group_index = 2 }, 194 | }, 195 | view = { 196 | entries = { name = "wildmenu", separator = " | " }, 197 | }, 198 | mapping = cmp.mapping.preset.cmdline(), 199 | }) 200 | 201 | cmp.setup.cmdline("/", { 202 | sources = { 203 | { name = "cmdline_history" }, 204 | { name = "buffer" }, 205 | }, 206 | view = { 207 | entries = { name = "wildmenu", separator = " | " }, 208 | }, 209 | mapping = cmp.mapping.preset.cmdline(), 210 | }) 211 | -------------------------------------------------------------------------------- /lua/plugins/config/comment.lua: -------------------------------------------------------------------------------- 1 | local present, Comment = pcall(require, "Comment") 2 | if not present then 3 | return 4 | end 5 | 6 | Comment.setup({ 7 | padding = true, 8 | sticky = true, 9 | ignore = "^$", 10 | toggler = { 11 | line = "gcc", 12 | block = "gcb", 13 | }, 14 | opleader = { 15 | line = "gc", 16 | block = "gb", 17 | }, 18 | 19 | -- with nvim-ts-context-commentstring 20 | pre_hook = function(ctx) 21 | local U = require("Comment.utils") 22 | 23 | local location = nil 24 | if ctx.ctype == U.ctype.block then 25 | location = require("ts_context_commentstring.utils").get_cursor_location() 26 | elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then 27 | location = require("ts_context_commentstring.utils").get_visual_start_location() 28 | end 29 | 30 | return require("ts_context_commentstring.internal").calculate_commentstring({ 31 | key = ctx.ctype == U.ctype.line and "__default" or "__multiline", 32 | location = location, 33 | }) 34 | end, 35 | }) 36 | -------------------------------------------------------------------------------- /lua/plugins/config/dashboard.lua: -------------------------------------------------------------------------------- 1 | local g = vim.g 2 | local fn = vim.fn 3 | 4 | local plugins_count = fn.len(fn.globpath("$HOME/AppData/Local/nvim-data/site/pack/packer/start/", "*", 0, 1)) 5 | local datetime = os.date("%d-%m-%Y") 6 | 7 | g.dashboard_disable_statusline = 1 8 | g.dashboard_default_executive = "telescope" 9 | 10 | -- g.dashboard_custom_header = { 11 | -- " ", 12 | -- "███╗ ██╗██╗ ██╗ ██╗ ██╗ █████╗ ██████╗██╗ ██╗", 13 | -- "████╗ ██║██║ ██║ ██║ ██║██╔══██╗██╔════╝██║ ██╔╝", 14 | -- "██╔██╗ ██║██║ ██║ ███████║███████║██║ █████╔╝ ", 15 | -- "██║╚██╗██║╚██╗ ██╔╝ ██╔══██║██╔══██║██║ ██╔═██╗ ", 16 | -- "██║ ╚████║ ╚████╔╝ ██║ ██║██║ ██║╚██████╗██║ ██╗", 17 | -- "╚═╝ ╚═══╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝", 18 | -- " ", 19 | -- } 20 | 21 | g.dashboard_custom_header = { 22 | " ", 23 | " ███ ██ ██ ██ ██ ██ █████ ██████ ██ ██ ", 24 | " ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ", 25 | " ██ ██ ██ ██ ██ ███████ ███████ ██ █████ ", 26 | " ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ", 27 | " ██ ████ ████ ██ ██ ██ ██ ██████ ██ ██ ", 28 | " ", 29 | } 30 | 31 | g.dashboard_custom_section = { 32 | a = { description = { " Find File SPC f f" }, command = "Telescope find_files" }, 33 | b = { description = { " Find Word SPC f w" }, command = "Telescope live_grep" }, 34 | c = { description = { "ﲉ Find Help SPC f h" }, command = "Telescope help_tags" }, 35 | d = { description = { " Colorschemes SPC f c" }, command = "Telescope colorscheme" }, 36 | e = { description = { " Find Keymaps SPC f k" }, command = "Telescope keymaps" }, 37 | } 38 | 39 | g.dashboard_custom_footer = { 40 | -- "┌─ Today is " .. datetime .. " ─┐", 41 | -- "└─ " .. plugins_count .. " plugins in total ─┘", 42 | " ", 43 | "NvHack loaded " .. plugins_count .. " plugins successfully!", 44 | } 45 | -------------------------------------------------------------------------------- /lua/plugins/config/explorer.lua: -------------------------------------------------------------------------------- 1 | vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) 2 | require("neo-tree").setup({ 3 | -- log_level = "trace", 4 | -- log_to_file = true, 5 | close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab 6 | popup_border_style = "rounded", 7 | enable_git_status = true, 8 | async_directory_scan = false, 9 | enable_diagnostics = true, 10 | default_component_configs = { 11 | indent = { 12 | indent_size = 2, 13 | padding = 1, -- extra padding on left hand side 14 | -- indent guides 15 | with_markers = true, 16 | indent_marker = "│", 17 | last_indent_marker = "└", 18 | highlight = "NeoTreeIndentMarker", 19 | -- expander config, needed for nesting files 20 | with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders 21 | expander_collapsed = "", 22 | expander_expanded = "", 23 | expander_highlight = "NeoTreeExpander", 24 | }, 25 | icon = { 26 | folder_closed = "", 27 | folder_open = "", 28 | folder_empty = "ﰊ", 29 | default = "*", 30 | }, 31 | name = { 32 | trailing_slash = false, 33 | use_git_status_colors = true, 34 | }, 35 | git_status = { 36 | symbols = { 37 | -- Change type 38 | added = "✚", 39 | deleted = "✖", 40 | modified = "", 41 | renamed = "", 42 | -- Status type 43 | untracked = "", 44 | ignored = "", 45 | unstaged = "", 46 | staged = "", 47 | conflict = "", 48 | }, 49 | }, 50 | }, 51 | window = { 52 | position = "right", 53 | width = 30, 54 | mappings = { 55 | [""] = "toggle_node", 56 | ["<2-LeftMouse>"] = "open", 57 | [""] = "open", 58 | ["S"] = "open_split", 59 | ["s"] = "open_vsplit", 60 | ["C"] = "close_node", 61 | [""] = "navigate_up", 62 | ["."] = "set_root", 63 | ["H"] = "toggle_hidden", 64 | ["R"] = "refresh", 65 | ["/"] = "fuzzy_finder", 66 | ["f"] = "filter_on_submit", 67 | [""] = "clear_filter", 68 | ["a"] = "add", 69 | ["A"] = "add_directory", 70 | ["d"] = "delete", 71 | ["r"] = "rename", 72 | ["y"] = "copy_to_clipboard", 73 | ["x"] = "cut_to_clipboard", 74 | ["p"] = "paste_from_clipboard", 75 | ["c"] = "copy", -- takes text input for destination 76 | ["m"] = "move", -- takes text input for destination 77 | ["q"] = "close_window", 78 | }, 79 | }, 80 | filesystem = { 81 | filtered_items = { 82 | visible = false, -- when true, they will just be displayed differently than normal items 83 | hide_dotfiles = true, 84 | hide_gitignored = true, 85 | hide_by_name = { 86 | ".DS_Store", 87 | "thumbs.db", 88 | ".git", 89 | ".gitattributes", 90 | "node_module", 91 | "package-lock.json", 92 | }, 93 | never_show = { -- remains hidden even if visible is toggled to true 94 | --".DS_Store", 95 | --"thumbs.db" 96 | }, 97 | }, 98 | follow_current_file = true, -- This will find and focus the file in the active buffer every 99 | -- time the current file is changed while the tree is open. 100 | hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree 101 | -- in whatever position is specified in window.position 102 | -- "open_current", -- netrw disabled, opening a directory opens within the 103 | -- window like netrw would, regardless of window.position 104 | -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs 105 | use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes 106 | -- instead of relying on nvim autocmd events. 107 | }, 108 | buffers = { 109 | show_unloaded = true, 110 | window = { 111 | mappings = { 112 | ["bd"] = "buffer_delete", 113 | }, 114 | }, 115 | }, 116 | git_status = { 117 | window = { 118 | position = "float", 119 | mappings = { 120 | ["A"] = "git_add_all", 121 | ["gu"] = "git_unstage_file", 122 | ["ga"] = "git_add_file", 123 | ["gr"] = "git_revert_file", 124 | ["gc"] = "git_commit", 125 | ["gp"] = "git_push", 126 | ["gg"] = "git_commit_and_push", 127 | }, 128 | }, 129 | }, 130 | event_handlers = { 131 | { 132 | { 133 | event = "file_renamed", 134 | handler = function(args) 135 | -- fix references to file 136 | print(args.source, " was renamed to ", args.destination) 137 | end, 138 | }, 139 | { 140 | event = "file_moved", 141 | handler = function(args) 142 | -- fix references to file 143 | print(args.source, " was moved to ", args.destination) 144 | end, 145 | }, 146 | filesystem = { 147 | commands = { 148 | -- Override delete to use trash instead of rm 149 | delete = function(state) 150 | local path = state.tree:get_node().path 151 | vim.fn.system({ "trash", vim.fn.fnameescape(path) }) 152 | require("neo-tree.sources.manager").refresh(state.name) 153 | end, 154 | }, 155 | }, 156 | -- Custom Window Chooser for File Open commands 157 | event = "file_open_requested", 158 | handler = function(args) 159 | local state = args.state 160 | local path = args.path 161 | local open_cmd = args.open_cmd or "edit" 162 | 163 | -- use last window if possible 164 | local suitable_window_found = false 165 | local nt = require("neo-tree") 166 | if nt.config.open_files_in_last_window then 167 | local prior_window = nt.get_prior_window() 168 | if prior_window > 0 then 169 | local success = pcall(vim.api.nvim_set_current_win, prior_window) 170 | if success then 171 | suitable_window_found = true 172 | end 173 | end 174 | end 175 | 176 | -- find a suitable window to open the file in 177 | if not suitable_window_found then 178 | if state.window.position == "right" then 179 | vim.cmd("wincmd t") 180 | else 181 | vim.cmd("wincmd w") 182 | end 183 | end 184 | local attempts = 0 185 | while attempts < 4 and vim.bo.filetype == "neo-tree" do 186 | attempts = attempts + 1 187 | vim.cmd("wincmd w") 188 | end 189 | if vim.bo.filetype == "neo-tree" then 190 | -- Neo-tree must be the only window, restore it's status as a sidebar 191 | local winid = vim.api.nvim_get_current_win() 192 | local width = require("neo-tree.utils").get_value(state, "window.width", 40) 193 | vim.cmd("vsplit " .. path) 194 | vim.api.nvim_win_set_width(winid, width) 195 | else 196 | vim.cmd(open_cmd .. " " .. path) 197 | end 198 | 199 | -- If you don't return this, it will proceed to open the file using built-in logic. 200 | return { handled = true } 201 | end, 202 | }, 203 | }, 204 | }) 205 | vim.cmd([[nnoremap \ :Neotree reveal]]) 206 | -------------------------------------------------------------------------------- /lua/plugins/config/fidget.lua: -------------------------------------------------------------------------------- 1 | local status_ok, fidget = pcall(require, "fidget") 2 | if not status_ok then 3 | return 4 | end 5 | local relative = "editor" 6 | fidget.setup({ 7 | text = { 8 | spinner = "moon", 9 | -- spinner = { 10 | -- " ", 11 | -- " ", 12 | -- " ", 13 | -- " ", 14 | -- " ", 15 | -- " ", 16 | -- " ", 17 | -- " ", 18 | -- " ", 19 | -- " ", 20 | -- " ", 21 | -- " ", 22 | -- " ", 23 | -- " ", 24 | -- " ", 25 | -- " ", 26 | -- " ", 27 | -- " ", 28 | -- " ", 29 | -- " ", 30 | -- " ", 31 | -- " ", 32 | -- " ", 33 | -- " ", 34 | -- " ", 35 | -- " ", 36 | -- " ", 37 | -- " ", 38 | -- }, 39 | done = "", 40 | commenced = " ", 41 | completed = " ", 42 | }, 43 | align = { 44 | bottom = true, 45 | right = true, 46 | }, 47 | timer = { 48 | spinner_rate = 100, 49 | fidget_decay = 500, 50 | task_decay = 300, 51 | }, 52 | window = { 53 | relative = relative, 54 | blend = 0, 55 | zindex = nil, 56 | }, 57 | fmt = { 58 | leftpad = true, 59 | stack_upwards = true, 60 | max_width = 0, 61 | -- function to format fidget title 62 | fidget = function(fidget_name, spinner) 63 | return string.format("%s %s", spinner, fidget_name) 64 | end, 65 | -- function to format each task line 66 | task = function(task_name, message, percentage) 67 | return string.format( 68 | "%s%s [%s]", 69 | message, 70 | percentage and string.format(" (%s%%)", percentage) or "", 71 | task_name 72 | ) 73 | end, 74 | }, 75 | sources = { 76 | ["null-ls"] = { 77 | ignore = true, 78 | }, 79 | }, 80 | debug = { 81 | logging = false, 82 | strict = false, 83 | }, 84 | }) 85 | -------------------------------------------------------------------------------- /lua/plugins/config/gitsigns.lua: -------------------------------------------------------------------------------- 1 | local status_ok, gitsigns = pcall(require, "gitsigns") 2 | if not status_ok then 3 | return 4 | end 5 | 6 | -- gitsigns.setup({ 7 | -- signs = { 8 | -- add = { 9 | -- hl = "GitSignsAdd", 10 | -- text = "▍", 11 | -- numhl = "GitSignsAddNr", 12 | -- linehl = "GitSignsAddLn", 13 | -- }, 14 | -- change = { 15 | -- hl = "GitSignsChange", 16 | -- text = "▍", 17 | -- numhl = "GitSignsChangeNr", 18 | -- linehl = "GitSignsChangeLn", 19 | -- }, 20 | -- delete = { 21 | -- hl = "GitSignsDelete", 22 | -- text = "▸", 23 | -- numhl = "GitSignsDeleteNr", 24 | -- linehl = "GitSignsDeleteLn", 25 | -- }, 26 | -- topdelete = { 27 | -- hl = "GitSignsDelete", 28 | -- text = "▾", 29 | -- numhl = "GitSignsDeleteNr", 30 | -- linehl = "GitSignsDeleteLn", 31 | -- }, 32 | -- changedelete = { 33 | -- hl = "GitSignsChange", 34 | -- text = "▍", 35 | -- numhl = "GitSignsChangeNr", 36 | -- linehl = "GitSignsChangeLn", 37 | -- }, 38 | -- }, 39 | -- current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` 40 | -- current_line_blame_opts = { 41 | -- virt_text = true, 42 | -- virt_text_pos = "eol", 43 | -- delay = 1000, 44 | -- ignore_whitespace = false, 45 | -- }, 46 | -- -- current_line_blame_formatter = " : | | ", 47 | -- current_line_blame_formatter = " | | ", 48 | -- }) 49 | 50 | gitsigns.setup({ 51 | debug_mode = true, 52 | max_file_length = 1000000000, 53 | signs = { 54 | add = { show_count = false, text = "│" }, 55 | change = { show_count = false, text = "│" }, 56 | delete = { show_count = true, text = "ﬠ" }, 57 | topdelete = { show_count = true, text = "ﬢ" }, 58 | changedelete = { show_count = true, text = "┊" }, 59 | }, 60 | preview_config = { 61 | border = "rounded", 62 | }, 63 | current_line_blame = true, 64 | current_line_blame_formatter = " : | | ", 65 | current_line_blame_formatter_opts = { 66 | relative_time = true, 67 | }, 68 | current_line_blame_opts = { 69 | delay = 0, 70 | }, 71 | count_chars = { 72 | "⒈", 73 | "⒉", 74 | "⒊", 75 | "⒋", 76 | "⒌", 77 | "⒍", 78 | "⒎", 79 | "⒏", 80 | "⒐", 81 | "⒑", 82 | "⒒", 83 | "⒓", 84 | "⒔", 85 | "⒕", 86 | "⒖", 87 | "⒗", 88 | "⒘", 89 | "⒙", 90 | "⒚", 91 | "⒛", 92 | }, 93 | _refresh_staged_on_update = false, 94 | watch_gitdir = { interval = 1000, follow_files = true }, 95 | sign_priority = 6, 96 | status_formatter = nil, -- Use default 97 | update_debounce = 0, 98 | word_diff = false, 99 | diff_opts = { internal = true }, 100 | }) 101 | 102 | -- vim.cmd([[ 103 | -- highlight GitSignsAdd guifg=#9ece6a 104 | -- highlight GitSignsChange guifg=#d39b47 105 | -- highlight GitSignsDelete guifg=#d63131 106 | -- highlight GitSignsCurrentLineBlame guifg=#FFFFFF 107 | -- ]]) 108 | -------------------------------------------------------------------------------- /lua/plugins/config/indent.lua: -------------------------------------------------------------------------------- 1 | local status_ok, indent_blankline = pcall(require, "indent_blankline") 2 | if not status_ok then 3 | return 4 | end 5 | 6 | -- See :h indent_blankline.txt 7 | -- Included by default 8 | -- vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile", "help" } 9 | vim.g.indent_blankline_filetype_exclude = { 10 | "help", 11 | "dashboard", 12 | "packer", 13 | "NvimTree", 14 | "Trouble", 15 | "neo-tree", 16 | "norg", 17 | } 18 | vim.g.indentLine_enabled = 1 19 | vim.g.indent_blankline_char = "│" 20 | vim.g.indent_blankline_show_trailing_blankline_indent = false 21 | vim.g.indent_blankline_show_first_indent_level = false 22 | vim.g.indent_blankline_use_treesitter = true 23 | vim.g.indent_blankline_show_current_context = true 24 | vim.g.indent_blankline_context_patterns = { 25 | "class", 26 | "return", 27 | "function", 28 | "method", 29 | "^if", 30 | "^while", 31 | "jsx_element", 32 | "^for", 33 | "^object", 34 | "^table", 35 | "block", 36 | "arguments", 37 | "if_statement", 38 | "else_clause", 39 | "jsx_element", 40 | "jsx_self_closing_element", 41 | "try_statement", 42 | "catch_clause", 43 | "import_statement", 44 | "operation_type", 45 | } 46 | 47 | indent_blankline.setup({ 48 | show_current_context = true, 49 | show_current_context_start = false, 50 | }) 51 | -------------------------------------------------------------------------------- /lua/plugins/config/lightbulb.lua: -------------------------------------------------------------------------------- 1 | -- Showing defaults 2 | require("nvim-lightbulb").setup({ 3 | -- LSP client names to ignore 4 | -- Example: {"sumneko_lua", "null-ls"} 5 | ignore = {}, 6 | sign = { 7 | enabled = true, 8 | -- Priority of the gutter sign 9 | priority = 10, 10 | }, 11 | float = { 12 | enabled = false, 13 | -- Text to show in the popup float 14 | text = "💡", 15 | -- Available keys for window options: 16 | -- - height of floating window 17 | -- - width of floating window 18 | -- - wrap_at character to wrap at for computing height 19 | -- - max_width maximal width of floating window 20 | -- - max_height maximal height of floating window 21 | -- - pad_left number of columns to pad contents at left 22 | -- - pad_right number of columns to pad contents at right 23 | -- - pad_top number of lines to pad contents at top 24 | -- - pad_bottom number of lines to pad contents at bottom 25 | -- - offset_x x-axis offset of the floating window 26 | -- - offset_y y-axis offset of the floating window 27 | -- - anchor corner of float to place at the cursor (NW, NE, SW, SE) 28 | -- - winblend transparency of the window (0-100) 29 | win_opts = {}, 30 | }, 31 | virtual_text = { 32 | enabled = false, 33 | -- Text to show at virtual text 34 | text = "💡", 35 | -- highlight mode to use for virtual text (replace, combine, blend), see :help nvim_buf_set_extmark() for reference 36 | hl_mode = "replace", 37 | }, 38 | status_text = { 39 | enabled = false, 40 | -- Text to provide when code actions are available 41 | text = "💡", 42 | -- Text to provide when no actions are available 43 | text_unavailable = "", 44 | }, 45 | }) 46 | -------------------------------------------------------------------------------- /lua/plugins/config/lsp/capabilities.lua: -------------------------------------------------------------------------------- 1 | local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) 2 | 3 | local completion = capabilities.textDocument.completion.completionItem 4 | capabilities.textDocument.completion.completionItem.preselectSupport = true 5 | capabilities.textDocument.completion.completionItem.insertReplaceSupport = true 6 | capabilities.textDocument.completion.completionItem.labelDetailsSupport = true 7 | capabilities.textDocument.completion.completionItem.deprecatedSupport = true 8 | capabilities.textDocument.completion.completionItem.commitCharactersSupport = true 9 | capabilities.textDocument.completion.completionItem.tagSupport = { 10 | valueSet = { 1 }, 11 | } 12 | capabilities.textDocument.completion.completionItem.snippetSupport = true 13 | capabilities.textDocument.completion.completionItem.resolveSupport = { 14 | properties = { "documentation", "detail", "additionalTextEdits" }, 15 | } 16 | capabilities.textDocument.codeAction = { 17 | dynamicRegistration = false, 18 | codeActionLiteralSupport = { 19 | codeActionKind = { 20 | valueSet = { 21 | "", 22 | "quickfix", 23 | "refactor", 24 | "refactor.extract", 25 | "refactor.inline", 26 | "refactor.rewrite", 27 | "source", 28 | "source.organizeImports", 29 | }, 30 | }, 31 | }, 32 | } 33 | -------------------------------------------------------------------------------- /lua/plugins/config/lsp/config.lua: -------------------------------------------------------------------------------- 1 | -- Taken from max. Thanks max 2 | 3 | -- local border = { 4 | -- { "┏", "FloatBorder" }, 5 | -- { "━", "FloatBorder" }, 6 | -- { "┓", "FloatBorder" }, 7 | -- { "┃", "FloatBorder" }, 8 | -- { "┛", "FloatBorder" }, 9 | -- { "━", "FloatBorder" }, 10 | -- { "┗", "FloatBorder" }, 11 | -- { "┃", "FloatBorder" }, 12 | -- } 13 | 14 | -- local border = { 15 | -- { "╔", "FloatBorder" }, 16 | -- { "═", "FloatBorder" }, 17 | -- { "╗", "FloatBorder" }, 18 | -- { "║", "FloatBorder" }, 19 | -- { "╝", "FloatBorder" }, 20 | -- { "═", "FloatBorder" }, 21 | -- { "╚", "FloatBorder" }, 22 | -- { "║", "FloatBorder" }, 23 | -- } 24 | 25 | local border = { 26 | { "╭", "FloatBorder" }, 27 | { "─", "FloatBorder" }, 28 | { "╮", "FloatBorder" }, 29 | { "│", "FloatBorder" }, 30 | { "╯", "FloatBorder" }, 31 | { "─", "FloatBorder" }, 32 | { "╰", "FloatBorder" }, 33 | { "│", "FloatBorder" }, 34 | } 35 | 36 | -- Code from max 37 | local codes = { 38 | no_matching_function = { 39 | message = " Can't find a matching function", 40 | "redundant-parameter", 41 | "ovl_no_viable_function_in_call", 42 | }, 43 | empty_block = { 44 | message = " That shouldn't be empty here", 45 | "empty-block", 46 | }, 47 | missing_symbol = { 48 | message = " Here should be a symbol", 49 | "miss-symbol", 50 | }, 51 | expected_semi_colon = { 52 | message = " Please put the `;` or `,`", 53 | "expected_semi_declaration", 54 | "miss-sep-in-table", 55 | "invalid_token_after_toplevel_declarator", 56 | }, 57 | redefinition = { 58 | message = " That variable was defined before", 59 | "redefinition", 60 | "redefined-local", 61 | }, 62 | no_matching_variable = { 63 | message = " Can't find that variable", 64 | "undefined-global", 65 | "reportUndefinedVariable", 66 | }, 67 | trailing_whitespace = { 68 | message = " Whitespaces are useless", 69 | "trailing-whitespace", 70 | "trailing-space", 71 | }, 72 | unused_variable = { 73 | message = " Don't define variables you don't use", 74 | "unused-local", 75 | }, 76 | unused_function = { 77 | message = " Don't define functions you don't use", 78 | "unused-function", 79 | }, 80 | useless_symbols = { 81 | message = " Remove that useless symbols", 82 | "unknown-symbol", 83 | }, 84 | wrong_type = { 85 | message = " Try to use the correct types", 86 | "init_conversion_failed", 87 | }, 88 | undeclared_variable = { 89 | message = " Have you delcared that variable somewhere?", 90 | "undeclared_var_use", 91 | }, 92 | lowercase_global = { 93 | message = " Should that be a global? (if so make it uppercase)", 94 | "lowercase-global", 95 | }, 96 | } 97 | 98 | local signs = { 99 | { name = "DiagnosticSignError", text = "" }, 100 | { name = "DiagnosticSignWarn", text = "" }, 101 | { name = "DiagnosticSignInfo", text = "" }, 102 | { name = "DiagnosticSignHint", text = "" }, 103 | } 104 | for _, sign in ipairs(signs) do 105 | vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) 106 | end 107 | 108 | local config = { 109 | signs = true, 110 | underline = true, 111 | severity_sort = true, 112 | update_in_insert = true, 113 | virtual_text = false, 114 | 115 | float = { 116 | focusable = false, 117 | scope = "cursor", 118 | source = true, 119 | border = border, 120 | header = { "Mistakes you made:", "DiagnosticHeader" }, 121 | prefix = function(diagnostic, i, total) 122 | local icon, highlight 123 | if diagnostic.severity == 1 then 124 | icon = "" 125 | highlight = "DiagnosticError" 126 | elseif diagnostic.severity == 2 then 127 | icon = "" 128 | highlight = "DiagnosticWarn" 129 | elseif diagnostic.severity == 3 then 130 | icon = "" 131 | highlight = "DiagnosticInfo" 132 | elseif diagnostic.severity == 4 then 133 | icon = "" 134 | highlight = "DiagnosticHint" 135 | end 136 | return i .. "/" .. total .. " " .. icon .. " ", highlight 137 | end, 138 | -- Code from max 139 | format = function(diagnostic) 140 | -- dump(diagnostic) 141 | if diagnostic.user_data == nil then 142 | return diagnostic.message 143 | elseif vim.tbl_isempty(diagnostic.user_data) then 144 | return diagnostic.message 145 | end 146 | local code = diagnostic.user_data.lsp.code 147 | for _, table in pairs(codes) do 148 | if vim.tbl_contains(table, code) then 149 | return table.message 150 | end 151 | end 152 | return diagnostic.message 153 | end, 154 | 155 | -- Code from TJ 156 | -- format = function(d) 157 | -- local t = vim.deepcopy(d) 158 | -- local code = d.code or d.user_data.lsp.code 159 | -- if code then 160 | -- t.message = string.format("%s -> (%s)", t.message, code):gsub("1. ", "") 161 | -- end 162 | -- return t.message 163 | -- end, 164 | 165 | -- Code from santigo-zero 166 | -- format = function(diagnostic) 167 | -- return string.format( 168 | -- "%s (%s) [%s]", 169 | -- diagnostic.message, 170 | -- diagnostic.source, 171 | -- diagnostic.code or diagnostic.user_data.lsp.code 172 | -- ) 173 | -- end, 174 | }, 175 | } 176 | 177 | vim.diagnostic.config(config) 178 | 179 | vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }) 180 | vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border }) 181 | -------------------------------------------------------------------------------- /lua/plugins/config/lsp/handlers.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | -- Taken from max. Thanks max 4 | 5 | -- local border = { 6 | -- { "┏", "FloatBorder" }, 7 | -- { "━", "FloatBorder" }, 8 | -- { "┓", "FloatBorder" }, 9 | -- { "┃", "FloatBorder" }, 10 | -- { "┛", "FloatBorder" }, 11 | -- { "━", "FloatBorder" }, 12 | -- { "┗", "FloatBorder" }, 13 | -- { "┃", "FloatBorder" }, 14 | -- } 15 | 16 | -- local border = { 17 | -- { "╔", "FloatBorder" }, 18 | -- { "═", "FloatBorder" }, 19 | -- { "╗", "FloatBorder" }, 20 | -- { "║", "FloatBorder" }, 21 | -- { "╝", "FloatBorder" }, 22 | -- { "═", "FloatBorder" }, 23 | -- { "╚", "FloatBorder" }, 24 | -- { "║", "FloatBorder" }, 25 | -- } 26 | 27 | local border = { 28 | { "╭", "FloatBorder" }, 29 | { "─", "FloatBorder" }, 30 | { "╮", "FloatBorder" }, 31 | { "│", "FloatBorder" }, 32 | { "╯", "FloatBorder" }, 33 | { "─", "FloatBorder" }, 34 | { "╰", "FloatBorder" }, 35 | { "│", "FloatBorder" }, 36 | } 37 | 38 | -- Code from max 39 | local codes = { 40 | no_matching_function = { 41 | message = " Can't find a matching function", 42 | "redundant-parameter", 43 | "ovl_no_viable_function_in_call", 44 | }, 45 | empty_block = { 46 | message = " That shouldn't be empty here", 47 | "empty-block", 48 | }, 49 | missing_symbol = { 50 | message = " Here should be a symbol", 51 | "miss-symbol", 52 | }, 53 | expected_semi_colon = { 54 | message = " Please put the `;` or `,`", 55 | "expected_semi_declaration", 56 | "miss-sep-in-table", 57 | "invalid_token_after_toplevel_declarator", 58 | }, 59 | redefinition = { 60 | message = " That variable was defined before", 61 | "redefinition", 62 | "redefined-local", 63 | }, 64 | no_matching_variable = { 65 | message = " Can't find that variable", 66 | "undefined-global", 67 | "reportUndefinedVariable", 68 | }, 69 | trailing_whitespace = { 70 | message = " Whitespaces are useless", 71 | "trailing-whitespace", 72 | "trailing-space", 73 | }, 74 | unused_variable = { 75 | message = " Don't define variables you don't use", 76 | "unused-local", 77 | }, 78 | unused_function = { 79 | message = " Don't define functions you don't use", 80 | "unused-function", 81 | }, 82 | useless_symbols = { 83 | message = " Remove that useless symbols", 84 | "unknown-symbol", 85 | }, 86 | wrong_type = { 87 | message = " Try to use the correct types", 88 | "init_conversion_failed", 89 | }, 90 | undeclared_variable = { 91 | message = " Have you delcared that variable somewhere?", 92 | "undeclared_var_use", 93 | }, 94 | lowercase_global = { 95 | message = " Should that be a global? (if so make it uppercase)", 96 | "lowercase-global", 97 | }, 98 | } 99 | 100 | -- TODO: backfill this to template 101 | M.setup = function() 102 | local signs = { 103 | { name = "DiagnosticSignError", text = "" }, 104 | { name = "DiagnosticSignWarn", text = "" }, 105 | { name = "DiagnosticSignInfo", text = "" }, 106 | { name = "DiagnosticSignHint", text = "" }, 107 | } 108 | for _, sign in ipairs(signs) do 109 | vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) 110 | end 111 | 112 | local config = { 113 | signs = true, 114 | underline = true, 115 | severity_sort = true, 116 | update_in_insert = true, 117 | -- virtual_text = { 118 | -- prefix = "ﱢ", 119 | -- }, 120 | virtual_text = false, 121 | 122 | float = { 123 | focusable = false, 124 | scope = "cursor", 125 | source = true, 126 | border = border, 127 | header = { "Mistakes you made:", "DiagnosticHeader" }, 128 | prefix = function(diagnostic, i, total) 129 | local icon, highlight 130 | if diagnostic.severity == 1 then 131 | icon = "" 132 | highlight = "DiagnosticError" 133 | elseif diagnostic.severity == 2 then 134 | icon = "" 135 | highlight = "DiagnosticWarn" 136 | elseif diagnostic.severity == 3 then 137 | icon = "" 138 | highlight = "DiagnosticInfo" 139 | elseif diagnostic.severity == 4 then 140 | icon = "" 141 | highlight = "DiagnosticHint" 142 | end 143 | return i .. "/" .. total .. " " .. icon .. " ", highlight 144 | end, 145 | -- Code from max 146 | format = function(diagnostic) 147 | -- dump(diagnostic) 148 | if diagnostic.user_data == nil then 149 | return diagnostic.message 150 | elseif vim.tbl_isempty(diagnostic.user_data) then 151 | return diagnostic.message 152 | end 153 | local code = diagnostic.user_data.lsp.code 154 | for _, table in pairs(codes) do 155 | if vim.tbl_contains(table, code) then 156 | return table.message 157 | end 158 | end 159 | return diagnostic.message 160 | end, 161 | 162 | -- Code from TJ 163 | -- format = function(d) 164 | -- local t = vim.deepcopy(d) 165 | -- local code = d.code or d.user_data.lsp.code 166 | -- if code then 167 | -- t.message = string.format("%s -> (%s)", t.message, code):gsub("1. ", "") 168 | -- end 169 | -- return t.message 170 | -- end, 171 | 172 | -- Code from santigo-zero 173 | -- format = function(diagnostic) 174 | -- return string.format( 175 | -- "%s (%s) [%s]", 176 | -- diagnostic.message, 177 | -- diagnostic.source, 178 | -- diagnostic.code or diagnostic.user_data.lsp.code 179 | -- ) 180 | -- end, 181 | }, 182 | } 183 | 184 | vim.diagnostic.config(config) 185 | 186 | vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { 187 | border = border, 188 | }) 189 | 190 | vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { 191 | border = border, 192 | }) 193 | 194 | -- Suppress error messages from lang servers 195 | vim.notify = function(msg, log_level) 196 | if msg:match("exit code") then 197 | return 198 | end 199 | if log_level == vim.log.levels.ERROR then 200 | vim.api.nvim_err_writeln(msg) 201 | else 202 | vim.api.nvim_echo({ { msg } }, true, {}) 203 | end 204 | end 205 | end 206 | 207 | local function lsp_highlight_document(client, bufnr) 208 | if client.resolved_capabilities.document_highlight then 209 | vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true }) 210 | vim.api.nvim_create_autocmd("CursorHold", { 211 | callback = function() 212 | vim.lsp.buf.document_highlight() 213 | end, 214 | buffer = bufnr, 215 | }) 216 | vim.api.nvim_create_autocmd("CursorMoved", { 217 | callback = function() 218 | vim.lsp.buf.clear_references() 219 | end, 220 | buffer = bufnr, 221 | }) 222 | end 223 | 224 | vim.api.nvim_set_hl(0, "LspReferenceText", { nocombine = true, reverse = false, underline = true }) 225 | vim.api.nvim_set_hl(0, "LspReferenceRead", { nocombine = true, reverse = false, underline = true }) 226 | vim.api.nvim_set_hl(0, "LspReferenceWrite", { nocombine = true, reverse = false, underline = true }) 227 | end 228 | 229 | M.on_attach = function(client, bufnr) 230 | local servers = { "tsserver", "jsonls", "html", "sumneko_lua", "rust_analyzer" } 231 | -- if servers[client.name] then 232 | -- client.resolved_capabilities.document_formatting = false 233 | -- client.resolved_capabilities.document_range_formatting = false 234 | -- end 235 | 236 | -- if client.name == "clangd" then 237 | -- client.offset_encoding = "utf-16" 238 | -- end 239 | for _, lsp in ipairs(servers) do 240 | client.resolved_capabilities.document_formatting = false 241 | client.resolved_capabilities.document_range_formatting = false 242 | end 243 | 244 | -- if client.name == "tsserver" then 245 | -- client.resolved_capabilities.document_formatting = false 246 | -- client.resolved_capabilities.document_range_formatting = false 247 | -- end 248 | -- if client.name == "jsonls" then 249 | -- client.resolved_capabilities.document_formatting = false 250 | -- client.resolved_capabilities.document_range_formatting = false 251 | -- end 252 | -- if client.name == "html" then 253 | -- client.resolved_capabilities.document_formatting = false 254 | -- client.resolved_capabilities.document_range_formatting = false 255 | -- end 256 | -- if client.name == "sumneko_lua" then 257 | -- client.resolved_capabilities.document_formatting = false 258 | -- client.resolved_capabilities.document_range_formatting = false 259 | -- end 260 | -- if client.name == "rust_analyzer" then 261 | -- client.resolved_capabilities.document_formatting = false 262 | -- client.resolved_capabilities.document_range_formatting = false 263 | -- end 264 | if client.name == "clangd" then 265 | client.resolved_capabilities.document_formatting = false 266 | client.resolved_capabilities.document_range_formatting = false 267 | client.offset_encoding = "utf-16" 268 | end 269 | lsp_highlight_document(client, bufnr) 270 | end 271 | 272 | local capabilities = vim.lsp.protocol.make_client_capabilities() 273 | -- capabilities.offsetEncoding = { "utf-16" } or { "utf-8" } 274 | 275 | local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") 276 | if not status_ok then 277 | return 278 | end 279 | 280 | M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities) 281 | 282 | local completion = capabilities.textDocument.completion.completionItem 283 | capabilities.textDocument.completion.completionItem.preselectSupport = true 284 | capabilities.textDocument.completion.completionItem.insertReplaceSupport = true 285 | capabilities.textDocument.completion.completionItem.labelDetailsSupport = true 286 | capabilities.textDocument.completion.completionItem.deprecatedSupport = true 287 | capabilities.textDocument.completion.completionItem.commitCharactersSupport = true 288 | capabilities.textDocument.completion.completionItem.tagSupport = { 289 | valueSet = { 1 }, 290 | } 291 | capabilities.textDocument.completion.completionItem.snippetSupport = true 292 | capabilities.textDocument.completion.completionItem.resolveSupport = { 293 | properties = { "documentation", "detail", "additionalTextEdits" }, 294 | } 295 | capabilities.textDocument.codeAction = { 296 | dynamicRegistration = false, 297 | codeActionLiteralSupport = { 298 | codeActionKind = { 299 | valueSet = { 300 | "", 301 | "quickfix", 302 | "refactor", 303 | "refactor.extract", 304 | "refactor.inline", 305 | "refactor.rewrite", 306 | "source", 307 | "source.organizeImports", 308 | }, 309 | }, 310 | }, 311 | } 312 | return M 313 | -------------------------------------------------------------------------------- /lua/plugins/config/lsp/init.lua: -------------------------------------------------------------------------------- 1 | local status_ok, lspconfig = pcall(require, "lspconfig") 2 | if not status_ok then 3 | return 4 | end 5 | 6 | -- WARNING: DON'T REMOVE THIS 7 | require("plugins.config.lsp.installer") 8 | require("plugins.config.lsp.capabilities") 9 | require("plugins.config.lsp.config") 10 | 11 | local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) 12 | 13 | local completion = capabilities.textDocument.completion.completionItem 14 | capabilities.textDocument.completion.completionItem.preselectSupport = true 15 | capabilities.textDocument.completion.completionItem.insertReplaceSupport = true 16 | capabilities.textDocument.completion.completionItem.labelDetailsSupport = true 17 | capabilities.textDocument.completion.completionItem.deprecatedSupport = true 18 | capabilities.textDocument.completion.completionItem.commitCharactersSupport = true 19 | capabilities.textDocument.completion.completionItem.tagSupport = { 20 | valueSet = { 1 }, 21 | } 22 | capabilities.textDocument.completion.completionItem.snippetSupport = true 23 | capabilities.textDocument.completion.completionItem.resolveSupport = { 24 | properties = { "documentation", "detail", "additionalTextEdits" }, 25 | } 26 | capabilities.textDocument.codeAction = { 27 | dynamicRegistration = false, 28 | codeActionLiteralSupport = { 29 | codeActionKind = { 30 | valueSet = { 31 | "", 32 | "quickfix", 33 | "refactor", 34 | "refactor.extract", 35 | "refactor.inline", 36 | "refactor.rewrite", 37 | "source", 38 | "source.organizeImports", 39 | }, 40 | }, 41 | }, 42 | } 43 | 44 | local function on_attach(client, bufnr) 45 | require("plugins.config.lsp.on_attach").setup(client, bufnr) 46 | end 47 | 48 | local function on_attach_utf16(client, bufnr) 49 | require("plugins.config.lsp.on_attach").utf16(client, bufnr) 50 | end 51 | 52 | local border = { 53 | { "╭", "FloatBorder" }, 54 | { "─", "FloatBorder" }, 55 | { "╮", "FloatBorder" }, 56 | { "│", "FloatBorder" }, 57 | { "╯", "FloatBorder" }, 58 | { "─", "FloatBorder" }, 59 | { "╰", "FloatBorder" }, 60 | { "│", "FloatBorder" }, 61 | } 62 | 63 | -- sumneko_lua 64 | local sumneko = { 65 | on_attach = on_attach, 66 | capabilities = capabilities, 67 | settings = { 68 | Lua = { 69 | diagnostics = { 70 | globals = { "vim" }, 71 | }, 72 | workspace = { 73 | library = { 74 | [vim.fn.expand("$VIMRUNTIME/lua")] = true, 75 | [vim.fn.stdpath("config") .. "/lua"] = true, 76 | }, 77 | }, 78 | }, 79 | }, 80 | } 81 | local use_lua_dev = false 82 | if use_lua_dev then 83 | local luadev = require("lua-dev").setup({ 84 | library = { 85 | vimruntime = true, 86 | types = true, 87 | plugins = { "nvim-treesitter", "plenary.nvim", "telescope.nvim" }, 88 | }, 89 | lspconfig = sumneko, 90 | }) 91 | 92 | lspconfig.sumneko_lua.setup(luadev) 93 | else 94 | lspconfig.sumneko_lua.setup(sumneko) 95 | end 96 | 97 | -- JSON 98 | lspconfig.jsonls.setup({ 99 | on_attach = on_attach, 100 | }) 101 | 102 | -- Clangd / C++ 103 | local clangd_defaults = require("lspconfig.server_configurations.clangd") 104 | local clangd_configs = vim.tbl_deep_extend("force", clangd_defaults["default_config"], { 105 | on_attach = on_attach_utf16, 106 | capabilities = capabilities, 107 | }) 108 | lspconfig.clangd.setup({ 109 | on_attach = on_attach, 110 | capabilities = capabilities, 111 | }) 112 | --[[ require("clangd_extensions").setup({ 113 | server = clangd_configs, 114 | extensions = { 115 | -- defaults: 116 | -- Automatically set inlay hints (type hints) 117 | autoSetHints = true, 118 | -- Whether to show hover actions inside the hover window 119 | -- This overrides the default hover handler 120 | hover_with_actions = true, 121 | -- These apply to the default ClangdSetInlayHints command 122 | inlay_hints = { 123 | -- Only show inlay hints for the current line 124 | only_current_line = false, 125 | -- Event which triggers a refersh of the inlay hints. 126 | -- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but 127 | -- not that this may cause higher CPU usage. 128 | -- This option is only respected when only_current_line and 129 | -- autoSetHints both are true. 130 | only_current_line_autocmd = "CursorHold", 131 | -- whether to show parameter hints with the inlay hints or not 132 | show_parameter_hints = true, 133 | -- prefix for parameter hints 134 | parameter_hints_prefix = "<- ", 135 | -- prefix for all the other hints (type, chaining) 136 | other_hints_prefix = "=> ", 137 | -- whether to align to the length of the longest line in the file 138 | max_len_align = false, 139 | -- padding from the left if max_len_align is true 140 | max_len_align_padding = 1, 141 | -- whether to align to the extreme right or not 142 | right_align = false, 143 | -- padding from the right if right_align is true 144 | right_align_padding = 7, 145 | -- The color of the hints 146 | highlight = "Comment", 147 | -- The highlight group priority for extmark 148 | priority = 100, 149 | }, 150 | ast = { 151 | role_icons = { 152 | type = "", 153 | declaration = "", 154 | expression = "", 155 | specifier = "", 156 | statement = "", 157 | ["template argument"] = "", 158 | }, 159 | kind_icons = { 160 | Compound = "", 161 | Recovery = "", 162 | TranslationUnit = "", 163 | PackExpansion = "", 164 | TemplateTypeParm = "", 165 | TemplateTemplateParm = "", 166 | TemplateParamObject = "", 167 | }, 168 | highlights = { 169 | detail = "Comment", 170 | }, 171 | memory_usage = { 172 | border = border, 173 | }, 174 | symbol_info = { 175 | border = border, 176 | }, 177 | }, 178 | }, 179 | }) ]] 180 | 181 | -- Rust 182 | lspconfig.rust_analyzer.setup({ 183 | on_attach = on_attach, 184 | capabilities = capabilities, 185 | }) 186 | -------------------------------------------------------------------------------- /lua/plugins/config/lsp/installer.lua: -------------------------------------------------------------------------------- 1 | local servers = { 2 | "emmet_ls", 3 | "html", 4 | "tsserver", 5 | "jsonls", 6 | "cssls", 7 | "clangd", 8 | "rust_analyzer", 9 | "sumneko_lua", 10 | "yamils", 11 | "ltex", 12 | } 13 | 14 | -- Setting up installer 15 | require("nvim-lsp-installer").setup({ 16 | ensure_installed = servers, 17 | }) 18 | -------------------------------------------------------------------------------- /lua/plugins/config/lsp/on_attach.lua: -------------------------------------------------------------------------------- 1 | local on_attach = {} 2 | 3 | local function lsp_highlight_document(client, bufnr) 4 | if client.server_capabilities.documentHighlightProvider then 5 | vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true }) 6 | vim.api.nvim_create_autocmd("CursorHold", { 7 | callback = function() 8 | vim.lsp.buf.document_highlight() 9 | end, 10 | buffer = bufnr, 11 | }) 12 | vim.api.nvim_create_autocmd("CursorMoved", { 13 | callback = function() 14 | vim.lsp.buf.clear_references() 15 | end, 16 | buffer = bufnr, 17 | }) 18 | end 19 | 20 | vim.api.nvim_set_hl(0, "LspReferenceText", { nocombine = true, reverse = false, underline = true }) 21 | vim.api.nvim_set_hl(0, "LspReferenceRead", { nocombine = true, reverse = false, underline = true }) 22 | vim.api.nvim_set_hl(0, "LspReferenceWrite", { nocombine = true, reverse = false, underline = true }) 23 | end 24 | 25 | function on_attach.setup(client, bufnr) 26 | local map = vim.keymap.set 27 | map("n", "lr", vim.lsp.buf.rename) 28 | map("n", "ld", vim.lsp.buf.definition) 29 | map("n", "lt", vim.lsp.buf.type_definition) 30 | map("n", "lh", vim.lsp.buf.signature_help) 31 | map("n", "ss", vim.lsp.buf.formatting_sync) 32 | map("n", "qf", vim.diagnostic.setqflist) 33 | map("n", "", vim.lsp.buf.references) 34 | -- map("n", "", vim.diagnostic.goto_prev) 35 | -- map("n", "", vim.diagnostic.goto_next) 36 | map("n", "", function() 37 | vim.diagnostic.goto_prev({ border = "rounded" }) 38 | end) 39 | map("n", "", function() 40 | vim.diagnostic.goto_next({ border = "rounded" }) 41 | end) 42 | 43 | client.server_capabilities.document_formatting = false 44 | client.server_capabilities.document_range_formatting = false 45 | lsp_highlight_document(client, bufnr) 46 | end 47 | 48 | function on_attach.utf16(client, bufnr) 49 | local map = vim.keymap.set 50 | map("n", "lr", vim.lsp.buf.rename) 51 | map("n", "ld", vim.lsp.buf.definition) 52 | map("n", "lt", vim.lsp.buf.type_definition) 53 | map("n", "lh", vim.lsp.buf.signature_help) 54 | map("n", "ss", vim.lsp.buf.formatting_sync) 55 | map("n", "qf", vim.diagnostic.setqflist) 56 | map("n", "", vim.lsp.buf.references) 57 | -- map("n", "", vim.diagnostic.goto_prev) 58 | -- map("n", "", vim.diagnostic.goto_next) 59 | map("n", "", function() 60 | vim.diagnostic.goto_prev({ border = "rounded" }) 61 | end) 62 | map("n", "", function() 63 | vim.diagnostic.goto_next({ border = "rounded" }) 64 | end) 65 | 66 | client.server_capabilities.document_formatting = false 67 | client.server_capabilities.document_range_formatting = false 68 | client.offset_encoding = "utf-16" 69 | lsp_highlight_document(client, bufnr) 70 | end 71 | 72 | return on_attach 73 | -------------------------------------------------------------------------------- /lua/plugins/config/lsp/settings/clang.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /lua/plugins/config/lsp/settings/jsonls.lua: -------------------------------------------------------------------------------- 1 | -- Find more schemas here: https://www.schemastore.org/json 2 | local schemas = { 3 | { 4 | description = "TypeScript compiler configuration file", 5 | fileMatch = { 6 | "tsconfig.json", 7 | "tsconfig.*.json", 8 | }, 9 | url = "https://json.schemastore.org/tsconfig.json", 10 | }, 11 | { 12 | description = "Lerna config", 13 | fileMatch = { "lerna.json" }, 14 | url = "https://json.schemastore.org/lerna.json", 15 | }, 16 | { 17 | description = "Babel configuration", 18 | fileMatch = { 19 | ".babelrc.json", 20 | ".babelrc", 21 | "babel.config.json", 22 | }, 23 | url = "https://json.schemastore.org/babelrc.json", 24 | }, 25 | { 26 | description = "ESLint config", 27 | fileMatch = { 28 | ".eslintrc.json", 29 | ".eslintrc", 30 | }, 31 | url = "https://json.schemastore.org/eslintrc.json", 32 | }, 33 | { 34 | description = "Bucklescript config", 35 | fileMatch = { "bsconfig.json" }, 36 | url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json", 37 | }, 38 | { 39 | description = "Prettier config", 40 | fileMatch = { 41 | ".prettierrc", 42 | ".prettierrc.json", 43 | "prettier.config.json", 44 | }, 45 | url = "https://json.schemastore.org/prettierrc", 46 | }, 47 | { 48 | description = "Vercel Now config", 49 | fileMatch = { "now.json" }, 50 | url = "https://json.schemastore.org/now", 51 | }, 52 | { 53 | description = "Stylelint config", 54 | fileMatch = { 55 | ".stylelintrc", 56 | ".stylelintrc.json", 57 | "stylelint.config.json", 58 | }, 59 | url = "https://json.schemastore.org/stylelintrc", 60 | }, 61 | { 62 | description = "A JSON schema for the ASP.NET LaunchSettings.json files", 63 | fileMatch = { "launchsettings.json" }, 64 | url = "https://json.schemastore.org/launchsettings.json", 65 | }, 66 | { 67 | description = "Schema for CMake Presets", 68 | fileMatch = { 69 | "CMakePresets.json", 70 | "CMakeUserPresets.json", 71 | }, 72 | url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json", 73 | }, 74 | { 75 | description = "Configuration file as an alternative for configuring your repository in the settings page.", 76 | fileMatch = { 77 | ".codeclimate.json", 78 | }, 79 | url = "https://json.schemastore.org/codeclimate.json", 80 | }, 81 | { 82 | description = "LLVM compilation database", 83 | fileMatch = { 84 | "compile_commands.json", 85 | }, 86 | url = "https://json.schemastore.org/compile-commands.json", 87 | }, 88 | { 89 | description = "Config file for Command Task Runner", 90 | fileMatch = { 91 | "commands.json", 92 | }, 93 | url = "https://json.schemastore.org/commands.json", 94 | }, 95 | { 96 | description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.", 97 | fileMatch = { 98 | "*.cf.json", 99 | "cloudformation.json", 100 | }, 101 | url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json", 102 | }, 103 | { 104 | description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.", 105 | fileMatch = { 106 | "serverless.template", 107 | "*.sam.json", 108 | "sam.json", 109 | }, 110 | url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json", 111 | }, 112 | { 113 | description = "Json schema for properties json file for a GitHub Workflow template", 114 | fileMatch = { 115 | ".github/workflow-templates/**.properties.json", 116 | }, 117 | url = "https://json.schemastore.org/github-workflow-template-properties.json", 118 | }, 119 | { 120 | description = "golangci-lint configuration file", 121 | fileMatch = { 122 | ".golangci.toml", 123 | ".golangci.json", 124 | }, 125 | url = "https://json.schemastore.org/golangci-lint.json", 126 | }, 127 | { 128 | description = "JSON schema for the JSON Feed format", 129 | fileMatch = { 130 | "feed.json", 131 | }, 132 | url = "https://json.schemastore.org/feed.json", 133 | versions = { 134 | ["1"] = "https://json.schemastore.org/feed-1.json", 135 | ["1.1"] = "https://json.schemastore.org/feed.json", 136 | }, 137 | }, 138 | { 139 | description = "Packer template JSON configuration", 140 | fileMatch = { 141 | "packer.json", 142 | }, 143 | url = "https://json.schemastore.org/packer.json", 144 | }, 145 | { 146 | description = "NPM configuration file", 147 | fileMatch = { 148 | "package.json", 149 | }, 150 | url = "https://json.schemastore.org/package.json", 151 | }, 152 | { 153 | description = "JSON schema for Visual Studio component configuration files", 154 | fileMatch = { 155 | "*.vsconfig", 156 | }, 157 | url = "https://json.schemastore.org/vsconfig.json", 158 | }, 159 | { 160 | description = "Resume json", 161 | fileMatch = { "resume.json" }, 162 | url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json", 163 | }, 164 | } 165 | 166 | local opts = { 167 | settings = { 168 | json = { 169 | schemas = schemas, 170 | }, 171 | }, 172 | setup = { 173 | commands = { 174 | Format = { 175 | function() 176 | vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line("$"), 0 }) 177 | end, 178 | }, 179 | }, 180 | }, 181 | } 182 | 183 | return opts 184 | -------------------------------------------------------------------------------- /lua/plugins/config/lsp/settings/sumneko_lua.lua: -------------------------------------------------------------------------------- 1 | return { 2 | settings = { 3 | Lua = { 4 | diagnostics = { 5 | globals = { "vim" }, 6 | }, 7 | workspace = { 8 | library = { 9 | [vim.fn.expand("$VIMRUNTIME/lua")] = true, 10 | [vim.fn.stdpath("config") .. "/lua"] = true, 11 | }, 12 | }, 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/plugins/config/lualine.lua: -------------------------------------------------------------------------------- 1 | -- Simple yet amazing config for statusline 2 | -- Author: Bryant 3 | -- Credit: glepnir & shadmansaleh 4 | 5 | local lualine = require("lualine") 6 | local colors = { 7 | bg = "#21222d", 8 | fg = "#f8f8ff", 9 | red = "#dd3e46", 10 | bred = "#fc3235", 11 | blue = "#4198c6", 12 | yellow = "#dda654", 13 | byellow = "#e8f402", 14 | green = "#41c643", 15 | cyber_green = "#32b53d", 16 | orange = "#c67f41", 17 | cyan = "#41c684", 18 | purple = "#cd8fe0", 19 | } 20 | 21 | -- Centering files 22 | local function center() 23 | return "%=" 24 | end 25 | 26 | -- Filename with icons 27 | local my_filename = require("lualine.components.filename"):extend() 28 | my_filename.apply_icon = require("lualine.components.filetype").apply_icon 29 | 30 | -- clock 31 | local clock = 'os.date("%I:%M:%S", os.time())' 32 | if _G.Statusline_timer == nil then 33 | _G.Statusline_timer = vim.loop.new_timer() 34 | else 35 | _G.Statusline_timer:stop() 36 | end 37 | _G.Statusline_timer:start( 38 | 0, 39 | 1000, 40 | vim.schedule_wrap(function() 41 | vim.api.nvim_command("redrawstatus") 42 | end) 43 | ) 44 | local date = os.date("%d-%m-%Y  %H:%M:%S") 45 | 46 | -- Config 47 | local config = { 48 | options = { 49 | component_separators = "", 50 | section_separators = "", 51 | theme = { 52 | normal = { c = { fg = one_bg, bg = one_bg } }, 53 | inactive = { c = { fg = one_bg, bg = one_bg } }, 54 | }, 55 | }, 56 | sections = { 57 | lualine_a = {}, 58 | lualine_b = {}, 59 | lualine_c = {}, 60 | lualine_x = {}, 61 | lualine_y = {}, 62 | lualine_z = {}, 63 | }, 64 | inactive_sections = { 65 | lualine_a = {}, 66 | lualine_b = {}, 67 | lualine_c = { { my_filename, colored = true } }, 68 | lualine_x = {}, 69 | lualine_y = {}, 70 | lualine_z = {}, 71 | }, 72 | extensions = { "nvim-tree", "toggleterm" }, 73 | } 74 | 75 | local function left(component) 76 | table.insert(config.sections.lualine_c, component) 77 | end 78 | 79 | local function right(component) 80 | table.insert(config.sections.lualine_x, component) 81 | end 82 | 83 | left({ 84 | "branch", 85 | icon = "", 86 | fmt = string.upper, 87 | color = { fg = colors.yellow }, 88 | }) 89 | 90 | left({ 91 | center, 92 | }) 93 | 94 | left({ 95 | my_filename, 96 | colored = true, 97 | }) 98 | 99 | right({ 100 | "diagnostics", 101 | sources = { "nvim_diagnostic" }, 102 | sections = { "error", "warn", "info" }, 103 | symbols = { error = " ", warn = " ", info = " " }, 104 | diagnostics_color = { 105 | color_error = { fg = colors.bred }, 106 | color_warn = { fg = colors.byellow }, 107 | color_info = { fg = colors.bgreen }, 108 | }, 109 | always_visible = true, 110 | update_in_insert = true, 111 | padding = { right = 2 }, 112 | }) 113 | 114 | right({ 115 | clock, 116 | icon = "", 117 | color = { fg = colors.cyber_green }, 118 | padding = { right = 1 }, 119 | }) 120 | right({ 121 | function() 122 | local current_line = vim.fn.line(".") 123 | local total_lines = vim.fn.line("$") 124 | local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" } 125 | local line_ratio = current_line / total_lines 126 | local index = math.ceil(line_ratio * #chars) 127 | return chars[index] 128 | end, 129 | padding = 0, 130 | color = { fg = colors.yellow }, 131 | }) 132 | 133 | -- Setup the config file / source it? 134 | lualine.setup(config) 135 | -------------------------------------------------------------------------------- /lua/plugins/config/neorg.lua: -------------------------------------------------------------------------------- 1 | local present, neorg = pcall(require, "neorg") 2 | if not present then 3 | return 4 | end 5 | 6 | local neorg_callbacks = require("neorg.callbacks") 7 | 8 | neorg.setup({ 9 | load = { 10 | ["core.defaults"] = {}, 11 | ["core.norg.dirman"] = { 12 | config = { 13 | workspaces = { 14 | homework = "D:/gtd/", 15 | notes = "D:/notes/", 16 | }, 17 | open_last_workspace = false, 18 | }, 19 | }, 20 | ["core.norg.esupports.metagen"] = { 21 | config = { 22 | type = "auto", 23 | }, 24 | }, 25 | ["core.export.markdown"] = { 26 | config = { 27 | extensions = "all", 28 | }, 29 | }, 30 | ["core.norg.completion"] = { 31 | config = { 32 | engine = "nvim-cmp", 33 | }, 34 | }, 35 | ["core.gtd.base"] = { 36 | config = { 37 | workspace = "homework", 38 | exclude = { "journal" }, 39 | }, 40 | }, 41 | ["core.norg.concealer"] = { 42 | config = { 43 | -- markup_preset = "dimmed", 44 | markup_preset = "conceal", 45 | -- icon_preset = "diamond", 46 | -- icon_preset = "varied", 47 | icons = { 48 | marker = { 49 | enabled = true, 50 | icon = " ", 51 | }, 52 | todo = { 53 | enable = true, 54 | pending = { 55 | -- icon = "" 56 | icon = "", 57 | }, 58 | uncertain = { 59 | icon = "?", 60 | }, 61 | urgent = { 62 | icon = "", 63 | }, 64 | on_hold = { 65 | icon = "", 66 | }, 67 | cancelled = { 68 | icon = "", 69 | }, 70 | }, 71 | heading = { 72 | enabled = true, 73 | level_1 = { 74 | icon = "◈", 75 | }, 76 | 77 | level_2 = { 78 | icon = " ◇", 79 | }, 80 | 81 | level_3 = { 82 | icon = " ◆", 83 | }, 84 | level_4 = { 85 | icon = " ❖", 86 | }, 87 | level_5 = { 88 | icon = " ⟡", 89 | }, 90 | level_6 = { 91 | icon = " ⋄", 92 | }, 93 | }, 94 | }, 95 | }, 96 | }, 97 | ["core.keybinds"] = { 98 | config = { 99 | hook = function(keybinds) 100 | keybinds.remap_event("norg", "n", "lp", "core.norg.qol.todo_items.todo.task_cycle") 101 | end, 102 | }, 103 | }, 104 | ["core.norg.journal"] = { 105 | config = { 106 | workspace = "homework", 107 | strategy = "flat", -- nested 108 | }, 109 | }, 110 | ["external.kanban"] = {}, 111 | ["core.integrations.telescope"] = {}, 112 | }, 113 | }) 114 | 115 | neorg_callbacks.on_event("core.keybinds.events.enable_keybinds", function(_, keybinds) 116 | -- Map all the below keybinds only when the "norg" mode is active 117 | keybinds.map_event_to_mode("norg", { 118 | n = { -- Bind keys in normal mode 119 | { "", "core.integrations.telescope.find_linkable" }, 120 | }, 121 | 122 | i = { -- Bind in insert mode 123 | { "", "core.integrations.telescope.insert_link" }, 124 | }, 125 | }, { 126 | silent = true, 127 | noremap = true, 128 | }) 129 | end) 130 | -------------------------------------------------------------------------------- /lua/plugins/config/notify.lua: -------------------------------------------------------------------------------- 1 | local notify = require("notify") 2 | local default = { 3 | stages = "fade", 4 | render = "default", 5 | timeout = 2000, 6 | minimum_width = 60, 7 | icons = { 8 | ERROR = "", 9 | WARN = "", 10 | INFO = "", 11 | DEBUG = "", 12 | TRACE = "", 13 | }, 14 | } 15 | 16 | vim.opt.termguicolors = true 17 | 18 | notify.setup(default) 19 | 20 | vim.notify = function(msg, level, opts) 21 | notify(msg, level, opts) 22 | end 23 | 24 | function _G.P(...) 25 | print(vim.inspect(...)) 26 | return ... 27 | end 28 | 29 | vim.notify = require("notify") 30 | 31 | -- vim.cmd([[ 32 | -- highlight link NotifyERRORBody Normal 33 | -- highlight link NotifyWARNBody Normal 34 | -- highlight link NotifyINFOBody Normal 35 | -- highlight link NotifyDEBUGBody Normal 36 | -- highlight link NotifyTRACEBody Normal 37 | -- ]]) 38 | 39 | -- This is a command i got from a repo. Will test it out soon 40 | -- vim.api.nvim_command('highlight LightBulbFloatWin ctermfg= ctermbg= guifg= guibg=') 41 | -------------------------------------------------------------------------------- /lua/plugins/config/null-ls.lua: -------------------------------------------------------------------------------- 1 | local null_ls = require("null-ls") 2 | -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting 3 | local formatting = null_ls.builtins.formatting 4 | -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics 5 | -- local diagnostics = null_ls.builtins.diagnostics 6 | local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) 7 | 8 | null_ls.setup({ 9 | debug = false, 10 | sources = { 11 | -- formatting.prettier.with({ 12 | -- extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" }, 13 | -- }), 14 | formatting.stylua, 15 | formatting.rustfmt, 16 | formatting.clang_format, 17 | }, 18 | 19 | -- Format on save (laggy) 20 | on_attach = function(client, bufnr) 21 | vim.api.nvim_create_autocmd("BufWritePre", { 22 | buffer = bufnr, 23 | callback = function() 24 | vim.lsp.buf.format() 25 | end, 26 | }) 27 | end, 28 | }) 29 | -------------------------------------------------------------------------------- /lua/plugins/config/nvim-tree.lua: -------------------------------------------------------------------------------- 1 | local g = vim.g 2 | 3 | local present, tree = pcall(require, "nvim-tree") 4 | if not present then 5 | return 6 | end 7 | 8 | g.nvim_tree_icons = { 9 | default = "", 10 | symlink = "", 11 | git = { 12 | deleted = "", 13 | ignored = "◌", 14 | renamed = "➜", 15 | staged = "✓", 16 | unmerged = "", 17 | unstaged = "✗", 18 | untracked = "★", 19 | }, 20 | folder = { 21 | default = "", 22 | empty = "", 23 | empty_open = "", 24 | open = "", 25 | symlink = "", 26 | symlink_open = "", 27 | arrow_open = "", 28 | arrow_closed = "", 29 | }, 30 | } 31 | 32 | tree.setup({ 33 | disable_netrw = true, 34 | hijack_netrw = true, 35 | open_on_setup = false, 36 | open_on_tab = true, 37 | hijack_cursor = false, 38 | update_cwd = false, 39 | view = { 40 | width = 30, 41 | height = 30, 42 | hide_root_folder = false, 43 | side = "right", 44 | preserve_window_proportions = true, 45 | mappings = { 46 | custom_only = false, 47 | list = {}, 48 | }, 49 | }, 50 | hijack_directories = { 51 | enable = true, 52 | auto_open = true, 53 | }, 54 | update_focused_file = { 55 | enable = true, 56 | update_cwd = true, 57 | ignore_list = {}, 58 | }, 59 | ignore_ft_on_setup = {}, 60 | system_open = { 61 | cmd = nil, 62 | args = {}, 63 | }, 64 | renderer = { 65 | indent_markers = { 66 | enable = true, 67 | }, 68 | }, 69 | filters = { 70 | dotfiles = false, 71 | custom = { ".git", ".gitattributes", "node_module", "package.lock.json" }, 72 | }, 73 | git = { 74 | enable = false, 75 | }, 76 | trash = { 77 | cmd = "trash", 78 | require_confirm = true, 79 | }, 80 | actions = { 81 | use_system_clipboard = true, 82 | change_dir = { 83 | enable = true, 84 | global = false, 85 | restrict_above_cwd = false, 86 | }, 87 | open_file = { 88 | quit_on_open = false, 89 | resize_window = false, 90 | window_picker = { 91 | enable = true, 92 | chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", 93 | exclude = { 94 | filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, 95 | buftype = { "nofile", "terminal", "help" }, 96 | }, 97 | }, 98 | }, 99 | }, 100 | }) 101 | -------------------------------------------------------------------------------- /lua/plugins/config/other.lua: -------------------------------------------------------------------------------- 1 | -- Colorizer 2 | 3 | local status_ok, color = pcall(require, "colorizer") 4 | if not status_ok then 5 | return 6 | end 7 | require("colorizer").setup({ 8 | "*", 9 | }, { 10 | mode = "foreground", 11 | hsl_fn = true, 12 | RRGGBBAA = true, 13 | rgb_fn = true, 14 | css = true, 15 | css_fn = true, 16 | }) 17 | 18 | -- Impatient 19 | require("impatient") 20 | require("impatient").enable_profile() 21 | -------------------------------------------------------------------------------- /lua/plugins/config/presence.lua: -------------------------------------------------------------------------------- 1 | local status_ok, discord = pcall(require, "presence") 2 | if not status_ok then 3 | return 4 | end 5 | 6 | -- The setup config table shows all available config options with their default values: 7 | discord:setup({ 8 | -- General options 9 | auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`) 10 | neovim_image_text = "The god of all editors", -- Text displayed when hovered over the Neovim image 11 | main_image = "neovim", -- Main image display (either "neovim" or "file") 12 | client_id = "793271441293967371", -- Use your own Discord application client id (not recommended) 13 | log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error") 14 | debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(, true)`) 15 | enable_line_number = false, -- Displays the current line number instead of the current project 16 | blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches 17 | buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "