Merge branch 'horsch'

This commit is contained in:
mandlm 2024-07-10 17:28:11 +02:00
commit 06de03dd73
Signed by: mandlm
GPG Key ID: 4AA25D647AA54CC7
48 changed files with 1116 additions and 623 deletions

8
.envrc Normal file
View File

@ -0,0 +1,8 @@
use flake .nix
if on_git_branch; then
echo
git status --short --branch
echo
git fetch
fi

1
.gitignore vendored
View File

@ -2,4 +2,3 @@
# Ignore build outputs from performing a nix-build or `nix build` command
result
result-*

25
.nix/flake.lock Normal file
View File

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1720418205,
"narHash": "sha256-cPJoFPXU44GlhWg4pUk9oUPqurPlCFZ11ZQPk21GTPU=",
"rev": "655a58a72a6601292512670343087c2d75d859c1",
"revCount": 650378,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.650378%2Brev-655a58a72a6601292512670343087c2d75d859c1/019095fe-96b2-7a7c-ad7c-2131b3fb6fa7/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

32
.nix/flake.nix Normal file
View File

@ -0,0 +1,32 @@
{
description = "A flake editing flake";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs = { nixpkgs, ... }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell.override
{
# Override stdenv in order to change compiler:
# stdenv = pkgs.clangStdenv;
}
{
packages = with pkgs; [
pre-commit
commitizen
];
shellHook = ''
pre-commit install --allow-missing-config --hook-type pre-commit --hook-type commit-msg
'';
};
});
};
}

27
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,27 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: detect-private-key
- id: mixed-line-ending
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.27.0
hooks:
- id: commitizen
stages: [commit-msg]
- repo: local
hooks:
- id: home-manager-check
name: Home Manager Config Check
entry: home-manager switch --dry-run
language: system
pass_filenames: false
exclude: ^docs/

View File

@ -1,2 +1 @@
# home-manager

View File

@ -0,0 +1,91 @@
# Setup Log WSL/Alpine
## User setup
```bash
su -
apk add sudo
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
adduser mmandl sudo
passwd mmandl
logout
```
## Home-manager setup
```bash
# Install nix package manager
sudo apk add curl xz openssh-client
curl -L https://nixos.org/nix/install | sh
echo ". /home/mmandl/.nix-profile/etc/profile.d/nix.sh" >> ~/.profile
# Add home-manager channel and install
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
```
## Home-manager config
```bash
# Extract initial home-manager config
unzip /mnt/c/Users/mmandl/Downloads/home-manager-main.zip
mv home-manager-main home-manager
rm -rf .config/home-manager
ln -s ../home-manager .config/home-manager
# Enable nix flakes support
mkdir -p .config/nix
echo "experimental-features = nix-command flakes" > .config/nix/nix.conf
# Install and configure user environment
home-manager switch
# Install zsh
sudo apk add zsh
chsh -s /bin/zsh
# Install gpg and ssh private keys
gpg --import /mnt/c/Users/mmandl/OneDrive\ -\ Horsch\ Maschinen\ GmbH/Dokumente/GPG/Michael\ Mandl\ michael.mandl@horsch.com\ \(0x088ED38F036C7AF2\)\ pub-sec.asc
# Switch to final home-manager config
rm -rf home-manager
git clone git@github.com:mmandl-horsch/home-manager.git
```
## Docker
```bash
# Enable openrc on boot
echo "[boot]\ncommand = /sbin/openrc default" > /etc/wsl.conf
# Install docker
sudo apk add docker
sudo rc-update add docker default
sudo adduser mmandl docker
# Install buildserver CA
firefox https://confluence.horsch.com/display/DFEDOCU1/SE+Tools+-+Buildserver+-+SSL?preview=/114590403/114590426/20201123_horsch_buildserver_ca_install.sh
sudo sh 20201123_horsch_buildserver_ca_install.sh
```
## VSCode
```bash
# Install vscode server runtime dependency
sudo apk add libstdc++
```
## Yocto
```bash
# Install non-busybox `readlink`
sudo apk add coreutils
```
## Kernel Module Autoloading
```bash
sudo apk add alpine-config
sudo setup-devd udev
```

125
email.nix
View File

