Compare commits

..

No commits in common. "5cf0960459ca7d0409eb30d905b14f924e2ad525" and "9b5a5b7de75f3b978e9d2b4f6ad27053cfa1453e" have entirely different histories.

11 changed files with 176 additions and 216 deletions

View File

@ -47,14 +47,8 @@ let
''); '');
}; };
}; };
fzgo_paths = [ in
"/home/server/.dotfiles" {
"/home/server/Containers"
"/home/server/Workspace"
"/home/server/Storage/Thomas"
"/home/server/Storage/Shared"
];
in {
home.username = "server"; home.username = "server";
home.homeDirectory = "/home/server"; home.homeDirectory = "/home/server";
nix = { nix = {
@ -69,8 +63,7 @@ in {
imports = [ imports = [
(import ./utils/common.nix { inherit inputs config pkgs; }) (import ./utils/common.nix { inherit inputs config pkgs; })
(import ./utils/services.nix { inherit pkgs scripts; }) (import ./utils/services.nix { inherit pkgs; scripts = scripts; })
(import ./utils/fzgo_links.nix { inherit config pkgs fzgo_paths; })
./ssh ./ssh
]; ];
programs.ssh.matchBlocks."*".identityFile = "/home/server/.secrets/SSH/Mallorea/id_ed25519"; programs.ssh.matchBlocks."*".identityFile = "/home/server/.secrets/SSH/Mallorea/id_ed25519";
@ -80,4 +73,9 @@ in {
LANG = "en_US.UTF-8"; LANG = "en_US.UTF-8";
XDG_RUNTIME_DIR = "/run/user/$(id -u)"; XDG_RUNTIME_DIR = "/run/user/$(id -u)";
}; };
programs.zsh.initExtra = pkgs.lib.mkForce ''
LOCAL_SEARCH_DIRS=(~/.dotfiles/ ~/Containers ~/Workspace ~/Storage/Thomas ~/Storage/Shared)
REMOTE_SEARCH_DIRS=()
'';
} }

View File

@ -1,14 +1,9 @@
{ inputs, config, pkgs, ... }: { inputs, config, pkgs, ... }:
let
fzgo_paths = [
"/home/user/.dotfiles"
];
in
{ {
imports = [ imports = [
(import ./utils/common.nix { inherit inputs config pkgs; }) (import ./utils/common.nix { inherit inputs config pkgs; })
(import ./utils/python.nix { inherit inputs config pkgs; }) (import ./utils/python.nix { inherit inputs config pkgs; })
(import ./utils/fzgo_links.nix { inherit config pkgs fzgo_paths; })
./ssh ./ssh
]; ];

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: { inputs, config, pkgs, ... }:
{ {
programs.git = { programs.git = {
@ -11,13 +11,11 @@
}; };
ignores = [ ignores = [
"*.direnv/" "*.direnv/"
".dmypy.json"
]; ];
extraConfig = { extraConfig = {
credentials.helper = "store"; credentials.helper = "store";
pull.rebase = false; pull.rebase = false;
push.autoSetupRemove = true; push.autoSetupRemove = true;
branch.autoSetupMerge = "simple";
init.defaultBranch = "master"; init.defaultBranch = "master";
diff.noprefix = true; diff.noprefix = true;
color.ui = "auto"; color.ui = "auto";

View File

@ -1,22 +1,22 @@
-- Copilot -- Copilot
-- return { return {
-- "zbirenbaum/copilot.lua", "zbirenbaum/copilot.lua",
-- cmd = "Copilot", cmd = "Copilot",
-- event = "InsertEnter", event = "InsertEnter",
-- opts = { opts = {
-- suggestion = { suggestion = {
-- auto_trigger = true, auto_trigger = true,
-- auto_refresh = true, auto_refresh = true,
-- keymap = { keymap = {
-- accept = "<leader><Tab>", accept = "<leader><Tab>",
-- }, },
-- }, },
-- filetypes = { filetypes = {
-- markdown = true, markdown = true,
-- tex = true, tex = true,
-- } }
-- } }
-- } }
-- Supermaven -- Supermaven
-- return { -- return {
@ -31,13 +31,13 @@
-- } -- }
-- Neocodium -- Neocodium
return { -- return {
"monkoose/neocodeium", -- "monkoose/neocodeium",
event = "VeryLazy", -- event = "VeryLazy",
config = function() -- config = function()
local neocodeium = require("neocodeium") -- local neocodeium = require("neocodeium")
neocodeium.setup() -- neocodeium.setup()
vim.keymap.set("i", "<leader><tab>", neocodeium.accept) -- vim.keymap.set("i", "<leader><tab>", neocodeium.accept)
vim.keymap.set("i", "<leader>a", function () neocodeium.cycle_or_complete(1) end) -- vim.keymap.set("i", "<leader>a", function () neocodeium.cycle_or_complete(1) end)
end, -- end,
} -- }

View File

@ -164,11 +164,9 @@ return {
}, },
filetypes = filetypes filetypes = filetypes
}, },
bashls = {
filetypes = {"sh", "bash", "zsh"},
},
texlab = {}, texlab = {},
nixd = {}, nixd = {},
bashls = {},
csharp_ls = {}, csharp_ls = {},
cmake = {}, cmake = {},
jsonls = {}, jsonls = {},

View File

@ -1,20 +1,6 @@
return { return {
"mfussenegger/nvim-lint", "mfussenegger/nvim-lint",
config = function () config = function ()
local dmypy = require("lint").linters.dmypy
dmypy.args = {
"run",
'--timeout',
'50000',
'--',
'--show-column-numbers',
'--show-error-end',
'--hide-error-context',
'--no-color-output',
'--no-error-summary',
'--no-pretty',
"--use-fine-grained-cache",
}
require("lint").linters_by_ft = { require("lint").linters_by_ft = {
python = {"dmypy"}, python = {"dmypy"},
} }

View File

@ -1,12 +0,0 @@
{ config, pkgs, fzgo_paths }:
let
mkLink = source_path: file_type: {
"${source_path}_${file_type}" = {
source = config.lib.file.mkOutOfStoreSymlink source_path;
target = "/home/user/.config/fzgo/entries/${file_type}/${pkgs.lib.strings.replaceStrings [ "/" ] [ "|" ] source_path}";
};
};
mkLinks = source_path: (mkLink source_path "d") // (mkLink source_path "f");
in {
home.file = pkgs.lib.mkMerge (map mkLinks fzgo_paths);
}

View File

@ -19,7 +19,8 @@
PDF_VIEWER = "evince"; PDF_VIEWER = "evince";
GPULAB_CERT = "${config.xdg.configHome}/../.secrets/GPULab/certificate.pem"; GPULAB_CERT = "${config.xdg.configHome}/../.secrets/GPULab/certificate.pem";
GPULAB_DEV = "False"; GPULAB_DEV = "False";
GCC_COLORS = "error = '01;31:warning = '01;35:note = '01;36:caret = '01;32:locus = '01:quote = '01'"; GCC_COLORS =
"error = '01;31:warning = '01;35:note = '01;36:caret = '01;32:locus = '01:quote = '01'";
ARCHFLAGS = "-arch x86_64"; ARCHFLAGS = "-arch x86_64";
TERM = "screen-256color"; TERM = "screen-256color";
PYTHONDONTWRITEBYTECODE = "1"; PYTHONDONTWRITEBYTECODE = "1";
@ -55,7 +56,21 @@
enableCompletion = true; enableCompletion = true;
syntaxHighlighting.enable = false; syntaxHighlighting.enable = false;
autosuggestion.enable = true; autosuggestion.enable = true;
initExtra = ''export LD_LIBRARY_PATH=${pkgs.sqlite.out}/lib:$LD_LIBRARY_PATH'';
initExtra = ''
LOCAL_SEARCH_DIRS=(~/.dotfiles/)
REMOTE_SEARCH_DIRS=(
~/Workspace/Trackbox/Branches/
~/Workspace/Trackbox/Repositories/
~/Workspace/Trackbox/Resources/
~/Workspace/Trackbox/Docker/
~/Workspace/University/PhD/Thesis/
/home/server/Storage/Shared/
/home/server/Storage/Thomas/
)
export LD_LIBRARY_PATH=${pkgs.sqlite.out}/lib:$LD_LIBRARY_PATH
'';
initExtraFirst = '' initExtraFirst = ''
ZVM_VI_INSERT_ESCAPE_BINDKEY=jj ZVM_VI_INSERT_ESCAPE_BINDKEY=jj
source ${./files/waypipe.zsh} source ${./files/waypipe.zsh}
@ -63,7 +78,6 @@
source ${./files/p10k.zsh} source ${./files/p10k.zsh}
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
source ${./files/functions.zsh} source ${./files/functions.zsh}
source ${./files/fzgo.zsh}
function zvm_after_init() { function zvm_after_init() {
source ${./files/term.zsh} source ${./files/term.zsh}
source ${./files/completion.zsh} source ${./files/completion.zsh}
@ -75,6 +89,9 @@
eval "$(direnv hook zsh)" eval "$(direnv hook zsh)"
export LD_LIBRARY_PATH=${pkgs.sqlite.out}/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=${pkgs.sqlite.out}/lib:$LD_LIBRARY_PATH
} }
function run() {
NIXPKGS_ALLOW_UNFREE=1 nix run --impure "nixpkgs#$1" -- "''${@:2}"
}
function o() { function o() {
${pkgs.handlr-regex}/bin/handlr open $@ < /dev/null &> /dev/null & disown ${pkgs.handlr-regex}/bin/handlr open $@ < /dev/null &> /dev/null & disown
} }
@ -97,10 +114,14 @@
python = "python3"; python = "python3";
vim = "nvim"; vim = "nvim";
v = ''echo $(pwd) > /tmp/oil_dir && nvim -c ':lua require("oil").open()' && cd "$(cat /tmp/oil_dir 2> /dev/null || pwd)"''; v = ''echo $(pwd) > /tmp/oil_dir && nvim -c ':lua require("oil").open()' && cd "$(cat /tmp/oil_dir 2> /dev/null || pwd)"'';
cpr = "rsync --archive -hh --partial --info = stats1,progress2 --modify-window = 1"; cpr =
mvr = "rsync --archive -hh --partial --info = stats1,progress2 --modify-window = 1 --remove-source-files"; "rsync --archive -hh --partial --info = stats1,progress2 --modify-window = 1";
rg = "rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'"; mvr =
ag = "rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'"; "rsync --archive -hh --partial --info = stats1,progress2 --modify-window = 1 --remove-source-files";
rg =
"rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'";
ag =
"rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'";
reset = "tput reset"; reset = "tput reset";
}; };
history.size = 10000000; history.size = 10000000;

View File

@ -1,3 +1,89 @@
function cd_to() {
setopt localoptions pipefail no_aliases 2> /dev/null
local dir=$1
if [[ -z "$dir" ]]; then
zle redisplay
return 0
fi
zle push-line # Clear buffer. Auto-restored on next prompt.
cd $dir
zle accept-line
local ret=$?
unset dir # ensure this doesn't end up appearing in prompt expansion
zle reset-prompt
}
function find_local() {
fd . -t $1 | fzgo
}
function find_global() {
file_type=$1
mkdir -p ~/.cache/fzgo_paths
FZGO_CACHE=~/.cache/fzgo_paths/$file_type
FZGO_RECENTS=~/.cache/fzgo_paths/recents_$file_type
if [ -f $FZGO_CACHE ]; then
if [ $(stat -c %Y $FZGO_CACHE) -lt $(date +%s -d '-1 day') ]; then
rm $FZGO_CACHE
fi
fi
if [ ! -f $FZGO_CACHE ]; then
PATHS=""
for i in "$LOCAL_SEARCH_DIRS[@]"; do
if [ -d "$i" ]; then
PATHS="$PATHS\n$i\n$(fd . $i -t $file_type)"
fi
done
for i in "$REMOTE_SEARCH_DIRS[@]"; do
if [ -d "$i" ]; then
PATHS="$PATHS\n$i\n$(ssh mallorea fd . \"$i\" -t $file_type -d 15)"
fi
done
echo "$PATHS" > $FZGO_CACHE
fi
touch $FZGO_RECENTS
file="$(cat $FZGO_RECENTS $FZGO_CACHE | awk '!x[$0]++' | fzgo)"
echo "$file" | cat - $FZGO_RECENTS | awk '!x[$0]++' > /tmp/fzgo_paths_recents_$file_type && mv /tmp/fzgo_paths_recents_$file_type $FZGO_RECENTS
echo "$file"
}
function open_path() {
file_type=$1
search_fn=$2
selection="$($search_fn $file_type)"
if [ "$selection" = "" ]; then
zle reset-prompt
return
fi
if [ "$LBUFFER" = "" ]; then
if [ "$file_type" = "d" ]; then
cd_to "$selection"
else
selection=$(realpath "$selection")
parent=$(dirname "$selection")
cd_to "$parent"
nvim "$selection"
fi
else
emulate -L zsh
zle -I
LBUFFER="${LBUFFER}\"$selection\""
zle reset-prompt
fi
}
function open_global_path_d() { open_path d find_global }
function open_global_path_f() { open_path f find_global }
function open_local() { open_path f find_local }
function register_key() {
zle -N $2
bindkey "^$1" $2
bindkey -M emacs "^$1" $2
bindkey -M vicmd "^$1" $2
bindkey -M viins "^$1" $2
}
function push() { function push() {
git add -A git add -A
if [ -z "$*" ]; then if [ -z "$*" ]; then
@ -7,7 +93,3 @@ function push() {
fi fi
git push git push
} }
function run() {
NIXPKGS_ALLOW_UNFREE=1 nix run --impure "nixpkgs#$1" -- "''${@:2}"
}

View File

@ -1,106 +0,0 @@
local function cd_to() {
setopt localoptions pipefail no_aliases 2> /dev/null
local dir=$1
if [[ -z "$dir" ]]; then
zle redisplay
return 0
fi
zle push-line # Clear buffer. Auto-restored on next prompt.
cd $dir
zle accept-line
local ret=$?
unset dir # ensure this doesn't end up appearing in prompt expansion
zle reset-prompt
}
local function get_entries() {
file_type=$1
if [ ! -d "$XDG_CONFIG_HOME/fzgo/entries" ]; then
return
fi
for entry in "$XDG_CONFIG_HOME/fzgo/entries/$file_type"/*; do
# If the file is a symlink to a directory, we want to list the directory
if [ -L "$entry" ]; then
target=$(realpath "$entry")
if [ -d "$target" ]; then
fd . "$target" -t "$file_type"
fi
else
cat "$entry"
fi
done
}
function fzgo_update_cache() {
for file_type_dir in "$XDG_CONFIG_HOME/fzgo/entries"/*; do
mkdir -p "$XDG_CACHE_HOME/fzgo/entries"
for entry in "$file_type_dir"/*; do
file_type=$(basename "$file_type_dir")
mkdir -p "$XDG_CACHE_HOME/fzgo/entries/$file_type"
# If the file is a symlink to a directory, we want to list the directory
if [ -L "$entry" ]; then
target=$(realpath "$entry")
if [ -d "$target" ]; then
out_file="$(echo "$target" | sed 's\/\|\g')"
out_file="$XDG_CACHE_HOME/fzgo/entries/$file_type/$out_file"
mkdir -p "$(dirname \"$out_file\")"
fd . "$target" -t "$file_type" > "$out_file"
fi
fi
done
done
}
local function find_global() {
file_type=$1
FZGO_RECENTS=$XDG_CACHE_HOME/fzgo/recent_paths_$file_type
mkdir -p $(dirname $FZGO_RECENTS)
touch $FZGO_RECENTS
FZGO_RECENT_ENTRIES=$(cat $FZGO_RECENTS)
FZGO_ENTRIES=$(get_entries $file_type)
file="$(echo $FZGO_RECENT_ENTRIES'\n'$FZGO_ENTRIES | awk '!x[$0]++' | fzgo)"
echo "$file" | cat - $FZGO_RECENTS | awk '!x[$0]++' > /tmp/fzgo_paths_recents_$file_type && mv /tmp/fzgo_paths_recents_$file_type $FZGO_RECENTS
echo "$file"
}
local function find_local() {
fd . -t $1 | fzgo
}
local function open_path() {
file_type=$1
search_fn=$2
selection="$($search_fn $file_type)"
if [ "$selection" = "" ]; then
zle reset-prompt
return
fi
if [ "$LBUFFER" = "" ]; then
if [ "$file_type" = "d" ]; then
cd_to "$selection"
else
selection=$(realpath "$selection")
parent=$(dirname "$selection")
cd_to "$parent"
$EDITOR "$selection"
fi
else
emulate -L zsh
zle -I
LBUFFER="${LBUFFER}\"$selection\""
zle reset-prompt
fi
}
function fzgo_global_d() { open_path d find_global }
function fzgo_global_f() { open_path f find_global }
function fzgo_local_f() { open_path f find_local }
function fzgo_register_key() {
zle -N $2
bindkey "^$1" $2
bindkey -M emacs "^$1" $2
bindkey -M vicmd "^$1" $2
bindkey -M viins "^$1" $2
}

View File

@ -39,6 +39,6 @@ bindkey -M vicmd "^R" fzf-history-widget
bindkey -M viins "^R" fzf-history-widget bindkey -M viins "^R" fzf-history-widget
bindkey -M emacs "^R" fzf-history-widget bindkey -M emacs "^R" fzf-history-widget
fzgo_register_key "T" fzgo_global_d register_key "T" open_global_path_d
fzgo_register_key "E" fzgo_global_f register_key "E" open_global_path_f
fzgo_register_key "W" fzgo_local_f register_key "W" open_local