Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I use ":sh" for this purpose, but it has the problems that:

- you get a new shell, so your history is lost

- if you have a "stack" of vim's you have to return to them in stack order

- I develop a habit of typing Ctrl-d when I want to get back to vim, which means I accidentally log out of SSH sessions all the time if I actually haven't still got vim open

I think getting in the habit of using Ctrl-z instead would be a big improvement.



> - you get a new shell, so your history is lost

To prevent that from happening you can add this to your .bashrc

    #write to history file at each shell prompt
    export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"


Note that this can slow down your shell. Also it mingles histories from different sessions. Stop doing this myself for these reasons


Yes, these are good points but I've found the benefit outweighs the annoyance. fzf for a history searcher really helps. BUT not being able to 'up arrow' the previous command is annoying at times.

So far it's a 6/10 Slightly better then not doing it. =)




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: