Make editor function work with flakes
This commit is contained in:
+21
-10
@@ -1,7 +1,7 @@
|
|||||||
set -gx fish_greeting
|
set -gx fish_greeting
|
||||||
|
|
||||||
function nix
|
function nix
|
||||||
if test "$argv[1]" = "develop"
|
if test "$argv[1]" = "develop"; and test (count $argv) -eq 1
|
||||||
command nix develop -c fish $argv[2..-1]
|
command nix develop -c fish $argv[2..-1]
|
||||||
else if test "$argv[1]" = "shell"
|
else if test "$argv[1]" = "shell"
|
||||||
env IN_NIX_SHELL=shell nix $argv
|
env IN_NIX_SHELL=shell nix $argv
|
||||||
@@ -9,6 +9,7 @@ function nix
|
|||||||
command nix $argv
|
command nix $argv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function a
|
function a
|
||||||
for arg in $argv
|
for arg in $argv
|
||||||
if string match -q '*/' $arg
|
if string match -q '*/' $arg
|
||||||
@@ -19,13 +20,7 @@ function a
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function y
|
|
||||||
set tmp (mktemp -t "yazi-cwd.XXXXXX")
|
|
||||||
yazi $argv --cwd-file="$tmp"
|
|
||||||
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
|
||||||
builtin cd -- "$cwd"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function g
|
function g
|
||||||
if git rev-parse --git-dir >/dev/null 2>&1
|
if git rev-parse --git-dir >/dev/null 2>&1
|
||||||
gitui
|
gitui
|
||||||
@@ -33,13 +28,29 @@ function g
|
|||||||
echo "Not inside a Git repository."
|
echo "Not inside a Git repository."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function y
|
||||||
|
set tmp (mktemp -t "yazi-cwd.XXXXXX")
|
||||||
|
yazi $argv --cwd-file="$tmp"
|
||||||
|
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
||||||
|
builtin cd -- "$cwd"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function editor
|
function editor
|
||||||
set pos (cat ~/dotfiles/.pos)
|
set pos (cat ~/dotfiles/.pos)
|
||||||
y $pos
|
y $pos
|
||||||
if test -e ./p.vim
|
if test -e ./p.vim
|
||||||
nvim -S ./p.vim
|
set cmd nvim -S ./p.vim
|
||||||
else
|
else
|
||||||
nvim
|
set cmd nvim
|
||||||
|
end
|
||||||
|
if test -e ./flake.nix
|
||||||
|
and not contains -- "$IN_NIX_SHELL" pure impure
|
||||||
|
and command nix develop --command true 2>/dev/null
|
||||||
|
command nix develop --command $cmd
|
||||||
|
else
|
||||||
|
command $cmd
|
||||||
end
|
end
|
||||||
echo $PWD > ~/dotfiles/.pos
|
echo $PWD > ~/dotfiles/.pos
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user