~kungtotte/dotfiles

dotfiles/.config/fish/functions/did.fish -rw-r--r-- 356 bytes View raw
d73a0ef0Thomas Landin Add shortcut to insert date in init.vim 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function did
    set timestamp (date +"%Y-%m-%d %H:%M:%S %A")
    if test -n "$argv"
        echo -e "$timestamp\n- $argv\n\n(cat did.txt)" > "did.txt"
    else
        nvim +"normal O$timestamp" + 'normal o' +'normal ggo-  ' +startinsert "did.txt"
    end

    if test -e "did.txt"
        echo ""
        sed -n -e '/^$/ q' -e 'p' "did.txt"
    end
end