Primary Navigation

Workspace concept ala TextPad

Hi, Is it possible to load a set of files when you start gvim? (Like in Textpad, for those who know this editor) For example: I have a project containing 20

Message 1 of 12
, Feb 6, 2007

0 Attachment

Hi,

Is it possible to load a set of files when you start gvim? (Like in Textpad,
for those who know this editor)
For example:
I have a project containing 20 files.
I frequently uses 5 of them to modify and debug them.
Can you give a command to vim like: "Load workspace projectX", which then
load the 5 defined files?
And when needed add or delete files from this workspace?

Sessions should do what you want. You can look at :help session for more information, but this is basically what I do: 1. Open the files that you want, in tabs

Message 2 of 12
, Feb 6, 2007

0 Attachment

Sessions should do what you want. You can look at :help session for more information, but this is basically what I do:

1. Open the files that you want, in tabs (I typically have three tabs with source files, a tab with my todo.otl file, another with some init files and another with my .vimrc).
2. Type :mksession ~/work_session.vim

The file work_session.vim now contains the state of vim as it is. You can now quit that instance of vim, start up another and do

:source ~/work_session.vim

Or alternatively start vim with an argument:

Vim -S ~/work_session.vim

Presto, your "workspace" is there! If you want to add or remove files, just create a new session file with mksession, or replace the existing one.

I generally always have my vim session open, but whenever I need to reboot (I'm on Windows, so that is pretty often), I do a :mksession and then when I get back I just :source the file and I'm back where I left off!

On 2/6/07, Eric Leenman <eric.leenman@...> wrote:
> Hi,
>
> Is it possible to load a set of files when you start gvim? (Like in Textpad,
> for those who know this editor)
> For example:
> I have a project containing 20 files.
> I frequently uses 5 of them to modify and debug them.
> Can you give a command to vim like: "Load workspace projectX", which then
> load the 5 defined files?
> And when needed add or delete files from this workspace?
>

... Two more options: Project plugin ... * http://www.vim.org/scripts/script.php?script_id=69 I don t know how I used to live without this plugin. It allows

Message 4 of 12
, Feb 6, 2007

0 Attachment

> Is it possible to load a set of files when you start gvim? (Like in
> Textpad, for those who know this editor) For example: I have a project
> containing 20 files. I frequently uses 5 of them to modify and debug
> them. Can you give a command to vim like: "Load workspace projectX",
> which then load the 5 defined files? And when needed add or delete
> files from this workspace?

I'm a simple VIM user.
That's why I ask many things on this mailing-group, which is very
responsive.
Many times when I try to install very clever plugins I fail to do so.
Mainly because of the missing-Vim knowledge you guys have.

I decided to try it again and unfortantly failed again to follow the
instructions.
If it's not too much of your time, could you please explain what I need to
do following your 6 points.
If not thanks anyway.

I read on the script that I need to follow the 6 points mentioned.

[start of point 1]
1. Download the workspace.zip file and unzip the files to the $HOME/.vim or
the $HOME/vimfiles or the $VIM/vimfiles directory. This should unzip the
following two files (the directory structure should be preserved):

Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath'
Vim help pages for more details about installing Vim plugins.
[end of point 1]

What I did:
Download the zip file:
And stored
workspace.txt is stored in C:\Program Files\Vim\vimfiles\doc
workspace.vim C:\Program Files\Vim\vimfiles\plugin

Is this OK?
What is $HOME, how can I check this in VIM?
What is $VIM, how can I check this in VIM?
[start of point 2]
2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or
$VIM/doc/vimfiles directory, start Vim and run the ":helptags ."
command to process the workspace help file.
[end of point 2]

What I did:
I don't understand the first part. What is ment here?
I just started Vim and did typed: :helptags .
Vim did do something, don't know what.

[start of point 3]
3. If you are running a terminal/console version of Vim and the terminal
doesn't support changing the window width then set the
'Ws_Inc_Winwidth' variable to 0 in the .vimrc file.
[end of point 3]

What I did:
I ignored this, as I'm running gvim on windows xp.

[start of point 4]
[end of point 4]

What I did:
As there isn't a point 4 I went to point 5

[start of point 5]
5. Restart Vim.
[end of point 5]

What I did:
I did close gvim and restarted it.

[start of point 6]
6. You can now use the ":WsOpen <filename>" command to open a
workspace. You can use the ":help workspace" command to get
more information about using the workspace plugin.
[end of point 6]

What I did:
I typed :help workspace
Vim replied: E149: Sorry, no help for workspace

... No. These directories are only for what comes bundled with Vim. You should not change anything there, because any upgrade (maybe tomorrow, maybe next year)

Message 6 of 12
, Feb 7, 2007

0 Attachment

Eric Leenman wrote:

> Hi Yegappan,
>
>> From: "Yegappan Lakshmanan" <yegappanl@...>
>> To: "Eric Leenman" <eric.leenman@...>
> [...]
>> You can try using the workspace manager plugin:
>> http://vim.sourceforge.net/scripts/script.php?script_id=1410
>> - Yegappan
>
> I'm a simple VIM user.
> That's why I ask many things on this mailing-group, which is very
> responsive.
> Many times when I try to install very clever plugins I fail to do so.
> Mainly because of the missing-Vim knowledge you guys have.
>
> I decided to try it again and unfortantly failed again to follow the
> instructions.
> If it's not too much of your time, could you please explain what I need
> to do following your 6 points.
> If not thanks anyway.
>
> I read on the script that I need to follow the 6 points mentioned.
>
> [start of point 1]
> 1. Download the workspace.zip file and unzip the files to the $HOME/.vim
> or the $HOME/vimfiles or the $VIM/vimfiles directory. This should unzip
> the following two files (the directory structure should be preserved):
>
> plugin/workspace.vim - main workspace plugin file
> doc/workspace.txt - documentation (help) file
>
> Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath'
> Vim help pages for more details about installing Vim plugins.
> [end of point 1]
>
> What I did:
> Download the zip file:
> And stored
> workspace.txt is stored in C:\Program Files\Vim\vimfiles\doc
> workspace.vim C:\Program Files\Vim\vimfiles\plugin
>
> Is this OK?

No. These directories are only for what comes bundled with Vim. You should not
change anything there, because any upgrade (maybe tomorrow, maybe next year)
may silently undo whatever changes you had made.

> What is $HOME, how can I check this in VIM?

:echo $HOME

$HOME is your home directory. It's also where your _vimrc (and _gvimrc if you
use one) ought to be.

