Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
penta-sessions
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eri! 451 von Buffellow
penta-sessions
Commits
fa8ddccc
Commit
fa8ddccc
authored
13 years ago
by
M Rawash
Browse files
Options
Downloads
Patches
Plain Diff
added 'sessionoptions' and support for saving all settings and mappings
parent
2aad770c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
penta-sessions.js
+167
-101
167 additions, 101 deletions
penta-sessions.js
with
167 additions
and
101 deletions
penta-sessions.js
+
167
−
101
View file @
fa8ddccc
...
...
@@ -4,97 +4,6 @@ Copyright (c) 2011-2012, M Rawash <mrawash@gmail.com>
Released under the most recent GPL <http://www.gnu.org/licenses/gpl.html>
*/
XML
.
ignoreWhitespace
=
false
;
XML
.
prettyPrinting
=
false
;
var
INFO
=
<
plugin
name
=
"
penta-sessions
"
version
=
"
0.1
"
href
=
"
https://github.com/gwash/penta-sessions
"
summary
=
"
Pentadactyl Session Manager
"
xmlns
=
{
NS
}
>
<
author
email
=
"
mrawash@gmail.com
"
>
M
Rawash
<
/author
>
<
license
href
=
"
http://www.gnu.org/licenses/gpl.html
"
>
GPL
<
/license
>
<
project
name
=
"
Pentadactyl
"
min
-
version
=
"
1.0
"
/>
<
p
>
This
plugin
provides
Vim
-
like
session
handeling
.
<
/p
>
<
note
>
Only
operates
on
current
window
<
/note
>
<
item
>
<
tags
>
'
sesdir
'
'
sessiondir
'
<
/tags
>
<
spec
>
'
sessiondir
'
'
sesdir
'
<
/spec
>
<
type
>
string
<
/type
>
<
default
>
{
options
.
runtimepath
}
/sessions/
<
/default
>
<
description
>
<
p
>
The
default
directory
to
save
/
load
sessions
from
.
<
/p
>
<
/description
>
<
/item
>
<
item
>
<
tags
>
'
sesfile
'
'
sessionfile
'
<
/tags
>
<
spec
>
'
sessionfile
'
'
sesfile
'
<
/spec
>
<
type
>
string
<
/type
>
<
default
><
/default
>
<
description
>
<
p
>
The
session
file
you
are
currently
working
with
,
this
will
be
set
automatically
whenever
you
save
or
load
a
session
,
but
you
can
set
it
manually
if
you
want
.
<
/p
>
<
/description
>
<
/item
>
<
item
>
<
tags
>
ss
:
sessions
:
sessionsave
:
mkses
:
mksession
<
/tags
>
<
strut
/>
<
spec
>
:
sessions
<
oa
>
ave
<
/oa><oa>!</
oa
>
<
oa
>
file
<
/oa></
spec
>
<
spec
>
ss
<
/spec
>
<
description
>
<
p
>
Saves
current
session
to
an
ExCommand
<
oa
>
file
<
/oa>, which can be restored later
with
<
ex
>
:
sessionload
<
oa
>
file
<
/oa></
ex
>
.
<
/p
>
<
p
>
If
<
oa
>
file
<
/oa> is just a basename
(
without directory path
)
, it will create a session file
with
that
name
in
the
<
o
>
sessiondir
<
/o>
.
<
example
><
ex
>
:
sessionsave
<
/ex> pythonref</
example
>
<
/p
>
<
p
>
If
no
<
oa
>
file
<
/oa> was specified it will save to a numbered file
(
based on current date
)
in <o>sessiondir</
o
>
.
<
/p
>
<
p
>
Adding
!
will
overwrite
the
file
if
it
exists
.
<
example
><
ex
>
:
sessionsave
!<
/ex> {options.runtimepath}/
sessions
/
gapi
.
penta
<
/example
>
<
/p
>
<
/description
>
<
/item
>
<
item
>
<
tags
>
sa
:
sessiona
:
sessionappend
:
sessionadd
<
/tags
>
<
strut
/>
<
spec
>
:
sessiona
<
oa
>
ppend
<
/oa><oa>!</
oa
>
<
oa
>
file
<
/oa></
spec
>
<
spec
>
sa
<
/spec
>
<
description
>
<
p
>
Appends
current
tab
to
an
existing
session
<
oa
>
file
<
/oa>. If a ! was supplied it will append all tab
s
in
current
window
instead
.
<
/p
>
<
p
>
If
<
oa
>
file
<
/oa> is a basename, it will look for it in <o>sessiondir</
o
>
.
<
/p
>
<
/description
>
<
/item
>
<
item
>
<
tags
>
sl
:
sessionl
:
sessionload
<
/tags
>
<
strut
/>
<
spec
>
:
sessionl
<
oa
>
oad
<
/oa><oa>!</
oa
>
<
oa
>
file
<
/oa></
spec
>
<
spec
>
sl
<
/spec
>
<
description
>
<
p
>
Loads
session
from
<
oa
>
file
<
/oa>, replacing all tabs in current window if no ! was added
.
<
/p
>
<
p
>
If
<
oa
>
file
<
/oa> is a basename, it will look for it in <o>sessiondir</
o
>
.
<
/p
>
<
/description
>
<
/item
>
<
/plugin>
;
var
setsessiondir
=
function
(
value
)
{
let
dir
=
io
.
File
(
value
);
...
...
@@ -120,6 +29,22 @@ group.options.add(['sessionfile', 'sesfile'],
'
string
'
,
''
)
group
.
options
.
add
([
'
sessionoptions
'
,
'
sesop
'
],
"
Set what will be saved with :sessionsave
"
,
"
stringlist
"
,
'
curdir,help,tabs
'
,
{
completer
:
function
(
context
)
[
[
"
blank
"
,
"
Empty tabs
"
],
[
"
curdir
"
,
"
Current directory
"
],
[
"
help
"
,
"
Help tabs
"
],
[
"
options
"
,
"
All options and mappings
"
],
[
"
runtime
"
,
"
Current runtime path(s)
"
],
[
"
sesdir
"
,
"
Session directory as current directory
"
],
[
"
tabs
"
,
"
Normal tabs
"
]
]
}
)
group
.
commands
.
add
([
'
sessions[ave]
'
,
'
mkses[sion]
'
],
'
Save current window
'
,
function
(
args
)
{
...
...
@@ -129,16 +54,37 @@ group.commands.add(['sessions[ave]','mkses[sion]'],
dactyl
.
assert
(
!
file
.
exists
()
||
args
.
bang
,
_
(
"
io.exists
"
,
file
.
path
.
quote
()));
let
data
=
'
" vim: set ft=pentadactyl:
\n
'
;
data
+=
'
\n
cd
'
+
io
.
cwd
.
path
;
data
+=
'
\n
se rtp=
'
+
options
.
runtimepath
;
data
+=
'
\n
se sesdir=
'
+
options
.
sessiondir
;
tabs
.
visibleTabs
.
forEach
(
function
(
tab
,
i
)
{
data
+=
'
\n
t
'
+
tab
.
linkedBrowser
.
contentDocument
.
location
.
href
;
});
let
sesop
=
options
.
sessionoptions
.
toString
();
let
lines
=
new
Array
(
'
" vim: set ft=pentadactyl:
\n
'
);
if
(
/sesdir/
.
test
(
sesop
))
lines
.
push
(
'
silent cd
'
+
options
.
sessiondir
);
else
if
(
/curdir/
.
test
(
sesop
))
lines
.
push
(
'
silent cd
'
+
io
.
cwd
.
path
);
if
(
/runtime/
.
test
(
sesop
))
lines
.
push
(
'
set runtimepath=
'
+
options
.
runtimepath
);
if
(
/options/
.
test
(
sesop
))
{
let
cmds
=
[
cmd
.
serialize
().
map
(
commands
.
commandToString
,
cmd
)
for
(
cmd
in
commands
.
iterator
())
if
(
cmd
.
serialize
)];
cmds
=
array
.
flatten
(
cmds
);
lines
=
lines
.
concat
(
cmds
);
}
if
(
/tabs/
.
test
(
sesop
))
{
tabs
.
visibleTabs
.
forEach
(
function
(
tab
,
i
)
{
let
loc
=
tab
.
linkedBrowser
.
contentDocument
.
location
.
href
;
if
(
/^dactyl:
\/\/
help
\/
/
.
test
(
loc
)
&&
!
/help/
.
test
(
sesop
))
return
;
if
(
loc
==
'
about:blank
'
&&
!
/blank/
.
test
(
sesop
))
return
;
lines
.
push
(
'
tabopen
'
+
loc
);
});
}
try
{
file
.
write
(
data
);
file
.
write
(
lines
.
join
(
'
\n
'
)
);
}
catch
(
e
)
{
dactyl
.
echoerr
(
_
(
"
io.notWriteable
"
,
file
.
path
.
quote
()));
return
;
...
...
@@ -170,10 +116,10 @@ group.commands.add(['sessiona[ppend]', 'sessionadd'],
let
data
=
''
;
if
(
args
.
bang
)
{
tabs
.
visibleTabs
.
forEach
(
function
(
tab
,
i
)
{
data
+=
'
\n
t
'
+
tab
.
linkedBrowser
.
contentDocument
.
location
.
href
;
data
+=
'
\n
t
abopen
'
+
tab
.
linkedBrowser
.
contentDocument
.
location
.
href
;
});
}
else
{
data
+=
'
\n
t
'
+
gBrowser
.
mCurrentTab
.
linkedBrowser
.
contentDocument
.
location
.
href
;
data
+=
'
\n
t
abopen
'
+
gBrowser
.
mCurrentTab
.
linkedBrowser
.
contentDocument
.
location
.
href
;
}
try
{
...
...
@@ -239,4 +185,124 @@ group.mappings.add([modes.NORMAL], ['sl'],
);
XML
.
ignoreWhitespace
=
false
;
XML
.
prettyPrinting
=
false
;
var
INFO
=
<
plugin
name
=
"
penta-sessions
"
version
=
"
0.1
"
href
=
"
https://github.com/gwash/penta-sessions
"
summary
=
"
Pentadactyl Session Manager
"
xmlns
=
{
NS
}
>
<
author
email
=
"
mrawash@gmail.com
"
>
M
Rawash
<
/author
>
<
license
href
=
"
http://www.gnu.org/licenses/gpl.html
"
>
GPL
<
/license
>
<
project
name
=
"
Pentadactyl
"
min
-
version
=
"
1.0
"
/>
<
p
>
This
plugin
provides
Vim
-
like
session
handeling
.
<
/p
>
<
note
>
Only
operates
on
current
window
<
/note
>
<
item
>
<
tags
>
'
sesdir
'
'
sessiondir
'
<
/tags
>
<
spec
>
'
sessiondir
'
'
sesdir
'
<
/spec
>
<
type
>
string
<
/type
>
<
default
>
{
options
.
get
(
"
sessiondir
"
).
stringDefaultValue
}
<
/default
>
<
description
>
<
p
>
The
default
directory
to
save
/
load
sessions
from
.
<
/p
>
<
/description
>
<
/item
>
<
item
>
<
tags
>
'
sesfile
'
'
sessionfile
'
<
/tags
>
<
spec
>
'
sessionfile
'
'
sesfile
'
<
/spec
>
<
type
>
string
<
/type
>
<
default
><
/default
>
<
description
>
<
p
>
The
session
file
you
are
currently
working
with
,
this
will
be
set
automatically
whenever
you
save
or
load
a
session
,
but
you
can
set
it
manually
if
you
want
.
<
/p
>
<
/description
>
<
/item
>
<
item
>
<
tags
>
'
sesop
'
'
sessionoptions
'
<
/tags
>
<
spec
>
'
sessionoptions
'
'
sesop
'
<
/spec
>
<
type
>
stringlist
<
/type
>
<
default
>
{
options
.
get
(
"
sessionoptions
"
).
stringDefaultValue
}
<
/default
>
<
description
>
<
p
>
Changes
the
effect
of
the
<
ex
>
:
sessionsave
<
/ex> command. It is a comm
a
separated
list
of
words
.
Each
word
enables
saving
and
restoring
something
:
<
/p
>
<
dl
>
{
template
.
map
(
options
.
get
(
"
sessionoptions
"
).
completer
(),
function
([
k
,
v
])
<><
dt
>
{
k
}
<
/dt> <dd>{v}</
dd
><
/>
)
}
<
/dl
>
<
note
>
"
sesdir
"
overrides
"
curdir
"
if
added
.
<
/note
>
<
/description
>
<
/item
>
<
item
>
<
tags
>
ss
:
sessions
:
sessionsave
:
mkses
:
mksession
<
/tags
>
<
strut
/>
<
spec
>
:
sessions
<
oa
>
ave
<
/oa><oa>!</
oa
>
<
oa
>
file
<
/oa></
spec
>
<
spec
>
ss
<
/spec
>
<
description
>
<
p
>
Saves
current
session
to
an
ExCommand
<
oa
>
file
<
/oa>, which can be
restored
later
with
<
ex
>
:
sessionload
<
oa
>
file
<
/oa></
ex
>
.
<
/p
>
<
p
>
If
<
oa
>
file
<
/oa> is just a basename
(
without directory path
)
, it wil
l
create
a
session
file
with
that
name
in
the
<
o
>
sessiondir
<
/o>
.
<
example
>
<
ex
>
:
sessionsave
<
/ex> pythonre
f
<
/example
>
<
/p
>
<
p
>
If
no
<
oa
>
file
<
/oa> was specified it will save to a numbered fil
e
(
based
on
current
date
)
in
<
o
>
sessiondir
<
/o>
.
<
/p
>
<
p
>
Adding
!
will
overwrite
the
file
if
it
exists
.
<
example
>
<
ex
>
:
sessionsave
!<
/ex> {options.runtimepath}/
sessions
/
gapi
.
penta
<
/example
>
<
/p
>
<
/description
>
<
/item
>
<
item
>
<
tags
>
sa
:
sessiona
:
sessionappend
:
sessionadd
<
/tags
>
<
strut
/>
<
spec
>
:
sessiona
<
oa
>
ppend
<
/oa><oa>!</
oa
>
<
oa
>
file
<
/oa></
spec
>
<
spec
>
sa
<
/spec
>
<
description
>
<
p
>
Appends
current
tab
to
an
existing
session
<
oa
>
file
<
/oa>. If a ! wa
s
supplied
it
will
append
all
tabs
in
current
window
instead
.
<
/p
>
<
p
>
If
<
oa
>
file
<
/oa> is a basename, it will look for it in <o>sessiondir</
o
>
.
<
/p
>
<
/description
>
<
/item
>
<
item
>
<
tags
>
sl
:
sessionl
:
sessionload
<
/tags
>
<
strut
/>
<
spec
>
:
sessionl
<
oa
>
oad
<
/oa><oa>!</
oa
>
<
oa
>
file
<
/oa></
spec
>
<
spec
>
sl
<
/spec
>
<
description
>
<
p
>
Loads
session
from
<
oa
>
file
<
/oa>, replacing all tabs in current windo
w
if
no
!
was
added
.
<
/p
>
<
p
>
If
<
oa
>
file
<
/oa> is a basename, it will look for it in <o>sessiondir</
o
>
.
<
/p
>
<
/description
>
<
/item
>
<
/plugin>
;
/* vim:se sts=4 sw=4 et: */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment