[fix] *.nix: reformat with alejandra
This commit is contained in:
parent
876dc45719
commit
39c2fb096c
26 changed files with 565 additions and 562 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
autoGroups."highlightOnYank" = { };
|
||||
autoGroups."lspConfig" = { };
|
||||
autoGroups."restoreCursorPosition" = { };
|
||||
autoGroups."highlightOnYank" = {};
|
||||
autoGroups."lspConfig" = {};
|
||||
autoGroups."restoreCursorPosition" = {};
|
||||
autoCmd = [
|
||||
{
|
||||
group = "highlightOnYank";
|
||||
|
@ -38,53 +38,51 @@
|
|||
group = "lspConfig";
|
||||
event = "LspAttach";
|
||||
pattern = "*";
|
||||
callback =
|
||||
let
|
||||
opts = "noremap = true, buffer = bufnr";
|
||||
in
|
||||
{
|
||||
__raw = ''
|
||||
function(opts)
|
||||
local bufnr = opts.buf
|
||||
local client = vim.lsp.get_client_by_id(opts.data.client_id)
|
||||
local capabilities = client.server_capabilities
|
||||
-- Set Omnifunc if supported
|
||||
if capabilities.completionProvider then
|
||||
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
end
|
||||
-- Enable inlay hints if supported
|
||||
if capabilities.inlayHintProvider then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end
|
||||
-- Some Lsp servers do not advertise inlay hints properly so enable this keybinding regardless
|
||||
vim.keymap.set('n', '<space>ht', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(0), { bufnr = 0 })
|
||||
end,
|
||||
{ desc = '[H]ints [T]oggle', ${opts} }
|
||||
)
|
||||
-- Enable hover if supported
|
||||
if capabilities.hoverProvider then
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Hover Documentation', ${opts} })
|
||||
end
|
||||
-- Enable rename if supported
|
||||
if capabilities.renameProvider then
|
||||
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, { desc = '[R]ename', ${opts} })
|
||||
end
|
||||
-- Enable code actions if supported
|
||||
if capabilities.codeActionProvider then
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>fa', vim.lsp.buf.code_action, { desc = '[F]ind Code [A]ctions', ${opts} })
|
||||
end
|
||||
-- Enable formatting if supported
|
||||
if capabilities.documentFormattingProvider then
|
||||
vim.keymap.set('n', '<leader>w', function() vim.lsp.buf.format { async = true } end, { desc = 'Format Buffer', ${opts} })
|
||||
end
|
||||
-- Other keybinds
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = '[G]o to [D]efinition', ${opts} })
|
||||
vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition, { desc = '[G]o to [T]ype Definition', ${opts} })
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} })
|
||||
callback = let
|
||||
opts = "noremap = true, buffer = bufnr";
|
||||
in {
|
||||
__raw = ''
|
||||
function(opts)
|
||||
local bufnr = opts.buf
|
||||
local client = vim.lsp.get_client_by_id(opts.data.client_id)
|
||||
local capabilities = client.server_capabilities
|
||||
-- Set Omnifunc if supported
|
||||
if capabilities.completionProvider then
|
||||
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
end
|
||||
'';
|
||||
};
|
||||
-- Enable inlay hints if supported
|
||||
if capabilities.inlayHintProvider then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end
|
||||
-- Some Lsp servers do not advertise inlay hints properly so enable this keybinding regardless
|
||||
vim.keymap.set('n', '<space>ht', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(0), { bufnr = 0 })
|
||||
end,
|
||||
{ desc = '[H]ints [T]oggle', ${opts} }
|
||||
)
|
||||
-- Enable hover if supported
|
||||
if capabilities.hoverProvider then
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Hover Documentation', ${opts} })
|
||||
end
|
||||
-- Enable rename if supported
|
||||
if capabilities.renameProvider then
|
||||
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, { desc = '[R]ename', ${opts} })
|
||||
end
|
||||
-- Enable code actions if supported
|
||||
if capabilities.codeActionProvider then
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>fa', vim.lsp.buf.code_action, { desc = '[F]ind Code [A]ctions', ${opts} })
|
||||
end
|
||||
-- Enable formatting if supported
|
||||
if capabilities.documentFormattingProvider then
|
||||
vim.keymap.set('n', '<leader>w', function() vim.lsp.buf.format { async = true } end, { desc = 'Format Buffer', ${opts} })
|
||||
end
|
||||
-- Other keybinds
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = '[G]o to [D]efinition', ${opts} })
|
||||
vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition, { desc = '[G]o to [T]ype Definition', ${opts} })
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} })
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{ pkgs, ... }@opts:
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
{pkgs, ...} @ opts: {
|
||||
imports = [./options.nix];
|
||||
|
||||
config.programs.nixvim = (import ./nixvim.nix opts).config;
|
||||
}
|
||||
|
|
|
@ -3,21 +3,19 @@
|
|||
lib,
|
||||
config,
|
||||
...
|
||||
}@args:
|
||||
let
|
||||
} @ args: let
|
||||
cfg = config.jhome.nvim;
|
||||
hmAvailable = args ? hmConfig;
|
||||
nixosAvailable = args ? nixosConfig;
|
||||
darwinAvailable = args ? darwinConfig;
|
||||
canSetAsDefault = hmAvailable || nixosAvailable;
|
||||
notStandalone = hmAvailable || nixosAvailable || darwinAvailable;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
in {
|
||||
imports = [./options.nix];
|
||||
|
||||
config = lib.mkMerge [
|
||||
(lib.optionalAttrs canSetAsDefault { defaultEditor = lib.mkDefault true; })
|
||||
(lib.optionalAttrs notStandalone { enable = lib.mkDefault true; })
|
||||
(lib.optionalAttrs canSetAsDefault {defaultEditor = lib.mkDefault true;})
|
||||
(lib.optionalAttrs notStandalone {enable = lib.mkDefault true;})
|
||||
(lib.mkIf cfg.enable {
|
||||
# package = pkgs.neovim-nightly;
|
||||
globals.mapleader = " ";
|
||||
|
@ -49,15 +47,13 @@ in
|
|||
# Enable local configuration :h 'exrc'
|
||||
exrc = true; # safe since nvim 0.9
|
||||
};
|
||||
plugins = import ./plugins.nix { inherit lib pkgs; };
|
||||
plugins = import ./plugins.nix {inherit lib pkgs;};
|
||||
keymaps = import ./mappings.nix;
|
||||
inherit (import ./augroups.nix) autoGroups autoCmd;
|
||||
extraPlugins =
|
||||
let
|
||||
jjdescription = pkgs.callPackage ./vim-jjdescription.nix { };
|
||||
in
|
||||
with pkgs.vimPlugins;
|
||||
[
|
||||
extraPlugins = let
|
||||
jjdescription = pkgs.callPackage ./vim-jjdescription.nix {};
|
||||
in
|
||||
with pkgs.vimPlugins; [
|
||||
nvim-web-devicons
|
||||
jjdescription
|
||||
];
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
options.jhome.nvim.enable = lib.mkEnableOption "jalil's neovim configuration" // {
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
{lib, ...}: {
|
||||
options.jhome.nvim.enable =
|
||||
lib.mkEnableOption "jalil's neovim configuration"
|
||||
// {
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
}
|
||||
|
|
154
nvim/plugins.nix
154
nvim/plugins.nix
|
@ -1,5 +1,7 @@
|
|||
{ lib, pkgs }:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
}: {
|
||||
bacon = {
|
||||
enable = true;
|
||||
settings.quickfix.enabled = true;
|
||||
|
@ -10,15 +12,15 @@
|
|||
"/" = {
|
||||
mapping.__raw = "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{ name = "rg"; }
|
||||
{ name = "buffer"; }
|
||||
{name = "rg";}
|
||||
{name = "buffer";}
|
||||
];
|
||||
};
|
||||
":" = {
|
||||
mapping.__raw = "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{ name = "path"; }
|
||||
{ name = "cmdline"; }
|
||||
{name = "path";}
|
||||
{name = "cmdline";}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
@ -118,16 +120,16 @@
|
|||
conform-nvim = {
|
||||
enable = true;
|
||||
formattersByFt = {
|
||||
"_" = [ "trim_whitespace" ];
|
||||
c = [ "clang_format" ];
|
||||
cpp = [ "clang_format" ];
|
||||
lua = [ "stylua" ];
|
||||
nix = [ "nixpkgs_fmt" ];
|
||||
rust = [ "rustfmt" ];
|
||||
sh = [ "shfmt" ];
|
||||
toml = [ "taplo" ];
|
||||
yaml = [ "yamlfmt" ];
|
||||
zig = [ "zigfmt" ];
|
||||
"_" = ["trim_whitespace"];
|
||||
c = ["clang_format"];
|
||||
cpp = ["clang_format"];
|
||||
lua = ["stylua"];
|
||||
nix = ["nixpkgs_fmt"];
|
||||
rust = ["rustfmt"];
|
||||
sh = ["shfmt"];
|
||||
toml = ["taplo"];
|
||||
yaml = ["yamlfmt"];
|
||||
zig = ["zigfmt"];
|
||||
};
|
||||
};
|
||||
gitsigns.enable = true;
|
||||
|
@ -196,66 +198,64 @@
|
|||
enable = true;
|
||||
indent = true;
|
||||
incrementalSelection.enable = true;
|
||||
grammarPackages =
|
||||
let
|
||||
parsers = pkgs.vimPlugins.nvim-treesitter-parsers;
|
||||
in
|
||||
[
|
||||
parsers.asm
|
||||
parsers.bash
|
||||
# parsers.bibtex
|
||||
parsers.c
|
||||
parsers.comment
|
||||
parsers.commonlisp
|
||||
parsers.cpp
|
||||
parsers.css
|
||||
parsers.csv
|
||||
# parsers.d
|
||||
parsers.diff
|
||||
parsers.dockerfile
|
||||
parsers.dot
|
||||
parsers.doxygen
|
||||
parsers.git_config
|
||||
parsers.git_rebase
|
||||
parsers.gitattributes
|
||||
parsers.gitcommit
|
||||
parsers.gitignore
|
||||
parsers.go
|
||||
parsers.gomod
|
||||
parsers.gosum
|
||||
parsers.gowork
|
||||
parsers.html
|
||||
parsers.ini
|
||||
parsers.json
|
||||
parsers.json5
|
||||
parsers.jsonc
|
||||
# parsers.latex
|
||||
parsers.lua
|
||||
parsers.luadoc
|
||||
parsers.luap
|
||||
parsers.luau
|
||||
parsers.make
|
||||
parsers.markdown
|
||||
parsers.markdown_inline
|
||||
parsers.meson
|
||||
parsers.nix
|
||||
parsers.ocaml
|
||||
parsers.ocaml_interface
|
||||
parsers.pem
|
||||
parsers.python
|
||||
parsers.rust
|
||||
parsers.scheme
|
||||
parsers.sql
|
||||
parsers.ssh_config
|
||||
parsers.toml
|
||||
parsers.tsv
|
||||
parsers.vim
|
||||
parsers.vimdoc
|
||||
parsers.wgsl
|
||||
parsers.wgsl_bevy
|
||||
parsers.yaml
|
||||
parsers.zig
|
||||
];
|
||||
grammarPackages = let
|
||||
parsers = pkgs.vimPlugins.nvim-treesitter-parsers;
|
||||
in [
|
||||
parsers.asm
|
||||
parsers.bash
|
||||
# parsers.bibtex
|
||||
parsers.c
|
||||
parsers.comment
|
||||
parsers.commonlisp
|
||||
parsers.cpp
|
||||
parsers.css
|
||||
parsers.csv
|
||||
# parsers.d
|
||||
parsers.diff
|
||||
parsers.dockerfile
|
||||
parsers.dot
|
||||
parsers.doxygen
|
||||
parsers.git_config
|
||||
parsers.git_rebase
|
||||
parsers.gitattributes
|
||||
parsers.gitcommit
|
||||
parsers.gitignore
|
||||
parsers.go
|
||||
parsers.gomod
|
||||
parsers.gosum
|
||||
parsers.gowork
|
||||
parsers.html
|
||||
parsers.ini
|
||||
parsers.json
|
||||
parsers.json5
|
||||
parsers.jsonc
|
||||
# parsers.latex
|
||||
parsers.lua
|
||||
parsers.luadoc
|
||||
parsers.luap
|
||||
parsers.luau
|
||||
parsers.make
|
||||
parsers.markdown
|
||||
parsers.markdown_inline
|
||||
parsers.meson
|
||||
parsers.nix
|
||||
parsers.ocaml
|
||||
parsers.ocaml_interface
|
||||
parsers.pem
|
||||
parsers.python
|
||||
parsers.rust
|
||||
parsers.scheme
|
||||
parsers.sql
|
||||
parsers.ssh_config
|
||||
parsers.toml
|
||||
parsers.tsv
|
||||
parsers.vim
|
||||
parsers.vimdoc
|
||||
parsers.wgsl
|
||||
parsers.wgsl_bevy
|
||||
parsers.yaml
|
||||
parsers.zig
|
||||
];
|
||||
};
|
||||
trouble = {
|
||||
enable = true;
|
||||
|
@ -264,12 +264,12 @@
|
|||
lint = {
|
||||
enable = true;
|
||||
lintersByFt = {
|
||||
rust = [ "typos" ];
|
||||
rust = ["typos"];
|
||||
latex = [
|
||||
"chktex"
|
||||
"typos"
|
||||
];
|
||||
markdown = [ "typos" ];
|
||||
markdown = ["typos"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{ vimUtils, fetchFromGitHub }:
|
||||
{
|
||||
vimUtils,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
vimUtils.buildVimPlugin {
|
||||
name = "jjdescription";
|
||||
src = fetchFromGitHub {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue