2022-01-23 01:32:58 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (lib) getName mkIf optional;
|
|
|
|
# inherit (config.lib.file) mkOutOfStoreSymlink;
|
|
|
|
nixConfigDir = "${config.home.homeDirectory}/dotfiles.nix";
|
|
|
|
|
2022-02-10 05:09:07 +00:00
|
|
|
# nvr = "${pkgs.neovim-remote}/bin/nvr";
|
2022-01-23 01:32:58 +00:00
|
|
|
|
|
|
|
pluginWithDeps = plugin: deps: plugin.overrideAttrs (_: { dependencies = deps; });
|
|
|
|
|
|
|
|
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;
|
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
|
|
|
vimdiffAlias = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Config and plugins ------------------------------------------------------------------------- {{{
|
|
|
|
|
2022-06-27 18:50:03 +00:00
|
|
|
home.sessionVariables = {
|
|
|
|
EDITOR = "nvim";
|
|
|
|
};
|
|
|
|
|
2022-02-10 05:09:07 +00:00
|
|
|
# TODO: migrate to lua config
|
2022-01-23 01:32:58 +00:00
|
|
|
# Minimal init.vim config to load Lua config. Nix and Home Manager don't currently support
|
|
|
|
# `init.lua`.
|
|
|
|
# xdg.configFile."nvim/lua".source = mkOutOfStoreSymlink "${nixConfigDir}/configs/nvim/lua";
|
|
|
|
# xdg.configFile."nvim/colors".source = mkOutOfStoreSymlink "${nixConfigDir}/configs/nvim/colors";
|
|
|
|
# programs.neovim.extraConfig = "lua require('init')";
|
2022-02-10 05:09:07 +00:00
|
|
|
programs.neovim.extraConfig = builtins.readFile ../configs/init.vim;
|
2022-01-23 01:32:58 +00:00
|
|
|
|
|
|
|
programs.neovim.plugins = with pkgs.vimPlugins; [
|
2022-02-10 05:09:07 +00:00
|
|
|
neovim-sensible
|
2022-01-23 01:32:58 +00:00
|
|
|
tabular
|
|
|
|
vim-commentary
|
|
|
|
vim-surround
|
2022-02-12 07:19:07 +00:00
|
|
|
tokyonight-nvim
|
2022-02-10 05:09:07 +00:00
|
|
|
lightline-vim
|
|
|
|
vim-fish
|
|
|
|
vim-nix
|
|
|
|
ctrlp
|
2022-01-23 01:32:58 +00:00
|
|
|
] ++ map (p: { plugin = p; optional = true; }) [
|
|
|
|
which-key-nvim
|
|
|
|
zoomwintab-vim
|
2022-02-10 05:09:07 +00:00
|
|
|
nvim-treesitter
|
2022-01-23 01:32:58 +00:00
|
|
|
] ++ map nonVSCodePlugin [
|
|
|
|
direnv-vim
|
|
|
|
vim-fugitive
|
2022-02-10 05:09:07 +00:00
|
|
|
dhall-vim
|
|
|
|
haskell-vim
|
2022-01-23 01:32:58 +00:00
|
|
|
];
|
|
|
|
# }}}
|
|
|
|
|
|
|
|
# Shell related ------------------------------------------------------------------------------ {{{
|
|
|
|
|
|
|
|
# From personal addon module `./modules/programs/neovim/extras.nix`
|
|
|
|
programs.neovim.extras.termBufferAutoChangeDir = true;
|
|
|
|
programs.neovim.extras.nvrAliases.enable = true;
|
|
|
|
|
2022-02-10 05:09:07 +00:00
|
|
|
# programs.fish.functions.set-nvim-background = mkIf config.programs.neovim.enable {
|
|
|
|
# # See `./shells.nix` for more on how this is used.
|
|
|
|
# body = ''
|
|
|
|
# # Set `background` of all running Neovim instances base on `$term_background`.
|
|
|
|
# for server in (${nvr} --serverlist)
|
|
|
|
# ${nvr} -s --nostart --servername $server -c "set background=$term_background" &
|
|
|
|
# end
|
|
|
|
# '';
|
|
|
|
# onVariable = "term_background";
|
|
|
|
# };
|
2022-01-23 01:32:58 +00:00
|
|
|
|
2022-02-10 05:09:07 +00:00
|
|
|
# programs.fish.interactiveShellInit = mkIf config.programs.neovim.enable ''
|
|
|
|
# # Run Neovim related functions on init for their effects, and to register them so they are
|
|
|
|
# # triggered when the relevant event happens or variable changes.
|
|
|
|
# set-nvim-background
|
|
|
|
# '';
|
2022-01-23 01:32:58 +00:00
|
|
|
# }}}
|
|
|
|
|
|
|
|
# Required packages -------------------------------------------------------------------------- {{{
|
|
|
|
|
|
|
|
programs.neovim.extraPackages = with pkgs; [
|
2022-02-10 05:09:07 +00:00
|
|
|
# neovim-remote
|
2022-01-23 01:32:58 +00:00
|
|
|
gcc # needed for nvim-treesitter
|
|
|
|
tree-sitter # needed for nvim-treesitter
|
|
|
|
|
|
|
|
# Language servers
|
|
|
|
# See `../configs/nvim/lua/init.lua` for configuration.
|
|
|
|
# ccls
|
|
|
|
nodePackages.bash-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;
|
|
|
|
# }}}
|
2022-01-23 23:50:34 +00:00
|
|
|
}
|