update #16

Merged
jalil merged 2 commits from update into main 2024-07-02 09:52:58 +02:00
7 changed files with 263 additions and 131 deletions

View file

@ -197,11 +197,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1717285511, "lastModified": 1719745305,
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", "narHash": "sha256-xwgjVUpqSviudEkpQnioeez1Uo2wzrsMaJKJClh+Bls=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", "rev": "c3c5ecc05edc7dafba779c6c1a61cd08ac6583e9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -334,11 +334,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1718530513, "lastModified": 1719827385,
"narHash": "sha256-BmO8d0r+BVlwWtMLQEYnwmngqdXIuyFzMwvmTcLMee8=", "narHash": "sha256-qs+nU20Sm8czHg3bhGCqiH+8e13BJyRrKONW34g3i50=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "a1fddf0967c33754271761d91a3d921772b30d0e", "rev": "391ca6e950c2525b4f853cbe29922452c14eda82",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -407,11 +407,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1719681865, "lastModified": 1719895800,
"narHash": "sha256-Lp+l1IsREVbz8WM35OJYZz8sAH0XOjrZWUXVB5bJ2qg=", "narHash": "sha256-xNbjISJTFailxass4LmdWeV4jNhAlmJPwj46a/GxE6M=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "a59f00f5ac65b19382617ba00f360f8bc07ed3ac", "rev": "6e253f12b1009053eff5344be5e835f604bb64cd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -422,11 +422,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1719426051, "lastModified": 1719838683,
"narHash": "sha256-yJL9VYQhaRM7xs0M867ZFxwaONB9T2Q4LnGo1WovuR4=", "narHash": "sha256-Zw9rQjHz1ilNIimEXFeVa1ERNRBF8DoXDhLAZq5B4pE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "89c49874fb15f4124bf71ca5f42a04f2ee5825fd", "rev": "d032c1a6dfad4eedec7e35e91986becc699d7d69",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -456,11 +456,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1719695745, "lastModified": 1719860300,
"narHash": "sha256-4i71R8xofnwmlhb84swOLQro63pHvC37NVIipbz1I04=", "narHash": "sha256-ZeF+zI+/53HeS567/mXS2Gw+w8k9FsjRC/TzoVQOpi4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "c062b976eff9f13597c7c23d77a6b3ac677b7fd5", "rev": "079c2c479b5707adf0b03f817be30945c92c15cf",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -541,11 +541,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1719243788, "lastModified": 1719749022,
"narHash": "sha256-9T9mSY35EZSM1KAwb7K9zwQ78qTlLjosZgtUGnw4rn4=", "narHash": "sha256-ddPKHcqaKCIFSFc/cvxS14goUhCOAwsM1PbMr0ZtHMg=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "065a23edceff48f948816b795ea8cc6c0dee7cdf", "rev": "8df5ff62195d4e67e2264df0b7f5e8c9995fd0bd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -556,11 +556,11 @@
}, },
"unstable": { "unstable": {
"locked": { "locked": {
"lastModified": 1719506693, "lastModified": 1719690277,
"narHash": "sha256-C8e9S7RzshSdHB7L+v9I51af1gDM5unhJ2xO1ywxNH8=", "narHash": "sha256-0xSej1g7eP2kaUF+JQp8jdyNmpmCJKRpO12mKl/36Kc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b2852eb9365c6de48ffb0dc2c9562591f652242a", "rev": "2741b4b489b55df32afac57bc4bfd220e8bf617e",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -40,7 +40,6 @@
nixvim = { nixvim = {
url = "github:nix-community/nixvim"; url = "github:nix-community/nixvim";
inputs = { inputs = {
# Disable until fixed upstream: https://github.com/nix-community/nixvim/issues/1699
nixpkgs.follows = "unstable"; nixpkgs.follows = "unstable";
devshell.follows = "devshell"; devshell.follows = "devshell";
nix-darwin.follows = ""; # disable MacOS stuff nix-darwin.follows = ""; # disable MacOS stuff
@ -138,14 +137,21 @@
nixvim = nixvim.overlays.default; nixvim = nixvim.overlays.default;
jpassmenu = jpassmenu.overlays.default; jpassmenu = jpassmenu.overlays.default;
audiomenu = audiomenu.overlays.default; audiomenu = audiomenu.overlays.default;
unstable = final: prev: { unstable = final: prev: let
unstablePkgs = unstable.legacyPackages.${prev.system};
in {
# Get unstable packages
unstable = unstablePkgs;
# Update vim plugins with the versions from unstable
vimPlugins = prev.vimPlugins // unstablePkgs.vimPlugins;
# Get specific packages from unstable
inherit inherit
(unstable.legacyPackages.${prev.system}) (unstablePkgs)
gitoxide gitoxide
jujutsu jujutsu
wezterm wezterm
neovim-unwrapped
; ;
unstable = unstable.legacyPackages.${prev.system};
}; };
}; };

View file

@ -29,8 +29,11 @@ in {
# Better cat (bat) # Better cat (bat)
bat = { bat = {
enable = true; enable = true;
# Disable headers and numbers config = {
config.style = "plain"; # Disable headers and numbers
style = "plain";
theme = lib.mkForce "gruvbox-dark";
};
}; };
# Direnv # Direnv
direnv = { direnv = {

View file

@ -12,28 +12,38 @@ in {
group = "highlightOnYank"; group = "highlightOnYank";
event = "TextYankPost"; event = "TextYankPost";
pattern = "*"; pattern = "*";
callback = mkRaw '' callback =
function() mkRaw
vim.highlight.on_yank { /*
higroup = ( lua
vim.fn['hlexists'] 'HighlightedyankRegion' > 0 and 'HighlightedyankRegion' or 'IncSearch' */
), ''
timeout = 200, function()
} vim.highlight.on_yank {
end higroup = (
''; vim.fn['hlexists'] 'HighlightedyankRegion' > 0 and 'HighlightedyankRegion' or 'IncSearch'
),
timeout = 200,
}
end
'';
} }
{ {
group = "restoreCursorPosition"; group = "restoreCursorPosition";
event = "BufReadPost"; event = "BufReadPost";
pattern = "*"; pattern = "*";
callback = mkRaw '' callback =
function() mkRaw
if vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then /*
vim.cmd [[execute "normal! g'\""]] lua
*/
''
function()
if vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then
vim.cmd [[execute "normal! g'\""]]
end
end end
end '';
'';
} }
{ {
group = "lspConfig"; group = "lspConfig";
@ -42,7 +52,11 @@ in {
callback = let callback = let
opts = "noremap = true, buffer = bufnr"; opts = "noremap = true, buffer = bufnr";
in in
mkRaw '' mkRaw
/*
lua
*/
''
function(opts) function(opts)
local bufnr = opts.buf local bufnr = opts.buf
local client = vim.lsp.get_client_by_id(opts.data.client_id) local client = vim.lsp.get_client_by_id(opts.data.client_id)

View file

@ -51,99 +51,180 @@ in {
{ {
mode = "n"; mode = "n";
key = "<leader>dj"; key = "<leader>dj";
action = mkRaw "vim.diagnostic.goto_next"; action =
mkRaw
# lua
''
vim.diagnostic.goto_next
'';
options.desc = "Diagnostics next [J]"; options.desc = "Diagnostics next [J]";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>dk"; key = "<leader>dk";
action = mkRaw "vim.diagnostic.goto_prev"; action =
mkRaw
# lua
''
vim.diagnostic.goto_prev
'';
options.desc = "Diagnostics previous [K]"; options.desc = "Diagnostics previous [K]";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>xx"; key = "<leader>xx";
action = mkRaw "require('trouble').toggle"; action =
mkRaw
# lua
''
require('trouble').toggle
'';
options.desc = "Toggle trouble"; options.desc = "Toggle trouble";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>xw"; key = "<leader>xw";
action = mkRaw "function() require('trouble').toggle('workspace_diagnostics') end"; action =
mkRaw
# lua
''
function() require('trouble').toggle('workspace_diagnostics') end
'';
options.desc = "Toggle Workspace trouble"; options.desc = "Toggle Workspace trouble";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>xd"; key = "<leader>xd";
action = mkRaw "function() require('trouble').toggle('document_diagnostics') end"; action =
mkRaw
# lua
''
function() require('trouble').toggle('document_diagnostics') end
'';
options.desc = "Toggle Document trouble"; options.desc = "Toggle Document trouble";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>xq"; key = "<leader>xq";
action = mkRaw "function() require('trouble').toggle('quickfix') end"; action =
mkRaw
# lua
''
function() require('trouble').toggle('quickfix') end
'';
options.desc = "Toggle Quickfix trouble"; options.desc = "Toggle Quickfix trouble";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>xl"; key = "<leader>xl";
action = mkRaw "function() require('trouble').toggle('loclist') end"; action =
mkRaw
# lua
''
function() require('trouble').toggle('loclist') end
'';
options.desc = "Toggle Loclist trouble"; options.desc = "Toggle Loclist trouble";
} }
{ {
mode = "n"; mode = "n";
key = "gR"; key = "gR";
action = mkRaw "function() require('trouble').toggle('lsp_references') end"; action =
mkRaw
# lua
''
function() require('trouble').toggle('lsp_references') end
'';
options.desc = "Toggle lsp References trouble"; options.desc = "Toggle lsp References trouble";
} }
# Telescope # Telescope
{ {
mode = "n"; mode = "n";
key = "<leader>ff"; key = "<leader>ff";
action = mkRaw "require('telescope.builtin').find_files"; action =
mkRaw
# lua
''
require('telescope.builtin').find_files
'';
options.desc = "Find Files"; options.desc = "Find Files";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>fg"; key = "<leader>fg";
action = mkRaw "require('telescope.builtin').live_grep"; action =
mkRaw
# lua
''
require('telescope.builtin').live_grep
'';
options.desc = "Find Grep"; options.desc = "Find Grep";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>fh"; key = "<leader>fh";
action = mkRaw "require('telescope.builtin').help_tags"; action =
mkRaw
# lua
''
require('telescope.builtin').help_tags
'';
options.desc = "Find Help"; options.desc = "Find Help";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>fb"; key = "<leader>fb";
action = mkRaw "require('telescope.builtin').buffers"; action =
mkRaw
# lua
''
require('telescope.builtin').buffers
'';
options.desc = "Find Buffer"; options.desc = "Find Buffer";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>fd"; key = "<leader>fd";
action = mkRaw "require('telescope.builtin').diagnostics"; action =
mkRaw
# lua
''
require('telescope.builtin').diagnostics
'';
options.desc = "Find Diagnostics"; options.desc = "Find Diagnostics";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>fq"; key = "<leader>fq";
action = mkRaw "require('telescope.builtin').quickfix"; action =
mkRaw
# lua
''
require('telescope.builtin').quickfix
'';
options.desc = "Find Quickfix"; options.desc = "Find Quickfix";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>w"; key = "<leader>w";
action = mkRaw "require('conform').format"; action =
mkRaw
# lua
''
require('conform').format
'';
options.desc = "Format buffer"; options.desc = "Format buffer";
} }
# Nvim Silicon # Nvim Silicon
{ {
mode = "v"; mode = "v";
key = "<leader>sc"; key = "<leader>sc";
action = mkRaw "require('nvim-silicon').clip"; action =
mkRaw
# lua
''
require('nvim-silicon').clip
'';
options.desc = "Snap Code (to clipboard)"; options.desc = "Snap Code (to clipboard)";
} }
]; ];

View file

@ -15,14 +15,28 @@ in {
enable = true; enable = true;
cmdline = { cmdline = {
"/" = { "/" = {
mapping = mkRaw "cmp.mapping.preset.cmdline()"; mapping =
mkRaw
/*
lua
*/
''
cmp.mapping.preset.cmdline()
'';
sources = [ sources = [
{name = "rg";} {name = "rg";}
{name = "buffer";} {name = "buffer";}
]; ];
}; };
":" = { ":" = {
mapping = mkRaw "cmp.mapping.preset.cmdline()"; mapping =
mkRaw
/*
lua
*/
''
cmp.mapping.preset.cmdline()
'';
sources = [ sources = [
{name = "path";} {name = "path";}
{name = "cmdline";} {name = "cmdline";}
@ -31,7 +45,13 @@ in {
}; };
settings = { settings = {
# Snippets # Snippets
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; snippet.expand =
/*
lua
*/
''
function(args) require('luasnip').lsp_expand(args.body) end
'';
# Completion Sources # Completion Sources
sources = [ sources = [
{ {
@ -83,42 +103,47 @@ in {
groupIndex = 1; groupIndex = 1;
} }
]; ];
mapping = mkRaw '' mapping =
cmp.mapping.preset.insert({ mkRaw
["<C-n>"] = function(fallback) /*
if cmp.visible() then lua
cmp.select_next_item() */
elseif require("luasnip").expand_or_jumpable() then ''
require("luasnip").expand_or_jump() cmp.mapping.preset.insert({
elseif has_words_before() then ["<C-n>"] = function(fallback)
cmp.complete() if cmp.visible() then
else cmp.select_next_item()
fallback() elseif require("luasnip").expand_or_jumpable() then
end require("luasnip").expand_or_jump()
end, elseif has_words_before() then
["<C-p>"] = function(fallback) cmp.complete()
if cmp.visible() then else
cmp.select_prev_item() fallback()
elseif require("luasnip").jumpable(-1) then end
require("luasnip").jump(-1) end,
else ["<C-p>"] = function(fallback)
fallback() if cmp.visible() then
end cmp.select_prev_item()
end, elseif require("luasnip").jumpable(-1) then
["<C-u>"] = cmp.mapping(function(fallback) require("luasnip").jump(-1)
if require("luasnip").choice_active() then else
require("luasnip").next_choice() fallback()
else end
fallback() end,
end ["<C-u>"] = cmp.mapping(function(fallback)
end), if require("luasnip").choice_active() then
["<C-b>"] = cmp.mapping.scroll_docs(-4), require("luasnip").next_choice()
["<C-f>"] = cmp.mapping.scroll_docs(4), else
["<C-Space>"] = cmp.mapping.complete { }, fallback()
["<C-e>"] = cmp.mapping.close(), end
["<CR>"] = cmp.mapping.confirm { select = true }, end),
}) ["<C-b>"] = cmp.mapping.scroll_docs(-4),
''; ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete { },
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm { select = true },
})
'';
}; };
}; };
# FIXME: doesn't include formatters # FIXME: doesn't include formatters

View file

@ -2,7 +2,6 @@
imports = [./options.nix ./plugins.nix ./mappings.nix ./augroups.nix]; imports = [./options.nix ./plugins.nix ./mappings.nix ./augroups.nix];
config = { config = {
package = pkgs.unstable.neovim-unwrapped;
globals.mapleader = " "; globals.mapleader = " ";
# Appearance # Appearance
colorschemes.gruvbox = { colorschemes.gruvbox = {
@ -56,37 +55,41 @@
pkgs.unstable.typos pkgs.unstable.typos
pkgs.unstable.yamlfmt pkgs.unstable.yamlfmt
]; ];
extraConfigLuaPre = '' extraConfigLuaPre =
-- Lua Pre Config # lua
if vim.fn.has 'termguicolors' then ''
-- Enable RGB colors -- Lua Pre Config
vim.g.termguicolors = true if vim.fn.has 'termguicolors' then
end -- Enable RGB colors
vim.g.termguicolors = true
end
-- Useful function -- Useful function
local has_words_before = function() local has_words_before = function()
-- unpack = unpack or table.unpack -- unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 return col ~= 0
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil
end end
-- END: Lua Pre Config -- END: Lua Pre Config
''; '';
extraConfigLua = '' extraConfigLua =
-- Lua Config # lua
require("nvim-silicon").setup { ''
theme = "gruvbox-dark", -- Lua Config
pad_horiz = 16, require("nvim-silicon").setup {
pad_vert = 16, theme = "gruvbox-dark",
-- Current buffer name pad_horiz = 16,
window_title = function() pad_vert = 16,
return vim.fn.fnamemodify( -- Current buffer name
vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), window_title = function()
":t" return vim.fn.fnamemodify(
) vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()),
end, ":t"
} )
-- END: Lua Config end,
''; }
-- END: Lua Config
'';
}; };
} }