diff options
| author | Raymaekers Luca <luca@spacehb.net> | 2025-04-05 15:36:24 +0200 | 
|---|---|---|
| committer | Raymaekers Luca <luca@spacehb.net> | 2025-04-05 15:36:24 +0200 | 
| commit | ddad9ca6370c97991679bcfd91704e8548bb973a (patch) | |
| tree | 09ebbb33f9a65be421890d4964f567676cf21967 | |
| parent | 7870db20ff0594474daf7cab957cd936d4c246c7 (diff) | |
| parent | 2c433c348662ee6e4ee5c99a8f5e400858013fa2 (diff) | |
Merge branch 'fast'
| -rw-r--r-- | after/plugin/conform.lua | 53 | ||||
| -rw-r--r-- | after/plugin/dap.lua | 75 | ||||
| -rw-r--r-- | after/plugin/gitsigns.lua | 25 | ||||
| -rw-r--r-- | after/plugin/harpoon.lua | 34 | ||||
| -rw-r--r-- | after/plugin/mini.lua | 14 | ||||
| -rw-r--r-- | after/plugin/telescope.lua | 14 | ||||
| -rw-r--r-- | after/plugin/treesitter.lua | 2 | ||||
| -rw-r--r-- | init.lua | 1 | ||||
| -rw-r--r-- | lua/config/autocmds.lua | 20 | ||||
| -rw-r--r-- | lua/config/lazy.lua | 172 | ||||
| -rw-r--r-- | lua/config/lsp.lua | 160 | ||||
| -rw-r--r-- | lua/config/map.lua | 67 | ||||
| -rw-r--r-- | lua/config/projects.lua | 2 | ||||
| -rw-r--r-- | lua/config/set.lua | 80 | 
14 files changed, 58 insertions, 661 deletions
diff --git a/after/plugin/conform.lua b/after/plugin/conform.lua deleted file mode 100644 index 643743f..0000000 --- a/after/plugin/conform.lua +++ /dev/null @@ -1,53 +0,0 @@ -local conform = require("conform") -conform.setup({ -	formatters_by_ft = { -		lua = { "stylua" }, -		-- html = { "prettier" }, -		go = { "goimports", "gofmt" }, -	}, -	format_on_save = { -		-- These options will be passed to conform.format() -		timeout_ms = 500, -		lsp_format = "never", -	}, -}) - --- conform.formatters["clang-format"] = { --- 	prepend_args = { --- 		"--style", --- 		"{" --- 			.. "IndentWidth: 4, " --- 			.. "AlignAfterOpenBracket: BlockIndent, " --- 			.. "AlignArrayOfStructures: Right, " --- 			.. "BreakBeforeBraces: Linux, " --- 			.. "PointerAlignment: Left," --- 			.. "AllowShortIfStatementsOnASingleLine: true, " --- 			.. "AllowShortLoopsOnASingleLine: true, " --- 			.. "AllowAllArgumentsOnNextLine: true, " --- 			.. "AllowShortCaseLabelsOnASingleLine: true, " --- 			.. "AlwaysBreakAfterReturnType: AllDefinitions, " --- 			.. "ColumnLimit: " --- 			.. vim.o.tw --- 			.. "}", --- 	}, --- } - --- -- ID of autocmd for CFormat --- vim.b.CFormatID = nil --- -- Enable formatting on save for C only when using the :CFormat command --- vim.api.nvim_create_user_command("CFormat", function() --- 	if vim.b.CFormatID == nil then --- 		vim.b.CFormatID = vim.api.nvim_create_autocmd("BufWritePre", { --- 			buffer = 0, --- 			callback = function() --- 				conform.format({ formatters = { "clang-format" } }) --- 			end, --- 		}) --- 		conform.format({ formatters = { "clang-format" } }) --- 		print("Auto formatting enabled.") --- 	else --- 		vim.api.nvim_del_autocmd(vim.b.CFormatID) --- 		print("Auto formatting disabled.") --- 		vim.b.CFormatID = nil --- 	end --- end, {}) diff --git a/after/plugin/dap.lua b/after/plugin/dap.lua deleted file mode 100644 index fd141bb..0000000 --- a/after/plugin/dap.lua +++ /dev/null @@ -1,75 +0,0 @@ -local dap = require("dap") -local dapui = require("dapui") -local widgets = require("dap.ui.widgets") -local map = vim.keymap.set - -dapui.setup() --- stylua: ignore start -map("n", " bu", function() dapui.toggle() end, { desc = "Toggle dap-ui" }) -map("n", " bb", function() dap.toggle_breakpoint() end, { desc = "Toggle breakpoint" }) -map("n", " bc", function() dap.continue() end, {desc="Continue"}) -map("n", " bs", function() dap.step_over() end, {desc="Step over"}) -map("n", " bi", function() dap.step_into() end, {desc="Step into"}) -map("n", " bo", function() dap.step_out() end, {desc="Step out"}) -map({ "n", "v" }, " bh", function() widgets.hover() end, {desc="Show hover"}) -map({ "n", "v" }, " bv", function() widgets.preview() end, {desc="Show preview"}) -map("n", " bf", function() widgets.centered_float(widgets.frames) end, {desc="Show frames"}) -map("n", " bp", function() widgets.centered_float(widgets.scopes) end, {desc="Show scopes"}) --- stylua: ignore end -map("n", " bl", function() -	dap.set_breakpoint(nil, nil, vim.fn.input("Log point message: ")) -end, { desc = "Break point with log" }) - -dap.adapters.gdb = { -	id = "gdb", -	type = "executable", -	command = "gdb", -	args = { "--quiet", "--interpreter=dap" }, -} - -dap.configurations.c = { -	{ -		name = "Run (GDB)", -		type = "gdb", -		request = "launch", -		-- This requires special handling of 'run_last', see -		-- https://github.com/mfussenegger/nvim-dap/issues/1025#issuecomment-1695852355 -		program = function() -			local path = vim.fn.input({ -				prompt = "Path to executable: ", -				default = vim.fn.getcwd() .. "/", -				completion = "file", -			}) - -			return (path and path ~= "") and path or dap.ABORT -		end, -	}, -	{ -		name = "Run with arguments (GDB)", -		type = "gdb", -		request = "launch", -		-- This requires special handling of 'run_last', see -		-- https://github.com/mfussenegger/nvim-dap/issues/1025#issuecomment-1695852355 -		program = function() -			local path = vim.fn.input({ -				prompt = "Path to executable: ", -				default = vim.fn.getcwd() .. "/", -				completion = "file", -			}) - -			return (path and path ~= "") and path or dap.ABORT -		end, -		args = function() -			local args_str = vim.fn.input({ -				prompt = "Arguments: ", -			}) -			return vim.split(args_str, " +") -		end, -	}, -	{ -		name = "Attach to process (GDB)", -		type = "gdb", -		request = "attach", -		processId = require("dap.utils").pick_process, -	}, -} diff --git a/after/plugin/gitsigns.lua b/after/plugin/gitsigns.lua deleted file mode 100644 index 46536b1..0000000 --- a/after/plugin/gitsigns.lua +++ /dev/null @@ -1,25 +0,0 @@ -local gitsigns = require("gitsigns") -gitsigns.setup({ -	signs = { -		add = { text = "▎" }, -		change = { text = "▎" }, -		delete = { text = "▎" }, -		topdelete = { text = "▎" }, -		changedelete = { text = "▎" }, -		untracked = { text = "▎" }, -	}, -	numhl = false, -	attach_to_untracked = true, -	update_debounce = 0, -	on_attach = function() -		local map = vim.keymap.set -	        -- stylua: ignore start -	        map("n", "]g", gitsigns.next_hunk, { desc = "Next git hunk" }) -	        map("n", "[g", gitsigns.prev_hunk, { desc = "Previous git hunk" }) -            map("n", " gd", gitsigns.toggle_deleted, { desc="Toggle deleted"}) -            map("n", " gr", gitsigns.reset_hunk, { desc="Reset hunk"}) -            map("n", " gs", gitsigns.stage_hunk, { desc="Stage hunk"}) -            map("n", " gu", gitsigns.undo_stage_hunk, { desc="Undo stage hunk"}) -	    map("n", " gb", gitsigns.blame, { desc="Blame"}) -	end, -}) diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua deleted file mode 100644 index 999b957..0000000 --- a/after/plugin/harpoon.lua +++ /dev/null @@ -1,34 +0,0 @@ -local harpoon = require("harpoon") -local map = vim.keymap.set - --- REQUIRED -harpoon:setup() - -map("n", "<C-h>", function() -	harpoon.ui:toggle_quick_menu(harpoon:list()) -end, { desc = "Harpoon pick menu" }) - -map("n", " ha", function() -	harpoon:list():add() -	print("Added to harpoon.") -end, { desc = "Harpoon add" }) -map("n", " h1", function() -	harpoon:list():select(1) -end, { desc = "Harpoon 1" }) -map("n", " h2", function() -	harpoon:list():select(2) -end, { desc = "Harpoon 2" }) -map("n", " h3", function() -	harpoon:list():select(3) -end, { desc = "Harpoon 3" }) -map("n", " h4", function() -	harpoon:list():select(4) -end, { desc = "Harpoon 4" }) - --- Toggle previous & next buffers stored within Harpoon list -map("n", " hp", function() -	harpoon:list():prev() -end, { desc = "Harpoon previous" }) -map("n", " hn", function() -	harpoon:list():next() -end, { desc = "Harpoon next" }) diff --git a/after/plugin/mini.lua b/after/plugin/mini.lua index 6a35641..2ef3eff 100644 --- a/after/plugin/mini.lua +++ b/after/plugin/mini.lua @@ -5,12 +5,12 @@ require("mini.statusline").setup({  require("mini.surround").setup({  	silent = true,  	mappings = { -		add = "gsa", -- Add surrounding in Normal and Visual modes -		delete = "gsd", -- Delete surrounding -		find = "gsf", -- Find surrounding (to the right) -		find_left = "gsF", -- Find surrounding (to the left) -		highlight = "gsh", -- Highlight surrounding -		replace = "gsr", -- Replace surrounding -		update_n_lines = "gsn", -- Update `n_lines` +		add = "gsa", +		delete = "gsd", +		find = "gsf", +		find_left = "gsF", +		highlight = "gsh", +		replace = "gsr", +		update_n_lines = "gsn",  	},  }) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index c77e464..b481fa3 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -1,5 +1,8 @@ +local telescope = require("telescope") +local builtin = require("telescope.builtin")  local map = vim.keymap.set -require("telescope").setup({ + +telescope.setup({  	defaults = {  		path_display = {  			shorten = { @@ -23,17 +26,18 @@ require("telescope").setup({  	},  }) -local builtin = require("telescope.builtin")  map("n", " ff", builtin.find_files) -map("n", " bl", builtin.buffers) +map("n", " fb", builtin.buffers)  map("n", " fp", builtin.git_files)  map("n", " fw", builtin.live_grep)  map("n", " fh", builtin.help_tags) +map("n", " fk", builtin.keymaps) +map("n", " fs", builtin.spell_suggest)  -- symbols  map("n", " fe", "<cmd>lua require'telescope.builtin'.symbols{ sources = {'emoji', 'gitmoji'} }<CR>")  map("n", " fn", "<cmd>lua require'telescope.builtin'.symbols{ sources = {'nerd'} }<CR>")  map("n", " fj", "<cmd>lua require'telescope.builtin'.symbols{ sources = {'julia'} }<CR>") +map("n", " ft", "<cmd>lua require'telescope.builtin'.treesitter{ symbols = {'function'} }<CR>") -require("telescope").load_extension("ui-select") -require("telescope").load_extension("fzf") +telescope.load_extension("fzf") diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua index a0e8014..a625f4c 100644 --- a/after/plugin/treesitter.lua +++ b/after/plugin/treesitter.lua @@ -20,5 +20,3 @@ require("nvim-treesitter.configs").setup({  		},  	},  }) --- vim.api.nvim_buf_create_user_command --- vim.keymap.set("n", "") @@ -1,6 +1,5 @@  require("config.lazy")  require("config.set")  require("config.map") -require("config.lsp")  require("config.autocmds")  require("config.projects") diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index f6033d6..1a4970b 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -33,14 +33,6 @@ autocmd("TermOpen", {  		vim.keymap.set("t", "<Esc>", "<C-\\><C-n>", { noremap = true })  	end,  }) --- -- close automatically when shell process exits --- -- TODO: does not work --- autocmd("TermClose", { --- 	callback = function() --- 		vim.cmd("bdelete") --- 	end, --- }) -vim.keymap.set("n", "!", "<cmd>sp<CR><cmd>term<CR>", { desc = "Open terminal" })  -- [[ preserve last position ]]  autocmd("BufReadPost", { @@ -72,17 +64,5 @@ autocmd(  	}  ) --- autocmd({ "BufNewFile", "BufRead" }, { --- 	pattern = "*", --- 	callback = function() --- 		local output = vim.fn.system("git rev-parse --is-inside-work-tree") --- 		if output == "true\n" then --- 			vim.opt.signcolumn = "yes" --- 		else --- 			vim.opt.signcolumn = "no" --- 		end --- 	end, --- }) -  -- Automatically resize panes  autocmd("VimResized", { pattern = "*", command = "wincmd =" }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 1bd0b8a..3fd9dc9 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -6,132 +6,16 @@ if not vim.loop.fs_stat(lazypath) then  		"clone",  		"--filter=blob:none",  		"https://github.com/folke/lazy.nvim.git", -		"--branch=stable", -- latest stable release +		"--branch=stable",  		lazypath,  	})  end  vim.opt.rtp:prepend(lazypath) --- plugins installation and configuration  require("lazy").setup({  	"echasnovski/mini.nvim", -	"tpope/vim-fugitive", -	"lewis6991/gitsigns.nvim",  	"tpope/vim-vinegar", -	"tpope/vim-eunuch", -	-- "mg979/vim-visual-multi", -	{ -		"brenton-leighton/multiple-cursors.nvim", -		version = "*", -- Use the latest tagged version -		opts = { -			custom_key_maps = { -				{ -					"n", -					"<S-Tab>", -					function() -						require("multiple-cursors").align() -					end, -				}, -			}, -		}, -		keys = { -			{ "<C-j>", "<Cmd>MultipleCursorsAddDown<CR>", mode = { "n", "x" }, desc = "Add cursor and move down" }, -			{ "<C-k>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "x" }, desc = "Add cursor and move up" }, - -			{ "<C-Up>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "i", "x" }, desc = "Add cursor and move up" }, -			{ -				"<C-Down>", -				"<Cmd>MultipleCursorsAddDown<CR>", -				mode = { "n", "i", "x" }, -				desc = "Add cursor and move down", -			}, - -			{ -				"<Leader>m", -				"<Cmd>MultipleCursorsAddVisualArea<CR>", -				mode = { "x" }, -				desc = "Add cursors to the lines of the visual area", -			}, - -			{ "<Leader>a", "<Cmd>MultipleCursorsAddMatches<CR>", mode = { "n", "x" }, desc = "Add cursors to cword" }, -			{ -				"<Leader>A", -				"<Cmd>MultipleCursorsAddMatchesV<CR>", -				mode = { "n", "x" }, -				desc = "Add cursors to cword in previous area", -			}, - -			{ -				"<Leader>d", -				"<Cmd>MultipleCursorsAddJumpNextMatch<CR>", -				mode = { "n", "x" }, -				desc = "Add cursor and jump to next cword", -			}, -			{ "<Leader>D", "<Cmd>MultipleCursorsJumpNextMatch<CR>", mode = { "n", "x" }, desc = "Jump to next cword" }, - -			{ "<Leader>l", "<Cmd>MultipleCursorsLock<CR>", mode = { "n", "x" }, desc = "Lock virtual cursors" }, -		}, -	}, -	"jghauser/follow-md-links.nvim", -	"stevearc/conform.nvim",  	"norcalli/nvim-colorizer.lua", -	"neovim/nvim-lspconfig", -	{ -		"williamboman/mason.nvim", -		dependencies = { -			"williamboman/mason-lspconfig.nvim", -			-- for formatters and linters -			"WhoIsSethDaniel/mason-tool-installer.nvim", -		}, -		config = function() -			require("mason").setup({ -				ui = { -					border = "rounded", -				}, -			}) -		end, -	}, -	{ -		--snippets -		"L3MON4D3/LuaSnip", -		version = "v2.*", -		build = "make install_jsregexp", -	}, -	-- "mfussenegger/nvim-lint", -	-- { -	-- 	"ray-x/lsp_signature.nvim", -	-- 	event = "LspAttach", -	-- }, -	-- { -	-- 	"hrsh7th/nvim-cmp", -	-- 	dependencies = { -	-- 		"hrsh7th/cmp-nvim-lsp", -	-- 		"hrsh7th/cmp-path", -	-- 		"hrsh7th/cmp-buffer", -	-- 		"saadparwaiz1/cmp_luasnip", -	-- 		"onsails/lspkind.nvim", -	-- 	}, -	-- 	event = { "InsertEnter", "CmdlineEnter" }, -	-- }, -	{ -		"folke/which-key.nvim", -		event = "VeryLazy", -		opts = { -			win = { -				border = "rounded", -			}, -		}, -		keys = { -			{ -				"<leader>?", -				function() -					require("which-key").show({ global = false }) -				end, -				desc = "Buffer Local Keymaps (which-key)", -			}, -		}, -	}, -  	{  		"christoomey/vim-tmux-navigator",  		cmd = { @@ -151,49 +35,22 @@ require("lazy").setup({  	},  	{ -		"ray-x/go.nvim", -		dependencies = { -- optional packages -			"ray-x/guihua.lua", -			"neovim/nvim-lspconfig", -			"nvim-treesitter/nvim-treesitter", -		}, -		config = function() -			require("go").setup() -		end, -		event = { "CmdlineEnter" }, -		ft = { "go", "gomod" }, -		build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries -	}, - -	{ -		"dstein64/vim-startuptime", -		cmd = "StartupTime", -		init = function() -			vim.g.startuptime_tries = 10 -		end, -	}, - -	{  		"gbprod/nord.nvim",  		lazy = false,  		priority = 1000,  		config = function()  			require("nord").setup({  				transparent = false, -				terminal_colors = true, -- `:terminal` +				terminal_colors = true,  				diff = { mode = "bg" },  				borders = true, -				-- values : [bg|fg|none]  				errors = { mode = "bg" }, -				-- values : [vim|vscode]  				search = { theme = "vim" },  				styles = { -					-- `:help nvim_set_hl`  					comments = { italic = true },  					keywords = { bold = true },  					functions = { bold = true },  					variables = { bold = true }, -					-- To customize lualine/bufferline  					bufferline = {  						current = {},  						modified = { italic = true }, @@ -204,7 +61,6 @@ require("lazy").setup({  		end,  	},  	{ -		-- Fuzzy Finder (files, lsp, etc)  		"nvim-telescope/telescope.nvim",  		dependencies = {  			"nvim-lua/plenary.nvim", @@ -220,22 +76,7 @@ require("lazy").setup({  		"nvim-treesitter/nvim-treesitter",  		build = ":TSUpdate",  	}, -	{ -		"ThePrimeagen/harpoon", -		branch = "harpoon2", -		requires = { "nvim-lua/plenary.nvim", lazy = true }, -	}, - -	-- DAP -	{ -		{ -			"mfussenegger/nvim-dap", -		}, -		{ "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" } }, -	},  }, { - -	-- lazy options  	performance = {  		rtp = {  			disabled_plugins = { @@ -247,13 +88,4 @@ require("lazy").setup({  			},  		},  	}, -	-- install = { -	-- 	colorscheme = { "nord" }, -	-- 	missing = false, -	-- }, -	-- change_detection = { -	-- 	enabled = true, -	-- 	notify = true, -	-- }, -	-- checker = { enabled = true, notify = false },  }) diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua deleted file mode 100644 index 10235bf..0000000 --- a/lua/config/lsp.lua +++ /dev/null @@ -1,160 +0,0 @@ --- [[ Keybinds ]] -local diagnostic = vim.diagnostic -local lbuf = vim.lsp.buf -local map = vim.keymap.set -local builtin = require("telescope.builtin") - -map("n", " <cr>", lbuf.code_action, { desc = "Code actions" }) -map("n", "gd", lbuf.definition, { desc = "Definition" }) -map("i", "<C-k>", lbuf.hover) -map("n", " lr", lbuf.rename, { desc = "Rename" }) -map("n", " li", builtin.lsp_implementations, { desc = "Implementation" }) -map("n", " ls", lbuf.signature_help, { desc = "Signature help" }) -map("n", " lh", lbuf.typehierarchy, { desc = "Type hierarchy" }) -map("n", " lf", lbuf.references, { desc = "References" }) -map("n", " ll", lbuf.document_symbol, { desc = "List symbols" }) -map("n", " lt", lbuf.type_definition, { desc = "Type definition" }) --- map("n", " lls", vim.lsp.handlers["workspace/symbol"]) -map("n", " lq", diagnostic.setqflist, { desc = "Diagnostic quickfix" }) -map("n", " >>", diagnostic.goto_next, { desc = "Diagnostic next" }) -map("n", " <<", diagnostic.goto_prev, { desc = "Diagnostic prev" }) -map("n", " <,", function() -	diagnostic.goto_next({ severity = diagnostic.ERROR }) -end, { desc = "Diagnostic next error" }) -map("n", " >.", function() -	diagnostic.goto_prev({ severity = diagnostic.ERROR }) -end, { desc = "Diagnostic prev error" }) -map("n", " vf", diagnostic.open_float, { desc = "Diagnostics open floating window" }) --- map("n", " ") - --- vim.lsp.inlay_hint(0, false) - --- [[ LSP Setups ]] - -local lspconfig = require("lspconfig") -lspconfig.gopls.setup({}) --- lspconfig.clangd.setup({}) --- lspconfig.emmet_ls.setup({}) --- lspconfig.ts_ls.setup({}) --- lspconfig.powershell_es.setup({ --- 	cmd = { --- 		"pwsh", --- 		"-NoLog", --- 		"-NoProfile", --- 		"-Command", --- 		"/home/aluc/.local/share/nvim/mason/packages/" .. ---		"powershell-editor-services/PowerShellEditorServices/Start-EditorServices.ps1", --- 	}, --- }) --- lspconfig.lua_ls.setup({ --- 	-- with neovim support --- 	on_init = function(client) --- 		local path = client.workspace_folders[1].name --- 		if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then --- 			return --- 		end --- --- 		client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { --- 			runtime = { --- 				version = "LuaJIT", --- 			}, --- 			-- Make the server aware of Neovim runtime files --- 			workspace = { --- 				checkThirdParty = false, --- 				library = { --- 					vim.env.VIMRUNTIME, --- 				}, --- 			}, --- 		}) --- 	end, --- 	settings = { --- 		Lua = {}, --- 	}, --- }) - --- rounded border around floating windows -local _border = "rounded" -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { -	border = _border, -}) -vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { -	border = _border, -}) -vim.diagnostic.config({ -	float = { border = _border }, -}) - -local autocmd = vim.api.nvim_create_autocmd -autocmd("LspAttach", { -	callback = function(args) -		local client = vim.lsp.get_client_by_id(args.data.client_id) -		if client == nil then -			return -		end -		if vim.tbl_contains({ "null-ls" }, client.name) then -- blacklist lsp -			return -		end -	end, -}) - -local ls = require("luasnip") - -local parse_snippet = ls.parser.parse_snippet - -map({ "i", "s" }, "<C-h>", function() -	if ls.expand_or_locally_jumpable() then -		ls.expand_or_jump() -	end -end, { silent = true }) -map({ "i", "s" }, "<C-l>", function() -	if ls.locally_jumpable(-1) then -		ls.jump(-1) -	end -end, { silent = true }) -map({ "i", "s" }, "<C-c>", function() -	if ls.choice_active() then -		ls.change_choice(1) -	end -end, { silent = true }) - -ls.config.set_config({ -	history = true, -	-- Will update multiple nodes at the same time when in insert mode -	update_events = { "TextChanged", "TextChangedI" }, -}) - -ls.add_snippets("go", { -	parse_snippet("main", "package main\n\nfunc main() {\n\t$0\n}"), -	parse_snippet("e", "if err != nil {\n\tpanic(err)$1\n}$0"), -	parse_snippet("ee", "if err != nil {\n\tfmt.Fprintln(os.Stderr, err)$1\n\tos.Exit(${2:1})\n}\n$0"), -	parse_snippet("eif", "if err := $1; err != nil {\n\tfmt.Println(err)$2\n}\n$0"), -	parse_snippet("pf", "fmt.Printf($0)"), -	parse_snippet("pl", "fmt.Println($0)"), -}) -ls.add_snippets("sh", { -	parse_snippet("!", "#!/bin/sh\n$0"), -	parse_snippet("if", "if ${1:condition}; then\n\t$0\nfi"), -	parse_snippet("while", "while ${1:condition}; do\n\t$0\ndone"), -	parse_snippet("for", "for ${1:v} in ${2:list}; do\n\t$0\ndone"), -	parse_snippet("case", "case ${1:\\$var} in\n\t$0\nesac"), -}) -ls.add_snippets("c", { -	parse_snippet("main", "int\nmain(int Argc, char *Args[])\n{\n\t$0\n\treturn 0;\n}"), -	parse_snippet( -		"uints", -		[[#include <stdint.h> -typedef uint8_t  u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; -typedef int8_t  i8; -typedef int16_t i16; -typedef int32_t i32; -typedef int64_t i64; -typedef float  f32; -typedef double f64; -]] -	), -}) -ls.add_snippets("typescript", { parse_snippet("cl", "console.log($0);") }) -ls.add_snippets("html", { parse_snippet("t", [[<$1>$0</$1>]]) }) diff --git a/lua/config/map.lua b/lua/config/map.lua index 27c6bb9..80e2b6c 100644 --- a/lua/config/map.lua +++ b/lua/config/map.lua @@ -4,95 +4,70 @@ local map = vim.keymap.set  vim.g.mapleader = " "  vim.g.maplocalleader = "," +local function verbose_toggle(value, name) +	local toggle = value == false +	if toggle == true then +		print("Enabled " .. name .. ".") +	else +		print("Disabled " .. name .. ".") +	end +	return toggle +end  -- open config  map("n", " c", function()  	vim.cmd("cd ~/.config/nvim")  	vim.cmd("e " .. "init.lua")  end, { desc = "Open neovim config file" }) --- Move text easilly -map("v", "J", ":m '>+1<CR>gv=gv", { desc = "Move selected text up" }) -map("v", "K", ":m '<-2<CR>gv=gv", { desc = "Move selected text down" }) -map("n", "<M-b>", "<cmd>make<cr>", { desc = "Make" }) - --- better find next and previous -map("n", "n", "nzzzv", { desc = "Keep cursor in middle with search" }) -map("n", "N", "Nzzzv", { desc = "Keep cursor in middle with search" }) - -map("n", "J", "mzJ`z", { desc = "Move up next line with space in between" }) - --- greatest remap ever -map("x", " p", [["_dP]], { desc = "Paste while keeping the registry" }) - --- moving +-- insert navigation  map("i", "<C-a>", "<C-o>I", { noremap = true })  map("i", "<C-e>", "<C-o>A", { noremap = true })  -- buffers -map("n", " sp", "<cmd>sp<cr>", { desc = "Open horizontal split" }) -map("n", " vs", "<cmd>vs<cr>", { desc = "Open vertical split" })  map("n", " q", "<cmd>q!<cr>", { noremap = true })  map("n", " Q", "<cmd>qa!<cr>", { noremap = true }) --- close all except focused buffer -map("n", " 1", "<cmd>%bd|e#<cr>", { noremap = true }) --- next tab -map("n", "+", "<cmd>tabe .<cr>", { noremap = true }) +map("n", "!", "<cmd>sp<CR><cmd>term<CR>", { desc = "Open terminal" }) +map("n", "<M-b>", "<cmd>make<cr>", { desc = "Make" })  -- better indenting  map("v", "<", "<gv")  map("v", ">", ">gv") +map("v", "J", ":m '>+1<CR>gv=gv", { desc = "Move selected text up" }) +map("v", "K", ":m '<-2<CR>gv=gv", { desc = "Move selected text down" }) +map("x", " p", [["_dP]], { desc = "Paste while keeping the registry" }) +map("n", "n", "nzzzv", { desc = "Keep cursor in middle with search" }) +map("n", "N", "Nzzzv", { desc = "Keep cursor in middle with search" }) +map("n", "J", "mzJ`z", { desc = "Move up next line with space in between" })  -- allow for use of system clipboard fast  map({ "n", "v" }, " y", [["+y]])  map("n", " Y", [["+Y]])  map({ "n", "v" }, " P", [["+p]]) --- templates -map("n", "<LocalLeader>rt", ":-1r " .. vim.fn.stdpath("config") .. "/templates", { noremap = true }) -  -- hide all  local hidden = true -- flag  vim.api.nvim_create_user_command("Hide", function()  	hidden = hidden == false  	vim.opt.showmode = hidden  	vim.opt.ruler = hidden -	vim.opt.nu = hidden -	vim.opt.rnu = hidden  	vim.opt.showcmd = hidden  	vim.opt.laststatus = hidden and 2 or 0 -	vim.opt.signcolumn = hidden and "yes" or "no"  end, {}) --- write  map("n", " x", "!cx %", { desc = "Toggle file as executable" })  map("n", " w", "<cmd>write<cr>", { noremap = true }) -map("n", " W", "<cmd>write!<cr>", { noremap = true }) -map("n", " e", "<cmd>edit<cr>", { noremap = true })  map("n", ",s", function()  	vim.cmd.source()  	print("Sourced.")  end, { noremap = true }) --- Lazy -map("n", " P", "<cmd>Lazy<cr>", { noremap = true }) - -local function verbose_toggle(value, name) -	local toggle = value == false -	if toggle == true then -		print("Enabled " .. name .. ".") -	else -		print("Disabled " .. name .. ".") -	end -	return toggle -end -  -- spelling  map("n", " ts", function()  	vim.o.spell = verbose_toggle(vim.o.spell, "spelling")  end, { noremap = true, desc = "Toggle spelling" }) -map("n", "<C-s>g", "z=1<cr><cr>", { noremap = true }) -vim.diagnostic.enable(false) +map("n", "<c-s>g", "z=1<cr><cr>", { noremap = true, desc = "Correct word" }) +  map("n", " td", function()  	vim.diagnostic.enable(verbose_toggle(vim.diagnostic.is_enabled(), "diagnostics"))  end, { desc = "Toggle diagnostics" }) @@ -112,5 +87,3 @@ vim.api.nvim_create_user_command("Scratch", function()      setlocal noswapfile      ]])  end, {}) - -map("n", "<M-b>", "<cmd>make<cr>", { desc = "Make" }) diff --git a/lua/config/projects.lua b/lua/config/projects.lua index 8b71cb1..e2ad00a 100644 --- a/lua/config/projects.lua +++ b/lua/config/projects.lua @@ -14,7 +14,7 @@ M.Projects = {  M.InProject = false -for At, Project in pairs(M.Projects) do +for _, Project in pairs(M.Projects) do  	if string.find(CWD, Project.Path) then  		M.InProject = true  		Project.Options() diff --git a/lua/config/set.lua b/lua/config/set.lua index 4e4e045..467f46d 100644 --- a/lua/config/set.lua +++ b/lua/config/set.lua @@ -1,120 +1,78 @@  local opt = vim.opt +-- TODO: Check if HOME directory exists +local home = os.getenv("HOME") --- Don't highlight on search  opt.hlsearch = false  opt.incsearch = true  opt.conceallevel = 2 - --- Enable line numbers by default --- opt.number = true --- opt.relativenumber = true  opt.signcolumn = "no" - --- Tab settings  opt.tabstop = 4  opt.softtabstop = 4  opt.shiftwidth = 4  opt.expandtab = true - --- Enable smart indenting  opt.smartindent = true - --- Enable break indent  opt.breakindent = true +opt.backspace = "indent,eol,start" -local home = os.getenv("HOME") --- History settings  opt.undofile = true  opt.swapfile = true  opt.backup = true  opt.writebackup = true  opt.undodir = home .. "/.local/state/nvim" --- https://stackoverflow.com/a/1625850 --- TODO: Check if directory exists  opt.backupdir = home .. "/.local/share/Trash/nvim//,."  opt.directory = home .. "/.local/share/Trash/nvim//,." --- Case-insensitive searching UNLESS \C or capital in search  opt.ignorecase = true  opt.smartcase = true --- Decrease update time  opt.updatetime = 50  opt.timeoutlen = 300 - --- Set completeopt to have a better completion experience  opt.completeopt = "" - --- Enable true color support -opt.termguicolors = true - --- Enable scroll off  opt.scrolloff = 8 - --- Don't show mode I'm in, already have a nice status line for that -opt.showmode = false - --- Better split options  opt.splitbelow = true  opt.splitright = true - --- shared clipboard  opt.clipboard = "unnamed" --- do not highlight matched bracket + +opt.showmode = false  opt.showmatch = false --- highlight line at cursor  opt.cursorline = true  opt.textwidth = 100  -- opt.colorcolumn = "102" - --- status line --- show ruler +opt.termguicolors = true  opt.ruler = true --- show command  opt.showcmd = true -  opt.wildmenu = true -  opt.mouse = "" - -opt.backspace = "indent,eol,start" -  opt.laststatus = 2  opt.history = 200 +  -- opt.encoding = "utf-8"  -- opt.fileencoding = "utf-8" -  opt.smartindent = true  opt.scrolloff = 8 -  -- opt.spelllang = "en_us,nl"  opt.formatoptions = "tocqrnj" --- Get the current working directory, replace the $HOME portion of the path with ~, --- and extract the last three directories +opt.title = true + +-- vim.opt.fillchars = { fold = " " } +-- vim.opt.foldmethod = "indent" +vim.opt.foldenable = false +vim.opt.foldlevel = 99 +vim.g.markdown_folding = 1 +  local cwd = vim.fn.getcwd():gsub(home, "~") -local last_dirs = string.match(cwd, "[^/]+/[^/]+/[^/]+/?$") -if last_dirs then -	opt.titlestring = last_dirs .. " -> %t" +local IsInCWD = string.match(cwd, "[^/]+/[^/]+/[^/]+/?$") +if IsInCWD then +	opt.titlestring = IsInCWD .. " -> %t"  else  	opt.titlestring = cwd .. " -> %t"  end -opt.title = true -  -- Highlighting --- NOTE: -vim.fn.matchadd("matchNotes", "NOTE\\((.*)\\)\\?:")  vim.api.nvim_set_hl(0, "matchNotes", { fg = require("nord.colors").palette.frost.ice }) --- TODO: FIXME: +vim.fn.matchadd("matchNotes", "NOTE\\((.*)\\)\\?:")  vim.api.nvim_set_hl(0, "matchTodos", { fg = require("nord.colors").palette.aurora.yellow })  vim.fn.matchadd("matchTodos", "\\(TODO\\|FIXME\\)\\((.*)\\)\\?:") --- ERROR: BUG:  vim.api.nvim_set_hl(0, "matchErrors", { fg = require("nord.colors").palette.aurora.red })  vim.fn.matchadd("matchErrors", "\\(BUG\\|ERROR\\)\\((.*)\\)\\?:") - --- vim.opt.fillchars = { fold = " " } --- vim.opt.foldmethod = "indent" -vim.opt.foldenable = false -vim.opt.foldlevel = 99 -vim.g.markdown_folding = 1  | 
