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
1answer
29 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)) ...
1
vote
1answer
35 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, ...
2
votes
1answer
79 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 ...
0
votes
0answers
25 views

How do I load a session and also open a new file?

I save my sessions to Session.vim and load them by running vim -S, which opens my layout just the way I want it. It's great! Sometimes I want to edit ./README.md. I could run vim README.md, but then I'...
1
vote
1answer
21 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 ...
2
votes
1answer
80 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 ...
0
votes
1answer
44 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?
0
votes
1answer
43 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>&...
0
votes
1answer
23 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?
2
votes
1answer
136 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 ...
1
vote
1answer
234 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 ...
1
vote
1answer
36 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....
2
votes
0answers
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 ...
1
vote
1answer
336 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: ...
0
votes
1answer
33 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 ...
2
votes
1answer
133 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 ...
0
votes
1answer
159 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?
2
votes
1answer
156 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 ...
1
vote
0answers
35 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 ...
1
vote
1answer
482 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 ...
1
vote
1answer
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 ...
0
votes
0answers
140 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 ...
1
vote
1answer
81 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?
0
votes
1answer
267 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 ...
1
vote
1answer
171 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 ...
0
votes
1answer
205 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 ...
3
votes
3answers
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 ...
3
votes
1answer
651 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 ...
1
vote
1answer
343 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, ...
0
votes
1answer
64 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 ...
3
votes
1answer
347 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>...
8
votes
1answer
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 ...
0
votes
1answer
219 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 ...
0
votes
1answer
86 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 ...
3
votes
1answer
482 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 ...
3
votes
2answers
626 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 ...
3
votes
0answers
65 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 ...
0
votes
1answer
140 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 ...
5
votes
1answer
97 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 ...
5
votes
1answer
234 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 ...
3
votes
2answers
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 ...
6
votes
2answers
205 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 ...
9
votes
1answer
6k 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 ...
2
votes
1answer
55 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 ...
2
votes
0answers
48 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, ...
4
votes
1answer
153 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 ~/...
14
votes
2answers
5k 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 ...
3
votes
1answer
976 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 ...
0
votes
1answer
73 views

How can I save a session in a directory owned by root?

I quite often open linux system configuration files with vim and sometimes have a session with lots of tabs, splits, quicklists etc that I want to save to a session and restore again later. The ...
6
votes
2answers
2k views

Vim lost custom highlight settings after recovering from sessions

I defined some highlights in the vimrc file and it works well in gvim. However after I mksession and sourced it back, I found that some (maybe all) of the custom highlights were lost and vim used the ...