neovim: port to nixos config instead of home-manager
This commit is contained in:
parent
f2c61d64b7
commit
2269016736
|
@ -1,23 +1,17 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
lib.mkIf config.sane.home-manager.enable
|
||||
{
|
||||
# private because there could be sensitive things in the swap
|
||||
sane.persist.home.private = [ ".cache/vim-swap" ];
|
||||
|
||||
home-manager.users.colin.programs.neovim = {
|
||||
# neovim: https://github.com/neovim/neovim
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
let
|
||||
inherit (builtins) map;
|
||||
inherit (lib) concatMapStrings optionalString;
|
||||
# this structure roughly mirrors home-manager's `programs.neovim.plugins` option
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# docs: surround-nvim: https://github.com/ur4ltz/surround.nvim/
|
||||
# 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
|
||||
fzf-vim
|
||||
# docs: https://github.com/KeitaNakamura/tex-conceal.vim/
|
||||
{ plugin = fzf-vim; }
|
||||
({
|
||||
# docs: tex-conceal-vim: https://github.com/KeitaNakamura/tex-conceal.vim/
|
||||
plugin = tex-conceal-vim;
|
||||
type = "viml";
|
||||
config = ''
|
||||
|
@ -34,11 +28,11 @@ lib.mkIf config.sane.home-manager.enable
|
|||
" autocmd Syntax tex set conceallevel=2
|
||||
'';
|
||||
})
|
||||
({
|
||||
# treesitter syntax highlighting: https://nixos.wiki/wiki/Tree_sitters
|
||||
# docs: https://github.com/nvim-treesitter/nvim-treesitter
|
||||
# config taken from: https://github.com/i077/system/blob/master/modules/home/neovim/default.nix
|
||||
# this is required for tree-sitter to even highlight
|
||||
({
|
||||
plugin = nvim-treesitter.withAllGrammars;
|
||||
type = "lua";
|
||||
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
|
||||
" this used to be default, until <https://github.com/neovim/neovim/pull/19290>
|
||||
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/
|
||||
set list
|
||||
set listchars=tab:▷\·,trail:·,extends:◣,precedes:◢,nbsp:○
|
||||
|
||||
""""" PLUGIN CONFIG (tex)
|
||||
${plugin-config-tex}
|
||||
|
||||
""""" PLUGIN CONFIG (lua)
|
||||
lua <<EOF
|
||||
${plugin-config-lua}
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user