mirror of
https://github.com/elwrcl/copnix.git
synced 2026-10-31 06:18:03 +03:00
nu
This commit is contained in:
4 files changed
+127
-28
No files matched your search
@@ -1,12 +1,16 @@
|
||||
{ ... }:
|
||||
{
|
||||
flake.homeModules.home-nushell-commandline-copy =
|
||||
{ ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
let
|
||||
inherit (lib.meta) getExe';
|
||||
wlCopy = getExe' pkgs.wl-clipboard "wl-copy";
|
||||
in
|
||||
{
|
||||
programs.nushell.extraConfig = ''
|
||||
use std/clip
|
||||
def nu-highlight-default [] {
|
||||
home.packages = [ pkgs.wl-clipboard ];
|
||||
|
||||
programs.nushell.extraConfig = ''
|
||||
def nu-highlight-default [] {
|
||||
let input = $in
|
||||
$env.config.color_config = {}
|
||||
$input | nu-highlight
|
||||
@@ -17,7 +21,7 @@
|
||||
| nu-highlight-default
|
||||
| [ "```ansi" $in "```" ]
|
||||
| str join (char nl)
|
||||
| clip copy --ansi
|
||||
| ^${wlCopy}
|
||||
}
|
||||
|
||||
$env.config.keybindings ++= [
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{ ... }:
|
||||
{
|
||||
flake.homeModules.home-nushell-keybinds =
|
||||
{ ... }:
|
||||
{
|
||||
programs.nushell.extraConfig = ''
|
||||
$env.config.keybindings ++= [
|
||||
{
|
||||
name: jj_status
|
||||
modifier: control
|
||||
keycode: char_g
|
||||
mode: [ emacs vi_insert vi_normal ]
|
||||
event: { send: executehostcommand, cmd: "jj status" }
|
||||
}
|
||||
{
|
||||
name: jj_log
|
||||
modifier: alt
|
||||
keycode: char_l
|
||||
mode: [ emacs vi_insert vi_normal ]
|
||||
event: { send: executehostcommand, cmd: "jj log" }
|
||||
}
|
||||
{
|
||||
name: jj_diff
|
||||
modifier: alt
|
||||
keycode: char_d
|
||||
mode: [ emacs vi_insert vi_normal ]
|
||||
event: { send: executehostcommand, cmd: "jj diff" }
|
||||
}
|
||||
]
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -11,19 +11,38 @@
|
||||
ll = "eza -lah --icons --group-directories-first";
|
||||
la = "eza -a --icons --group-directories-first";
|
||||
lt = "eza --tree --level=2 --icons";
|
||||
tree = "eza --tree --git-ignore --group-directories-first";
|
||||
|
||||
cat = "bat";
|
||||
df = "df -h";
|
||||
du = "du -h";
|
||||
free = "free -h";
|
||||
df = "^df -h";
|
||||
du = "^du -h";
|
||||
free = "^free -h";
|
||||
rm = "trash-put";
|
||||
|
||||
sysinfo = "fastfetch";
|
||||
monitor = "sudo btop";
|
||||
ports = "sudo ss -tulpn";
|
||||
myip = "curl ifconfig.me";
|
||||
|
||||
js = "jj status";
|
||||
jl = "jj log";
|
||||
jd = "jj diff";
|
||||
jc = "jj commit";
|
||||
jp = "jj git push";
|
||||
jf = "jj git fetch";
|
||||
|
||||
gs = "git status";
|
||||
ga = "git add";
|
||||
gp = "git push";
|
||||
gl = "git log --oneline --graph --decorate";
|
||||
|
||||
#gnu
|
||||
gfind = "^find";
|
||||
ggrep = "^grep --color=auto";
|
||||
gls = "^ls";
|
||||
gdu = "^du";
|
||||
gmkdir = "^mkdir";
|
||||
|
||||
".." = "cd ..";
|
||||
"..." = "cd ../..";
|
||||
"...." = "cd ../../..";
|
||||
@@ -32,6 +51,8 @@
|
||||
environmentVariables = {
|
||||
MESA_SHADER_CACHE_MAX_SIZE = "2G";
|
||||
MESA_SHADER_CACHE_DIR = "/tmp/mesa_shader_cache";
|
||||
FZF_DEFAULT_OPTS = "--height 40% --layout=reverse --border";
|
||||
FZF_DEFAULT_COMMAND = "fd --type f --hidden --follow --exclude .git";
|
||||
};
|
||||
|
||||
extraEnv = ''
|
||||
@@ -40,32 +61,73 @@
|
||||
|
||||
extraConfig = ''
|
||||
$env.config.show_banner = false
|
||||
def gc [msg: string] { git commit -m $msg }
|
||||
def rebuild [] {
|
||||
git -C ~/copland add -A
|
||||
git -C ~/copland commit -m "update"
|
||||
nh os switch
|
||||
$env.config.history.file_format = "sqlite"
|
||||
$env.config.history.max_size = 1_000_000
|
||||
$env.config.history.isolation = false
|
||||
|
||||
$env.config.edit_mode = "vi"
|
||||
$env.config.cursor_shape.vi_insert = "line"
|
||||
$env.config.cursor_shape.vi_normal = "block"
|
||||
|
||||
$env.config.completions.algorithm = "substring"
|
||||
$env.config.highlight_resolved_externals = true
|
||||
|
||||
def --env mc [path: path] {
|
||||
mkdir $path
|
||||
cd $path
|
||||
}
|
||||
|
||||
def rebuild-dry [] { nh os switch --dry }
|
||||
def rebuild-cop [] {
|
||||
def --env mcg [path: path] {
|
||||
mkdir $path
|
||||
cd $path
|
||||
jj git init --colocate
|
||||
}
|
||||
|
||||
def rebuild [] {
|
||||
jj --repository ~/copland status | ignore
|
||||
nh os switch --accept-flake-config
|
||||
}
|
||||
|
||||
def rebuild-dry [] {
|
||||
nh os switch --dry --accept-flake-config
|
||||
}
|
||||
|
||||
def rebuild-up [] {
|
||||
nix flake update --flake ~/copland
|
||||
git -C ~/copland add -A
|
||||
git -C ~/copland commit -m $"flake update (date now | format date '%Y-%m-%d')"
|
||||
nh os switch
|
||||
jj --repository ~/copland status | ignore
|
||||
nh os switch --accept-flake-config
|
||||
}
|
||||
def extract [file: string] {
|
||||
let ext = ($file | path parse | get extension)
|
||||
match $ext {
|
||||
"gz" => { tar xzf $file },
|
||||
"bz2" => { tar xjf $file },
|
||||
"tar" => { tar xf $file },
|
||||
"zip" => { unzip $file },
|
||||
"7z" => { 7z x $file },
|
||||
"rar" => { unrar e $file },
|
||||
_ => { print $"'($file)' can't be extracted" }
|
||||
|
||||
def extract [file: path] {
|
||||
let name = ($file | path basename)
|
||||
match $name {
|
||||
_ if ($name | str ends-with ".tar.bz2") => { ^tar xjf $file }
|
||||
_ if ($name | str ends-with ".tar.gz") => { ^tar xzf $file }
|
||||
_ if ($name | str ends-with ".tar.xz") => { ^tar xJf $file }
|
||||
_ if ($name | str ends-with ".tar") => { ^tar xf $file }
|
||||
_ if ($name | str ends-with ".bz2") => { ^bunzip2 $file }
|
||||
_ if ($name | str ends-with ".gz") => { ^gunzip $file }
|
||||
_ if ($name | str ends-with ".zip") => { ^unzip $file }
|
||||
_ if ($name | str ends-with ".7z") => { ^7z x $file }
|
||||
_ if ($name | str ends-with ".rar") => { ^unrar e $file }
|
||||
_ => { print $"(ansi red)'($name)' açılamıyor(ansi reset)" }
|
||||
}
|
||||
}
|
||||
|
||||
# `which`, with canonicalize .
|
||||
def realwhich [...applications: string, --all (-a)] {
|
||||
which --all=$all ...$applications
|
||||
| update path {|row|
|
||||
match $row.type {
|
||||
"external" => { $row.path | path expand }
|
||||
_ => $row.path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($"($env.HOME)/.config/copetch/animated-copetch.sh" | path exists) {
|
||||
^$"($env.HOME)/.config/copetch/animated-copetch.sh"
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
enableNushellIntegration = true;
|
||||
options = [ "--cmd cd" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user