init.lua

Overview

Note: you need to change the theme to something that does not use
pywal if you dont have it installed on your system.
run :help colorscheme in nvim.
 
Start with the Prerequisites Install some prerequisites such as a LaTeX-Compiler aswell as a pdf-reader.

 
The init.lua is sourcing the four config files below:

  • Options
    Defines the basic behaviour and visual appearance of the editor
    (line numbers, indentation depth, clipboard behaviour and global
    display settings).
  • Lazy
    Specify which plugins are installed, how they are loaded, and what settings they require on startup.
  • Keymaps
    Define personal keyboard shortcuts in here.
  • Autocmds
    Automatic event-driven actions.
     
-- Set leader keys first (before lazy.nvim)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"

-- Sourcing Config
require("config.options")
require("config.lazy")
require("config.keymaps")
require("config.autocmds")

-- Setting the Theme
vim.api.nvim_create_autocmd("VimEnter", {
  callback = function()
    require("neopywal").setup()
    vim.cmd.colorscheme("neopywal")
  end,
})

prerequisites

Prerequisites

 
This nvim config is for writing markdown, daily notes and/or
academic writing. Hence we need to install some prerequisites such
as a LaTeX-Compiler aswell as a pdf-reader on the system. You can
switch my options for software you like more, but be aware that some
of the nvim plugins are tailored around my choices.

 

PDF-Reader: Sioyek

Sioyek is nice becauce it comes with many features, is scriptable an has vim-keybindings from the go.

[]

autocmds.lua

Overview

This module automates specific behaviors based on file types, buffer
events, or external system changes. It ensures that Markdown files
are formatted correctly, color themes (Pywal) are synchronized, and
the Kitty terminal font switches dynamically between coding and
writing modes.

-- ~/.config/nvim/lua/config/autocmds.lua
-- ------------------------------------
-- Markdown Settings
-- ------------------------------------
-- Markdown textwidth (Define when Linebreaks occur)
-- ------------------------------------
vim.api.nvim_create_autocmd({"FileType", "BufEnter"}, {
	pattern = "*.md",
	callback = function()
		if vim.bo.filetype == "markdown" then
			vim.opt_local.textwidth = 70
		end
	end,
})

-- CMD's for Markdown files
vim.api.nvim_create_autocmd("FileType", {
	pattern = "markdown",
	callback = function()
		vim.cmd("SoftPencil")
	end,
})

-- ------------------------------------
-- MISC
-- ------------------------------------
-- Pywal auto-reload
-- ------------------------------------
vim.api.nvim_create_autocmd({ "BufWritePost", "FileChangedShell" }, {
	group = vim.api.nvim_create_augroup("PywalAutoReload", { clear = true }),
	pattern = vim.fn.expand("~/.cache/wal/colors-wal.vim"),
	callback = function()
		if vim.fn.filereadable(vim.fn.expand("~/.cache/wal/colors-wal.vim")) == 1 then
			vim.cmd("silent! source ~/.cache/wal/colors-wal.vim")
		end
	end,
})


-- ------------------------------------
-- User commands
-- ------------------------------------
-- Convert .md to PDF
-- ------------------------------------
vim.api.nvim_create_user_command("ConvertToPDF", function()
	local choice = vim.fn.inputlist({
		"Select template:",
		"1. University (uni.latex)",
		"2. Simple (simple.latex)"
	})

	if choice < 1 or choice > 2 then return end

	local templates = { "uni", "simple" }
	local script = vim.fn.expand("~/bin/md2pdf.sh")

	if vim.fn.filereadable(script) == 1 then
		vim.cmd("lcd %:p:h | !" .. script .. " %:p " .. templates[choice])
	else
		vim.notify("md2pdf.sh not found", vim.log.levels.ERROR)
	end
end, {})

-- ------------------------------------
-- --- Kitty Font Switch for .md --- --
-- ------------------------------------
local default_font_conf = "~/.config/kitty/font_default.conf"
local markdown_font_conf = "~/.config/kitty/font_markdown.conf"

local function switch_kitty_font()
  local current_ft = vim.bo.filetype
  local buf_name = vim.api.nvim_buf_get_name(0)

  -- 1. to .md font
  if current_ft == "markdown" then
    local cmd = string.format("kitty @ load-config %s", markdown_font_conf)
    vim.schedule(function() vim.fn.system(cmd) end)
    return
  end

  -- 2. Wenn wir im Prose-Analyzer oder in der Toolbar sind: TU NICHTS.
  -- Das behält die aktuelle Schriftart (Markdown) einfach bei.
  if current_ft == "prose_summary" or buf_name:find("ProseAnalyzer Summary") or current_ft == "" then
    return 
  end

  -- 3. Liste standard font
  local force_default_ft = {
    ["lua"] = true,
    ["sh"] = true,
    ["python"] = true,
    ["conf"] = true,
    ["kitty"] = true,
    ["help"] = true,
  }

  -- 4. set back 
  if force_default_ft[current_ft] then
    local cmd = string.format("kitty @ load-config %s", default_font_conf)
    vim.schedule(function() vim.fn.system(cmd) end)
  end
end

local font_switcher_group = vim.api.nvim_create_augroup("KittyFontSwitcher", { clear = true })

