neovim: port to nixos config instead of home-manager
This commit is contained in:
@@ -1,23 +1,17 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
lib.mkIf config.sane.home-manager.enable
|
let
|
||||||
{
|
inherit (builtins) map;
|
||||||
# private because there could be sensitive things in the swap
|
inherit (lib) concatMapStrings optionalString;
|
||||||
sane.persist.home.private = [ ".cache/vim-swap" ];
|
# this structure roughly mirrors home-manager's `programs.neovim.plugins` option
|
||||||
|
|
||||||
home-manager.users.colin.programs.neovim = {
|
|
||||||
# neovim: https://github.com/neovim/neovim
|
|
||||||
enable = true;
|
|
||||||
viAlias = true;
|
|
||||||
vimAlias = true;
|
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
# docs: surround-nvim: https://github.com/ur4ltz/surround.nvim/
|
# docs: surround-nvim: https://github.com/ur4ltz/surround.nvim/
|
||||||
# docs: vim-surround: https://github.com/tpope/vim-surround
|
# docs: vim-surround: https://github.com/tpope/vim-surround
|
||||||
vim-surround
|
{ plugin = vim-surround; }
|
||||||
# docs: fzf-vim (fuzzy finder): https://github.com/junegunn/fzf.vim
|
# docs: fzf-vim (fuzzy finder): https://github.com/junegunn/fzf.vim
|
||||||
fzf-vim
|
{ plugin = fzf-vim; }
|
||||||
# docs: https://github.com/KeitaNakamura/tex-conceal.vim/
|
|
||||||
({
|
({
|
||||||
|
# docs: tex-conceal-vim: https://github.com/KeitaNakamura/tex-conceal.vim/
|
||||||
plugin = tex-conceal-vim;
|
plugin = tex-conceal-vim;
|
||||||
type = "viml";
|
type = "viml";
|
||||||
config = ''
|
config = ''
|
||||||
@@ -34,11 +28,11 @@ lib.mkIf config.sane.home-manager.enable
|
|||||||
" autocmd Syntax tex set conceallevel=2
|
" autocmd Syntax tex set conceallevel=2
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
({
|
||||||
# treesitter syntax highlighting: https://nixos.wiki/wiki/Tree_sitters
|
# treesitter syntax highlighting: https://nixos.wiki/wiki/Tree_sitters
|
||||||
# docs: https://github.com/nvim-treesitter/nvim-treesitter
|
# docs: https://github.com/nvim-treesitter/nvim-treesitter
|
||||||
# config taken from: https://github.com/i077/system/blob/master/modules/home/neovim/default.nix
|
# config taken from: https://github.com/i077/system/blob/master/modules/home/neovim/default.nix
|
||||||
# this is required for tree-sitter to even highlight
|
# this is required for tree-sitter to even highlight
|
||||||
({
|
|
||||||
plugin = nvim-treesitter.withAllGrammars;
|
plugin = nvim-treesitter.withAllGrammars;
|
||||||
type = "lua";
|
type = "lua";
|
||||||
config = ''
|
config = ''
|
||||||
@@ -72,7 +66,25 @@ lib.mkIf config.sane.home-manager.enable
|
|||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
extraConfig = ''
|
plugin-packages = map (p: p.plugin) plugins;
|
||||||
|
plugin-config-tex = concatMapStrings (p: optionalString (p.type or "" == "viml") p.config) plugins;
|
||||||
|
plugin-config-lua = concatMapStrings (p: optionalString (p.type or "" == "lua") p.config) plugins;
|
||||||
|
in
|
||||||
|
lib.mkIf config.sane.home-manager.enable
|
||||||
|
{
|
||||||
|
# private because there could be sensitive things in the swap
|
||||||
|
sane.persist.home.private = [ ".cache/vim-swap" ];
|
||||||
|
|
||||||
|
programs.neovim = {
|
||||||
|
# neovim: https://github.com/neovim/neovim
|
||||||
|
enable = true;
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
|
configure = {
|
||||||
|
packages.myVimPackage = {
|
||||||
|
start = plugin-packages;
|
||||||
|
};
|
||||||
|
customRC = ''
|
||||||
" let the terminal handle mouse events, that way i get OS-level ctrl+shift+c/etc
|
" let the terminal handle mouse events, that way i get OS-level ctrl+shift+c/etc
|
||||||
" this used to be default, until <https://github.com/neovim/neovim/pull/19290>
|
" this used to be default, until <https://github.com/neovim/neovim/pull/19290>
|
||||||
set mouse=
|
set mouse=
|
||||||
@@ -104,6 +116,15 @@ lib.mkIf config.sane.home-manager.enable
|
|||||||
" source: https://www.reddit.com/r/neovim/comments/chlmfk/highlight_trailing_whitespaces_in_neovim/
|
" source: https://www.reddit.com/r/neovim/comments/chlmfk/highlight_trailing_whitespaces_in_neovim/
|
||||||
set list
|
set list
|
||||||
set listchars=tab:▷\·,trail:·,extends:◣,precedes:◢,nbsp:○
|
set listchars=tab:▷\·,trail:·,extends:◣,precedes:◢,nbsp:○
|
||||||
|
|
||||||
|
""""" PLUGIN CONFIG (tex)
|
||||||
|
${plugin-config-tex}
|
||||||
|
|
||||||
|
""""" PLUGIN CONFIG (lua)
|
||||||
|
lua <<EOF
|
||||||
|
${plugin-config-lua}
|
||||||
|
EOF
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user