> What is $VIM, how can I check this in VIM?

:echo $VIM

On your system, I expect $VIM to be the directory C:\Program Files\Vim

> [start of point 2]
> 2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or
> $VIM/doc/vimfiles directory, start Vim and run the ":helptags ."
> command to process the workspace help file.
> [end of point 2]

Now you know (as shown above) where $HOME is. cd to there (in the Dos Box) and do
dir
If there is no vimfiles subdir, then you should also do
md vimfiles
Then
cd vimfiles
dir
Is there a doc dubdirectory? If not,
md doc
This is where the helpfile sould go.
Is there (in what Vim calls $HOME/vimfiles) a plugin subdirectory? If not,
md plugin
That's where the .vim should go.
Then,
gvim
:helptags ~/vimfiles/doc
( ~ is an abbreviation for $HOME). After this :helpgrep command has finished
running (and the cursor has gone back to the edit window and started blinking
again),
:help workspace.txt
ought to bring you to the first page of help for the workspace plugin.

>
> What I did:
> I don't understand the first part. What is ment here?
> I just started Vim and did typed: :helptags .
> Vim did do something, don't know what.

No prob. The instructions above should tell you how to do it.

>
> [start of point 3]
> 3. If you are running a terminal/console version of Vim and the terminal
> doesn't support changing the window width then set the
> 'Ws_Inc_Winwidth' variable to 0 in the .vimrc file.
> [end of point 3]
>
> What I did:
> I ignored this, as I'm running gvim on windows xp.

That's right, it's not for gvim. However, you can provide for it by testing in
your vimrc (there are versions of vim.exe for Windows, running in console
mode, and if you want to run them full-screen they won't be resizable. Add

if ! has("gui_running")
let g:Ws_Inc_Winwidth = 0
endif

to your vimrc. This will be ignored by gvim, because in gvim,
has("gui_running") is nonzero.

>
> [start of point 4]
> [end of point 4]
>
> What I did:
> As there isn't a point 4 I went to point 5

:-)

>
> [start of point 5]
> 5. Restart Vim.
> [end of point 5]
>
> What I did:
> I did close gvim and restarted it.

Right.

>
>
> [start of point 6]
> 6. You can now use the ":WsOpen <filename>" command to open a
> workspace. You can use the ":help workspace" command to get
> more information about using the workspace plugin.
> [end of point 6]
>
> What I did:
> I typed :help workspace
> Vim replied: E149: Sorry, no help for workspace
>
> Thanks for your time.
> Best regards,
> Eric Leenman

":help workspace.txt" (as I showed above) or ":help workspace" (as shown here)
ought to show the workspace help, one the tags file has been (re)generated (by
":helptags") in the directory containing the workspace.txt helpfile.
:help :WsOpen
also ought to show you how to use the ":WsOpen" command, about which I know
nothing.

Best regards,
Tony.
--
Yea, though I walk through the valley of the shadow of APL, I shall
fear no evil, for I can string six primitive monadic and dyadic
operators together.
-- Steve Higgins

Jürgen Krämer

Hi, ... sorry to correct you, Tony, but I think you missed the vimfiles part of those paths. C: Program Files Vim vimfiles is used for system-wide

Message 7 of 12
, Feb 7, 2007

