# Vim specific config options imported by .bashrc # Use this folder to store session files export VIM_SESSIONS=$HOME/.local/share/vim/sessions # Open Vim loading the appropriate project session based on the name of # the current folder. If it does not exists create a new one. vims() { mkdir -p "$VIM_SESSIONS" if [ -d "$VIM_SESSIONS" ]; then # Computes the current folder name (possibly the name of the # project). local folder="${PWD##*/}" # Removes any dots in front of the folder name. local session="$VIM_SESSIONS/${folder#.}.vim" if [ -f $session ]; then # If a session file exists, use it. vim -S "$session" else # Otherwise open vim and start a new session. vim +"call dyamon#session#new(\"$session\")" fi else exit 1 fi }