aboutsummaryrefslogblamecommitdiff
path: root/.config/nvim/lua/plugins.lua
blob: 11b0b3d02f9aedc29dccbd930beba6956e13a9f9 (plain) (tree)
1
2
3
4
5
6
7
8
9





                                                                        
                                                               

                                                                    






                                                                         
                                                                
                                                             

                                                                  
                                                           
                                                           
                                                                







                                                                               
                                                                               

                                                                       
                                                               




                                                                 


                                                                 
                                                                       





                                                                         

                                                                   













                                                                 

                                                                        
                                                             
                                                                    
                                                                             
                                                                   

                                                                       

                                                                              
                                                                  

                                                                 
                                                                 

                                                                           
                                                                 
                                                                     
                                                                 
                                                                    





                                                                        
                                                                  

 

                                  

                                                           












                                                                         


                                                           
                                            














                                                                                          
 

                 







                                
         













                                                                                        
 
                                  










                                                                                           
 
                                    


                                          




                                                                      
 
                          


                                              

          




                                                                                                      
                     


                                                                               

         

                                                 
 
                                      







                                     

                                    

                                     




                                                                        
          








































                                                                                                                       
 

                               























                                                                                                
          
 
                        

























                                                                                               

         
                     







                                                                                                   

                                                                                       












                                                                                                     
                                                                   












































                                                                                                                   



                                                      

























                                                          


                        








                                                                                                            
                                                               
                                                                                                                        
                                                                             





                                             
          
























                                                                               






                                      
local PKGS = {
	-- Plugin manager
	{ url = "https://github.com/savq/paq-nvim.git" };

	-- Common
	{ url = "https://github.com/kyazdani42/nvim-web-devicons.git" };
	{ url = "https://github.com/ojroques/nvim-osc52.git" };
	{ url = "https://github.com/chrisgrieser/nvim-spider.git" };
	{ url = "https://github.com/nvim-orgmode/orgmode.git" };

	{ url = "https://github.com/kyazdani42/nvim-tree.lua.git" };
	{ url = "https://github.com/nvim-telescope/telescope.nvim.git" };
	{ url = "https://github.com/nvim-lua/plenary.nvim.git" };
	{ url = "https://github.com/kevinhwang91/nvim-ufo.git" };
	{ url = "https://github.com/kevinhwang91/promise-async.git" };
	{ url = "https://github.com/iamcco/markdown-preview.nvim.git" };
	{ url = "https://github.com/folke/which-key.nvim.git" };
	{ url = "https://github.com/tpope/vim-abolish.git" };
	{ url = "https://github.com/mg979/vim-visual-multi.git" };
	{ url = "https://github.com/echasnovski/mini.nvim.git" };
	{ url = "https://github.com/catppuccin/nvim.git" };
	{ url = "https://github.com/mbbill/undotree.git" };
	{ url = "https://github.com/chentoast/marks.nvim.git" };

	-- Status line
	{ url = "https://github.com/akinsho/bufferline.nvim.git" };
	{ url = "https://github.com/nvim-lualine/lualine.nvim.git" };

	-- Code colors
	{ url = "https://github.com/lukas-reineke/indent-blankline.nvim.git" };
	{ url = "https://github.com/nvim-treesitter/nvim-treesitter.git" };
	{ url = "https://github.com/nvim-treesitter/nvim-treesitter-context" };
	{ url = "https://github.com/norcalli/nvim-colorizer.lua.git" };
	{ url = "https://github.com/mracos/mermaid.vim.git" };
	{ url = "https://github.com/jlcrochet/vim-razor.git" };

	-- Themes
	{ url = "https://github.com/dracula/vim.git" };
	{ url = "https://github.com/folke/tokyonight.nvim.git" };
	{ url = "https://github.com/Mofiqul/vscode.nvim.git" };
	{ url = "https://github.com/sainnhe/sonokai.git" };
	{ url = "https://github.com/navarasu/onedark.nvim.git" };
	{ url = "https://github.com/Mofiqul/adwaita.nvim.git" };
	{ url = "https://github.com/projekt0n/github-nvim-theme.git" };

	-- LCOV Coverage
	{ url = "https://github.com/google/vim-coverage.git" };
	{ url = "https://github.com/google/vim-maktaba.git" };

	{ url = "https://github.com/editorconfig/editorconfig-vim.git" };
	-- Some bugs when opening shell files
	-- { url = "https://github.com/nathom/filetype.nvim.git" };
	{ url = "https://github.com/wfxr/minimap.vim.git" };

	-- LSP
	{ url = "https://github.com/neovim/nvim-lspconfig.git" };
	{ url = "https://github.com/hrsh7th/nvim-cmp.git" };
	{ url = "https://github.com/hrsh7th/cmp-nvim-lsp.git" };
	{ url = "https://github.com/hrsh7th/cmp-buffer.git" };
	{ url = "https://github.com/hrsh7th/cmp-path.git" };
	{ url = "https://github.com/hrsh7th/cmp-cmdline.git" };
	{ url = "https://github.com/hrsh7th/cmp-vsnip.git" };
	{ url = "https://github.com/hrsh7th/vim-vsnip.git" };
	{ url = "https://github.com/onsails/lspkind.nvim.git" };
	{ url = "https://github.com/folke/trouble.nvim.git" };
	{ url = "https://github.com/folke/lsp-colors.nvim.git" };
	{ url = "https://github.com/nanotee/sqls.nvim.git" };
	{ url = "https://github.com/lvimuser/lsp-inlayhints.nvim.git" };
	{ url = "https://github.com/sigmaSd/deno-nvim.git" };
	{ url = "https://github.com/ray-x/lsp_signature.nvim.git" };
	{ url = "https://github.com/Hoffs/omnisharp-extended-lsp.nvim.git" };
	{ url = "https://github.com/lewis6991/gitsigns.nvim.git" };
	{ url = "https://github.com/jacobsimpson/nvim-mercurial.git" };

	-- Deprecated
	-- { url = "https://github.com/jose-elias-alvarez/null-ls.nvim.git" };
	{ url = "https://github.com/nvimtools/none-ls.nvim.git" };
	{ url = "https://github.com/mfussenegger/nvim-dap.git" };
	{ url = "https://github.com/rcarriga/nvim-dap-ui.git" };
	{ url = "https://github.com/nvim-neotest/nvim-nio.git" };
	{ url = "https://github.com/antoinemadec/FixCursorHold.nvim.git" };
	{ url = "https://github.com/nvim-neotest/neotest.git" };
	{ url = "https://github.com/nvim-neotest/nvim-nio.git" };
	{ url = "https://github.com/Issafalcon/neotest-dotnet.git" };
	{ url = "https://github.com/VidocqH/lsp-lens.nvim.git" };
	{ url = "https://github.com/simrat39/rust-tools.nvim.git" };

	-- Dev container
	{ url = "https://codeberg.org/esensar/nvim-dev-container.git" };

	-- Games
	{ url = "https://github.com/alec-gibson/nvim-tetris.git" };
	{ url = "https://github.com/seandewar/nvimesweeper.git" };
}