@ -1,125 +0,0 @@
{ config, lib, pkgs, ... }:
{
home.packages = [ pkgs.libsecret ];
programs.msmtp.enable = true;
programs.mbsync.enable = true;
programs.neomutt = {
enable = true;
sidebar.enable = true;
vimKeys = true;
macros = [
{
action = "<shell-escape>mbsync -all<enter>";
key = "S";
map = [ "index" ];
}
];
};
accounts.email = {
maildirBasePath = "${config.xdg.dataHome}/mail";
accounts = {
molez = rec {
primary = true;
realName = "Michael Mandl";
address = "mandlm@molez.net";
userName = address;
passwordCommand = "secret-tool lookup email mandlm@molez.net";
imap = {
host = "mail.molez.net";
port = 993;
tls.enable = true;
};
smtp = {
host = "mail.molez.net";
port = 465;
tls.enable = true;
};
gpg = {
key = "0x4AA25D647AA54CC7";
signByDefault = true;
};
msmtp.enable = true;
mbsync = {
enable = true;
create = "both";
expunge = "both";
};
neomutt.enable = true;
};
swp = {
realName = "Michael Mandl";
address = "mandl@vi-bim.de";
userName = "mandl";
passwordCommand = "secret-tool lookup email mandl@vi-bim.de";
imap = {
host = "swpmail.softwareparadies.de";
port = 993;
tls.enable = true;
};
smtp = {
host = "swpmail.softwareparadies.de";
port = 465;
tls.enable = true;
};
gpg = {
key = "0x4E60F44227F611B4 ";
signByDefault = true;
};
signature = {
showSignature = "append";
text = ''
--
Mit freundlichen Grüßen
Michael Mandl
Entwicklung
------------------------------------------
swp software systems GmbH & Co. KG
Königsbrücker Straße 124
01099 Dresden
Tel: 0351-492850
Fax: 0351-4928550
www: https://www.vi-bim.de
Kennen Sie schon unsere FAQ-Wissensdatenbank? Einfach hier klicken:
https://faq.vi-bim.de
Unsere Datenschutzerklärung finden Sie unter https://datenschutz.vi-bim.de
Registergericht: Amtsgericht Dresden HRA 3008
persönlich haftender Gesellschafter:
swp Beteiligungs GmbH
Registergericht: Amtsgericht Dresden HRB 15 20 9
Geschäftsführer: Holger Schönemann, Stefan Urlberger
'';
};
msmtp.enable = true;
mbsync = {
enable = true;
create = "both";
expunge = "both";
};
neomutt.enable = true;
};
};
};
}

View File

@ -20,12 +20,40 @@
inherit pkgs;
modules = [
./home.nix
./shell
./git
./gpg
./neovim
./private.nix
./xps.nix
];
extraSpecialArgs = {
username = "mandlm";
user = "mandlm";
userName = "Michael Mandl";
userEmail = "mandlm@molez.net";
gpgSigningKey = "4AA25D647AA54CC7";
gpgSSHKeys = [ "1F937AC8F77ED74CE24EAAE79B5601F73C6D115F" ];
theme = "dark";
};
};
"mmandl@NB11313" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./shell
./git
./gpg
./neovim
./horsch.nix
];
extraSpecialArgs = {
user = "mmandl";
userName = "Michael Mandl";
userEmail = "michael.mandl@horsch.com";
gpgSigningKey = "088ED38F036C7AF2";
gpgSSHKeys = [ "AEB2BF3FF9CF9529E9A3C6F1A202D21686FF9278" ];
theme = "dark";
};
};

71
git.nix
View File

@ -1,71 +0,0 @@
{ ... }:
{
programs = {
git = {
enable = true;
extraConfig = {
core.editor = "nvim";
diff.external = "difft --background light";
diff.tool = "difftastic";
diff.ignoreSubmodules = "none";
difftool.difftastic.cmd = "difft --background light \"$LOCAL\" \"$REMOTE\"";
difftool.prompt = false;
fetch.writeCommitGraph = true;
fetch.recurseSubmodules = true;
format.pretty = "format:%C(yellow)%h %Cblue%>(12)%ad %C(red)%G? %Cgreen%<(7,trunc)%aN%Cred%d %Creset%s";
init.defaultBranch = "main";
log.date = "relative";
merge.ff = false;
merge.tool = "nvim";
mergetool.nvim.cmd = "nvim -f -c \"Gdiffsplit!\" \"$MERGED\"";
mergetool.prompt = false;
pager.difftool = true;
pull.rebase = true;
push.recurseSubmodules = "on-demand";
rebase.autostash = true;
rerere.enabled = true;
status.submoduleSummary = true;
submodule.recurse = true;
user.private.email = "mandlm@molez.net";
user.private.name = "Michael Mandl";
user.private.signingkey = "4AA25D647AA54CC7";
user.swp.email = "mandl@vi-bim.de";
user.swp.name = "Michael Mandl";
user.swp.signingkey = "4E60F44227F611B4";
worktree.guessRemote = true;
};
aliases = {
identity = ''! git config user.name "$(git config user.$1.name)"; git config user.email "$(git config user.$1.email)"; git config user.signingkey "$(git config user.$1.signingkey)"; git config commit.gpgsign "true"; : '';
clone-worktree = ''! mkdir $2; git clone $1 $2/.base; BRANCH=`git -C $2/.base symbolic-ref --short HEAD`; echo "branch is $BRANCH"; git -C $2/.base checkout --detach HEAD; git -C $2/.base worktree add ../$BRANCH; :'';
graph = "log --graph --all --max-count 32";
};
ignores = [
".env"
".direnv"
"*.swp"
];
};
};
}

125
git/default.nix Normal file
View File

