Giter Club home page Giter Club logo

Comments (8)

finishingmove avatar finishingmove commented on July 19, 2024 1

I think a lot of people might find this useful as well:

let s:local_session_directory = xolox#misc#path#merge('~/.vim/sessions', getcwd())

I actually spent a couple of hours looking for a plugin that could do this...

from vim-session.

xolox avatar xolox commented on July 19, 2024

You should be able to "fake" this by setting the g:session_directory variable in Vim script, depending on the working directory. Have you written any Vim script before? If not, I might be able to help.

from vim-session.

kebot avatar kebot commented on July 19, 2024

@xolox Thanks for your help, I try to write it in python, here is my script:

python << EOF
import os
from os.path import join
import vim
os.getcwd()

session_dir = join(os.getcwd(), '.vimsessions')
if os.path.isdir(session_dir): 
  vim.command('let g:session_directory = "%s"' % session_dir )
else:
  pass

EOF

from vim-session.

xolox avatar xolox commented on July 19, 2024

I believe the following bit of Vim script will do what you want. Try adding the following to your vimrc script:

" Check whether the current working directory contains a ".vimsessions"
" directory. It it does, we'll configure the vim-session plug-in to load
" its sessions from the ".vimsessions" directory.
" From: https://github.com/xolox/vim-session/issues/49
let s:local_session_directory = xolox#misc#path#merge(getcwd(), '.vimsessions')
if isdirectory(s:local_session_directory)
  let g:session_directory = s:local_session_directory
endif
unlet s:local_session_directory

from vim-session.

hoschi avatar hoschi commented on July 19, 2024

Great, thanks :)

from vim-session.

xolox avatar xolox commented on July 19, 2024

I'm closing this issue now, because I assume the code sample answers your question. If not, feel free to reopen the issue. Happy Vimming!

from vim-session.

simlei avatar simlei commented on July 19, 2024

I was faster by decisively not settling :) but on a second though, google may have improved over the last 5-ish years.
is this still the preferred way to go? would it break using multiple tab sessions in one vim instance?

from vim-session.

JamesHagerman avatar JamesHagerman commented on July 19, 2024

xolox#misc#path#merge dies even with xolox/vim-misc installed :(

Edit: I used this instead and it seems to be good enough

let g:session_default_name = fnamemodify(getcwd(), ':t')

from vim-session.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.