Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
2 votes
1 answer
31 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 ...
user avatar
  • 38
0 votes
1 answer
18 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 ...
user avatar
  • 101
0 votes
1 answer
25 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 ...
user avatar
  • 1,572
0 votes
1 answer
44 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)) ...
user avatar
1 vote
1 answer
41 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, ...
user avatar
2 votes
1 answer
133 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 ...
user avatar
  • 131
1 vote
1 answer
23 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 ...
user avatar
2 votes
1 answer
114 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 ...
user avatar
0 votes
1 answer
49 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?
user avatar
  • 3,081
0 votes
1 answer
45 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>&...
user avatar
  • 173
0 votes
1 answer
25 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?
user avatar
  • 1,114
2 votes
1 answer
227 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 ...
user avatar
1 vote
1 answer
320 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 ...
user avatar
  • 133
1 vote
1 answer
46 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....
user avatar
  • 353
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 ...
user avatar
  • 446
1 vote
1 answer
485 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: ...
user avatar
  • 389
0 votes
1 answer
36 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 ...
user avatar
  • 1
2 votes
1 answer
157 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 ...
user avatar
0 votes
1 answer
181 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?
user avatar
  • 3,081
2 votes
1 answer
174 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 ...
user avatar
  • 123
1 vote
0 answers
36 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 ...
user avatar
  • 20.7k
1 vote
1 answer
611 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 ...
user avatar
  • 23
1 vote
1 answer
1k 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 ...
user avatar
  • 1,648
0 votes
0 answers
159 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 ...
user avatar
1 vote
1 answer
86 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?
user avatar
  • 13
0 votes
1 answer
317 views

In Vim, how to tag/enrich buffers with custom information (that persist naturally)

Gday, 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 ...
user avatar
  • 103
1 vote
1 answer
183 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 ...
user avatar
  • 137
0 votes
1 answer
222 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 ...
user avatar
  • 169
4 votes
3 answers
2k 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 ...
user avatar
  • 447
3 votes
1 answer
749 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 ...
user avatar
  • 131
1 vote
1 answer
354 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, ...
user avatar
  • 1,489
0 votes
1 answer
67 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 ...
user avatar
  • 1,489
3 votes
1 answer
392 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>...
user avatar
  • 447
9 votes
2 answers
2k 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 ...
user avatar
0 votes
1 answer
259 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 ...
user avatar
0 votes
1 answer
90 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 ...
user avatar
4 votes
1 answer
533 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 ...
user avatar
  • 353
3 votes
2 answers
709 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 ...
user avatar
  • 131
4 votes
0 answers
69 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 ...
user avatar
  • 143
0 votes
1 answer
161 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 ...
user avatar
  • 137
5 votes
1 answer
99 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 ...
user avatar
5 votes
1 answer
255 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 ...
user avatar
  • 2,221
3 votes
2 answers
1k 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 ...
user avatar
6 votes
2 answers
216 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 ...
user avatar
10 votes
1 answer
7k 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 ...
user avatar
  • 211
2 votes
1 answer
57 views

Using '-c' when calling vim from terminal

My issue is with using the -c while calling vim from terminal like $ vim -c jk I want to be able to open the last session before quitting on typing viml in terminal For this I made a map to save ...
user avatar
  • 247
2 votes
0 answers
49 views

:mksession session file includes nonprintable characters

I have been having some problems using UltiSnips with vim. It seems that :mksession is adding a bunch of nonprintable characters to my session file(s). When this is sourced to restore my session, ...
user avatar
4 votes
1 answer
167 views

Source vim session file: Track down unexpected sourcing of other file

I often save my session using the following: In vim: mksession! ~/session.vim In gvim: mksession! ~/sessionX.vim However, when I invoke vim with a sourcing of ~/session.vim, I'm finding that ~/...
user avatar
14 votes
2 answers
6k views

How do I restore a group of tabs? [duplicate]

I just learned about tabs, meaning I can open them via :tabe some/file :tabe yet/another/file :tabe foo and circle them via gt (activate right one) and gT (activate left one). Yet when I close my ...
user avatar
  • 2,747
3 votes
1 answer
1k views

Make vim sessions adopt changes to vimrc file

I've made changes to my _vimrc (windows) file since creating a session. I'm finding it impossible (using :source) to apply these changes to the session; it sticks stubbornly to the values as they ...
user avatar