aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2014-11-24 20:50:25 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2014-11-24 20:53:55 +0100
commit6e5a6113af29dcc2380e6884fb49ed0e4fcbe16d (patch)
tree6ab0908e43744634d8bf25f8326faa9603b6dd73
parentad3d2f4a63cddd312cdf3571c42b420b5b23e50e (diff)
downloadsciteco-6e5a6113af29dcc2380e6884fb49ed0e4fcbe16d.tar.gz
allow disabling of buffer sessions. in sample.teco_ini, disable sessions automatically when files are given.
this allows you to use sciteco in a Git repository to edit a specific file, without changing the buffer session. Also useful if SciTECO is used as the GIT_EDITOR without thrashing the repository's session every time a commit message is edited.
-rw-r--r--lib/session.tes9
-rw-r--r--sample.teco_ini11
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/session.tes b/lib/session.tes
index 99dce52..9b924bc 100644
--- a/lib/session.tes
+++ b/lib/session.tes
@@ -1,16 +1,18 @@
! Macros for saving and loading buffer sessions !
! Path of the session profile.
- Change this to save/load a custom profile !
+ Change this to save/load a custom profile.
+ If empty, no session will be saved. !
EU[session.path]Q[$SCITECOCONFIG]/.teco_session
! Save current session to the file specified by "session.path" !
@[session.save]{
+ :Q[session.path]"= Oend '
Q*U.[curbuf]
EJ<
%.bEB ESGETFIRSTVISIBLELINEU.[fvline] ESGETXOFFSETU.[xoff] .U.[dot]
:@EU.[session]{EBQ* \.[fvline]ESSETFIRSTVISIBLELINE \.[xoff]ESSETXOFFSET \.[dot]:J^M}
- EQ* Z"= -1U.u '
+ :Q*"= -1U.u '
>
! We always start with an unnamed file in the ring, so we may have to remove it: !
Q.u"F :@EU.[session]{EB -EF^M} '
@@ -18,11 +20,12 @@ EU[session.path]Q[$SCITECOCONFIG]/.teco_session
E%.[session]Q[session.path]
Q.[curbuf]EB
-}
+!end!}
! Load session specified by "session.path" !
@[session.load]{
EJ<-EF>
+ ! now we have only one unnamed buffer !
EQ.x ENQ[session.path]
Z"=
1EB
diff --git a/sample.teco_ini b/sample.teco_ini
index 67ead44..9314859 100644
--- a/sample.teco_ini
+++ b/sample.teco_ini
@@ -8,9 +8,6 @@ EMQ[$SCITECOPATH]/color.tes
EMQ[$SCITECOPATH]/lexer.tes
EMQ[$SCITECOPATH]/session.tes
-! Uncomment to use a separate session per Git repository !
-! M[session.git] !
-
! Automatic lexing and session management using ED hooks !
@#ED{
Oadd,edit,close,quit
@@ -43,11 +40,15 @@ EMQ[$SCITECOPATH]/fnkeys.tes
! Uncomment to enable default keyboard macros !
! 0,64ED !
-! open all files specified on the commandline
- If no file is specified, load the last buffer session !
+! If files are given on the command-line, open them
+ and disable session saving.
+ Otherwise open a buffer session. !
Z"=
+ ! Uncomment to use a separate session per Git repository: !
+ ! M[session.git] !
M[session.load]
|
+ [session.path] ! disables session saving !
[.f
<:L;R 0X.f [* EBQ.f ]* L>
].f