v0.3.0 99dc266

dir.go RawHistoryFolder

1package platform
2
3import (
4	"fmt"
5	"os"
6	"path/filepath"
7)
8
9// StateDir returns the directory vev writes state to: $XDG_STATE_HOME/vev if
10// set, else ~/.local/state/vev.
11func StateDir() string {
12	if xdg := os.Getenv("XDG_STATE_HOME"); xdg != "" {
13		return filepath.Join(xdg, "vev")
14	}
15	home, err := os.UserHomeDir()
16	if err != nil || home == "" {
17		// Last resort: a per-uid temp path so state setup never aborts startup.
18		return filepath.Join(os.TempDir(), fmt.Sprintf("vev-state-%d", os.Getuid()))
19	}
20	return filepath.Join(home, ".local", "state", "vev")
21}
22
23// ConfigPath returns the user config file path: $XDG_CONFIG_HOME/vev/config if
24// set, else ~/.config/vev/config.
25func ConfigPath() string {
26	if xdg := os.Getenv("XDG_CONFIG_HOME"); xdg != "" {
27		return filepath.Join(xdg, "vev", "config")
28	}
29	home, err := os.UserHomeDir()
30	if err != nil || home == "" {
31		// Last resort: a per-uid temp path so config lookup never aborts startup.
32		return filepath.Join(os.TempDir(), fmt.Sprintf("vev-config-%d", os.Getuid()), "config")
33	}
34	return filepath.Join(home, ".config", "vev", "config")
35}
36
37// DirOrHome returns dir when it names an existing directory. Otherwise it
38// falls back to the current user's home directory, then to / as a last resort.
39func DirOrHome(dir string) string {
40	if dir != "" {
41		if st, err := os.Stat(dir); err == nil && st.IsDir() {
42			return dir
43		}
44	}
45	if home, err := os.UserHomeDir(); err == nil && home != "" {
46		return home
47	}
48	return "/"
49}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close