Update lazyvim module
This commit is contained in:
@ -13,69 +13,138 @@ in {
|
|||||||
options.modules.lazyvim = import ./options.nix {inherit lib mylib;};
|
options.modules.lazyvim = import ./options.nix {inherit lib mylib;};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# TODO: Configure by option
|
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim";
|
||||||
VISUAL = "nvim";
|
VISUAL = "nvim";
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs;
|
||||||
|
builtins.concatLists [
|
||||||
|
(optionals cfg.neovide [neovide])
|
||||||
|
|
||||||
|
[
|
||||||
(pkgs.ripgrep.override {withPCRE2 = true;})
|
(pkgs.ripgrep.override {withPCRE2 = true;})
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
lua51Packages.lua-curl # For rest
|
||||||
|
lua51Packages.xml2lua # For rest
|
||||||
|
lua51Packages.mimetypes # For rest
|
||||||
|
lua51Packages.jsregexp # For tree-sitter
|
||||||
|
|
||||||
|
# Language servers
|
||||||
|
clang-tools_18
|
||||||
|
clojure-lsp
|
||||||
|
cmake-language-server
|
||||||
|
haskell-language-server
|
||||||
|
lua-language-server
|
||||||
|
nil
|
||||||
|
pyright
|
||||||
|
rust-analyzer
|
||||||
|
texlab
|
||||||
|
|
||||||
# Linters
|
# Linters
|
||||||
vale
|
checkstyle # java
|
||||||
|
clippy # rust
|
||||||
|
clj-kondo # clojure
|
||||||
|
eslint_d # javascript
|
||||||
|
python311Packages.flake8
|
||||||
|
lua51Packages.luacheck
|
||||||
|
vale # text
|
||||||
|
statix # nix
|
||||||
|
|
||||||
# Formatters
|
# Formatters
|
||||||
alejandra # nix
|
alejandra # nix
|
||||||
|
python311Packages.black
|
||||||
|
google-java-format
|
||||||
|
html-tidy
|
||||||
jq # json
|
jq # json
|
||||||
html-tidy # html
|
prettierd # html/css/js
|
||||||
|
rustfmt
|
||||||
|
stylua
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
home.file.".config/nvim/parser".source = let
|
||||||
|
parsers = pkgs.symlinkJoin {
|
||||||
|
name = "treesitter-parsers";
|
||||||
|
paths = pkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies;
|
||||||
|
};
|
||||||
|
in "${parsers}/parser";
|
||||||
|
|
||||||
|
home.file.".config/neovide/config.toml".text = ''
|
||||||
|
fork = true # Start neovide detached
|
||||||
|
frame = "none" # full, buttonless, none
|
||||||
|
idle = true # Don't render frames without changes
|
||||||
|
# maximized = true
|
||||||
|
title-hidden = true
|
||||||
|
# vsync = true
|
||||||
|
'';
|
||||||
|
|
||||||
|
home.file.".config/vale/.vale.ini".text = ''
|
||||||
|
# Core settings appear at the top
|
||||||
|
# (the "global" section).
|
||||||
|
|
||||||
|
[formats]
|
||||||
|
# Format associations appear under
|
||||||
|
# the optional "formats" section.
|
||||||
|
|
||||||
|
[*]
|
||||||
|
# Format-specific settings appear
|
||||||
|
# under a user-provided "glob"
|
||||||
|
# pattern.
|
||||||
|
'';
|
||||||
|
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultEditor = true;
|
defaultEditor = true;
|
||||||
enableMan = true;
|
enableMan = true;
|
||||||
colorschemes.catppuccin.enable = true;
|
luaLoader.enable = true;
|
||||||
|
# colorschemes.catppuccin.enable = true;
|
||||||
|
viAlias = cfg.alias;
|
||||||
|
vimAlias = cfg.alias;
|
||||||
|
|
||||||
opts = {
|
globals = {
|
||||||
ruler = true; # Show cursor position in status line
|
mapleader = " ";
|
||||||
number = true;
|
mallocalleader = " ";
|
||||||
relativenumber = false;
|
|
||||||
showmode = false; # Status line already shows this
|
|
||||||
backspace = ["indent" "eol" "start"];
|
|
||||||
undofile = true;
|
|
||||||
undodir = "/home/christoph/.vim/undo"; # TODO: Use username variable
|
|
||||||
encoding = "utf-8";
|
|
||||||
|
|
||||||
# Search
|
|
||||||
incsearch = true; # Already highlight results while typing
|
|
||||||
hlsearch = true;
|
|
||||||
ignorecase = true;
|
|
||||||
laststatus = 2;
|
|
||||||
hidden = true; # Don't unload buffers immediately
|
|
||||||
|
|
||||||
# Indentation
|
|
||||||
autoindent = true;
|
|
||||||
expandtab = true;
|
|
||||||
smartindent = true;
|
|
||||||
smarttab = true;
|
|
||||||
shiftwidth = 4;
|
|
||||||
softtabstop = 4;
|
|
||||||
|
|
||||||
termguicolors = true; # For bufferline
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
opts = import ./vim_opts.nix {inherit lib mylib;};
|
||||||
|
extraConfigLuaPost = builtins.readFile ./extraConfigLuaPost.lua;
|
||||||
|
|
||||||
|
# extraLuaPackages = with pkgs.lua51Packages; [];
|
||||||
|
|
||||||
|
# extraPython3Packages = p: [
|
||||||
|
# # For CHADtree
|
||||||
|
# p.pyyaml
|
||||||
|
# p.pynvim-pp
|
||||||
|
# p.std2
|
||||||
|
# ];
|
||||||
|
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
lazy-nvim
|
lazy-nvim
|
||||||
vim-airline-themes
|
|
||||||
nvim-web-devicons
|
|
||||||
# nvim-nio # For rest
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
event = ["BufWritePost"];
|
||||||
|
# pattern = "*";
|
||||||
|
callback = {__raw = "function() require('lint').try_lint() end";};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
event = ["BufWritePre"];
|
||||||
|
callback = {__raw = "function() require('conform').format() end";};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
# TODO: Toggle wrapping
|
||||||
|
# TODO: Toggle format on save
|
||||||
|
# TODO: Toggle format on paste
|
||||||
|
keymaps = import ./keybinds.nix {inherit lib mylib;};
|
||||||
|
|
||||||
extraConfigLua = let
|
extraConfigLua = let
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
# LazyVim
|
LazyVim # Sets many vim options
|
||||||
LazyVim
|
|
||||||
bufferline-nvim
|
bufferline-nvim
|
||||||
cmp-buffer
|
cmp-buffer
|
||||||
cmp-nvim-lsp
|
cmp-nvim-lsp
|
||||||
@ -148,6 +217,7 @@ in {
|
|||||||
path = mini-nvim;
|
path = mini-nvim;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
mkEntryFromDrv = drv:
|
mkEntryFromDrv = drv:
|
||||||
if lib.isDerivation drv
|
if lib.isDerivation drv
|
||||||
then {
|
then {
|
||||||
@ -155,37 +225,14 @@ in {
|
|||||||
path = drv;
|
path = drv;
|
||||||
}
|
}
|
||||||
else drv;
|
else drv;
|
||||||
lazyPath = pkgs.linkFarm "lazy-plugins" (builtins.map mkEntryFromDrv plugins);
|
|
||||||
in ''
|
|
||||||
require("lazy").setup({
|
|
||||||
defaults = {
|
|
||||||
lazy = true,
|
|
||||||
},
|
|
||||||
dev = {
|
|
||||||
-- reuse files from pkgs.vimPlugins.*
|
|
||||||
path = "${lazyPath}",
|
|
||||||
patterns = { "." },
|
|
||||||
-- fallback to download
|
|
||||||
fallback = true,
|
|
||||||
},
|
|
||||||
spec = {
|
|
||||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
|
||||||
-- The following configs are needed for fixing lazyvim on nix
|
|
||||||
-- force enable telescope-fzf-native.nvim
|
|
||||||
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = true },
|
|
||||||
-- disable mason.nvim, use config.extraPackages
|
|
||||||
{ "williamboman/mason-lspconfig.nvim", enabled = false },
|
|
||||||
{ "williamboman/mason.nvim", enabled = false },
|
|
||||||
-- uncomment to import/override with your plugins
|
|
||||||
-- { import = "plugins" },
|
|
||||||
-- put this line at the end of spec to clear ensure_installed
|
|
||||||
{ "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
|
|
||||||
viAlias = cfg.alias;
|
lazyPath = pkgs.linkFarm "lazy-plugins" (builtins.map mkEntryFromDrv plugins);
|
||||||
vimAlias = cfg.alias;
|
in (
|
||||||
|
builtins.replaceStrings
|
||||||
|
["@lazyPath@"]
|
||||||
|
["${lazyPath}"]
|
||||||
|
(builtins.readFile ./extraConfigLua.lua)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,5 @@
|
|||||||
-- Package manager setup
|
-- Skip loading LazyVim options
|
||||||
require("lazy").setup({
|
package.loaded["lazyvim.config.options"] = true
|
||||||
defaults = {
|
|
||||||
lazy = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
dev = {
|
|
||||||
-- reuse files from pkgs.vimPlugins.*
|
|
||||||
path = "@lazyPath@", -- NOTE: Will be replaced by the nix path
|
|
||||||
patterns = { "." },
|
|
||||||
-- fallback to download
|
|
||||||
fallback = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
spec = {
|
|
||||||
-- { "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
|
||||||
-- The following configs are needed for fixing lazyvim on nix
|
|
||||||
-- force enable telescope-fzf-native.nvim
|
|
||||||
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = true },
|
|
||||||
-- disable mason.nvim, use config.extraPackages
|
|
||||||
{ "williamboman/mason-lspconfig.nvim", enabled = false },
|
|
||||||
{ "williamboman/mason.nvim", enabled = false },
|
|
||||||
-- uncomment to import/override with your plugins
|
|
||||||
-- { import = "plugins" },
|
|
||||||
-- put this line at the end of spec to clear ensure_installed
|
|
||||||
{ "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Hide inline diagnostics and show border
|
-- Hide inline diagnostics and show border
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
@ -39,3 +13,46 @@ vim.api.nvim_set_keymap("c", "<Up>", 'v:lua.get_wildmenu_key("<left>", "<up>")',
|
|||||||
function _G.get_wildmenu_key(key_wildmenu, key_regular)
|
function _G.get_wildmenu_key(key_wildmenu, key_regular)
|
||||||
return vim.fn.wildmenumode() ~= 0 and key_wildmenu or key_regular
|
return vim.fn.wildmenumode() ~= 0 and key_wildmenu or key_regular
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Package manager setup
|
||||||
|
require("lazy").setup({
|
||||||
|
defaults = {
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
dev = {
|
||||||
|
-- reuse files from pkgs.vimPlugins.*
|
||||||
|
path = "@lazyPath@", -- NOTE: Will be replaced by the nix path
|
||||||
|
|
||||||
|
patterns = { "." },
|
||||||
|
|
||||||
|
-- fallback to download
|
||||||
|
fallback = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
{
|
||||||
|
"LazyVim/LazyVim",
|
||||||
|
import = "lazyvim.plugins",
|
||||||
|
opts = {
|
||||||
|
defaults = {
|
||||||
|
autocmds = false, -- Skip loading LazyVim cmds
|
||||||
|
keymaps = false, -- Skip loading LazyVim keymaps
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- force enable telescope-fzf-native.nvim on nix
|
||||||
|
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = true },
|
||||||
|
|
||||||
|
-- disable mason.nvim, use config.extraPackages on nix
|
||||||
|
{ "williamboman/mason-lspconfig.nvim", enabled = false },
|
||||||
|
{ "williamboman/mason.nvim", enabled = false },
|
||||||
|
|
||||||
|
-- uncomment to import/override with your plugins
|
||||||
|
-- { import = "plugins" },
|
||||||
|
|
||||||
|
-- put this line at the end of spec to clear ensure_installed on nix
|
||||||
|
{ "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
@ -7,4 +7,5 @@ with lib;
|
|||||||
with mylib.modules; {
|
with mylib.modules; {
|
||||||
enable = mkEnableOpt "LazyVim";
|
enable = mkEnableOpt "LazyVim";
|
||||||
alias = mkBoolOpt false "Link nvim to vim/vi";
|
alias = mkBoolOpt false "Link nvim to vim/vi";
|
||||||
|
neovide = mkEnableOpt "NeoVide";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user