Comments (8)
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.
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.
@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.
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.
Great, thanks :)
from vim-session.
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.
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.
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)
- gVim 8.1.1 full-screen HOT 2
- Saving session with makefile quicklist not working. HOT 4
- OpenSession - Entering a number without hitting enter
- autosave hidden unnamed buffers
- Persist markers into session? HOT 1
- Color scheme is not loaded properly when auto restoring session on VimEnter HOT 2
- RestartVim not working (linux vim 8.0.1453)
- Swich sessions HOT 1
- Forking this project HOT 1
- Files don't close when saving session in windows
- Missing/stale functions/mappings after some plugins get installed or removed
- Rename SaveSession, OpenSession, etc. to SessionSave, SessionOpen, etc.
- Swapfiles conflict when opening session in two Vim sessions
- Error while opening a session that contains at least one terminal buffer.
- Add support of Buffer Explorer plugin
- vim-session reorders the opened tabs
- newvim :setlocal buftype=acwrite & E676
- Save :Focus from vim-dispatch?
- slow
- Session is not completely restored on auto-load
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-session.