summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@spacehb.net>2025-04-05 15:36:12 +0200
committerRaymaekers Luca <luca@spacehb.net>2025-04-05 15:36:12 +0200
commit2c433c348662ee6e4ee5c99a8f5e400858013fa2 (patch)
tree09ebbb33f9a65be421890d4964f567676cf21967
parent19423cd7c17edae426c39e01683424089bc8c8c9 (diff)
checkpoint
-rw-r--r--lua/config/lazy.lua21
-rw-r--r--lua/config/map.lua66
-rw-r--r--lua/config/projects.lua2
-rw-r--r--lua/config/set.lua80
4 files changed, 41 insertions, 128 deletions
diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua
index 4ced567..3fd9dc9 100644
--- a/lua/config/lazy.lua
+++ b/lua/config/lazy.lua
@@ -6,13 +6,12 @@ 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-vinegar",
@@ -42,20 +41,16 @@ require("lazy").setup({
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 },
@@ -66,7 +61,6 @@ require("lazy").setup({
end,
},
{
- -- Fuzzy Finder (files, lsp, etc)
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
@@ -83,8 +77,6 @@ require("lazy").setup({
build = ":TSUpdate",
},
}, {
-
- -- lazy options
performance = {
rtp = {
disabled_plugins = {
@@ -96,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/map.lua b/lua/config/map.lua
index fe0672c..80e2b6c 100644
--- a/lua/config/map.lua
+++ b/lua/config/map.lua
@@ -4,96 +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" })
@@ -113,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