tpope / vim-obsession

obsession.vim: continuously updated session files
http://www.vim.org/scripts/script.php?script_id=4472
1.76k stars 70 forks source link

ProTip: start vim with obsession #11

Open sunaku opened 11 years ago

sunaku commented 11 years ago

Hello,

I'd like to share the following sh(1) function that I wrote to "alias" vim so that it starts with obsession, unless there are any arguments provided to vim (in the case of editing a particular file). Just add it to your .profile or .bashrc or .zshrc to use it.

function vim() {
  if test $# -gt 0; then
    env vim "$@"
  elif test -f Session.vim; then
    env vim -S
  else
    env vim -c Obsession
  fi
}

Thanks so much for creating vim obsession! :love_letter:

dhruvasagar commented 10 years ago

This is neat and I used it for a while, then I created a plugin for vim to do this instead and a little more to enable easy switching between vim sessions cleanly. Checkout https://github.com/dhruvasagar/vim-prosession

lfv89 commented 10 years ago

@sunaku This is exactly what I was looking for, thank you.