python: add history to pdb
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
{ config, pkgs, inputs, ... }:
|
{ config, pkgs, inputs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
dotfiles = "${config.home.homeDirectory}/git/dotfiles";
|
||||||
|
|
||||||
|
createDotLink = name: {
|
||||||
|
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/${name}/.config/${name}";
|
||||||
|
recursive = true;
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
inputs.nix-index-database.homeModules.default
|
inputs.nix-index-database.homeModules.default
|
||||||
@@ -137,9 +145,6 @@
|
|||||||
# I am not sure this is working
|
# I am not sure this is working
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
XDG_BIN_HOME = "${config.home.homeDirectory}/.local/bin";
|
XDG_BIN_HOME = "${config.home.homeDirectory}/.local/bin";
|
||||||
#This variable is overriden. It does not work
|
|
||||||
EDITOR = "hx";
|
|
||||||
#PAGER = "bat";
|
|
||||||
};
|
};
|
||||||
home.sessionPath = [ "$XDG_BIN_HOME" ];
|
home.sessionPath = [ "$XDG_BIN_HOME" ];
|
||||||
|
|
||||||
@@ -176,6 +181,10 @@
|
|||||||
set fish_greeting
|
set fish_greeting
|
||||||
fish_add_path -g $HOME/.local/bin
|
fish_add_path -g $HOME/.local/bin
|
||||||
'';
|
'';
|
||||||
|
shellInit = ''
|
||||||
|
set -gx EDITOR "nvim"
|
||||||
|
set -gx VISUAL "$EDITOR"
|
||||||
|
'';
|
||||||
plugins = [
|
plugins = [
|
||||||
{ name = "grc"; src = pkgs.fishPlugins.grc.src; }
|
{ name = "grc"; src = pkgs.fishPlugins.grc.src; }
|
||||||
];
|
];
|
||||||
@@ -191,6 +200,7 @@
|
|||||||
#programs.neovim.enable = true;
|
#programs.neovim.enable = true;
|
||||||
programs.neovim = {
|
programs.neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
defaultEditor = true;
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
(nvim-treesitter.withPlugins (p: with p; [
|
(nvim-treesitter.withPlugins (p: with p; [
|
||||||
nix
|
nix
|
||||||
@@ -238,19 +248,16 @@
|
|||||||
|
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
|
|
||||||
xdg.configFile = let
|
xdg.configFile = {
|
||||||
dotfiles = "${config.home.homeDirectory}/git/dotfiles";
|
|
||||||
|
|
||||||
createDotLink = name: {
|
|
||||||
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/${name}/.config/${name}";
|
|
||||||
recursive = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
in {
|
|
||||||
"git" = createDotLink "git";
|
"git" = createDotLink "git";
|
||||||
"niri" = createDotLink "niri";
|
"niri" = createDotLink "niri";
|
||||||
"jj" = createDotLink "jj";
|
"jj" = createDotLink "jj";
|
||||||
"helix" = createDotLink "helix";
|
"helix" = createDotLink "helix";
|
||||||
"ghostty" = createDotLink "ghostty";
|
"ghostty" = createDotLink "ghostty";
|
||||||
};
|
};
|
||||||
|
home.file = {
|
||||||
|
".pdbrc" = {
|
||||||
|
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/python/.pdbrc";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
18
python/.pdbrc
Normal file
18
python/.pdbrc
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# ~/.pdbrc
|
||||||
|
import atexit
|
||||||
|
import os
|
||||||
|
import readline
|
||||||
|
|
||||||
|
# Define where the pdb command history will be saved
|
||||||
|
historyPath = os.path.expanduser("~/.pdb_history")
|
||||||
|
|
||||||
|
# Read existing history if it exists
|
||||||
|
if os.path.exists(historyPath):
|
||||||
|
readline.read_history_file(historyPath)
|
||||||
|
|
||||||
|
# Register a hook to automatically save history when exiting pdb
|
||||||
|
def save_history(historyPath=historyPath):
|
||||||
|
import readline
|
||||||
|
readline.write_history_file(historyPath)
|
||||||
|
|
||||||
|
atexit.register(save_history)
|
||||||
Reference in New Issue
Block a user