@ -0,0 +1,125 @@
{ pkgs, userName, userEmail, gpgSigningKey, ... }:
{
programs = {
less.enable = true;
git = {
enable = true;
inherit userName;
inherit userEmail;
signing = {
key = gpgSigningKey;
signByDefault = true;
};
difftastic = {
enable = true;
background = "light";
};
lfs = {
enable = true;
};
extraConfig = {
core.editor = "nvim";
core.pager = "less -FX";
credential.helper = "cache --timeout=3600";
diff.ignoreSubmodules = "none";
fetch.writeCommitGraph = true;
fetch.recurseSubmodules = true;
format.pretty = "format:%C(yellow)%h %Cblue%>(12)%ad %C(red)%G? %Cgreen%<(7,trunc)%aN%Cred%d %Creset%s";
init.defaultBranch = "main";
log.date = "relative";
merge.ff = false;
merge.tool = "nvim";
mergetool.nvim.cmd = "nvim -f -c \"Gdiffsplit!\" \"$MERGED\"";
mergetool.prompt = false;
pager.difftool = true;
pull.rebase = true;
push.recurseSubmodules = "on-demand";
rebase.autostash = true;
rerere.enabled = true;
status.submoduleSummary = true;
submodule.recurse = true;
worktree.guessRemote = true;
};
aliases = {
graph = "log --graph --all --max-count 32";
};
ignores = [
".env"
".direnv"
"*.swp"
];
};
};
home.packages = with pkgs; [
(writeShellScriptBin "git-clone-worktree" ''
uri=''${1}
dir=''${2}
if [[ -z ''${dir} ]]; then
dir=''$(basename ''${1} .git)
fi
if [[ -e ''${dir} ]]; then
echo "error: directory ''${dir} already exists"
exit 1
fi
mkdir ''${dir}
git clone ''${uri} ''${dir}/.base
branch=`git -C ''${dir}/.base symbolic-ref --short HEAD`
echo "default branch is ''${branch}"
git -C ''${dir}/.base checkout --detach HEAD
git -C ''${dir}/.base worktree add ../''${branch}
'')
(writeShellScriptBin "git-make-relative" ''
gitfile=''${1}
if [[ -z ''${gitfile} ]]; then
gitfile=".git"
fi
if [[ ! -f ''${gitfile} ]]; then
echo "file ''${gitfile} does not exist"
exit 1
fi
gitdir=$(grep "gitdir:" ''${gitfile} | cut -d: -f2 | xargs)
rel_gitdir=$(realpath -s --relative-to=. ''${gitdir})
echo "relative path: ''${rel_gitdir}"
sed -i -e "s,gitdir:.*,gitdir: ''${rel_gitdir}," ''${gitfile}
'')
];
}

View File

@ -1,21 +1,41 @@
{ pkgs, ... }:
{ pkgs, gpgSSHKeys, ... }:
{
services.gpg-agent = {
enable = true;
enableZshIntegration = true;
pinentryPackage = pkgs.pinentry-gnome3;
pinentryPackage = pkgs.pinentry-curses;
enableSshSupport = true;
sshKeys = [ "1F937AC8F77ED74CE24EAAE79B5601F73C6D115F" ];
sshKeys = gpgSSHKeys;
defaultCacheTtl = 3600 * 12;
defaultCacheTtlSsh = 3600 * 12;
maxCacheTtl = 3600 * 12;
maxCacheTtlSsh = 3600 * 12;
extraConfig = ''
allow-loopback-pinentry
'';
};
programs.gpg = {
enable = true;
mutableKeys = true;
mutableTrust = true;
publicKeys = [{
source = ./pubring.asc;
trust = "ultimate";
}];
mutableKeys = false;
mutableTrust = false;
settings = {
pinentry-mode = "loopback";
};
publicKeys = [
{
source = ./molez.pub.asc;
trust = "ultimate";
}
{
source = ./vi-bim.pub.asc;
trust = "ultimate";
}
{
source = ./horsch.pub.asc;
trust = "ultimate";
}
];
};
}

51
gpg/horsch.pub.asc Normal file
View File

