Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For a few years now at work I have been using the GNOME Terminal, and have gotten very used to that. I usually organize my work by categorizing each task on its own virtual desktop, then within each virtual desktop I have multiple Gnome Terminals each with multiple terminal tabs, most of which have a file open for editing.

This setup really makes it hard for me to reboot, and when I do, its a real pain trying to save what files I had opened and where. I have looked further into the GNOME Terminal, as well as Konsole, but as far as I can tell, neither of these terminal programs can do what I want. I want to be able to save a session in either GNOME or Konsole, but when I reload that session, the files that were previously open in VI, will be open in VI again. All they seem to do now, is just reload the directory that I was in, but not open the file in VI.

Is there a program that is capable of doing this, or perhaps a setting I am missing in either GNOME or Konsole that will allow for automatic reopening of files I had open in VI before closing the session?

share|improve this question
1  
This may be off-topic, but most of the time, those settings are uneeded because linux hosts hardly nerver need a reboot. –  Kwaio Sep 30 '13 at 12:14
    
@Kwaio I suppose its more for the scenario when my machine crashes. For instance, on Friday, all of my terminals just decided to crash, yet other programs remained open and unaffected. First time I have experienced that in 3 years of using this machine though. –  halexh Sep 30 '13 at 12:23
    
You could create a directory of symlinks to the files you want openned, and make a script on startup that opens them all. just an idea –  Kwaio Sep 30 '13 at 14:43

2 Answers 2

Did you try to store it on a session?

:h session

its better you ask on http://unix.stackexchange.com, however i found some good links on the internet...you should take a look on those following links.

stackoverflow link - Save and Restore vim state

vim configuration

all important VI commands

share|improve this answer

With Vim, you can run :mksession to save your current session, i.e., mappings, options, variables, current directory, tabs, windows (and their layouts), etc. This saves all the session information into a file in the current directory called Session.vim (you can provide a filename to the :mksession command if you want to save different sessions in different files, e.g., :mksession work-task.vim). Since the information is stored in a file, it will persist after a restart of the computer.

To restore your session the next time you start Vim, simply run, :source Session.vim or :source work-task.vim

See Vim’s help session-file for full details.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.