-- toggle switch
vim.api.nvim_create_autocmd({ "FileType", "BufWinEnter" }, {
  pattern = "*",
  group = font_switcher_group,
  callback = function()
    switch_kitty_font()
  end,
})

-- back to default on quit
vim.api.nvim_create_autocmd("VimLeave", {
  group = font_switcher_group,
  callback = function()
    local cmd = string.format("kitty @ load-config %s", default_font_conf)
    vim.fn.system(cmd)
  end,
})
[]

init.lua

init.lua

Overview

Note: you need to change the theme if you don’t have pywal installed on your system.
run :help colorscheme in nvim.
 
Start with the Prerequisites to install dependencies such as a LaTeX-Compiler aswell as a pdf-reader.

 
The init.lua is sourcing the four config files below:

  • Options
    Defines the basic behaviour and visual appearance of the editor
    (line numbers, indentation depth, clipboard behaviour and global
    display settings).
  • Lazy
    Specify which plugins are installed, how they are loaded, and what settings they require on startup.
  • Keymaps
    Define personal keyboard shortcuts in here.
  • Autocmds
    Automatic event-driven actions.
     
-- Set leader keys first (before lazy.nvim)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"

-- Sourcing Config
require("config.options")
require("config.lazy")
require("config.keymaps")
require("config.autocmds")

-- Setting the Theme
vim.api.nvim_create_autocmd("VimEnter", {
  callback = function()
    require("neopywal").setup()
    vim.cmd.colorscheme("neopywal")
  end,
})
[]

lazy.lua

Overview

Manages all external extensions, ensures their automatic installation (Bootstrap), and keeps them updated in the background (Checker).
 
 

-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
  local out = vim.fn.system({ 
    "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath 
  })
  if vim.v.shell_error ~= 0 then
    vim.notify("Failed to clone lazy.nvim:\n" .. out, vim.log.levels.ERROR)
    vim.fn.getchar()
    os.exit(1)
  end
end
vim.opt.rtp:prepend(lazypath)

-- Plugin Setup
require("lazy").setup({
  spec = {
    -- MDVim plugins
    { import = "plugins.treesitter" },
    { import = "plugins.screensaver" },
    { import = "plugins.mdcanvas" },
    { import = "plugins.fugitive" },
    { import = "plugins.flash" },
    { import = "plugins.pomo" },
    { import = "plugins.img-clip" },
    { import = "plugins.snacks" },
    { import = "plugins.obsidian" },
    { import = "plugins.todo" },
    { import = "plugins.easytables" },
    { import = "plugins.vim-autoread" },
    { import = "plugins.render-markdown" },
    { import = "plugins.which-key" },
    { import = "plugins.footnote" },
    { import = "plugins.pencil" },
    { import = "plugins.vim-markdown" },
    { import = "plugins.cmp" },
    { import = "plugins.cmp-rg" },
    { import = "plugins.stay-centered" },
    { import = "plugins.lualine" },
    { import = "plugins.yazi" },
    { import = "plugins.telescope" },

    -- Own Plugins
    { import = "plugins.glossator-nvim" },
    { import = "plugins.ltqf" }, 
    { import = "plugins.md-toc" },
    { import = "plugins.recollect" },
    { import = "plugins.sioyek-highlights" },
    { import = "plugins.bibman" },
    { import = "plugins.hmw" },
    { import = "plugins.toce" },
    { import = "plugins.md2pdf" },
    { import = "plugins.prose-analyzer" },
    { import = "plugins.citation-nvim" },
    { import = "plugins.weblink_reader" },

    -- Personal Setup
    { import = "plugins.kitty-scrollback" },
    { import = "plugins.neopywal" },
  },
  checker = { 
    enabled = true,  -- automatically checks for plugin updates in the background.
    notify = false,  -- does it silently 
  },
})
[]

options.lua

Overview

You can define basic behaviour and visual appearance of the editor
(line numbers, indentation depth, clipboard behaviour and global
display settings) in here.

-- General Settings

-- Display Options
vim.opt.fillchars = { eob = " " }  -- Set end-of-buffer character (remove ~ symbols)
vim.opt.termguicolors = true       -- Enable true color support for better colors
vim.opt.showmode = false           -- Don't show mode in command line (handled by statusline)
vim.opt.ruler = false              -- Don't show cursor position in command line
vim.opt.laststatus = 2             -- Always show statusline
vim.opt.cmdheight = 0              -- Hide command line when not used
vim.opt.conceallevel = 2		   -- what md elements to show
vim.opt.shortmess:append("c")	   -- Unterdrücke completion messages
vim.opt.more = false          	   -- Kein "Press ENTER to continue"

-- Line Numbers
vim.opt.relativenumber = true      -- Show relative line numbers for easy jumping
vim.opt.number = true              -- Show absolute line number at cursor line

-- Indentation
vim.opt.tabstop = 2                -- Number of spaces for a tab character
vim.opt.shiftwidth = 2             -- Number of spaces for indentation (>>, <<)

-- System Integration
vim.opt.clipboard = "unnamedplus"  -- Use system clipboard for all operations
vim.opt.encoding = "utf-8"         -- Set file encoding to UTF-8

-- Search Behavior
vim.opt.ignorecase = true          -- Case-insensitive search by default
vim.opt.smartcase = true           -- Override ignorecase if uppercase letters in pattern
[]