Compare commits

...
Sign in to create a new pull request.

7 commits
raspi ... main

Author SHA1 Message Date
Ellis Rahhal
4a83351844 bumped revs; removed unnecessary flake imports 2025-05-29 14:20:00 -07:00
6a2b1631f2 added custom header option 2025-04-20 23:40:53 -07:00
413651f285 fixed autoindentation 2025-04-20 20:21:57 -07:00
Ellis Rahhal
ab2d8a1273 updated trailing whitepsace deletion 2025-04-14 11:35:06 -07:00
Ellis Rahhal
e4e8213366 added nvim-tree integration to avanete 2025-04-06 19:41:33 -07:00
Ellis Rahhal
a4488ddf90 updated gitsigns config 2025-03-27 23:44:25 -07:00
Ellis Rahhal
122998a342 added rapsi support 2025-03-22 15:44:10 -07:00
11 changed files with 171 additions and 74 deletions

View file

@ -64,7 +64,7 @@
__raw = ''
function()
vim.cmd([[
if &ft =~ 'javascript\|html\|jade\|json\|css\|less\|php\|python\|sh\|c\|cpp\|markdown\|yaml\|vim\|nix|graphql'
if &ft =~ 'javascript\|html\|jade\|json\|css\|less\|php\|python\|sh\|c\|cpp\|markdown\|yaml\|vim\|nix\|graphql\|java'
:%s/\s\+$//e
elseif expand('%:t') =~ '\.gltf$' || expand('%:t') =~ '\.glsl$'
:%s/\s\+$//e

69
flake.lock generated
View file

@ -8,11 +8,11 @@
]
},
"locked": {
"lastModified": 1738453229,
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
@ -53,43 +53,27 @@
]
},
"locked": {
"lastModified": 1729958008,
"narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=",
"lastModified": 1748294338,
"narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=",
"owner": "NuschtOS",
"repo": "ixx",
"rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb",
"rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"ref": "v0.0.6",
"ref": "v0.0.8",
"repo": "ixx",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1741513245,
"narHash": "sha256-7rTAMNTY1xoBwz0h7ZMtEcd8LELk9R5TzBPoHuhNSCk=",
"lastModified": 1748406211,
"narHash": "sha256-B3BsCRbc+x/d0WiG1f+qfSLUy+oiIfih54kalWBi+/M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e3e32b642a31e6714ec1b712de8c91a3352ce7e1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1738797219,
"narHash": "sha256-KRwX9Z1XavpgeSDVM/THdFd6uH8rNm/6R+7kIbGa+2s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1da52dd49a127ad74486b135898da2cef8c62665",
"rev": "3d1f29646e4b57ed468d60f9d286cde23a8d1707",
"type": "github"
},
"original": {
@ -102,15 +86,16 @@
"nixvim": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2",
"nuschtosSearch": "nuschtosSearch"
"nixpkgs": "nixpkgs",
"nuschtosSearch": "nuschtosSearch",
"systems": "systems_2"
},
"locked": {
"lastModified": 1741709061,
"narHash": "sha256-G1YTksB0CnVhpU1gEmvO3ugPS5CAmUpm5UtTIUIPnEI=",
"lastModified": 1748521000,
"narHash": "sha256-EnXH5PIrZBoe8U09hPQr2kOuPTZSqAJy78DqUVLmWXg=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "3a3abf11700f76738d8ad9d15054ceaf182d2974",
"rev": "a9e45072d82374dd3f0d971795e7d7f99e5bc6c2",
"type": "github"
},
"original": {
@ -129,11 +114,11 @@
]
},
"locked": {
"lastModified": 1738508923,
"narHash": "sha256-4DaDrQDAIxlWhTjH6h/+xfG05jt3qDZrZE/7zDLQaS4=",
"lastModified": 1748298102,
"narHash": "sha256-PP11GVwUt7F4ZZi5A5+99isuq39C59CKc5u5yVisU/U=",
"owner": "NuschtOS",
"repo": "search",
"rev": "86e2038290859006e05ca7201425ea5b5de4aecb",
"rev": "f8a1c221afb8b4c642ed11ac5ee6746b0fe1d32f",
"type": "github"
},
"original": {
@ -144,7 +129,6 @@
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"nixvim": "nixvim"
}
},
@ -162,6 +146,21 @@
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View file

@ -2,31 +2,16 @@
description = "Opinionated Nixvim config as a flake";
inputs = {
## nixvim uses it's own version, so this is only
## for explicitly installed packages and non nixvim config
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixvim = {
url = "github:nix-community/nixvim";
nixvim.url = "github:nix-community/nixvim";
};
};
outputs = { nixpkgs, ... } @ inputs:
let
# system = "x86_64-linux";
pkgs = import "${nixpkgs}" {
# system = "x86_64-linux";
};
in
# outputs = { self, nixpkgs, ... } @ inputs:
outputs = { self, ... } @ inputs:
{
nixosModules = rec {
nixvim-config = import ./default.nix {
default = import ./default.nix {
inherit inputs;
# inherit system;
inherit pkgs;
};
default = nixvim-config;
};
};
}

View file

@ -12,7 +12,13 @@
enable-startify-cowsay = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable startify";
description = "Enable startify cowsay";
};
startify-header = lib.mkOption {
type = lib.types.nullOr (lib.types.listOf lib.types.str);
default = null;
description = "Startify text/ascii image, if cowsay disabled";
};
};
}

View file

