Compare commits
	
		
			4 Commits
		
	
	
		
			e3ce7dccd4
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 3e85812630 | ||
|   | a968cdc50a | ||
|   | d7df92eb95 | ||
|   | 6d75acf6f2 | 
							
								
								
									
										36
									
								
								nvim/lua/olinpin/plugins/attempt.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								nvim/lua/olinpin/plugins/attempt.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | |||||||
|  | return { | ||||||
|  | 	"m-demare/attempt.nvim", | ||||||
|  | 	config = function() | ||||||
|  | 		local attempt = require("attempt") | ||||||
|  |  | ||||||
|  | 		attempt.setup({ | ||||||
|  | 			initial_content = { | ||||||
|  | 				php = "<?php\n\n", | ||||||
|  | 				py = "", | ||||||
|  | 			}, | ||||||
|  | 			ext_options = { "js", "py", "php", "" }, | ||||||
|  | 			format_opts = { | ||||||
|  | 				js = "JavaScript", | ||||||
|  | 				py = "Python", | ||||||
|  | 				[""] = "[None]", | ||||||
|  | 			}, | ||||||
|  | 		}) | ||||||
|  |  | ||||||
|  | 		local cmd_map = { | ||||||
|  | 			py = "python3", | ||||||
|  | 			js = "node", | ||||||
|  | 			php = "php", | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		vim.keymap.set("n", "<leader>ss", attempt.new_select, { desc = "Attempt: Open Attempt" }) | ||||||
|  | 		vim.keymap.set("n", "<leader>si", attempt.new_input_ext, { desc = "Attempt: New Attempt with Input" }) | ||||||
|  | 		vim.keymap.set("n", "<leader>sr", function() | ||||||
|  | 			local ext = vim.fn.expand("%:e") | ||||||
|  | 			local cmd = cmd_map[ext] or 'echo "unsupported"' | ||||||
|  | 			vim.cmd("split | terminal " .. cmd .. " %") | ||||||
|  | 		end, { desc = "Attempt: Run Attempt" }) | ||||||
|  | 		vim.keymap.set("n", "<leader>sd", attempt.delete_buf, { desc = "Attempt: Delete Attempt from Current Buffer" }) | ||||||
|  | 		vim.keymap.set("n", "<leader>sc", attempt.rename_buf, { desc = "Attempt: Rename Attempt from Current Buffer" }) | ||||||
|  | 		vim.keymap.set("n", "<leader>sf", ":Telescope attempt<CR>", { desc = "Attempt: List Attempts with Telescope" }) | ||||||
|  | 	end, | ||||||
|  | } | ||||||
							
								
								
									
										58
									
								
								nvim/lua/olinpin/plugins/completion.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								nvim/lua/olinpin/plugins/completion.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | |||||||
|  | return { | ||||||
|  | 	{ | ||||||
|  | 		"hrsh7th/nvim-cmp", | ||||||
|  | 		event = "InsertEnter", | ||||||
|  | 		dependencies = { | ||||||
|  | 			"hrsh7th/cmp-nvim-lsp", | ||||||
|  | 			"hrsh7th/cmp-buffer", | ||||||
|  | 			"hrsh7th/cmp-path", | ||||||
|  | 			"L3MON4D3/LuaSnip", | ||||||
|  | 			"saadparwaiz1/cmp_luasnip", | ||||||
|  | 		}, | ||||||
|  | 		config = function() | ||||||
|  | 			local cmp = require("cmp") | ||||||
|  | 			local luasnip = require("luasnip") | ||||||
|  |  | ||||||
|  | 			cmp.setup({ | ||||||
|  | 				snippet = { | ||||||
|  | 					expand = function(args) | ||||||
|  | 						luasnip.lsp_expand(args.body) | ||||||
|  | 					end, | ||||||
|  | 				}, | ||||||
|  | 				mapping = cmp.mapping.preset.insert({ | ||||||
|  | 					["<C-b>"] = cmp.mapping.scroll_docs(-4), | ||||||
|  | 					["<C-f>"] = cmp.mapping.scroll_docs(4), | ||||||
|  | 					["<C-Space>"] = cmp.mapping.complete(), | ||||||
|  | 					["<C-e>"] = cmp.mapping.abort(), | ||||||
|  | 					["<CR>"] = cmp.mapping.confirm({ select = true }), | ||||||
|  | 					["<Tab>"] = cmp.mapping(function(fallback) | ||||||
|  | 						if cmp.visible() then | ||||||
|  | 							cmp.select_next_item() | ||||||
|  | 						elseif luasnip.expand_or_jumpable() then | ||||||
|  | 							luasnip.expand_or_jump() | ||||||
|  | 						else | ||||||
|  | 							fallback() | ||||||
|  | 						end | ||||||
|  | 					end, { "i", "s" }), | ||||||
|  | 					["<S-Tab>"] = cmp.mapping(function(fallback) | ||||||
|  | 						if cmp.visible() then | ||||||
|  | 							cmp.select_prev_item() | ||||||
|  | 						elseif luasnip.jumpable(-1) then | ||||||
|  | 							luasnip.jump(-1) | ||||||
|  | 						else | ||||||
|  | 							fallback() | ||||||
|  | 						end | ||||||
|  | 					end, { "i", "s" }), | ||||||
|  | 				}), | ||||||
|  | 				sources = cmp.config.sources({ | ||||||
|  | 					{ name = "nvim_lsp" }, | ||||||
|  | 					{ name = "luasnip" }, | ||||||
|  | 				}, { | ||||||
|  | 					{ name = "buffer" }, | ||||||
|  | 					{ name = "path" }, | ||||||
|  | 				}), | ||||||
|  | 			}) | ||||||
|  | 		end, | ||||||
|  | 	}, | ||||||
|  | } | ||||||
|  |  | ||||||
| @@ -1,3 +0,0 @@ | |||||||
| return { |  | ||||||
|     "xavierchow/vim-sequence-diagram" |  | ||||||
| } |  | ||||||
| @@ -1,24 +0,0 @@ | |||||||
| return { |  | ||||||
|     "ggandor/leap.nvim", |  | ||||||
|     config = function () |  | ||||||
|         require('leap') |  | ||||||
|         vim.keymap.set("n", "<leader>s", "<Plug>(leap-forward-to)", { desc = "Leap forward to" }) |  | ||||||
|         -- default mapping: `s` |  | ||||||
|  |  | ||||||
|         vim.keymap.set("n", "<leader>S", "<Plug>(leap-backward-to)", { desc = "Leap backward to" }) |  | ||||||
|         -- arguments: `{ backward = true }` |  | ||||||
|         -- default mapping: `S` |  | ||||||
|  |  | ||||||
|         vim.keymap.set("n", "<leader>b", "<Plug>(leap-forward-till)", { desc = "Leap forward till" } ) |  | ||||||
|         -- arguments: `{ offset = -1, inclusive_op = true }` |  | ||||||
|         -- default mapping: `x` (Visual and Operator-pending mode only) |  | ||||||
|  |  | ||||||
|         vim.keymap.set("n", "<leader>B", "<Plug>(leap-backward-till)", { desc = "Leap backward till" }) |  | ||||||
|         -- arguments: `{ backward = true, offset = 2 }` |  | ||||||
|         -- default mapping: `X` (Visual and Operator-pending mode only) |  | ||||||
|  |  | ||||||
|         -- <Plug>(leap-from-window) |  | ||||||
|         -- arguments: `{ target_windows = require('leap.util').get_enterable_windows() }` |  | ||||||
|         -- default mapping: `gs` |  | ||||||
|     end |  | ||||||
| } |  | ||||||
| @@ -27,10 +27,10 @@ local PACKAGES = { | |||||||
| 	-- Lint | 	-- Lint | ||||||
| 	"eslint-lsp", | 	"eslint-lsp", | ||||||
| 	"pylint", | 	"pylint", | ||||||
|     "jq", | 	"jq", | ||||||
|     "php-cs-fixer", | 	"php-cs-fixer", | ||||||
|     "intelephense", | 	"intelephense", | ||||||
|     "prettier", | 	"prettier", | ||||||
| } | } | ||||||
|  |  | ||||||
| local function install(pack, version) | local function install(pack, version) | ||||||
| @@ -117,30 +117,30 @@ end | |||||||
| return { | return { | ||||||
| 	{ | 	{ | ||||||
| 		"williamboman/mason.nvim", | 		"williamboman/mason.nvim", | ||||||
| 	init = function() | 		init = function() | ||||||
| 		-- Do not crowd home directory with NPM cache folder | 			-- Do not crowd home directory with NPM cache folder | ||||||
| 		vim.env.npm_config_cache = vim.env.HOME .. "/.cache/npm" | 			vim.env.npm_config_cache = vim.env.HOME .. "/.cache/npm" | ||||||
| 	end, | 		end, | ||||||
| 	opts = { | 		opts = { | ||||||
| 		ui = { | 			ui = { | ||||||
| 			border = "rounded", | 				border = "rounded", | ||||||
| 			height = 0.85, | 				height = 0.85, | ||||||
| 			width = 0.8, | 				width = 0.8, | ||||||
|  | 			}, | ||||||
| 		}, | 		}, | ||||||
| 	}, | 		config = function(_, opts) | ||||||
| 	config = function(_, opts) | 			require("mason").setup(opts) | ||||||
| 		require("mason").setup(opts) |  | ||||||
|  |  | ||||||
| 		-- Filter out disabled packages | 			-- Filter out disabled packages | ||||||
| 		local packages = {} | 			local packages = {} | ||||||
| 		for _, package in ipairs(PACKAGES) do | 			for _, package in ipairs(PACKAGES) do | ||||||
| 			table.insert(packages, package) | 				table.insert(packages, package) | ||||||
| 		end | 			end | ||||||
|  |  | ||||||
| 		vim.defer_fn(function() | 			vim.defer_fn(function() | ||||||
| 			syncPackages(packages) | 				syncPackages(packages) | ||||||
| 		end, 3000) | 			end, 3000) | ||||||
| 	end, | 		end, | ||||||
|  |  | ||||||
| 		event = { "VeryLazy" }, | 		event = { "VeryLazy" }, | ||||||
| 	}, | 	}, | ||||||
| @@ -148,6 +148,8 @@ return { | |||||||
| 		"williamboman/mason-lspconfig.nvim", | 		"williamboman/mason-lspconfig.nvim", | ||||||
| 		dependencies = { "williamboman/mason.nvim" }, | 		dependencies = { "williamboman/mason.nvim" }, | ||||||
| 		config = function() | 		config = function() | ||||||
|  | 			local capabilities = require("cmp_nvim_lsp").default_capabilities() | ||||||
|  |  | ||||||
| 			local on_attach = function(client, bufnr) | 			local on_attach = function(client, bufnr) | ||||||
| 				local opts = { buffer = bufnr, silent = true } | 				local opts = { buffer = bufnr, silent = true } | ||||||
|  |  | ||||||
| @@ -165,12 +167,13 @@ return { | |||||||
| 			end | 			end | ||||||
|  |  | ||||||
| 			-- Configure LSP servers using new vim.lsp.config API | 			-- Configure LSP servers using new vim.lsp.config API | ||||||
| 			vim.lsp.config('lua_ls', { | 			vim.lsp.config("lua_ls", { | ||||||
| 				on_attach = on_attach, | 				on_attach = on_attach, | ||||||
|  | 				capabilities = capabilities, | ||||||
| 				settings = { | 				settings = { | ||||||
| 					Lua = { | 					Lua = { | ||||||
| 						runtime = { version = 'LuaJIT' }, | 						runtime = { version = "LuaJIT" }, | ||||||
| 						diagnostics = { globals = { 'vim' } }, | 						diagnostics = { globals = { "vim" } }, | ||||||
| 						workspace = { | 						workspace = { | ||||||
| 							library = vim.api.nvim_get_runtime_file("", true), | 							library = vim.api.nvim_get_runtime_file("", true), | ||||||
| 							checkThirdParty = false, | 							checkThirdParty = false, | ||||||
| @@ -180,14 +183,24 @@ return { | |||||||
| 				}, | 				}, | ||||||
| 			}) | 			}) | ||||||
|  |  | ||||||
| 			vim.lsp.config('ts_ls', { on_attach = on_attach }) | 			vim.lsp.config("ts_ls", { on_attach = on_attach, capabilities = capabilities }) | ||||||
| 			vim.lsp.config('pyright', { on_attach = on_attach }) | 			vim.lsp.config("pyright", { on_attach = on_attach, capabilities = capabilities }) | ||||||
| 			vim.lsp.config('html', { on_attach = on_attach }) | 			vim.lsp.config("html", { on_attach = on_attach, capabilities = capabilities }) | ||||||
| 			vim.lsp.config('cssls', { on_attach = on_attach }) | 			vim.lsp.config("cssls", { on_attach = on_attach, capabilities = capabilities }) | ||||||
| 			vim.lsp.config('jsonls', { on_attach = on_attach }) | 			vim.lsp.config("jsonls", { on_attach = on_attach, capabilities = capabilities }) | ||||||
| 			vim.lsp.config('yamlls', { on_attach = on_attach }) | 			vim.lsp.config("yamlls", { on_attach = on_attach, capabilities = capabilities }) | ||||||
| 			vim.lsp.config('intelephense', { on_attach = on_attach }) | 			vim.lsp.config("intelephense", { | ||||||
| 			vim.lsp.config('eslint', { on_attach = on_attach }) | 				on_attach = on_attach, | ||||||
|  | 				capabilities = capabilities, | ||||||
|  | 				settings = { | ||||||
|  | 					intelephense = { | ||||||
|  | 						format = { | ||||||
|  | 							enable = true, | ||||||
|  | 						}, | ||||||
|  | 					}, | ||||||
|  | 				}, | ||||||
|  | 			}) | ||||||
|  | 			vim.lsp.config("eslint", { on_attach = on_attach, capabilities = capabilities }) | ||||||
|  |  | ||||||
| 			require("mason-lspconfig").setup({ | 			require("mason-lspconfig").setup({ | ||||||
| 				ensure_installed = { | 				ensure_installed = { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user