@ -0,0 +1,51 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBGY9z3YBDACrIG26NDCvf+HV4V6LiePgvRoC4lEqaUvrf9USsTvbLA7WQdTm
KagTM4rI3H7R1VzJmbQSpFRdue1JaO4wAqTlbYTJNOxJrYdH/dBvMXq+flMGlbsq
jzsWmNW08XzGxC1OiYlnX+xId9EqWdvDH9apCL5MaWh3+c8k3+CSZdhQzcbIT+Lw
Tl2epyV5KytQmpK6Ov0XCt0doNqzwGelsQZudJ2APKTYYVob7BgYjZ4kv92eaCcp
0VoRRQV3kZrXwMRZ5vieIZQVIYlh3lXA8WKS18XBjsZqgSzF/PEHoH64f+KP8D0v
nh9H9zV+aKjc+lyptCB1mJNUfEprWVpvNImLlL+JC6x1yoMUY10UN+spKkuSynis
IFug55tTsxDP5XmrkrpOucXi766HcEGo/e3lI8MVCserlDgGnFHckwYeILHIjziw
xIYDw2O0VXpJLvVpZFLd2mxHKlIXJri2nl89KqvzAYD7LG5qfE21INrJjAz4m0/I
3+B+tKs3v/ipaecAEQEAAbQoTWljaGFlbCBNYW5kbCA8bWljaGFlbC5tYW5kbEBo
b3JzY2guY29tPokBzAQTAQoANhYhBEjdu0CnvlkHUcIjYgiO048DbHryBQJmPc92
AhsDBAsJCAcEFQoJCAUWAgMBAAIeAQIXgAAKCRAIjtOPA2x68lw+C/0QvfX+tjCu
MOLdwL/2xkKrTQMSj0vXeOVjoPjPAltDFzgYv+Ax6CP4NjmaQpQqg1t4oKmIaVNm
IQdTpq6z8c4tBiHbFvY4JlDm9fMa/wn2iM2u+D4tIro8ulA1PKyJGYrFmo4RdUW3
8u5vyU+V9yWvRfmjS4efloUur8nfzThtgc1XXgut0pBTVR7b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TX889YslErQ17re/Zbqd
ZJJ3wuBZt6CUBRCzG56K5G58adh2Z0oz9vsmPa4lfb6wpje/mIoWQoi/I7/4VAso
3ygTeUGteA==
=Ok46
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -1,75 +0,0 @@
{ pkgs, username, ... }:
{
home.username = "${username}";
home.homeDirectory = "/home/${username}";
home.stateVersion = "24.05"; # Please read the comment before changing.
home.packages = with pkgs; [
eza
jq
htop
ripgrep
pavucontrol
gnumake
unzip
gcc
thunderbird
keepassxc
tree
light
element-desktop
difftastic
darktable
kubectl
kubectx
simple-scan
calibre
libreoffice
gthumb
gimp
evince
screen
inkscape
chromium
xclip
];
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. These will be explicitly sourced when using a
# shell provided by Home Manager. If you don't want to manage your shell
# through Home Manager then you have to manually source 'hm-session-vars.sh'
# located at either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/mandlm/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = { };
programs.home-manager.enable = true;
imports = [
./bat.nix
./carapace.nix
./direnv.nix
./firefox.nix
./fzf.nix
./git.nix
./gpg
./kitty.nix
./neovim
./nextcloud.nix
./starship.nix
./sway
./zoxide.nix
./zsh.nix
];
}

23
horsch.nix Normal file
View File

@ -0,0 +1,23 @@
{ pkgs, user, ... }:
{
home.username = user;
home.homeDirectory = "/home/${user}";
home.stateVersion = "24.05"; # Please read the comment before changing.
programs.home-manager.enable = true;
home.packages = with pkgs; [
wsl-open
xdg-utils
];
imports = [
./picocom.nix
./podman.nix
./horsch/ssh.nix
./horsch/zsh.nix
];
}

64
horsch/ssh.nix Normal file
View File

@ -0,0 +1,64 @@
{ ... }:
{
programs = {
ssh = {
enable = true;
matchBlocks = {
SmartCAN = {
host = "smartcan 192.168.5.1";
user = "root";
hostname = "192.168.5.1";
checkHostIP = false;
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
LogLevel = "ERROR";
};
};
Fusion-USB = {
host = "fusion-usb fusion 172.16.0.1";
user = "root";
hostname = "172.16.0.1";
checkHostIP = false;
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
LogLevel = "ERROR";
};
};
Fusion-Wifi = {
host = "fusion-wifi 172.16.1.1";
user = "root";
hostname = "172.16.1.1";
checkHostIP = false;
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
LogLevel = "ERROR";
};
};
Fusion-TX = {
host = "fusion-tx 10.100.30.160";
user = "root";
hostname = "10.100.30.160";
checkHostIP = false;
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
LogLevel = "ERROR";
};
};
hcvpnde = {
host = "hcvpnde hcvpnde.horsch.com";
hostname = "hcvpnde.horsch.com";
};
smartcan-vpn = {
host = "smartcan3-*";
user = "root";
proxyJump = "hcvpnde";
};
};
};
};
}

53
horsch/zsh.nix Normal file
View File

@ -0,0 +1,53 @@
{ ... }:
{
programs.zsh.initExtra = ''
if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ];
then
source $HOME/.nix-profile/etc/profile.d/nix.sh
fi
function sc-log {
ssh smartcan "SYSTEMD_COLORS=true journalctl --follow --no-tail --unit smartcan-''${1:-*}"
}
function sc-restart {
ssh smartcan "systemctl restart smartcan-''${1}"
}
function fu-reboot {
ssh fusion "reboot"
}
function fu-flash {
local ssh_login="fusion"
local update_file=''${1}
if [ -z ''${update_file} ]; then
update_file=$(find build/tmp/deploy/images -name "*.swu" -type f | fzf --select-1)
fi
if [ -z ''${update_file} ]; then
echo "no file selected"
return 1
fi
if [ ! -f ''${update_file} ]; then
echo "file \"''${update_file}\" does not exist"
return 2
fi
echo "flashing ''${update_file} to device..."
cat "''${update_file}" | ssh ''${ssh_login} "swupdate-client -"
if [ $? -ne 0 ]; then
echo "update failed"
return 3
fi
echo "rebooting device"
ssh ''${ssh_login} reboot
echo "done."
}
'';
}

