forked from malob/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneovim.nix
99 lines (89 loc) · 3.02 KB
/
neovim.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{ config, pkgs, lib, ... }:
# Let-In ----------------------------------------------------------------------------------------{{{
let
inherit (lib) getName mkIf optional;
inherit (config.lib.file) mkOutOfStoreSymlink;
inherit (config.home.user-info) nixConfigDirectory;
pluginWithDeps = plugin: deps: plugin.overrideAttrs (_: { dependencies = deps; });
nonVSCodePluginWithConfig = plugin: {
plugin = plugin;
optional = true;
config = ''
if !exists('g:vscode')
lua require('malo.' .. string.gsub('${plugin.pname}', '%.', '-'))
endif
'';
};
nonVSCodePlugin = plugin: {
plugin = plugin;
optional = true;
config = ''if !exists('g:vscode') | packadd ${plugin.pname} | endif'';
};
in
# }}}
{
# Neovim
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.neovim.enable
programs.neovim.enable = true;
# Config and plugins ------------------------------------------------------------------------- {{{
# Minimal init.vim config to load Lua config. Nix and Home Manager don't currently support
# `init.lua`.
xdg.configFile."nvim/lua".source = mkOutOfStoreSymlink "${nixConfigDirectory}/configs/nvim/lua";
xdg.configFile."nvim/colors".source = mkOutOfStoreSymlink "${nixConfigDirectory}/configs/nvim/colors";
programs.neovim.extraConfig = "lua require('init')";
programs.neovim.plugins = with pkgs.vimPlugins; [
lush-nvim
moses-nvim
tabular
vim-commentary
vim-eunuch
vim-haskell-module-name
vim-surround
] ++ map (p: { plugin = p; optional = true; }) [
telescope-symbols-nvim
telescope-z-nvim
which-key-nvim
zoomwintab-vim
] ++ map nonVSCodePlugin [
agda-vim
copilot-vim
direnv-vim
goyo-vim
vim-fugitive
] ++ map nonVSCodePluginWithConfig [
editorconfig-vim
(pluginWithDeps galaxyline-nvim [ nvim-web-devicons ])
gitsigns-nvim
indent-blankline-nvim
lspsaga-nvim
(pluginWithDeps bufferline-nvim [ nvim-web-devicons ])
(pluginWithDeps nvim-compe [ compe-tabnine ])
nvim-lspconfig
nvim-treesitter
(pluginWithDeps telescope-nvim [ nvim-web-devicons ])
vim-floaterm
vim-pencil
vim-polyglot
];
# From personal addon module `../modules/home/programs/neovim/extras.nix`
programs.neovim.extras.termBufferAutoChangeDir = true;
programs.neovim.extras.nvrAliases.enable = true;
# }}}
# Required packages -------------------------------------------------------------------------- {{{
programs.neovim.extraPackages = with pkgs; [
neovim-remote
gcc # needed for nvim-treesitter
tree-sitter # needed for nvim-treesitter
# Language servers
# See `../configs/nvim/lua/malo/nvim-lspconfig.lua` for configuration.
ccls
nodePackages.bash-language-server
nodePackages.typescript-language-server
nodePackages.vim-language-server
nodePackages.vscode-langservers-extracted
nodePackages.yaml-language-server
rnix-lsp
] ++ optional (pkgs.stdenv.system != "x86_64-darwin") sumneko-lua-language-server;
# }}}
}
# vim: foldmethod=marker