local function init_plugins()
	local paq = require("paq")
	local indent_blankline = require("ibl")
	local indent_blankline_hooks = require("ibl.hooks")
	local colorizer = require("colorizer")
	local ufo = require("ufo")
	local catppuccin = require("catppuccin")
	local osc52 = require("osc52")
	local devcontainer = require("devcontainer")
	local whichkey = require("which-key")
	local orgmode = require("orgmode")
	local nvim_treesitter_config = require("nvim-treesitter.configs")
	local mini_surround = require("mini.surround")
	local mini_comment = require("mini.comment")
	local gitsigns = require("gitsigns")
	local marks = require("marks")
	local neotest = require("neotest")
	local telescope = require("telescope")
	local telescopeConfig = require("telescope.config")
	local previewers = require("telescope.previewers")
	local lsp_lens = require("lsp-lens")

	local _bad = { ".*%.cshtml" }
	local bad_files = function(filepath)
		for _, v in ipairs(_bad) do if filepath:match(v) then return false end end

		return true
	end

	local new_maker = function(filepath, bufnr, opts)
		opts = opts or {}
		if opts.use_ft_detect == nil then opts.use_ft_detect = true end
		opts.use_ft_detect = opts.use_ft_detect == false and false or
						                     bad_files(filepath)
		previewers.buffer_previewer_maker(filepath, bufnr, opts)
	end

	paq(PKGS)

	local highlight = {
		"RainbowRed";
		"RainbowYellow";
		"RainbowBlue";
		"RainbowOrange";
		"RainbowGreen";
		"RainbowViolet";
		"RainbowCyan";
	}
	-- create the highlight groups in the highlight setup hook, so they are reset
	-- every time the colorscheme changes
	indent_blankline_hooks.register(indent_blankline_hooks.type.HIGHLIGHT_SETUP,
	                                function()
		vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
		vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
		vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
		vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
		vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
		vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
		vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
	end)

	indent_blankline.setup({ indent = { highlight = highlight; tab_char = "▎" } })

	colorizer.setup({ "*" }, {
		RGB = true; -- #RGB hex codes
		RRGGBB = true; -- #RRGGBB hex codes
		names = true; -- "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 = "foreground"; -- Set the display mode.
	})

	vim.g.minimap_auto_start = 0
	vim.g.minimap_highlight_range = 1
	vim.g.minimap_highlight_search = 1

	ufo.setup({
		provider_selector = function(bufnr, filetype, buftype)
			return { "treesitter"; "indent" }
		end;
	});

	catppuccin.setup({
		transparent_background = true;
		show_end_of_line = true;
		term_colors = true;
	})

	vim.o.foldcolumn = "1"
	vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
	vim.o.foldlevelstart = 99
	vim.o.foldenable = true

	osc52.setup {
		max_length = 0; -- Maximum length of selection (0 for no limit)
		silent = false; -- Disable message on successful copy
		trim = false; -- Trim surrounding whitespaces before copy
	}

	devcontainer.setup({ always_mount = {} })
	whichkey.setup({})

	nvim_treesitter_config.setup({
		ensure_installed = {
			"javascript";
			"typescript";
			"lua";
			"c_sharp";
			"jsonc";
			"org";
		};
		ignore_install = {};
		modules = {};
		sync_install = false;
		auto_install = true;
		highlight = {
			enable = true;
			disable = { "markdown"; "yaml"; "sql"; "help" };
			additional_vim_regex_highlighting = { "org" };
		};
	})

	---@diagnostic disable-next-line: missing-fields
	orgmode.setup({
		org_agenda_files = "~/.local/share/org/**/*.org";
		org_default_notes_file = "~/.local/share/org/agenda.org";
		org_startup_folded = "showeverything";
		org_todo_keywords = {
			"TODO";
			"FIXME";
			"BLOCKED";
			"ONHOLD";
			"|";
			"DONE";
			"RESOLVED";
			"CLOSED";
		};
		org_todo_repeat_to_state = "TODO";
		org_todo_keyword_faces = {
			FIXME = ":background #FF5555 :foreground #F1FA8C";
			TODO = ":background #FF79C6 :foreground #F1FA8C"; -- overrides builtin color for `TODO` keyword
			BLOCKED = ":foreground #F1FA8C";
			ONHOLD = ":foreground #F1FA8C";
		};
		org_capture_templates = {
			a = {
				description = "TODO";
				template = "* TODO [#B] (%<%Y-%m-%d>)\n\n%?";
				target = "~/.local/share/org/agenda.org";
			};
			t = {
				description = "Today";
				template = "* Today (%<%Y-%m-%d>) %<%A>\n** %U\n\n%?";
				target = "~/.local/share/org/journal/%<%Y-%m-%d>.org";
			};
			n = {
				description = "Note";
				template = "* Note (%<%Y-%m-%d>) %?";
				target = "~/.local/share/org/note/%<%Y-%m-%d>.org";
			};
		};
	})

	mini_surround.setup({})
	mini_comment.setup({
		-- Options which control module behavior
		options = {
			-- Whether to ignore blank lines
			ignore_blank_line = true;

			-- Whether to recognize as comment only lines without indent
			start_of_line = false;

			-- Whether to ensure single space pad for comment parts
			pad_comment_parts = true;
		};

		-- Module mappings. Use `''` (empty string) to disable one.
		mappings = {
			-- Toggle comment (like `gcip` - comment inner paragraph) for both
			-- Normal and Visual modes
			comment = "gc";

			-- Toggle comment on current line
			comment_line = "gcc";

			-- Define 'comment' textobject (like `dgc` - delete whole comment block)
			textobject = "gc";
		};
	})

	gitsigns.setup {
		signcolumn = true; -- Toggle with `:Gitsigns toggle_signs`
		numhl = true; -- Toggle with `:Gitsigns toggle_numhl`
		linehl = false; -- Toggle with `:Gitsigns toggle_linehl`
		word_diff = false; -- Toggle with `:Gitsigns toggle_word_diff`
		watch_gitdir = { interval = 1000; follow_files = true };
		attach_to_untracked = true;
		current_line_blame = true; -- Toggle with `:Gitsigns toggle_current_line_blame`
		current_line_blame_opts = {
			virt_text = true;
			virt_text_pos = "eol"; -- 'eol' | 'overlay' | 'right_align'
			delay = 0;
			ignore_whitespace = false;
		};
		current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>";
		sign_priority = 6;
		update_debounce = 100;
		status_formatter = nil; -- Use default
		max_file_length = 40000; -- Disable if file is longer than this (in lines)
		preview_config = {
			-- Options passed to nvim_open_win
			border = "single";
			style = "minimal";
			relative = "cursor";
			row = 0;
			col = 1;
		};
	}

	marks.setup({
		-- whether to map keybinds or not. default true
		default_mappings = false;
		-- which builtin marks to show. default {}
		builtin_marks = { "."; "<"; ">"; "^" };
		-- whether movements cycle back to the beginning/end of buffer. default true
		cyclic = true;
		-- whether the shada file is updated after modifying uppercase marks. default false
		force_write_shada = false;
		-- how often (in ms) to redraw signs/recompute mark positions.
		-- higher values will have better performance but may cause visual lag,
		-- while lower values may cause performance penalties. default 150.
		refresh_interval = 250;
		-- sign priorities for each type of mark - builtin marks, uppercase marks, lowercase
		-- marks, and bookmarks.
		-- can be either a table with all/none of the keys, or a single number, in which case
		-- the priority applies to all marks.
		-- default 10.
		sign_priority = { lower = 10; upper = 15; builtin = 8; bookmark = 20 };
		-- disables mark tracking for specific filetypes. default {}
		excluded_filetypes = { "" };
		mappings = {};
	})

	neotest.setup({ adapters = { require("neotest-dotnet") } })

	-- Clone the default Telescope configuration
	local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }

	-- I want to search in hidden/dot files.
	table.insert(vimgrep_arguments, "--hidden")
	-- I don't want to search in the `.git` directory.
	table.insert(vimgrep_arguments, "--glob")
	table.insert(vimgrep_arguments, "!**/.git/*")

	telescope.setup({
		defaults = {
			-- `hidden = true` is not supported in text grep commands.
			vimgrep_arguments = vimgrep_arguments;
			buffer_previewer_maker = new_maker;
		};
		pickers = {
			find_files = {
				-- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
				find_command = {
					"rg";
					"--files";
					"--hidden";
					"--glob";
					"!**/.git/*";
					"--trim";
				};
			};
			live_grep = {
				-- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
				find_command = {
					"rg";
					"--files";
					"--hidden";
					"--glob";
					"!**/.git/*";
					"--trim";
				};
				path_display = { "smart" };
				only_sort_text = true;
				word_match = "-w";
				search = "";
			};
		};
	})

	local SymbolKind = vim.lsp.protocol.SymbolKind

	local all_symbols = {
		vim.lsp.protocol.SymbolKind.File;
		vim.lsp.protocol.SymbolKind.Module;
		vim.lsp.protocol.SymbolKind.Namespace;
		vim.lsp.protocol.SymbolKind.Package;
		vim.lsp.protocol.SymbolKind.Class;
		vim.lsp.protocol.SymbolKind.Method;
		vim.lsp.protocol.SymbolKind.Property;
		vim.lsp.protocol.SymbolKind.Field;
		vim.lsp.protocol.SymbolKind.Constructor;
		vim.lsp.protocol.SymbolKind.Enum;
		vim.lsp.protocol.SymbolKind.Interface;
		vim.lsp.protocol.SymbolKind.Function;
		vim.lsp.protocol.SymbolKind.Variable;
		vim.lsp.protocol.SymbolKind.Constant;
		vim.lsp.protocol.SymbolKind.String;
		vim.lsp.protocol.SymbolKind.Number;
		vim.lsp.protocol.SymbolKind.Boolean;
		vim.lsp.protocol.SymbolKind.Array;
		vim.lsp.protocol.SymbolKind.Object;
		vim.lsp.protocol.SymbolKind.Key;
		vim.lsp.protocol.SymbolKind.Null;
		vim.lsp.protocol.SymbolKind.EnumMember;
		vim.lsp.protocol.SymbolKind.Struct;
		vim.lsp.protocol.SymbolKind.Event;
		vim.lsp.protocol.SymbolKind.Operator;
		vim.lsp.protocol.SymbolKind.TypeParameter;
	}

	lsp_lens.setup({
		enable = false;
		include_declaration = false; -- Reference include declaration
		sections = { -- Enable / Disable specific request, formatter example looks 'Format Requests'
			definition = true;
			references = true;
			implements = true;
			git_authors = false;
		};
		ignore_filetype = { "prisma" };
		-- Target Symbol Kinds to show lens information
		target_symbol_kinds = all_symbols; -- { SymbolKind.Function, SymbolKind.Method, SymbolKind.Interface, },
		-- Symbol Kinds that may have target symbol kinds as children
		wrapper_symbol_kinds = {
			SymbolKind.Class;
			SymbolKind.Struct;
			SymbolKind.Enum;
			SymbolKind.Interface;
		};
	})
end

local function clone_paq()
	local path = vim.fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim"
	if vim.fn.empty(vim.fn.glob(path)) > 0 then
		vim.fn.system {
			"git";
			"clone";
			"--depth=1";
			"https://github.com/savq/paq-nvim.git";
			path;
		}
		return true
	else
		return false
	end
end
local function bootstrap_paq()
	clone_paq()
	-- Load Paq
	vim.cmd("packadd paq-nvim")
	local paq = require("paq")
	-- Read and install packages
	paq(PKGS)
	paq.install()
end

return {
	clone_paq = clone_paq;
	bootstrap_paq = bootstrap_paq;
	init_plugins = init_plugins;
}