View File

@ -1,3 +1,3 @@
require("auto-session").setup {
log_level = "error",
log_level = "error",
}

View File

@ -25,11 +25,11 @@ vim.cmd([[
]])
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
dapui.close()
end

View File

@ -1,8 +1,6 @@
{ pkgs, theme, ... }:
{
# symlink for a stable path
# symlink for a stable path
home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb;
programs = {
@ -18,17 +16,18 @@
vim-bbye
ansible-vim
# ui
# ui
dressing-nvim
# session handling
project-nvim
auto-session
# escape handling
# escape handling
better-escape-nvim
nvim-treesitter.withAllGrammars
nvim-treesitter-textobjects
markdown-preview-nvim # use({ "iamcco/markdown-preview.nvim", run = ":call mkdp#util#install()" })
toggleterm-nvim
nvim-notify
@ -83,7 +82,7 @@
nvim-dap
nvim-dap-ui
# neorg
# neorg
neorg
neorg-telescope
];
@ -96,13 +95,14 @@
terraform-ls
tflint
bash-language-server
nodePackages.dockerfile-language-server-nodejs
nodePackages.eslint_d
nodePackages.prettier
nodePackages.typescript
nodePackages.typescript-language-server
nodePackages.vscode-langservers-extracted
nodePackages.yaml-language-server
nodePackages.prettier
nodePackages.eslint_d
nodePackages.typescript-language-server
nodePackages.typescript
nodePackages.dockerfile-language-server-nodejs
nodePackages.vscode-langservers-extracted
vscode-extensions.vue.volar
lldb
vscode-extensions.vadimcn.vscode-lldb
marksman
@ -111,6 +111,16 @@
texlab
nixd
nixpkgs-fmt
bitbake-language-server
(python3.withPackages (ps: with ps; [
pep8
autopep8
python-lsp-server
]))
pyright
#clipboard
xclip
];
extraLuaPackages = luaPackages: [
@ -151,17 +161,11 @@
${builtins.readFile ./project-nvim.lua }
${builtins.readFile ./dap.lua }
${builtins.readFile ./neorg.lua }
${builtins.readFile ./illuminate.lua }
vim.g.gitblame_date_format = "%r"
-- setup illuminate highlight groups
vim.api.nvim_set_hl(0, "IlluminatedWordText", { bold = true })
vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "IlluminatedWordText" })
vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "IlluminatedWordText" })
EOF
'';
};
};
}

8
neovim/illuminate.lua Normal file
View File

@ -0,0 +1,8 @@
local illuminate = require("illuminate")
illuminate.configure({
providers = {
"lsp", "treesitter", "regex",
},
under_cursor = true,
})

View File

@ -1,5 +1,5 @@
require("ibl").setup {
indent = {
char = "",
},
indent = {
char = "",
},
}

View File

@ -1,5 +1,5 @@
local function nnoremap(key, command)
vim.api.nvim_set_keymap("n", key, command, { noremap = true })
vim.api.nvim_set_keymap("n", key, command, { noremap = true })
end
vim.g.mapleader = " "
@ -27,13 +27,13 @@ local telescope_themes = require("telescope.themes")
local telescope_projects = require("telescope").extensions.projects
local function map_telescope(key, telescope_function)
vim.api.nvim_set_keymap("n", key, "", {
noremap = true,
callback = function()
local theme = telescope_themes.get_dropdown({ layout_config = { width = 0.9 } })
telescope_function(theme)
end,
})
vim.api.nvim_set_keymap("n", key, "", {
noremap = true,
callback = function()
local theme = telescope_themes.get_dropdown({ layout_config = { width = 0.9 } })
telescope_function(theme)
end,
})
end
map_telescope("<leader>ff", telescope.find_files)
@ -47,16 +47,16 @@ map_telescope("<C-g>", telescope.live_grep)
-- terminal
vim.api.nvim_create_autocmd("TermOpen", {
pattern = "term://*",
callback = function()
local opts = { noremap = true }
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
end,
desc = "Map terminal esc and window switch keys",
pattern = "term://*",
callback = function()
local opts = { noremap = true }
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
end,
desc = "Map terminal esc and window switch keys",
})
-- buffer closing

View File

