From 69c8ca6af346097bd131fadf5d3203f286cc14fd Mon Sep 17 00:00:00 2001 From: The-Repo-Club Date: Sun, 14 Aug 2022 18:23:48 +0100 Subject: [PATCH] Update Dotfiles Signed-off-by: The-Repo-Club --- ckb-next/.config/ckb-next/ckb-next.conf | 16 +- dconf/.config/dconf/user | Bin 6032 -> 6032 bytes nvim/.config/nvim/init.lua | 26 + nvim/.config/nvim/lua/core/autocmds.lua | 14 + nvim/.config/nvim/lua/core/custom.lua | 22 + nvim/.config/nvim/lua/core/default_config.lua | 182 ++++++ nvim/.config/nvim/lua/core/functions.lua | 28 + nvim/.config/nvim/lua/core/hooks.lua | 68 +++ nvim/.config/nvim/lua/core/init.lua | 20 + nvim/.config/nvim/lua/core/mappings.lua | 127 +++++ nvim/.config/nvim/lua/core/options.lua | 77 +++ nvim/.config/nvim/lua/core/system.lua | 44 ++ nvim/.config/nvim/lua/core/utils.lua | 311 ++++++++++ .../nvim/lua/custom/configs/lualine.lua | 162 ++++++ .../nvim/lua/custom/configs/startify.lua | 112 ++++ nvim/.config/nvim/lua/custom/configs/trim.lua | 12 + .../nvim/lua/custom/configs/which-key.lua | 5 + nvim/.config/nvim/lua/custom/init.lua | 97 ++++ nvim/.config/nvim/lua/custom/nvimrc.lua | 74 +++ .../nvim/lua/plugins/configs/bufferline.lua | 49 ++ nvim/.config/nvim/lua/plugins/configs/cmp.lua | 72 +++ .../nvim/lua/plugins/configs/dashboard.lua | 79 +++ .../nvim/lua/plugins/configs/gitsigns.lua | 34 ++ .../nvim/lua/plugins/configs/icons.lua | 146 +++++ .../nvim/lua/plugins/configs/lspconfig.lua | 103 ++++ .../lua/plugins/configs/lspkind_icons.lua | 31 + .../nvim/lua/plugins/configs/nvimtree.lua | 82 +++ .../nvim/lua/plugins/configs/others.lua | 119 ++++ .../nvim/lua/plugins/configs/telescope.lua | 82 +++ .../nvim/lua/plugins/configs/treesitter.lua | 32 ++ nvim/.config/nvim/lua/plugins/init.lua | 270 +++++++++ nvim/.config/nvim/lua/plugins/packerInit.lua | 47 ++ nvim/.config/nvim/plugin/packer_compiled.lua | 539 ++++++++++++++++++ 33 files changed, 3074 insertions(+), 8 deletions(-) create mode 100644 nvim/.config/nvim/init.lua create mode 100644 nvim/.config/nvim/lua/core/autocmds.lua create mode 100644 nvim/.config/nvim/lua/core/custom.lua create mode 100644 nvim/.config/nvim/lua/core/default_config.lua create mode 100644 nvim/.config/nvim/lua/core/functions.lua create mode 100644 nvim/.config/nvim/lua/core/hooks.lua create mode 100644 nvim/.config/nvim/lua/core/init.lua create mode 100644 nvim/.config/nvim/lua/core/mappings.lua create mode 100644 nvim/.config/nvim/lua/core/options.lua create mode 100644 nvim/.config/nvim/lua/core/system.lua create mode 100644 nvim/.config/nvim/lua/core/utils.lua create mode 100644 nvim/.config/nvim/lua/custom/configs/lualine.lua create mode 100644 nvim/.config/nvim/lua/custom/configs/startify.lua create mode 100644 nvim/.config/nvim/lua/custom/configs/trim.lua create mode 100644 nvim/.config/nvim/lua/custom/configs/which-key.lua create mode 100644 nvim/.config/nvim/lua/custom/init.lua create mode 100644 nvim/.config/nvim/lua/custom/nvimrc.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/bufferline.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/cmp.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/dashboard.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/gitsigns.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/icons.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/lspconfig.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/lspkind_icons.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/nvimtree.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/others.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/telescope.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/treesitter.lua create mode 100644 nvim/.config/nvim/lua/plugins/init.lua create mode 100644 nvim/.config/nvim/lua/plugins/packerInit.lua create mode 100644 nvim/.config/nvim/plugin/packer_compiled.lua diff --git a/ckb-next/.config/ckb-next/ckb-next.conf b/ckb-next/.config/ckb-next/ckb-next.conf index 0bc8cc5fb..7546a0bd8 100644 --- a/ckb-next/.config/ckb-next/ckb-next.conf +++ b/ckb-next/.config/ckb-next/ckb-next.conf @@ -197,7 +197,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Lighting\Keys\y=#ffffff 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Lighting\Keys\z=#ffffff 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Modified=cf6d196b +0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Modified=70041c12 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Name=Rainbow 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Performance\DPI\0=@Point(400 400) @@ -425,7 +425,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Lighting\Keys\y=#ff0000 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Lighting\Keys\z=#ff0000 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Modified=f84a11e9 +0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Modified=6d3e86c7 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Name=Breathing 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Performance\DPI\0=@Point(400 400) @@ -675,7 +675,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Lighting\Keys\y=#aa00ff 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Lighting\Keys\z=#aa00ff 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Modified=9065427 +0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Modified=b17121ec 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Name=Trippy 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Performance\DPI\0=@Point(400 400) @@ -733,7 +733,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\CurrentMode={51EB6E3A-27A0-4AD6-A35C-6B67E0329A3D} 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\HwModified=7ffd 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\ModeCount=3 -0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\Modified=63db8f2d +0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\Modified=cdf45323 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\Name=Multi 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Binding\KeyMap=K68 GB 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Binding\UseRealNames=true @@ -929,7 +929,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Lighting\Keys\y=#ffffff 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Lighting\Keys\z=#ffffff 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Modified=7c233a8b +0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Modified=9e7c9170 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Name=Rainbow 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Performance\DPI\0=@Point(400 400) @@ -1157,7 +1157,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Lighting\Keys\y=#ff0000 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Lighting\Keys\z=#ff0000 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Modified=a69957f0 +0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Modified=e39dadb9 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Name=Breathing 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Performance\DPI\0=@Point(400 400) @@ -1407,7 +1407,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Lighting\Keys\y=#aa00ff 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Lighting\Keys\z=#aa00ff 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Modified=dabdf1d2 +0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Modified=1101fcbe 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Name=Trippy 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Performance\DPI\0=@Point(400 400) @@ -1465,7 +1465,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\CurrentMode={11C11AE3-3195-4DFC-B8AC-2FEA703414E5} 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\HwModified=40b6f054 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\ModeCount=3 -0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\Modified=b68a017a +0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\Modified=4df1f967 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\Name=Demo [Popups] diff --git a/dconf/.config/dconf/user b/dconf/.config/dconf/user index f9575ef4320274eb523d56ebc56176c32fc2a74d..9e30412e14e737c05fc0503edab507211bcc72cd 100644 GIT binary patch delta 18 ZcmbQBKS6&(f)FboCj&#{=2RhVRsb?61egE- delta 18 ZcmbQBKS6&(f)HyjBLhRj=2RhVRsc581r7iJ diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100644 index 000000000..835231234 --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1,26 @@ +local ok, err = pcall(require, "core") + +vim.g.dracula_show_end_of_buffer = true -- default false, Turn on or off EndOfBuffer symbol +vim.g.dracula_transparent_bg = true -- default false, enables transparent background + +vim.cmd[[colorscheme minimalmistakes]] +vim.cmd("hi! link DashboardHeader Error") +vim.cmd("hi! link DashboardCenter Keyword") +vim.cmd("set colorcolumn=90") + +if not ok then + error("Error loading core" .. "\n\n" .. err) +end + +vim.opt.termguicolors = true + +vim.opt.list = true +vim.opt.listchars:append("space:⋅") +vim.opt.listchars:append("eol:↴") + +vim.g.header_email = "wayne6324@gmail.com" +vim.g.header_github = "The-Repo-Club" +vim.g.header_username = "The-Repo-Club" + +vim.g.header_sh = "bash" +vim.g.header_auto_update = "true" diff --git a/nvim/.config/nvim/lua/core/autocmds.lua b/nvim/.config/nvim/lua/core/autocmds.lua new file mode 100644 index 000000000..06da3271b --- /dev/null +++ b/nvim/.config/nvim/lua/core/autocmds.lua @@ -0,0 +1,14 @@ +-- uncomment this if you want to open nvim with a dir +-- vim.cmd [[ autocmd BufEnter * if &buftype != "terminal" | lcd %:p:h | endif ]] + +-- Use relative & absolute line numbers in 'n' & 'i' modes respectively +-- vim.cmd[[ au InsertEnter * set norelativenumber ]] +-- vim.cmd[[ au InsertLeave * set relativenumber ]] + +-- Don't show any numbers inside terminals +vim.cmd [[ au TermOpen term://* setlocal nonumber norelativenumber | setfiletype terminal ]] + +-- Open a file from its last left off position +-- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]] +-- File extension specific tabbing +-- vim.cmd [[ autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 ]] diff --git a/nvim/.config/nvim/lua/core/custom.lua b/nvim/.config/nvim/lua/core/custom.lua new file mode 100644 index 000000000..78c036499 --- /dev/null +++ b/nvim/.config/nvim/lua/core/custom.lua @@ -0,0 +1,22 @@ +local function isModuleAvailable(name) + if package.loaded[name] then + return true + else + for _, searcher in ipairs(package.searchers or package.loaders) do + local loader = searcher(name) + if type(loader) == "function" then + package.preload[name] = loader + return true + end + end + return false + end +end + +local loadIfExists = function(module) + if isModuleAvailable(module) then + require(module) + end +end + +loadIfExists "custom" diff --git a/nvim/.config/nvim/lua/core/default_config.lua b/nvim/.config/nvim/lua/core/default_config.lua new file mode 100644 index 000000000..61ce78869 --- /dev/null +++ b/nvim/.config/nvim/lua/core/default_config.lua @@ -0,0 +1,182 @@ +-- IMPORTANT NOTE : This is default config, so dont change anything here. +-- use custom/nvimrc.lua instead + +local M = {} +M.options, M.ui, M.mappings, M.plugins = {}, {}, {}, {} + +-- non plugin normal, available without any plugins +M.options = { + -- NeoVim/Vim options + clipboard = "unnamedplus", + cmdheight = 1, + ruler = false, + hidden = true, + ignorecase = true, + smartcase = true, + mapleader = " ", + mouse = "a", + number = true, + -- relative numbers in normal mode tool at the bottom of options.lua + numberwidth = 2, + relativenumber = false, + expandtab = true, + shiftwidth = 2, + smartindent = true, + tabstop = 8, -- Number of spaces that a in the file counts for + timeoutlen = 400, + -- interval for writing swap file to disk, also used by gitsigns + updatetime = 250, + undofile = true, -- keep a permanent undo (across restarts) +} + +-- ui configs +M.ui = { + italic_comments = false, + -- Enable this only if your terminal has the colorscheme set which neovim uses + -- For Ex : if you have onedark set in neovim, set onedark's bg color on your terminal + transparency = false, +} + +-- these are plugin related options +M.plugins = { + -- enable and disable plugins (false for disable) + status = { + blankline = true, -- show code scope with symbols + bufferline = true, -- list open buffers up the top, easy switching too + colorizer = false, -- color RGB, HEX, CSS, NAME color codes + comment = true, -- easily (un)comment code, language aware + dashboard = true, -- NeoVim 'home screen' on open + esc_insertmode = true, -- map to with no lag + gitsigns = true, -- gitsigns in statusline + lspsignature = true, -- lsp enhancements + telescope_media = false, -- media previews within telescope finders + vim_matchup = true, -- % operator enhancements + cmp = true, + clap = true, + nvimtree = true, + autopairs = true, + startify = false, + }, + options = { + lspconfig = { + setup_lspconf = "", -- path of file containing setups of different lsps + }, + nvimtree = { + enable_git = 1, + }, + luasnip = { + snippet_path = {}, + }, + statusline = { -- statusline related options + -- these are filetypes, not pattern matched + -- shown filetypes will overrule hidden filetypes + hidden = { + "help", + "dashboard", + "NvimTree", + "terminal", + }, + -- show short statusline on small screens + shortline = true, + shown = {}, + -- default, round , slant , block , arrow + style = "default", + }, + esc_insertmode_timeout = 300, +}, +default_plugin_config_replace = {}, +} + +-- mappings -- don't use a single keymap twice -- +-- non plugin mappings +M.mappings = { + -- custom = {}, -- all custom user mappings + -- close current focused buffer + close_buffer = "x", + copy_whole_file = "", -- copy all contents of the current buffer + line_number_toggle = "n", -- show or hide line number + new_buffer = "", -- open a new buffer + new_tab = "b", -- open a new vim tab + save_file = "", -- save file using :w + theme_toggler = "tt", -- for theme toggler, see in ui.theme_toggler + -- navigation in insert mode, only if enabled in options + insert_nav = { + backward = "", + end_of_line = "", + forward = "", + next_line = "", + prev_line = "", + beginning_of_line = "", + }, + --better window movement + window_nav = { + moveLeft = "", + moveRight = "", + moveUp = "", + moveDown = "", + }, + -- terminal related mappings + terminal = { + -- multiple mappings can be given for esc_termmode and esc_hide_termmode + -- get out of terminal mode + esc_termmode = { "jk" }, -- multiple mappings allowed + -- get out of terminal mode and hide it + esc_hide_termmode = { "JK" }, -- multiple mappings allowed + -- show & recover hidden terminal buffers in a telescope picker + pick_term = "W", + -- below three are for spawning terminals + new_horizontal = "h", + new_vertical = "v", + new_window = "w", + }, +} + +-- all plugins related mappings +M.mappings.plugins = { + -- list open buffers up the top, easy switching too + bufferline = { + next_buffer = "", -- next buffer + prev_buffer = "", -- previous buffer + }, + -- easily (un)comment code, language aware + comment = { + toggle = "/", -- toggle comment (works on multiple lines) + }, + -- NeoVim 'home screen' on open + dashboard = { + find_files = "dff", + browser = "dfb", + find_word = "dfw", + new_file = "dfn", -- basically create a new buffer + open = "do", -- open dashboard + session_load = "dl", -- load a saved session + session_save = "ds", -- save a session + }, + -- map to with no lag + better_escape = { -- will still work + esc_insertmode = { "jk" }, -- multiple mappings allowed +}, +-- file explorer/tree +nvimtree = { + toggle = "", + focus = "e", +}, +-- multitool for finding & picking things +telescope = { + buffers = "fb", + find_files = "ff", + find_hiddenfiles = "fa", + git_commits = "cm", + git_status = "gt", + help_tags = "fh", + live_grep = "fw", + oldfiles = "fo", + themes = "th", -- NeoVim theme picker + -- media previews within telescope finders + telescope_media = { + media_files = "fp", + }, +}, +} + +return M diff --git a/nvim/.config/nvim/lua/core/functions.lua b/nvim/.config/nvim/lua/core/functions.lua new file mode 100644 index 000000000..8ac60e6fb --- /dev/null +++ b/nvim/.config/nvim/lua/core/functions.lua @@ -0,0 +1,28 @@ +local utils = require "core.utils" +local system = require "core.system" +local M = {} + +M.edit_config = function() + local selected_config = tonumber(vim.fn.inputlist({ + "Select a configuration file to edit:", + "1. init.lua (default)", + "2. init.lua", + "3. nvimrc.lua", + })) + local config = utils.load_config() + local setting = config.plugins.options + + local open_command = setting.open_command and "split" or "edit" + + if selected_config == 1 then + vim.cmd(string.format("%s %s%sinit.lua", open_command, system.nvim_default_root, system.sep)) + elseif selected_config == 2 then + vim.cmd(string.format("%s %s%sinit.lua", open_command, system.nvim_configs_root, system.sep)) + elseif selected_config == 3 then + vim.cmd(string.format("%s %s%snvimrc.lua", open_command, system.nvim_configs_root, system.sep)) + elseif selected_config ~= 0 then + log.error("Invalid option selected.") + end +end + +return M diff --git a/nvim/.config/nvim/lua/core/hooks.lua b/nvim/.config/nvim/lua/core/hooks.lua new file mode 100644 index 000000000..f0dfa1fcf --- /dev/null +++ b/nvim/.config/nvim/lua/core/hooks.lua @@ -0,0 +1,68 @@ +local hooks, overrides, M = {}, {}, {} +local allowed_hooks = { + "install_plugins", + "setup_mappings", + "ready", +} + +local function has_value(tab, val) + for _, value in ipairs(tab) do + if value == val then + return true + end + end + + return false +end + +M.add = function(name, fn) + if not (has_value(allowed_hooks, name)) then + error("Custom lua uses unallowed hook " .. name) + end + if hooks[name] == nil then + hooks[name] = {} + end + table.insert(hooks[name], fn) +end + +M.run = function(name, args) + if hooks[name] == nil then + return + end + + for _, hook in pairs(hooks[name]) do + hook(args) + end +end + +M.createOverrides = function(module) + local O = {} + + O.get = function(name, default) + local current = default + if overrides[module] and overrides[module][name] then + if type(overrides[module][name]) == "function" then + current = overrides[module][name] + elseif type(overrides[module][name]) == "table" then + for _, override in pairs(overrides[module][name]) do + current = override(current) + end + end + end + return current + end + + return O +end + +M.override = function(module, name, overwrite) + if overrides[module] == nil then + overrides[module] = {} + end + if overrides[module][name] == nil then + overrides[module][name] = {} + end + table.insert(overrides[module][name], overwrite) +end + +return M diff --git a/nvim/.config/nvim/lua/core/init.lua b/nvim/.config/nvim/lua/core/init.lua new file mode 100644 index 000000000..9b7912664 --- /dev/null +++ b/nvim/.config/nvim/lua/core/init.lua @@ -0,0 +1,20 @@ +local core_modules = { + "core.custom", + "core.options", + "core.autocmds", + "core.mappings", +} + +local hooks = require "core.hooks" + +for _, module in ipairs(core_modules) do + local ok, err = pcall(require, module) + if not ok then + error("Error loading " .. module .. "\n\n" .. err) + end +end + +-- set all the non plugin mappings +require("core.mappings").misc() + +hooks.run "ready" diff --git a/nvim/.config/nvim/lua/core/mappings.lua b/nvim/.config/nvim/lua/core/mappings.lua new file mode 100644 index 000000000..e40fc1f3c --- /dev/null +++ b/nvim/.config/nvim/lua/core/mappings.lua @@ -0,0 +1,127 @@ +local utils = require "core.utils" +local hooks = require "core.hooks" + +local config = utils.load_config() +local map = utils.map + +local maps = config.mappings +local plugin_maps = maps.plugins + +local cmd = vim.cmd + +local M = {} + +-- these mappings will only be called during initialization +M.misc = function() + local function non_config_mappings() + -- Don't copy the replaced text after pasting in visual mode + map("v", "p", '"_dP') + + -- Allow moving the cursor through wrapped lines with j, k, and + -- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/ + -- empty mode is same as using :map + -- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour + map("", "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true }) + map("", "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true }) + map("", "", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true }) + map("", "", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true }) + + -- use ESC to turn off search highlighting + map("n", "", ":noh ") + end + + local function optional_mappings() + + end + + local function required_mappings() + map("n", maps.close_buffer, ":lua require('core.utils').close_buffer() ") -- close buffer + map("n", maps.copy_whole_file, ":%y+ ") -- copy whole file content + map("n", maps.new_buffer, ":enew ") -- new buffer + map("n", maps.new_tab, ":tabnew ") -- new tabs + map("n", maps.line_number_toggle, ":set nu! ") -- toggle numbers + map("n", maps.save_file, ":w ") -- ctrl + s to save file + + -- terminal mappings -- + local term_maps = maps.terminal + -- get out of terminal mode + map("t", term_maps.esc_termmode, "") + -- hide a term from within terminal mode + map("t", term_maps.esc_hide_termmode, " :lua require('core.utils').close_buffer() ") + -- pick a hidden term + map("n", term_maps.pick_term, ":Telescope terms ") + -- Open terminals + -- TODO this opens on top of an existing vert/hori term, fixme + map("n", term_maps.new_horizontal, ":execute 15 .. 'new +terminal' | let b:term_type = 'hori' | startinsert ") + map("n", term_maps.new_vertical, ":execute 'vnew +terminal' | let b:term_type = 'vert' | startinsert ") + map("n", term_maps.new_window, ":execute 'terminal' | let b:term_type = 'wind' | startinsert ") + -- terminal mappings end -- + + -- Add Packer commands because we are not loading it at startup + cmd "silent! command PackerClean lua require 'plugins' require('packer').clean()" + cmd "silent! command PackerCompile lua require 'plugins' require('packer').compile()" + cmd "silent! command PackerInstall lua require 'plugins' require('packer').install()" + cmd "silent! command PackerStatus lua require 'plugins' require('packer').status()" + cmd "silent! command PackerSync lua require 'plugins' require('packer').sync()" + cmd "silent! command PackerUpdate lua require 'plugins' require('packer').update()" + end + + non_config_mappings() + optional_mappings() + required_mappings() + hooks.run("setup_mappings", map) +end + +-- below are all plugin related mappings + +M.bufferline = function() + local m = plugin_maps.bufferline + + map("n", m.next_buffer, ":BufferLineCycleNext ") + map("n", m.prev_buffer, ":BufferLineCyclePrev ") +end + +M.comment = function() + local m = plugin_maps.comment.toggle + map("n", m, ":CommentToggle ") + map("v", m, ":CommentToggle ") +end + +M.dashboard = function() + local m = plugin_maps.dashboard + + map("n", m.find_files, ":Telescope find_files find_command=rg,--hidden,--files ") + map("n", m.browser, ":Telescope file_browser ") + map("n", m.find_word, ":Telescope live_grep ") + map("n", m.new_file, ":DashboardNewFile ") + map("n", m.open, ":Dashboard ") + map("n", m.session_load, ":SessionLoad ") + map("n", m.session_save, ":SessionSave ") +end + +M.nvimtree = function() + map("n", plugin_maps.nvimtree.toggle, ":NvimTreeToggle ") + map("n", plugin_maps.nvimtree.focus, ":NvimTreeFocus ") +end + +M.telescope = function() + local m = plugin_maps.telescope + + map("n", m.buffers, ":Telescope buffers ") + map("n", m.find_files, ":Telescope find_files ") + map("n", m.find_hiddenfiles, ":Telescope find_files hidden=true ") + map("n", m.git_commits, ":Telescope git_commits ") + map("n", m.git_status, ":Telescope git_status ") + map("n", m.help_tags, ":Telescope help_tags ") + map("n", m.live_grep, ":Telescope live_grep ") + map("n", m.oldfiles, ":Telescope oldfiles ") + map("n", m.themes, ":Telescope themes ") +end + +M.telescope_media = function() + local m = plugin_maps.telescope.telescope_media + + map("n", m.media_files, ":Telescope media_files ") +end + +return M diff --git a/nvim/.config/nvim/lua/core/options.lua b/nvim/.config/nvim/lua/core/options.lua new file mode 100644 index 000000000..64d86498a --- /dev/null +++ b/nvim/.config/nvim/lua/core/options.lua @@ -0,0 +1,77 @@ +local opt = vim.opt +local g = vim.g + +-- export user config as a global varibale +g.neovim_user_config = "nvimrc" + +local options = require("core.utils").load_config().options + +opt.title = true +opt.clipboard = options.clipboard +opt.cmdheight = options.cmdheight +opt.cul = true -- cursor line + +-- Indentline +opt.expandtab = options.expandtab +opt.shiftwidth = options.shiftwidth +opt.smartindent = options.smartindent + +-- disable tilde on end of buffer: https://github.com/neovim/neovim/pull/8546#issuecomment-643643758 +opt.fillchars = { eob = " " } + +opt.hidden = options.hidden +opt.ignorecase = options.ignorecase +opt.smartcase = options.smartcase +opt.mouse = options.mouse + +-- Numbers +opt.number = options.number +opt.numberwidth = options.numberwidth +opt.relativenumber = options.relativenumber +opt.ruler = options.ruler + +-- disable nvim intro +opt.shortmess:append "sI" + +opt.signcolumn = "yes" +opt.splitbelow = true +opt.splitright = true +opt.tabstop = options.tabstop +opt.termguicolors = true +opt.timeoutlen = options.timeoutlen +opt.undofile = options.undofile + +-- interval for writing swap file to disk, also used by gitsigns +opt.updatetime = options.updatetime + +-- go to previous/next line with h,l,left arrow and right arrow +-- when cursor reaches end/beginning of line +opt.whichwrap:append "<>[]hl" + +g.mapleader = options.mapleader + +-- disable some builtin vim plugins +local disabled_built_ins = { + "2html_plugin", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", +} + +for _, plugin in pairs(disabled_built_ins) do + g["loaded_" .. plugin] = 1 +end diff --git a/nvim/.config/nvim/lua/core/system.lua b/nvim/.config/nvim/lua/core/system.lua new file mode 100644 index 000000000..627246af6 --- /dev/null +++ b/nvim/.config/nvim/lua/core/system.lua @@ -0,0 +1,44 @@ +-------------------------------------------------------------------------------- +-- Path - nvim/lua/core/system.lua +-- GitHub - https://github.com/The-Repo-Club/ +-- Author - The-Repo-Club [wayne6324@gmail.com] +-- Start On - Fri 05 Nov 00:16:08 GMT 2021 +-- Modified On - Fri 05 Nov 00:16:08 GMT 2021 +-------------------------------------------------------------------------------- + +local M = {} + +-- get_config_dir will get the config path based in the current system, e.g. +-- 'C:\Users\JohnDoe\AppData\Local' for windows and '~/.config' for *nix +-- @return string +local function get_config_dir() + if string.find(vim.loop.os_uname().sysname, "Windows") then + return os.getenv("USERPROFILE") .. "\\AppData\\Local\\" + end + + return (os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME")) + or (os.getenv("HOME") .. "/.config") +end + +-- get_separator will return the system paths separator, e.g. \ for Windows and / for *nix +-- @return string +local function get_separator() + if vim.loop.os_uname().sysname == "Windows" then + return "\\" + end + + return "/" +end + +M.config_dir = get_config_dir() + +M.sep = get_separator() + +-- The nvim root directory, works as a fallback for looking nvim configurations +-- in case that nvim_configs_root directory does not exists. +M.nvim_root = string.format("%s%snvim", M.config_dir, M.sep) +-- The nvim configurations root directory +M.nvim_default_root = string.format("%s%snvim%slua%splugins", M.config_dir, M.sep, M.sep, M.sep) +M.nvim_configs_root = string.format("%s%snvim%slua%scustom", M.config_dir, M.sep, M.sep, M.sep) + +return M diff --git a/nvim/.config/nvim/lua/core/utils.lua b/nvim/.config/nvim/lua/core/utils.lua new file mode 100644 index 000000000..cb1409463 --- /dev/null +++ b/nvim/.config/nvim/lua/core/utils.lua @@ -0,0 +1,311 @@ +local M = {} + +M.close_buffer = function(bufexpr, force) + -- This is a modification of a NeoVim plugin from + -- Author: ojroques - Olivier Roques + -- Src: https://github.com/ojroques/nvim-bufdel + -- (Author has okayed copy-paste) + + -- Options + local opts = { + next = "cycle", -- how to retrieve the next buffer + quit = false, -- exit when last buffer is deleted + --TODO make this a nvimrc flag/option + } + + -- ---------------- + -- Helper functions + -- ---------------- + + -- Switch to buffer 'buf' on each window from list 'windows' + local function switch_buffer(windows, buf) + local cur_win = vim.fn.winnr() + for _, winid in ipairs(windows) do + vim.cmd(string.format("%d wincmd w", vim.fn.win_id2win(winid))) + vim.cmd(string.format("buffer %d", buf)) + end + vim.cmd(string.format("%d wincmd w", cur_win)) -- return to original window + end + + -- Select the first buffer with a number greater than given buffer + local function get_next_buf(buf) + local next = vim.fn.bufnr "#" + if opts.next == "alternate" and vim.fn.buflisted(next) == 1 then + return next + end + for i = 0, vim.fn.bufnr "$" - 1 do + next = (buf + i) % vim.fn.bufnr "$" + 1 -- will loop back to 1 + if vim.fn.buflisted(next) == 1 then + return next + end + end + end + + -- ---------------- + -- End helper functions + -- ---------------- + + local buf = vim.fn.bufnr() + if vim.fn.buflisted(buf) == 0 then -- exit if buffer number is invalid + vim.cmd "close" + return + end + + if #vim.fn.getbufinfo { buflisted = 1 } < 2 then + if opts.quit then + -- exit when there is only one buffer left + if force then + vim.cmd "qall!" + else + vim.cmd "confirm qall" + end + return + end + + local chad_term, type = pcall(function() + return vim.api.nvim_buf_get_var(buf, "term_type") + end) + + if chad_term then + -- Must be a window type + vim.cmd(string.format("setlocal nobl", buf)) + vim.cmd "enew" + return + end + -- don't exit and create a new empty buffer + vim.cmd "enew" + vim.cmd "bp" + end + + local next_buf = get_next_buf(buf) + local windows = vim.fn.getbufinfo(buf)[1].windows + + -- force deletion of terminal buffers to avoid the prompt + if force or vim.fn.getbufvar(buf, "&buftype") == "terminal" then + local chad_term, type = pcall(function() + return vim.api.nvim_buf_get_var(buf, "term_type") + end) + + -- TODO this scope is error prone, make resilient + if chad_term then + if type == "wind" then + -- hide from bufferline + vim.cmd(string.format("%d bufdo setlocal nobl", buf)) + -- swtich to another buff + -- TODO switch to next bufffer, this works too + vim.cmd "BufferLineCycleNext" + else + local cur_win = vim.fn.winnr() + -- we can close this window + vim.cmd(string.format("%d wincmd c", cur_win)) + return + end + else + switch_buffer(windows, next_buf) + vim.cmd(string.format("bd! %d", buf)) + end + else + switch_buffer(windows, next_buf) + vim.cmd(string.format("silent! confirm bd %d", buf)) + end + -- revert buffer switches if user has canceled deletion + if vim.fn.buflisted(buf) == 1 then + switch_buffer(windows, buf) + end +end + +-- load config +-- 1st arg = boolean - whether to force reload +-- Modifies _G._NEOVIM_CONFIG global variable +M.load_config = function(reload) + -- only do the stuff below one time, otherwise just return the set config + if _G._NEOVIM_CONFIG_CONTENTS ~= nil and not (reload or false) then + return _G._NEOVIM_CONFIG_CONTENTS + end + + -- these are the table value which will be always prioritiezed to take user config value + local to_replace = { + "['mappings']['plugins']['esc_insertmode']", + "['mappings']['terminal']['esc_termmode']", + "['mappings']['terminal']['esc_hide_termmode']", + } + + local default_config = "core.default_config" + local config_name = vim.g.neovim_user_config or "nvimrc" + local config_file = vim.fn.stdpath "config" .. "/lua/custom/" .. config_name .. ".lua" + + -- unload the modules if force reload + if reload then + package.loaded[default_config or false] = nil + package.loaded[config_name or false] = nil + end + + -- don't enclose in pcall, it better break when default config is faulty + _G._NEOVIM_CONFIG_CONTENTS = require(default_config) + + -- user config is not required to run neovim but a optional + -- Make sure the config doesn't break the whole system if user config is not present or in bad state or not a table + -- print warning texts if user config file is present + -- check if the user config is present + if vim.fn.filereadable(vim.fn.glob(config_file)) == 1 then + local present, config = pcall(require, "custom/" .. config_name) + if present then + -- make sure the returned value is table + if type(config) == "table" then + -- data = require(config_name) + _G._NEOVIM_CONFIG_CONTENTS = require("core.utils").merge_table( + _G._NEOVIM_CONFIG_CONTENTS, + config, + to_replace + ) + else + print("Warning: " .. config_name .. " sourced successfully but did not return a lua table.") + end + else + print("Warning: " .. config_file .. " is present but sourcing failed.") + end + end + return _G._NEOVIM_CONFIG_CONTENTS +end + +M.map = function(mode, keys, cmd, opt) + local options = { noremap = true, silent = true } + if opt then + options = vim.tbl_extend("force", options, opt) + end + + -- all valid modes allowed for mappings + -- :h map-modes + local valid_modes = { + [""] = true, + ["n"] = true, + ["v"] = true, + ["s"] = true, + ["x"] = true, + ["o"] = true, + ["!"] = true, + ["i"] = true, + ["l"] = true, + ["c"] = true, + ["t"] = true, + } + + -- helper function for M.map + -- can gives multiple modes and keys + local function map_wrapper(mode, lhs, rhs, options) + if type(lhs) == "table" then + for _, key in ipairs(lhs) do + map_wrapper(mode, key, rhs, options) + end + else + if type(mode) == "table" then + for _, m in ipairs(mode) do + map_wrapper(m, lhs, rhs, options) + end + else + if valid_modes[mode] and lhs and rhs then + vim.api.nvim_set_keymap(mode, lhs, rhs, options) + else + mode, lhs, rhs = mode or "", lhs or "", rhs or "" + print("Cannot set mapping [ mode = '" .. mode .. "' | key = '" .. lhs .. "' | cmd = '" .. rhs .. "' ]") + end + end + end + end + + map_wrapper(mode, keys, cmd, options) +end + +-- Base code: https://gist.github.com/revolucas/184aec7998a6be5d2f61b984fac1d7f7 +-- Changes over it: preserving table 1 contents and also update with table b, without duplicating +-- 1st arg - base table +-- 2nd arg - table to merge +-- 3rg arg - list of nodes as a table, if the node is found replace the from table2 to result, rather than adding the value +-- e.g: merge_table(t1, t2, { ['mappings']['plugins']['bufferline'] }) +M.merge_table = function(into, from, nodes_to_replace) + -- make sure both are table + if type(into) ~= "table" or type(from) ~= "table" then + return into + end + + local stack, seen = {}, {} + local table1, table2 = into, from + + if type(nodes_to_replace) == "table" then + -- function that will be executed with loadstring + local replace_fn = function(node) + local base_fn = [[ + return function(table1, table2) + local t1, t2 = table1_node or false , table2_node or false + if t1 and t2 then + table1_node = table2_node + end + return table1 + end]] + + -- replace the _node in base_fn to actual given node value + local fn = base_fn:gsub("_node", node) + -- return the function created from the string base_fn + return loadstring(fn)()(table1, table2) + end + + for _, node in ipairs(nodes_to_replace) do + -- pcall() is a poor workaround for if "['mappings']['plugins']['esc_insertmode']" 'plugins' sub-table does not exist + local ok, result = pcall(replace_fn, node) + if ok then + -- if the node is found then replace + table1 = result + end + end + end + + while true do + for k, v in pairs(table2) do + if type(v) == "table" and type(table1[k]) == "table" then + table.insert(stack, { table1[k], table2[k] }) + else + local present = seen[v] or false + if not present then + if type(k) == "number" then + -- add the value to seen table until value is found + -- only do when key is number we just want to append to subtables + -- todo: maybe improve this + + for _, value in pairs(table1) do + if value == v then + present = true + break + end + end + seen[v] = true + if not present then + table1[#table1 + 1] = v + end + else + table1[k] = v + end + end + end + end + if #stack > 0 then + local t = stack[#stack] + table1, table2 = t[1], t[2] + stack[#stack] = nil + else + break + end + end + return into +end + +-- load plugin after entering vim ui +M.packer_lazy_load = function(plugin, timer) + if plugin then + timer = timer or 0 + vim.defer_fn(function() + require("packer").loader(plugin) + end, timer) + end +end + +return M diff --git a/nvim/.config/nvim/lua/custom/configs/lualine.lua b/nvim/.config/nvim/lua/custom/configs/lualine.lua new file mode 100644 index 000000000..0d43994be --- /dev/null +++ b/nvim/.config/nvim/lua/custom/configs/lualine.lua @@ -0,0 +1,162 @@ +-- Dracual config for lualine +-- Author: Wayne Wesley +-- Credit: TheRepoClub +local lualine = require 'lualine' + +-- Color table for highlights +local colors = { + bg = '#283036', + fg = '#e5e9f0', + yellow = '#ffff59', + cyan = '#59fff9', + darkblue = '#081633', + green = '#59ff59', + orange = '#ff9c59', + violet = '#9059ff', + magenta = '#ff59f9', + blue = '#51afef', + red = '#ff5959' +} + +local conditions = { + buffer_not_empty = function() return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 end, + hide_in_width = function() return vim.fn.winwidth(0) > 80 end, + check_git_workspace = function() + local filepath = vim.fn.expand('%:p:h') + local gitdir = vim.fn.finddir('.git', filepath .. ';') + return gitdir and #gitdir > 0 and #gitdir < #filepath + end +} + +-- Config +local config = { + options = { + -- Disable sections and component separators + icons_enabled = true, + theme = 'dracula', + section_separators = {'', ''}, + component_separators = {'', ''}, + disabled_filetypes = {} + }, + sections = { + -- these are to remove the defaults + lualine_a = {'mode'}, + lualine_b = {'bo:filetype'}, + lualine_y = {}, + lualine_z = {}, + -- These will be filled later + lualine_c = {}, + lualine_x = {} + }, + inactive_sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_v = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {} + }, + tabline = {}, +} + +-- Inserts a component in lualine_c at left section +local function ins_left(component) + table.insert(config.sections.lualine_c, component) +end + +-- Inserts a component in lualine_x ot right section +local function ins_right(component) + table.insert(config.sections.lualine_x, component) +end + +ins_left { + function() return '▊' end, + color = {fg = colors.blue}, -- Sets highlighting of component + left_padding = 0 -- We don't need space before this +} + +ins_left { + -- filesize component + function() + local function format_file_size(file) + local size = vim.fn.getfsize(file) + if size <= 0 then return '' end + local sufixes = {'b', 'k', 'm', 'g'} + local i = 1 + while size > 1024 do + size = size / 1024 + i = i + 1 + end + return string.format('%.1f%s', size, sufixes[i]) + end + local file = vim.fn.expand('%:p') + if string.len(file) == 0 then return '' end + return format_file_size(file) + end, + condition = conditions.buffer_not_empty +} + +ins_left { + 'filename', + condition = conditions.buffer_not_empty, + color = {fg = colors.magenta, gui = 'bold'} +} + +ins_left {'location'} + +ins_left {'progress', color = {fg = colors.fg, gui = 'bold'}} + +ins_left { + 'diagnostics', + sources = {'nvim_diagnostic'}, + symbols = {error = ' ', warn = ' ', info = ' '}, + color_error = colors.red, + color_warn = colors.yellow, + color_info = colors.cyan +} + +-- Insert mid section. You can make any number of sections in neovim :) +-- for lualine it's any number greater then 2 +ins_left {function() return '%=' end} + +-- Add components to right sections +ins_right { + 'o:encoding', -- option component same as &encoding in viml + upper = true, -- I'm not sure why it's upper case either ;) + condition = conditions.hide_in_width, + color = {fg = colors.green, gui = 'bold'} +} + +ins_right { + 'fileformat', + upper = true, + icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh + color = {fg = colors.green, gui = 'bold'} +} + +ins_right { + 'branch', + icon = '', + condition = conditions.check_git_workspace, + color = {fg = colors.violet, gui = 'bold'} +} + +ins_right { + 'diff', + -- Is it me or the symbol for modified us really weird + symbols = {added = ' ', modified = ' ', removed = ' '}, + color_added = colors.green, + color_modified = colors.orange, + color_removed = colors.red, + condition = conditions.hide_in_width +} + +ins_right { + function() return '▊' end, + color = {fg = colors.blue}, + right_padding = 0 +} + +-- Now don't forget to initialize lualine +lualine.setup(config) diff --git a/nvim/.config/nvim/lua/custom/configs/startify.lua b/nvim/.config/nvim/lua/custom/configs/startify.lua new file mode 100644 index 000000000..c48b852a8 --- /dev/null +++ b/nvim/.config/nvim/lua/custom/configs/startify.lua @@ -0,0 +1,112 @@ +local g = vim.g +local fn = vim.fn + +g.webdevicons_enable_startify = 1 +g.startify_enable_special = 0 +g.startify_update_oldfiles = 1 +g.startify_files_number = 30 +g.startify_session_autoload = 1 +g.startify_session_persistence = 1 +g.startify_session_dir = '~/.config/nvim/session' +g.startify_session_delete_buffers = 1 +g.startify_change_to_vcs_root = 1 +g.startify_fortune_use_unicode = 1 +g.startify_session_persistence = 1 +g.startify_relative_path = 1 +g.startify_change_to_dir = 1 + +g.startify_custom_header = { + " ██ ", + " ░░ ", + " ███████ █████ ██████ ██ ██ ██ ██████████ ", + " ░░██░░░██ ██░░░██ ██░░░░██░██ ░██░██░░██░░██░░██ ", + " ░██ ░██░███████░██ ░██░░██ ░██ ░██ ░██ ░██ ░██ ", + " ░██ ░██░██░░░░ ░██ ░██ ░░████ ░██ ░██ ░██ ░██ ", + " ███ ░██░░██████░░██████ ░░██ ░██ ███ ░██ ░██ ", + " ░░░ ░░ ░░░░░░ ░░░░░░ ░░ ░░ ░░░ ░░ ░░ ", + " ", + " [ Think NeoVim Author:The-Repo-Club ] ", +} + +g.startify_custom_footer = { + " +-----------------------------------------------+", + " | Think NeoVim ^_^ |", + " | Talk is cheap Show me the code |", + " | |", + " | Github:The-Repo-Club |", + " +-----------------------------------------------+", +} + +local function lsCustomPluginSettingsDir() + local settings_dir = "~/.config/nvim/lua/custom/configs/" + local files = fn.systemlist("find -L ".. settings_dir .." -maxdepth 1 -type f | LC_ALL=C sort | rev | cut -d'/' -f-1 | rev") + local lst = {} + for key, file in pairs(files) do + lst[key] = { line = file, path = (settings_dir..""..file) } + end + return lst +end + +local function lsDefaultPluginSettingsDir() + local settings_dir = "~/.config/nvim/lua/plugins/configs/" + local files = fn.systemlist("find -L ".. settings_dir .." -maxdepth 1 -type f | LC_ALL=C sort | rev | cut -d'/' -f-1 | rev") + local lst = {} + for key, file in pairs(files) do + lst[key] = { line = file, path = (settings_dir..""..file) } + end + return lst +end + +local function lsCustomSettingsDir() + local settings_dir = "~/.config/nvim/lua/custom/" + local files = fn.systemlist("find -L ".. settings_dir .." -maxdepth 1 -type f | LC_ALL=C sort | rev | cut -d'/' -f-1 | rev") + local lst = {} + for key, file in pairs(files) do + lst[key] = { line = file, path = (settings_dir..""..file) } + end + return lst +end + +local function lsDefaultSettingsDir() + local settings_dir = "~/.config/nvim/lua/plugins/" + local files = fn.systemlist("find -L ".. settings_dir .." -maxdepth 1 -type f | LC_ALL=C sort | rev | cut -d'/' -f-1 | rev") + local lst = {} + for key, file in pairs(files) do + lst[key] = { line = file, path = (settings_dir..""..file) } + end + return lst +end + +local function lsGitDir() + local files = fn.systemlist('getfolders -a /mnt/500GB/.gitlabs/') + return fn.map(files, "{'line': v:val, 'path': v:val}") +end + +local function lsAurDir() + local files = fn.systemlist('getfolders -a /mnt/500GB/.aur/') + return fn.map(files, "{'line': v:val, 'path': v:val}") +end + +local function lsPwd() + local files = fn.systemlist('find -L . -maxdepth 1 -type f -printf "%p\n" | LC_ALL=C sort') + return fn.map(files, "{'line': v:val, 'path': v:val}") +end + +g.startify_lists = { + { type = 'sessions', header = {' Recent Sessions'}}, + { type = 'bookmarks', header = {' Bookmarked files'}}, + { type = lsPwd, header = {' Current Directory: '}}, + { type = lsGitDir, header = {' Git projects'}}, + { type = lsAurDir, header = {' AUR projects'}}, + { type = lsCustomPluginSettingsDir, header = {' Custom Plugin Settings: '}}, + { type = lsDefaultPluginSettingsDir, header = {' Default Plugin Settings: '}}, + { type = lsCustomSettingsDir, header = {' Custom Settings: '}}, + { type = lsDefaultSettingsDir, header = {' Default Settings: '}}, + { type = 'files', header = {' Recent files'}}, +} + +g.startify_bookmarks = { + -- { D = '~/documents/' }, + -- { d = '~/downloads/' }, + -- { c = '~/.config/' }, +} diff --git a/nvim/.config/nvim/lua/custom/configs/trim.lua b/nvim/.config/nvim/lua/custom/configs/trim.lua new file mode 100644 index 000000000..973438c0d --- /dev/null +++ b/nvim/.config/nvim/lua/custom/configs/trim.lua @@ -0,0 +1,12 @@ +require('trim').setup({ + -- if you want to ignore markdown file. + -- you can specify filetypes. + disable = {"markdown"}, + + -- if you want to ignore space of top + patterns = { + [[%s/\s\+$//e]], + [[%s/\($\n\s*\)\+\%$//]], + [[%s/\(\n\n\)\n\+/\1/]], + }, +}) diff --git a/nvim/.config/nvim/lua/custom/configs/which-key.lua b/nvim/.config/nvim/lua/custom/configs/which-key.lua new file mode 100644 index 000000000..a5317b268 --- /dev/null +++ b/nvim/.config/nvim/lua/custom/configs/which-key.lua @@ -0,0 +1,5 @@ +require("which-key").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below +} diff --git a/nvim/.config/nvim/lua/custom/init.lua b/nvim/.config/nvim/lua/custom/init.lua new file mode 100644 index 000000000..4cdaf248e --- /dev/null +++ b/nvim/.config/nvim/lua/custom/init.lua @@ -0,0 +1,97 @@ +-- This is where your custom modules and plugins go. +-- See the wiki for a guide on how to extend NeoVim + +local hooks = require "core.hooks" +local status = require("core.utils").load_config().plugins.status + +hooks.add("setup_mappings", function(map) + map("n", "", "za ") + map("n", "oc", ' lua require("core.functions").edit_config() ') +end) + +-- NOTE: To use this, make a copy with `cp example_init.lua init.lua` + +hooks.add("install_plugins", function(use) + use { + "wakatime/vim-wakatime" + } + + use { + "gko/vim-coloresque" + } + + use { + "liuchengxu/vim-clap" + } + + use { + "folke/which-key.nvim", + config = function() + require("custom.configs.which-key") + end + } + use { + "cappyzawa/trim.nvim", + config = function() + require("custom.configs.trim") + end + } + + use { + "nvim-lualine/lualine.nvim", + disable = not status.bufferline, + config = function() + require("custom.configs.lualine") + end + } + + use { + "Minimal-Mistakes/vim", + } + use { + "ap/vim-css-color", + } + use { + "jremmen/vim-ripgrep", + } + use { + "tpope/vim-fugitive", + } + use { + "airblade/vim-gitgutter", + } + use { + "leafgarland/typescript-vim", + } + use { + "vim-utils/vim-man", + } + use { + "lyuts/vim-rtags", + } + use { + "mbbill/undotree", + } + use { + "ctrlpvim/ctrlp.vim", + } + use { + "mhinz/vim-startify", + disable = not status.startify, + config = function() + require("custom.configs.startify") + end + } + use { + "mboughaba/i3config.vim", + } + use { + "The-Repo-Club/Vim_Headers" + } + use { + "The-Repo-Club/Vim_Keys" + } + use{ + "Thyrum/vim-stabs" + } +end) diff --git a/nvim/.config/nvim/lua/custom/nvimrc.lua b/nvim/.config/nvim/lua/custom/nvimrc.lua new file mode 100644 index 000000000..997430ab7 --- /dev/null +++ b/nvim/.config/nvim/lua/custom/nvimrc.lua @@ -0,0 +1,74 @@ +local M = {} +M.options, M.ui, M.mappings, M.plugins = {}, {}, {}, {} + +-- NOTE: To use this, make a copy with `cp example_nvimrc.lua nvimrc.lua` + +-------------------------------------------------------------------- + +-- To use this file, copy the structure of `core/default_config.lua`, +-- examples of setting relative number & changing theme: + +M.options = { + mousdde = "a", + encoding = "UTF-8", + relativenumber = true, + number = true, + linebreak = true, + showbreak = "+++", + textwidth = 0, + showmatch = true, + visualbell = true, + + smartcase = true, + gdefault = true, + ignorecase = true, + nohlsearch = true, + nohlsearch = true, + + autoindent = true, + cindent = true, + noexpandtab = true, + copyindent = true, + preserveindent = true, + expandtab = false, + smartindent = false, + smarttab = false, + shiftwidth = 4, + tabstop = 4, + softtabstop = 4, + -- Advance + + confirm = true, + ruler = true, + noshowmode = true, + noruler = true, + noshowcmd = true, + cmdheight=1, + nowrap = true, + hidden = true, + noswapfile = true, + nobackup = true, + undodir = "~/.config/nvim/undodir", + undofile = true, + scrolloff = 8, + signcolumn = true, + undolevels = 1000, + backspace = { + "indent", + "eol", + "start", + }, + + nocompatible = true, + termguicolors = true, + background = "dark", + +} + +M.plugins = { + options = { + open_command = false, + } +} + +return M diff --git a/nvim/.config/nvim/lua/plugins/configs/bufferline.lua b/nvim/.config/nvim/lua/plugins/configs/bufferline.lua new file mode 100644 index 000000000..f84674b59 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/bufferline.lua @@ -0,0 +1,49 @@ +local colors = require('dracula').colors() + +vim.opt.termguicolors = true +local present, bufferline = pcall(require, "bufferline") +if not present then + return +end + +bufferline.setup { + options = { + numbers = "both", + offsets = { { filetype = "NvimTree", text = "File Explorer", padding = 1 } }, + buffer_close_icon = "", + modified_icon = "", + close_icon = "", + show_close_icon = true, + left_trunc_marker = "", + right_trunc_marker = "", + max_name_length = 14, + max_prefix_length = 13, + tab_size = 20, + show_tab_indicators = true, + enforce_regular_tabs = false, + view = "multiwindow", + show_buffer_close_icons = true, + show_buffer_icons = true, + separator_style = "thin", + always_show_bufferline = true, + diagnostics = false, -- "or nvim_lsp" + custom_filter = function(buf_number) + -- Func to filter out our managed/persistent split terms + local present_type, type = pcall(function() + return vim.api.nvim_buf_get_var(buf_number, "term_type") + end) + + if present_type then + if type == "vert" then + return false + elseif type == "hori" then + return false + else + return true + end + else + return true + end + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/configs/cmp.lua b/nvim/.config/nvim/lua/plugins/configs/cmp.lua new file mode 100644 index 000000000..48245e5e2 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/cmp.lua @@ -0,0 +1,72 @@ +local present, cmp = pcall(require, "cmp") + +if not present then + return +end + +vim.opt.completeopt = "menuone,noselect" + +-- nvim-cmp setup +cmp.setup { + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + formatting = { + format = function(entry, vim_item) + -- load lspkind icons + vim_item.kind = string.format( + "%s %s", + require("plugins.configs.lspkind_icons").icons[vim_item.kind], + vim_item.kind + ) + + vim_item.menu = ({ + nvim_lsp = "[LSP]", + nvim_lua = "[Lua]", + buffer = "[BUF]", + })[entry.source.name] + + return vim_item + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [""] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expand_or_jumpable() then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") + else + fallback() + end + end, + [""] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require("luasnip").jumpable(-1) then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") + else + fallback() + end + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = 'orgmode' }, + { name = "buffer" }, + { name = "nvim_lua" }, + { name = "path" }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/configs/dashboard.lua b/nvim/.config/nvim/lua/plugins/configs/dashboard.lua new file mode 100644 index 000000000..2b8fff72e --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/dashboard.lua @@ -0,0 +1,79 @@ +local home = os.getenv('HOME') +local db = require('dashboard') + +db.session_directory = "~/.config/nvim/session" + +-- linux +db.hide_statusline = 1 +db.hide_tabline = 0 + +db.custom_header = { + " ", + "================= =============== =============== ======== ========", + "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //", + "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||", + "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||", + "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||", + "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||", + "||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||", + "|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||", + "||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||", + "|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||", + "|| `' || || `' || || `' || || | \\ / | ||", + "|| .===' `===. .==='.`===. .===' /==. | \\/ | ||", + "|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||", + "|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||", + "|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||", + "||.==' _-' `' | /==.||", + "==' _-' \\/ `==", + "\\ _-' `-_ /", + " `'' [ Think NeoVim Author:The-Repo-Club ] ``' ", + " " +} + +db.custom_center = { + { + icon = ' ', + desc = 'Find File ', + shortcut = 'SPC d f f' + }, { + icon = ' ', + desc = 'File Browser ', + shortcut = 'SPC d f b' + }, { + icon = ' ', + desc = 'Find Word ', + shortcut = 'SPC d f w' + }, { + icon = '洛 ', + desc = 'File New ', + shortcut = 'SPC d f n' + }, { + icon = ' ', + desc = 'Load Last Session ', + shortcut = 'SPC d l ' + }, { + icon = ' ', + desc = 'Save Session ', + shortcut = 'SPC d s ' + }, { + icon = ' ', + desc = 'Open Private Configuration ', + action = 'lua require("core.functions").edit_config()', + shortcut = 'SPC o c ' + } +} + +db.custom_footer = { + " ", + " ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ", + " ┃ ╔═══════════════════════════════════════╗ ┃ ", + " ┃ ║ Think NeoVim ^_^ ║ ┃ ", + " ┃ ║ ║ ┃ ", + " ┃ ║ Talk is cheap Show us the code. ║ ┃ ", + " ┃ ║ ║ ┃ ", + " ┃ ║ Github:The-Repo-Club ║ ┃ ", + " ┃ ╚═══════════════════════════════════════╝ ┃ ", + " ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ", + " " +} diff --git a/nvim/.config/nvim/lua/plugins/configs/gitsigns.lua b/nvim/.config/nvim/lua/plugins/configs/gitsigns.lua new file mode 100644 index 000000000..6e8e6dc18 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/gitsigns.lua @@ -0,0 +1,34 @@ +local present, gitsigns = pcall(require, "gitsigns") +if not present then + return +end + +gitsigns.setup { + keymaps = { + -- Default keymap options + buffer = true, + noremap = true, + ["n ]c"] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns\".next_hunk()'" }, + ["n [c"] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns\".prev_hunk()'" }, + ["n hs"] = 'lua require"gitsigns".stage_hunk()', + ["n hu"] = 'lua require"gitsigns".undo_stage_hunk()', + ["n hr"] = 'lua require"gitsigns".reset_hunk()', + ["n hp"] = 'lua require"gitsigns".preview_hunk()', + ["n hb"] = 'lua require"gitsigns".blame_line()', + }, + numhl = false, + + sign_priority = 5, + signs = { + add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" }, + change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" }, + changedelete = { hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr" }, + delete = { hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr" }, + topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" }, + }, + + status_formatter = nil, -- Use default + watch_gitdir = { + interval = 100, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/configs/icons.lua b/nvim/.config/nvim/lua/plugins/configs/icons.lua new file mode 100644 index 000000000..fc4e64851 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/icons.lua @@ -0,0 +1,146 @@ +local present, icons = pcall(require, "nvim-web-devicons") +if not present then + return +end + +local colors = require('dracula').colors() + +icons.setup { + override = { + c = { + icon = "", + color = colors.blue, + name = "c", + }, + css = { + icon = "", + color = colors.blue, + name = "css", + }, + deb = { + icon = "", + color = colors.cyan, + name = "deb", + }, + Dockerfile = { + icon = "", + color = colors.cyan, + name = "Dockerfile", + }, + html = { + icon = "", + color = colors.baby_pink, + name = "html", + }, + jpeg = { + icon = "", + color = colors.dark_purple, + name = "jpeg", + }, + jpg = { + icon = "", + color = colors.dark_purple, + name = "jpg", + }, + js = { + icon = "", + color = colors.sun, + name = "js", + }, + kt = { + icon = "󱈙", + color = colors.orange, + name = "kt", + }, + lock = { + icon = "", + color = colors.red, + name = "lock", + }, + lua = { + icon = "", + color = colors.blue, + name = "lua", + }, + mp3 = { + icon = "", + color = colors.white, + name = "mp3", + }, + mp4 = { + icon = "", + color = colors.white, + name = "mp4", + }, + out = { + icon = "", + color = colors.white, + name = "out", + }, + png = { + icon = "", + color = colors.dark_purple, + name = "png", + }, + py = { + icon = "", + color = colors.cyan, + name = "py", + }, + ["robots.txt"] = { + icon = "ﮧ", + color = colors.red, + name = "robots", + }, + toml = { + icon = "", + color = colors.blue, + name = "toml", + }, + ts = { + icon = "ﯤ", + color = colors.teal, + name = "ts", + }, + ttf = { + icon = "", + color = colors.white, + name = "TrueTypeFont", + }, + rb = { + icon = "", + color = colors.pink, + name = "rb", + }, + rpm = { + icon = "", + color = colors.orange, + name = "rpm", + }, + vue = { + icon = "﵂", + color = colors.vibrant_green, + name = "vue", + }, + woff = { + icon = "", + color = colors.white, + name = "WebOpenFontFormat", + }, + woff2 = { + icon = "", + color = colors.white, + name = "WebOpenFontFormat2", + }, + xz = { + icon = "", + color = colors.sun, + name = "xz", + }, + zip = { + icon = "", + color = colors.sun, + name = "zip", + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/configs/lspconfig.lua b/nvim/.config/nvim/lua/plugins/configs/lspconfig.lua new file mode 100644 index 000000000..4bef15db0 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/lspconfig.lua @@ -0,0 +1,103 @@ +local overrides = require("core.hooks").createOverrides "lsp" + +local function on_attach(_, bufnr) + local function buf_set_keymap(...) + vim.api.nvim_buf_set_keymap(bufnr, ...) + end + local function buf_set_option(...) + vim.api.nvim_buf_set_option(bufnr, ...) + end + + -- Enable completion triggered by + buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") + + -- Mappings. + local opts = { noremap = true, silent = true } + + -- See `:help vim.lsp.*` for documentation on any of the below functions + buf_set_keymap("n", "gD", "lua vim.lsp.buf.declaration()", opts) + buf_set_keymap("n", "gd", "lua vim.lsp.buf.definition()", opts) + buf_set_keymap("n", "K", "lua vim.lsp.buf.hover()", opts) + buf_set_keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) + buf_set_keymap("n", "gk", "lua vim.lsp.buf.signature_help()", opts) + buf_set_keymap("n", "wa", "lua vim.lsp.buf.add_workspace_folder()", opts) + buf_set_keymap("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()", opts) + buf_set_keymap("n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts) + buf_set_keymap("n", "D", "lua vim.lsp.buf.type_definition()", opts) + buf_set_keymap("n", "rn", "lua vim.lsp.buf.rename()", opts) + buf_set_keymap("n", "ca", "lua vim.lsp.buf.code_action()", opts) + buf_set_keymap("n", "gr", "lua vim.lsp.buf.references()", opts) + buf_set_keymap("n", "ge", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) + buf_set_keymap("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", opts) + buf_set_keymap("n", "]d", "lua vim.lsp.diagnostic.goto_next()", opts) + buf_set_keymap("n", "q", "lua vim.lsp.diagnostic.set_loclist()", opts) + buf_set_keymap("n", "fm", "lua vim.lsp.buf.formatting()", opts) + buf_set_keymap("v", "ca", "lua vim.lsp.buf.range_code_action()", opts) +end + +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" } +capabilities.textDocument.completion.completionItem.snippetSupport = true +capabilities.textDocument.completion.completionItem.preselectSupport = true +capabilities.textDocument.completion.completionItem.insertReplaceSupport = true +capabilities.textDocument.completion.completionItem.labelDetailsSupport = true +capabilities.textDocument.completion.completionItem.deprecatedSupport = true +capabilities.textDocument.completion.completionItem.commitCharactersSupport = true +capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } +capabilities.textDocument.completion.completionItem.resolveSupport = { + properties = { + "documentation", + "detail", + "additionalTextEdits", + }, +} + +-- replace the default lsp diagnostic symbols +local function lspSymbol(name, icon) + vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefault" .. name }) +end + +lspSymbol("Error", "") +lspSymbol("Information", "") +lspSymbol("Hint", "") +lspSymbol("Warning", "") + +local lsp_publish_diagnostics_options = overrides.get("publish_diagnostics", { + virtual_text = { + prefix = "", + spacing = 0, + }, + signs = true, + underline = true, + update_in_insert = false, -- update diagnostics insert mode +}) +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( +vim.lsp.diagnostic.on_publish_diagnostics, +lsp_publish_diagnostics_options +) +vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "single", +}) +vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = "single", +}) + +-- suppress error messages from lang servers +vim.notify = function(msg, log_level, _opts) + if msg:match "exit code" then + return + end + if log_level == vim.log.levels.ERROR then + vim.api.nvim_err_writeln(msg) + else + vim.api.nvim_echo({ { msg } }, true, {}) + end +end + +-- requires a file containing user's lspconfigs + +local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf + +if string.len(addlsp_confs) ~= 0 then + require(addlsp_confs).setup_lsp(on_attach, capabilities) +end diff --git a/nvim/.config/nvim/lua/plugins/configs/lspkind_icons.lua b/nvim/.config/nvim/lua/plugins/configs/lspkind_icons.lua new file mode 100644 index 000000000..b0b4be1a4 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/lspkind_icons.lua @@ -0,0 +1,31 @@ +local M = {} + +M.icons = { + Text = "", + Method = "", + Function = "", + Constructor = "", + Field = "ﰠ", + Variable = "", + Class = "ﴯ", + Interface = "", + Module = "", + Property = "ﰠ", + Unit = "塞", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "פּ", + Event = "", + Operator = "", + TypeParameter = "", +} + +return M diff --git a/nvim/.config/nvim/lua/plugins/configs/nvimtree.lua b/nvim/.config/nvim/lua/plugins/configs/nvimtree.lua new file mode 100644 index 000000000..c58f2707a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/nvimtree.lua @@ -0,0 +1,82 @@ +local present, nvimtree = pcall(require, "nvim-tree") +local git_status = require("core.utils").load_config().plugins.options.nvimtree.enable_git + +if not present then + return +end + +local g = vim.g + +vim.o.termguicolors = true + +g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names +g.nvim_tree_git_hl = git_status +g.nvim_tree_gitignore = 0 +g.nvim_tree_highlight_opened_files = 0 +g.nvim_tree_indent_markers = 1 +g.nvim_tree_ignore = { ".git", "node_modules", ".cache" } +g.nvim_tree_quit_on_open = 0 -- closes tree when file's opened +g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" } +-- +g.nvim_tree_show_icons = { + folders = 1, + -- folder_arrows= 1 + files = 1, + git = git_status, +} + +g.nvim_tree_icons = { + default = "", + symlink = "", + git = { + deleted = "", + ignored = "◌", + renamed = "➜", + staged = "✓", + unmerged = "", + unstaged = "✗", + untracked = "★", + }, + folder = { + -- disable indent_markers option to get arrows working or if you want both arrows and indent then just add the arrow icons in front ofthe default and opened folders below! + -- arrow_open = "", + -- arrow_closed = "", + default = "", + empty = "", --  + empty_open = "", + open = "", + symlink = "", + symlink_open = "", + }, +} + +nvimtree.setup { + diagnostics = { + enable = false, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + filters = { + dotfiles = false, + }, + disable_netrw = true, + hijack_netrw = true, + ignore_ft_on_setup = { "dashboard" }, + auto_close = false, + open_on_tab = false, + hijack_cursor = true, + update_cwd = true, + update_focused_file = { + enable = true, + update_cwd = false, + }, + view = { + allow_resize = true, + side = "left", + width = 25, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/configs/others.lua b/nvim/.config/nvim/lua/plugins/configs/others.lua new file mode 100644 index 000000000..f292ddb4a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/others.lua @@ -0,0 +1,119 @@ +local M = {} + +local nvimrc_config = require("core.utils").load_config() +M.autopairs = function() + local present1, autopairs = pcall(require, "nvim-autopairs") + local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp") + + if not (present1 or present2) then + return + end + + autopairs.setup() + + -- not needed if you disable cmp, the above var related to cmp tooo! override default config for autopairs + local cmp = require "cmp" + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) +end + +M.better_escape = function() + require("better_escape").setup { + mapping = nvimrc_config.mappings.plugins.better_escape.esc_insertmode, + timeout = nvimrc_config.plugins.options.esc_insertmode_timeout, + } +end + +M.blankline = function() + require("indent_blankline").setup { + indentLine_enabled = 1, + char = "|", + filetype_exclude = { + "help", + "terminal", + "dashboard", + "packer", + "lspinfo", + "TelescopePrompt", + "TelescopeResults", + }, + buftype_exclude = { "terminal" }, + show_trailing_blankline_indent = true, + show_first_indent_level = true, + space_char_blankline = " ", + char_highlight_list = { + "IndentBlanklineIndent1", + "IndentBlanklineIndent2", + "IndentBlanklineIndent3", + "IndentBlanklineIndent4", + "IndentBlanklineIndent5", + "IndentBlanklineIndent6", + }, + } +end + +M.colorizer = function() + local present, colorizer = pcall(require, "colorizer") + if present then + colorizer.setup({ "*" }, { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = false, -- "Name" codes like Blue + RRGGBBAA = false, -- #RRGGBBAA hex codes + rgb_fn = false, -- CSS rgb() and rgba() functions + hsl_fn = false, -- CSS hsl() and hsla() functions + css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn + + -- Available modes: foreground, background + mode = "background", -- Set the display mode. + }) + vim.cmd "ColorizerReloadAllBuffers" + end +end + +M.comment = function() + local present, nvim_comment = pcall(require, "nvim_comment") + if present then + nvim_comment.setup() + end +end + +M.luasnip = function() + local present, luasnip = pcall(require, "luasnip") + if not present then + return + end + + luasnip.config.set_config { + history = true, + updateevents = "TextChanged,TextChangedI", + } + + require("luasnip/loaders/from_vscode").load { paths = nvimrc_config.plugins.options.luasnip.snippet_path } + require("luasnip/loaders/from_vscode").load() +end + +M.signature = function() + local present, lspsignature = pcall(require, "lsp_signature") + if present then + lspsignature.setup { + bind = true, + doc_lines = 0, + floating_window = true, + fix_pos = true, + hint_enable = true, + hint_prefix = " ", + hint_scheme = "String", + hi_parameter = "Search", + max_height = 22, + max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width + handler_opts = { + border = "single", -- double, single, shadow, none + }, + zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom + padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc + } + end +end + +return M diff --git a/nvim/.config/nvim/lua/plugins/configs/telescope.lua b/nvim/.config/nvim/lua/plugins/configs/telescope.lua new file mode 100644 index 000000000..9af0e168d --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/telescope.lua @@ -0,0 +1,82 @@ +local present, telescope = pcall(require, "telescope") +if not present then return end + +telescope.setup { + defaults = { + vimgrep_arguments = { + "rg", "--color=never", "--no-heading", "--with-filename", + "--line-number", "--column", "--smart-case" + }, + prompt_prefix = "  ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + preview_width = 0.55, + results_width = 0.8 + }, + vertical = {mirror = false}, + width = 0.87, + height = 0.80, + preview_cutoff = 120 + }, + file_sorter = require("telescope.sorters").get_fuzzy_file, + file_ignore_patterns = {"node_modules"}, + generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + path_display = {"absolute"}, + winblend = 0, + border = {}, + borderchars = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"}, + color_devicons = true, + use_less = true, + set_env = {["COLORTERM"] = "truecolor"}, -- default = nil, + file_previewer = require("telescope.previewers").vim_buffer_cat.new, + grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker + }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = false, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case" -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + }, + media_files = { + filetypes = {"png", "webp", "jpg", "jpeg"}, + find_cmd = "rg" -- find command (defaults to `fd`) + }, + file_browser = { + theme = "dracula", + -- disables netrw and use telescope-file-browser in its place + hijack_netrw = true, + mappings = { + ["i"] = { + -- your custom insert mode mappings + }, + ["n"] = { + -- your custom normal mode mappings + } + } + } + } +} + +local extensions = {"themes", "terms", "fzf"} +local packer_repos = [["extensions", "telescope-fzf-native.nvim", "telescope-file-browser.nvim"]] + +if vim.fn.executable "ueberzug" == 1 then + table.insert(extensions, "media_files") + packer_repos = packer_repos .. ', "telescope-media-files.nvim"' +end + +pcall(function() + for _, ext in ipairs(extensions) do telescope.load_extension(ext) end +end) diff --git a/nvim/.config/nvim/lua/plugins/configs/treesitter.lua b/nvim/.config/nvim/lua/plugins/configs/treesitter.lua new file mode 100644 index 000000000..10e42afb8 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/configs/treesitter.lua @@ -0,0 +1,32 @@ +local present, ts_config = pcall(require, "nvim-treesitter.configs") +if not present then + return +end + +local parser_config = require "nvim-treesitter.parsers".get_parser_configs() + +parser_config.org = { + install_info = { + url = 'https://github.com/milisims/tree-sitter-org', + revision = 'f110024d539e676f25b72b7c80b0fd43c34264ef', + files = {'src/parser.c', 'src/scanner.cc'}, + }, + filetype = 'org', +} + +ts_config.setup { + ensure_installed = { + "lua", + "org", + "haskell", + "cpp", + "c", + "javascript", + "markdown" + }, + highlight = { + enable = true, + use_languagetree = true, + additional_vim_regex_highlighting = {'org'}, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/init.lua b/nvim/.config/nvim/lua/plugins/init.lua new file mode 100644 index 000000000..47cc96c2b --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/init.lua @@ -0,0 +1,270 @@ +local present, packer = pcall(require, "plugins.packerInit") + +if not present then + return false +end + +local use = packer.use + +return packer.startup(function() + local status = require("core.utils").load_config().plugins.status + + -- FUNCTION: override_req, use `nvimrc` plugin config override if present + -- name = name inside `default_config` / `nvimrc` + -- default_req = run this if 'name' does not exist in `default_config` / `nvimrc` + -- if override or default_req start with `(`, then strip that and assume override calls a function, not a whole file + local override_req = function(name, default_req) + local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name] + local result + + if override == nil then + result = default_req + else + result = override + end + + if string.match(result, "^%(") then + result = result:sub(2) + result = result:gsub("%)%.", "').", 1) + return "require('" .. result + else + return "require('" .. result .. "')" + end + end + + -- this is arranged on the basis of when a plugin starts + + + + use { + "wbthomason/packer.nvim", + event = "VimEnter", + } + + -- this is the neovim core repo containing utilities for some features like theme swticher, no need to lazy load + use { + "nvim-lua/plenary.nvim", + } + + use { + "Mofiqul/dracula.nvim", + after = "packer.nvim", + } + + use { + "kyazdani42/nvim-web-devicons", + after = "packer.nvim", + config = override_req("nvim_web_devicons", "plugins.configs.icons"), + } + + use { + "akinsho/bufferline.nvim", + disable = not status.bufferline, + after = "nvim-web-devicons", + config = override_req("bufferline", "plugins.configs.bufferline"), + setup = function() + require("core.mappings").bufferline() + end, + } + + use { + "lukas-reineke/indent-blankline.nvim", + disable = not status.blankline, + event = "BufRead", + config = override_req("indent_blankline", "(plugins.configs.others).blankline()"), + } + + use { + "norcalli/nvim-colorizer.lua", + disable = not status.colorizer, + event = "BufRead", + config = override_req("nvim_colorizer", "(plugins.configs.others).colorizer()"), + } + + use { + "nvim-treesitter/nvim-treesitter", + branch = "master", + event = "BufRead", + config = override_req("nvim_treesitter", "plugins.configs.treesitter"), + } + + -- git stuff + use { + "lewis6991/gitsigns.nvim", + disable = not status.gitsigns, + opt = true, + config = override_req("gitsigns", "plugins.configs.gitsigns"), + setup = function() + require("core.utils").packer_lazy_load "gitsigns.nvim" + end, + } + + -- lsp stuff + + use { + "neovim/nvim-lspconfig", + opt = true, + setup = function() + require("core.utils").packer_lazy_load "nvim-lspconfig" + -- reload the current file so lsp actually starts for it + vim.defer_fn(function() + vim.cmd 'if &ft == "packer" | echo "" | else | silent! e %' + end, 0) + end, + config = override_req("lspconfig", "plugins.configs.lspconfig"), + } + + use { + "ray-x/lsp_signature.nvim", + disable = not status.lspsignature, + after = "nvim-lspconfig", + config = override_req("signature", "(plugins.configs.others).signature()"), + } + + use { + "andymass/vim-matchup", + disable = not status.vim_matchup, + opt = true, + setup = function() + require("core.utils").packer_lazy_load "vim-matchup" + end, + } + + use { + "max397574/better-escape.nvim", + disable = not status.esc_insertmode, + event = "InsertEnter", + config = override_req("better_escape", "(plugins.configs.others).better_escape()"), + } + + -- load luasnips + cmp related in insert mode only + + use { + "rafamadriz/friendly-snippets", + disable = not status.cmp, + event = "InsertEnter", + } + + use { + "L3MON4D3/LuaSnip", + disable = not status.cmp, + wants = "friendly-snippets", + after = "nvim-cmp", + config = override_req("luasnip", "(plugins.configs.others).luasnip()"), + } + + use { + "saadparwaiz1/cmp_luasnip", + disable = not status.cmp, + after = "LuaSnip", + } + + use { + "hrsh7th/cmp-nvim-lua", + disable = not status.cmp, + after = "cmp_luasnip", + } + + use { + "hrsh7th/cmp-nvim-lsp", + disable = not status.cmp, + after = "cmp-nvim-lua", + } + + use { + "hrsh7th/cmp-buffer", + disable = not status.cmp, + after = "cmp-nvim-lsp", + } + + use { + "hrsh7th/cmp-path", + disable = not status.cmp, + after = "cmp-buffer", + } + + use { + "hrsh7th/cmp-cmdline", + disable = not status.cmp, + after = "cmp-path", + } + + use { + "hrsh7th/nvim-cmp", + disable = not status.cmp, + after = "cmp-path", + config = override_req("nvim_cmp", "plugins.configs.cmp"), + } + -- misc plugins + use { + "windwp/nvim-autopairs", + disable = not status.autopairs, + after = "nvim-cmp", + config = override_req("nvim_autopairs", "(plugins.configs.others).autopairs()"), + } + + use { + "glepnir/dashboard-nvim", + disable = not status.dashboard, + config = override_req("dashboard", "plugins.configs.dashboard"), + setup = function() + require("core.mappings").dashboard() + end, + } + + use { + "junegunn/fzf.vim", + disable = not status.clap, + after = "dashboard-nvim", + } + + use { + "terrortylor/nvim-comment", + disable = not status.comment, + cmd = "CommentToggle", + config = override_req("nvim_comment", "(plugins.configs.others).comment()"), + setup = function() + require("core.mappings").comment() + end, + } + + -- file managing , picker etc + use { + "kyazdani42/nvim-tree.lua", + disable = not status.nvimtree, + cmd = { "NvimTreeToggle", "NvimTreeFocus" }, + config = override_req("nvim_tree", "plugins.configs.nvimtree"), + setup = function() + require("core.mappings").nvimtree() + end, + } + + use { + "nvim-telescope/telescope.nvim", + module = "telescope", + cmd = "Telescope", + requires = { + { + "nvim-telescope/telescope-fzf-native.nvim", + run = "make", + }, + { + "nvim-telescope/telescope-file-browser.nvim", + run = "make", + }, + { + "nvim-telescope/telescope-media-files.nvim", + disable = not status.telescope_media, + setup = function() + require("core.mappings").telescope_media() + end, + }, + }, + config = override_req("telescope", "plugins.configs.telescope"), + setup = function() + require("core.mappings").telescope() + end, + } + + require("core.hooks").run("install_plugins", use) +end) diff --git a/nvim/.config/nvim/lua/plugins/packerInit.lua b/nvim/.config/nvim/lua/plugins/packerInit.lua new file mode 100644 index 000000000..bbb3c6194 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/packerInit.lua @@ -0,0 +1,47 @@ +local cmd = vim.cmd + +cmd "packadd packer.nvim" + +local present, packer = pcall(require, "packer") + +if not present then + local packer_path = vim.fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim" + + print "Cloning packer.." + -- remove the dir before cloning + vim.fn.delete(packer_path, "rf") + vim.fn.system { + "git", + "clone", + "https://github.com/wbthomason/packer.nvim", + "--depth", + "20", + packer_path, + } + + cmd "packadd packer.nvim" + present, packer = pcall(require, "packer") + + if present then + print "Packer cloned successfully." + else + error("Couldn't clone packer !\nPacker path: " .. packer_path .. "\n" .. packer) + end +end + +packer.init { + display = { + open_fn = function() + return require("packer.util").float { border = "single" } + end, + prompt_border = "single", + }, + git = { + clone_timeout = 600, -- Timeout, in seconds, for git clones + }, + auto_clean = true, + compile_on_sync = true, + -- auto_reload_compiled = true +} + +return packer diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua new file mode 100644 index 000000000..7068c3f01 --- /dev/null +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -0,0 +1,539 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + + local time + local profile_info + local should_profile = false + if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end + else + time = function(chunk, start) end + end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + + _G._packer = _G._packer or {} + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/repo/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/repo/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/repo/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/repo/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/repo/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + LuaSnip = { + after = { "cmp_luasnip" }, + config = { "require('plugins.configs.others').luasnip()" }, + load_after = {}, + loaded = true, + needs_bufread = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip", + wants = { "friendly-snippets" } + }, + Vim_Headers = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/Vim_Headers", + url = "https://github.com/The-Repo-Club/Vim_Headers" + }, + Vim_Keys = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/Vim_Keys", + url = "https://github.com/The-Repo-Club/Vim_Keys" + }, + ["better-escape.nvim"] = { + config = { "require('plugins.configs.others').better_escape()" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/better-escape.nvim", + url = "https://github.com/max397574/better-escape.nvim" + }, + ["bufferline.nvim"] = { + config = { "require('plugins.configs.bufferline')" }, + load_after = { + ["nvim-web-devicons"] = true + }, + loaded = false, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/bufferline.nvim", + url = "https://github.com/akinsho/bufferline.nvim" + }, + ["cmp-buffer"] = { + after = { "cmp-path" }, + after_files = { "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp-buffer/after/plugin/cmp_buffer.lua" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-cmdline"] = { + after_files = { "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp-cmdline/after/plugin/cmp_cmdline.lua" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp-cmdline", + url = "https://github.com/hrsh7th/cmp-cmdline" + }, + ["cmp-nvim-lsp"] = { + after = { "cmp-buffer" }, + after_files = { "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp/after/plugin/cmp_nvim_lsp.lua" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-nvim-lua"] = { + after = { "cmp-nvim-lsp" }, + after_files = { "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lua/after/plugin/cmp_nvim_lua.lua" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lua", + url = "https://github.com/hrsh7th/cmp-nvim-lua" + }, + ["cmp-path"] = { + after = { "nvim-cmp", "cmp-cmdline" }, + after_files = { "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp-path/after/plugin/cmp_path.lua" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + cmp_luasnip = { + after = { "cmp-nvim-lua" }, + after_files = { "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp_luasnip/after/plugin/cmp_luasnip.lua" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/cmp_luasnip", + url = "https://github.com/saadparwaiz1/cmp_luasnip" + }, + ["ctrlp.vim"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/ctrlp.vim", + url = "https://github.com/ctrlpvim/ctrlp.vim" + }, + ["dashboard-nvim"] = { + after = { "fzf.vim" }, + config = { "require('plugins.configs.dashboard')" }, + loaded = true, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/dashboard-nvim", + url = "https://github.com/glepnir/dashboard-nvim" + }, + ["dracula.nvim"] = { + load_after = { + ["packer.nvim"] = true + }, + loaded = false, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/dracula.nvim", + url = "https://github.com/Mofiqul/dracula.nvim" + }, + ["friendly-snippets"] = { + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/friendly-snippets", + url = "https://github.com/rafamadriz/friendly-snippets" + }, + ["fzf.vim"] = { + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/fzf.vim", + url = "https://github.com/junegunn/fzf.vim" + }, + ["gitsigns.nvim"] = { + config = { "require('plugins.configs.gitsigns')" }, + loaded = false, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/gitsigns.nvim", + url = "https://github.com/lewis6991/gitsigns.nvim" + }, + ["i3config.vim"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/i3config.vim", + url = "https://github.com/mboughaba/i3config.vim" + }, + ["indent-blankline.nvim"] = { + config = { "require('plugins.configs.others').blankline()" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/indent-blankline.nvim", + url = "https://github.com/lukas-reineke/indent-blankline.nvim" + }, + ["lsp_signature.nvim"] = { + config = { "require('plugins.configs.others').signature()" }, + load_after = { + ["nvim-lspconfig"] = true + }, + loaded = false, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/lsp_signature.nvim", + url = "https://github.com/ray-x/lsp_signature.nvim" + }, + ["lualine.nvim"] = { + config = { "\27LJ\2\n6\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\27custom.configs.lualine\frequire\0" }, + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/lualine.nvim", + url = "https://github.com/nvim-lualine/lualine.nvim" + }, + ["nvim-autopairs"] = { + config = { "require('plugins.configs.others').autopairs()" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/nvim-autopairs", + url = "https://github.com/windwp/nvim-autopairs" + }, + ["nvim-cmp"] = { + after = { "LuaSnip", "nvim-autopairs" }, + config = { "require('plugins.configs.cmp')" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-comment"] = { + commands = { "CommentToggle" }, + config = { "require('plugins.configs.others').comment()" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/nvim-comment", + url = "https://github.com/terrortylor/nvim-comment" + }, + ["nvim-lspconfig"] = { + after = { "lsp_signature.nvim" }, + config = { "require('plugins.configs.lspconfig')" }, + loaded = false, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-tree.lua"] = { + commands = { "NvimTreeToggle", "NvimTreeFocus" }, + config = { "require('plugins.configs.nvimtree')" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua", + url = "https://github.com/kyazdani42/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + config = { "require('plugins.configs.treesitter')" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-web-devicons"] = { + after = { "bufferline.nvim" }, + config = { "require('plugins.configs.icons')" }, + load_after = { + ["packer.nvim"] = true + }, + loaded = false, + needs_bufread = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, + ["packer.nvim"] = { + after = { "dracula.nvim", "nvim-web-devicons" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["telescope-file-browser.nvim"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/telescope-file-browser.nvim", + url = "https://github.com/nvim-telescope/telescope-file-browser.nvim" + }, + ["telescope-fzf-native.nvim"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim", + url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim" + }, + ["telescope.nvim"] = { + commands = { "Telescope" }, + config = { "require('plugins.configs.telescope')" }, + loaded = false, + needs_bufread = true, + only_cond = false, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["trim.nvim"] = { + config = { "\27LJ\2\n3\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\24custom.configs.trim\frequire\0" }, + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/trim.nvim", + url = "https://github.com/cappyzawa/trim.nvim" + }, + ["typescript-vim"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/typescript-vim", + url = "https://github.com/leafgarland/typescript-vim" + }, + undotree = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/undotree", + url = "https://github.com/mbbill/undotree" + }, + vim = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim", + url = "https://github.com/Minimal-Mistakes/vim" + }, + ["vim-clap"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim-clap", + url = "https://github.com/liuchengxu/vim-clap" + }, + ["vim-coloresque"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim-coloresque", + url = "https://github.com/gko/vim-coloresque" + }, + ["vim-css-color"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim-css-color", + url = "https://github.com/ap/vim-css-color" + }, + ["vim-fugitive"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim-fugitive", + url = "https://github.com/tpope/vim-fugitive" + }, + ["vim-gitgutter"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim-gitgutter", + url = "https://github.com/airblade/vim-gitgutter" + }, + ["vim-man"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim-man", + url = "https://github.com/vim-utils/vim-man" + }, + ["vim-matchup"] = { + after_files = { "/home/repo/.local/share/nvim/site/pack/packer/opt/vim-matchup/after/plugin/matchit.vim" }, + loaded = false, + needs_bufread = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/opt/vim-matchup", + url = "https://github.com/andymass/vim-matchup" + }, + ["vim-ripgrep"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim-ripgrep", + url = "https://github.com/jremmen/vim-ripgrep" + }, + ["vim-rtags"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim-rtags", + url = "https://github.com/lyuts/vim-rtags" + }, + ["vim-stabs"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim-stabs", + url = "https://github.com/Thyrum/vim-stabs" + }, + ["vim-wakatime"] = { + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/vim-wakatime", + url = "https://github.com/wakatime/vim-wakatime" + }, + ["which-key.nvim"] = { + config = { "\27LJ\2\n8\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\29custom.configs.which-key\frequire\0" }, + loaded = true, + path = "/home/repo/.local/share/nvim/site/pack/packer/start/which-key.nvim", + url = "https://github.com/folke/which-key.nvim" + } +} + +time([[Defining packer_plugins]], false) +local module_lazy_loads = { + ["^telescope"] = "telescope.nvim" +} +local lazy_load_called = {['packer.load'] = true} +local function lazy_load_module(module_name) + local to_load = {} + if lazy_load_called[module_name] then return nil end + lazy_load_called[module_name] = true + for module_pat, plugin_name in pairs(module_lazy_loads) do + if not _G.packer_plugins[plugin_name].loaded and string.match(module_name, module_pat) then + to_load[#to_load + 1] = plugin_name + end + end + + if #to_load > 0 then + require('packer.load')(to_load, {module = module_name}, _G.packer_plugins) + local loaded_mod = package.loaded[module_name] + if loaded_mod then + return function(modname) return loaded_mod end + end + end +end + +if not vim.g.packer_custom_loader_enabled then + table.insert(package.loaders, 1, lazy_load_module) + vim.g.packer_custom_loader_enabled = true +end + +-- Setup for: telescope.nvim +time([[Setup for telescope.nvim]], true) +try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\14telescope\18core.mappings\frequire\0", "setup", "telescope.nvim") +time([[Setup for telescope.nvim]], false) +-- Setup for: nvim-lspconfig +time([[Setup for nvim-lspconfig]], true) +try_loadstring("\27LJ\2\nU\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0006if &ft == \"packer\" | echo \"\" | else | silent! e %\bcmd\bvimx\1\0\4\0\a\0\f6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\0016\0\4\0009\0\5\0003\2\6\0)\3\0\0B\0\3\1K\0\1\0\0\rdefer_fn\bvim\19nvim-lspconfig\21packer_lazy_load\15core.utils\frequire\0", "setup", "nvim-lspconfig") +time([[Setup for nvim-lspconfig]], false) +-- Setup for: dashboard-nvim +time([[Setup for dashboard-nvim]], true) +try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\14dashboard\18core.mappings\frequire\0", "setup", "dashboard-nvim") +time([[Setup for dashboard-nvim]], false) +time([[packadd for dashboard-nvim]], true) +vim.cmd [[packadd dashboard-nvim]] +time([[packadd for dashboard-nvim]], false) +-- Setup for: vim-matchup +time([[Setup for vim-matchup]], true) +try_loadstring("\27LJ\2\nS\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\1K\0\1\0\16vim-matchup\21packer_lazy_load\15core.utils\frequire\0", "setup", "vim-matchup") +time([[Setup for vim-matchup]], false) +-- Setup for: nvim-tree.lua +time([[Setup for nvim-tree.lua]], true) +try_loadstring("\27LJ\2\n>\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\rnvimtree\18core.mappings\frequire\0", "setup", "nvim-tree.lua") +time([[Setup for nvim-tree.lua]], false) +-- Setup for: nvim-comment +time([[Setup for nvim-comment]], true) +try_loadstring("\27LJ\2\n=\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\fcomment\18core.mappings\frequire\0", "setup", "nvim-comment") +time([[Setup for nvim-comment]], false) +-- Setup for: bufferline.nvim +time([[Setup for bufferline.nvim]], true) +try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\15bufferline\18core.mappings\frequire\0", "setup", "bufferline.nvim") +time([[Setup for bufferline.nvim]], false) +-- Setup for: gitsigns.nvim +time([[Setup for gitsigns.nvim]], true) +try_loadstring("\27LJ\2\nU\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\1K\0\1\0\18gitsigns.nvim\21packer_lazy_load\15core.utils\frequire\0", "setup", "gitsigns.nvim") +time([[Setup for gitsigns.nvim]], false) +-- Config for: lualine.nvim +time([[Config for lualine.nvim]], true) +try_loadstring("\27LJ\2\n6\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\27custom.configs.lualine\frequire\0", "config", "lualine.nvim") +time([[Config for lualine.nvim]], false) +-- Config for: trim.nvim +time([[Config for trim.nvim]], true) +try_loadstring("\27LJ\2\n3\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\24custom.configs.trim\frequire\0", "config", "trim.nvim") +time([[Config for trim.nvim]], false) +-- Config for: dashboard-nvim +time([[Config for dashboard-nvim]], true) +require('plugins.configs.dashboard') +time([[Config for dashboard-nvim]], false) +-- Config for: which-key.nvim +time([[Config for which-key.nvim]], true) +try_loadstring("\27LJ\2\n8\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\29custom.configs.which-key\frequire\0", "config", "which-key.nvim") +time([[Config for which-key.nvim]], false) +-- Load plugins in order defined by `after` +time([[Sequenced loading]], true) +vim.cmd [[ packadd fzf.vim ]] +vim.cmd [[ packadd nvim-cmp ]] +-- Config for: nvim-cmp +require('plugins.configs.cmp') +vim.cmd [[ packadd cmp-buffer ]] +vim.cmd [[ packadd cmp-path ]] +vim.cmd [[ packadd nvim-autopairs ]] +-- Config for: nvim-autopairs +require('plugins.configs.others').autopairs() +vim.cmd [[ packadd LuaSnip ]] +-- Config for: LuaSnip +require('plugins.configs.others').luasnip() +vim.cmd [[ packadd cmp-cmdline ]] +vim.cmd [[ packadd cmp_luasnip ]] +vim.cmd [[ packadd cmp-nvim-lsp ]] +vim.cmd [[ packadd cmp-nvim-lua ]] +time([[Sequenced loading]], false) + +-- Command lazy-loads +time([[Defining lazy-load commands]], true) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file NvimTreeToggle lua require("packer.load")({'nvim-tree.lua'}, { cmd = "NvimTreeToggle", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file CommentToggle lua require("packer.load")({'nvim-comment'}, { cmd = "CommentToggle", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file NvimTreeFocus lua require("packer.load")({'nvim-tree.lua'}, { cmd = "NvimTreeFocus", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Telescope lua require("packer.load")({'telescope.nvim'}, { cmd = "Telescope", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +time([[Defining lazy-load commands]], false) + +vim.cmd [[augroup packer_load_aucmds]] +vim.cmd [[au!]] + -- Event lazy-loads +time([[Defining lazy-load event autocommands]], true) +vim.cmd [[au VimEnter * ++once lua require("packer.load")({'packer.nvim'}, { event = "VimEnter *" }, _G.packer_plugins)]] +vim.cmd [[au InsertEnter * ++once lua require("packer.load")({'better-escape.nvim', 'friendly-snippets'}, { event = "InsertEnter *" }, _G.packer_plugins)]] +vim.cmd [[au BufRead * ++once lua require("packer.load")({'nvim-treesitter', 'indent-blankline.nvim'}, { event = "BufRead *" }, _G.packer_plugins)]] +time([[Defining lazy-load event autocommands]], false) +vim.cmd("augroup END") +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end