@ -1,8 +1,10 @@
{ config, pkgs, ... }:
{ config, ... }:
{
programs.nixvim = {
enable = config.nixvim-config.enable;
nixpkgs.config.allowUnfree = true; # For claude-code
defaultEditor = true;
globals = {
@ -54,8 +56,6 @@
winaltkeys = "no"; # Disable ALT keys for menu
autoindent = true;
smartindent = true;
colorcolumn = "121";
laststatus = 3;
@ -81,6 +81,8 @@
expandtab = true; # Insert spaces when entering <Tab>
softtabstop = 4; # Number of spaces that a <Tab> counts for while performing editing operations, like inserting a <Tab> or using <BS>. It "feels" like a tab though
ai = true; # auto indent
autoindent = true;
smartindent = false;
};
## ------------------------------------------------

View file

@ -130,5 +130,39 @@
# };
};
};
nvim-tree = {
# Add "ga" keybinding to add to Avante context
onAttach.__raw = ''
function(bufnr)
local api = require 'nvim-tree.api'
api.config.mappings.default_on_attach(bufnr)
local add_file_to_avante_ctx = function()
local sidebar = require('avante').get()
if not (sidebar and sidebar:is_open()) then
return
end
local node = api.tree.get_node_under_cursor()
if not (node and node.type == 'file') then
return
end
sidebar.file_selector:add_selected_file(node.absolute_path)
end
vim.keymap.set('n', 'ga', add_file_to_avante_ctx, {
desc = 'add to Avante context',
buffer = bufnr,
noremap = true,
silent = true,
nowait = true,
})
end
'';
};
} else {};
}

View file

@ -16,6 +16,7 @@
./dap.nix
./diffview.nix
./fzf-lua.nix
./gitsigns.nix
./indent-blankline.nix
./lazydev.nix
./lsp.nix
@ -26,16 +27,18 @@
./startify.nix
./telescope.nix
./treesitter.nix
./vim-signify.nix
## Currently using gitsigns
# ./vim-signify.nix
];
programs.nixvim = {
plugins = {
claude-code.enable = true;
comment.enable = true;
## needed by avante. already archived, so may need to migrate to snacks
# dressing.enable = true;
fugitive.enable = true;
gitsigns.enable = true;
lightline.enable = false;
lualine.enable = true;
nix.enable = true;

59
plugins/gitsigns.nix Normal file
View file

@ -0,0 +1,59 @@
{ ... }:
{
programs.nixvim = {
extraConfigLua = ''
local function get_base_branch()
-- Try to get the default branch from git config
local default_branch_cmd = "git config --get init.defaultbranch || " ..
"git symbolic-ref refs/remotes/origin/HEAD | sed 's!refs/remotes/origin/!!'"
local default_branch = vim.fn.system(default_branch_cmd):gsub("%s+", "")
-- If default branch is empty or fails, fall back to common defaults
if not default_branch or default_branch == "" then
local common_defaults = {"main", "master", "develop", "development"}
for _, branch in ipairs(common_defaults) do
local branch_exists = vim.fn.system(string.format("git branch --list %s", branch)):match("%s*" .. branch .. "%s*")
if branch_exists and branch_exists ~= "" then
default_branch = branch
break
end
end
end
-- If still no default branch, use current branch
if not default_branch or default_branch == "" then
default_branch = vim.fn.system("git rev-parse --abbrev-ref HEAD"):gsub("%s+", "")
end
return default_branch
end
'';
plugins.gitsigns = {
enable = true;
};
autoGroups = {
DynamicGitsignsBase = {
clear = true;
};
};
autoCmd = [
{
event = [ "BufEnter" "DirChanged" ];
group = "DynamicGitsignsBase";
callback.__raw = ''
function()
local ok, gs = pcall(require, 'gitsigns')
if not ok then return end
local new_base = get_base_branch()
-- Use change_base command if available
pcall(gs.change_base, new_base)
end
'';
}
];
};
}

View file

@ -122,7 +122,7 @@
# custom_elements_ls.enable = true;
denols = {
enable = true;
rootDir = "require('lspconfig').util.root_pattern('deno.json', 'deno.jsonc')";
rootMarkers = [ "require('lspconfig').util.root_pattern('deno.json', 'deno.jsonc')" ];
};
dockerls.enable = true; # Docker
eslint.enable = true;
@ -156,7 +156,7 @@
tailwindcss.enable = true;
ts_ls = {
enable = true;
rootDir = "require('lspconfig').util.root_pattern('package.json')";
rootMarkers = [ "require('lspconfig').util.root_pattern('package.json')" ];
settings = {
single_file_support = false;
};
@ -164,5 +164,9 @@
yamlls.enable = true; # YAML
};
};
extraPackages = with pkgs; [
eslint
];
};
}

View file

@ -1,16 +1,21 @@
{ config, ... }:
{ config, lib, ... }:
let
header-space = " ";
in
{
programs.nixvim = {
plugins.startify = {
enable = true;
settings = {
custom_header = if config.nixvim-config.enable-startify-cowsay then null else [
''. _______ ____ ____.___ _____''
''. \ \ ____ ___\ \ / /| | / \''
''. / | \_/ __ \/ _ \ Y / | |/ \ / \''
''. / | \ ___( <_> ) / | / Y \''
''. \____|__ /\___ >____/ \___/ |___\____|__ /''
''. \/ \/ \/''
custom_header = if config.nixvim-config.enable-startify-cowsay then null
else if config.nixvim-config.startify-header != null
then config.nixvim-config.startify-header else [
''${header-space} _______ ____ ____.___ _____''
''${header-space} \ \ ____ ___\ \ / /| | / \''
''${header-space} / | \_/ __ \/ _ \ Y / | |/ \ / \''
''${header-space}/ | \ ___( <_> ) / | / Y \''
''${header-space}\____|__ /\___ >____/ \___/ |___\____|__ /''
''${header-space} \/ \/ \/''
];
};
};

View file

@ -29,7 +29,7 @@
};
};
indent = {
enable = true;
enable = false;
};
};
};