@ -1,154 +1,170 @@
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local on_attach = function(client, bufnr)
local function nnoremap(key, command)
vim.keymap.set("n", key, command, { noremap = true, silent = true, buffer = bufnr })
end
local function nnoremap(key, command)
vim.keymap.set("n", key, command, { noremap = true, silent = true, buffer = bufnr })
end
local function format_buffer()
vim.lsp.buf.format({
timeout_ms = 3000,
async = false,
filter = function(formatter)
return formatter.name ~= "tsserver" and formatter.name ~= "volar"
end
})
end
local function format_buffer()
vim.lsp.buf.format({
timeout_ms = 3000,
async = false,
filter = function(formatter)
return formatter.name ~= "tsserver" and formatter.name ~= "volar"
end
})
end
require("lsp-inlayhints").on_attach(client, bufnr)
require("lsp-inlayhints").on_attach(client, bufnr)
local telescope = require("telescope.builtin")
local telescope = require("telescope.builtin")
nnoremap("gD", vim.lsp.buf.declaration)
nnoremap("gd", telescope.lsp_definitions)
nnoremap("gt", telescope.lsp_type_definitions)
nnoremap("gi", telescope.lsp_implementations)
nnoremap("gr", telescope.lsp_references)
nnoremap("K", vim.lsp.buf.hover)
nnoremap("<leader>rn", vim.lsp.buf.rename)
nnoremap("<leader>ca", vim.lsp.buf.code_action)
nnoremap("<leader>f", format_buffer)
nnoremap("<leader>d", telescope.diagnostics)
nnoremap("<leader>D", require("lsp_lines").toggle)
nnoremap("<C-p>", vim.diagnostic.goto_prev)
nnoremap("<C-n>", vim.diagnostic.goto_next)
nnoremap("gD", vim.lsp.buf.declaration)
nnoremap("gd", telescope.lsp_definitions)
nnoremap("gt", telescope.lsp_type_definitions)
nnoremap("gi", telescope.lsp_implementations)
nnoremap("gr", telescope.lsp_references)
nnoremap("K", vim.lsp.buf.hover)
nnoremap("<leader>rn", vim.lsp.buf.rename)
nnoremap("<leader>ca", vim.lsp.buf.code_action)
nnoremap("<leader>f", format_buffer)
nnoremap("<leader>d", telescope.diagnostics)
nnoremap("<leader>D", require("lsp_lines").toggle)
nnoremap("<C-p>", vim.diagnostic.goto_prev)
nnoremap("<C-n>", vim.diagnostic.goto_next)
nnoremap("<M-o>", ":ClangdSwitchSourceHeader<CR>")
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = format_buffer,
})
end
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = format_buffer,
})
end
end
require("lsp-inlayhints").setup({})
local lsp_status = require("lsp-status")
lsp_status.config({
current_function = false,
show_filename = false,
diagnostics = true,
status_symbol = "",
current_function = false,
show_filename = false,
diagnostics = true,
status_symbol = "",
})
lsp_status.register_progress()
-- setup lua language server for init.nvim and nvim plugin development
require("neodev").setup({
override = function(root_dir, options)
if require("neodev.util").has_file(root_dir, "/etc/nixos") then
options.enabled = true
options.plugins = true
end
end,
override = function(root_dir, options)
if require("neodev.util").has_file(root_dir, "/etc/nixos") then
options.enabled = true
options.plugins = true
end
end,
})
local capabilities = require("cmp_nvim_lsp").default_capabilities(lsp_status.capabilities)
local servers = {
["bashls"] = {},
["clangd"] = {},
["cmake"] = {},
["dockerls"] = {},
["eslint"] = {},
["html"] = {},
["jsonls"] = {},
["lua_ls"] = {
Lua = {
runtime = {
version = "LuaJIT",
},
diagnostics = {
globals = { "vim" },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
["bashls"] = {},
["bitbake_language_server"] = {},
["clangd"] = {},
["cmake"] = {},
["dockerls"] = {},
["eslint"] = {},
["html"] = {},
["jsonls"] = {},
["lua_ls"] = {
Lua = {
runtime = {
version = "LuaJIT",
},
diagnostics = {
globals = { "vim" },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
format = {
enable = true,
defaultConfig = {
indent_style = "space",
indent_size = "2",
},
},
},
["marksman"] = {},
["nixd"] = {},
["pylsp"] = {
pylsp = {
plugins = {
pycodestyle = {
maxLineLength = 120
}
}
},
["marksman"] = {},
["nixd"] = {},
["pylsp"] = {
pylsp = {
plugins = {
autopep8 = {
enabled = true
},
flake8 = {
enabled = true
},
pycodestyle = {
maxLineLength = 120,
enabled = true,
}
},
["pyright"] = {},
["terraformls"] = {},
["texlab"] = {},
["tflint"] = {},
["tsserver"] = {},
["yamlls"] = {
yaml = {
keyOrdering = false
}
},
}
}
},
["pyright"] = {},
["terraformls"] = {},
["texlab"] = {},
["tflint"] = {},
["tsserver"] = {},
["yamlls"] = {
yaml = {
keyOrdering = false
}
},
}
local lspconfig = require("lspconfig")
for lsp, settings in pairs(servers) do
lspconfig[lsp].setup({
settings = settings,
on_attach = on_attach,
capabilities = capabilities,
})
lspconfig[lsp].setup({
settings = settings,
on_attach = on_attach,
capabilities = capabilities,
})
end
-- setup rustaceanvim
vim.g.rustaceanvim = {
server = {
on_attach = on_attach,
settings = {
["rust-analyzer"] = {
cargo = {
loadOutDirsFromCheck = true,
},
checkOnSave = { command = "clippy" },
procMacro = {
enable = true,
},
},
server = {
on_attach = on_attach,
settings = {
["rust-analyzer"] = {
cargo = {
loadOutDirsFromCheck = true,
},
checkOnSave = { command = "clippy" },
procMacro = {
enable = true,
},
},
},
},
}
-- setup null-ls for markdown formatting
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.prettier,
null_ls.builtins.diagnostics.tsc,
},
on_attach = on_attach,
sources = {
null_ls.builtins.formatting.prettier,
null_ls.builtins.diagnostics.tsc,
},
on_attach = on_attach,
})
-- setup lsp_lines
@ -156,29 +172,29 @@ require("lsp_lines").setup()
-- setup vim diagnostics
vim.diagnostic.config({
virtual_text = false,
signs = true,
update_in_insert = true,
underline = true,
severity_sort = true,
float = {
border = "rounded",
source = "always",
header = "",
prefix = "",
},
virtual_text = false,
signs = true,
update_in_insert = true,
underline = true,
severity_sort = true,
float = {
border = "rounded",
source = true,
header = "",
prefix = "",
},
})
-- setup diagnostics signs
local diagnostics_signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(diagnostics_signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
-- setup volar
lspconfig["volar"].setup({
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' },
on_attach = on_attach,
capabilities = capabilities,
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' },
on_attach = on_attach,
capabilities = capabilities,
})

View File

@ -1,7 +1,7 @@
require('lualine').setup({
options = { globalstatus = true },
sections = {
lualine_c = { { "filename", path = 1 }, "require('lsp-status').status()" }
},
extensions = { "toggleterm" }
options = { globalstatus = true },
sections = {
lualine_c = { { "filename", path = 1 }, "require('lsp-status').status()" }
},
extensions = { "toggleterm" }
})

View File

@ -1,16 +1,16 @@
local neorg = require("neorg")
neorg.setup({
load = {
["core.defaults"] = {},
["core.concealer"] = {},
["core.dirman"] = {
config = {
workspaces = {
notes = "~/notes",
},
default_workspace = "notes",
},
load = {
["core.defaults"] = {},
["core.concealer"] = {},
["core.dirman"] = {
config = {
workspaces = {
notes = "~/notes",
},
}
default_workspace = "notes",
},
},
}
})

View File

@ -1,87 +1,87 @@
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(
col, col):match("%s") == nil
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(
col, col):match("%s") == nil
end
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer" },
{ name = "nvim-lua" },
{ name = "calc" },
}),
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
experimental = { ghost_text = true },
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
fields = { "menu", "abbr", "kind" },
format = function(entry, item)
local menu_icon = {
nvim_lsp = "λ",
luasnip = "",
buffer = "Ω",
path = "🖿",
}
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer" },
{ name = "nvim-lua" },
{ name = "calc" },
}),
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
experimental = { ghost_text = true },
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
fields = { "menu", "abbr", "kind" },
format = function(entry, item)
local menu_icon = {
nvim_lsp = "λ",
luasnip = "",
buffer = "Ω",
path = "🖿",
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
item.menu = menu_icon[entry.source.name]
return item
end,
},
})
-- `/` cmdline setup.
cmp.setup.cmdline("/", {
sources = cmp.config.sources(
{ name = "buffer" }
)
sources = cmp.config.sources(
{ name = "buffer" }
)
})
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
sources = cmp.config.sources(
{ name = "path" },
{ name = "cmdline" }
)
sources = cmp.config.sources(
{ name = "path" },
{ name = "cmdline" }
)
})

