add bash go back as an option to disable it on server
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
|
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/10/17 18:15:38 by tomoron #+# #+# #
|
# Created: 2024/10/17 18:15:38 by tomoron #+# #+# #
|
||||||
# Updated: 2025/02/14 16:44:45 by tomoron ### ########.fr #
|
# Updated: 2025/02/25 12:03:56 by tomoron ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
@ -53,20 +53,6 @@
|
|||||||
historyControl = ["ignoreboth"];
|
historyControl = ["ignoreboth"];
|
||||||
historyIgnore = [ "ls" "cd" "exit" ];
|
historyIgnore = [ "ls" "cd" "exit" ];
|
||||||
shellOptions = [ "cdspell" "autocd"];
|
shellOptions = [ "cdspell" "autocd"];
|
||||||
bashrcExtra = ''
|
|
||||||
cd() {
|
|
||||||
builtin cd "$@"
|
|
||||||
echo -n "$PWD" > ~/.last_directory
|
|
||||||
}
|
|
||||||
[ -z "\$${PS1:-}" ] && return
|
|
||||||
|
|
||||||
if [ -f ~/.last_directory ];then
|
|
||||||
echo -n going to
|
|
||||||
cat ~/.last_directory
|
|
||||||
echo
|
|
||||||
builtin cd "$(cat ~/.last_directory)"
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home.sessionPath = [ "~/.local/bin" ];
|
home.sessionPath = [ "~/.local/bin" ];
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
{ config, lib, pkgs, username,homeDir, ... }:
|
{ config, lib, pkgs, username,homeDir, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [];
|
|
||||||
|
|
||||||
home.packages = with pkgs;[
|
home.packages = with pkgs;[
|
||||||
neovim
|
neovim
|
||||||
dmenu
|
dmenu
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
mods.bash.goback = false;
|
||||||
wayland.windowManager.hyprland.settings = {
|
wayland.windowManager.hyprland.settings = {
|
||||||
monitor= [
|
monitor= [
|
||||||
"virt-1, 1920x1080@60, 0x0, 1.0"
|
"virt-1, 1920x1080@60, 0x0, 1.0"
|
||||||
|
24
homeConfigs/modules/bash.nix
Normal file
24
homeConfigs/modules/bash.nix
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{ lib, config, ...}:
|
||||||
|
|
||||||
|
{
|
||||||
|
options.mods.bash.goback = lib.mkOption{
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "go back to last cd when starting bash";
|
||||||
|
};
|
||||||
|
|
||||||
|
config.programs.bash.bashrcExtra = lib.mkIf config.mods.bash.goback ''
|
||||||
|
cd() {
|
||||||
|
builtin cd "$@"
|
||||||
|
echo -n "$PWD" > ~/.last_directory
|
||||||
|
}
|
||||||
|
[ -z "\$${PS1:-}" ] && return
|
||||||
|
|
||||||
|
if [ -f ~/.last_directory ];then
|
||||||
|
echo -n going to
|
||||||
|
cat ~/.last_directory
|
||||||
|
echo
|
||||||
|
builtin cd "$(cat ~/.last_directory)"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
}
|
Reference in New Issue
Block a user