0 Attachment

Hi,

A.J.Mechelynck wrote:

> Eric Leenman wrote:
>>
>> I read on the script that I need to follow the 6 points mentioned.
>>
>> [start of point 1]
>> 1. Download the workspace.zip file and unzip the files to the $HOME/.vim
>> or the $HOME/vimfiles or the $VIM/vimfiles directory. This should unzip
>> the following two files (the directory structure should be preserved):
>>
>> plugin/workspace.vim - main workspace plugin file
>> doc/workspace.txt - documentation (help) file
>>
>> Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath'
>> Vim help pages for more details about installing Vim plugins.
>> [end of point 1]
>>
>> What I did:
>> Download the zip file:
>> And stored
>> workspace.txt is stored in C:\Program Files\Vim\vimfiles\doc

^^^^^^^^

>> workspace.vim C:\Program Files\Vim\vimfiles\plugin

^^^^^^^^

>>
>> Is this OK?
>
> No. These directories are only for what comes bundled with Vim. You should not
> change anything there, because any upgrade (maybe tomorrow, maybe next year)
> may silently undo whatever changes you had made.

sorry to correct you, Tony, but I think you missed the "vimfiles" part of
those paths. C:\Program Files\Vim\vimfiles is used for system-wide
configuration files, not for files bundled with Vim.

[snip]

>> [start of point 2]
>> 2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or
>> $VIM/doc/vimfiles directory, start Vim and run the ":helptags ."

^^^^^^^^^^^^
Those directories are swapped -- it should have read $VIM/vimfiles/doc.

>> command to process the workspace help file.
>> [end of point 2]

An easier way to update the tags file is to just start Vim and enter

:helptags $HOME/.vim/doc
:helptags $HOME/vimfiles/doc

or

:helptags $VIM/vimfiles/doc

In you case -- because C:\Program Files\Vim corresponds to $VIM -- the
third one is the correct one. After that, :help workspace should work.

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

A.J.Mechelynck

... [...] ... [...] Oops. Right. It s C: Program Files vim vim70 (and its contents) that you shouldn t touch. Best regards, Tony. -- Confession is good for the

>>> What I did:
>>> Download the zip file:
>>> And stored
>>> workspace.txt is stored in C:\Program Files\Vim\vimfiles\doc
> ^^^^^^^^
>>> workspace.vim C:\Program Files\Vim\vimfiles\plugin
> ^^^^^^^^
>>> Is this OK?
>> No. These directories are only for what comes bundled with Vim. You should not
>> change anything there, because any upgrade (maybe tomorrow, maybe next year)
>> may silently undo whatever changes you had made.
>
> sorry to correct you, Tony, but I think you missed the "vimfiles" part of
> those paths. C:\Program Files\Vim\vimfiles is used for system-wide
> configuration files, not for files bundled with Vim.

I got it so far working.
One question.
When I give the command "af"(AddFile) in the filebuffer, the plugin comes
with
the message "give file name" (or something like that)
Do you then need to type the complete path (i.e.
C:\Projects\FPGA\VHDL\test.vhdl)
Or can you browse to it ?

Hi Eric, ... In the prompt for adding a file to the workspace, you have to enter the filename. If you are using Vim7, you can make the attached change to the

Message 10 of 12
, Feb 15, 2007

0 Attachment

Hi Eric,

On 2/14/07, Eric Leenman <eric.leenman@...> wrote:
> Hi Yeggapan,
>
> [...]
> >You can try using the workspace manager plugin:
> >
> >http://vim.sourceforge.net/scripts/script.php?script_id=1410
> [...]
>
> I got it so far working.
> One question.
> When I give the command "af"(AddFile) in the filebuffer, the plugin comes
> with
> the message "give file name" (or something like that)
> Do you then need to type the complete path (i.e.
> C:\Projects\FPGA\VHDL\test.vhdl)
> Or can you browse to it ?
>

In the prompt for adding a file to the workspace, you have to enter
the filename.
If you are using Vim7, you can make the attached change to the workspace
plugin to get filename completion at this prompt. With this change, you can
complete directory and filenames at the prompt.

What I did:
I assume you mean line 521, 527.
But when I look at the workspace.vim file the line numbers doesn't line up
with it.
Therefor I copied the whole function Ws_Add_Files
It is from line number 483--556

" Ws_Add_Files
" Add one or more files to the current group in the workspace
function! s:Ws_Add_Files(args, append)
" Get the current group
let lnum = line('.')
let cmd = s:Ws_Get_Entry_Idx_By_Line('s:ws_entry_', lnum)
if cmd == ''
" Add the new files at the end of the workgroup
let prefix="s:ws_entry"
let idx=""
endif

C:\Windows\system32\cmd.exe /c let file_names = input("Enter file name(s):
", '', 'file')
'let' is not recognized as an internal or external command, operable program
or batch file.
shell returned 1
Hit any key to close this window...