You are not logged in.

#1 2009-09-10 01:59:18

Lexion
Member
Registered: 2008-03-23
Posts: 510

vim/urxvt sessions

I use xmonad, urxvt, and vim for development, but there is no session saving such as in geany or kate.  Is there any way I can open a project one file at a time, save a session, reboot, and then open the same session with a few commands and not one (file) by one?  I'm perfectly fine with any level of hackishness smile.


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#2 2009-09-10 02:04:43

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: vim/urxvt sessions

In vim, run

:help mksession

archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#3 2009-09-10 07:14:05

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: vim/urxvt sessions

Lexion wrote:

I use xmonad, urxvt, and vim for development, but there is no session saving such as in geany or kate.  Is there any way I can open a project one file at a time, save a session, reboot, and then open the same session with a few commands and not one (file) by one?  I'm perfectly fine with any level of hackishness smile.

Do an initial

:mksession

and save the file (usually "Session.vim") at some suiting place.

To save later editing sessions I did set up a keybinding for this in my .vimrc:

" --- Define a session save shortcut ---
:map <C-F12> :wa<Bar>exe "mksession! " . v:this_session<CR>

Afterwards reopen the session with

vim -S <where-your-Session-file-was-saved>

Last edited by bernarcher (2009-09-10 07:17:41)


To know or not to know ...
... the questions remain forever.

Offline

#4 2009-09-10 11:21:59

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: vim/urxvt sessions

Thanks for the quick replies, but mksession only handles one vim instance, I often have five or six open at a time
in multiple windows.  I'm sorry If I didn't phrase the question correctly.

I coded a simple script to open/load vim sessions, but it would be nice if there is a better solution.

#!/bin/bash

SESSIONLIST=""
SESSIONLIST=$(cat /etc/vs.save)

if [ $1 == "add" ] && [ $2 ]
then
    SESSIONLIST="$SESSIONLIST $2"
    echo $SESSIONLIST > /etc/vs.save
    urxvtc -e vim $2
elif [ $1 == "load" ]
then
    for i in $SESSIONLIST
    do
        urxvtc -e vim $i
    done
fi

Last edited by Lexion (2009-09-10 11:43:39)


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#5 2009-09-10 12:47:07

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: vim/urxvt sessions

If I understand properly, you do want to run some sort of "project" which consists of several vim instances each running in its own urxvt window. In that case I too have no better idea than your script.

But I vaguely remember there are some project/ide vim scripts out there. Did you search the Vim Scripts database for these?

Most a designed to run one single vim instance, however. But one or two of them were outside scripts which provided multiple vim instances.

Sorry to be of no better help. It is quite some time ago, I had a look at vim IDEs.


To know or not to know ...
... the questions remain forever.

Offline

#6 2009-09-10 17:00:11

Heller_Barde
Member
Registered: 2008-04-01
Posts: 245

Re: vim/urxvt sessions

@Lexion:
albeit i have no clue whatsoever about how to, I suppose you could write some script for vim to be aware of other vim instances and communicate with them.
good luck

cheers Barde

Offline

Board footer

Powered by FluxBB