Skip to content

Commit

Permalink
fish: Add fix_fish_history
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Chancellor <[email protected]>
  • Loading branch information
nathanchance committed Dec 10, 2024
1 parent c481b12 commit e65485f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions fish/functions/fix_fish_history.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env fish
# SPDX-License-Identifier: MIT
# Copyright (C) 2024 Nathan Chancellor

function fix_fish_history -d "Remove NUL bytes to workaround https://github.com/fish-shell/fish-shell/issues/10300"
python3 -c "from pathlib import Path
fish_history = Path.home() / '.local/share/fish/fish_history'
history_bytes = fish_history.read_bytes()
if (nul := b'\x00') in history_bytes:
fish_history.write_bytes(history_bytes.replace(nul, b''))"
end

0 comments on commit e65485f

Please sign in to comment.