aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/session.tes
blob: 99dce526805eaa257a2bac105f7a44db647d7973 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
! Macros for saving and loading buffer sessions !

! Path of the session profile.
  Change this to save/load a custom profile !
EU[session.path]Q[$SCITECOCONFIG]/.teco_session

! Save current session to the file specified by "session.path" !
@[session.save]{
  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 '
  >
  ! 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} '
  :@EU.[session]{\.[curbuf]EB^M}

  E%.[session]Q[session.path]
  Q.[curbuf]EB
}

! Load session specified by "session.path" !
@[session.load]{
  EJ<-EF>
  EQ.x ENQ[session.path]
  Z"=
    1EB
  |
    :EMQ[session.path]
  '
}

! Call this to set up the session path unique to
  the current Git repository (if there is one) !
@[session.git]{
  ! if there is no Git repository, session.path is left as it is !
  :EG[session.path]git rev-parse --show-toplevel"S
    [* EQ[session.path] ZJ -D I/.teco_session ]*
  '
}