Questions tagged [sessions]

For questions about vim's sessions feature, which persist an editing session to disk for recovery later.

Filter by
Sorted by
Tagged with
0 votes
1 answer
40 views

How to `vim -S` silently?

:source Session.vim causes some noise. Within (Neo)Vim I can simply run :silent exec "source Session.vim" to silence it, but how can I silence vim -S when I load my session from the command ...
Martin Braun's user avatar
0 votes
1 answer
143 views

Close session and all buffers with one command

I often use sessions to edit and track files in a project. I almost always type :q when I'm done working and end up closing the buffer I was last working on when what I want to do is close all buffers ...
francismaile's user avatar
0 votes
1 answer
58 views

read viminfo when argc() > 0

Does Vim read the viminfo when called with a file argument? How can I force Vim to restore the buffer list in that case? Use case & context What I want is: When called as vi: enable read/write ...
qeatzy's user avatar
  • 940
0 votes
1 answer
107 views

Is it possible to store the current colorscheme into a session?

As title. I have to use some colorscheme to make my reading experience better on certain filetype. I have made an auto session plugin myself but I don't know how to store the colorscheme info I'm ...
NeoZoom.lua's user avatar
  • 1,242
2 votes
2 answers
339 views

How to save quickfix list per Neovim session using :mksession?

I could not find this in :h sessionoptions. If this cannot be done, is there another way to save quickfix list to some file and reload it?
Ariel Frischer's user avatar
3 votes
1 answer
85 views

vim-workspace does not save set options

I want to have a persisting vim setting in my workspace. The vim plugin vim-workspace seems to be the obvious solution for this. Yet it does not save some options. For instance I want to have my spell ...
john's user avatar
  • 48
1 vote
2 answers
122 views

Can the default filename for :mksession be changed?

If :mksession or vim -S is used without a filename parameter a default file Session.vim is used. This can be very convenient. I wonder if there is a way to change this default filename to something ...
Paidhi's user avatar
  • 111
0 votes
1 answer
26 views

Is it by design that opening with -S doesn't account for changes in file permission?

If a_session is created via :mksession, when reopening that session via vim -S a_session, Vim doesn't take into account that file permissions of some of the opened files might have changed in the ...
Enlico's user avatar
  • 2,162
1 vote
1 answer
102 views

Prevent vim from exiting in case of error during autocommand

I'd like to save my session before vim exits. Here's what I have so far: function SaveSession() let l:new_session = trim(inputdialog("Enter new session name: ", v:this_session, -1)) ...
Big McLargeHuge's user avatar
2 votes
1 answer
125 views

Why does Vim load buffers from old session when new one is started?

The situation is this: I have 2 sessions: s1.vim and s2.vim. First one was saved with files A, B, C in buffers list. Second one was saved with file A. Next I start vim: vim -S s1.vim. :ls shows A, B, ...
whysoserious's user avatar
3 votes
1 answer
271 views

NeoVim Save BreakPoints to Session

I am using NeoVim for writing go code, for debugging I am using vimspector The debugging works well, however everytime I exit and restart nvim the breakpoints are lost. I tried saving the session ...
Pharaoh's user avatar
  • 141
1 vote
1 answer
24 views

Simple way to store additionnal config in the scope of the actual directory [duplicate]

I have my .vimrc with some global/local configurations, but when I am working in a project, I know that I often create configs (settings, mapping, command, abbreviations, etc.) specifically for this ...
Fabrice Hategekimana's user avatar
2 votes
1 answer
279 views

When opening an existing session and an existing file at the same time, the focus goes to the last opened file in the session

When doing this: vim -S Session.vim OTHER_FILE The shown buffer contains the last opened file in the Session.vim and not the file OTHER_FILE. I find this behavior a bit disturbing, I would have ...
djoproject's user avatar
0 votes
1 answer
79 views

Is there a `:browse oldfiles` for vim sessions?

It seems to me it would make more sense to have a :browse oldfiles for the last n sessions you opened up / saved in vim. Is there such a thing?
leeand00's user avatar
  • 3,447
0 votes
1 answer
53 views

How to identify the script that's calling a user command?