View File

@ -5,8 +5,8 @@ vim.opt.termguicolors = true
vim.opt.number = true
-- tabwidth
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
-- indent with spaces
vim.opt.expandtab = true

View File

@ -3,25 +3,25 @@ local actions = require("telescope.actions")
local themes = require("telescope.themes")
telescope.setup({
defaults = {
mappings = {
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<ESC>"] = actions.close,
["<C-c>"] = actions.close
},
n = {
["<ESC>"] = actions.close,
["<C-c>"] = actions.close
}
}
},
extensions = {
["ui-select"] = {
themes.get_dropdown({})
},
defaults = {
mappings = {
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<ESC>"] = actions.close,
["<C-c>"] = actions.close
},
n = {
["<ESC>"] = actions.close,
["<C-c>"] = actions.close
}
}
},
extensions = {
["ui-select"] = {
themes.get_dropdown({})
},
}
})
telescope.load_extension("fzf")

View File

@ -1,14 +1,93 @@
require('nvim-treesitter.configs').setup({
highlight = {
enable = true,
highlight = {
enable = true,
},
indent = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
node_decremental = "<bs>",
scope_incremental = false,
},
incremental_selection = {
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" },
["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" },
["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" },
["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" },
["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" },
["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" },
["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" },
["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" },
["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" },
["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" },
["af"] = { query = "@call.outer", desc = "Select outer part of a function call" },
["if"] = { query = "@call.inner", desc = "Select inner part of a function call" },
["am"] = { query = "@function.outer", desc = "Select outer part of a method/function definition" },
["im"] = { query = "@function.inner", desc = "Select inner part of a method/function definition" },
["ac"] = { query = "@class.outer", desc = "Select outer part of a class" },
["ic"] = { query = "@class.inner", desc = "Select inner part of a class" },
},
move = {
enable = true,
keymaps = {
init_selection = "v",
node_decremental = "<",
node_incremental = ">",
scope_incremental = false,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]f"] = { query = "@call.outer", desc = "Next function call start" },
["]m"] = { query = "@function.outer", desc = "Next method/function def start" },
["]c"] = { query = "@class.outer", desc = "Next class start" },
["]i"] = { query = "@conditional.outer", desc = "Next conditional start" },
["]l"] = { query = "@loop.outer", desc = "Next loop start" },
-- You can pass a query group to use query from `queries/<lang>/<query_group>.scm file in your runtime path.
-- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm.
["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" },
["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" },
},
goto_next_end = {
["]F"] = { query = "@call.outer", desc = "Next function call end" },
["]M"] = { query = "@function.outer", desc = "Next method/function def end" },
["]C"] = { query = "@class.outer", desc = "Next class end" },
["]I"] = { query = "@conditional.outer", desc = "Next conditional end" },
["]L"] = { query = "@loop.outer", desc = "Next loop end" },
},
goto_previous_start = {
["[f"] = { query = "@call.outer", desc = "Prev function call start" },
["[m"] = { query = "@function.outer", desc = "Prev method/function def start" },
["[c"] = { query = "@class.outer", desc = "Prev class start" },
["[i"] = { query = "@conditional.outer", desc = "Prev conditional start" },
["[l"] = { query = "@loop.outer", desc = "Prev loop start" },
},
goto_previous_end = {
["[F"] = { query = "@call.outer", desc = "Prev function call end" },
["[M"] = { query = "@function.outer", desc = "Prev method/function def end" },
["[C"] = { query = "@class.outer", desc = "Prev class end" },
["[I"] = { query = "@conditional.outer", desc = "Prev conditional end" },
["[L"] = { query = "@loop.outer", desc = "Prev loop end" },
},
},
lsp_interop = {
enable = true,
border = 'none',
floating_preview_opts = {},
peek_definition_code = {
["<leader>df"] = "@function.outer",
["<leader>dF"] = "@class.outer",
},
},
},
},
})

5
picocom.nix Normal file
View File

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.picocom ];
}

5
podman.nix Normal file
View File

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.podman ];
}

38
private.nix Normal file
View File

@ -0,0 +1,38 @@
{ pkgs, user, ... }:
{
home.username = user;
home.homeDirectory = "/home/${user}";
home.stateVersion = "24.05"; # Please read the comment before changing.
home.packages = with pkgs; [
pavucontrol
gnumake
gcc
thunderbird
keepassxc
light
element-desktop
darktable
kubectl
kubectx
simple-scan
calibre
libreoffice
gthumb
gimp
evince
inkscape
chromium
];
programs.home-manager.enable = true;
imports = [
./firefox.nix
./kitty.nix
./nextcloud.nix
./sway
];
}

View File

@ -5,4 +5,3 @@
enableZshIntegration = true;
};
}

25
shell/default.nix Normal file
View File

@ -0,0 +1,25 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
difftastic
htop
jq
unzip
xclip
];
imports = [
./bat.nix
./carapace.nix
./direnv.nix
./eza.nix
./fzf.nix
./ripgrep.nix
./rsync.nix
./shell_aliases.nix
./starship.nix
./tree.nix
./zoxide.nix
./zsh.nix
];
}

8
shell/eza.nix Normal file
View File

@ -0,0 +1,8 @@
{ ... }:
{
programs.eza = {
enable = true;
git = true;
extraOptions = [ "--group-directories-first" ];
};
}

9
shell/ripgrep.nix Normal file
View File

@ -0,0 +1,9 @@
{ ... }:
{
programs = {
ripgrep = {
enable = true;
};
};
}

5
shell/rsync.nix Normal file
View File

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.rsync ];
}

11
shell/shell_aliases.nix Normal file
View File

@ -0,0 +1,11 @@
{ ... }:
{
home.shellAliases = {
g = "git";
gg = "git graph";
gs = "git status";
gd = "git diff";
k = "kubectl";
};
}

5
shell/tree.nix Normal file
View File

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.tree ];
}

View File

@ -6,4 +6,3 @@
enableZshIntegration = true;
};
}

View File

@ -13,6 +13,10 @@ in
highlight = zsh_autosuggest_highlight_style;
};
syntaxHighlighting = {
enable = true;
};
initExtra = ''
function set_win_title(){
local TITLE=$(git config --get remote.origin.url || echo "$PWD")
@ -21,11 +25,5 @@ in
precmd_functions+=(set_win_title)
'';
shellAliases = {
ls = "eza --group-directories-first --git";
neovide = "neovide --multigrid";
xclip = "xclip -selection clipboard";
};
};
}