emacs: Load neovim config from a Lua file

this allows for better editing experience compared to the stringly mess
from before.

So now Emacs is good for modifying NeoVim config, with support for both
Nix and Lua, and NeoVim is capable of editing Emacs config via orgmode.
Nice :)
This commit is contained in:
Payas Relekar 2023-09-13 19:11:31 +05:30
parent 43b013d7da
commit f131210561
7 changed files with 62 additions and 50 deletions

View file

@ -1,7 +1,8 @@
{ config, pkgs, ... }:
{ ... }:
{
imports = [
../../modules/common-home.nix
../../modules/neovim/nvim.nix
];
}

View file

@ -1162,7 +1162,7 @@ When Emacs is opened in Windows Subsystem for Linux, open web links in Firefox o
** Lua
#+begin_src emacs-lisp :lexical t
(use-package! lua-mode
:config
:init
(setq! lua-indent-close-paren-align nil
lua-indent-level 4
lua-indent-nested-block-content-align t))

View file

@ -3,6 +3,7 @@
{
imports = [
../../modules/common-home.nix
../../modules/neovim/nvim.nix
./mail.nix
./emacs.nix

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, ... }:
{
home.stateVersion = "22.05";
@ -78,52 +78,6 @@
enableFishIntegration = true;
};
neovim = {
enable = true;
vimAlias = true;
withPython3 = false;
withRuby = false;
withNodeJs = false;
plugins = with pkgs.vimPlugins; [
nvim-treesitter.withAllGrammars
neogit
orgmode
lualine-nvim
];
extraConfig = ''
set nobackup
set number
set relativenumber
'';
extraLuaConfig = ''
-- Neogit (magit clone)
local neogit = require('neogit')
neogit.setup {}
-- Lualine
require('lualine').setup()
-- Load custom treesitter grammar for org filetype
require('orgmode').setup_ts_grammar()
-- Treesitter configuration
require('nvim-treesitter.configs').setup {
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
-- highlighting will fallback to default Vim syntax highlighting
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = {'org'},
},
}
require('orgmode').setup({
org_agenda_files = {'~/org/**/*'},
})
'';
};
htop = {
enable = true;
settings = {

32
modules/neovim/init.lua Normal file
View file

@ -0,0 +1,32 @@
-- Vim/NeoVim built-ins
vim.o.nobackup = true
vim.o.number = true
vim.o.relativenumber = true
-- Neogit (magit clone)
require('neogit').setup()
-- Lualine
require('lualine').setup()
-- Load custom treesitter grammar for org filetype
require('orgmode').setup_ts_grammar()
-- Treesitter configuration
require('nvim-treesitter.configs').setup {
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
-- highlighting will fallback to default Vim syntax highlighting
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = {'org'},
},
}
-- Orgmode
require('orgmode').setup({
org_agenda_files = {
'~/org/**/*'
},
})

24
modules/neovim/nvim.nix Normal file
View file

@ -0,0 +1,24 @@
{ pkgs, ... }:
{
xdg.configFile = {
"nvim/init.lua" = {
source = ./init.lua;
};
};
programs = {
neovim = {
enable = true;
vimAlias = true;
withPython3 = false;
withRuby = false;
withNodeJs = false;
plugins = with pkgs.vimPlugins; [
nvim-treesitter.withAllGrammars
neogit
orgmode
lualine-nvim
];
};
};
}

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ ... }:
{
imports = [