I have a problem: I need to pass « any » caller-session trace into a user command… Was trying with: command WantToKnowWhosCalling call Impl("\<SID>", \ expand("<SID>&...
Mooncer's user avatar
  • 173
0 votes
1 answer
64 views

How to avoid losing your viminfo (command history, and so on) on abort?

Your command history, marks, etc are lost when exiting on seg fault / forcingly closing gui app(i.e. cmd-Q on mac) . How to avoid it?
eyal karni's user avatar
  • 1,026
3 votes
1 answer
528 views

How to preserve options in Vim sessions?

I am using vertical splits to compare two files which cannot be compared with diff. I don’t know how to save specific settings in the session. Here is how I proceed: enable the settings: :set ...
Lionel Hamayon's user avatar
2 votes
1 answer
548 views

Update a Vim Session file's loaded plugins without losing window positioning

I have a Vim Session file I created by doing: :mksession Then I quit Vim. I then downloaded a plugin to: ${HOME}/.vim/pack/vendor/start/vim-markdown-folding and then I fired up Vim with the session ...
FilBot3's user avatar
  • 153
1 vote
1 answer
69 views

Remember spelling settings in session file

I enabled spell checking in a buffer with set spell spelllang=en which works. If I save the session with mksession! and later source it back with vim -S Session.vim, spellchecking is no longer enabled....
JohnDoe's user avatar
  • 363
2 votes
0 answers
31 views

Save terminal buffer's current working directory with mksession [duplicate]

I usually start vim at the root of my project. Then I open tabs with windows inside. Usually one of the windows has a :terminal. In the :terminal, I usually cd to/some/subfolder. At the end of the ...
425nesp's user avatar
  • 556
4 votes
1 answer
827 views

what is the purpose of the view folder in the .vim folder?

I got an error when opening my .vimrc with vim saying ".vimrc" 138L, 3781C Error detected while processing /home/fbence/.vim/view/~=+.vimrc=: line 117: E518: Unknown option: termkey= line 118: ...
fbence's user avatar
  • 603
0 votes
1 answer
40 views

Vim session swaps files around

I create a session using :mks, which has tabs and split views inside tabs. When I open the session using vi -S Session.vim, some of the files are swapped around. I have tried deleting and creating new ...
AdamP's user avatar
  • 1
2 votes
1 answer
218 views

Session - start with buffer 1

Note: Possible fixed bug. See comments. A somewhat minor nuisance, but as the pedantic for these things :P When saving and opening a Session file the Session.vim file does: badd +1 file1 badd +1 ...
user3342816's user avatar
0 votes
1 answer
253 views

Can a vim session use environment variables to specify the path to a file it opens?

Can you edit a vim session, so that it opens a file based on the value of an environment variable instead of an absolute path to a file?
leeand00's user avatar
  • 3,447
2 votes
1 answer
210 views

! is required but not allowed for custom command

I'm using Neovim 0.3.7. I have a default session file that loads up a number of files I'm working on at the moment. To save and load the sessions I have the following custom commands defined: let ...
Moustache's user avatar
  • 123
1 vote
0 answers
42 views

Save :Man window in session

TL;DR: I want to persist :Man windows in sessions I am obsessed with sessions, and use tpope's vim-obsession for managing them. Coupled with a scripted tmux, sessions make for a perfect "quit, go ...
D. Ben Knoble's user avatar
  • 24.8k
1 vote
1 answer
1k views

Colorscheme Errors (E185) with vimrc and sessions

I have a couple of things which suggest there's an issue with the way I use colorscheme with my vimrc file. Errors when running source ~/.vimrc The colorscheme used when opening a vim session ...
BitFlow's user avatar
  • 133
1 vote
1 answer
2k views

Change saved session's working directory

I have a neovim session saved using :mks which by default saves to a subdirectory in my project ~/project/subdir/Session.vim. I want it to save to ~/project/Session.vim, which I can do by running :cd ...
howard's user avatar
  • 1,858
0 votes
0 answers
224 views

How to properly organize persistence of the vim state of all opened buffers?

Before switching to vim years ago I was using Sublime Text and it perfectly handled situations when I just close it and open again. Nothing is lost and at the place where I left it off. So I'm aiming ...
Georgy Grigoryev's user avatar
1 vote
1 answer
99 views

How to save modifiable and readonly states in session file?

I can’t find how to save modifiable and readonly states with :mksession. Is it even possible?
Alekh's user avatar
  • 13
0 votes
1 answer
407 views

How to tag/enrich buffers with custom information (that persist naturally)?

I am trying to persist some state about my buffers, specifically terminal buffers, over vim sessions with :mksession through the plugin vim-session by Xolox. The goal is to assign labels to the ...
simlei's user avatar
  • 113
1 vote
1 answer
212 views

Can capitalized marks be saved in session INSTEAD of viminfo?

Marks are saved in .viminfo I would like to have separate marks saved per session. Is there an easy setting to make this switch? I know I could write some vimscript to save my session marks ...
Wumbo's user avatar
  • 147
0 votes
1 answer
264 views

how to set filetype after session restored with vim-session plugin

I used exvim as session manager, it uses a project file with extension .exvim. The session is auto-loaded when double click the .exvim, and auto-saved on exit. But there're bugs and the dev is ...
aj3423's user avatar
  • 199
5 votes
3 answers
3k views

How can I read a command-line argument in vimrc?

Here is a situation: I want to manage my working environment on multiple projects separately, and all of them should have its own session (Session.vim) to save and restore. So I would like to launch ...
Blaszard's user avatar
  • 535
3 votes
1 answer
925 views

Vim Session keeping terminal state

I am currently using tmux to have two terminals on the left and vim on the right. One terminal is running Django server, and the other one is for general usage. I am trying to find out if I can ditch ...
panosl's user avatar
  • 131
1 vote
1 answer
425 views

Persistent conceal settings through Vim / Neovim restarts

I can successfully toggle between different conceal levels in Neovim, which is rather handy when working with markdown documents. Also, when working with with multiple documents in a Neovim session, ...
ipatch's user avatar
  • 1,809
0 votes
1 answer
83 views

How to NOT create a view and session file when viewing man pages

I recently discovered the world of vim session files, and they are awesome for working with multi-file code projects. However, when opening a man page I don't need a session file created for viewing ...
ipatch's user avatar
  • 1,809
4 votes
1 answer
462 views

Can I retain and restore all the GUI windows and its files on launch on Vim?

I'm currently using the session saving to restore the state when the app (MacVim) is closed. nnoremap <leader>q :mksession! ~/.vim/Session.vim<CR>:wqa<CR> nnoremap <leader>...
Blaszard's user avatar
  • 535
9 votes
2 answers
3k views

How to share the same buffer between multiple vim instances

I work with two displays. I usually open one instance of Vim in display #1 (let's call it Vim #1), which over time ends up having an open buffer for nearly every file in a project. Now I want to ...
Pierre Prinetti's user avatar
0 votes
1 answer
354 views

Do not reopen buffers of last session

When Vim starts, it always opens buffers of last session too. That is to say, when I leave Vim by closing all windows, but do not explicitly close buffers (by :bd), those buffers will be opened next ...
Violapterin's user avatar
0 votes
1 answer
95 views

Remapping of j as gj etc in .vimrc is not applied in a session

My .vimrc contains: noremap <buffer> <silent> $ g$ noremap <buffer> <silent> 0 g0 noremap <buffer> <silent> j gj noremap <buffer> <silent> k gk I've ...
Marc Adler's user avatar
4 votes
1 answer
664 views

How could I preserve netrw :Lexplore in Vim sessions?

I use netrw :Lexplore as my file browser and I also use vim sessions. However, whenever I open a session file, :Lexplore is closed and I have to re-open. Is there a way to keep netrw :Lexplore open ...
JohnDoe's user avatar
  • 363
3 votes
2 answers
908 views

How to have different vim sessions open the same file seamlessly

from some time now I'm using vim very intensively. I'm connecting to my server with different screen sessions, one for my main PC, another for netbooks or mobile phone, tablets, ... All this time ...
Joel.O's user avatar
  • 131
4 votes
0 answers
70 views

Persisting unsaved changes to untitled buffers in a session [duplicate]

Sublime Text has a killer feature I'd really like to get working in Vim. It's pretty much the only reason why I can't drop it in favor of Vim yet. The feature is that Sublime remembers unsaved ...
Pieter's user avatar
  • 143
0 votes
1 answer
214 views

Do sessions get loaded after vimrc, and is there a block to specify loading code AFTER a session is loaded?

set sessionoptions+=globals if !exists('g:EGbufs') if exists('g:EGbufsstring') exe "let g:EGbufs=".g:EGbufsstring else let g:EGbufs = {} endif ...
Wumbo's user avatar
  • 147
5 votes
1 answer
106 views

Empty first tab lost when using sessions

I'm creating a session with mksession, and when I restore the session, if the first tab was empty ([No Name]), it's gone in the restored session. Other empty tabs are restored fine; it seems to only ...
Jim Stewart's user avatar
5 votes
1 answer
300 views

Ignore word spelling on a per-file/buffer basis

I can add a word to the local dictionary or spellfile with zg. I can use zG to add a word to the internal spellfile, but this still affects all loaded files. How can I add spelling exceptions on a ...
Tom Hale's user avatar
  • 2,551
3 votes
2 answers
2k views

Make Vim sessions save the content of unnamed buffers

When saving a session with :mksession and :sourceing it back, the content of [No Name] unnamed buffers is lost. I like to sometimes write temporary throwaway code or notes on a unnamed or scratch ...
Jerome Dalbert's user avatar
6 votes
2 answers
248 views

Make Vim sessions save alternate files

When saving a session with :mksession and sourceing it back, I noticed that alternate files (accessed via C-^) are not persisted. The docs don't mention anything about persisting alternate files. Is ...
Jerome Dalbert's user avatar
10 votes
1 answer
9k views

Remember previous session [duplicate]

Editors like Sublime Text remember your session, so that whenever you open Sublime Text it is exactly how it was when you last closed it: All of the same files are open Your cursor is in the same ...
Justin's user avatar
  • 211