From c5aaacf0f9bb440fb5e6c8acb441753ce3d3cad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 26 Mar 2023 18:27:41 +0200 Subject: [PATCH] refactor(nvim): move options to seperate file --- modules/programs/nvim/default.nix | 6 ++++- modules/programs/nvim/init.lua | 39 ------------------------------- modules/programs/nvim/options.lua | 38 ++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 40 deletions(-) create mode 100644 modules/programs/nvim/options.lua diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 3a32217..2e09fc8 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -41,7 +41,11 @@ in vimdiffAlias = true; withNodeJs = true; withPython3 = true; - extraLuaConfig = builtins.readFile ./init.lua; + extraLuaConfig = lib.concatLines ( + builtins.map + builtins.readFile + [ ./options.lua ./init.lua ] + ); extraPackages = with pkgs; [ alejandra black diff --git a/modules/programs/nvim/init.lua b/modules/programs/nvim/init.lua index 3a9ce13..a24dc95 100644 --- a/modules/programs/nvim/init.lua +++ b/modules/programs/nvim/init.lua @@ -1,42 +1,3 @@ -vim.g.mapleader = " " -vim.g.maplocalleader = "," - --- FIX to create spell dir if not existent -local spelldir = vim.fn.stdpath("data") .. "/site/spell" -if not vim.loop.fs_stat(spelldir) then - vim.fn.mkdir(spelldir, "p") -end - -vim.opt.autoindent = true -vim.opt.backupdir = { vim.fn.stdpath("state") .. "/nvim/backup/" } -- don't store backup in files dir -vim.opt.clipboard = "unnamedplus" -- sync with system clipboard -vim.opt.conceallevel = 2 -vim.opt.expandtab = true -- spaces instead of tabs -vim.opt.ignorecase = true -vim.opt.mouse = "a" -- mouse for all modes -vim.opt.number = true -vim.opt.relativenumber = true -vim.opt.scrolloff = 4 -- lines of context -vim.opt.shiftround = true -- round indent -vim.opt.shiftwidth = 0 -- use tabstop value -vim.opt.shortmess:append({ c = true }) -vim.opt.signcolumn = "yes" -vim.opt.smartcase = true -vim.opt.splitbelow = true -vim.opt.splitright = true -vim.opt.tabstop = 2 -vim.opt.termguicolors = true -vim.opt.undofile = true -vim.opt.undolevels = 10000 -vim.opt.updatetime = 300 -vim.opt_local.spell = true -vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling - -if vim.g.neovide then - vim.opt.guifont = "Fira Code Nerd Font:h10" - vim.g.neovide_scale_factor = 0.7 -end - require("impatient") local wk = require("which-key") diff --git a/modules/programs/nvim/options.lua b/modules/programs/nvim/options.lua new file mode 100644 index 0000000..4ebf278 --- /dev/null +++ b/modules/programs/nvim/options.lua @@ -0,0 +1,38 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = "," + +-- FIX to create spell dir if not existent +local spelldir = vim.fn.stdpath("data") .. "/site/spell" +if not vim.loop.fs_stat(spelldir) then + vim.fn.mkdir(spelldir, "p") +end + +vim.opt.autoindent = true +vim.opt.backupdir = { vim.fn.stdpath("state") .. "/nvim/backup/" } -- don't store backup in files dir +vim.opt.clipboard = "unnamedplus" -- sync with system clipboard +vim.opt.conceallevel = 2 +vim.opt.expandtab = true -- spaces instead of tabs +vim.opt.ignorecase = true +vim.opt.mouse = "a" -- mouse for all modes +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.scrolloff = 4 -- lines of context +vim.opt.shiftround = true -- round indent +vim.opt.shiftwidth = 0 -- use tabstop value +vim.opt.shortmess:append({ c = true }) +vim.opt.signcolumn = "yes" +vim.opt.smartcase = true +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.tabstop = 2 +vim.opt.termguicolors = true +vim.opt.undofile = true +vim.opt.undolevels = 10000 +vim.opt.updatetime = 300 +vim.opt_local.spell = true +vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling + +if vim.g.neovide then + vim.opt.guifont = "Fira Code Nerd Font:h10" + vim.g.neovide_scale_factor = 0.7 +end